@imqueue/rpc 1.14.0 → 1.15.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imqueue/rpc",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "RPC-like client-service implementation over messaging queue",
5
5
  "keywords": [
6
6
  "redis",
@@ -15,8 +15,8 @@
15
15
  "scripts": {
16
16
  "prepublishOnly": "./node_modules/.bin/tsc",
17
17
  "test": "./node_modules/.bin/tsc && ./node_modules/.bin/nyc mocha && ./node_modules/.bin/nyc report --reporter=text-lcov && npm run test-coverage",
18
- "test-fast": "./node_modules/.bin/tsc && ./node_modules/.bin/nyc mocha && /usr/bin/env node -e \"require('open')('file://`pwd`/coverage/index.html', { wait: false })\"",
19
- "test-local": "export COVERALLS_REPO_TOKEN=$IMQ_RPC_COVERALLS_TOKEN && npm test && /usr/bin/env node -e \"require('open')('https://coveralls.io/github/imqueue/imq-rpc', { wait: false });\"",
18
+ "test-fast": "./node_modules/.bin/tsc && ./node_modules/.bin/nyc mocha && /usr/bin/env node -e \"import('open').then(open => open.default('file://`pwd`/coverage/index.html', { wait: false }))\"",
19
+ "test-local": "export COVERALLS_REPO_TOKEN=$IMQ_RPC_COVERALLS_TOKEN && npm test && /usr/bin/env node -e \"import('open').then(open => open.default('https://coveralls.io/github/imqueue/imq-rpc', { wait: false }));\"",
20
20
  "test-coverage": "cat ./coverage/lcov.info | CODECLIMATE_API_HOST=https://codebeat.co/webhooks/code_coverage CODECLIMATE_REPO_TOKEN=c2cc3954-6824-4cdf-8349-12bd9c31955a ./node_modules/.bin/codeclimate-test-reporter",
21
21
  "clean-typedefs": "find . -name '*.d.ts' -not -wholename '*node_modules*' -not -wholename '*generator*' -type f -delete",
22
22
  "clean-maps": "find . -name '*.js.map' -not -wholename '*node_modules*' -not -wholename '*generator*' -type f -delete",
@@ -25,7 +25,7 @@
25
25
  "clean-doc": "rm -rf docs",
26
26
  "clean-benchmark": "rm -rf benchmark-result",
27
27
  "clean": "npm run clean-tests && npm run clean-typedefs && npm run clean-maps && npm run clean-js && npm run clean-doc && npm run clean-benchmark",
28
- "doc": "rm -rf docs && typedoc --excludePrivate --excludeExternals --hideGenerator --exclude \"**/+(debug|test|node_modules|docs|coverage|benchmark|.nyc_output)/**/*\" --mode file --out ./docs . && /usr/bin/env node -e \"require('open')('file://`pwd`/docs/index.html', { wait: false });\""
28
+ "doc": "rm -rf docs && typedoc --excludePrivate --excludeExternals --hideGenerator --exclude \"**/+(debug|test|node_modules|docs|coverage|benchmark|.nyc_output)/**/*\" --mode file --out ./docs . && /usr/bin/env node -e \"import('open').then(open => open.default('file://`pwd`/docs/index.html', { wait: false }));\""
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -38,20 +38,20 @@
38
38
  "author": "imqueue.com <support@imqueue.com> (https://imqueue.com)",
39
39
  "license": "ISC",
40
40
  "dependencies": {
41
- "@imqueue/core": "^1.12.0",
42
- "@types/node": "^20.1.4",
43
- "acorn": "^8.8.2",
41
+ "@imqueue/core": "^1.13.0",
42
+ "@types/node": "^20.9.0",
43
+ "acorn": "^8.11.2",
44
44
  "murmurhash-native": "^3.5.0",
45
45
  "node-machine-id": "^1.1.12",
46
46
  "reflect-metadata": "^0.1.13",
47
- "typescript": "^5.0.4"
47
+ "typescript": "^5.2.2"
48
48
  },
49
49
  "devDependencies": {
50
- "@types/chai": "^4.3.5",
51
- "@types/mocha": "^10.0.1",
52
- "@types/mock-require": "^2.0.1",
53
- "@types/sinon": "^10.0.15",
54
- "chai": "^4.3.7",
50
+ "@types/chai": "^4.3.10",
51
+ "@types/mocha": "^10.0.4",
52
+ "@types/mock-require": "^2.0.3",
53
+ "@types/sinon": "^17.0.1",
54
+ "chai": "^4.3.10",
55
55
  "codeclimate-test-reporter": "^0.5.1",
56
56
  "coveralls": "^3.1.1",
57
57
  "minimist": "^1.2.8",
@@ -60,10 +60,10 @@
60
60
  "mock-require": "^3.0.3",
61
61
  "nyc": "^15.1.0",
62
62
  "open": "^9.1.0",
63
- "sinon": "^15.0.4",
63
+ "sinon": "^17.0.1",
64
64
  "source-map-support": "^0.5.21",
65
65
  "ts-node": "^10.9.1",
66
- "typedoc": "^0.24.7"
66
+ "typedoc": "^0.25.3"
67
67
  },
68
68
  "main": "index.js",
69
69
  "typescript": {
package/src/IMQCache.js CHANGED
@@ -84,7 +84,7 @@ class IMQCache {
84
84
  : adapter.name];
85
85
  }
86
86
  }
87
+ exports.IMQCache = IMQCache;
87
88
  IMQCache.options = {};
88
89
  IMQCache.adapters = {};
89
- exports.IMQCache = IMQCache;
90
90
  //# sourceMappingURL=IMQCache.js.map
package/src/IMQClient.js CHANGED
@@ -220,13 +220,13 @@ class IMQClient extends events_1.EventEmitter {
220
220
  return await generator(name, clientOptions);
221
221
  }
222
222
  }
223
+ exports.IMQClient = IMQClient;
223
224
  __decorate([
224
225
  (0, _1.remote)(),
225
226
  __metadata("design:type", Function),
226
227
  __metadata("design:paramtypes", [_1.IMQDelay]),
227
228
  __metadata("design:returntype", Promise)
228
229
  ], IMQClient.prototype, "describe", null);
229
- exports.IMQClient = IMQClient;
230
230
  /**
231
231
  * Builds and returns call resolver, which supports after call optional hook
232
232
  *
package/src/IMQLock.js CHANGED
@@ -147,6 +147,7 @@ class IMQLock {
147
147
  return !!IMQLock.acquiredLocks[key];
148
148
  }
149
149
  }
150
+ exports.IMQLock = IMQLock;
150
151
  IMQLock.acquiredLocks = {};
151
152
  IMQLock.queues = {};
152
153
  IMQLock.metadata = {};
@@ -162,5 +163,4 @@ IMQLock.deadlockTimeout = 10000;
162
163
  * @type {ILogger}
163
164
  */
164
165
  IMQLock.logger = console;
165
- exports.IMQLock = IMQLock;
166
166
  //# sourceMappingURL=IMQLock.js.map
@@ -20,7 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.IMQRPCDescription = void 0;
21
21
  class IMQRPCDescription {
22
22
  }
23
+ exports.IMQRPCDescription = IMQRPCDescription;
23
24
  IMQRPCDescription.serviceDescription = {};
24
25
  IMQRPCDescription.typesDescription = {};
25
- exports.IMQRPCDescription = IMQRPCDescription;
26
26
  //# sourceMappingURL=IMQRPCDescription.js.map
package/src/IMQService.js CHANGED
@@ -223,6 +223,7 @@ class IMQService {
223
223
  return serviceDescription;
224
224
  }
225
225
  }
226
+ exports.IMQService = IMQService;
226
227
  __decorate([
227
228
  (0, core_1.profile)(),
228
229
  __metadata("design:type", Function),
@@ -247,7 +248,6 @@ __decorate([
247
248
  __metadata("design:paramtypes", []),
248
249
  __metadata("design:returntype", Description)
249
250
  ], IMQService.prototype, "describe", null);
250
- exports.IMQService = IMQService;
251
251
  /**
252
252
  * Sends IMQ response with support of after call optional hook
253
253
  *
@@ -1,13 +1,18 @@
1
+ export interface LockOptions {
2
+ disabled?: boolean;
3
+ skipArgs?: number[];
4
+ }
1
5
  /**
2
6
  * \@lock() decorator implementation
3
7
  * Will make all simultaneous similar method calls locked to be resolved with
4
8
  * the first obtained values. Similarity is identified by a bypassed method
5
9
  * argument values.
6
10
  *
11
+ * @param {boolean|LockOptions} enabledOrOptions - whether to enable locks or not
7
12
  * @return {(
8
13
  * target: any,
9
14
  * methodName: (string),
10
15
  * descriptor: TypedPropertyDescriptor<(...args: any[]) => any>
11
16
  * ) => void}
12
17
  */
13
- export declare function lock(enabled?: boolean): (target: any, methodName: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) => void;
18
+ export declare function lock(enabledOrOptions?: boolean | LockOptions): (target: any, methodName: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) => void;
@@ -25,14 +25,21 @@ const __1 = require("..");
25
25
  * the first obtained values. Similarity is identified by a bypassed method
26
26
  * argument values.
27
27
  *
28
+ * @param {boolean|LockOptions} enabledOrOptions - whether to enable locks or not
28
29
  * @return {(
29
30
  * target: any,
30
31
  * methodName: (string),
31
32
  * descriptor: TypedPropertyDescriptor<(...args: any[]) => any>
32
33
  * ) => void}
33
34
  */
34
- function lock(enabled = true) {
35
+ function lock(enabledOrOptions = true) {
35
36
  return function (target, methodName, descriptor) {
37
+ const enabled = typeof enabledOrOptions === 'boolean'
38
+ ? enabledOrOptions
39
+ : !enabledOrOptions.disabled;
40
+ const skipArgs = typeof enabledOrOptions === 'boolean'
41
+ ? undefined
42
+ : enabledOrOptions.skipArgs;
36
43
  const original = descriptor.value;
37
44
  const className = typeof target === 'function'
38
45
  ? target.name // static
@@ -42,7 +49,7 @@ function lock(enabled = true) {
42
49
  let lock;
43
50
  let sig = '';
44
51
  if (withLocks) {
45
- sig = (0, __1.signature)(className, methodName, args);
52
+ sig = (0, __1.signature)(className, methodName, skipArgs ? args.filter((_, index) => !~skipArgs.indexOf(index)) : args);
46
53
  lock = await __1.IMQLock.acquire(sig, undefined, {
47
54
  className,
48
55
  methodName,