@kensio/simnaril 0.0.0

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 (79) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +37 -0
  3. package/dist/api.d.ts +24 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +66 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/duplicate-entity-error.d.ts +7 -0
  8. package/dist/duplicate-entity-error.d.ts.map +1 -0
  9. package/dist/duplicate-entity-error.js +14 -0
  10. package/dist/duplicate-entity-error.js.map +1 -0
  11. package/dist/entity-not-found-error.d.ts +7 -0
  12. package/dist/entity-not-found-error.d.ts.map +1 -0
  13. package/dist/entity-not-found-error.js +13 -0
  14. package/dist/entity-not-found-error.js.map +1 -0
  15. package/dist/environment.d.ts +21 -0
  16. package/dist/environment.d.ts.map +1 -0
  17. package/dist/environment.js +65 -0
  18. package/dist/environment.js.map +1 -0
  19. package/dist/http/interception.d.ts +13 -0
  20. package/dist/http/interception.d.ts.map +1 -0
  21. package/dist/http/interception.js +56 -0
  22. package/dist/http/interception.js.map +1 -0
  23. package/dist/http/operation-pipeline.d.ts +7 -0
  24. package/dist/http/operation-pipeline.d.ts.map +1 -0
  25. package/dist/http/operation-pipeline.js +24 -0
  26. package/dist/http/operation-pipeline.js.map +1 -0
  27. package/dist/http/operation-router.d.ts +9 -0
  28. package/dist/http/operation-router.d.ts.map +1 -0
  29. package/dist/http/operation-router.js +63 -0
  30. package/dist/http/operation-router.js.map +1 -0
  31. package/dist/http/operation.d.ts +51 -0
  32. package/dist/http/operation.d.ts.map +1 -0
  33. package/dist/http/operation.js +43 -0
  34. package/dist/http/operation.js.map +1 -0
  35. package/dist/http/resource-operation-registry.d.ts +13 -0
  36. package/dist/http/resource-operation-registry.d.ts.map +1 -0
  37. package/dist/http/resource-operation-registry.js +46 -0
  38. package/dist/http/resource-operation-registry.js.map +1 -0
  39. package/dist/http/resource-operation.d.ts +9 -0
  40. package/dist/http/resource-operation.d.ts.map +1 -0
  41. package/dist/http/resource-operation.js +25 -0
  42. package/dist/http/resource-operation.js.map +1 -0
  43. package/dist/http/rest-resource-operations.d.ts +9 -0
  44. package/dist/http/rest-resource-operations.d.ts.map +1 -0
  45. package/dist/http/rest-resource-operations.js +97 -0
  46. package/dist/http/rest-resource-operations.js.map +1 -0
  47. package/dist/http/route.d.ts +14 -0
  48. package/dist/http/route.d.ts.map +1 -0
  49. package/dist/http/route.js +77 -0
  50. package/dist/http/route.js.map +1 -0
  51. package/dist/http/semantic-http-operation.d.ts +16 -0
  52. package/dist/http/semantic-http-operation.d.ts.map +1 -0
  53. package/dist/http/semantic-http-operation.js +20 -0
  54. package/dist/http/semantic-http-operation.js.map +1 -0
  55. package/dist/index.d.ts +11 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +11 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/resource.d.ts +29 -0
  60. package/dist/resource.d.ts.map +1 -0
  61. package/dist/resource.js +78 -0
  62. package/dist/resource.js.map +1 -0
  63. package/dist/rest-resource-operation.d.ts +29 -0
  64. package/dist/rest-resource-operation.d.ts.map +1 -0
  65. package/dist/rest-resource-operation.js +2 -0
  66. package/dist/rest-resource-operation.js.map +1 -0
  67. package/dist/rest-resource.d.ts +37 -0
  68. package/dist/rest-resource.d.ts.map +1 -0
  69. package/dist/rest-resource.js +63 -0
  70. package/dist/rest-resource.js.map +1 -0
  71. package/dist/unclaimed-origin-error.d.ts +8 -0
  72. package/dist/unclaimed-origin-error.d.ts.map +1 -0
  73. package/dist/unclaimed-origin-error.js +16 -0
  74. package/dist/unclaimed-origin-error.js.map +1 -0
  75. package/dist/unimplemented-route-error.d.ts +8 -0
  76. package/dist/unimplemented-route-error.d.ts.map +1 -0
  77. package/dist/unimplemented-route-error.js +16 -0
  78. package/dist/unimplemented-route-error.js.map +1 -0
  79. package/package.json +74 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-router.d.ts","sourceRoot":"","sources":["../../src/http/operation-router.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAIxB,oEAAoE;AACpE,qBAAa,eAAe;;IAI1B,GAAG,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAEpC;IAED,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAEvC;IAEK,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA0BhD;CA2CF"}
@@ -0,0 +1,63 @@
1
+ import { DuplicateEntityError } from "../duplicate-entity-error.js";
2
+ import { EntityNotFoundError } from "../entity-not-found-error.js";
3
+ import { UnimplementedRouteError } from "../unimplemented-route-error.js";
4
+ import { runHttpOperation, runMiddleware } from "./operation-pipeline.js";
5
+ /** Selects and runs registered operations for one simulated API. */
6
+ export class OperationRouter {
7
+ #middleware = [];
8
+ #operations = [];
9
+ use(middleware) {
10
+ this.#middleware.push(middleware);
11
+ }
12
+ register(operation) {
13
+ this.#operations.push(operation);
14
+ }
15
+ async handle(request) {
16
+ const pathname = new URL(request.url).pathname;
17
+ const method = request.method.toUpperCase();
18
+ let selected;
19
+ for (const operation of this.#operations) {
20
+ if (operation.method !== method) {
21
+ continue;
22
+ }
23
+ const match = operation.match(pathname);
24
+ if (match !== undefined &&
25
+ (selected === undefined ||
26
+ operation.specificity > selected.operation.specificity)) {
27
+ selected = { match, operation };
28
+ }
29
+ }
30
+ if (selected === undefined) {
31
+ throw new UnimplementedRouteError(request);
32
+ }
33
+ return this.#run(selected.operation, request, selected.match);
34
+ }
35
+ async #run(operation, request, match) {
36
+ const context = {
37
+ params: match.params,
38
+ query: new URL(request.url).searchParams,
39
+ request,
40
+ };
41
+ const middleware = [
42
+ ...this.#middleware,
43
+ ...operation.resourceMiddleware,
44
+ ...operation.middleware,
45
+ ];
46
+ return runMiddleware(context, middleware, () => runHttpOperation(operation, match, context), (action) => this.#translateErrors(action));
47
+ }
48
+ async #translateErrors(action) {
49
+ try {
50
+ return await action();
51
+ }
52
+ catch (error) {
53
+ if (error instanceof EntityNotFoundError) {
54
+ return Response.json({ error: error.message }, { status: 404 });
55
+ }
56
+ if (error instanceof DuplicateEntityError) {
57
+ return Response.json({ error: error.message }, { status: 409 });
58
+ }
59
+ throw error;
60
+ }
61
+ }
62
+ }
63
+ //# sourceMappingURL=operation-router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-router.js","sourceRoot":"","sources":["../../src/http/operation-router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAM1E,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG1E,oEAAoE;AACpE,MAAM,OAAO,eAAe;IACjB,WAAW,GAAqB,EAAE,CAAC;IACnC,WAAW,GAAoB,EAAE,CAAC;IAE3C,GAAG,CAAC,UAA0B;QAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,QAAQ,CAAC,SAAwB;QAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAgB;QAC3B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;QAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC5C,IAAI,QAAqE,CAAC;QAE1E,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACzC,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAChC,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,KAAK,YAAY,mBAAmB,EAAE,CAAC;gBACzC,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YAClE,CAAC;YAED,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;gBAC1C,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YAClE,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,51 @@
1
+ import type { CompiledRoute, RouteMatch } from "./route.js";
2
+ /** HTTP data shared by handlers and middleware for one matched operation. */
3
+ export interface HttpOperationContext {
4
+ params: Readonly<Record<string, string>>;
5
+ query: URLSearchParams;
6
+ request: Request;
7
+ }
8
+ /** Runs around an HTTP operation and its encoded response. */
9
+ export type HttpMiddleware = (context: HttpOperationContext, next: () => Promise<Response>) => Promise<Response> | Response;
10
+ /** HTTP and semantic data supplied to a semantic operation handler. */
11
+ export interface SemanticOperationContext<TInput, TResource> extends HttpOperationContext {
12
+ input: TInput;
13
+ resource: TResource;
14
+ }
15
+ /** Replaces the semantic behaviour of a supplied operation. */
16
+ export interface SemanticOperationOverride<TInput, TOutput, TResource> {
17
+ handle: (context: SemanticOperationContext<TInput, TResource>) => Promise<TOutput> | TOutput;
18
+ }
19
+ export interface HttpOperation extends CompiledRoute {
20
+ decode: (request: Request) => Promise<unknown>;
21
+ encode: (output: unknown) => Promise<Response> | Response;
22
+ method: string;
23
+ middleware: readonly HttpMiddleware[];
24
+ operate: (input: unknown, context: HttpOperationContext) => unknown;
25
+ resourceMiddleware: readonly HttpMiddleware[];
26
+ transform: (decoded: unknown, match: RouteMatch) => unknown;
27
+ }
28
+ declare const middlewareAccess: unique symbol;
29
+ declare const semanticRun: unique symbol;
30
+ /** Adds operation middleware and replaces semantic behaviour when supported. */
31
+ export declare class SemanticOperation<TInput, TOutput, TResource> {
32
+ #private;
33
+ constructor(handle: (context: SemanticOperationContext<TInput, TResource>) => Promise<TOutput> | TOutput);
34
+ /** Replaces this operation's semantic behaviour. */
35
+ override(replacement: SemanticOperationOverride<TInput, TOutput, TResource>): this;
36
+ /** Adds middleware around this operation. */
37
+ use(middleware: HttpMiddleware): this;
38
+ [semanticRun](context: SemanticOperationContext<TInput, TResource>): Promise<TOutput> | TOutput;
39
+ [middlewareAccess](): readonly HttpMiddleware[];
40
+ }
41
+ /** Adds middleware around a raw HTTP operation. */
42
+ export interface RawHttpOperation {
43
+ /** Adds middleware around this operation. */
44
+ use: (middleware: HttpMiddleware) => this;
45
+ [middlewareAccess]: () => readonly HttpMiddleware[];
46
+ }
47
+ export declare function createRawHttpOperation(): RawHttpOperation;
48
+ export declare function operationMiddleware<TInput, TOutput, TResource>(operation: RawHttpOperation | SemanticOperation<TInput, TOutput, TResource>): readonly HttpMiddleware[];
49
+ export declare function runSemanticOperation<TInput, TOutput, TResource>(operation: SemanticOperation<TInput, TOutput, TResource>, context: SemanticOperationContext<TInput, TResource>): Promise<TOutput> | TOutput;
50
+ export {};
51
+ //# sourceMappingURL=operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/http/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE5D,6EAA6E;AAC7E,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG,CAC3B,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,MAAM,OAAO,C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Q,CACN,WAAW,EAAE,yBAAyB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,GACjE,IAAI,CAGN;IAED,6CAA6C;IAC7C,GAAG,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAGpC;IAED,CAAC,WAAW,CAAC,CACX,OAAO,EAAE,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,GACnD,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAE5B;IAED,CAAC,gBAAgB,CAAC,IAAI,SAAS,cAAc,EAAE,CAE9C;CACF;AAED,mDAAmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,GAAG,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,CAAC,gBAAgB,CAAC,EAAE,MAAM,SAAS,cAAc,EAAE,CAAC;CACrD;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAUzD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAC5D,SAAS,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,GAC1E,SAAS,cAAc,EAAE,CAE3B;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAC7D,SAAS,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EACxD,OAAO,EAAE,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,GACnD,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAE5B"}
@@ -0,0 +1,43 @@
1
+ const middlewareAccess = Symbol("operation middleware");
2
+ const semanticRun = Symbol("semantic operation handler");
3
+ /** Adds operation middleware and replaces semantic behaviour when supported. */
4
+ export class SemanticOperation {
5
+ #middleware = [];
6
+ #handle;
7
+ constructor(handle) {
8
+ this.#handle = handle;
9
+ }
10
+ /** Replaces this operation's semantic behaviour. */
11
+ override(replacement) {
12
+ this.#handle = replacement.handle;
13
+ return this;
14
+ }
15
+ /** Adds middleware around this operation. */
16
+ use(middleware) {
17
+ this.#middleware.push(middleware);
18
+ return this;
19
+ }
20
+ [semanticRun](context) {
21
+ return this.#handle(context);
22
+ }
23
+ [middlewareAccess]() {
24
+ return this.#middleware;
25
+ }
26
+ }
27
+ export function createRawHttpOperation() {
28
+ const middleware = [];
29
+ return {
30
+ use(added) {
31
+ middleware.push(added);
32
+ return this;
33
+ },
34
+ [middlewareAccess]: () => middleware,
35
+ };
36
+ }
37
+ export function operationMiddleware(operation) {
38
+ return operation[middlewareAccess]();
39
+ }
40
+ export function runSemanticOperation(operation, context) {
41
+ return operation[semanticRun](context);
42
+ }
43
+ //# sourceMappingURL=operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/http/operation.ts"],"names":[],"mappings":"AAyCA,MAAM,gBAAgB,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACxD,MAAM,WAAW,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAEzD,gFAAgF;AAChF,MAAM,OAAO,iBAAiB;IACnB,WAAW,GAAqB,EAAE,CAAC;IAC5C,OAAO,CAEyB;IAEhC,YACE,MAE+B;QAE/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,oDAAoD;IACpD,QAAQ,CACN,WAAkE;QAElE,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6CAA6C;IAC7C,GAAG,CAAC,UAA0B;QAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,CAAC,WAAW,CAAC,CACX,OAAoD;QAEpD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,CAAC,gBAAgB,CAAC;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AASD,MAAM,UAAU,sBAAsB;IACpC,MAAM,UAAU,GAAqB,EAAE,CAAC;IAExC,OAAO;QACL,GAAG,CAAC,KAAK;YACP,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,CAAC,UAAU;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,SAA2E;IAE3E,OAAO,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,SAAwD,EACxD,OAAoD;IAEpD,OAAO,SAAS,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { RestResource } from "../rest-resource.js";
2
+ import type { ResourceOperationProps, RestResourceOperations, RestResourceProps } from "../rest-resource-operation.js";
3
+ import type { HttpMiddleware, HttpOperation, SemanticOperation } from "./operation.js";
4
+ /** Registers supplied and custom operations owned by one REST resource. */
5
+ export declare class ResourceOperationRegistry<T extends object> {
6
+ #private;
7
+ readonly operations: RestResourceOperations<T>;
8
+ constructor(resource: RestResource<T>, configuration: RestResourceProps["operations"]);
9
+ use(middleware: HttpMiddleware): void;
10
+ add<TInput, TOutput>(name: string, props: ResourceOperationProps<T, TInput, TOutput>): SemanticOperation<TInput, TOutput, RestResource<T>>;
11
+ attach(registerOperation: (operation: HttpOperation) => void): void;
12
+ }
13
+ //# sourceMappingURL=resource-operation-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-operation-registry.d.ts","sourceRoot":"","sources":["../../src/http/resource-operation-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAIxB,2EAA2E;AAC3E,qBAAa,yBAAyB,CAAC,CAAC,SAAS,MAAM;;IACrD,QAAQ,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAa/C,YACE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EACzB,aAAa,EAAE,iBAAiB,CAAC,YAAY,CAAC,EAU/C;IAED,GAAG,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAEpC;IAED,GAAG,CAAC,MAAM,EAAE,OAAO,EACjB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAChD,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAsBrD;IAED,MAAM,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,GAAG,IAAI,CAMlE;CACF"}
@@ -0,0 +1,46 @@
1
+ import { resourceOperation } from "./resource-operation.js";
2
+ import { restResourceOperations } from "./rest-resource-operations.js";
3
+ /** Registers supplied and custom operations owned by one REST resource. */
4
+ export class ResourceOperationRegistry {
5
+ operations;
6
+ #httpOperations;
7
+ #middleware = [];
8
+ #names = new Set([
9
+ "list",
10
+ "create",
11
+ "get",
12
+ "update",
13
+ "delete",
14
+ ]);
15
+ #resource;
16
+ #registerOperation;
17
+ constructor(resource, configuration) {
18
+ this.#resource = resource;
19
+ const supplied = restResourceOperations(resource, configuration, this.#middleware);
20
+ this.#httpOperations = supplied.http;
21
+ this.operations = supplied.semantic;
22
+ }
23
+ use(middleware) {
24
+ this.#middleware.push(middleware);
25
+ }
26
+ add(name, props) {
27
+ if (this.#names.has(name)) {
28
+ throw new TypeError(`An operation named "${name}" already exists on resource path "${this.#resource.path}".`);
29
+ }
30
+ if (!props.path.startsWith("/")) {
31
+ throw new TypeError(`Expected a resource operation path such as "/:id/archive", received "${props.path}".`);
32
+ }
33
+ const operation = resourceOperation(this.#resource, this.#middleware, props);
34
+ this.#names.add(name);
35
+ this.#httpOperations.push(operation.http);
36
+ this.#registerOperation?.(operation.http);
37
+ return operation.semantic;
38
+ }
39
+ attach(registerOperation) {
40
+ this.#registerOperation = registerOperation;
41
+ for (const operation of this.#httpOperations) {
42
+ registerOperation(operation);
43
+ }
44
+ }
45
+ }
46
+ //# sourceMappingURL=resource-operation-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-operation-registry.js","sourceRoot":"","sources":["../../src/http/resource-operation-registry.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,2EAA2E;AAC3E,MAAM,OAAO,yBAAyB;IAC3B,UAAU,CAA4B;IACtC,eAAe,CAAkB;IACjC,WAAW,GAAqB,EAAE,CAAC;IACnC,MAAM,GAAG,IAAI,GAAG,CAAS;QAChC,MAAM;QACN,QAAQ;QACR,KAAK;QACL,QAAQ;QACR,QAAQ;KACT,CAAC,CAAC;IACM,SAAS,CAAkB;IACpC,kBAAkB,CAAmD;IAErE,YACE,QAAyB,EACzB,aAA8C;QAE9C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,sBAAsB,CACrC,QAAQ,EACR,aAAa,EACb,IAAI,CAAC,WAAW,CACjB,CAAC;QACF,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED,GAAG,CAAC,UAA0B;QAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,GAAG,CACD,IAAY,EACZ,KAAiD;QAEjD,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,SAAS,CACjB,uBAAuB,IAAI,sCAAsC,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CACzF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,SAAS,CACjB,wEAAwE,KAAK,CAAC,IAAI,IAAI,CACvF,CAAC;QACJ,CAAC;QAED,MAAM,SAAS,GAAG,iBAAiB,CACjC,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,WAAW,EAChB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,kBAAkB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,iBAAqD;QAC1D,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;QAE5C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC7C,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { RestResource } from "../rest-resource.js";
2
+ import type { ResourceOperationProps } from "../rest-resource-operation.js";
3
+ import { type HttpMiddleware, type HttpOperation, SemanticOperation } from "./operation.js";
4
+ /** Builds one named semantic operation below a resource path. */
5
+ export declare function resourceOperation<T extends object, TInput, TOutput>(resource: RestResource<T>, middleware: readonly HttpMiddleware[], props: ResourceOperationProps<T, TInput, TOutput>): {
6
+ http: HttpOperation;
7
+ semantic: SemanticOperation<TInput, TOutput, RestResource<T>>;
8
+ };
9
+ //# sourceMappingURL=resource-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-operation.d.ts","sourceRoot":"","sources":["../../src/http/resource-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAYxB,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,EACjE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EACzB,UAAU,EAAE,SAAS,cAAc,EAAE,EACrC,KAAK,EAAE,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAChD;IACD,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D,CAgBA"}
@@ -0,0 +1,25 @@
1
+ import { SemanticOperation, } from "./operation.js";
2
+ import { compileRoute } from "./route.js";
3
+ import { semanticHttpOperation } from "./semantic-http-operation.js";
4
+ const decodeResourceOperation = async (request) => request.body === null ? undefined : request.json();
5
+ const encodeResourceOperation = (output) => output === undefined
6
+ ? new Response(undefined, { status: 204 })
7
+ : Response.json(output);
8
+ /** Builds one named semantic operation below a resource path. */
9
+ export function resourceOperation(resource, middleware, props) {
10
+ const route = compileRoute(`${resource.path}${props.path}`);
11
+ const semantic = new SemanticOperation(props.handle);
12
+ return {
13
+ semantic,
14
+ http: semanticHttpOperation({
15
+ decode: decodeResourceOperation,
16
+ encode: encodeResourceOperation,
17
+ method: props.method,
18
+ resource,
19
+ resourceMiddleware: middleware,
20
+ route,
21
+ semantic,
22
+ }),
23
+ };
24
+ }
25
+ //# sourceMappingURL=resource-operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-operation.js","sourceRoot":"","sources":["../../src/http/resource-operation.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,uBAAuB,GAAG,KAAK,EAAE,OAAgB,EAAoB,EAAE,CAC3E,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AAErD,MAAM,uBAAuB,GAAG,CAAC,MAAe,EAAY,EAAE,CAC5D,MAAM,KAAK,SAAS;IAClB,CAAC,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAC1C,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE5B,iEAAiE;AACjE,MAAM,UAAU,iBAAiB,CAC/B,QAAyB,EACzB,UAAqC,EACrC,KAAiD;IAKjD,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO;QACL,QAAQ;QACR,IAAI,EAAE,qBAAqB,CAAC;YAC1B,MAAM,EAAE,uBAAuB;YAC/B,MAAM,EAAE,uBAAuB;YAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,QAAQ;YACR,kBAAkB,EAAE,UAAU;YAC9B,KAAK;YACL,QAAQ;SACT,CAAC;KACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { RestResource } from "../rest-resource.js";
2
+ import type { RestResourceOperationConfiguration, RestResourceOperations } from "../rest-resource-operation.js";
3
+ import { type HttpMiddleware, type HttpOperation } from "./operation.js";
4
+ /** Builds conventional collection and item operations for one resource. */
5
+ export declare function restResourceOperations<T extends object>(resource: RestResource<T>, configuration?: Partial<Record<keyof RestResourceOperations<T>, RestResourceOperationConfiguration>>, resourceMiddleware?: readonly HttpMiddleware[]): {
6
+ http: HttpOperation[];
7
+ semantic: RestResourceOperations<T>;
8
+ };
9
+ //# sourceMappingURL=rest-resource-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-resource-operations.d.ts","sourceRoot":"","sources":["../../src/http/rest-resource-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EACV,kCAAkC,EAClC,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAGnB,MAAM,gBAAgB,CAAC;AAoExB,2EAA2E;AAC3E,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EACrD,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,EACzB,aAAa,GAAE,OAAO,CACpB,MAAM,CAAC,MAAM,sBAAsB,CAAC,CAAC,CAAC,EAAE,kCAAkC,CAAC,CACvE,EACN,kBAAkB,GAAE,SAAS,cAAc,EAAO,GACjD;IAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAA;CAAE,CAqEhE"}
@@ -0,0 +1,97 @@
1
+ import { SemanticOperation, } from "./operation.js";
2
+ import { compileRoute } from "./route.js";
3
+ import { semanticHttpOperation } from "./semantic-http-operation.js";
4
+ const decodeEmpty = () => Promise.resolve();
5
+ const decodeJson = async (request) => request.json();
6
+ const encodeJson = (status) => (output) => Response.json(output, { status });
7
+ const encodeEmpty = () => new Response(undefined, { status: 204 });
8
+ const requiredPathParameter = (params, name) => {
9
+ const value = params[name];
10
+ if (value === undefined) {
11
+ throw new TypeError(`Matched operation has no ":${name}" path parameter.`);
12
+ }
13
+ return value;
14
+ };
15
+ const suppliedOperation = (props) => {
16
+ const semantic = new SemanticOperation(props.handle);
17
+ const route = compileRoute(`${props.resource.path}${props.configuration?.path ?? props.defaultPath}`, props.requiredParameters);
18
+ return {
19
+ semantic,
20
+ http: semanticHttpOperation({
21
+ decode: props.decode,
22
+ encode: props.encode,
23
+ method: props.configuration?.method ?? props.defaultMethod,
24
+ resource: props.resource,
25
+ resourceMiddleware: props.resourceMiddleware,
26
+ route,
27
+ semantic,
28
+ }),
29
+ };
30
+ };
31
+ /** Builds conventional collection and item operations for one resource. */
32
+ export function restResourceOperations(resource, configuration = {}, resourceMiddleware = []) {
33
+ const list = suppliedOperation({
34
+ resource,
35
+ resourceMiddleware,
36
+ configuration: configuration.list,
37
+ defaultMethod: "GET",
38
+ defaultPath: "",
39
+ decode: decodeEmpty,
40
+ handle: ({ resource: operationResource }) => operationResource.list(),
41
+ encode: encodeJson(200),
42
+ });
43
+ const create = suppliedOperation({
44
+ resource,
45
+ resourceMiddleware,
46
+ configuration: configuration.create,
47
+ defaultMethod: "POST",
48
+ defaultPath: "",
49
+ decode: decodeJson,
50
+ handle: ({ input, resource: operationResource }) => operationResource.create(input),
51
+ encode: encodeJson(201),
52
+ });
53
+ const get = suppliedOperation({
54
+ resource,
55
+ resourceMiddleware,
56
+ configuration: configuration.get,
57
+ defaultMethod: "GET",
58
+ defaultPath: "/:id",
59
+ decode: decodeEmpty,
60
+ handle: ({ params, resource: operationResource }) => operationResource.get(requiredPathParameter(params, "id")),
61
+ encode: encodeJson(200),
62
+ requiredParameters: ["id"],
63
+ });
64
+ const update = suppliedOperation({
65
+ resource,
66
+ resourceMiddleware,
67
+ configuration: configuration.update,
68
+ defaultMethod: "PATCH",
69
+ defaultPath: "/:id",
70
+ decode: decodeJson,
71
+ handle: ({ input, params, resource: operationResource }) => operationResource.update(requiredPathParameter(params, "id"), input),
72
+ encode: encodeJson(200),
73
+ requiredParameters: ["id"],
74
+ });
75
+ const deleteOperation = suppliedOperation({
76
+ resource,
77
+ resourceMiddleware,
78
+ configuration: configuration.delete,
79
+ defaultMethod: "DELETE",
80
+ defaultPath: "/:id",
81
+ decode: decodeEmpty,
82
+ handle: ({ params, resource: operationResource }) => operationResource.delete(requiredPathParameter(params, "id")),
83
+ encode: encodeEmpty,
84
+ requiredParameters: ["id"],
85
+ });
86
+ return {
87
+ http: [list.http, create.http, get.http, update.http, deleteOperation.http],
88
+ semantic: {
89
+ list: list.semantic,
90
+ create: create.semantic,
91
+ get: get.semantic,
92
+ update: update.semantic,
93
+ delete: deleteOperation.semantic,
94
+ },
95
+ };
96
+ }
97
+ //# sourceMappingURL=rest-resource-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-resource-operations.js","sourceRoot":"","sources":["../../src/http/rest-resource-operations.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,WAAW,GAAG,GAAqB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;AAE9D,MAAM,UAAU,GAAG,KAAK,EAAE,OAAgB,EAAoB,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AAEhF,MAAM,UAAU,GACd,CAAC,MAAc,EAAE,EAAE,CACnB,CAAC,MAAe,EAAY,EAAE,CAC5B,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAEtC,MAAM,WAAW,GAAG,GAAa,EAAE,CAAC,IAAI,QAAQ,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,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,iBAAiB,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC;QACtE,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC;QACvB,kBAAkB,EAAE,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;IACH,MAAM,eAAe,GAAG,iBAAiB,CAAgB;QACvD,QAAQ;QACR,kBAAkB;QAClB,aAAa,EAAE,aAAa,CAAC,MAAM;QACnC,aAAa,EAAE,QAAQ;QACvB,WAAW,EAAE,MAAM;QACnB,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAClD,iBAAiB,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/D,MAAM,EAAE,WAAW;QACnB,kBAAkB,EAAE,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC;QAC3E,QAAQ,EAAE;YACR,IAAI,EAAE,IAAI,CAAC,QAAQ;YACnB,MAAM,EAAE,MAAM,CAAC,QAAQ;YACvB,GAAG,EAAE,GAAG,CAAC,QAAQ;YACjB,MAAM,EAAE,MAAM,CAAC,QAAQ;YACvB,MAAM,EAAE,eAAe,CAAC,QAAQ;SACjC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ export interface RouteMatch {
2
+ params: Readonly<Record<string, string>>;
3
+ }
4
+ export interface CompiledRoute {
5
+ match: (pathname: string) => RouteMatch | undefined;
6
+ specificity: number;
7
+ }
8
+ /** Compiles an absolute path template with named parameters. */
9
+ export declare function compileRoute(path: string, requiredParameters?: readonly string[]): CompiledRoute;
10
+ /** Validates an absolute operation path or path template. */
11
+ export declare function validateOperationPath(path: string): void;
12
+ /** Normalizes and validates one HTTP method. */
13
+ export declare function normalizeMethod(method: string): string;
14
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/http/route.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IACpD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,kBAAkB,GAAE,SAAS,MAAM,EAAO,GACzC,aAAa,CA6Ef;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAexD;AAED,gDAAgD;AAChD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMtD"}
@@ -0,0 +1,77 @@
1
+ /** Compiles an absolute path template with named parameters. */
2
+ export function compileRoute(path, requiredParameters = []) {
3
+ validateOperationPath(path);
4
+ const segments = path === "/" ? [] : path.slice(1).split("/");
5
+ const parameterNames = new Set();
6
+ for (const segment of segments) {
7
+ if (!segment.startsWith(":")) {
8
+ continue;
9
+ }
10
+ const name = segment.slice(1);
11
+ if (!/^[A-Za-z_][A-Za-z\d_]*$/u.test(name)) {
12
+ throw new TypeError(`Expected a named path parameter such as ":id", received "${segment}".`);
13
+ }
14
+ if (parameterNames.has(name)) {
15
+ throw new TypeError(`Path parameter ":${name}" appears more than once.`);
16
+ }
17
+ parameterNames.add(name);
18
+ }
19
+ for (const name of requiredParameters) {
20
+ if (!parameterNames.has(name)) {
21
+ throw new TypeError(`Operation path "${path}" must include path parameter ":${name}".`);
22
+ }
23
+ }
24
+ const literalSegments = segments.filter((segment) => !segment.startsWith(":")).length;
25
+ const literalLength = segments
26
+ .filter((segment) => !segment.startsWith(":"))
27
+ .join("/").length;
28
+ return {
29
+ specificity: literalSegments * 1_000_000 + segments.length * 1000 + literalLength,
30
+ match: (pathname) => {
31
+ const candidateSegments = pathname === "/" ? [] : pathname.slice(1).split("/");
32
+ if (candidateSegments.length !== segments.length) {
33
+ return undefined;
34
+ }
35
+ const params = {};
36
+ for (const [index, segment] of segments.entries()) {
37
+ const candidate = candidateSegments[index] ?? "";
38
+ if (candidate.length === 0) {
39
+ return undefined;
40
+ }
41
+ if (!segment.startsWith(":")) {
42
+ if (candidate !== segment) {
43
+ return undefined;
44
+ }
45
+ continue;
46
+ }
47
+ try {
48
+ params[segment.slice(1)] = decodeURIComponent(candidate);
49
+ }
50
+ catch {
51
+ return undefined;
52
+ }
53
+ }
54
+ return { params };
55
+ },
56
+ };
57
+ }
58
+ /** Validates an absolute operation path or path template. */
59
+ export function validateOperationPath(path) {
60
+ const base = new URL("https://simnaril.invalid");
61
+ const url = new URL(path, base);
62
+ if (url.origin !== base.origin ||
63
+ url.pathname !== path ||
64
+ url.search !== "" ||
65
+ url.hash !== "" ||
66
+ !/^\/(?:[^/]+(?:\/[^/]+)*)?$/u.test(path)) {
67
+ throw new TypeError(`Expected an absolute operation path such as "/widgets/:id", received "${path}".`);
68
+ }
69
+ }
70
+ /** Normalizes and validates one HTTP method. */
71
+ export function normalizeMethod(method) {
72
+ if (!/^[!#$%&'*+\-.^_`|~A-Za-z\d]+$/u.test(method)) {
73
+ throw new TypeError(`Expected an HTTP method, received "${method}".`);
74
+ }
75
+ return method.toUpperCase();
76
+ }
77
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/http/route.ts"],"names":[],"mappings":"AASA,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,kBAA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AC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEhC,IACE,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAC1B,GAAG,CAAC,QAAQ,KAAK,IAAI;QACrB,GAAG,CAAC,MAAM,KAAK,EAAE;QACjB,GAAG,CAAC,IAAI,KAAK,EAAE;QACf,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,EACzC,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,yEAAyE,IAAI,IAAI,CAClF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,gDAAgD;AAChD,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,gCAAgC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,SAAS,CAAC,sCAAsC,MAAM,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { RestResource } from "../rest-resource.js";
2
+ import { type HttpMiddleware, type HttpOperation, type SemanticOperation } from "./operation.js";
3
+ import type { CompiledRoute } from "./route.js";
4
+ interface SemanticHttpOperationProps<T extends object, TInput, TOutput> {
5
+ decode: (request: Request) => Promise<unknown>;
6
+ encode: (output: unknown) => Promise<Response> | Response;
7
+ method: string;
8
+ resource: RestResource<T>;
9
+ resourceMiddleware: readonly HttpMiddleware[];
10
+ route: CompiledRoute;
11
+ semantic: SemanticOperation<TInput, TOutput, RestResource<T>>;
12
+ }
13
+ /** Adapts a semantic resource operation to shared HTTP execution. */
14
+ export declare function semanticHttpOperation<T extends object, TInput, TOutput>(props: SemanticHttpOperationProps<T, TInput, TOutput>): HttpOperation;
15
+ export {};
16
+ //# sourceMappingURL=semantic-http-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-http-operation.d.ts","sourceRoot":"","sources":["../../src/http/semantic-http-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAGlB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,UAAU,0BAA0B,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO;IACpE,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC1B,kBAAkB,EAAE,SAAS,cAAc,EAAE,CAAC;IAC9C,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/D;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,OAAO,EACrE,KAAK,EAAE,0BAA0B,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GACpD,aAAa,CAgBf"}
@@ -0,0 +1,20 @@
1
+ import { operationMiddleware, runSemanticOperation, } from "./operation.js";
2
+ import { normalizeMethod } from "./route.js";
3
+ /** Adapts a semantic resource operation to shared HTTP execution. */
4
+ export function semanticHttpOperation(props) {
5
+ return {
6
+ ...props.route,
7
+ decode: props.decode,
8
+ encode: props.encode,
9
+ method: normalizeMethod(props.method),
10
+ middleware: operationMiddleware(props.semantic),
11
+ operate: (input, context) => runSemanticOperation(props.semantic, {
12
+ ...context,
13
+ input: input,
14
+ resource: props.resource,
15
+ }),
16
+ resourceMiddleware: props.resourceMiddleware,
17
+ transform: (decoded) => decoded,
18
+ };
19
+ }
20
+ //# sourceMappingURL=semantic-http-operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-http-operation.js","sourceRoot":"","sources":["../../src/http/semantic-http-operation.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAY7C,qEAAqE;AACrE,MAAM,UAAU,qBAAqB,CACnC,KAAqD;IAErD,OAAO;QACL,GAAG,KAAK,CAAC,KAAK;QACd,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC;QACrC,UAAU,EAAE,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC/C,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAC1B,oBAAoB,CAAC,KAAK,CAAC,QAAQ,EAAE;YACnC,GAAG,OAAO;YACV,KAAK,EAAE,KAAe;YACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;SACzB,CAAC;QACJ,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;QAC5C,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;KAChC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { SimApi, type RawHttpOperationHandler, type SimApiResourceProps, } from "./api.js";
2
+ export { SimEnvironment, type SimEnvironmentProps, type SimService, type UnhandledRequestPolicy, } from "./environment.js";
3
+ export { DuplicateEntityError } from "./duplicate-entity-error.js";
4
+ export { EntityNotFoundError } from "./entity-not-found-error.js";
5
+ export { type HttpMiddleware, type HttpOperationContext, type RawHttpOperation, SemanticOperation, type SemanticOperationContext, type SemanticOperationOverride, } from "./http/operation.js";
6
+ export { RestResource } from "./rest-resource.js";
7
+ export { type ResourceOperationProps, type RestResourceOperationConfiguration, type RestResourceOperationName, type RestResourceOperations, type RestResourceProps, } from "./rest-resource-operation.js";
8
+ export { SimResource, type SimResourceProps } from "./resource.js";
9
+ export { UnclaimedOriginError } from "./unclaimed-origin-error.js";
10
+ export { UnimplementedRouteError } from "./unimplemented-route-error.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,kCAAkC,EACvC,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ export { SimApi, } from "./api.js";
2
+ export { SimEnvironment, } from "./environment.js";
3
+ export { DuplicateEntityError } from "./duplicate-entity-error.js";
4
+ export { EntityNotFoundError } from "./entity-not-found-error.js";
5
+ export { SemanticOperation, } from "./http/operation.js";
6
+ export { RestResource } from "./rest-resource.js";
7
+ export {} from "./rest-resource-operation.js";
8
+ export { SimResource } from "./resource.js";
9
+ export { UnclaimedOriginError } from "./unclaimed-origin-error.js";
10
+ export { UnimplementedRouteError } from "./unimplemented-route-error.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,GAGP,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,cAAc,GAIf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAIL,iBAAiB,GAGlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAMN,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC"}