@owlmeans/route 0.1.18-rc.7 → 0.1.18-rc.8
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/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/route/SKILL.md +12 -3
- package/build/consts.d.ts +7 -1
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +6 -0
- package/build/consts.js.map +1 -1
- package/build/helper.d.ts +6 -0
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +10 -0
- package/build/helper.js.map +1 -1
- package/build/types.d.ts +12 -0
- package/build/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/consts.ts +7 -1
- package/src/helper.ts +13 -0
- package/src/types.ts +12 -0
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/route",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.8",
|
|
5
|
+
"generatedAt": "2026-09-01T17:39:40.766Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: route
|
|
3
|
-
description: How to use @owlmeans/route — route() for declaring URL segments, frontend()/backend()/socket() markers, RouteMethod and RouteProtocols enums, and the address helpers under ./utils. Auto-invoked when importing route helpers or defining an entrypoint's URL path.
|
|
3
|
+
description: How to use @owlmeans/route — route() for declaring URL segments, frontend()/backend()/socket()/job() markers, RouteMethod and RouteProtocols enums, and the address helpers under ./utils. Auto-invoked when importing route helpers or defining an entrypoint's URL path.
|
|
4
4
|
user-invocable: false
|
|
5
5
|
---
|
|
6
6
|
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/route
|
|
9
9
|
|
|
10
10
|
**Layer:** Core
|
|
11
|
-
**Install:** `"@owlmeans/route": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/route": "^0.1.18-rc.8"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
@@ -18,9 +18,10 @@ user-invocable: false
|
|
|
18
18
|
| `frontend(options?, default?)` | Mark a route as a React page (web only) |
|
|
19
19
|
| `backend(options?, method?)` | Mark a route as a backend endpoint |
|
|
20
20
|
| `socket(options?, secondary?)` | A backend route answering over `RouteProtocols.SOCKET` |
|
|
21
|
+
| `job(options?, secondary?)` | A backend route carried by the queue (`RouteProtocols.QUEUE`) — takes `queue`, `reply`, `timeout` |
|
|
21
22
|
| `service(alias, options?)` | Point a route at a named service |
|
|
22
23
|
| `RouteMethod` | enum of GET, POST, PUT, PATCH, DELETE |
|
|
23
|
-
| `RouteProtocols` | enum of WEB (`http`), SOCKET (`ws`) |
|
|
24
|
+
| `RouteProtocols` | enum of WEB (`http`), SOCKET (`ws`), QUEUE (`queue`) |
|
|
24
25
|
| `RouteDeclaration` | The immutable declaration `route()` produces |
|
|
25
26
|
| `RouteModel` | `{ route }` — the model wrapping a declaration |
|
|
26
27
|
| `RouteAddress` | `{ host, port, base, secure, protocol }` — where a route answers |
|
|
@@ -35,6 +36,14 @@ route contributes under its parent and is never rewritten, and the model carries
|
|
|
35
36
|
Where the route answers is worked out on demand, against the context that asks — which is what lets
|
|
36
37
|
the same declaration serve a client and a server at once.
|
|
37
38
|
|
|
39
|
+
## Protocol picks the transport
|
|
40
|
+
|
|
41
|
+
A route names the protocol it answers on, and an application binds one by registering a transport
|
|
42
|
+
service under `transportAlias(protocol)`. So the protocol is what decides whether a call travels as
|
|
43
|
+
an HTTP request, a socket frame or a queued job — the call site never says. `job()` is `backend()`
|
|
44
|
+
with `RouteProtocols.QUEUE`, plus the three fields only a queue needs: `queue` (which one carries
|
|
45
|
+
it), `reply` (`false` returns as soon as the job is accepted), and `timeout`.
|
|
46
|
+
|
|
38
47
|
## Subpath Exports
|
|
39
48
|
|
|
40
49
|
- `./utils` — the computed address helpers, all taking `(context, declaration)`
|
package/build/consts.d.ts
CHANGED
|
@@ -7,8 +7,14 @@ export declare enum RouteMethod {
|
|
|
7
7
|
}
|
|
8
8
|
export declare const SEP = "/";
|
|
9
9
|
export declare const PARAM = ":";
|
|
10
|
+
/**
|
|
11
|
+
* How a route is carried. The protocol picks the transport that answers it — an application binds
|
|
12
|
+
* one by registering a service under `transportAlias(protocol)` — so a caller writes `call()` and
|
|
13
|
+
* never learns whether an HTTP request, a socket frame or a queued job did the work.
|
|
14
|
+
*/
|
|
10
15
|
export declare enum RouteProtocols {
|
|
11
16
|
WEB = "http",
|
|
12
|
-
SOCKET = "ws"
|
|
17
|
+
SOCKET = "ws",
|
|
18
|
+
QUEUE = "queue"
|
|
13
19
|
}
|
|
14
20
|
//# sourceMappingURL=consts.d.ts.map
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,GAAG,MAAM,CAAA;AAEtB,eAAO,MAAM,KAAK,MAAM,CAAA;AAExB,oBAAY,cAAc;IACxB,GAAG,SAAS;IACZ,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,GAAG,MAAM,CAAA;AAEtB,eAAO,MAAM,KAAK,MAAM,CAAA;AAExB;;;;GAIG;AACH,oBAAY,cAAc;IACxB,GAAG,SAAS;IACZ,MAAM,OAAO;IACb,KAAK,UAAU;CAChB"}
|
package/build/consts.js
CHANGED
|
@@ -8,9 +8,15 @@ export var RouteMethod;
|
|
|
8
8
|
})(RouteMethod || (RouteMethod = {}));
|
|
9
9
|
export const SEP = '/';
|
|
10
10
|
export const PARAM = ':';
|
|
11
|
+
/**
|
|
12
|
+
* How a route is carried. The protocol picks the transport that answers it — an application binds
|
|
13
|
+
* one by registering a service under `transportAlias(protocol)` — so a caller writes `call()` and
|
|
14
|
+
* never learns whether an HTTP request, a socket frame or a queued job did the work.
|
|
15
|
+
*/
|
|
11
16
|
export var RouteProtocols;
|
|
12
17
|
(function (RouteProtocols) {
|
|
13
18
|
RouteProtocols["WEB"] = "http";
|
|
14
19
|
RouteProtocols["SOCKET"] = "ws";
|
|
20
|
+
RouteProtocols["QUEUE"] = "queue";
|
|
15
21
|
})(RouteProtocols || (RouteProtocols = {}));
|
|
16
22
|
//# sourceMappingURL=consts.js.map
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,0BAAW,CAAA;IACX,gCAAiB,CAAA;AACnB,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,CAAA;AAEtB,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;AAExB,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,0BAAW,CAAA;IACX,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,0BAAW,CAAA;IACX,gCAAiB,CAAA;AACnB,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,CAAA;AAEtB,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;AAExB;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,8BAAY,CAAA;IACZ,+BAAa,CAAA;IACb,iCAAe,CAAA;AACjB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB"}
|
package/build/helper.d.ts
CHANGED
|
@@ -8,5 +8,11 @@ export declare const rtype: (type: AppType, opts?: RouteOptions | string) => Par
|
|
|
8
8
|
export declare const backend: (opts?: RouteOptions | string | null, method?: RouteOptions | RouteMethod) => Partial<RouteOptions>;
|
|
9
9
|
export declare const service: (service: string, opts?: Partial<RouteOptions>) => Partial<RouteOptions>;
|
|
10
10
|
export declare const socket: (opts?: RouteOptions | string | null, secondary?: RouteOptions) => Partial<RouteOptions>;
|
|
11
|
+
/**
|
|
12
|
+
* A backend route carried by the queue rather than by HTTP. Everything else about it is a normal
|
|
13
|
+
* backend route — it has a path, a parent, guards and a filter — so the same declaration is served
|
|
14
|
+
* with `elevate(...)` and called with `call()`; only the transport underneath differs.
|
|
15
|
+
*/
|
|
16
|
+
export declare const job: (opts?: RouteOptions | string | null, secondary?: RouteOptions) => Partial<RouteOptions>;
|
|
11
17
|
export declare const frontend: (opts?: RouteOptions | string | null, def?: RouteOptions | boolean) => Partial<RouteOptions>;
|
|
12
18
|
//# sourceMappingURL=helper.d.ts.map
|
package/build/helper.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAuB,MAAM,aAAa,CAAA;AAE9D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AAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAM5C,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,MAAM,OAAO,EAAE,OAAO,YAAY,GAAG,MAAM,KAAG,OAAO,CAAC,YAAY,CAEvF,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,GAAG,MAAM,GAAG,IAAI,EAAE,SAAS,YAAY,GAAG,WAAW,KAAG,OAAO,CAAC,YAAY,CAQtH,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,EAAE,OAAO,OAAO,CAAC,YAAY,CAAC,KAAG,OAAO,CAAC,YAAY,CAI3F,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,OAAO,YAAY,GAAG,MAAM,GAAG,IAAI,EAAE,YAAY,YAAY,KAAG,OAAO,CAAC,YAAY,CAM1G,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,GAAI,OAAO,YAAY,GAAG,MAAM,GAAG,IAAI,EAAE,YAAY,YAAY,KAAG,OAAO,CAAC,YAAY,CAMvG,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,YAAY,GAAG,MAAM,GAAG,IAAI,EAAE,MAAM,YAAY,GAAG,OAAO,KAAG,OAAO,CAAC,YAAY,CAQhH,CAAA"}
|
package/build/helper.js
CHANGED
|
@@ -28,6 +28,16 @@ export const socket = (opts, secondary) => {
|
|
|
28
28
|
route.protocol = RouteProtocols.SOCKET;
|
|
29
29
|
return route;
|
|
30
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* A backend route carried by the queue rather than by HTTP. Everything else about it is a normal
|
|
33
|
+
* backend route — it has a path, a parent, guards and a filter — so the same declaration is served
|
|
34
|
+
* with `elevate(...)` and called with `call()`; only the transport underneath differs.
|
|
35
|
+
*/
|
|
36
|
+
export const job = (opts, secondary) => {
|
|
37
|
+
const route = backend(opts, secondary);
|
|
38
|
+
route.protocol = RouteProtocols.QUEUE;
|
|
39
|
+
return route;
|
|
40
|
+
};
|
|
31
41
|
export const frontend = (opts, def) => {
|
|
32
42
|
if (typeof def === 'boolean') {
|
|
33
43
|
opts = typeof opts === 'string' ? { parent: opts, default: def } : { default: def, ...(opts ?? {}) };
|
package/build/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAe,cAAc,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAIxD,MAAM,CAAC,MAAM,KAAK,GAAqC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAK,EAAE,EAAE,CAC5E,cAAc,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAU,EAAE;IACpD,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAClB,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACpD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAEtD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAE,IAA4B,EAAyB,EAAE,CAAC,CAC3F,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,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GED
|
@@ -22,6 +22,18 @@ export interface RouteDeclaration extends BasicRoute {
|
|
|
22
22
|
method?: RouteMethod;
|
|
23
23
|
protocol?: RouteProtocols;
|
|
24
24
|
secure?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* QUEUE routes only: the queue that carries this entrypoint's jobs. It names an address, not a
|
|
27
|
+
* process — which queues a given process consumes is configuration, never a declaration.
|
|
28
|
+
*/
|
|
29
|
+
queue?: string;
|
|
30
|
+
/**
|
|
31
|
+
* QUEUE routes only: whether the caller waits for the job's return value. `false` resolves as
|
|
32
|
+
* soon as the job is accepted, which is what a long pipeline wants; the default is to wait.
|
|
33
|
+
*/
|
|
34
|
+
reply?: boolean;
|
|
35
|
+
/** How long a caller waits for an answer, in milliseconds, when the transport supports it. */
|
|
36
|
+
timeout?: number;
|
|
25
37
|
}
|
|
26
38
|
export interface CommonServiceRoute extends BasicRoute {
|
|
27
39
|
home?: string;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAA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,UAAU;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC9D,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,cAAc,CAAA;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,gBAAgB,CAAC;CAC9D"}
|
package/package.json
CHANGED
package/src/consts.ts
CHANGED
|
@@ -11,7 +11,13 @@ export const SEP = '/'
|
|
|
11
11
|
|
|
12
12
|
export const PARAM = ':'
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* How a route is carried. The protocol picks the transport that answers it — an application binds
|
|
16
|
+
* one by registering a service under `transportAlias(protocol)` — so a caller writes `call()` and
|
|
17
|
+
* never learns whether an HTTP request, a socket frame or a queued job did the work.
|
|
18
|
+
*/
|
|
14
19
|
export enum RouteProtocols {
|
|
15
20
|
WEB = 'http',
|
|
16
|
-
SOCKET = 'ws'
|
|
21
|
+
SOCKET = 'ws',
|
|
22
|
+
QUEUE = 'queue'
|
|
17
23
|
}
|
package/src/helper.ts
CHANGED
|
@@ -43,6 +43,19 @@ export const socket = (opts?: RouteOptions | string | null, secondary?: RouteOpt
|
|
|
43
43
|
return route
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A backend route carried by the queue rather than by HTTP. Everything else about it is a normal
|
|
48
|
+
* backend route — it has a path, a parent, guards and a filter — so the same declaration is served
|
|
49
|
+
* with `elevate(...)` and called with `call()`; only the transport underneath differs.
|
|
50
|
+
*/
|
|
51
|
+
export const job = (opts?: RouteOptions | string | null, secondary?: RouteOptions): Partial<RouteOptions> => {
|
|
52
|
+
const route = backend(opts, secondary)
|
|
53
|
+
|
|
54
|
+
route.protocol = RouteProtocols.QUEUE
|
|
55
|
+
|
|
56
|
+
return route
|
|
57
|
+
}
|
|
58
|
+
|
|
46
59
|
export const frontend = (opts?: RouteOptions | string | null, def?: RouteOptions | boolean): Partial<RouteOptions> => {
|
|
47
60
|
if (typeof def === 'boolean') {
|
|
48
61
|
opts = typeof opts === 'string' ? { parent: opts, default: def } : { default: def, ...(opts ?? {}) }
|
package/src/types.ts
CHANGED
|
@@ -24,6 +24,18 @@ export interface RouteDeclaration extends BasicRoute {
|
|
|
24
24
|
method?: RouteMethod
|
|
25
25
|
protocol?: RouteProtocols
|
|
26
26
|
secure?: boolean
|
|
27
|
+
/**
|
|
28
|
+
* QUEUE routes only: the queue that carries this entrypoint's jobs. It names an address, not a
|
|
29
|
+
* process — which queues a given process consumes is configuration, never a declaration.
|
|
30
|
+
*/
|
|
31
|
+
queue?: string
|
|
32
|
+
/**
|
|
33
|
+
* QUEUE routes only: whether the caller waits for the job's return value. `false` resolves as
|
|
34
|
+
* soon as the job is accepted, which is what a long pipeline wants; the default is to wait.
|
|
35
|
+
*/
|
|
36
|
+
reply?: boolean
|
|
37
|
+
/** How long a caller waits for an answer, in milliseconds, when the transport supports it. */
|
|
38
|
+
timeout?: number
|
|
27
39
|
}
|
|
28
40
|
|
|
29
41
|
export interface CommonServiceRoute extends BasicRoute {
|