@owlmeans/entrypoint 0.1.18-rc.2 → 0.1.18-rc.21
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/README.md +272 -60
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/entrypoint/SKILL.md +84 -48
- package/build/consts.d.ts +5 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +5 -0
- package/build/consts.js.map +1 -1
- package/build/entrypoint.d.ts +0 -1
- package/build/entrypoint.d.ts.map +1 -1
- package/build/entrypoint.js +31 -57
- package/build/entrypoint.js.map +1 -1
- package/build/helper.d.ts +1 -2
- package/build/helper.d.ts.map +1 -1
- package/build/helper.js +0 -9
- package/build/helper.js.map +1 -1
- package/build/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/materialize.d.ts +12 -0
- package/build/materialize.d.ts.map +1 -0
- package/build/materialize.js +34 -0
- package/build/materialize.js.map +1 -0
- package/build/protocol.d.ts +231 -0
- package/build/protocol.d.ts.map +1 -0
- package/build/protocol.js +124 -0
- package/build/protocol.js.map +1 -0
- package/build/types.d.ts +60 -10
- package/build/types.d.ts.map +1 -1
- package/build/utils/entrypoint.d.ts.map +1 -1
- package/build/utils/entrypoint.js +1 -1
- package/build/utils/entrypoint.js.map +1 -1
- package/build/utils/types.d.ts +2 -2
- package/build/utils/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/consts.ts +6 -0
- package/src/entrypoint.ts +33 -65
- package/src/helper.ts +1 -12
- package/src/index.ts +3 -3
- package/src/materialize.ts +49 -0
- package/src/protocol.ts +402 -0
- package/src/types.ts +63 -10
- package/src/utils/entrypoint.ts +1 -1
- package/src/utils/types.ts +2 -2
package/build/entrypoint.js
CHANGED
|
@@ -1,61 +1,49 @@
|
|
|
1
1
|
import { appendContextual } from '@owlmeans/context';
|
|
2
|
+
import { isLocalRoute, resolveAddress, resolveMount, resolvePath, resolveService } from '@owlmeans/route/utils';
|
|
2
3
|
export const entrypoint = (route, opts) => {
|
|
3
|
-
let guards = null;
|
|
4
|
-
let gates = null;
|
|
5
4
|
const ep = appendContextual(route.route.alias, {
|
|
6
5
|
_entrypoint: true,
|
|
7
|
-
_module: true,
|
|
8
6
|
sticky: false,
|
|
9
7
|
route,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
getParent: () => {
|
|
22
|
-
const parentAlias = ep.getParentAlias();
|
|
23
|
-
if (parentAlias == null) {
|
|
24
|
-
throw new SyntaxError(`Entrypoint has no parent - ${ep.getAlias()}`);
|
|
25
|
-
}
|
|
26
|
-
if (ep.ctx == null) {
|
|
27
|
-
throw new SyntaxError(`Entrypoint has no context yet - ${ep.getAlias()}`);
|
|
28
|
-
}
|
|
29
|
-
return ep.ctx.entrypoint(parentAlias);
|
|
30
|
-
},
|
|
31
|
-
setService: service => {
|
|
32
|
-
if (ep.route.route.resolved) {
|
|
33
|
-
throw new SyntaxError(`Cannot update a resolved entrypoint - ${ep.getAlias()}`);
|
|
34
|
-
}
|
|
35
|
-
ep.route.route.service = service;
|
|
36
|
-
},
|
|
8
|
+
segment: () => ep.route.route.path,
|
|
9
|
+
path: () => resolvePath(ep.assertCtx(), ep.route.route),
|
|
10
|
+
mount: () => resolveMount(ep.assertCtx(), ep.route.route),
|
|
11
|
+
service: () => resolveService(ep.assertCtx(), ep.route.route),
|
|
12
|
+
address: () => resolveAddress(ep.assertCtx(), ep.route.route),
|
|
13
|
+
isLocal: () => isLocalRoute(ep.assertCtx(), ep.route.route),
|
|
14
|
+
parent: () => ep.route.route.parent == null ? null
|
|
15
|
+
: ep.assertCtx().entrypoint(ep.route.route.parent),
|
|
16
|
+
// Walked afresh on every call: a guard attached to an ancestor after this entrypoint was first
|
|
17
|
+
// asked still has to count.
|
|
37
18
|
getGuards: () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (ep.hasParent()) {
|
|
43
|
-
guards.push(...ep.getParent().getGuards().filter(guard => !guards?.includes(guard)));
|
|
19
|
+
const guards = [...ep.guards ?? []];
|
|
20
|
+
const parent = ep.parent();
|
|
21
|
+
if (parent != null) {
|
|
22
|
+
guards.push(...parent.getGuards().filter(guard => !guards.includes(guard)));
|
|
44
23
|
}
|
|
45
24
|
return guards;
|
|
46
25
|
},
|
|
26
|
+
/**
|
|
27
|
+
* The gates standing over this entrypoint: its own, then an ancestor's for each gate service
|
|
28
|
+
* this entrypoint has not already named.
|
|
29
|
+
*
|
|
30
|
+
* KNOWN HAZARD, deliberately left alone: the dedup is by gate SERVICE, and two gates under one
|
|
31
|
+
* service are two different questions because their parameters differ — so a child that
|
|
32
|
+
* declares its own gate silently drops its ancestor's, which is the opposite of what
|
|
33
|
+
* "inherited" means. Anything that needs a group rule AND a member rule must therefore not
|
|
34
|
+
* express the group half as a gate under the same service. Changing this would widen every
|
|
35
|
+
* backend and socket entrypoint that today relies on the replacement, so it is a migration
|
|
36
|
+
* rather than a fix.
|
|
37
|
+
*/
|
|
47
38
|
getGates: () => {
|
|
48
|
-
|
|
49
|
-
return gates;
|
|
50
|
-
}
|
|
51
|
-
gates = ep.gate != null ? [[
|
|
39
|
+
const gates = ep.gate != null ? [[
|
|
52
40
|
ep.gate, ep.gateParams == null
|
|
53
41
|
? [] : Array.isArray(ep.gateParams)
|
|
54
42
|
? ep.gateParams : [ep.gateParams]
|
|
55
43
|
]] : [];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
const parent = ep.parent();
|
|
45
|
+
if (parent != null) {
|
|
46
|
+
gates.push(...parent.getGates().filter(([gate]) => !gates.some(([g]) => g === gate)));
|
|
59
47
|
}
|
|
60
48
|
return gates;
|
|
61
49
|
},
|
|
@@ -63,18 +51,4 @@ export const entrypoint = (route, opts) => {
|
|
|
63
51
|
});
|
|
64
52
|
return ep;
|
|
65
53
|
};
|
|
66
|
-
export const parent = (ep, aliasOrParent, _parent) => {
|
|
67
|
-
if (Array.isArray(ep)) {
|
|
68
|
-
if (_parent == null) {
|
|
69
|
-
throw SyntaxError('Elevating parent requires parent name to be specified');
|
|
70
|
-
}
|
|
71
|
-
ep = ep.find(e => e.route.route.alias === aliasOrParent);
|
|
72
|
-
if (ep == null) {
|
|
73
|
-
throw SyntaxError(`Entrypoint not found ${aliasOrParent}`);
|
|
74
|
-
}
|
|
75
|
-
return parent(ep, _parent);
|
|
76
|
-
}
|
|
77
|
-
ep.route.route.parent = aliasOrParent;
|
|
78
|
-
return ep;
|
|
79
|
-
};
|
|
80
54
|
//# sourceMappingURL=entrypoint.js.map
|
package/build/entrypoint.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EACL,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EACxE,MAAM,uBAAuB,CAAA;AAG9B,MAAM,CAAC,MAAM,UAAU,GAAgD,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrF,MAAM,EAAE,GAAqB,gBAAgB,CAAmB,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;QACjF,WAAW,EAAE,IAAI;QAEjB,MAAM,EAAE,KAAK;QAEb,KAAK;QAEL,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI;QAElC,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW,CAA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QAAQ,EAAE,GAAG,EAAE;YACb,MAAM,KAAK,GAAyB,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;oBACrD,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,IAAI,IAAI;wBAC5B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;wBACjC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC;iBACtC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YAEP,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,CAAA;YAC1B,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;gBACnB,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAA;YACvF,CAAC;YAED,OAAO,KAAK,CAAA;QACd,CAAC;QAED,GAAG,IAAI;KACR,CAAC,CAAA;IAEF,OAAO,EAAE,CAAA;AACX,CAAC,CAAA"}
|
package/build/helper.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Filter, CommonEntrypointOptions, AbstractResponse
|
|
1
|
+
import { Filter, CommonEntrypointOptions, AbstractResponse } from './types.js';
|
|
2
2
|
export declare const filter: (filter: Filter, opts?: CommonEntrypointOptions) => CommonEntrypointOptions;
|
|
3
3
|
export declare const guard: (guard: string, opts?: CommonEntrypointOptions) => CommonEntrypointOptions;
|
|
4
4
|
export declare const gate: (gate: string, params: string | string[], opts?: CommonEntrypointOptions) => CommonEntrypointOptions;
|
|
5
5
|
export declare const provideResponse: <T>(originalResponse?: unknown) => AbstractResponse<T>;
|
|
6
|
-
export declare const clone: <M extends CommonEntrypoint>(entrypoints: M[], from: string, to: string, service: string) => void;
|
|
7
6
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE9E,eAAO,MAAM,MAAM,WAAY,MAAM,SAAS,uBAAuB,KAAG,uBAAgD,CAAA;AAExH,eAAO,MAAM,KAAK,UAAW,MAAM,SAAS,uBAAuB,KAAG,uBACC,CAAA;AAEvE,eAAO,MAAM,IAAI,SAAU,MAAM,UAAU,MAAM,GAAG,MAAM,EAAE,SAAS,uBAAuB,KAAG,uBACtD,CAAA;AAEzC,eAAO,MAAM,eAAe,GAAI,CAAC,qBAAqB,OAAO,KAAG,gBAAgB,CAAC,CAAC,CAejF,CAAA"}
|
package/build/helper.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { route } from '@owlmeans/route';
|
|
2
|
-
import { entrypoint } from './entrypoint.js';
|
|
3
1
|
export const filter = (filter, opts) => ({ filter, ...opts });
|
|
4
2
|
export const guard = (guard, opts) => ({ ...opts, guards: [...new Set([guard, ...(opts?.guards ?? [])])] });
|
|
5
3
|
export const gate = (gate, params, opts) => ({ ...opts, gate, gateParams: params });
|
|
@@ -16,11 +14,4 @@ export const provideResponse = (originalResponse) => {
|
|
|
16
14
|
};
|
|
17
15
|
return handler;
|
|
18
16
|
};
|
|
19
|
-
export const clone = (entrypoints, from, to, service) => {
|
|
20
|
-
const source = entrypoints.find(e => e.alias === from);
|
|
21
|
-
if (source?.route.route != null) {
|
|
22
|
-
const _route = { ...source.route.route, service, resolved: false, alias: to };
|
|
23
|
-
entrypoints.push(entrypoint(route(to, _route.path, _route)));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
17
|
//# sourceMappingURL=helper.js.map
|
package/build/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,IAA8B,EAA2B,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;AAExH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,IAA8B,EAA2B,EAAE,CAC9F,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAEvE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,MAAyB,EAAE,IAA8B,EAA2B,EAAE,CACvH,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAI,gBAA0B,EAAuB,EAAE;IACpF,MAAM,OAAO,GAAwB;QACnC,gBAAgB,EAAE,gBAAgB;QAElC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;YACrB,OAAO,CAAC,OAAO,GAAG,OAAO,CAAA;QAC3B,CAAC;QAED,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACvB,CAAC;KACF,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type * from './types.js';
|
|
2
|
-
export * from './entrypoint.js';
|
|
3
|
-
export * from './filter.js';
|
|
4
|
-
export * from './helper.js';
|
|
5
2
|
export * from './consts.js';
|
|
3
|
+
export * from './protocol.js';
|
|
4
|
+
export * from './materialize.js';
|
|
5
|
+
export { provideResponse } from './helper.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './entrypoint.js';
|
|
2
|
-
export * from './filter.js';
|
|
3
|
-
export * from './helper.js';
|
|
4
1
|
export * from './consts.js';
|
|
2
|
+
export * from './protocol.js';
|
|
3
|
+
export * from './materialize.js';
|
|
4
|
+
export { provideResponse } from './helper.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CommonEntrypoint } from './types.js';
|
|
2
|
+
import type { EntrypointProtocolDeclaration } from './protocol.js';
|
|
3
|
+
/** A context-bound entrypoint made from an immutable protocol declaration. */
|
|
4
|
+
export type MaterializedEntrypoint<Protocol extends EntrypointProtocolDeclaration> = CommonEntrypoint & {
|
|
5
|
+
readonly protocol: Protocol;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Make a local, mutable registration from a shared declaration. The protocol is never mutated;
|
|
9
|
+
* guards, route resolution and handlers belong exclusively to this materialized entrypoint.
|
|
10
|
+
*/
|
|
11
|
+
export declare const materializeEntrypoint: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol) => MaterializedEntrypoint<Protocol>;
|
|
12
|
+
//# sourceMappingURL=materialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize.d.ts","sourceRoot":"","sources":["../src/materialize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAmC,MAAM,YAAY,CAAA;AACnF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,eAAe,CAAA;AAElE,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,CAAC,QAAQ,SAAS,6BAA6B,IAAI,gBAAgB,GAAG;IACtG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAC5B,CAAA;AAgCD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,SAAS,6BAA6B,YACxE,QAAQ,KACjB,sBAAsB,CAAC,QAAQ,CAGjC,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { entrypoint } from './entrypoint.js';
|
|
2
|
+
const filterOf = (protocol) => {
|
|
3
|
+
const request = protocol.contract?.requestSchemas;
|
|
4
|
+
const response = protocol.contract?.responseSchemas;
|
|
5
|
+
if (request == null && response == null)
|
|
6
|
+
return undefined;
|
|
7
|
+
return {
|
|
8
|
+
body: request?.body == null ? undefined : structuredClone(request.body),
|
|
9
|
+
params: request?.params == null ? undefined : structuredClone(request.params),
|
|
10
|
+
query: request?.query == null ? undefined : structuredClone(request.query),
|
|
11
|
+
headers: request?.headers == null ? undefined : structuredClone(request.headers),
|
|
12
|
+
// Fastify requires response serializers to be keyed by a status code. A protocol's
|
|
13
|
+
// ordinary response has no explicit outcome, so it is the normal successful 200 reply.
|
|
14
|
+
response: response == null ? undefined : {
|
|
15
|
+
...(response.default == null ? {} : { 200: structuredClone(response.default) }),
|
|
16
|
+
...Object.fromEntries(Object.entries(response.byStatus ?? {}).map(([status, schema]) => [
|
|
17
|
+
status, structuredClone(schema),
|
|
18
|
+
])),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const optionsOf = (protocol) => ({
|
|
23
|
+
sticky: protocol.sticky,
|
|
24
|
+
guards: [...protocol.guards],
|
|
25
|
+
gate: protocol.gate?.alias,
|
|
26
|
+
gateParams: protocol.gate == null ? undefined : [...protocol.gate.params],
|
|
27
|
+
filter: filterOf(protocol),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Make a local, mutable registration from a shared declaration. The protocol is never mutated;
|
|
31
|
+
* guards, route resolution and handlers belong exclusively to this materialized entrypoint.
|
|
32
|
+
*/
|
|
33
|
+
export const materializeEntrypoint = (protocol) => Object.assign(entrypoint({ route: { ...protocol.route.route } }, optionsOf(protocol)), { protocol });
|
|
34
|
+
//# sourceMappingURL=materialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materialize.js","sourceRoot":"","sources":["../src/materialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAS5C,MAAM,QAAQ,GAAG,CAAC,QAAuC,EAAsB,EAAE;IAC/E,MAA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AA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,QAAuC,EAA2B,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK;IAC1B,UAAU,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IACzE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC;CAC3B,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAAkB,EACgB,EAAE,CAAC,MAAM,CAAC,MAAM,CAClD,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,EACvE,EAAE,QAAQ,EAAE,CACb,CAAA"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { Auth } from '@owlmeans/auth';
|
|
2
|
+
import type { BasicEntrypoint, EntrypointReference } from '@owlmeans/context';
|
|
3
|
+
import type { JSONSchemaType, AnySchemaObject } from 'ajv';
|
|
4
|
+
import type { RouteModel } from '@owlmeans/route';
|
|
5
|
+
import type { EntrypointOutcome } from './consts.js';
|
|
6
|
+
import type { ResolvedEntity } from './types.js';
|
|
7
|
+
import type { AbstractRequest } from './types.js';
|
|
8
|
+
/** A deliberately broad value used only by declarations without an I/O contract. */
|
|
9
|
+
export type OpenValue = object | string | number | boolean | bigint | null | undefined;
|
|
10
|
+
/** The request accepted by a declaration that intentionally supplies no contract. */
|
|
11
|
+
export interface OpenRequest {
|
|
12
|
+
body?: object;
|
|
13
|
+
params?: object;
|
|
14
|
+
query?: object;
|
|
15
|
+
headers?: object;
|
|
16
|
+
}
|
|
17
|
+
/** The four independent request sections an entrypoint may declare. */
|
|
18
|
+
export interface RequestShape {
|
|
19
|
+
body?: OpenValue;
|
|
20
|
+
params?: object;
|
|
21
|
+
query?: object;
|
|
22
|
+
headers?: object;
|
|
23
|
+
}
|
|
24
|
+
/** Addressing and transport controls are never part of an entrypoint's payload contract. */
|
|
25
|
+
export interface CallOptions {
|
|
26
|
+
auth?: Auth;
|
|
27
|
+
host?: string;
|
|
28
|
+
base?: string | boolean;
|
|
29
|
+
unsecure?: boolean;
|
|
30
|
+
timeout?: number;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
interface TypeToken {
|
|
34
|
+
readonly kind: 'entrypoint-type';
|
|
35
|
+
readonly schema?: AnySchemaObject;
|
|
36
|
+
}
|
|
37
|
+
/** A type-only contract source, optionally paired with an AJV schema. */
|
|
38
|
+
export type Typed<T> = TypeToken & {
|
|
39
|
+
readonly value?: T;
|
|
40
|
+
};
|
|
41
|
+
declare const entrypointSchemaType: unique symbol;
|
|
42
|
+
/**
|
|
43
|
+
* A JSON schema carrying the model type it validates. Use `schema<Model>(...)` once beside the
|
|
44
|
+
* model; every protocol that consumes it then infers the model without another generic.
|
|
45
|
+
*/
|
|
46
|
+
export type EntrypointSchema<T> = JSONSchemaType<T> & {
|
|
47
|
+
readonly [entrypointSchemaType]: T;
|
|
48
|
+
};
|
|
49
|
+
export declare const schema: <T>(value: JSONSchemaType<T>) => EntrypointSchema<T>;
|
|
50
|
+
/** A schema or an explicit type-only source for one request/response value. */
|
|
51
|
+
export type ShapeSource<T> = EntrypointSchema<T> | JSONSchemaType<T> | Typed<T>;
|
|
52
|
+
type AnyShapeSource = AnySchemaObject | TypeToken;
|
|
53
|
+
/**
|
|
54
|
+
* Supplies type information where a response has no runtime schema, or attaches a type to an
|
|
55
|
+
* otherwise untyped schema literal at the declaration boundary.
|
|
56
|
+
*/
|
|
57
|
+
export declare function typed<T>(): Typed<T>;
|
|
58
|
+
export declare function typed<T>(schema: JSONSchemaType<T>): Typed<T>;
|
|
59
|
+
export interface RequestSources {
|
|
60
|
+
body?: AnyShapeSource;
|
|
61
|
+
params?: AnyShapeSource;
|
|
62
|
+
query?: AnyShapeSource;
|
|
63
|
+
headers?: AnyShapeSource;
|
|
64
|
+
}
|
|
65
|
+
export interface RuntimeRequestSchemas {
|
|
66
|
+
body?: AnySchemaObject;
|
|
67
|
+
params?: AnySchemaObject;
|
|
68
|
+
query?: AnySchemaObject;
|
|
69
|
+
headers?: AnySchemaObject;
|
|
70
|
+
}
|
|
71
|
+
export interface RuntimeResponseSchemas {
|
|
72
|
+
default?: AnySchemaObject;
|
|
73
|
+
byStatus?: Readonly<Record<number, AnySchemaObject>>;
|
|
74
|
+
}
|
|
75
|
+
/** The runtime schemas and compile-time request/response pair attached to one protocol. */
|
|
76
|
+
export interface EntrypointContract<Request extends RequestShape, Response> {
|
|
77
|
+
readonly kind: 'entrypoint-contract';
|
|
78
|
+
readonly requestSchemas: RuntimeRequestSchemas;
|
|
79
|
+
readonly responseSchemas?: RuntimeResponseSchemas;
|
|
80
|
+
readonly requestType?: Request;
|
|
81
|
+
readonly responseType?: Response;
|
|
82
|
+
}
|
|
83
|
+
/** Runtime fields common to every protocol, regardless of its compile-time request/reply pair. */
|
|
84
|
+
export interface EntrypointProtocolDeclaration {
|
|
85
|
+
readonly kind: 'entrypoint-protocol';
|
|
86
|
+
readonly alias: string;
|
|
87
|
+
readonly route: RouteModel;
|
|
88
|
+
readonly contract?: Pick<EntrypointContract<RequestShape, OpenValue>, 'kind' | 'requestSchemas' | 'responseSchemas'>;
|
|
89
|
+
readonly sticky: boolean;
|
|
90
|
+
readonly guards: readonly string[];
|
|
91
|
+
readonly gate?: {
|
|
92
|
+
readonly alias: string;
|
|
93
|
+
readonly params: readonly string[];
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** An access gate declared by a protocol, including inherited parent declarations. */
|
|
97
|
+
export interface EntrypointGate {
|
|
98
|
+
readonly alias: string;
|
|
99
|
+
readonly params: readonly string[];
|
|
100
|
+
}
|
|
101
|
+
type SourceValue<Source> = Source extends Typed<infer Value> ? Value : Source extends EntrypointSchema<infer Value> ? Value : Source extends JSONSchemaType<infer Value> ? Value extends OpenValue ? Value : OpenValue : OpenValue;
|
|
102
|
+
type RequestFromSources<Sources extends RequestSources> = (Sources extends {
|
|
103
|
+
body: infer Source;
|
|
104
|
+
} ? {
|
|
105
|
+
body: SourceValue<Source>;
|
|
106
|
+
} : {}) & (Sources extends {
|
|
107
|
+
params: infer Source;
|
|
108
|
+
} ? {
|
|
109
|
+
params: SourceValue<Source>;
|
|
110
|
+
} : {}) & (Sources extends {
|
|
111
|
+
query: infer Source;
|
|
112
|
+
} ? {
|
|
113
|
+
query: SourceValue<Source>;
|
|
114
|
+
} : {}) & (Sources extends {
|
|
115
|
+
headers: infer Source;
|
|
116
|
+
} ? {
|
|
117
|
+
headers: SourceValue<Source>;
|
|
118
|
+
} : {});
|
|
119
|
+
/**
|
|
120
|
+
* Declare an exact request and response. The primary overload means a body request; use
|
|
121
|
+
* `contract.request` for independently-shaped request sections.
|
|
122
|
+
*/
|
|
123
|
+
export declare function contract(): EntrypointContract<{}, undefined>;
|
|
124
|
+
export declare function contract<Response>(response: ShapeSource<Response>): EntrypointContract<{}, Response>;
|
|
125
|
+
export declare function contract<Body extends OpenValue, Response>(body: ShapeSource<Body>, response: ShapeSource<Response>): EntrypointContract<{
|
|
126
|
+
body: Body;
|
|
127
|
+
}, Response>;
|
|
128
|
+
export declare namespace contract {
|
|
129
|
+
function request<Sources extends RequestSources, Response>(request: Sources, response: ShapeSource<Response>): EntrypointContract<RequestFromSources<Sources>, Response>;
|
|
130
|
+
}
|
|
131
|
+
export interface EntrypointOptions {
|
|
132
|
+
sticky?: boolean;
|
|
133
|
+
guards?: string | readonly string[];
|
|
134
|
+
gate?: {
|
|
135
|
+
alias: string;
|
|
136
|
+
params?: string | readonly string[];
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface EntrypointResult<Response> {
|
|
140
|
+
value: Response;
|
|
141
|
+
outcome: EntrypointOutcome;
|
|
142
|
+
}
|
|
143
|
+
export type CallArguments<Request extends RequestShape> = {} extends Request ? [request?: Request & CallOptions] : [request: Request & CallOptions];
|
|
144
|
+
type UrlRequest<Request extends RequestShape> = (Request extends {
|
|
145
|
+
params: infer Params;
|
|
146
|
+
} ? {
|
|
147
|
+
params: Params;
|
|
148
|
+
} : Request extends {
|
|
149
|
+
params?: infer Params;
|
|
150
|
+
} ? {
|
|
151
|
+
params?: Params;
|
|
152
|
+
} : {}) & (Request extends {
|
|
153
|
+
query: infer Query;
|
|
154
|
+
} ? {
|
|
155
|
+
query: Query;
|
|
156
|
+
} : Request extends {
|
|
157
|
+
query?: infer Query;
|
|
158
|
+
} ? {
|
|
159
|
+
query?: Query;
|
|
160
|
+
} : {});
|
|
161
|
+
export type UrlArguments<Request extends RequestShape> = {} extends UrlRequest<Request> ? [request?: UrlRequest<Request> & CallOptions] : [request: UrlRequest<Request> & CallOptions];
|
|
162
|
+
export interface EntrypointRequestMeta {
|
|
163
|
+
alias: string;
|
|
164
|
+
auth?: Auth;
|
|
165
|
+
entity?: ResolvedEntity;
|
|
166
|
+
path: string;
|
|
167
|
+
canceled?: boolean;
|
|
168
|
+
cancel?: () => void;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A protocol request at an implementation boundary.
|
|
172
|
+
*
|
|
173
|
+
* Transport metadata and empty request sections remain available to handlers; a declared section
|
|
174
|
+
* then refines that base shape to its protocol contract.
|
|
175
|
+
*/
|
|
176
|
+
export type HandlerRequest<Request extends RequestShape> = AbstractRequest & Request & EntrypointRequestMeta;
|
|
177
|
+
/** The context-bound counterpart of an immutable protocol declaration. */
|
|
178
|
+
export interface RegisteredEntrypoint<Request extends RequestShape, Response> extends BasicEntrypoint {
|
|
179
|
+
readonly protocol: EntrypointProtocol<Request, Response>;
|
|
180
|
+
call: (...args: CallArguments<Request>) => Promise<Response>;
|
|
181
|
+
invoke: (...args: CallArguments<Request>) => Promise<EntrypointResult<Response>>;
|
|
182
|
+
url: (...args: UrlArguments<Request>) => Promise<string>;
|
|
183
|
+
validate: (...args: CallArguments<Request>) => Promise<boolean>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* An immutable shared declaration. Its inherited reference type is what gives a context lookup
|
|
187
|
+
* the exact registered entrypoint type without a consumer-supplied generic.
|
|
188
|
+
*/
|
|
189
|
+
export interface EntrypointProtocol<Request extends RequestShape = RequestShape, Response = OpenValue> extends EntrypointProtocolDeclaration, EntrypointReference<RegisteredEntrypoint<Request, Response>> {
|
|
190
|
+
readonly contract?: EntrypointContract<Request, Response>;
|
|
191
|
+
}
|
|
192
|
+
export type RequestOf<Protocol extends EntrypointProtocolDeclaration> = Protocol extends EntrypointProtocol<infer Request, infer _Response> ? Request : OpenRequest;
|
|
193
|
+
export type ResponseOf<Protocol extends EntrypointProtocolDeclaration> = Protocol extends EntrypointProtocol<infer _Request, infer Response> ? Response : OpenValue;
|
|
194
|
+
export type BodyOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
|
|
195
|
+
body: infer Body;
|
|
196
|
+
} ? Body : OpenValue;
|
|
197
|
+
export type ParamsOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
|
|
198
|
+
params: infer Params;
|
|
199
|
+
} ? Params : object;
|
|
200
|
+
export type QueryOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
|
|
201
|
+
query: infer Query;
|
|
202
|
+
} ? Query : object;
|
|
203
|
+
export type HeadersOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
|
|
204
|
+
headers: infer Headers;
|
|
205
|
+
} ? Headers : object;
|
|
206
|
+
export type CallRequestOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> & CallOptions;
|
|
207
|
+
/** Create an immutable protocol declaration from a route and its contract. */
|
|
208
|
+
export declare const protocol: <Request extends RequestShape, Response>(route: RouteModel, entrypointContract: EntrypointContract<Request, Response>, options?: EntrypointOptions) => EntrypointProtocol<Request, Response>;
|
|
209
|
+
export declare const openProtocol: (route: RouteModel, options?: EntrypointOptions) => EntrypointProtocol<OpenRequest, OpenValue>;
|
|
210
|
+
export declare const entrypointRef: <Request extends RequestShape = OpenRequest, Response = OpenValue>(alias: string) => EntrypointReference<RegisteredEntrypoint<Request, Response>>;
|
|
211
|
+
export declare const aliasOf: (reference: EntrypointReference | string) => string;
|
|
212
|
+
export declare const isEntrypointProtocol: (value: object) => value is EntrypointProtocolDeclaration;
|
|
213
|
+
export interface EntrypointTree {
|
|
214
|
+
readonly [key: string]: EntrypointProtocolDeclaration | EntrypointTree;
|
|
215
|
+
}
|
|
216
|
+
/** Flatten an exported protocol tree for a layer-specific materializer. */
|
|
217
|
+
export declare const protocols: (tree: EntrypointTree) => EntrypointProtocolDeclaration[];
|
|
218
|
+
/**
|
|
219
|
+
* Rebuild an immutable protocol tree while transforming its declarations.
|
|
220
|
+
*
|
|
221
|
+
* Protocol consumers keep addressing declarations by their exported tree path; a cross-cutting
|
|
222
|
+
* concern such as a coguard therefore never needs to flatten the tree and recover declarations
|
|
223
|
+
* by alias.
|
|
224
|
+
*/
|
|
225
|
+
export declare const mapProtocols: <Tree extends EntrypointTree>(tree: Tree, mapper: (protocol: EntrypointProtocolDeclaration) => EntrypointProtocolDeclaration) => Tree;
|
|
226
|
+
/** Resolve the gates a protocol inherits through its route parents without materializing it. */
|
|
227
|
+
export declare const gatesOf: (protocol: EntrypointProtocolDeclaration, tree: EntrypointTree) => readonly EntrypointGate[];
|
|
228
|
+
/** Clone an immutable protocol while preserving its request/response pair. */
|
|
229
|
+
export declare const decorateEntrypoint: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol, options: EntrypointOptions) => Protocol;
|
|
230
|
+
export {};
|
|
231
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -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UACF,CAAC,QAAQ,EAAE,6BAA6B,KAAK,6BAA6B,KACjF,IAKO,CAAA;AAEV,gGAAgG;AAChG,eAAO,MAAM,OAAO,aACR,6BAA6B,QACjC,cAAc,KACnB,SAAS,cAAc,EAiBzB,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,GAAI,QAAQ,SAAS,6BAA6B,YACrE,QAAQ,WACT,iBAAiB,KACzB,QAKD,CAAA"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export const schema = (value) => value;
|
|
2
|
+
export function typed(schema) {
|
|
3
|
+
return schema == null
|
|
4
|
+
? { kind: 'entrypoint-type' }
|
|
5
|
+
: { kind: 'entrypoint-type', schema };
|
|
6
|
+
}
|
|
7
|
+
const schemaOf = (source) => {
|
|
8
|
+
if (source == null)
|
|
9
|
+
return undefined;
|
|
10
|
+
const schema = 'kind' in source && source.kind === 'entrypoint-type'
|
|
11
|
+
? source.schema
|
|
12
|
+
: source;
|
|
13
|
+
return schema == null ? undefined : structuredClone(schema);
|
|
14
|
+
};
|
|
15
|
+
const responseSchemasOf = (source) => {
|
|
16
|
+
const schema = schemaOf(source);
|
|
17
|
+
return schema == null ? undefined : { default: schema };
|
|
18
|
+
};
|
|
19
|
+
export function contract(first, second) {
|
|
20
|
+
const body = second == null ? undefined : first;
|
|
21
|
+
const response = second ?? first;
|
|
22
|
+
return {
|
|
23
|
+
kind: 'entrypoint-contract',
|
|
24
|
+
requestSchemas: { body: schemaOf(body) },
|
|
25
|
+
responseSchemas: responseSchemasOf(response),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
(function (contract) {
|
|
29
|
+
function request(request, response) {
|
|
30
|
+
return {
|
|
31
|
+
kind: 'entrypoint-contract',
|
|
32
|
+
requestSchemas: {
|
|
33
|
+
body: schemaOf(request.body),
|
|
34
|
+
params: schemaOf(request.params),
|
|
35
|
+
query: schemaOf(request.query),
|
|
36
|
+
headers: schemaOf(request.headers),
|
|
37
|
+
},
|
|
38
|
+
responseSchemas: responseSchemasOf(response),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
contract.request = request;
|
|
42
|
+
})(contract || (contract = {}));
|
|
43
|
+
const guardsOf = (guards) => guards == null
|
|
44
|
+
? []
|
|
45
|
+
: typeof guards === 'string' ? [guards] : [...guards];
|
|
46
|
+
const gateOf = (gate) => gate == null
|
|
47
|
+
? undefined
|
|
48
|
+
: {
|
|
49
|
+
alias: gate.alias,
|
|
50
|
+
params: gate.params == null ? [] : typeof gate.params === 'string' ? [gate.params] : [...gate.params],
|
|
51
|
+
};
|
|
52
|
+
/** Create an immutable protocol declaration from a route and its contract. */
|
|
53
|
+
export const protocol = (route, entrypointContract, options) => Object.freeze({
|
|
54
|
+
kind: 'entrypoint-protocol',
|
|
55
|
+
alias: route.route.alias,
|
|
56
|
+
route: Object.freeze({ route: Object.freeze({ ...route.route }) }),
|
|
57
|
+
contract: entrypointContract,
|
|
58
|
+
sticky: options?.sticky ?? false,
|
|
59
|
+
guards: Object.freeze(guardsOf(options?.guards)),
|
|
60
|
+
gate: gateOf(options?.gate),
|
|
61
|
+
});
|
|
62
|
+
export const openProtocol = (route, options) => Object.freeze({
|
|
63
|
+
kind: 'entrypoint-protocol',
|
|
64
|
+
alias: route.route.alias,
|
|
65
|
+
route: Object.freeze({ route: Object.freeze({ ...route.route }) }),
|
|
66
|
+
sticky: options?.sticky ?? false,
|
|
67
|
+
guards: Object.freeze(guardsOf(options?.guards)),
|
|
68
|
+
gate: gateOf(options?.gate),
|
|
69
|
+
});
|
|
70
|
+
export const entrypointRef = (alias) => ({ alias });
|
|
71
|
+
export const aliasOf = (reference) => typeof reference === 'string' ? reference : reference.alias;
|
|
72
|
+
export const isEntrypointProtocol = (value) => 'kind' in value && value.kind === 'entrypoint-protocol';
|
|
73
|
+
/** Flatten an exported protocol tree for a layer-specific materializer. */
|
|
74
|
+
export const protocols = (tree) => {
|
|
75
|
+
const result = [];
|
|
76
|
+
const visit = (node) => {
|
|
77
|
+
Object.values(node).forEach((entry) => {
|
|
78
|
+
if (isEntrypointProtocol(entry)) {
|
|
79
|
+
result.push(entry);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
visit(entry);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
visit(tree);
|
|
87
|
+
return result;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Rebuild an immutable protocol tree while transforming its declarations.
|
|
91
|
+
*
|
|
92
|
+
* Protocol consumers keep addressing declarations by their exported tree path; a cross-cutting
|
|
93
|
+
* concern such as a coguard therefore never needs to flatten the tree and recover declarations
|
|
94
|
+
* by alias.
|
|
95
|
+
*/
|
|
96
|
+
export const mapProtocols = (tree, mapper) => Object.freeze(Object.fromEntries(Object.entries(tree).map(([key, entry]) => [
|
|
97
|
+
key,
|
|
98
|
+
isEntrypointProtocol(entry) ? mapper(entry) : mapProtocols(entry, mapper),
|
|
99
|
+
])));
|
|
100
|
+
/** Resolve the gates a protocol inherits through its route parents without materializing it. */
|
|
101
|
+
export const gatesOf = (protocol, tree) => {
|
|
102
|
+
const byAlias = new Map(protocols(tree).map(candidate => [candidate.alias, candidate]));
|
|
103
|
+
const result = [];
|
|
104
|
+
const visited = new Set();
|
|
105
|
+
let current = protocol;
|
|
106
|
+
while (current != null && !visited.has(current.alias)) {
|
|
107
|
+
visited.add(current.alias);
|
|
108
|
+
if (current.gate != null && !result.some(gate => gate.alias === current.gate.alias)) {
|
|
109
|
+
result.push(current.gate);
|
|
110
|
+
}
|
|
111
|
+
current = current.route.route.parent == null
|
|
112
|
+
? undefined
|
|
113
|
+
: byAlias.get(current.route.route.parent);
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
};
|
|
117
|
+
/** Clone an immutable protocol while preserving its request/response pair. */
|
|
118
|
+
export const decorateEntrypoint = (protocol, options) => Object.freeze({
|
|
119
|
+
...protocol,
|
|
120
|
+
sticky: options.sticky ?? protocol.sticky,
|
|
121
|
+
guards: options.guards == null ? protocol.guards : guardsOf(options.guards),
|
|
122
|
+
gate: options.gate == null ? protocol.gate : gateOf(options.gate),
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=protocol.js.map
|