@owlmeans/entrypoint 0.1.18-rc.4 → 0.1.18-rc.40

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 (55) hide show
  1. package/README.md +262 -60
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/entrypoint/SKILL.md +84 -48
  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.d.ts +20 -5
  9. package/build/filter.d.ts.map +1 -1
  10. package/build/filter.js +7 -5
  11. package/build/filter.js.map +1 -1
  12. package/build/helper.d.ts +1 -2
  13. package/build/helper.d.ts.map +1 -1
  14. package/build/helper.js +0 -9
  15. package/build/helper.js.map +1 -1
  16. package/build/index.d.ts +4 -3
  17. package/build/index.d.ts.map +1 -1
  18. package/build/index.js +4 -3
  19. package/build/index.js.map +1 -1
  20. package/build/materialize.d.ts +7 -0
  21. package/build/materialize.d.ts.map +1 -0
  22. package/build/materialize.js +34 -0
  23. package/build/materialize.js.map +1 -0
  24. package/build/protocol.d.ts +44 -0
  25. package/build/protocol.d.ts.map +1 -0
  26. package/build/protocol.js +124 -0
  27. package/build/protocol.js.map +1 -0
  28. package/build/types.d.ts +228 -12
  29. package/build/types.d.ts.map +1 -1
  30. package/build/types.local.d.ts +27 -0
  31. package/build/types.local.d.ts.map +1 -0
  32. package/build/types.local.js +2 -0
  33. package/build/types.local.js.map +1 -0
  34. package/build/utils/entrypoint.d.ts.map +1 -1
  35. package/build/utils/entrypoint.js +1 -1
  36. package/build/utils/entrypoint.js.map +1 -1
  37. package/build/utils/types.d.ts +2 -2
  38. package/build/utils/types.d.ts.map +1 -1
  39. package/build/utils.d.ts +6 -0
  40. package/build/utils.d.ts.map +1 -0
  41. package/build/utils.js +6 -0
  42. package/build/utils.js.map +1 -0
  43. package/package.json +5 -5
  44. package/src/consts.ts +1 -0
  45. package/src/entrypoint.ts +33 -65
  46. package/src/filter.ts +9 -5
  47. package/src/helper.ts +1 -12
  48. package/src/index.ts +4 -3
  49. package/src/materialize.ts +43 -0
  50. package/src/protocol.ts +191 -0
  51. package/src/types.local.ts +24 -0
  52. package/src/types.ts +262 -12
  53. package/src/utils/entrypoint.ts +1 -1
  54. package/src/utils/types.ts +2 -2
  55. package/src/utils.ts +5 -0
package/build/types.d.ts CHANGED
@@ -1,28 +1,44 @@
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
+ import type { createFilterHelper } from './filter.js';
8
+ /**
9
+ * A URL unit: an immutable route declaration plus what guards, gates and schemas it answers under.
10
+ *
11
+ * Nothing here is rewritten once declared. Every address question — segment, path, mount, service,
12
+ * host — is a question about the declaration asked against the context the entrypoint is registered
13
+ * in, so the same declaration answers differently in a client and in a server without being touched.
14
+ */
6
15
  export interface CommonEntrypoint extends BasicEntrypoint {
7
- route: CommonRouteModel;
16
+ route: RouteModel;
8
17
  /**
9
18
  * @property {boolean} - if true — router attaches this entrypoint unconditionally
10
19
  * @default false
11
20
  */
12
21
  sticky: boolean;
13
- filter?: Filter;
22
+ /** The guards declared on this entrypoint alone — see `getGuards()` for the inherited set. */
14
23
  guards?: string[];
15
24
  gate?: string;
16
25
  gateParams?: string | string[];
26
+ filter?: Filter;
17
27
  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;
28
+ /** The segment this entrypoint contributes under its parent. */
29
+ segment: () => string;
30
+ /** Every ancestor's segment, then this one. */
31
+ path: () => string;
32
+ /** `base` + `path()` — what a server mounts and a client requests. */
33
+ mount: () => string;
34
+ service: () => ResolvedServiceRoute;
35
+ address: () => RouteAddress;
36
+ /** Does this entrypoint belong to the service its context IS? */
37
+ isLocal: () => boolean;
38
+ parent: () => CommonEntrypoint | null;
39
+ /** Own guards and every ancestor's, deduped. Recomputed on each call. */
25
40
  getGuards: () => string[];
41
+ /** Own gate and every ancestor's, as `[gate, params]`. Recomputed on each call. */
26
42
  getGates: () => [string, string[]][];
27
43
  }
28
44
  export interface CommonEntrypointOptions extends Partial<CommonEntrypoint> {
@@ -39,6 +55,17 @@ export interface EntrypointAssert {
39
55
  export interface AbstractRequest<T extends {} = {}> {
40
56
  alias: string;
41
57
  auth?: Auth;
58
+ /**
59
+ * The organization entity this request acts for, resolved from `auth.entitySlug` once, at the
60
+ * server boundary.
61
+ *
62
+ * The slug on the token is renameable and therefore unusable as a key; `entity.id` is the stable
63
+ * value that records, grants and minted infrastructure names are keyed by. Resolving it here —
64
+ * rather than in each handler — is what keeps a rename from meaning a sweep of every call site,
65
+ * and it is absent whenever no resolver is registered (an implementation that has no notion of
66
+ * an organization store), so consumers must handle that rather than assume it.
67
+ */
68
+ entity?: ResolvedEntity;
42
69
  params: Record<string, string | number | undefined | null> | Partial<T>;
43
70
  body?: Record<string, any> | Partial<T>;
44
71
  headers: Record<string, string[] | string | undefined>;
@@ -53,6 +80,20 @@ export interface AbstractRequest<T extends {} = {}> {
53
80
  timeout?: number;
54
81
  signal?: AbortSignal;
55
82
  }
83
+ /**
84
+ * An organization entity as request handlers see it: the stable id to key by, the current slug to
85
+ * compose user-facing names from, and the frozen key that external systems already know it under.
86
+ */
87
+ export interface ResolvedEntity {
88
+ id: string;
89
+ slug: string;
90
+ /**
91
+ * The identifier this organization is known by in systems whose names cannot be rewritten —
92
+ * an IAM realm, an object-storage prefix, a cluster object. Minted once and never recomputed,
93
+ * so it stays valid across every later rename.
94
+ */
95
+ iamKey: string;
96
+ }
56
97
  export interface AbstractResponse<T> {
57
98
  responseProvider?: any;
58
99
  value?: T;
@@ -80,4 +121,179 @@ export interface Filter {
80
121
  response?: AnySchemaObject;
81
122
  headers?: AnySchemaObject;
82
123
  }
124
+ /**
125
+ * How a call to an entrypoint is actually carried.
126
+ *
127
+ * The transport is chosen by the route's protocol, so a consumer always writes `ep.call(...)` and
128
+ * never learns which built-in or package-owned carrier handled it. An
129
+ * application binds a protocol by registering a transport service under `transportAlias(protocol)`.
130
+ */
131
+ export interface EntrypointTransport extends InitializedService {
132
+ readonly protocol: RouteProtocol;
133
+ handle: EntrypointHandler;
134
+ }
135
+ /** A deliberately broad value used only by declarations without an I/O contract. */
136
+ export type OpenValue = object | string | number | boolean | bigint | null | undefined;
137
+ /** The four independent request sections an entrypoint may declare. */
138
+ export interface RequestShape {
139
+ body?: OpenValue;
140
+ params?: object;
141
+ query?: object;
142
+ headers?: object;
143
+ }
144
+ export interface RuntimeRequestSchemas {
145
+ body?: AnySchemaObject;
146
+ params?: AnySchemaObject;
147
+ query?: AnySchemaObject;
148
+ headers?: AnySchemaObject;
149
+ }
150
+ export interface RuntimeResponseSchemas {
151
+ default?: AnySchemaObject;
152
+ byStatus?: Readonly<Record<number, AnySchemaObject>>;
153
+ }
154
+ /** The runtime schemas and compile-time request/response pair attached to one protocol. */
155
+ export interface EntrypointContract<Request extends RequestShape, Response> {
156
+ readonly kind: 'entrypoint-contract';
157
+ readonly requestSchemas: RuntimeRequestSchemas;
158
+ readonly responseSchemas?: RuntimeResponseSchemas;
159
+ readonly requestType?: Request;
160
+ readonly responseType?: Response;
161
+ }
162
+ /** Runtime fields common to every protocol, regardless of its compile-time request/reply pair. */
163
+ export interface EntrypointProtocolDeclaration {
164
+ readonly kind: 'entrypoint-protocol';
165
+ readonly alias: string;
166
+ readonly route: RouteModel;
167
+ readonly contract?: Pick<EntrypointContract<RequestShape, OpenValue>, 'kind' | 'requestSchemas' | 'responseSchemas'>;
168
+ readonly sticky: boolean;
169
+ readonly guards: readonly string[];
170
+ readonly gate?: {
171
+ readonly alias: string;
172
+ readonly params: readonly string[];
173
+ };
174
+ }
175
+ /** A context-bound entrypoint made from an immutable protocol declaration. */
176
+ export type MaterializedEntrypoint<Protocol extends EntrypointProtocolDeclaration> = CommonEntrypoint & {
177
+ readonly protocol: Protocol;
178
+ };
179
+ /** The request accepted by a declaration that intentionally supplies no contract. */
180
+ export interface OpenRequest {
181
+ body?: object;
182
+ params?: object;
183
+ query?: object;
184
+ headers?: object;
185
+ }
186
+ /** Addressing and transport controls are never part of an entrypoint's payload contract. */
187
+ export interface CallOptions {
188
+ auth?: Auth;
189
+ host?: string;
190
+ base?: string | boolean;
191
+ unsecure?: boolean;
192
+ timeout?: number;
193
+ signal?: AbortSignal;
194
+ }
195
+ /** A type-only contract source, optionally paired with an AJV schema. */
196
+ export type Typed<T> = TypeToken & {
197
+ readonly value?: T;
198
+ };
199
+ /**
200
+ * A JSON schema carrying the model type it validates. Use `schema<Model>(...)` once beside the
201
+ * model; every protocol that consumes it then infers the model without another generic.
202
+ */
203
+ export type EntrypointSchema<T> = JSONSchemaType<T> & {
204
+ readonly [entrypointSchemaType]: T;
205
+ };
206
+ /** A schema or an explicit type-only source for one request/response value. */
207
+ export type ShapeSource<T> = EntrypointSchema<T> | JSONSchemaType<T> | Typed<T>;
208
+ export interface RequestSources {
209
+ body?: AnyShapeSource;
210
+ params?: AnyShapeSource;
211
+ query?: AnyShapeSource;
212
+ headers?: AnyShapeSource;
213
+ }
214
+ /** An access gate declared by a protocol, including inherited parent declarations. */
215
+ export interface EntrypointGate {
216
+ readonly alias: string;
217
+ readonly params: readonly string[];
218
+ }
219
+ export type RequestFromSources<Sources extends RequestSources> = (Sources extends {
220
+ body: infer Source;
221
+ } ? {
222
+ body: SourceValue<Source>;
223
+ } : {}) & (Sources extends {
224
+ params: infer Source;
225
+ } ? {
226
+ params: SourceValue<Source>;
227
+ } : {}) & (Sources extends {
228
+ query: infer Source;
229
+ } ? {
230
+ query: SourceValue<Source>;
231
+ } : {}) & (Sources extends {
232
+ headers: infer Source;
233
+ } ? {
234
+ headers: SourceValue<Source>;
235
+ } : {});
236
+ export interface EntrypointOptions {
237
+ sticky?: boolean;
238
+ guards?: string | readonly string[];
239
+ gate?: {
240
+ alias: string;
241
+ params?: string | readonly string[];
242
+ };
243
+ }
244
+ export interface EntrypointResult<Response> {
245
+ value: Response;
246
+ outcome: EntrypointOutcome;
247
+ }
248
+ export type CallArguments<Request extends RequestShape> = {} extends Request ? [request?: Request & CallOptions] : [request: Request & CallOptions];
249
+ export type UrlArguments<Request extends RequestShape> = {} extends UrlRequest<Request> ? [request?: UrlRequest<Request> & CallOptions] : [request: UrlRequest<Request> & CallOptions];
250
+ export interface EntrypointRequestMeta {
251
+ alias: string;
252
+ auth?: Auth;
253
+ entity?: ResolvedEntity;
254
+ path: string;
255
+ canceled?: boolean;
256
+ cancel?: () => void;
257
+ }
258
+ /**
259
+ * A protocol request at an implementation boundary.
260
+ *
261
+ * Transport metadata and empty request sections remain available to handlers; a declared section
262
+ * then refines that base shape to its protocol contract.
263
+ */
264
+ export type HandlerRequest<Request extends RequestShape> = AbstractRequest & Request & EntrypointRequestMeta;
265
+ /**
266
+ * An immutable shared declaration. Its inherited reference type is what gives a context lookup
267
+ * the exact registered entrypoint type without a consumer-supplied generic.
268
+ */
269
+ export interface EntrypointProtocol<Request extends RequestShape = RequestShape, Response = OpenValue> extends EntrypointProtocolDeclaration, EntrypointReference<RegisteredEntrypoint<Request, Response>> {
270
+ readonly contract?: EntrypointContract<Request, Response>;
271
+ }
272
+ /** The context-bound counterpart of an immutable protocol declaration. */
273
+ export interface RegisteredEntrypoint<Request extends RequestShape, Response> extends BasicEntrypoint {
274
+ readonly protocol: EntrypointProtocol<Request, Response>;
275
+ call: (...args: CallArguments<Request>) => Promise<Response>;
276
+ invoke: (...args: CallArguments<Request>) => Promise<EntrypointResult<Response>>;
277
+ url: (...args: UrlArguments<Request>) => Promise<string>;
278
+ validate: (...args: CallArguments<Request>) => Promise<boolean>;
279
+ }
280
+ export type RequestOf<Protocol extends EntrypointProtocolDeclaration> = Protocol extends EntrypointProtocol<infer Request, infer _Response> ? Request : OpenRequest;
281
+ export type ResponseOf<Protocol extends EntrypointProtocolDeclaration> = Protocol extends EntrypointProtocol<infer _Request, infer Response> ? Response : OpenValue;
282
+ export type BodyOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
283
+ body: infer Body;
284
+ } ? Body : OpenValue;
285
+ export type ParamsOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
286
+ params: infer Params;
287
+ } ? Params : object;
288
+ export type QueryOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
289
+ query: infer Query;
290
+ } ? Query : object;
291
+ export type HeadersOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> extends {
292
+ headers: infer Headers;
293
+ } ? Headers : object;
294
+ export type CallRequestOf<Protocol extends EntrypointProtocolDeclaration> = RequestOf<Protocol> & CallOptions;
295
+ export interface EntrypointTree {
296
+ readonly [key: string]: EntrypointProtocolDeclaration | EntrypointTree;
297
+ }
298
+ export type FilterHelper = ReturnType<typeof createFilterHelper>;
83
299
  //# 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,KAA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+ 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,YAAY,CAAA;AAElF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAClC;AAED,MAAM,CAAC,OAAO,CAAC,MAAM,oBAAoB,EAAE,OAAO,MAAM,CAAA;AAExD,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,SAAS,CAAA;AAExD,MAAM,MAAM,WAAW,CAAC,MAAM,IAC5B,MAAM,SAAS,KAAK,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GACrC,MAAM,SAAS,gBAAgB,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GAClD,MAAM,SAAS,cAAc,CAAC,MAAM,KAAK,CAAC,GACxC,KAAK,SAAS,SAAS,GAAG,KAAK,GAAG,SAAS,GAC3C,SAAS,CAAA;AAEnB,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,YAAY,IACjD,CAAC,OAAO,SAAS;IAAE,MAAM,EAAE,MAAM,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D,OAAO,SAAS;IAAE,MAAM,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,EAAE,CAAC,GACvE,CAAC,OAAO,SAAS;IAAE,KAAK,EAAE,MAAM,KAAK,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,GACxD,OAAO,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAA;CAAE,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG,EAAE,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.local.js","sourceRoot":"","sources":["../src/types.local.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
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,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.4",
3
+ "version": "0.1.18-rc.40",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -28,10 +28,10 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@owlmeans/auth": "^0.1.18-rc.4",
32
- "@owlmeans/context": "^0.1.18-rc.4",
33
- "@owlmeans/route": "^0.1.18-rc.4",
34
- "ajv": "^8.17.1"
31
+ "@owlmeans/auth": "^0.1.18-rc.39",
32
+ "@owlmeans/context": "^0.1.18-rc.33",
33
+ "@owlmeans/route": "^0.1.18-rc.34",
34
+ "ajv": "^8.20.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@owlmeans/dep-config": "workspace:*",
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,67 @@
1
1
  import type { CommonEntrypoint } from './types.js'
2
2
  import { appendContextual } from '@owlmeans/context'
3
+ import {
4
+ isLocalRoute, resolveAddress, resolveMount, resolvePath, resolveService
5
+ } from '@owlmeans/route/utils'
3
6
  import type { CreateEntrypointSignature } from './utils/types.js'
4
7
 
5
8
  export const entrypoint: CreateEntrypointSignature<CommonEntrypoint> = (route, opts) => {
6
- let guards: string[] | null = null
7
- let gates: [string, string[]][] | null = null
8
9
  const ep: CommonEntrypoint = appendContextual<CommonEntrypoint>(route.route.alias, {
9
10
  _entrypoint: true,
10
- _module: true,
11
11
 
12
12
  sticky: false,
13
13
 
14
14
  route,
15
15
 
16
- getAlias: () => ep.route.route.alias,
17
- getPath: () => ep.route.route.path,
18
- getParentAlias: () => ep.route.route.parent ?? null,
19
- hasParent: () => ep.getParentAlias() != null,
16
+ segment: () => ep.route.route.path,
20
17
 
21
- resolve: async <M extends CommonEntrypoint>() => {
22
- if (ep.ctx == null) {
23
- throw new SyntaxError(`Entrypoint has no context yet - ${ep.getAlias()}`)
24
- }
18
+ path: () => resolvePath(ep.assertCtx(), ep.route.route),
25
19
 
26
- await ep.route.resolve(ep.ctx)
20
+ mount: () => resolveMount(ep.assertCtx(), ep.route.route),
27
21
 
28
- return ep as M
29
- },
22
+ service: () => resolveService(ep.assertCtx(), ep.route.route),
30
23
 
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
- }
24
+ address: () => resolveAddress(ep.assertCtx(), ep.route.route),
39
25
 
40
- return ep.ctx.entrypoint(parentAlias)
41
- },
26
+ isLocal: () => isLocalRoute(ep.assertCtx(), ep.route.route),
42
27
 
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
- },
28
+ parent: () => ep.route.route.parent == null ? null
29
+ : ep.assertCtx().entrypoint<CommonEntrypoint>(ep.route.route.parent),
49
30
 
31
+ // Walked afresh on every call: a guard attached to an ancestor after this entrypoint was first
32
+ // asked still has to count.
50
33
  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
- )
34
+ const guards = [...ep.guards ?? []]
35
+ const parent = ep.parent()
36
+ if (parent != null) {
37
+ guards.push(...parent.getGuards().filter(guard => !guards.includes(guard)))
60
38
  }
61
39
 
62
40
  return guards
63
41
  },
64
42
 
43
+ /**
44
+ * The gates standing over this entrypoint: its own, then an ancestor's for each gate service
45
+ * this entrypoint has not already named.
46
+ *
47
+ * KNOWN HAZARD, deliberately left alone: the dedup is by gate SERVICE, and two gates under one
48
+ * service are two different questions because their parameters differ — so a child that
49
+ * declares its own gate silently drops its ancestor's, which is the opposite of what
50
+ * "inherited" means. Anything that needs a group rule AND a member rule must therefore not
51
+ * express the group half as a gate under the same service. Changing this would widen every
52
+ * backend and socket entrypoint that today relies on the replacement, so it is a migration
53
+ * rather than a fix.
54
+ */
65
55
  getGates: () => {
66
- if (gates != null) {
67
- return gates
68
- }
69
-
70
- gates = ep.gate != null ? [[
56
+ const gates: [string, string[]][] = ep.gate != null ? [[
71
57
  ep.gate, ep.gateParams == null
72
58
  ? [] : Array.isArray(ep.gateParams)
73
59
  ? ep.gateParams : [ep.gateParams]
74
60
  ]] : []
75
61
 
76
- if (ep.hasParent()) {
77
- gates.push(
78
- ...ep.getParent().getGates()
79
- .filter(([gate]) => !gates?.some(([g]) => g === gate))
80
- )
62
+ const parent = ep.parent()
63
+ if (parent != null) {
64
+ gates.push(...parent.getGates().filter(([gate]) => !gates.some(([g]) => g === gate)))
81
65
  }
82
66
 
83
67
  return gates
@@ -88,19 +72,3 @@ export const entrypoint: CreateEntrypointSignature<CommonEntrypoint> = (route, o
88
72
 
89
73
  return ep
90
74
  }
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
- }
package/src/filter.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import type { JSONSchemaType } from 'ajv'
2
2
  import type { Filter } from './types.js'
3
3
 
4
- export const body = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
4
+ const body = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
5
5
  return { ...filter, body: schema as any }
6
6
  }
7
7
 
8
- export const query = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
8
+ const query = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
9
9
  return { ...filter, query: schema as any }
10
10
  }
11
11
 
12
- export const params = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
12
+ const params = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
13
13
  return { ...filter, params: schema as any }
14
14
  }
15
15
 
16
- export const response = <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter): Filter => {
16
+ const response = <T>(schema: JSONSchemaType<T>, code?: number, filter?: Filter): Filter => {
17
17
  let _schema: any = schema
18
18
  if (filter?.response != null && code != null) {
19
19
  _schema = { ...filter.response, [code]: schema }
@@ -21,6 +21,10 @@ export const response = <T>(schema: JSONSchemaType<T>, code?: number, filter?: F
21
21
  return { ...filter, response: _schema }
22
22
  }
23
23
 
24
- export const headers = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
24
+ const headers = <T>(schema: JSONSchemaType<T>, filter?: Filter): Filter => {
25
25
  return { ...filter, headers: schema as any }
26
26
  }
27
+
28
+ export const createFilterHelper = () => ({ body, query, params, response, headers })
29
+
30
+ 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,7 @@
1
1
 
2
2
  export type * from './types.js'
3
- export * from './entrypoint.js'
4
- export * from './filter.js'
5
- export * from './helper.js'
6
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'