@emartech/me-idempotency 3.0.17 → 3.0.18

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.18](https://github.com/emartech/me-modules/compare/@emartech/me-idempotency@3.0.17...@emartech/me-idempotency@3.0.18) (2024-08-04)
7
+
8
+ **Note:** Version bump only for package @emartech/me-idempotency
9
+
10
+
11
+
12
+
13
+
6
14
  ## [3.0.17](https://github.com/emartech/me-modules/compare/@emartech/me-idempotency@3.0.16...@emartech/me-idempotency@3.0.17) (2024-04-09)
7
15
 
8
16
  **Note:** Version bump only for package @emartech/me-idempotency
@@ -0,0 +1,17 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import tseslint from 'typescript-eslint';
5
+
6
+ export default tseslint.config({
7
+ files: ['**/*.ts'],
8
+ extends: [
9
+ eslint.configs.recommended,
10
+ ...tseslint.configs.recommended,
11
+ ]
12
+ }, {
13
+ files: ["**/*.spec.ts"],
14
+ rules: {
15
+ "@typescript-eslint/no-unused-expressions": "off"
16
+ }
17
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emartech/me-idempotency",
3
- "version": "3.0.17",
3
+ "version": "3.0.18",
4
4
  "description": "",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/emartech/me-modules/tree/master/modules/me-idempotency",
@@ -16,42 +16,39 @@
16
16
  "types": "dist/index.d.ts",
17
17
  "scripts": {
18
18
  "clean": "rm -rf dist",
19
- "build": "npm run clean && tsc",
19
+ "prebuild": "npm run clean",
20
+ "build": "tsc --project tsconfig.build.json",
20
21
  "build-docs": "rm -rf docs && typedoc --out docs --target es2018 --theme markdown --exclude 'test/**'",
21
- "lint": "eslint ./src --ext .ts",
22
- "format": "npm run lint -- --fix",
22
+ "lint": "eslint .",
23
+ "format": "eslint . --fix",
23
24
  "test": "NODE_ENV=test mocha -r dotenv/config -r ts-node/register '**/*.spec.ts'",
24
25
  "prepublishOnly": "npm run build"
25
26
  },
26
27
  "dependencies": {
27
- "redis": "^4.6.10"
28
+ "redis": "^4.7.0"
28
29
  },
29
30
  "devDependencies": {
30
- "@tsconfig/node18": "^18.2.2",
31
- "@types/chai": "^4.2.10",
32
- "@types/mocha": "^10.0.3",
33
- "@types/node": "^18.18.7",
34
- "@types/sinon": "^17.0.1",
35
- "@typescript-eslint/eslint-plugin": "^7.0.1",
36
- "@typescript-eslint/parser": "^7.0.1",
37
- "@typescript-eslint/typescript-estree": "^7.0.1",
31
+ "@eslint/js": "^9.8.0",
32
+ "@tsconfig/node18": "^18.2.4",
33
+ "@types/chai": "^4.3.17",
34
+ "@types/eslint__js": "^8.42.3",
35
+ "@types/mocha": "^10.0.7",
36
+ "@types/node": "^18.19.43",
37
+ "@types/sinon": "^17.0.3",
38
38
  "chai": "^4.3.10",
39
39
  "chai-string": "1.5.0",
40
40
  "chai-subset": "1.6.0",
41
- "dotenv": "^16.3.1",
42
- "eslint": "^8.52.0",
43
- "eslint-config-prettier": "^9.0.0",
44
- "eslint-plugin-mocha": "^10.2.0",
45
- "eslint-plugin-prettier": "^5.0.1",
46
- "mocha": "^10.2.0",
47
- "prettier": "3.2.5",
48
- "sinon": "17.0.1",
49
- "sinon-chai": "3.7.0",
41
+ "dotenv": "^16.4.5",
42
+ "eslint": "^9.8.0",
43
+ "mocha": "^10.7.0",
44
+ "sinon": "18.0.0",
45
+ "sinon-chai": "^3.7.0",
50
46
  "ts-node": "10.9.2",
51
- "typescript": "5.4.4"
47
+ "typescript": "5.5.4",
48
+ "typescript-eslint": "^8.0.0"
52
49
  },
53
50
  "engines": {
54
51
  "node": ">=18"
55
52
  },
56
- "gitHead": "a6ec46b5cbc00a8e9a50549e273ac4c50cfa790f"
53
+ "gitHead": "ff08781b12c6e641384e2781e6cccf1f0fa693de"
57
54
  }
@@ -0,0 +1,5 @@
1
+
2
+ {
3
+ "extends": "./tsconfig.json",
4
+ "exclude": ["src/**/*.spec.ts"]
5
+ }
package/tsconfig.json CHANGED
@@ -1,11 +1,6 @@
1
1
  {
2
2
  "extends": "@tsconfig/node18/tsconfig.json",
3
- "exclude": [
4
- "dist",
5
- "node_modules"
6
- ],
7
3
  "compilerOptions": {
8
- "baseUrl": "./",
9
4
  "rootDir": "./",
10
5
  "outDir": "./dist",
11
6
  "declaration": true,
package/.eslintrc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "extends": [
3
- "eslint:recommended",
4
- "plugin:mocha/recommended",
5
- "plugin:@typescript-eslint/recommended",
6
- "plugin:prettier/recommended"
7
- ],
8
- "rules": {
9
- "mocha/no-mocha-arrows": 0,
10
- "mocha/no-setup-in-describe": 0
11
- }
12
- }
package/.prettierrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "tabWidth": 2,
3
- "semi": false,
4
- "singleQuote": true,
5
- "printWidth": 120
6
- }
@@ -1 +0,0 @@
1
- import 'mocha';
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- require("mocha");
5
- const redis_1 = require("redis");
6
- const create_idempotency_fn_1 = require("./create-idempotency-fn");
7
- describe('me-idempotency', () => {
8
- describe('defaultIdempotencyKeyGenerator', () => {
9
- it('should generate a string key', () => {
10
- const key = (0, create_idempotency_fn_1.defaultIdempotencyKeyGenerator)(1, 'str', true);
11
- (0, chai_1.expect)(key).to.eql('idempotency:1:str:true');
12
- });
13
- });
14
- describe('createRedisIdempotency', () => {
15
- const key = `testIdemp-${new Date().toISOString()}`;
16
- let redisClient;
17
- let idemp;
18
- before(async () => {
19
- redisClient = (0, redis_1.createClient)({ url: process.env.REDIS_URL });
20
- await redisClient.connect();
21
- idemp = (0, create_idempotency_fn_1.createRedisIdempotency)(redisClient);
22
- });
23
- afterEach(() => idemp.del(key));
24
- after(() => redisClient.quit());
25
- it('should set a new key and return true', async () => {
26
- const result = await idemp.set(key);
27
- (0, chai_1.expect)(result).to.eql(true);
28
- });
29
- it('should return false setting the key twice', async () => {
30
- await idemp.set(key);
31
- const result = await idemp.set(key);
32
- (0, chai_1.expect)(result).to.eql(false);
33
- });
34
- it('should delete the key and return the number of deleted key', async () => {
35
- await idemp.set(key);
36
- const result = await idemp.del(key);
37
- const resultSecondDeletion = await idemp.del(key);
38
- (0, chai_1.expect)(result).to.eql(1);
39
- (0, chai_1.expect)(resultSecondDeletion).to.eql(0);
40
- });
41
- it('should return true when getting existing key', async () => {
42
- await idemp.set(key);
43
- const result = await idemp.get(key);
44
- (0, chai_1.expect)(result).to.eql(true);
45
- });
46
- it('should return false when getting non-existing key', async () => {
47
- const result = await idemp.get('i-do-not-exist');
48
- (0, chai_1.expect)(result).to.eql(false);
49
- });
50
- });
51
- });
52
- //# sourceMappingURL=create-idempotency-fn.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-idempotency-fn.spec.js","sourceRoot":"","sources":["../../src/create-idempotency-fn.spec.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,iBAAc;AACd,iCAAqD;AACrD,mEAAgG;AAEhG,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;QAC9C,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;YACtC,MAAM,GAAG,GAAG,IAAA,sDAA8B,EAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;YAC1D,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,GAAG,GAAG,aAAa,IAAI,IAAI,EAAE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