@imqueue/rpc 1.17.0 → 2.0.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/LICENSE +585 -13
- package/README.md +2 -1
- package/index.d.ts +16 -12
- package/index.js +16 -12
- package/package.json +15 -15
- package/src/IMQCache.d.ts +17 -11
- package/src/IMQClient.d.ts +26 -13
- package/src/IMQClient.js +49 -20
- package/src/IMQDelay.d.ts +17 -11
- package/src/IMQDelay.js +17 -11
- package/src/IMQLock.d.ts +17 -11
- package/src/IMQLock.js +8 -18
- package/src/IMQMetadata.d.ts +17 -11
- package/src/IMQRPCDescription.d.ts +17 -11
- package/src/IMQRPCDescription.js +0 -17
- package/src/IMQRPCError.d.ts +17 -11
- package/src/IMQRPCOptions.d.ts +18 -11
- package/src/IMQRPCOptions.js +17 -11
- package/src/IMQRPCRequest.d.ts +17 -11
- package/src/IMQRPCResponse.d.ts +17 -11
- package/src/IMQService.d.ts +18 -12
- package/src/IMQService.js +18 -12
- package/src/cache/ICache.d.ts +17 -11
- package/src/cache/RedisCache.d.ts +24 -17
- package/src/cache/RedisCache.js +11 -10
- package/src/cache/index.d.ts +19 -11
- package/src/cache/index.js +19 -11
- package/src/decorators/cache.d.ts +17 -11
- package/src/decorators/cache.js +17 -11
- package/src/decorators/expose.d.ts +17 -11
- package/src/decorators/expose.js +17 -11
- package/src/decorators/index.d.ts +19 -11
- package/src/decorators/index.js +19 -11
- package/src/decorators/indexed.js +19 -13
- package/src/decorators/lock.js +17 -11
- package/src/decorators/logged.d.ts +17 -11
- package/src/decorators/property.js +19 -13
- package/src/decorators/remote.d.ts +17 -11
- package/src/decorators/remote.js +17 -11
- package/src/helpers/fs.js +17 -11
- package/src/helpers/index.d.ts +18 -11
- package/src/helpers/index.js +18 -11
- package/src/helpers/os-uuid.js +17 -11
- package/src/helpers/pid.js +17 -11
- package/src/helpers/signature.js +17 -11
- package/src/index.d.ts +17 -11
- package/src/index.js +17 -11
package/index.js
CHANGED
|
@@ -15,21 +15,25 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*!
|
|
18
|
-
* I
|
|
18
|
+
* I'm Queue Software Project
|
|
19
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
+
* This program is free software: you can redistribute it and/or modify
|
|
22
|
+
* it under the terms of the GNU General Public License as published by
|
|
23
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
* (at your option) any later version.
|
|
21
25
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
26
|
+
* This program is distributed in the hope that it will be useful,
|
|
27
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
* GNU General Public License for more details.
|
|
25
30
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
31
|
+
* You should have received a copy of the GNU General Public License
|
|
32
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
33
|
+
*
|
|
34
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
35
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
36
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
33
37
|
*/
|
|
34
38
|
__exportStar(require("./src"), exports);
|
|
35
39
|
__exportStar(require("@imqueue/core"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imqueue/rpc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "RPC-like client-service implementation over messaging queue",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"redis",
|
|
@@ -36,34 +36,34 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://imqueue.com/",
|
|
38
38
|
"author": "imqueue.com <support@imqueue.com> (https://imqueue.com)",
|
|
39
|
-
"license": "
|
|
39
|
+
"license": "GPL-3.0-only",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@imqueue/core": "^
|
|
42
|
-
"@types/node": "^
|
|
43
|
-
"acorn": "^8.
|
|
44
|
-
"farmhash": "^4.0.
|
|
41
|
+
"@imqueue/core": "^2.0.0",
|
|
42
|
+
"@types/node": "^24.0.8",
|
|
43
|
+
"acorn": "^8.15.0",
|
|
44
|
+
"farmhash": "^4.0.2",
|
|
45
45
|
"node-machine-id": "^1.1.12",
|
|
46
46
|
"reflect-metadata": "^0.2.2",
|
|
47
|
-
"typescript": "^5.
|
|
47
|
+
"typescript": "^5.8.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/chai": "^5.
|
|
51
|
-
"@types/mocha": "^10.0.
|
|
50
|
+
"@types/chai": "^5.2.2",
|
|
51
|
+
"@types/mocha": "^10.0.10",
|
|
52
52
|
"@types/mock-require": "^3.0.0",
|
|
53
|
-
"@types/sinon": "^17.0.
|
|
54
|
-
"chai": "^
|
|
53
|
+
"@types/sinon": "^17.0.4",
|
|
54
|
+
"chai": "^5.2.0",
|
|
55
55
|
"codeclimate-test-reporter": "^0.5.1",
|
|
56
56
|
"coveralls-next": "^4.2.1",
|
|
57
57
|
"minimist": "^1.2.8",
|
|
58
|
-
"mocha": "^
|
|
58
|
+
"mocha": "^11.7.1",
|
|
59
59
|
"mocha-lcov-reporter": "^1.3.0",
|
|
60
60
|
"mock-require": "^3.0.3",
|
|
61
61
|
"nyc": "^17.1.0",
|
|
62
|
-
"open": "^10.1.
|
|
63
|
-
"sinon": "^
|
|
62
|
+
"open": "^10.1.2",
|
|
63
|
+
"sinon": "^21.0.0",
|
|
64
64
|
"source-map-support": "^0.5.21",
|
|
65
65
|
"ts-node": "^10.9.2",
|
|
66
|
-
"typedoc": "^0.
|
|
66
|
+
"typedoc": "^0.28.7"
|
|
67
67
|
},
|
|
68
68
|
"main": "index.js",
|
|
69
69
|
"typescript": {
|
package/src/IMQCache.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* IMQCache implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
17
23
|
*/
|
|
18
24
|
import { ICache, ICacheAdapter } from '.';
|
|
19
25
|
/**
|
package/src/IMQClient.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* IMQClient implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
17
23
|
*/
|
|
18
24
|
import { JsonObject } from '@imqueue/core';
|
|
19
25
|
import { IMQClientOptions, IMQRPCResponse, IMQRPCRequest, IMQDelay, Description } from '.';
|
|
@@ -25,25 +31,32 @@ export declare abstract class IMQClient extends EventEmitter {
|
|
|
25
31
|
readonly options: IMQClientOptions;
|
|
26
32
|
readonly id: number;
|
|
27
33
|
readonly name: string;
|
|
34
|
+
readonly hostName: string;
|
|
28
35
|
readonly serviceName: string;
|
|
36
|
+
readonly queueName: string;
|
|
29
37
|
private readonly baseName;
|
|
30
|
-
private imq;
|
|
38
|
+
private readonly imq;
|
|
39
|
+
private readonly subscriptionImq;
|
|
40
|
+
private static singleImq;
|
|
31
41
|
private readonly logger;
|
|
32
42
|
private resolvers;
|
|
33
43
|
/**
|
|
34
44
|
* Class constructor
|
|
35
45
|
*
|
|
36
46
|
* @constructor
|
|
37
|
-
* @param {Partial<
|
|
47
|
+
* @param {Partial<IMQClientOptions>} options
|
|
38
48
|
* @param {string} serviceName
|
|
39
49
|
* @param {string} name
|
|
40
50
|
*/
|
|
41
51
|
constructor(options?: Partial<IMQClientOptions>, serviceName?: string, name?: string);
|
|
52
|
+
private createImq;
|
|
53
|
+
private createSubscriptionImq;
|
|
42
54
|
/**
|
|
43
55
|
* Sends call to remote service method
|
|
44
56
|
*
|
|
45
57
|
* @access protected
|
|
46
58
|
* @param {...any[]} args
|
|
59
|
+
* @template T
|
|
47
60
|
* @returns {Promise<T>}
|
|
48
61
|
*/
|
|
49
62
|
protected remoteCall<T>(...args: any[]): Promise<T>;
|
package/src/IMQClient.js
CHANGED
|
@@ -15,19 +15,25 @@ exports.imqCallRejector = imqCallRejector;
|
|
|
15
15
|
/*!
|
|
16
16
|
* IMQClient implementation
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* I'm Queue Software Project
|
|
19
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* This program is free software: you can redistribute it and/or modify
|
|
22
|
+
* it under the terms of the GNU General Public License as published by
|
|
23
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
24
|
+
* (at your option) any later version.
|
|
23
25
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
26
|
+
* This program is distributed in the hope that it will be useful,
|
|
27
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
28
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
29
|
+
* GNU General Public License for more details.
|
|
30
|
+
*
|
|
31
|
+
* You should have received a copy of the GNU General Public License
|
|
32
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
33
|
+
*
|
|
34
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
35
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
36
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
31
37
|
*/
|
|
32
38
|
const core_1 = require("@imqueue/core");
|
|
33
39
|
const _1 = require(".");
|
|
@@ -46,11 +52,12 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
46
52
|
* Class constructor
|
|
47
53
|
*
|
|
48
54
|
* @constructor
|
|
49
|
-
* @param {Partial<
|
|
55
|
+
* @param {Partial<IMQClientOptions>} options
|
|
50
56
|
* @param {string} serviceName
|
|
51
57
|
* @param {string} name
|
|
52
58
|
*/
|
|
53
59
|
constructor(options, serviceName, name) {
|
|
60
|
+
var _a;
|
|
54
61
|
super();
|
|
55
62
|
this.resolvers = {};
|
|
56
63
|
const baseName = name || this.constructor.name;
|
|
@@ -62,26 +69,46 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
62
69
|
this.options = Object.assign(Object.assign({}, _1.DEFAULT_IMQ_CLIENT_OPTIONS), options);
|
|
63
70
|
this.id = (0, _1.pid)(baseName);
|
|
64
71
|
this.logger = this.options.logger || /* istanbul ignore next */ console;
|
|
65
|
-
this.
|
|
72
|
+
this.hostName = ((_a = IMQClient.singleImq) === null || _a === void 0 ? void 0 : _a.name) ||
|
|
73
|
+
`${(0, _1.osUuid)()}-${this.id}:client`;
|
|
74
|
+
this.name = `${baseName}-${this.hostName}`;
|
|
66
75
|
this.serviceName = serviceName || baseName.replace(/Client$/, '');
|
|
67
|
-
this.
|
|
76
|
+
this.queueName = this.options.singleQueue ? this.hostName : this.name;
|
|
77
|
+
this.imq = this.createImq();
|
|
78
|
+
this.subscriptionImq = this.createSubscriptionImq();
|
|
68
79
|
_1.SIGNALS.forEach((signal) => process.on(signal, async () => {
|
|
69
80
|
this.destroy().catch(this.logger.error);
|
|
70
81
|
// istanbul ignore next
|
|
71
82
|
setTimeout(() => process.exit(0), core_1.IMQ_SHUTDOWN_TIMEOUT);
|
|
72
83
|
}));
|
|
73
84
|
}
|
|
85
|
+
createImq() {
|
|
86
|
+
if (!this.options.singleQueue) {
|
|
87
|
+
return core_1.default.create(this.queueName, this.options);
|
|
88
|
+
}
|
|
89
|
+
if (!IMQClient.singleImq) {
|
|
90
|
+
IMQClient.singleImq = core_1.default.create(this.queueName, this.options);
|
|
91
|
+
}
|
|
92
|
+
return IMQClient.singleImq;
|
|
93
|
+
}
|
|
94
|
+
createSubscriptionImq() {
|
|
95
|
+
if (!this.options.singleQueue) {
|
|
96
|
+
return this.imq;
|
|
97
|
+
}
|
|
98
|
+
return core_1.default.create(this.name, this.options);
|
|
99
|
+
}
|
|
74
100
|
/**
|
|
75
101
|
* Sends call to remote service method
|
|
76
102
|
*
|
|
77
103
|
* @access protected
|
|
78
104
|
* @param {...any[]} args
|
|
105
|
+
* @template T
|
|
79
106
|
* @returns {Promise<T>}
|
|
80
107
|
*/
|
|
81
108
|
async remoteCall(...args) {
|
|
82
109
|
const logger = this.options.logger || console;
|
|
83
110
|
const method = args.pop();
|
|
84
|
-
const from = this.
|
|
111
|
+
const from = this.queueName;
|
|
85
112
|
const to = this.serviceName;
|
|
86
113
|
let delay = 0;
|
|
87
114
|
let metadata;
|
|
@@ -130,7 +157,7 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
130
157
|
* @return {Promise<void>}
|
|
131
158
|
*/
|
|
132
159
|
async subscribe(handler) {
|
|
133
|
-
return this.
|
|
160
|
+
return this.subscriptionImq.subscribe(this.name, handler);
|
|
134
161
|
}
|
|
135
162
|
// noinspection JSUnusedGlobalSymbols
|
|
136
163
|
/**
|
|
@@ -139,7 +166,7 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
139
166
|
* @return {Promise<void>}
|
|
140
167
|
*/
|
|
141
168
|
async unsubscribe() {
|
|
142
|
-
return this.
|
|
169
|
+
return this.subscriptionImq.unsubscribe();
|
|
143
170
|
}
|
|
144
171
|
// noinspection JSUnusedGlobalSymbols
|
|
145
172
|
/**
|
|
@@ -150,7 +177,7 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
150
177
|
* @return {Promise<void>}
|
|
151
178
|
*/
|
|
152
179
|
async broadcast(payload) {
|
|
153
|
-
return this.imq.publish(payload, this.
|
|
180
|
+
return this.imq.publish(payload, this.queueName);
|
|
154
181
|
}
|
|
155
182
|
/**
|
|
156
183
|
* Initializes client work
|
|
@@ -165,7 +192,7 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
165
192
|
// istanbul ignore if
|
|
166
193
|
if (!this.resolvers[message.to]) {
|
|
167
194
|
// when there is no resolvers it means
|
|
168
|
-
// we have
|
|
195
|
+
// we have message in queue which was initiated
|
|
169
196
|
// by some process which is broken. So we provide an
|
|
170
197
|
// ability to handle enqueued messages via EventEmitter
|
|
171
198
|
// interface
|
|
@@ -179,7 +206,9 @@ class IMQClient extends events_1.EventEmitter {
|
|
|
179
206
|
}
|
|
180
207
|
resolve && resolve(message.data, message);
|
|
181
208
|
});
|
|
182
|
-
|
|
209
|
+
if (this.imq) {
|
|
210
|
+
await this.imq.start();
|
|
211
|
+
}
|
|
183
212
|
}
|
|
184
213
|
// noinspection JSUnusedGlobalSymbols
|
|
185
214
|
/**
|
package/src/IMQDelay.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* IMQDelay implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
17
23
|
*/
|
|
18
24
|
export declare class IMQDelay {
|
|
19
25
|
timer: number;
|
package/src/IMQDelay.js
CHANGED
|
@@ -4,19 +4,25 @@ exports.IMQDelay = void 0;
|
|
|
4
4
|
/*!
|
|
5
5
|
* IMQDelay implementation
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* I'm Queue Software Project
|
|
8
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
8
9
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* This program is free software: you can redistribute it and/or modify
|
|
11
|
+
* it under the terms of the GNU General Public License as published by
|
|
12
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
13
|
+
* (at your option) any later version.
|
|
12
14
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* This program is distributed in the hope that it will be useful,
|
|
16
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
* GNU General Public License for more details.
|
|
19
|
+
*
|
|
20
|
+
* You should have received a copy of the GNU General Public License
|
|
21
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
*
|
|
23
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
24
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
25
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
20
26
|
*/
|
|
21
27
|
class IMQDelay {
|
|
22
28
|
get ms() {
|
package/src/IMQLock.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* IMQLock implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
17
23
|
*/
|
|
18
24
|
import { ILogger } from '@imqueue/core';
|
|
19
25
|
export type AcquiredLock<T> = T | boolean;
|
package/src/IMQLock.js
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* IMQLock implementation
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2018, imqueue.com <support@imqueue.com>
|
|
6
|
-
*
|
|
7
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
9
|
-
* copyright notice and this permission notice appear in all copies.
|
|
10
|
-
*
|
|
11
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
*/
|
|
19
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
3
|
exports.IMQLock = void 0;
|
|
21
4
|
/**
|
|
@@ -80,7 +63,14 @@ class IMQLock {
|
|
|
80
63
|
if (IMQLock.deadlockTimeout) {
|
|
81
64
|
// avoid dead-locks using timeouts
|
|
82
65
|
timer = setTimeout(() => {
|
|
83
|
-
|
|
66
|
+
let dumpStr = '';
|
|
67
|
+
try {
|
|
68
|
+
dumpStr = JSON.stringify(IMQLock.metadata[key]);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
dumpStr = 'Unable to stringify metadata';
|
|
72
|
+
}
|
|
73
|
+
const err = new Error(`Lock timeout, "${key}" call rejected, metadata: ${dumpStr}`);
|
|
84
74
|
clearTimeout(timer);
|
|
85
75
|
timer = null;
|
|
86
76
|
IMQLock.release(key, null, err);
|
package/src/IMQMetadata.d.ts
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* IMQMetadata implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
17
23
|
*/
|
|
18
24
|
import { AnyJson, JsonObject } from '@imqueue/core';
|
|
19
25
|
export declare class IMQMetadata {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* IMQRPCDescription implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* I'm Queue Software Project
|
|
5
|
+
* Copyright (C) 2025 imqueue.com <support@imqueue.com>
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*
|
|
20
|
+
* If you want to use this code in a closed source (commercial) project, you can
|
|
21
|
+
* purchase a proprietary commercial license. Please contact us at
|
|
22
|
+
* <support@imqueue.com> to get commercial licensing options.
|
|
17
23
|
*/
|
|
18
24
|
/**
|
|
19
25
|
* Method argument description
|
package/src/IMQRPCDescription.js
CHANGED
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* IMQRPCDescription implementation
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2018, imqueue.com <support@imqueue.com>
|
|
6
|
-
*
|
|
7
|
-
* Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
* purpose with or without fee is hereby granted, provided that the above
|
|
9
|
-
* copyright notice and this permission notice appear in all copies.
|
|
10
|
-
*
|
|
11
|
-
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
* PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
*/
|
|
19
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
3
|
exports.IMQRPCDescription = void 0;
|
|
21
4
|
class IMQRPCDescription {
|