@imqueue/rpc 3.2.0 → 3.2.2

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 (55) 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.d.ts +18 -0
  35. package/src/decorators/expose.js +188 -18
  36. package/src/decorators/index.d.ts +9 -9
  37. package/src/decorators/index.js +9 -25
  38. package/src/decorators/indexed.d.ts +1 -1
  39. package/src/decorators/indexed.js +6 -9
  40. package/src/decorators/lock.js +8 -11
  41. package/src/decorators/logged.d.ts +1 -1
  42. package/src/decorators/logged.js +25 -4
  43. package/src/decorators/metadata.js +1 -2
  44. package/src/decorators/property.js +7 -11
  45. package/src/decorators/remote.js +1 -4
  46. package/src/helpers/fs.js +7 -12
  47. package/src/helpers/index.d.ts +4 -4
  48. package/src/helpers/index.js +4 -20
  49. package/src/helpers/os-uuid.js +5 -8
  50. package/src/helpers/pid.d.ts +1 -1
  51. package/src/helpers/pid.js +12 -16
  52. package/src/helpers/signature.js +3 -6
  53. package/src/index.d.ts +14 -14
  54. package/src/index.js +14 -30
  55. package/tsconfig.json +5 -2
@@ -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
  * Copyright (C) 2025 imqueue.com <support@imqueue.com>
19
3
  *
@@ -37,6 +21,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
21
  * purchase a proprietary commercial license. Please contact us at
38
22
  * <support@imqueue.com> to get commercial licensing options.
39
23
  */
40
- __exportStar(require("./ICache"), exports);
41
- __exportStar(require("./RedisCache"), exports);
24
+ export * from './ICache.js';
25
+ export * from './RedisCache.js';
42
26
  //# sourceMappingURL=index.js.map
@@ -21,7 +21,7 @@
21
21
  * purchase a proprietary commercial license. Please contact us at
22
22
  * <support@imqueue.com> to get commercial licensing options.
23
23
  */
24
- import { ICache, ICacheConstructor } from '..';
24
+ import { type ICache, type ICacheConstructor } from '../cache/index.js';
25
25
  export interface CacheDecoratorOptions {
26
26
  adapter?: string | ICache | ICacheConstructor;
27
27
  ttl?: number;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cache = void 0;
4
1
  /*!
5
2
  * IMQ-RPC Decorators: cache
6
3
  *
@@ -24,8 +21,11 @@ exports.cache = void 0;
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 __1 = require("..");
28
- const helpers_1 = require("../helpers");
24
+ // cache classes are imported from their defining modules (not the package
25
+ // barrel) to avoid a circular-import TDZ on the module-scope default options
26
+ import { RedisCache, } from '../cache/index.js';
27
+ import { IMQCache } from '../IMQCache.js';
28
+ import { signature } from '../helpers/index.js';
29
29
  /**
30
30
  * Creates a `@cache()` method decorator that memoizes the decorated method's
31
31
  * result in a cache adapter (RedisCache by default). On each call the cache is
@@ -38,16 +38,16 @@ const helpers_1 = require("../helpers");
38
38
  * ttl, nx); merged over `cache.globalOptions`
39
39
  * @return {Function} - a dual-mode method decorator
40
40
  */
41
- const cache = function (options) {
41
+ export const cache = function (options) {
42
42
  const cacheOptions = {
43
- ...exports.cache.globalOptions,
43
+ ...cache.globalOptions,
44
44
  ...options,
45
45
  };
46
- let Adapter = cacheOptions.adapter || __1.RedisCache;
46
+ let Adapter = cacheOptions.adapter || RedisCache;
47
47
  const wrap = (original, methodName) => async function (...args) {
48
48
  const className = this.constructor.name;
49
49
  if (!this.cache) {
50
- let cache = __1.IMQCache.get(Adapter);
50
+ let cache = IMQCache.get(Adapter);
51
51
  if (cache && cache.ready) {
52
52
  this.cache = cache;
53
53
  }
@@ -60,12 +60,12 @@ const cache = function (options) {
60
60
  if (logger) {
61
61
  opts = { ...opts, logger };
62
62
  }
63
- await __1.IMQCache.register(Adapter, opts).init();
64
- this.cache = __1.IMQCache.get(Adapter);
63
+ await IMQCache.register(Adapter, opts).init();
64
+ this.cache = IMQCache.get(Adapter);
65
65
  }
66
66
  }
67
67
  try {
68
- const key = (0, helpers_1.signature)(className, methodName, args);
68
+ const key = signature(className, methodName, args);
69
69
  let result = await this.cache.get(key);
70
70
  if (result === undefined) {
71
71
  result = original.apply(this, args);
@@ -88,8 +88,7 @@ const cache = function (options) {
88
88
  return descriptor;
89
89
  };
90
90
  };
91
- exports.cache = cache;
92
- exports.cache.globalOptions = {
93
- adapter: __1.RedisCache,
91
+ cache.globalOptions = {
92
+ adapter: RedisCache,
94
93
  };
95
94
  //# sourceMappingURL=cache.js.map
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.classType = classType;
4
1
  /*!
5
2
  * IMQ-RPC Decorators: classType
6
3
  *
@@ -24,7 +21,7 @@ exports.classType = classType;
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 property_1 = require("./property");
24
+ import { registerType } from './property.js';
28
25
  /**
29
26
  * Implements the '@classType' decorator factory.
30
27
  *
@@ -67,14 +64,14 @@ const property_1 = require("./property");
67
64
  *
68
65
  * @return {(value: Function, context: ClassDecoratorContext) => void}
69
66
  */
70
- function classType() {
67
+ export function classType() {
71
68
  // Dual-mode: standard (TC39) class decorators pass a context object with a
72
69
  // `kind` property; legacy ones pass only the constructor. In legacy mode
73
70
  // @property already registers each field directly, so there is nothing to
74
71
  // flush and the class is returned unchanged.
75
72
  return function (value, context) {
76
73
  if (context && typeof context === 'object' && 'kind' in context) {
77
- (0, property_1.registerType)(value, context.metadata);
74
+ registerType(value, context.metadata);
78
75
  return;
79
76
  }
80
77
  return value;
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Extracts method JSDoc blocks from original source text of a given class.
3
+ *
4
+ * The text may be TypeScript (type annotations, generics, modifiers,
5
+ * decorators), which acorn cannot parse — so extraction is textual: the
6
+ * search is narrowed to the class region (from the class declaration to the
7
+ * next class declaration or EOF), and each doc block is attributed to the
8
+ * method whose declaration head immediately follows it. When several blocks
9
+ * precede a method, the closest one wins, matching the runtime parser.
10
+ *
11
+ * @param {string} src - source file text (TypeScript or JavaScript)
12
+ * @param {string} className - class to extract method docs for
13
+ * @return {{ [method: string]: string }} - map of method name to raw JSDoc
14
+ * block body (delimiters excluded, as acorn reports comment values)
15
+ */
16
+ export declare function parseSourceComments(src: string, className: string): {
17
+ [method: string]: string;
18
+ };
1
19
  /**
2
20
  * Expose decorator factory. Applied to a service method, it registers that
3
21
  * method in the RPC service description. (Complex argument/return types are
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expose = expose;
4
1
  /*!
5
2
  * IMQ-RPC Decorators: expose
6
3
  *
@@ -24,18 +21,33 @@ exports.expose = expose;
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 acorn_1 = require("acorn");
28
- const __1 = require("..");
24
+ import { readFileSync } from 'fs';
25
+ import { fileURLToPath } from 'url';
26
+ import { parse } from 'acorn';
27
+ import { IMQRPCDescription, } from '../index.js';
29
28
  const descriptions = {};
30
29
  const RX_ARG_NAMES = /^(\S+)([=\s]+.*?)?$/;
31
30
  const RX_COMMA_SPLIT = /\s*,\s*/;
32
31
  const RX_MULTILINE_CLEANUP = /\*?\n +\* ?/g;
33
32
  const RX_DESCRIPTION = /^([\s\S]*?)@/;
34
33
  const RX_TAG = /(@[^@]+)/g;
35
- const RX_TYPE = /\{([\s\S]+)\}/;
36
34
  const RX_LI_CLEANUP = /^\s*-\s*/;
37
35
  const RX_SPACE_SPLIT = / /;
38
36
  const RX_OPTIONAL = /^\[(.*?)\]$/;
37
+ // member head that may follow a doc block in original (possibly TypeScript)
38
+ // source: optional decorators and modifiers, then the method name right
39
+ // before its (possibly generic) argument list
40
+ const RX_SOURCE_METHOD = /^\s*(?:@[\w$.]+(?:\([^)]*\))?\s*)*(?:(?:public|protected|private|static|override|abstract|async)\s+)*([\w$]+)\s*(?:<[^>]*>)?\s*\(/;
41
+ const RX_JSDOC_BLOCK = /\/\*\*([\s\S]*?)\*\//g;
42
+ // path of this very module — used to skip own frames during caller capture
43
+ const OWN_PATH = (() => {
44
+ try {
45
+ return fileURLToPath(import.meta.url);
46
+ }
47
+ catch {
48
+ return '';
49
+ }
50
+ })();
39
51
  /**
40
52
  * Lookup and returns a list of argument names for a given function
41
53
  *
@@ -50,6 +62,37 @@ function argumentNames(fn) {
50
62
  .map(arg => arg.trim().replace(RX_ARG_NAMES, '$1'))
51
63
  .filter(arg => arg);
52
64
  }
65
+ /**
66
+ * Extracts a leading JSDoc `{type}` from a tag definition. Braces are matched
67
+ * by depth, so object-literal types (e.g. `{{ x: number }}`) are captured whole
68
+ * and a later `}` in the description cannot extend the captured type. The type,
69
+ * if present, must be the leading token of the definition.
70
+ *
71
+ * @param {string} tagDef - tag definition text following the tag name
72
+ * @return {{ tsType: string, rest: string } | null} - captured type and the
73
+ * remaining definition (name + description), or null when there is no type
74
+ */
75
+ function extractType(tagDef) {
76
+ const start = tagDef.indexOf('{');
77
+ // a type is only a type when it leads the definition; a `{` preceded by
78
+ // any non-whitespace belongs to the description, not to a type
79
+ if (start === -1 || tagDef.slice(0, start).trim() !== '') {
80
+ return null;
81
+ }
82
+ let depth = 0;
83
+ for (let i = start; i < tagDef.length; i++) {
84
+ if (tagDef[i] === '{') {
85
+ depth++;
86
+ }
87
+ else if (tagDef[i] === '}' && --depth === 0) {
88
+ return {
89
+ tsType: tagDef.slice(start + 1, i),
90
+ rest: tagDef.slice(i + 1).trim(),
91
+ };
92
+ }
93
+ }
94
+ return null; // unbalanced braces — treat as having no parseable type
95
+ }
53
96
  /**
54
97
  * Parses given multi-line comment block
55
98
  *
@@ -76,13 +119,12 @@ function parseComment(src) {
76
119
  let parts = tag.split(RX_SPACE_SPLIT);
77
120
  let tagName = parts.shift();
78
121
  let tagDef = parts.join(' ');
79
- let typeMatch = tagDef.match(RX_TYPE);
122
+ let typeInfo = extractType(tagDef);
80
123
  let tsType = '', name = '', description = '', type = '';
81
124
  let isOptional = false;
82
- if (typeMatch) {
83
- tsType = typeMatch[1];
84
- tagDef = tagDef.replace(RX_TYPE, '').trim();
85
- parts = tagDef.split(/ /);
125
+ if (typeInfo) {
126
+ tsType = typeInfo.tsType;
127
+ parts = typeInfo.rest.split(/ /);
86
128
  }
87
129
  name = (parts.shift() || '').replace(RX_LI_CLEANUP, '');
88
130
  description = parts.join(' ').replace(RX_LI_CLEANUP, '');
@@ -143,7 +185,7 @@ function parseDescriptions(name, src) {
143
185
  };
144
186
  let body;
145
187
  try {
146
- body = (0, acorn_1.parse)(src, options).body;
188
+ body = parse(src, options).body;
147
189
  }
148
190
  catch {
149
191
  // tolerate unparseable sources (e.g. bound or native functions) the
@@ -191,6 +233,124 @@ function parseDescriptions(name, src) {
191
233
  }
192
234
  }
193
235
  }
236
+ /**
237
+ * Extracts method JSDoc blocks from original source text of a given class.
238
+ *
239
+ * The text may be TypeScript (type annotations, generics, modifiers,
240
+ * decorators), which acorn cannot parse — so extraction is textual: the
241
+ * search is narrowed to the class region (from the class declaration to the
242
+ * next class declaration or EOF), and each doc block is attributed to the
243
+ * method whose declaration head immediately follows it. When several blocks
244
+ * precede a method, the closest one wins, matching the runtime parser.
245
+ *
246
+ * @param {string} src - source file text (TypeScript or JavaScript)
247
+ * @param {string} className - class to extract method docs for
248
+ * @return {{ [method: string]: string }} - map of method name to raw JSDoc
249
+ * block body (delimiters excluded, as acorn reports comment values)
250
+ */
251
+ export function parseSourceComments(src, className) {
252
+ const comments = {};
253
+ const classRx = new RegExp(`\\bclass\\s+${className}\\b`);
254
+ const classMatch = classRx.exec(src);
255
+ if (!classMatch) {
256
+ return comments;
257
+ }
258
+ const start = classMatch.index + classMatch[0].length;
259
+ const nextClass = /\bclass\s+[\w$]+/g;
260
+ nextClass.lastIndex = start;
261
+ const next = nextClass.exec(src);
262
+ const region = src.slice(start, next ? next.index : src.length);
263
+ let match;
264
+ RX_JSDOC_BLOCK.lastIndex = 0;
265
+ while ((match = RX_JSDOC_BLOCK.exec(region))) {
266
+ const head = region
267
+ .slice(match.index + match[0].length)
268
+ .match(RX_SOURCE_METHOD);
269
+ if (head && head[1] !== 'constructor') {
270
+ comments[head[1]] = match[1];
271
+ }
272
+ }
273
+ return comments;
274
+ }
275
+ // per-path cache of source file reads used by the dev-mode fallback;
276
+ // null marks an unreadable path so it is only attempted once
277
+ const sourceFileCache = {};
278
+ /**
279
+ * Reads and caches a source file, returning null when unreadable.
280
+ *
281
+ * @param {string} path - absolute source file path
282
+ * @return {string | null}
283
+ */
284
+ function readSourceFile(path) {
285
+ if (!(path in sourceFileCache)) {
286
+ try {
287
+ sourceFileCache[path] = readFileSync(path, 'utf8');
288
+ }
289
+ catch {
290
+ sourceFileCache[path] = null;
291
+ }
292
+ }
293
+ return sourceFileCache[path];
294
+ }
295
+ /**
296
+ * Captures the file path of the code that invoked the expose() factory —
297
+ * physically the module defining the decorated class. Own and internal
298
+ * frames are skipped. Returns an empty string when no frame is usable
299
+ * (e.g. bundled builds without source maps).
300
+ *
301
+ * @return {string}
302
+ */
303
+ function captureCallerPath() {
304
+ const stack = new Error().stack || '';
305
+ for (const line of stack.split('\n').slice(1)) {
306
+ const match = line.match(/\(?((?:file:\/\/)?[^()\s]+?\.[cm]?[jt]sx?)(?::\d+){0,2}\)?$/);
307
+ if (!match) {
308
+ continue;
309
+ }
310
+ let path = match[1];
311
+ if (path.startsWith('file://')) {
312
+ try {
313
+ path = fileURLToPath(path);
314
+ }
315
+ catch {
316
+ continue;
317
+ }
318
+ }
319
+ if (path === OWN_PATH ||
320
+ path.startsWith('node:') ||
321
+ path.includes('node_modules')) {
322
+ continue;
323
+ }
324
+ return path;
325
+ }
326
+ return '';
327
+ }
328
+ /**
329
+ * Dev-mode fallback: when the runtime class source yields no JSDoc (a
330
+ * comment-stripping transpiler like tsx/esbuild), re-extract method docs
331
+ * from the defining source file on disk. Runtime source always wins when
332
+ * it carries any JSDoc; extraction misses leave methods at their current
333
+ * (untyped) state, so behavior never degrades below the status quo.
334
+ *
335
+ * @param {string} className - class to describe
336
+ * @param {string} sourcePath - captured defining file path
337
+ */
338
+ function applySourceFallback(className, sourcePath) {
339
+ const hasJsdoc = Object.keys(descriptions[className] || {}).some(key => key !== 'inherits');
340
+ if (hasJsdoc || !sourcePath) {
341
+ return;
342
+ }
343
+ const src = readSourceFile(sourcePath);
344
+ if (!src) {
345
+ return;
346
+ }
347
+ const comments = parseSourceComments(src, className);
348
+ for (const method of Object.keys(comments)) {
349
+ descriptions[className][method] = {
350
+ comment: parseComment(comments[method]),
351
+ };
352
+ }
353
+ }
194
354
  /**
195
355
  * Helper function to make easy descriptions parts extractions
196
356
  *
@@ -220,12 +380,18 @@ function get(prop, className, method, defaults) {
220
380
  * @param {Function} ctor - class that declares the method
221
381
  * @param {string} methodName - exposed method name
222
382
  * @param {(...args: any[]) => any} fn - the method implementation
383
+ * @param {string} [sourcePath] - defining file path captured at decoration
223
384
  */
224
- function buildMethodDescription(ctor, methodName, fn) {
385
+ function buildMethodDescription(ctor, methodName, fn, sourcePath) {
225
386
  const className = ctor.name;
226
387
  const argNames = argumentNames(fn);
227
388
  if (!descriptions[className]) {
228
389
  parseDescriptions(className, ctor.toString());
390
+ // dev-mode: a comment-stripping transpiler leaves no JSDoc in the
391
+ // runtime source — recover method docs from the file on disk
392
+ if (sourcePath) {
393
+ applySourceFallback(className, sourcePath);
394
+ }
229
395
  }
230
396
  const args = get('params', className, methodName, []);
231
397
  const ret = get('returns', className, methodName, {
@@ -259,12 +425,12 @@ function buildMethodDescription(ctor, methodName, fn) {
259
425
  // to a helper (e.g. `extends _classSuper`), so the source name is unusable
260
426
  const parent = Object.getPrototypeOf(ctor);
261
427
  const inherits = parent && parent.name ? parent.name : 'Function';
262
- __1.IMQRPCDescription.serviceDescription[className] = __1.IMQRPCDescription
428
+ IMQRPCDescription.serviceDescription[className] = IMQRPCDescription
263
429
  .serviceDescription[className] || {
264
430
  inherits,
265
431
  methods: {},
266
432
  };
267
- __1.IMQRPCDescription.serviceDescription[className].methods[methodName] = {
433
+ IMQRPCDescription.serviceDescription[className].methods[methodName] = {
268
434
  description: get('description', className, methodName, ''),
269
435
  arguments: args,
270
436
  returns: ret,
@@ -277,7 +443,11 @@ function buildMethodDescription(ctor, methodName, fn) {
277
443
  *
278
444
  * @return {(value: any, context: ClassMethodDecoratorContext) => void}
279
445
  */
280
- function expose() {
446
+ export function expose() {
447
+ // the factory executes at class-definition time inside the defining
448
+ // module, so the caller frame points at the service source file — used
449
+ // as the dev-mode fallback when runtime comments are stripped
450
+ const sourcePath = captureCallerPath();
281
451
  // Dual-mode: standard (TC39) invocations pass a context object with a
282
452
  // `kind` property; legacy ones pass (target, propertyKey, descriptor).
283
453
  return function exposeDecorator(target, context, descriptor) {
@@ -298,13 +468,13 @@ function expose() {
298
468
  const ctor = proto
299
469
  ? proto.constructor
300
470
  : this.constructor;
301
- buildMethodDescription(ctor, methodName, value);
471
+ buildMethodDescription(ctor, methodName, value, sourcePath);
302
472
  });
303
473
  return;
304
474
  }
305
475
  // legacy: `target` is the prototype, so its constructor is the class
306
476
  // that declares the method — available immediately at decoration time
307
- buildMethodDescription(target.constructor, String(context), descriptor.value);
477
+ buildMethodDescription(target.constructor, String(context), descriptor.value, sourcePath);
308
478
  return descriptor;
309
479
  };
310
480
  }
@@ -21,12 +21,12 @@
21
21
  * purchase a proprietary commercial license. Please contact us at
22
22
  * <support@imqueue.com> to get commercial licensing options.
23
23
  */
24
- import './metadata';
25
- export * from './expose';
26
- export * from './classType';
27
- export * from './remote';
28
- export * from './lock';
29
- export * from './cache';
30
- export * from './property';
31
- export * from './indexed';
32
- export * from './logged';
24
+ import './metadata.js';
25
+ export * from './expose.js';
26
+ export * from './classType.js';
27
+ export * from './remote.js';
28
+ export * from './lock.js';
29
+ export * from './cache.js';
30
+ export * from './property.js';
31
+ export * from './indexed.js';
32
+ export * from './logged.js';
@@ -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
  * Copyright (C) 2025 imqueue.com <support@imqueue.com>
19
3
  *
@@ -39,13 +23,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
23
  */
40
24
  // must load first: installs the Symbol.metadata polyfill required by the
41
25
  // standard-decorator metadata used across the decorators below
42
- require("./metadata");
43
- __exportStar(require("./expose"), exports);
44
- __exportStar(require("./classType"), exports);
45
- __exportStar(require("./remote"), exports);
46
- __exportStar(require("./lock"), exports);
47
- __exportStar(require("./cache"), exports);
48
- __exportStar(require("./property"), exports);
49
- __exportStar(require("./indexed"), exports);
50
- __exportStar(require("./logged"), exports);
26
+ import './metadata.js';
27
+ export * from './expose.js';
28
+ export * from './classType.js';
29
+ export * from './remote.js';
30
+ export * from './lock.js';
31
+ export * from './cache.js';
32
+ export * from './property.js';
33
+ export * from './indexed.js';
34
+ export * from './logged.js';
51
35
  //# sourceMappingURL=index.js.map
@@ -21,7 +21,7 @@
21
21
  * purchase a proprietary commercial license. Please contact us at
22
22
  * <support@imqueue.com> to get commercial licensing options.
23
23
  */
24
- import { Thunk } from '..';
24
+ import { type Thunk } from '../index.js';
25
25
  /**
26
26
  * Implements '@indexed' decorator factory
27
27
  * This is used to specify complex service types which are need to expose
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.indexed = indexed;
4
1
  /*!
5
2
  * IMQ-RPC Decorators: property
6
3
  *
@@ -24,8 +21,8 @@ exports.indexed = indexed;
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 __1 = require("..");
28
- const property_1 = require("./property");
24
+ import { IMQRPCDescription } from '../index.js';
25
+ import { registerType } from './property.js';
29
26
  /**
30
27
  * Implements '@indexed' decorator factory
31
28
  * This is used to specify complex service types which are need to expose
@@ -43,7 +40,7 @@ const property_1 = require("./property");
43
40
  *
44
41
  * @return {(constructor: Function) => void}
45
42
  */
46
- function indexed(indexTypedef) {
43
+ export function indexed(indexTypedef) {
47
44
  // Dual-mode: standard (TC39) class decorators pass a context object with a
48
45
  // `kind` property; legacy ones pass only the constructor.
49
46
  return function (value, context) {
@@ -59,18 +56,18 @@ function indexed(indexTypedef) {
59
56
  }
60
57
  if (isStandard) {
61
58
  // registers any @property fields on this class plus the index type
62
- (0, property_1.registerType)(value, context.metadata, indexTypedef);
59
+ registerType(value, context.metadata, indexTypedef);
63
60
  return;
64
61
  }
65
62
  // legacy: @property already registered the fields directly, so only
66
63
  // the index type needs to be attached to the existing description
67
64
  const typeName = value.name;
68
- __1.IMQRPCDescription.typesDescription[typeName] = __1.IMQRPCDescription
65
+ IMQRPCDescription.typesDescription[typeName] = IMQRPCDescription
69
66
  .typesDescription[typeName] || {
70
67
  properties: {},
71
68
  inherits: Object.getPrototypeOf(value).name,
72
69
  };
73
- __1.IMQRPCDescription.typesDescription[typeName].indexType =
70
+ IMQRPCDescription.typesDescription[typeName].indexType =
74
71
  indexTypedef;
75
72
  return value;
76
73
  };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lock = lock;
4
1
  /*!
5
2
  * IMQ-RPC Decorators: lock
6
3
  *
@@ -24,8 +21,8 @@ exports.lock = lock;
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 __1 = require("..");
28
- const helpers_1 = require("../helpers");
24
+ import { IMQLock } from '../index.js';
25
+ import { signature } from '../helpers/index.js';
29
26
  /**
30
27
  * Creates a `@lock()` method decorator. Concurrent calls to the decorated
31
28
  * method that share the same arguments are coalesced: only the first call is
@@ -38,7 +35,7 @@ const helpers_1 = require("../helpers");
38
35
  * or the lock options
39
36
  * @return {Function} - a dual-mode method decorator
40
37
  */
41
- function lock(enabledOrOptions = true) {
38
+ export function lock(enabledOrOptions = true) {
42
39
  const enabled = typeof enabledOrOptions === 'boolean'
43
40
  ? enabledOrOptions
44
41
  : !enabledOrOptions.disabled;
@@ -53,15 +50,15 @@ function lock(enabledOrOptions = true) {
53
50
  let lock;
54
51
  let sig = '';
55
52
  if (withLocks) {
56
- sig = (0, helpers_1.signature)(className, methodName, skipArgs
53
+ sig = signature(className, methodName, skipArgs
57
54
  ? args.filter((_, index) => !~skipArgs.indexOf(index))
58
55
  : args);
59
- lock = await __1.IMQLock.acquire(sig, undefined, {
56
+ lock = await IMQLock.acquire(sig, undefined, {
60
57
  className,
61
58
  methodName,
62
59
  args,
63
60
  });
64
- if (!__1.IMQLock.locked(sig)) {
61
+ if (!IMQLock.locked(sig)) {
65
62
  return lock;
66
63
  }
67
64
  }
@@ -75,13 +72,13 @@ function lock(enabledOrOptions = true) {
75
72
  result = await result;
76
73
  }
77
74
  if (withLocks) {
78
- __1.IMQLock.release(sig, result);
75
+ IMQLock.release(sig, result);
79
76
  }
80
77
  return result;
81
78
  }
82
79
  catch (err) {
83
80
  if (withLocks) {
84
- __1.IMQLock.release(sig, null, err);
81
+ IMQLock.release(sig, null, err);
85
82
  }
86
83
  throw err;
87
84
  }
@@ -21,7 +21,7 @@
21
21
  * purchase a proprietary commercial license. Please contact us at
22
22
  * <support@imqueue.com> to get commercial licensing options.
23
23
  */
24
- import { ILogger } from '@imqueue/core';
24
+ import { type ILogger } from '@imqueue/core';
25
25
  export type LoggedLogLevel = 'info' | 'log' | 'warn' | 'error';
26
26
  export interface LoggedDecoratorOptions {
27
27
  level?: LoggedLogLevel;