@imqueue/rpc 3.4.4 → 3.5.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/index.d.ts +58 -0
  3. package/index.js +58 -0
  4. package/package.json +1 -1
  5. package/src/IMQCache.d.ts +20 -11
  6. package/src/IMQCache.js +20 -11
  7. package/src/IMQClient.d.ts +191 -38
  8. package/src/IMQClient.js +204 -57
  9. package/src/IMQDelay.d.ts +29 -6
  10. package/src/IMQDelay.js +20 -6
  11. package/src/IMQLock.d.ts +81 -35
  12. package/src/IMQLock.js +38 -35
  13. package/src/IMQMetadata.d.ts +9 -1
  14. package/src/IMQMetadata.js +1 -1
  15. package/src/IMQRPCDescription.d.ts +183 -9
  16. package/src/IMQRPCDescription.js +22 -0
  17. package/src/IMQRPCError.d.ts +91 -9
  18. package/src/IMQRPCError.js +23 -7
  19. package/src/IMQRPCOptions.d.ts +221 -18
  20. package/src/IMQRPCOptions.js +22 -6
  21. package/src/IMQRPCRequest.d.ts +39 -1
  22. package/src/IMQRPCResponse.d.ts +34 -0
  23. package/src/IMQRequestContext.d.ts +2 -5
  24. package/src/IMQRequestContext.js +2 -5
  25. package/src/IMQService.d.ts +144 -19
  26. package/src/IMQService.js +151 -33
  27. package/src/cache/ICache.d.ts +58 -16
  28. package/src/cache/RedisCache.d.ts +58 -17
  29. package/src/cache/RedisCache.js +43 -17
  30. package/src/decorators/cache.d.ts +46 -2
  31. package/src/decorators/cache.js +2 -2
  32. package/src/decorators/classType.d.ts +28 -13
  33. package/src/decorators/classType.js +28 -13
  34. package/src/decorators/expose.d.ts +59 -7
  35. package/src/decorators/expose.js +77 -30
  36. package/src/decorators/indexed.d.ts +27 -8
  37. package/src/decorators/indexed.js +27 -8
  38. package/src/decorators/lock.d.ts +20 -2
  39. package/src/decorators/lock.js +2 -2
  40. package/src/decorators/logged.d.ts +29 -2
  41. package/src/decorators/logged.js +2 -2
  42. package/src/decorators/property.d.ts +97 -4
  43. package/src/decorators/property.js +84 -6
  44. package/src/decorators/remote.d.ts +1 -1
  45. package/src/decorators/remote.js +1 -1
  46. package/src/helpers/fs.d.ts +5 -7
  47. package/src/helpers/fs.js +8 -10
  48. package/src/helpers/os-uuid.d.ts +0 -2
  49. package/src/helpers/os-uuid.js +2 -10
  50. package/src/helpers/pid.d.ts +7 -7
  51. package/src/helpers/pid.js +10 -11
  52. package/src/helpers/signature.d.ts +4 -4
  53. package/src/helpers/signature.js +7 -7
@@ -23,10 +23,38 @@
23
23
  */
24
24
  import { type IRedisClient, type IMQOptions } from '@imqueue/core';
25
25
  import { type ICache } from './index.js';
26
+ /**
27
+ * Options accepted by {@link RedisCache.init}.
28
+ *
29
+ * @remarks
30
+ * This inherits the queue option shape, but the adapter only honours `host`,
31
+ * `port`, `username`, `password`, `prefix`, `logger` and `conn`. All other
32
+ * inherited queue options are accepted by the type and silently ignored.
33
+ */
26
34
  export interface IRedisCacheOptions extends Partial<IMQOptions> {
35
+ /**
36
+ * An existing Redis client to reuse — a running service's queue writer, for
37
+ * example — instead of opening a new connection.
38
+ *
39
+ * @remarks
40
+ * Honoured only while no shared connection exists yet.
41
+ */
27
42
  conn?: IRedisClient;
28
43
  }
44
+ /**
45
+ * Default options for {@link RedisCache}: the standard queue defaults, with
46
+ * `prefix` overridden to `imq-cache` so cache keys never collide with queue keys
47
+ * under the `imq` prefix.
48
+ *
49
+ * @remarks
50
+ * User options are merged over these, so keys default to
51
+ * `imq-cache:RedisCache:<key>`.
52
+ */
29
53
  export declare const DEFAULT_REDIS_CACHE_OPTIONS: IMQOptions;
54
+ /**
55
+ * Message of the `TypeError` thrown by any {@link RedisCache} operation invoked
56
+ * before a connection has been established. Exported so callers can match on it.
57
+ */
30
58
  export declare const REDIS_CLIENT_INIT_ERROR = "Redis client is not initialized!";
31
59
  /**
32
60
  * Class RedisCache. Implements a cache engine on top of Redis.
@@ -35,30 +63,48 @@ export declare class RedisCache implements ICache {
35
63
  private static redis?;
36
64
  private static initPromise?;
37
65
  private logger;
66
+ /**
67
+ * The effective options after merging user input over
68
+ * {@link DEFAULT_REDIS_CACHE_OPTIONS}.
69
+ *
70
+ * @remarks
71
+ * Populated only by {@link RedisCache.init} — it is `undefined` until then, which
72
+ * is why every instance must be initialized before use even when another instance
73
+ * already opened the shared connection.
74
+ */
38
75
  options: IRedisCacheOptions;
76
+ /**
77
+ * This adapter instance's name, `'RedisCache'`. Used as the registry key and as
78
+ * a segment of every cache key.
79
+ */
39
80
  name: string;
81
+ /**
82
+ * True once {@link RedisCache.init} has completed successfully.
83
+ *
84
+ * @remarks
85
+ * Never reset: {@link RedisCache.destroy} closes the shared connection without
86
+ * clearing this flag.
87
+ */
40
88
  ready: boolean;
41
89
  /**
42
90
  * Initializes the cache instance. The underlying Redis connection is
43
91
  * shared between all instances; concurrent initializations share a single
44
92
  * connection attempt.
45
93
  *
46
- * @param {IRedisCacheOptions} [options] - Redis cache options
47
- * @returns {Promise<RedisCache>}
94
+ * @param options - Redis cache options
48
95
  */
49
96
  init(options?: IRedisCacheOptions): Promise<RedisCache>;
50
97
  /**
51
98
  * Returns the fully qualified key name for a given generic key.
52
99
  *
53
- * @param {string} key - generic key to qualify
54
- * @returns {string}
100
+ * @param key - generic key to qualify
55
101
  */
56
102
  private key;
57
103
  /**
58
104
  * Returns the value stored in the cache under a given key.
59
105
  *
60
- * @param {string} key - key to read the value for
61
- * @returns {Promise<any>} - stored value, or undefined if not found
106
+ * @param key - key to read the value for
107
+ * @returns stored value, or undefined if not found
62
108
  */
63
109
  get(key: string): Promise<any>;
64
110
  /**
@@ -68,31 +114,26 @@ export declare class RedisCache implements ICache {
68
114
  * is created only if it does not exist yet. The given value can be any
69
115
  * JSON-compatible object and will be serialized automatically.
70
116
  *
71
- * @param {string} key - key to store the value under
72
- * @param {any} value - value to store
73
- * @param {number} [ttl] - time-to-live in milliseconds
74
- * @param {boolean} [nx] - store only if the key does not exist yet
75
- * @returns {Promise<boolean>}
117
+ * @param key - key to store the value under
118
+ * @param value - value to store
119
+ * @param ttl - time-to-live in milliseconds
120
+ * @param nx - store only if the key does not exist yet
76
121
  */
77
122
  set(key: string, value: any, ttl?: number, nx?: boolean): Promise<boolean>;
78
123
  /**
79
124
  * Removes the value stored in the cache under the given key.
80
125
  *
81
- * @param {string} key - key to remove
82
- * @returns {Promise<boolean>}
126
+ * @param key - key to remove
83
127
  */
84
128
  del(key: string): Promise<boolean>;
85
129
  /**
86
130
  * Purges all keys from the cache matching a given wildcard mask.
87
131
  *
88
- * @param {string} keyMask - wildcard mask to match keys against
89
- * @return {Promise<boolean>}
132
+ * @param keyMask - wildcard mask to match keys against
90
133
  */
91
134
  purge(keyMask: string): Promise<boolean>;
92
135
  /**
93
136
  * Safely destroys the Redis connection.
94
- *
95
- * @returns {Promise<void>}
96
137
  */
97
138
  static destroy(): Promise<void>;
98
139
  }
@@ -24,10 +24,23 @@
24
24
  import { DEFAULT_IMQ_OPTIONS, Redis, } from '@imqueue/core';
25
25
  import { hostname } from 'node:os';
26
26
  import {} from './index.js';
27
+ /**
28
+ * Default options for {@link RedisCache}: the standard queue defaults, with
29
+ * `prefix` overridden to `imq-cache` so cache keys never collide with queue keys
30
+ * under the `imq` prefix.
31
+ *
32
+ * @remarks
33
+ * User options are merged over these, so keys default to
34
+ * `imq-cache:RedisCache:<key>`.
35
+ */
27
36
  export const DEFAULT_REDIS_CACHE_OPTIONS = {
28
37
  ...DEFAULT_IMQ_OPTIONS,
29
38
  prefix: 'imq-cache',
30
39
  };
40
+ /**
41
+ * Message of the `TypeError` thrown by any {@link RedisCache} operation invoked
42
+ * before a connection has been established. Exported so callers can match on it.
43
+ */
31
44
  export const REDIS_CLIENT_INIT_ERROR = 'Redis client is not initialized!';
32
45
  /**
33
46
  * Class RedisCache. Implements a cache engine on top of Redis.
@@ -38,16 +51,35 @@ export class RedisCache {
38
51
  // single promise instead of opening one connection each
39
52
  static initPromise;
40
53
  logger;
54
+ /**
55
+ * The effective options after merging user input over
56
+ * {@link DEFAULT_REDIS_CACHE_OPTIONS}.
57
+ *
58
+ * @remarks
59
+ * Populated only by {@link RedisCache.init} — it is `undefined` until then, which
60
+ * is why every instance must be initialized before use even when another instance
61
+ * already opened the shared connection.
62
+ */
41
63
  options;
64
+ /**
65
+ * This adapter instance's name, `'RedisCache'`. Used as the registry key and as
66
+ * a segment of every cache key.
67
+ */
42
68
  name = RedisCache.name;
69
+ /**
70
+ * True once {@link RedisCache.init} has completed successfully.
71
+ *
72
+ * @remarks
73
+ * Never reset: {@link RedisCache.destroy} closes the shared connection without
74
+ * clearing this flag.
75
+ */
43
76
  ready = false;
44
77
  /**
45
78
  * Initializes the cache instance. The underlying Redis connection is
46
79
  * shared between all instances; concurrent initializations share a single
47
80
  * connection attempt.
48
81
  *
49
- * @param {IRedisCacheOptions} [options] - Redis cache options
50
- * @returns {Promise<RedisCache>}
82
+ * @param options - Redis cache options
51
83
  */
52
84
  async init(options) {
53
85
  this.options = {
@@ -100,8 +132,7 @@ export class RedisCache {
100
132
  /**
101
133
  * Returns the fully qualified key name for a given generic key.
102
134
  *
103
- * @param {string} key - generic key to qualify
104
- * @returns {string}
135
+ * @param key - generic key to qualify
105
136
  */
106
137
  key(key) {
107
138
  return `${this.options.prefix}:${this.name}:${key}`;
@@ -109,8 +140,8 @@ export class RedisCache {
109
140
  /**
110
141
  * Returns the value stored in the cache under a given key.
111
142
  *
112
- * @param {string} key - key to read the value for
113
- * @returns {Promise<any>} - stored value, or undefined if not found
143
+ * @param key - key to read the value for
144
+ * @returns stored value, or undefined if not found
114
145
  */
115
146
  async get(key) {
116
147
  if (!RedisCache.redis) {
@@ -129,11 +160,10 @@ export class RedisCache {
129
160
  * is created only if it does not exist yet. The given value can be any
130
161
  * JSON-compatible object and will be serialized automatically.
131
162
  *
132
- * @param {string} key - key to store the value under
133
- * @param {any} value - value to store
134
- * @param {number} [ttl] - time-to-live in milliseconds
135
- * @param {boolean} [nx] - store only if the key does not exist yet
136
- * @returns {Promise<boolean>}
163
+ * @param key - key to store the value under
164
+ * @param value - value to store
165
+ * @param ttl - time-to-live in milliseconds
166
+ * @param nx - store only if the key does not exist yet
137
167
  */
138
168
  async set(key, value, ttl, nx = false) {
139
169
  if (!RedisCache.redis) {
@@ -154,8 +184,7 @@ export class RedisCache {
154
184
  /**
155
185
  * Removes the value stored in the cache under the given key.
156
186
  *
157
- * @param {string} key - key to remove
158
- * @returns {Promise<boolean>}
187
+ * @param key - key to remove
159
188
  */
160
189
  async del(key) {
161
190
  if (!RedisCache.redis) {
@@ -166,8 +195,7 @@ export class RedisCache {
166
195
  /**
167
196
  * Purges all keys from the cache matching a given wildcard mask.
168
197
  *
169
- * @param {string} keyMask - wildcard mask to match keys against
170
- * @return {Promise<boolean>}
198
+ * @param keyMask - wildcard mask to match keys against
171
199
  */
172
200
  async purge(keyMask) {
173
201
  if (!RedisCache.redis) {
@@ -184,8 +212,6 @@ export class RedisCache {
184
212
  }
185
213
  /**
186
214
  * Safely destroys the Redis connection.
187
- *
188
- * @returns {Promise<void>}
189
215
  */
190
216
  static async destroy() {
191
217
  RedisCache.initPromise = undefined;
@@ -22,13 +22,57 @@
22
22
  * <support@imqueue.com> to get commercial licensing options.
23
23
  */
24
24
  import { type ICache, type ICacheConstructor } from '../cache/index.js';
25
+ /**
26
+ * Per-method options for the {@link cache} decorator.
27
+ */
25
28
  export interface CacheDecoratorOptions {
29
+ /**
30
+ * Cache adapter as a constructor, an instance, or a built-in adapter name.
31
+ *
32
+ * @defaultValue RedisCache
33
+ *
34
+ * @remarks
35
+ * Only built-in adapters can be referenced by name — currently just
36
+ * `'RedisCache'`. Any other string throws a `TypeError`.
37
+ */
26
38
  adapter?: string | ICache | ICacheConstructor;
39
+ /**
40
+ * Time-to-live in milliseconds.
41
+ *
42
+ * @remarks
43
+ * Omitted or non-positive means the entry never expires. A non-integer value is
44
+ * rejected by Redis, which makes the write throw rather than return falsy.
45
+ */
27
46
  ttl?: number;
47
+ /**
48
+ * Store only when the key does not already exist.
49
+ *
50
+ * @remarks
51
+ * Honoured by the built-in Redis adapter, but outside the {@link ICache}
52
+ * interface, so custom adapters may ignore it. When it suppresses a write, the
53
+ * existing value and its remaining TTL are left untouched.
54
+ */
28
55
  nx?: boolean;
29
56
  }
57
+ /**
58
+ * The type of the {@link cache} export: a decorator factory that also carries
59
+ * process-wide defaults.
60
+ */
30
61
  export interface CacheDecorator {
62
+ /**
63
+ * @param options - per-method cache options, merged over
64
+ * {@link CacheDecorator.globalOptions}
65
+ * @returns a dual-mode method decorator that replaces the method with an `async`
66
+ * wrapper — so a decorated synchronous method returns a promise
67
+ */
31
68
  (options?: CacheDecoratorOptions): (...args: any[]) => any;
69
+ /**
70
+ * Process-wide defaults, merged under each call's own options.
71
+ *
72
+ * @remarks
73
+ * Merging happens when a decorator is applied, so this must be set before any
74
+ * decorated class is imported.
75
+ */
32
76
  globalOptions?: CacheDecoratorOptions;
33
77
  }
34
78
  /**
@@ -39,8 +83,8 @@ export interface CacheDecorator {
39
83
  * decorator is dual-mode: it works both as a standard (TC39) and as a legacy
40
84
  * method decorator.
41
85
  *
42
- * @param {CacheDecoratorOptions} [options] - per-method cache options (adapter,
86
+ * @param options - per-method cache options (adapter,
43
87
  * ttl, nx); merged over `cache.globalOptions`
44
- * @return {Function} - a dual-mode method decorator
88
+ * @returns a dual-mode method decorator
45
89
  */
46
90
  export declare const cache: CacheDecorator;
@@ -34,9 +34,9 @@ import { signature } from '../helpers/index.js';
34
34
  * decorator is dual-mode: it works both as a standard (TC39) and as a legacy
35
35
  * method decorator.
36
36
  *
37
- * @param {CacheDecoratorOptions} [options] - per-method cache options (adapter,
37
+ * @param options - per-method cache options (adapter,
38
38
  * ttl, nx); merged over `cache.globalOptions`
39
- * @return {Function} - a dual-mode method decorator
39
+ * @returns a dual-mode method decorator
40
40
  */
41
41
  export const cache = function (options) {
42
42
  const cacheOptions = {
@@ -1,21 +1,21 @@
1
1
  /**
2
- * Implements the '@classType' decorator factory.
2
+ * Registers a complex-type class's `@property` field definitions into the RPC
3
+ * type description, so the type can be exposed to service clients.
3
4
  *
4
- * Applied to a complex-type class, it registers the class's '@property' field
5
- * definitions into the RPC type description so the type can be exposed to
6
- * service clients. It is required on any class that uses '@property':
7
- * standard (TC39) field decorators cannot see the class they belong to, so a
8
- * class-level decorator is needed to flush the collected properties under the
9
- * class name.
5
+ * @returns a dual-mode class decorator `(value, context?) => any`, typed `any` so
6
+ * one function serves both decorator protocols. Under standard (TC39)
7
+ * decorators it flushes the collected fields via {@link registerType} and
8
+ * returns `undefined`; under legacy decorators it is a pass-through that
9
+ * returns the class unchanged.
10
10
  *
11
11
  * @example
12
- * ~~~typescript
12
+ * ```typescript
13
13
  * import { classType, property, expose, IMQService } from '@imqueue/rpc';
14
14
  *
15
15
  * @classType()
16
16
  * class Address {
17
17
  * @property('string')
18
- * country: string;
18
+ * country!: string;
19
19
  *
20
20
  * @property('string', true)
21
21
  * zipCode?: string; // optional
@@ -24,9 +24,9 @@
24
24
  * @classType()
25
25
  * class User {
26
26
  * @property('string')
27
- * firstName: string;
27
+ * firstName!: string;
28
28
  *
29
- * @property('Array<Address>', true)
29
+ * @property(() => [Address], true)
30
30
  * addresses?: Address[];
31
31
  * }
32
32
  *
@@ -36,8 +36,23 @@
36
36
  * // now User (and Address) are properly exposed to clients
37
37
  * }
38
38
  * }
39
- * ~~~
39
+ * ```
40
40
  *
41
- * @return {(value: Function, context: ClassDecoratorContext) => void}
41
+ * @remarks
42
+ * Required on every class that uses {@link property} when compiling with
43
+ * standard (TC39) decorators, the protocol this package targets: standard field
44
+ * decorators cannot see their class, so a class-level decorator is what flushes
45
+ * the collected fields under the class name.
46
+ *
47
+ * Under legacy (`experimentalDecorators`) decorators `@property` registers each
48
+ * field directly and this decorator is a harmless no-op.
49
+ *
50
+ * Omitting it produces no error — the type is silently missing from the RPC
51
+ * type description, and generated clients then reference an undeclared type.
52
+ * Applying it to a class with no `@property` fields registers an empty type
53
+ * description.
54
+ *
55
+ * {@link indexed} performs the same flush in addition to recording an index
56
+ * signature, so a class carrying `@indexed()` does not also need `@classType()`.
42
57
  */
43
58
  export declare function classType(): any;
@@ -23,23 +23,23 @@
23
23
  */
24
24
  import { registerType } from './property.js';
25
25
  /**
26
- * Implements the '@classType' decorator factory.
26
+ * Registers a complex-type class's `@property` field definitions into the RPC
27
+ * type description, so the type can be exposed to service clients.
27
28
  *
28
- * Applied to a complex-type class, it registers the class's '@property' field
29
- * definitions into the RPC type description so the type can be exposed to
30
- * service clients. It is required on any class that uses '@property':
31
- * standard (TC39) field decorators cannot see the class they belong to, so a
32
- * class-level decorator is needed to flush the collected properties under the
33
- * class name.
29
+ * @returns a dual-mode class decorator `(value, context?) => any`, typed `any` so
30
+ * one function serves both decorator protocols. Under standard (TC39)
31
+ * decorators it flushes the collected fields via {@link registerType} and
32
+ * returns `undefined`; under legacy decorators it is a pass-through that
33
+ * returns the class unchanged.
34
34
  *
35
35
  * @example
36
- * ~~~typescript
36
+ * ```typescript
37
37
  * import { classType, property, expose, IMQService } from '@imqueue/rpc';
38
38
  *
39
39
  * @classType()
40
40
  * class Address {
41
41
  * @property('string')
42
- * country: string;
42
+ * country!: string;
43
43
  *
44
44
  * @property('string', true)
45
45
  * zipCode?: string; // optional
@@ -48,9 +48,9 @@ import { registerType } from './property.js';
48
48
  * @classType()
49
49
  * class User {
50
50
  * @property('string')
51
- * firstName: string;
51
+ * firstName!: string;
52
52
  *
53
- * @property('Array<Address>', true)
53
+ * @property(() => [Address], true)
54
54
  * addresses?: Address[];
55
55
  * }
56
56
  *
@@ -60,9 +60,24 @@ import { registerType } from './property.js';
60
60
  * // now User (and Address) are properly exposed to clients
61
61
  * }
62
62
  * }
63
- * ~~~
63
+ * ```
64
64
  *
65
- * @return {(value: Function, context: ClassDecoratorContext) => void}
65
+ * @remarks
66
+ * Required on every class that uses {@link property} when compiling with
67
+ * standard (TC39) decorators, the protocol this package targets: standard field
68
+ * decorators cannot see their class, so a class-level decorator is what flushes
69
+ * the collected fields under the class name.
70
+ *
71
+ * Under legacy (`experimentalDecorators`) decorators `@property` registers each
72
+ * field directly and this decorator is a harmless no-op.
73
+ *
74
+ * Omitting it produces no error — the type is silently missing from the RPC
75
+ * type description, and generated clients then reference an undeclared type.
76
+ * Applying it to a class with no `@property` fields registers an empty type
77
+ * description.
78
+ *
79
+ * {@link indexed} performs the same flush in addition to recording an index
80
+ * signature, so a class carrying `@indexed()` does not also need `@classType()`.
66
81
  */
67
82
  export function classType() {
68
83
  // Dual-mode: standard (TC39) class decorators pass a context object with a
@@ -8,19 +8,71 @@
8
8
  * method whose declaration head immediately follows it. When several blocks
9
9
  * precede a method, the closest one wins, matching the runtime parser.
10
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
11
+ * @param src - source file text (TypeScript or JavaScript)
12
+ * @param className - class to extract method docs for
13
+ * @returns map of method name to raw JSDoc
14
14
  * block body (delimiters excluded, as acorn reports comment values)
15
15
  */
16
16
  export declare function parseSourceComments(src: string, className: string): {
17
17
  [method: string]: string;
18
18
  };
19
19
  /**
20
- * Expose decorator factory. Applied to a service method, it registers that
21
- * method in the RPC service description. (Complex argument/return types are
22
- * registered separately via the '@classType' decorator on those classes.)
20
+ * Makes a service method callable remotely by registering it in the RPC service
21
+ * description.
23
22
  *
24
- * @return {(value: any, context: ClassMethodDecoratorContext) => void}
23
+ * @returns a dual-mode method decorator, typed `any` so one function serves both
24
+ * decorator protocols. It never replaces or wraps the decorated method:
25
+ * under standard (TC39) decorators it registers a
26
+ * `context.addInitializer()` hook and returns `undefined`; under legacy
27
+ * decorators it registers immediately and returns the property descriptor
28
+ * unchanged.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * import { expose, IMQService } from '@imqueue/rpc';
33
+ *
34
+ * class UserService extends IMQService {
35
+ * @expose()
36
+ * public async count(active: boolean): Promise<number> {
37
+ * return 0;
38
+ * }
39
+ * }
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * Applying this is mandatory for remote callability: a service rejects calls
44
+ * to any class method absent from the service description with the
45
+ * `IMQ_RPC_NO_ACCESS` error. Undecorated methods remain callable in-process only.
46
+ *
47
+ * Every exposed method must carry a JSDoc block with typed `@param` and `@returns`
48
+ * tags. Standard decorators provide no runtime type reflection, so JSDoc is the
49
+ * only type source: undocumented types fall back to `any` in generated clients,
50
+ * and the documented `@param` list is also what the service's argument-count check
51
+ * validates — it must match the method's real arity, or calls fail with
52
+ * `IMQ_RPC_INVALID_ARGS_COUNT`. Consuming projects must therefore compile with
53
+ * `removeComments: false`.
54
+ *
55
+ * Decorator order matters: this must be the innermost decorator (listed last,
56
+ * closest to the method) when combined with {@link lock}, {@link cache} or
57
+ * {@link logged}. Those replace the method with a `(...args)` wrapper, and if this
58
+ * decorator is applied after them it records the wrapper's rest parameter as the
59
+ * method's only argument, breaking both argument validation and generated client
60
+ * signatures.
61
+ *
62
+ * Registration timing differs by protocol. Under standard decorators the class is
63
+ * not available at decoration time, so registration is deferred to an initializer
64
+ * that runs on first construction of an instance — the service description
65
+ * stays empty until then. Under legacy decorators it happens at class-definition
66
+ * time.
67
+ *
68
+ * Instance (prototype) methods only. Applied to a `static` method it silently
69
+ * registers under the pseudo-class name `Function` and the method stays
70
+ * unreachable remotely. Methods inherited from a base class are registered under
71
+ * the class that declares them and resolved through the description's `inherits`
72
+ * chain, so that base class must be loaded for the subclass description to be
73
+ * complete.
74
+ *
75
+ * Complex argument and return types are registered separately, by
76
+ * {@link classType} or {@link indexed} on those classes.
25
77
  */
26
78
  export declare function expose(): any;