Skip to content

Commit

Permalink
feat: 🎸 add namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
haozi committed Mar 15, 2024
1 parent d01e5a4 commit ddad27d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 38 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "idmp",
"version": "1.15.2",
"version": "1.15.3",
"keywords": [
"deduplicate network requests",
"idempotent function",
Expand Down Expand Up @@ -50,7 +50,7 @@
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.27",
"@types/node": "^20.11.28",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@vitejs/plugin-legacy": "^5.3.2",
Expand Down
3 changes: 2 additions & 1 deletion plugins/node-fs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ const getData = async <T = any>(key: string) => {

type NonVoid<T> = T extends void ? never : T

const fsIdmpWrap = (_idmp: Idmp) => {
const fsIdmpWrap = (_idmp: Idmp, namespace = '') => {
const newIdmp = <T>(
globalKey: string,
promiseFunc: IdmpPromise<NonVoid<T>>,
options?: IdmpOptions,
) => {
globalKey = `${namespace}_${globalKey}`
const finalOptions = getOptions(options)
return _idmp(
globalKey,
Expand Down
70 changes: 35 additions & 35 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ddad27d

Please sign in to comment.