@owlmeans/entrypoint 0.1.18-rc.8 → 0.1.18

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 (60) hide show
  1. package/README.md +262 -60
  2. package/agent-meta/manifest.json +3 -3
  3. package/agent-meta/skills/entrypoint/SKILL.md +78 -56
  4. package/build/entrypoint.d.ts +0 -1
  5. package/build/entrypoint.d.ts.map +1 -1
  6. package/build/entrypoint.js +31 -57
  7. package/build/entrypoint.js.map +1 -1
  8. package/build/filter/types.d.ts +16 -0
  9. package/build/filter/types.d.ts.map +1 -0
  10. package/build/filter/types.js +2 -0
  11. package/build/filter/types.js.map +1 -0
  12. package/build/filter.d.ts +3 -7
  13. package/build/filter.d.ts.map +1 -1
  14. package/build/filter.js +22 -18
  15. package/build/filter.js.map +1 -1
  16. package/build/helper.d.ts +1 -2
  17. package/build/helper.d.ts.map +1 -1
  18. package/build/helper.js +0 -9
  19. package/build/helper.js.map +1 -1
  20. package/build/index.d.ts +5 -3
  21. package/build/index.d.ts.map +1 -1
  22. package/build/index.js +4 -3
  23. package/build/index.js.map +1 -1
  24. package/build/materialize.d.ts +7 -0
  25. package/build/materialize.d.ts.map +1 -0
  26. package/build/materialize.js +34 -0
  27. package/build/materialize.js.map +1 -0
  28. package/build/protocol.d.ts +44 -0
  29. package/build/protocol.d.ts.map +1 -0
  30. package/build/protocol.js +124 -0
  31. package/build/protocol.js.map +1 -0
  32. package/build/types.d.ts +201 -12
  33. package/build/types.d.ts.map +1 -1
  34. package/build/types.local.d.ts +27 -0
  35. package/build/types.local.d.ts.map +1 -0
  36. package/build/types.local.js +2 -0
  37. package/build/types.local.js.map +1 -0
  38. package/build/utils/entrypoint.d.ts.map +1 -1
  39. package/build/utils/entrypoint.js +1 -1
  40. package/build/utils/entrypoint.js.map +1 -1
  41. package/build/utils/types.d.ts +2 -2
  42. package/build/utils/types.d.ts.map +1 -1
  43. package/build/utils.d.ts +6 -0
  44. package/build/utils.d.ts.map +1 -0
  45. package/build/utils.js +6 -0
  46. package/build/utils.js.map +1 -0
  47. package/package.json +6 -6
  48. package/src/consts.ts +1 -0
  49. package/src/entrypoint.ts +31 -65
  50. package/src/filter/types.ts +16 -0
  51. package/src/filter.ts +24 -17
  52. package/src/helper.ts +1 -12
  53. package/src/index.ts +5 -3
  54. package/src/materialize.ts +43 -0
  55. package/src/protocol.ts +191 -0
  56. package/src/types.local.ts +24 -0
  57. package/src/types.ts +234 -12
  58. package/src/utils/entrypoint.ts +1 -1
  59. package/src/utils/types.ts +2 -2
  60. package/src/utils.ts +5 -0
@@ -1,61 +1,49 @@
1
1
  import { appendContextual } from '@owlmeans/context';
2
+ import { routeAddressOf } 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
- getAlias: () => ep.route.route.alias,
11
- getPath: () => ep.route.route.path,
12
- getParentAlias: () => ep.route.route.parent ?? null,
13
- hasParent: () => ep.getParentAlias() != null,
14
- resolve: async () => {
15
- if (ep.ctx == null) {
16
- throw new SyntaxError(`Entrypoint has no context yet - ${ep.getAlias()}`);
17
- }
18
- await ep.route.resolve(ep.ctx);
19
- return ep;
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: () => routeAddressOf(ep.assertCtx()).resolvePath(ep.route.route),
10
+ mount: () => routeAddressOf(ep.assertCtx()).resolveMount(ep.route.route),
11
+ service: () => routeAddressOf(ep.assertCtx()).resolveService(ep.route.route),
12
+ address: () => routeAddressOf(ep.assertCtx()).resolveAddress(ep.route.route),
13
+ isLocal: () => routeAddressOf(ep.assertCtx()).isLocalRoute(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
- if (guards != null) {
39
- return guards;
40
- }
41
- guards = ep.guards ?? [];
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
- if (gates != null) {
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
- if (ep.hasParent()) {
57
- gates.push(...ep.getParent().getGates()
58
- .filter(([gate]) => !gates?.some(([g]) => g === gate)));
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
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../src/entrypoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAGpD,MAAM,CAAC,MAAM,UAAU,GAAgD,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrF,IAAI,MAAM,GAAoB,IAAI,CAAA;IAClC,IAAI,KAAK,GAAgC,IAAI,CAAA;IAC7C,MAAM,EAAE,GAAqB,gBAAgB,CAAmB,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;QACjF,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAI;QAEb,MAAM,EAAE,KAAK;QAEb,KAAK;QAEL,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK;QACpC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI;QAClC,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI;QACnD,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,IAAI;QAE5C,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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"}
@@ -0,0 +1,16 @@
1
+ import type { JSONSchemaType } from 'ajv';
2
+ import type { Filter } from '../types.js';
3
+ /** Builds the request/response schema filter of an entrypoint, one section at a time. */
4
+ export interface FilterHelper {
5
+ /** `filter` with its body schema set. */
6
+ body: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
7
+ /** `filter` with its query schema set. */
8
+ query: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
9
+ /** `filter` with its params schema set. */
10
+ params: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
11
+ /** `filter` with its response schema set — keyed by `code` when the filter already has responses. */
12
+ response: <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter) => Filter;
13
+ /** `filter` with its headers schema set. */
14
+ headers: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
15
+ }
16
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/filter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,yFAAyF;AACzF,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAC/D,0CAA0C;IAC1C,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAChE,2CAA2C;IAC3C,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IACjE,qGAAqG;IACrG,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IAClF,4CAA4C;IAC5C,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CACnE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/filter/types.ts"],"names":[],"mappings":""}
package/build/filter.d.ts CHANGED
@@ -1,8 +1,4 @@
1
- import type { JSONSchemaType } from 'ajv';
2
- import type { Filter } from './types.js';
3
- export declare const body: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
4
- export declare const query: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
5
- export declare const params: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
6
- export declare const response: <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter) => Filter;
7
- export declare const headers: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter;
1
+ import type { FilterHelper } from './filter/types.js';
2
+ export declare const createFilterHelper: () => FilterHelper;
3
+ export declare const filterHelper: FilterHelper;
8
4
  //# sourceMappingURL=filter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,eAAO,MAAM,IAAI,GAAI,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC,WAAW,MAAM,KAAG,MAEpE,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC,WAAW,MAAM,KAAG,MAErE,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC,WAAW,MAAM,KAAG,MAEtE,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC,SAAS,MAAM,WAAW,MAAM,KAAG,MAMvF,CAAA;AAED,eAAO,MAAM,OAAO,GAAI,CAAC,UAAU,cAAc,CAAC,CAAC,CAAC,WAAW,MAAM,KAAG,MAEvE,CAAA"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,eAAO,MAAM,kBAAkB,QAAO,YA0BrC,CAAA;AAED,eAAO,MAAM,YAAY,cAAuB,CAAA"}
package/build/filter.js CHANGED
@@ -1,20 +1,24 @@
1
- export const body = (schema, filter) => {
2
- return { ...filter, body: schema };
3
- };
4
- export const query = (schema, filter) => {
5
- return { ...filter, query: schema };
6
- };
7
- export const params = (schema, filter) => {
8
- return { ...filter, params: schema };
9
- };
10
- export const response = (schema, code, filter) => {
11
- let _schema = schema;
12
- if (filter?.response != null && code != null) {
13
- _schema = { ...filter.response, [code]: schema };
14
- }
15
- return { ...filter, response: _schema };
16
- };
17
- export const headers = (schema, filter) => {
18
- return { ...filter, headers: schema };
1
+ export const createFilterHelper = () => {
2
+ const body = (schema, filter) => {
3
+ return { ...filter, body: schema };
4
+ };
5
+ const query = (schema, filter) => {
6
+ return { ...filter, query: schema };
7
+ };
8
+ const params = (schema, filter) => {
9
+ return { ...filter, params: schema };
10
+ };
11
+ const response = (schema, code, filter) => {
12
+ let _schema = schema;
13
+ if (filter?.response != null && code != null) {
14
+ _schema = { ...filter.response, [code]: schema };
15
+ }
16
+ return { ...filter, response: _schema };
17
+ };
18
+ const headers = (schema, filter) => {
19
+ return { ...filter, headers: schema };
20
+ };
21
+ return { body, query, params, response, headers };
19
22
  };
23
+ export const filterHelper = createFilterHelper();
20
24
  //# sourceMappingURL=filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.js","sourceRoot":"","sources":["../src/filter.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAI,MAAyB,EAAE,MAAe,EAAU,EAAE;IAC5E,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAa,EAAE,CAAA;AAC3C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAI,MAAyB,EAAE,MAAe,EAAU,EAAE;IAC7E,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAa,EAAE,CAAA;AAC5C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,MAAM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CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,CAAI,MAAyB,EAAE,IAAa,EAAE,MAAe,EAAU,EAAE;QACxF,IAAI,OAAO,GAAQ,MAAM,CAAA;QACzB,IAAI,MAAM,EAAE,QAAQ,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YAC7C,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;QAClD,CAAC;QACD,OAAO,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;IACzC,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,CAAI,MAAyB,EAAE,MAAe,EAAU,EAAE;QACxE,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,MAAa,EAAE,CAAA;IAC9C,CAAC,CAAA;IAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AACnD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAA"}
package/build/helper.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { Filter, CommonEntrypointOptions, AbstractResponse, CommonEntrypoint } from './types.js';
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
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGhG,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;AAED,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,gBAAgB,eAAe,CAAC,EAAE,QAAQ,MAAM,MAAM,MAAM,WAAW,MAAM,SAO5G,CAAA"}
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
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,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,OAA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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,8 @@
1
1
  export type * from './types.js';
2
- export * from './entrypoint.js';
3
- export * from './filter.js';
4
- export * from './helper.js';
2
+ export type * from './filter/types.js';
5
3
  export * from './consts.js';
4
+ export * from './utils.js';
5
+ export * from './protocol.js';
6
+ export * from './materialize.js';
7
+ export { provideResponse } from './helper.js';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,mBAAmB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
package/build/index.js CHANGED
@@ -1,5 +1,6 @@
1
- export * from './entrypoint.js';
2
- export * from './filter.js';
3
- export * from './helper.js';
4
1
  export * from './consts.js';
2
+ export * from './utils.js';
3
+ export * from './protocol.js';
4
+ export * from './materialize.js';
5
+ export { provideResponse } from './helper.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { EntrypointProtocolDeclaration, MaterializedEntrypoint } from './types.js';
2
+ /**
3
+ * Make a local, mutable registration from a shared declaration. The protocol is never mutated;
4
+ * guards, route resolution and handlers belong exclusively to this materialized entrypoint.
5
+ */
6
+ export declare const materializeEntrypoint: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol) => MaterializedEntrypoint<Protocol>;
7
+ //# 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,EAAmC,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAgCxH;;;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;AAG5C,MAAM,QAAQ,GAAG,CAAC,QAAuC,EAAsB,EAAE;IAC/E,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjD,M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2B,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,44 @@
1
+ import type { EntrypointReference } from '@owlmeans/context';
2
+ import type { JSONSchemaType } from 'ajv';
3
+ import type { RouteModel } from '@owlmeans/route';
4
+ import type { EntrypointContract, EntrypointGate, EntrypointOptions, EntrypointProtocol, EntrypointProtocolDeclaration, EntrypointSchema, EntrypointTree, OpenRequest, OpenValue, RegisteredEntrypoint, RequestFromSources, RequestShape, RequestSources, ShapeSource, Typed } from './types.js';
5
+ export declare const schema: <T>(value: JSONSchemaType<T>) => EntrypointSchema<T>;
6
+ /**
7
+ * Supplies type information where a response has no runtime schema, or attaches a type to an
8
+ * otherwise untyped schema literal at the declaration boundary.
9
+ */
10
+ export declare function typed<T>(): Typed<T>;
11
+ export declare function typed<T>(schema: JSONSchemaType<T>): Typed<T>;
12
+ /**
13
+ * Declare an exact request and response. The primary overload means a body request; use
14
+ * `contract.request` for independently-shaped request sections.
15
+ */
16
+ export declare function contract(): EntrypointContract<{}, undefined>;
17
+ export declare function contract<Response>(response: ShapeSource<Response>): EntrypointContract<{}, Response>;
18
+ export declare function contract<Body extends OpenValue, Response>(body: ShapeSource<Body>, response: ShapeSource<Response>): EntrypointContract<{
19
+ body: Body;
20
+ }, Response>;
21
+ export declare namespace contract {
22
+ function request<Sources extends RequestSources, Response>(request: Sources, response: ShapeSource<Response>): EntrypointContract<RequestFromSources<Sources>, Response>;
23
+ }
24
+ /** Create an immutable protocol declaration from a route and its contract. */
25
+ export declare const protocol: <Request extends RequestShape, Response>(route: RouteModel, entrypointContract: EntrypointContract<Request, Response>, options?: EntrypointOptions) => EntrypointProtocol<Request, Response>;
26
+ export declare const openProtocol: (route: RouteModel, options?: EntrypointOptions) => EntrypointProtocol<OpenRequest, OpenValue>;
27
+ export declare const entrypointRef: <Request extends RequestShape = OpenRequest, Response = OpenValue>(alias: string) => EntrypointReference<RegisteredEntrypoint<Request, Response>>;
28
+ export declare const aliasOf: (reference: EntrypointReference | string) => string;
29
+ export declare const isEntrypointProtocol: (value: object) => value is EntrypointProtocolDeclaration;
30
+ /** Flatten an exported protocol tree for a layer-specific materializer. */
31
+ export declare const protocols: (tree: EntrypointTree) => EntrypointProtocolDeclaration[];
32
+ /**
33
+ * Rebuild an immutable protocol tree while transforming its declarations.
34
+ *
35
+ * Protocol consumers keep addressing declarations by their exported tree path; a cross-cutting
36
+ * concern such as a coguard therefore never needs to flatten the tree and recover declarations
37
+ * by alias.
38
+ */
39
+ export declare const mapProtocols: <Tree extends EntrypointTree>(tree: Tree, mapper: (protocol: EntrypointProtocolDeclaration) => EntrypointProtocolDeclaration) => Tree;
40
+ /** Resolve the gates a protocol inherits through its route parents without materializing it. */
41
+ export declare const gatesOf: (protocol: EntrypointProtocolDeclaration, tree: EntrypointTree) => readonly EntrypointGate[];
42
+ /** Clone an immutable protocol while preserving its request/response pair. */
43
+ export declare const decorateEntrypoint: <Protocol extends EntrypointProtocolDeclaration>(protocol: Protocol, options: EntrypointOptions) => Protocol;
44
+ //# sour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,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,MAAM,GAAG,CAAI,KAAwB,EAAuB,EAAE,CACzE,KAA4B,CAAA;AAQ9B,MAAM,UAAU,KAAK,CAAI,MAA0B;IACjD,OAAO,MAAM,IAAI,IAAI;QACnB,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE;QAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAA;AACzC,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,MAAkC,EAA+B,EAAE;IACnF,IAAI,MAAM,IAAI,IAAI;QAAE,OAAO,SAAS,CAAA;IACpC,MAAM,MAAM,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,iBAAiB;QAClE,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,MAAM,CAAA;IAEV,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;AAC7D,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,CAAC,MAAkC,EAAsC,EAAE;IACnG,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM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