@emartech/me-idempotency 4.0.3 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/create-idempotency-fn.ts"],"sourcesContent":["export { createRedisIdempotency, defaultIdempotencyKeyGenerator } from './create-idempotency-fn'\n","import { RedisClientType } from 'redis'\n\nexport const defaultIdempotencyKeyGenerator = (...args: unknown[]) => {\n const prefix = 'idempotency'\n return [prefix].concat(args.map(arg => `${arg}`)).join(':')\n}\n\nexport const createRedisIdempotency = (client: RedisClientType, ttlInSec: number = 60 * 60 * 6) => {\n return {\n del: async (key: string) => client.del(key),\n set: async (key: string) => {\n const result = await client.set(key, '1', { EX: ttlInSec, NX: true })\n return result === 'OK'\n },\n get: async (key: string) => {\n const result = await client.get(key)\n return result !== null\n },\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/create-idempotency-fn.ts"],"sourcesContent":["export { createRedisIdempotency, defaultIdempotencyKeyGenerator } from './create-idempotency-fn'\n","import { RedisClientType } from 'redis'\n\nexport const defaultIdempotencyKeyGenerator = (...args: unknown[]) => {\n const prefix = 'idempotency'\n return [prefix].concat(args.map(arg => `${arg}`)).join(':')\n}\n\nexport const createRedisIdempotency = (client: RedisClientType, ttlInSec: number = 60 * 60 * 6) => {\n return {\n del: async (key: string) => client.del(key),\n set: async (key: string) => {\n const result = await client.set(key, '1', { EX: ttlInSec, NX: true })\n return result === 'OK'\n },\n get: async (key: string) => {\n const result = await client.get(key)\n return result !== null\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,iCAAiC,IAAI,SAAoB;AACpE,QAAM,SAAS;AACf,SAAO,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,SAAO,GAAG,GAAG,EAAE,CAAC,EAAE,KAAK,GAAG;AAC5D;AAEO,IAAM,yBAAyB,CAAC,QAAyB,WAAmB,KAAK,KAAK,MAAM;AACjG,SAAO;AAAA,IACL,KAAK,OAAO,QAAgB,OAAO,IAAI,GAAG;AAAA,IAC1C,KAAK,OAAO,QAAgB;AAC1B,YAAM,SAAS,MAAM,OAAO,IAAI,KAAK,KAAK,EAAE,IAAI,UAAU,IAAI,KAAK,CAAC;AACpE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA,KAAK,OAAO,QAAgB;AAC1B,YAAM,SAAS,MAAM,OAAO,IAAI,GAAG;AACnC,aAAO,WAAW;AAAA,IACpB;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/create-idempotency-fn.ts"],"sourcesContent":["import { RedisClientType } from 'redis'\n\nexport const defaultIdempotencyKeyGenerator = (...args: unknown[]) => {\n const prefix = 'idempotency'\n return [prefix].concat(args.map(arg => `${arg}`)).join(':')\n}\n\nexport const createRedisIdempotency = (client: RedisClientType, ttlInSec: number = 60 * 60 * 6) => {\n return {\n del: async (key: string) => client.del(key),\n set: async (key: string) => {\n const result = await client.set(key, '1', { EX: ttlInSec, NX: true })\n return result === 'OK'\n },\n get: async (key: string) => {\n const result = await client.get(key)\n return result !== null\n },\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/create-idempotency-fn.ts"],"sourcesContent":["import { RedisClientType } from 'redis'\n\nexport const defaultIdempotencyKeyGenerator = (...args: unknown[]) => {\n const prefix = 'idempotency'\n return [prefix].concat(args.map(arg => `${arg}`)).join(':')\n}\n\nexport const createRedisIdempotency = (client: RedisClientType, ttlInSec: number = 60 * 60 * 6) => {\n return {\n del: async (key: string) => client.del(key),\n set: async (key: string) => {\n const result = await client.set(key, '1', { EX: ttlInSec, NX: true })\n return result === 'OK'\n },\n get: async (key: string) => {\n const result = await client.get(key)\n return result !== null\n },\n }\n}\n"],"mappings":";;;AAEO,IAAM,iCAAiC,IAAI,SAAoB;AACpE,QAAM,SAAS;AACf,SAAO,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,SAAO,GAAG,GAAG,EAAE,CAAC,EAAE,KAAK,GAAG;AAC5D;AAEO,IAAM,yBAAyB,CAAC,QAAyB,WAAmB,KAAK,KAAK,MAAM;AACjG,SAAO;AAAA,IACL,KAAK,OAAO,QAAgB,OAAO,IAAI,GAAG;AAAA,IAC1C,KAAK,OAAO,QAAgB;AAC1B,YAAM,SAAS,MAAM,OAAO,IAAI,KAAK,KAAK,EAAE,IAAI,UAAU,IAAI,KAAK,CAAC;AACpE,aAAO,WAAW;AAAA,IACpB;AAAA,IACA,KAAK,OAAO,QAAgB;AAC1B,YAAM,SAAS,MAAM,OAAO,IAAI,GAAG;AACnC,aAAO,WAAW;AAAA,IACpB;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emartech/me-idempotency",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "Idempotency library using Redis as a backend.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": "github:emartech/me-modules",
|
|
@@ -19,13 +19,12 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"clean": "rm -rf dist",
|
|
22
|
-
"build": "tsup
|
|
22
|
+
"build": "tsup",
|
|
23
23
|
"lint": "eslint src/",
|
|
24
24
|
"format": "eslint src/ --fix",
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
26
|
"spec": "NODE_ENV=test mocha",
|
|
27
27
|
"test": "npm run lint && npm run typecheck && npm run spec",
|
|
28
|
-
"docs": "typedoc",
|
|
29
28
|
"prepublishOnly": "npm run build"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"@types/mocha": "^10.0.7",
|
|
37
36
|
"@types/sinon": "^17.0.3",
|
|
38
37
|
"chai": "^5.1.2",
|
|
39
|
-
"chai-string": "
|
|
38
|
+
"chai-string": "2.0.0",
|
|
40
39
|
"chai-subset": "1.6.0",
|
|
41
40
|
"dotenv": "^16.4.7",
|
|
42
41
|
"mocha": "^11.0.1",
|
|
@@ -46,5 +45,5 @@
|
|
|
46
45
|
"engines": {
|
|
47
46
|
"node": ">=20"
|
|
48
47
|
},
|
|
49
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "064d83ef76f3ca61fa946fc995ed7d22bbb42af4"
|
|
50
49
|
}
|