@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
package/build/types.d.ts CHANGED
@@ -1,28 +1,43 @@
1
- import type { CommonRouteModel } from '@owlmeans/route';
2
- import type { InitializedService, LazyService, BasicEntrypoint } from '@owlmeans/context';
3
- import type { AnySchemaObject } from 'ajv';
1
+ import type { ResolvedServiceRoute, RouteAddress, RouteModel, RouteProtocol } from '@owlmeans/route';
2
+ import type { InitializedService, LazyService, BasicEntrypoint, EntrypointReference } from '@owlmeans/context';
3
+ import type { AnySchemaObject, JSONSchemaType } from 'ajv';
4
4
  import type { EntrypointOutcome } from './consts.js';
5
5
  import type { Auth } from '@owlmeans/auth';
6
+ import type { AnyShapeSource, entrypointSchemaType, SourceValue, TypeToken, UrlRequest } from './types.local.js';
7
+ /**
8
+ * A URL unit: an immutable route declaration plus what guards, gates and schemas it answers under.
9
+ *
10
+ * Nothing here is rewritten once declared. Every address question — segment, path, mount, service,
11
+ * host — is a question about the declaration asked against the context the entrypoint is registered
12
+ * in, so the same declaration answers differently in a client and in a server without being touched.
13
+ */
6
14
  export interface CommonEntrypoint extends BasicEntrypoint {
7
- route: CommonRouteModel;
15
+ route: RouteModel;
8
16
  /**
9
17
  * @property {boolean} - if true — router attaches this entrypoint unconditionally
10
18
  * @default false
11
19
  */
12
20
  sticky: boolean;
13
- filter?: Filter;
21
+ /** The guards declared on this entrypoint alone — see `getGuards()` for the inherited set. */
14
22
  guards?: string[];
15
23
  gate?: string;
16
24
  gateParams?: string | string[];
25
+ filter?: Filter;
17
26
  handle?: EntrypointHandler;
18
- getAlias: () => string;
19
- getPath: () => string;
20
- getParentAlias: () => string | null;
21
- hasParent: () => boolean;
22
- resolve: <M extends CommonEntrypoint>() => Promise<M>;
23
- getParent: <M extends CommonEntrypoint>() => M;
24
- setService: (service: string) => void;
27
+ /** The segment this entrypoint contributes under its parent. */
28
+ segment: () => string;
29
+ /** Every ancestor's segment, then this one. */
30
+ path: () => string;
31
+ /** `base` + `path()` — what a server mounts and a client requests. */
32
+ mount: () => string;
33
+ service: () => ResolvedServiceRoute;
34
+ address: () => RouteAddress;
35
+ /** Does this entrypoint belong to the service its context IS? */
36
+ isLocal: () => boolean;
37
+ parent: () => CommonEntrypoint | null;
38
+ /** Own guards and every ancestor's, deduped. Recomputed on each call. */
25
39
  getGuards: () => string[];
40
+ /** Own gate and every ancestor's, as `[gate, params]`. Recomputed on each call. */
26
41
  getGates: () => [string, string[]][];
27
42
  }
28
43
  export interface CommonEntrypointOptions extends Partial<CommonEntrypoint> {
@@ -105,4 +120,178 @@ export interface Filter {
105
120
  response?: AnySchemaObject;
106
121
  headers?: AnySchemaObject;
107
122
  }
123
+ /**
124
+ * How a call to an entrypoint is actually carried.
125
+ *
126
+ * The transport is chosen by the route's protocol, so a consumer always writes `ep.call(...)` and
127
+ * never learns which built-in or package-owned carrier handled it. An
128
+ * application binds a protocol by registering a transport service under `transportAlias(protocol)`.
129
+ */
130
+ export interface EntrypointTransport extends InitializedService {
131
+ readonly protocol: RouteProtocol;
132
+ handle: EntrypointHandler;
133
+ }
134
+ /** A deliberately broad value used only by declarations without an I/O contract. */
135
+ export type OpenValue = object | string | number | boolean | bigint | null | undefined;
136
+ /** The four independent request sections an entrypoint may declare. */
137
+ export interface RequestShape {
138
+ body?: OpenValue;
139
+ params?: object;
140
+ query?: object;
141
+ headers?: object;
142
+ }
143
+ export interface RuntimeRequestSchemas {
144
+ body?: AnySchemaObject;
145
+ params?: AnySchemaObject;
146
+ query?: AnySchemaObject;
147
+ headers?: AnySchemaObject;
148
+ }
149
+ export interface RuntimeResponseSchemas {
150
+ default?: AnySchemaObject;
151
+ byStatus?: Readonly<Record<number, AnySchemaObject>>;
152
+ }
153
+ /** The runtime schemas and compile-time request/response pair attached to one protocol. */
154
+ export interface EntrypointContract<Request extends RequestShape, Response> {
155
+ readonly kind: 'entrypoint-contract';
156
+ readonly requestSchemas: RuntimeRequestSchemas;
157
+ readonly responseSchemas?: RuntimeResponseSchemas;
158
+ readonly requestType?: Request;
159
+ readonly responseType?: Response;
160
+ }
161
+ /** Runtime fields common to every protocol, regardless of its compile-time request/reply pair. */
162
+ export interface EntrypointProtocolDeclaration {
163
+ readonly kind: 'entrypoint-protocol';
164
+ readonly alias: string;
165
+ readonly route: RouteModel;
166
+ readonly contract?: Pick<EntrypointContract<RequestShape, OpenValue>, 'kind' | 'requestSchemas' | 'responseSchemas'>;
167
+ readonly sticky: boolean;
168
+ readonly guards: readonly string[];
169
+ readonly gate?: {
170
+ readonly alias: string;
171
+ readonly params: readonly string[];
172
+ };
173
+ }
174
+ /** A context-bound entrypoint made from an immutable protocol declaration. */
175
+ export interface MaterializedEntrypoint<Protocol extends EntrypointProtocolDeclaration> extends CommonEntrypoint {
176
+ readonly protocol: Protocol;
177
+ }
178
+ /** The request accepted by a declaration that intentionally supplies no contract. */
179
+ export interface OpenRequest {
180
+ body?: object;
181
+ params?: object;
182
+ query?: object;
183
+ headers?: object;
184
+ }
185
+ /** Addressing and transport controls are never part of an entrypoint's payload contract. */
186
+ export interface CallOptions {
187
+ auth?: Auth;
188
+ host?: string;
189
+ base?: string | boolean;
190
+ unsecure?: boolean;
191
+ timeout?: number;
192
+ signal?: AbortSignal;
193
+ }
194
+ /** A type-only contract source, optionally paired with an AJV schema. */
195
+ export interface Typed<T> extends TypeToken {
196
+ readonly value?: T;
197
+ }
198
+ /**
199
+ * A JSON schema carrying the model type it validates. Use `schema<Model>(...)` once beside the
200
+ * model; every protocol that consumes it then infers the model without another generic.
201
+ */
202
+ export type EntrypointSchema<T> = JSONSchemaType<T> & {
203
+ readonly [entrypointSchemaType]: T;
204
+ };
205
+ /** A schema or an explicit type-only source for one request/response value. */
206
+ export type ShapeSource<T> = EntrypointSchema<T> | JSONSchemaType<T> | Typed<T>;
207
+ export interface RequestSources {
208
+ body?: AnyShapeSource;
209
+ params?: AnyShapeSource;
210
+ query?: AnyShapeSource;
211
+ headers?: AnyShapeSource;
212
+ }
213
+ /** An access gate declared by a protocol, including inherited parent declarations. */
214
+ export interface EntrypointGate {
215
+ readonly alias: string;
216
+ readonly params: readonly string[];
217
+ }
218
+ export type RequestFromSources<Sources extends RequestSources> = (Sources extends {
219
+ body: infer Source;
220
+ } ? {
221
+ body: SourceValue<Source>;
222
+ } : {}) & (Sources extends {
223
+ params: infer Source;
224
+ } ? {
225
+ params: SourceValue<Source>;
226
+ } : {}) & (Sources extends {
227
+ query: infer Source;
228
+ } ? {
229
+ query: SourceValue<Source>;
230
+ } : {}) & (Sources extends {
231
+ headers: infer Source;
232
+ } ? {
233
+ headers: SourceValue<Source>;
234
+ } : {});
235
+ export interface EntrypointOptions {
236
+ sticky?: boolean;
237
+ guards?: string | readonly string[];
238
+ gate?: {
239
+ alias: string;
240
+ params?: string | readonly string[];
241
+ };
242
+ }
243
+ export interface EntrypointResult<Response> {
244
+ value: Response;
245
+ outcome: EntrypointOutcome;
246
+ }
247
+ export type CallArguments<Request extends RequestShape> = {} extends Request ? [request?: Request & CallOptions] : [request: Request & CallOptions];
248
+ export type UrlArguments<Request extends RequestShape> = {} extends UrlRequest<Request> ? [request?: UrlRequest<Request> & CallOptions] : [request: UrlRequest<Request> & CallOptions];
249
+ export interface EntrypointRequestMeta {
250
+ alias: string;
251
+ auth?: Auth;
252
+ entity?: ResolvedEntity;
253
+ path: string;
254
+ canceled?: boolean;
255
+ cancel?: () => void;
256
+ }
257
+ /**
258
+ * A protocol request at an implementation boundary.
259
+ *
260
+ * Transport metadata and empty request sections remain available to handlers; a declared section
261
+ * then refines that base shape to its protocol contract.
262
+ */
263
+ export type HandlerRequest<Request extends RequestShape> = AbstractRequest & Request & EntrypointRequestMeta;
264
+ /**
265
+ * An immutable shared declaration. Its inherited reference type is what gives a context lookup
266
+ * the exact registered entrypoint type without a consumer-supplied generic.
267
+ */
268
+ export interface EntrypointProtocol<Request extends RequestShape = RequestShape, Response = OpenValue> extends EntrypointProtocolDeclaration, EntrypointReference<RegisteredEntrypoint<Request, Response>> {
269
+ readonly contract?: EntrypointContract<Request, Response>;
270
+ }
271
+ /** The context-bound counterpart of an immutable protocol declaration. */
272
+ export interface RegisteredEntrypoint<Request extends RequestShape, Response> extends BasicEntrypoint {
273
+ readonly protocol: EntrypointProtocol<Request, Response>;
274
+ call: (...args: CallArguments<Request>) => Promise<Response>;
275
+ invoke: (...args: CallArguments<Request>) => Promise<EntrypointResult<Response>>;
276
+ url: (...args: UrlArguments<Request>) => Promise<string>;
277
+ validate: (...args: CallArguments<Request>) => Promise<boolean>;
278
+ }
279
+ export type RequestOf<Protocol extends EntrypointProtocolDeclaration> = Protocol extends EntrypointProtocol<infer Request, infer _Response> ? Request : OpenRequest;
280
+ export type ResponseOf<Protocol extends EntrypointProtocolDeclaration> = Protocol extends EntrypointProtocol<infer _Request, infer Response> ? Response : OpenValue;
281
+ export type BodyOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
282
+ body: infer Body;
283
+ } ? Body : OpenValue;
284
+ export type ParamsOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
285
+ params: infer Params;
286
+ } ? Params : object;
287
+ export type QueryOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
288
+ query: infer Query;
289
+ } ? Query : object;
290
+ export type HeadersOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
291
+ headers: infer Headers;
292
+ } ? Headers : object;
293
+ export type CallRequestOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> & CallOptions;
294
+ export interface EntrypointTree {
295
+ readonly [key: string]: EntrypointProtocolDeclaration | EntrypointTree;
296
+ }
108
297
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,KAAK,EAAE,gBAAgB,CAAA;IACvB;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IACnC,SAAS,EAAE,MAAM,OAAO,CAAA;IACxB,OAAO,EAAE,CAAC,CAAC,SAAS,gBAAgB,OAAO,OAAO,CAAC,CAAC,CAAC,CAAA;IACrD,SAAS,EAAE,CAAC,CAAC,SAAS,gBAAgB,OAAO,CAAC,CAAA;IAC9C,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,MAAM,EAAE,CAAA;IACzB,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AC,QAAQ,SAAS,6BAA6B,IAAI,SAAS,CAAC,QAAQ,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,OAAO,CAAA;CAAE,GAC1H,OAAO,GACP,MAAM,CAAA;AAGV,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,6BAA6B,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAA;AAE7G,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,6BAA6B,GAAG,cAAc,CAAA;CACvE"}
@@ -0,0 +1,27 @@
1
+ import type { JSONSchemaType, AnySchemaObject } from 'ajv';
2
+ import type { EntrypointSchema, OpenValue, RequestShape, Typed } from './types.js';
3
+ export interface TypeToken {
4
+ readonly kind: 'entrypoint-type';
5
+ readonly schema?: AnySchemaObject;
6
+ }
7
+ export declare const entrypointSchemaType: unique symbol;
8
+ export type AnyShapeSource = AnySchemaObject | TypeToken;
9
+ export 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;
10
+ export type UrlRequest<Request extends RequestShape> = (Request extends {
11
+ params: infer Params;
12
+ } ? {
13
+ params: Params;
14
+ } : Request extends {
15
+ params?: infer Params;
16
+ } ? {
17
+ params?: Params;
18
+ } : {}) & (Request extends {
19
+ query: infer Query;
20
+ } ? {
21
+ query: Query;
22
+ } : Request extends {
23
+ query?: infer Query;
24
+ } ? {
25
+ query?: Query;
26
+ } : {});
27
+ //# sourceMappingURL=types.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.local.d.ts","sourceRoot":"","sources":["../src/types.local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,KAAK,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,Y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- {"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,GAAG,IAAI,gBACR,CAAA"}
1
+ {"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,eAAO,MAAM,YAAY,QAAS,MAAM,KAAG,GAAG,IAAI,gBAC5B,CAAA"}
@@ -1,2 +1,2 @@
1
- export const isEntrypoint = (obj) => '_entrypoint' in obj || '_module' in obj;
1
+ export const isEntrypoint = (obj) => '_entrypoint' in obj;
2
2
  //# sourceMappingURL=entrypoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAA2B,EAAE,CACnE,aAAa,IAAI,GAAG,IAAI,SAAS,IAAI,GAAG,CAAA"}
1
+ {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["../../src/utils/entrypoint.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAA2B,EAAE,CACnE,aAAa,IAAI,GAAG,CAAA"}
@@ -1,6 +1,6 @@
1
- import { CommonRouteModel } from '@owlmeans/route';
1
+ import { RouteModel } from '@owlmeans/route';
2
2
  import { CommonEntrypointOptions } from '../types.js';
3
3
  export interface CreateEntrypointSignature<M> {
4
- (route: CommonRouteModel, opts?: CommonEntrypointOptions): M;
4
+ (route: RouteModel, opts?: CommonEntrypointOptions): M;
5
5
  }
6
6
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,uBAAuB,GAAG,CAAC,CAAC;CAC9D"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,uBAAuB,GAAG,CAAC,CAAC;CACxD"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Service alias a transport registers under. The default protocol is the web one, so an application
3
+ * that binds nothing keeps talking HTTP.
4
+ */
5
+ export declare const transportAlias: (protocol?: string) => string;
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,cAAc,cAAc,MAAM,WAAqC,CAAA"}
package/build/utils.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Service alias a transport registers under. The default protocol is the web one, so an application
3
+ * that binds nothing keeps talking HTTP.
4
+ */
5
+ export const transportAlias = (protocol = 'http') => `transport:${protocol}`;
6
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAQ,GAAW,MAAM,EAAE,EAAE,CAAC,aAAa,QAAQ,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/entrypoint",
3
- "version": "0.1.18-rc.8",
3
+ "version": "0.1.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -28,13 +28,13 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@owlmeans/auth": "^0.1.18-rc.7",
32
- "@owlmeans/context": "^0.1.18-rc.6",
33
- "@owlmeans/route": "^0.1.18-rc.6",
34
- "ajv": "^8.17.1"
31
+ "@owlmeans/auth": "^0.1.18",
32
+ "@owlmeans/context": "^0.1.18",
33
+ "@owlmeans/route": "^0.1.18",
34
+ "ajv": "^8.20.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@owlmeans/dep-config": "workspace:*",
37
+ "@owlmeans/dep-config": "^0.1.18",
38
38
  "nodemon": "^3.1.14",
39
39
  "typescript": "^7.0.2"
40
40
  },
package/src/consts.ts CHANGED
@@ -5,3 +5,4 @@ export enum EntrypointOutcome {
5
5
  Created = 'created',
6
6
  Finished = 'finished'
7
7
  }
8
+
package/src/entrypoint.ts CHANGED
@@ -1,83 +1,65 @@
1
1
  import type { CommonEntrypoint } from './types.js'
2
2
  import { appendContextual } from '@owlmeans/context'
3
+ import { routeAddressOf } from '@owlmeans/route/utils'
3
4
  import type { CreateEntrypointSignature } from './utils/types.js'
4
5
 
5
6
  export const entrypoint: CreateEntrypointSignature<CommonEntrypoint> = (route, opts) => {
6
- let guards: string[] | null = null
7
- let gates: [string, string[]][] | null = null
8
7
  const ep: CommonEntrypoint = appendContextual<CommonEntrypoint>(route.route.alias, {
9
8
  _entrypoint: true,
10
- _module: true,
11
9
 
12
10
  sticky: false,
13
11
 
14
12
  route,
15
13
 
16
- getAlias: () => ep.route.route.alias,
17
- getPath: () => ep.route.route.path,
18
- getParentAlias: () => ep.route.route.parent ?? null,
19
- hasParent: () => ep.getParentAlias() != null,
14
+ segment: () => ep.route.route.path,
20
15
 
21
- resolve: async <M extends CommonEntrypoint>() => {
22
- if (ep.ctx == null) {
23
- throw new SyntaxError(`Entrypoint has no context yet - ${ep.getAlias()}`)
24
- }
16
+ path: () => routeAddressOf(ep.assertCtx()).resolvePath(ep.route.route),
25
17
 
26
- await ep.route.resolve(ep.ctx)
18
+ mount: () => routeAddressOf(ep.assertCtx()).resolveMount(ep.route.route),
27
19
 
28
- return ep as M
29
- },
20
+ service: () => routeAddressOf(ep.assertCtx()).resolveService(ep.route.route),
30
21
 
31
- getParent: () => {
32
- const parentAlias = ep.getParentAlias()
33
- if (parentAlias == null) {
34
- throw new SyntaxError(`Entrypoint has no parent - ${ep.getAlias()}`)
35
- }
36
- if (ep.ctx == null) {
37
- throw new SyntaxError(`Entrypoint has no context yet - ${ep.getAlias()}`)
38
- }
22
+ address: () => routeAddressOf(ep.assertCtx()).resolveAddress(ep.route.route),
39
23
 
40
- return ep.ctx.entrypoint(parentAlias)
41
- },
24
+ isLocal: () => routeAddressOf(ep.assertCtx()).isLocalRoute(ep.route.route),
42
25
 
43
- setService: service => {
44
- if (ep.route.route.resolved) {
45
- throw new SyntaxError(`Cannot update a resolved entrypoint - ${ep.getAlias()}`)
46
- }
47
- ep.route.route.service = service
48
- },
26
+ parent: () => ep.route.route.parent == null ? null
27
+ : ep.assertCtx().entrypoint<CommonEntrypoint>(ep.route.route.parent),
49
28
 
29
+ // Walked afresh on every call: a guard attached to an ancestor after this entrypoint was first
30
+ // asked still has to count.
50
31
  getGuards: () => {
51
- if (guards != null) {
52
- return guards
53
- }
54
- guards = ep.guards ?? []
55
-
56
- if (ep.hasParent()) {
57
- guards.push(
58
- ...ep.getParent().getGuards().filter(guard => !guards?.includes(guard))
59
- )
32
+ const guards = [...ep.guards ?? []]
33
+ const parent = ep.parent()
34
+ if (parent != null) {
35
+ guards.push(...parent.getGuards().filter(guard => !guards.includes(guard)))
60
36
  }
61
37
 
62
38
  return guards
63
39
  },
64
40
 
41
+ /**
42
+ * The gates standing over this entrypoint: its own, then an ancestor's for each gate service
43
+ * this entrypoint has not already named.
44
+ *
45
+ * KNOWN HAZARD, deliberately left alone: the dedup is by gate SERVICE, and two gates under one
46
+ * service are two different questions because their parameters differ — so a child that
47
+ * declares its own gate silently drops its ancestor's, which is the opposite of what
48
+ * "inherited" means. Anything that needs a group rule AND a member rule must therefore not
49
+ * express the group half as a gate under the same service. Changing this would widen every
50
+ * backend and socket entrypoint that today relies on the replacement, so it is a migration
51
+ * rather than a fix.
52
+ */
65
53
  getGates: () => {
66
- if (gates != null) {
67
- return gates
68
- }
69
-
70
- gates = ep.gate != null ? [[
54
+ const gates: [string, string[]][] = ep.gate != null ? [[
71
55
  ep.gate, ep.gateParams == null
72
56
  ? [] : Array.isArray(ep.gateParams)
73
57
  ? ep.gateParams : [ep.gateParams]
74
58
  ]] : []
75
59
 
76
- if (ep.hasParent()) {
77
- gates.push(
78
- ...ep.getParent().getGates()
79
- .filter(([gate]) => !gates?.some(([g]) => g === gate))
80
- )
60
+ const parent = ep.parent()
61
+ if (parent != null) {
62
+ gates.push(...parent.getGates().filter(([gate]) => !gates.some(([g]) => g === gate)))
81
63
  }
82
64
 
83
65
  return gates
@@ -88,19 +70,3 @@ export const entrypoint: CreateEntrypointSignature<CommonEntrypoint> = (route, o
88
70
 
89
71
  return ep
90
72
  }
91
-
92
- export const parent = <T extends CommonEntrypoint | CommonEntrypoint[]>(ep: T, aliasOrParent: string, _parent?: string): T => {
93
- if (Array.isArray(ep)) {
94
- if (_parent == null) {
95
- throw SyntaxError('Elevating parent requires parent name to be specified')
96
- }
97
- ep = ep.find(e => e.route.route.alias === aliasOrParent) as T
98
- if (ep == null) {
99
- throw SyntaxError(`Entrypoint not found ${aliasOrParent}`)
100
- }
101
- return parent(ep, _parent)
102
- }
103
- ep.route.route.parent = aliasOrParent
104
-
105
- return ep
106
- }
@@ -0,0 +1,16 @@
1
+ import type { JSONSchemaType } from 'ajv'
2
+ import type { Filter } from '../types.js'
3
+
4
+ /** Builds the request/response schema filter of an entrypoint, one section at a time. */
5
+ export interface FilterHelper {
6
+ /** `filter` with its body schema set. */
7
+ body: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter
8
+ /** `filter` with its query schema set. */
9
+ query: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter
10
+ /** `filter` with its params schema set. */
11
+ params: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter
12
+ /** `filter` with its response schema set — keyed by `code` when the filter already has responses. */
13
+ response: <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter) => Filter
14
+ /** `filter` with its headers schema set. */
15
+ headers: <T>(schema: JSONSchemaType<T>, filter?: Filter) => Filter
16
+ }
package/src/filter.ts CHANGED
@@ -1,26 +1,33 @@
1
1
  import type { JSONSchemaType } from 'ajv'
2
2
  import type { Filter } from './types.js'
3
+ import type { FilterHelper } from './filter/types.js'
3
4
 
4
- export const body = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
5
- return { ...filter, body: schema as any }
6
- }
5
+ export const createFilterHelper = (): FilterHelper => {
6
+ const body = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
7
+ return { ...filter, body: schema as any }
8
+ }
7
9
 
8
- export const query = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
9
- return { ...filter, query: schema as any }
10
- }
10
+ const query = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
11
+ return { ...filter, query: schema as any }
12
+ }
11
13
 
12
- export const params = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
13
- return { ...filter, params: schema as any }
14
- }
14
+ const params = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
15
+ return { ...filter, params: schema as any }
16
+ }
15
17
 
16
- export const response = <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter): Filter => {
17
- let _schema: any = schema
18
- if (filter?.response != null && code != null) {
19
- _schema = { ...filter.response, [code]: schema }
18
+ const response = <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter): Filter => {
19
+ let _schema: any = schema
20
+ if (filter?.response != null && code != null) {
21
+ _schema = { ...filter.response, [code]: schema }
22
+ }
23
+ return { ...filter, response: _schema }
20
24
  }
21
- return { ...filter, response: _schema }
22
- }
23
25
 
24
- export const headers = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
25
- return { ...filter, headers: schema as any }
26
+ const headers = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
27
+ return { ...filter, headers: schema as any }
28
+ }
29
+
30
+ return { body, query, params, response, headers }
26
31
  }
32
+
33
+ export const filterHelper = createFilterHelper()
package/src/helper.ts CHANGED
@@ -1,6 +1,4 @@
1
- import { route } from '@owlmeans/route'
2
- import { Filter, CommonEntrypointOptions, AbstractResponse, CommonEntrypoint } from './types.js'
3
- import { entrypoint } from './entrypoint.js'
1
+ import { Filter, CommonEntrypointOptions, AbstractResponse } from './types.js'
4
2
 
5
3
  export const filter = (filter: Filter, opts?: CommonEntrypointOptions): CommonEntrypointOptions => ({ filter, ...opts })
6
4
 
@@ -26,12 +24,3 @@ export const provideResponse = <T>(originalResponse?: unknown): AbstractResponse
26
24
 
27
25
  return handler
28
26
  }
29
-
30
- export const clone = <M extends CommonEntrypoint>(entrypoints: M[], from: string, to: string, service: string) => {
31
- const source = entrypoints.find(e => e.alias === from)
32
-
33
- if (source?.route.route != null) {
34
- const _route = { ...source.route.route, service, resolved: false, alias: to }
35
- entrypoints.push(entrypoint(route(to, _route.path, _route)) as M)
36
- }
37
- }
package/src/index.ts CHANGED
@@ -1,6 +1,8 @@
1
1
 
2
2
  export type * from './types.js'
3
- export * from './entrypoint.js'
4
- export * from './filter.js'
5
- export * from './helper.js'
3
+ export type * from './filter/types.js'
6
4
  export * from './consts.js'
5
+ export * from './utils.js'
6
+ export * from './protocol.js'
7
+ export * from './materialize.js'
8
+ export { provideResponse } from './helper.js'