@imqueue/rpc 3.2.0 → 3.2.1

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.
Files changed (54) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +2 -18
  3. package/package.json +6 -2
  4. package/src/IMQCache.d.ts +1 -24
  5. package/src/IMQCache.js +37 -6
  6. package/src/IMQClient.d.ts +2 -2
  7. package/src/IMQClient.js +53 -86
  8. package/src/IMQDelay.js +1 -5
  9. package/src/IMQLock.d.ts +2 -2
  10. package/src/IMQLock.js +26 -6
  11. package/src/IMQMetadata.d.ts +1 -1
  12. package/src/IMQMetadata.js +25 -5
  13. package/src/IMQRPCDescription.js +1 -5
  14. package/src/IMQRPCError.d.ts +1 -1
  15. package/src/IMQRPCError.js +27 -7
  16. package/src/IMQRPCOptions.d.ts +5 -5
  17. package/src/IMQRPCOptions.js +10 -9
  18. package/src/IMQRPCRequest.d.ts +2 -2
  19. package/src/IMQRPCRequest.js +25 -2
  20. package/src/IMQRPCResponse.d.ts +2 -2
  21. package/src/IMQRPCResponse.js +25 -2
  22. package/src/IMQRequestContext.d.ts +2 -2
  23. package/src/IMQRequestContext.js +6 -8
  24. package/src/IMQService.d.ts +2 -2
  25. package/src/IMQService.js +36 -75
  26. package/src/cache/ICache.js +1 -2
  27. package/src/cache/RedisCache.d.ts +3 -23
  28. package/src/cache/RedisCache.js +14 -17
  29. package/src/cache/index.d.ts +2 -2
  30. package/src/cache/index.js +2 -18
  31. package/src/decorators/cache.d.ts +1 -1
  32. package/src/decorators/cache.js +14 -15
  33. package/src/decorators/classType.js +3 -6
  34. package/src/decorators/expose.js +6 -9
  35. package/src/decorators/index.d.ts +9 -9
  36. package/src/decorators/index.js +9 -25
  37. package/src/decorators/indexed.d.ts +1 -1
  38. package/src/decorators/indexed.js +6 -9
  39. package/src/decorators/lock.js +8 -11
  40. package/src/decorators/logged.d.ts +1 -1
  41. package/src/decorators/logged.js +25 -4
  42. package/src/decorators/metadata.js +1 -2
  43. package/src/decorators/property.js +7 -11
  44. package/src/decorators/remote.js +1 -4
  45. package/src/helpers/fs.js +7 -12
  46. package/src/helpers/index.d.ts +4 -4
  47. package/src/helpers/index.js +4 -20
  48. package/src/helpers/os-uuid.js +5 -8
  49. package/src/helpers/pid.d.ts +1 -1
  50. package/src/helpers/pid.js +12 -16
  51. package/src/helpers/signature.js +3 -6
  52. package/src/index.d.ts +14 -14
  53. package/src/index.js +14 -30
  54. package/tsconfig.json +5 -2
@@ -1,4 +1,4 @@
1
- import { ILogger } from '@imqueue/core';
1
+ import { type ILogger } from '@imqueue/core';
2
2
  /**
3
3
  * OS signals that should trigger pid file cleanup on process termination.
4
4
  */
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IMQ_PID_DIR = exports.IMQ_TMP_DIR = exports.SIGNALS = void 0;
4
- exports.pid = pid;
5
- exports.forgetPid = forgetPid;
6
1
  /*!
7
2
  * IMQ-RPC helpers: pid, forgetPid
8
3
  *
@@ -26,20 +21,21 @@ exports.forgetPid = forgetPid;
26
21
  * purchase a proprietary commercial license. Please contact us at
27
22
  * <support@imqueue.com> to get commercial licensing options.
28
23
  */
29
- const node_path_1 = require("node:path");
30
- const node_fs_1 = require("node:fs");
24
+ import { resolve } from 'node:path';
25
+ import { existsSync, mkdirSync, writeFileSync, unlinkSync } from 'node:fs';
26
+ import {} from '@imqueue/core';
31
27
  /**
32
28
  * OS signals that should trigger pid file cleanup on process termination.
33
29
  */
34
- exports.SIGNALS = ['SIGTERM', 'SIGINT', 'SIGHUP', 'SIGQUIT'];
30
+ export const SIGNALS = ['SIGTERM', 'SIGINT', 'SIGHUP', 'SIGQUIT'];
35
31
  /**
36
32
  * Base temporary directory used by imq-rpc.
37
33
  */
38
- exports.IMQ_TMP_DIR = process.env.TMPDIR || '/tmp';
34
+ export const IMQ_TMP_DIR = process.env.TMPDIR || '/tmp';
39
35
  /**
40
36
  * Directory where imq-rpc stores its pid files.
41
37
  */
42
- exports.IMQ_PID_DIR = (0, node_path_1.resolve)(exports.IMQ_TMP_DIR, '.imq-rpc');
38
+ export const IMQ_PID_DIR = resolve(IMQ_TMP_DIR, '.imq-rpc');
43
39
  /**
44
40
  * Returns an increment-based process identifier for the given service name,
45
41
  * creating the corresponding pid file under the given directory.
@@ -48,17 +44,17 @@ exports.IMQ_PID_DIR = (0, node_path_1.resolve)(exports.IMQ_TMP_DIR, '.imq-rpc');
48
44
  * @param {string} [path] - directory to store the pid file in
49
45
  * @returns {number} - the allocated increment-based identifier
50
46
  */
51
- function pid(name, path = exports.IMQ_PID_DIR) {
47
+ export function pid(name, path = IMQ_PID_DIR) {
52
48
  const pidFile = `${path}/${name}`;
53
49
  const pidOpts = { encoding: 'utf8', flag: 'wx' };
54
- if (!(0, node_fs_1.existsSync)(path)) {
55
- (0, node_fs_1.mkdirSync)(path);
50
+ if (!existsSync(path)) {
51
+ mkdirSync(path);
56
52
  }
57
53
  let id = 0;
58
54
  let done = false;
59
55
  while (!done) {
60
56
  try {
61
- (0, node_fs_1.writeFileSync)(`${pidFile}-${id}.pid`, process.pid + '', pidOpts);
57
+ writeFileSync(`${pidFile}-${id}.pid`, process.pid + '', pidOpts);
62
58
  done = true;
63
59
  }
64
60
  catch (err) {
@@ -80,9 +76,9 @@ function pid(name, path = exports.IMQ_PID_DIR) {
80
76
  * @param {ILogger} logger - logger instance
81
77
  * @param {string} [path] - directory the pid file is stored in
82
78
  */
83
- function forgetPid(name, id, logger, path = exports.IMQ_PID_DIR) {
79
+ export function forgetPid(name, id, logger, path = IMQ_PID_DIR) {
84
80
  try {
85
- (0, node_fs_1.unlinkSync)(`${path}/${name}-${id}.pid`);
81
+ unlinkSync(`${path}/${name}-${id}.pid`);
86
82
  }
87
83
  catch {
88
84
  /* ignore */
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.signature = signature;
4
1
  /*!
5
2
  * IMQ-RPC helpers: signature
6
3
  *
@@ -24,7 +21,7 @@ exports.signature = signature;
24
21
  * purchase a proprietary commercial license. Please contact us at
25
22
  * <support@imqueue.com> to get commercial licensing options.
26
23
  */
27
- const node_crypto_1 = require("node:crypto");
24
+ import { hash } from 'node:crypto';
28
25
  /**
29
26
  * Serializes a value into a deterministic, JSON-compatible string. It mirrors
30
27
  * `JSON.stringify` semantics (including `toJSON` support and how `undefined`,
@@ -102,11 +99,11 @@ function serialize(value, ancestors) {
102
99
  * @param {readonly unknown[]} args - arguments passed to the method
103
100
  * @returns {string} - hexadecimal hash string
104
101
  */
105
- function signature(className, methodName, args) {
102
+ export function signature(className, methodName, args) {
106
103
  const data = serialize([className, methodName, args], []);
107
104
  // one-shot native hash truncated to 64 bits (16 hex chars) — same key
108
105
  // space as the previous farmhash fingerprint64, but ~3-4x faster per
109
106
  // call on typical payloads (no WASM boundary, no bigint conversion)
110
- return (0, node_crypto_1.hash)('sha256', data, 'hex').slice(0, 16);
107
+ return hash('sha256', data, 'hex').slice(0, 16);
111
108
  }
112
109
  //# sourceMappingURL=signature.js.map
package/src/index.d.ts CHANGED
@@ -19,17 +19,17 @@
19
19
  * purchase a proprietary commercial license. Please contact us at
20
20
  * <support@imqueue.com> to get commercial licensing options.
21
21
  */
22
- export * from './decorators';
23
- export * from './cache';
24
- export * from './IMQDelay';
25
- export * from './IMQCache';
26
- export * from './IMQRPCOptions';
27
- export * from './IMQRPCDescription';
28
- export * from './IMQRPCError';
29
- export * from './IMQRPCRequest';
30
- export * from './IMQRPCResponse';
31
- export * from './IMQLock';
32
- export * from './IMQService';
33
- export * from './IMQClient';
34
- export * from './IMQMetadata';
35
- export * from './IMQRequestContext';
22
+ export * from './decorators/index.js';
23
+ export * from './cache/index.js';
24
+ export * from './IMQDelay.js';
25
+ export * from './IMQCache.js';
26
+ export * from './IMQRPCOptions.js';
27
+ export * from './IMQRPCDescription.js';
28
+ export * from './IMQRPCError.js';
29
+ export * from './IMQRPCRequest.js';
30
+ export * from './IMQRPCResponse.js';
31
+ export * from './IMQLock.js';
32
+ export * from './IMQService.js';
33
+ export * from './IMQClient.js';
34
+ export * from './IMQMetadata.js';
35
+ export * from './IMQRequestContext.js';
package/src/index.js CHANGED
@@ -1,19 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
1
  /*!
18
2
  * I'm Queue Software Project
19
3
  * Copyright (C) 2025 imqueue.com <support@imqueue.com>
@@ -35,18 +19,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
35
19
  * purchase a proprietary commercial license. Please contact us at
36
20
  * <support@imqueue.com> to get commercial licensing options.
37
21
  */
38
- __exportStar(require("./decorators"), exports);
39
- __exportStar(require("./cache"), exports);
40
- __exportStar(require("./IMQDelay"), exports);
41
- __exportStar(require("./IMQCache"), exports);
42
- __exportStar(require("./IMQRPCOptions"), exports);
43
- __exportStar(require("./IMQRPCDescription"), exports);
44
- __exportStar(require("./IMQRPCError"), exports);
45
- __exportStar(require("./IMQRPCRequest"), exports);
46
- __exportStar(require("./IMQRPCResponse"), exports);
47
- __exportStar(require("./IMQLock"), exports);
48
- __exportStar(require("./IMQService"), exports);
49
- __exportStar(require("./IMQClient"), exports);
50
- __exportStar(require("./IMQMetadata"), exports);
51
- __exportStar(require("./IMQRequestContext"), exports);
22
+ export * from './decorators/index.js';
23
+ export * from './cache/index.js';
24
+ export * from './IMQDelay.js';
25
+ export * from './IMQCache.js';
26
+ export * from './IMQRPCOptions.js';
27
+ export * from './IMQRPCDescription.js';
28
+ export * from './IMQRPCError.js';
29
+ export * from './IMQRPCRequest.js';
30
+ export * from './IMQRPCResponse.js';
31
+ export * from './IMQLock.js';
32
+ export * from './IMQService.js';
33
+ export * from './IMQClient.js';
34
+ export * from './IMQMetadata.js';
35
+ export * from './IMQRequestContext.js';
52
36
  //# sourceMappingURL=index.js.map
package/tsconfig.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2023",
4
- "lib": ["es2023", "esnext.decorators"],
3
+ "target": "es2024",
4
+ "lib": ["es2024", "esnext.decorators"],
5
5
  "moduleDetection": "force",
6
6
 
7
7
  "module": "nodenext",
8
8
  "moduleResolution": "nodenext",
9
9
  "resolveJsonModule": true,
10
10
  "esModuleInterop": true,
11
+ "verbatimModuleSyntax": true,
11
12
 
12
13
  "types": ["node"],
13
14
 
@@ -19,6 +20,8 @@
19
20
  "removeComments": false,
20
21
  "newLine": "lf",
21
22
 
23
+ "skipLibCheck": true,
24
+
22
25
  "strict": true,
23
26
  "strictPropertyInitialization": false,
24
27
  "noImplicitOverride": true,