@warlock.js/core 5.26.0 → 5.27.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 (98) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/esm/cli/commands/openapi-generator.action.mjs +43 -0
  3. package/esm/cli/commands/openapi-generator.action.mjs.map +1 -0
  4. package/esm/cli/commands/openapi-generator.command.mjs +44 -0
  5. package/esm/cli/commands/openapi-generator.command.mjs.map +1 -0
  6. package/esm/cli/framework-cli-commands.mjs +2 -0
  7. package/esm/cli/framework-cli-commands.mjs.map +1 -1
  8. package/esm/dev-server/build-development-openapi-document.mjs +36 -0
  9. package/esm/dev-server/build-development-openapi-document.mjs.map +1 -0
  10. package/esm/dev-server/collect-development-api-routes.mjs +27 -0
  11. package/esm/dev-server/collect-development-api-routes.mjs.map +1 -0
  12. package/esm/dev-server/dev-logger.mjs +9 -1
  13. package/esm/dev-server/dev-logger.mjs.map +1 -1
  14. package/esm/dev-server/development-server.mjs +6 -3
  15. package/esm/dev-server/development-server.mjs.map +1 -1
  16. package/esm/dev-server/files-orchestrator.mjs +17 -1
  17. package/esm/dev-server/files-orchestrator.mjs.map +1 -1
  18. package/esm/dev-server/model-resource-typings.mjs +246 -0
  19. package/esm/dev-server/model-resource-typings.mjs.map +1 -0
  20. package/esm/dev-server/type-generator.mjs +46 -2
  21. package/esm/dev-server/type-generator.mjs.map +1 -1
  22. package/esm/http/index.d.mts +2 -1
  23. package/esm/http/request.d.mts +2 -2
  24. package/esm/http/request.d.mts.map +1 -1
  25. package/esm/http/serialized.d.mts +114 -0
  26. package/esm/http/serialized.d.mts.map +1 -0
  27. package/esm/index.d.mts +8 -3
  28. package/esm/index.mjs +4 -1
  29. package/esm/openapi/build-openapi-document.d.mts +17 -0
  30. package/esm/openapi/build-openapi-document.d.mts.map +1 -0
  31. package/esm/openapi/build-openapi-document.mjs +124 -0
  32. package/esm/openapi/build-openapi-document.mjs.map +1 -0
  33. package/esm/openapi/cast-schema.mjs +89 -0
  34. package/esm/openapi/cast-schema.mjs.map +1 -0
  35. package/esm/openapi/collect-openapi-document.mjs +40 -0
  36. package/esm/openapi/collect-openapi-document.mjs.map +1 -0
  37. package/esm/openapi/development-openapi-provider.d.mts +17 -0
  38. package/esm/openapi/development-openapi-provider.d.mts.map +1 -0
  39. package/esm/openapi/development-openapi-provider.mjs +21 -0
  40. package/esm/openapi/development-openapi-provider.mjs.map +1 -0
  41. package/esm/openapi/error-responses.mjs +67 -0
  42. package/esm/openapi/error-responses.mjs.map +1 -0
  43. package/esm/openapi/index.d.mts +3 -0
  44. package/esm/openapi/index.mjs +4 -0
  45. package/esm/openapi/openapi-child-output.mjs +57 -0
  46. package/esm/openapi/openapi-child-output.mjs.map +1 -0
  47. package/esm/openapi/openapi-protocol.mjs +30 -0
  48. package/esm/openapi/openapi-protocol.mjs.map +1 -0
  49. package/esm/openapi/paths.mjs +63 -0
  50. package/esm/openapi/paths.mjs.map +1 -0
  51. package/esm/openapi/request-schemas.mjs +138 -0
  52. package/esm/openapi/request-schemas.mjs.map +1 -0
  53. package/esm/openapi/response-schemas.mjs +85 -0
  54. package/esm/openapi/response-schemas.mjs.map +1 -0
  55. package/esm/openapi/schema-registry.mjs +143 -0
  56. package/esm/openapi/schema-registry.mjs.map +1 -0
  57. package/esm/openapi/security.mjs +98 -0
  58. package/esm/openapi/security.mjs.map +1 -0
  59. package/esm/openapi/types.d.mts +119 -0
  60. package/esm/openapi/types.d.mts.map +1 -0
  61. package/esm/production/registration-child-runner.mjs +139 -0
  62. package/esm/production/registration-child-runner.mjs.map +1 -0
  63. package/esm/production/route-registration-child.mjs +30 -2
  64. package/esm/production/route-registration-child.mjs.map +1 -1
  65. package/esm/production/route-registration-snapshot.mjs +22 -119
  66. package/esm/production/route-registration-snapshot.mjs.map +1 -1
  67. package/esm/resource/define-resource.d.mts +44 -14
  68. package/esm/resource/define-resource.d.mts.map +1 -1
  69. package/esm/resource/define-resource.mjs +0 -40
  70. package/esm/resource/define-resource.mjs.map +1 -1
  71. package/esm/resource/index.d.mts +1 -1
  72. package/esm/resource/resource.d.mts +4 -4
  73. package/esm/resource/resource.d.mts.map +1 -1
  74. package/esm/resource/resource.mjs.map +1 -1
  75. package/esm/resource/types.d.mts +89 -4
  76. package/esm/resource/types.d.mts.map +1 -1
  77. package/esm/restful/restful.d.mts +5 -5
  78. package/esm/restful/restful.d.mts.map +1 -1
  79. package/esm/router/index.d.mts +1 -1
  80. package/esm/router/named-api-routes-with-responses.mjs +59 -0
  81. package/esm/router/named-api-routes-with-responses.mjs.map +1 -0
  82. package/esm/router/response-schema-types.mjs +100 -0
  83. package/esm/router/response-schema-types.mjs.map +1 -0
  84. package/esm/router/router.d.mts +2 -2
  85. package/esm/router/router.d.mts.map +1 -1
  86. package/esm/router/router.mjs +38 -11
  87. package/esm/router/router.mjs.map +1 -1
  88. package/esm/router/types.d.mts +16 -1
  89. package/esm/router/types.d.mts.map +1 -1
  90. package/llms-full.txt +265 -5
  91. package/llms.txt +3 -2
  92. package/package.json +13 -13
  93. package/skills/README.md +3 -2
  94. package/skills/create-controller/SKILL.md +39 -2
  95. package/skills/define-resource/SKILL.md +100 -1
  96. package/skills/generate-openapi/SKILL.md +120 -0
  97. package/skills/index.md +3 -3
  98. package/skills/validate-input/SKILL.md +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.mts","names":[],"sources":["../../../../../../../core/src/http/request.ts"],"mappings":";;;;;;;;;;KAiCK,eAAA,iBAIU,mBAAA,mBAAsC,CAAA,0BAA2B,CAAA,WAAY,CAAA,GACvF,mBAAA,CAAoB,CAAA;AAAA,KAGpB,UAAA,SAAmB,eAAe;;KAG3B,iBAAA,IAAqB,OAAA,UAAiB,YAAA,GAAe,MAAM;AAAA,cAE1D,OAAA;EATwC;;;;;;;;;;;;;;;AAC3B;EAyBjB,WAAA,EAAc,cAAA;EAtBR;;;EA2BN,QAAA,EAAW,QAAA;EAxBR;;;EA6BH,KAAA,EAAQ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B,MAAA;;;;;;;;;;;EAcJ,QAAA,CAAS,GAAA,UAAa,KAAA;;;;MAUlB,KAAA;;;;EAOJ,QAAA,CAAS,GAAA,UAAa,KAAA;;;;EAStB,GAAA;;;;EAOA,eAAA;;;;EAUA,iBAAA;;;;EAmBA,KAAA;;;;EAmBA,IAAA,CAAK,IAAA;;;;EAOL,KAAA,CAAM,IAAA;;;;EAWN,MAAA,CAAO,IAAA;;;;EAOP,IAAA,CAAK,GAAA,UAAa,YAAA;;;;EAqBlB,GAAA,CAAI,GAAA,UAAa,YAAA;;;;MAWb,OAAA;;;;EAOJ,MAAA,CAAO,GAAA,UAAa,YAAA;;;;EASpB,KAAA,CAAM,GAAA,UAAa,YAAA;;;;EASnB,MAAA,CAAO,GAAA,UAAa,YAAA;;;;;;;;;;MAehB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCJ,QAAA;;;;MAoCI,MAAA;;;;MAOA,GAAA;;;;MAOA,OAAA;;;;MAOA,SAAA;;;;MAOA,OAAA,gBAAuB,WAAA,CAAY,OAAA;;;;EAOvC,SAAA,CAAU,GAAA,EAAK,UAAA,EAAY,KAAA;AAAA"}
@@ -0,0 +1,114 @@
1
+ import { Model } from "@warlock.js/cascade";
2
+
3
+ //#region ../core/src/http/serialized.d.ts
4
+ /**
5
+ * The two wire formats Warlock serializes a value into.
6
+ *
7
+ * - `"json"`: an API response. `Response.parse` walks the value, then the body
8
+ * is `JSON.stringify`-ed. `Date` becomes a string, `Map` an object, `Set` an
9
+ * array.
10
+ * - `"devalue"`: page loader data. `serializeLoaderData` walks the value, then
11
+ * `devalue` encodes it. `Date`, `Map`, `Set`, `RegExp` and `URL` survive as
12
+ * native values.
13
+ */
14
+ type SerializedWire = "json" | "devalue";
15
+ /**
16
+ * Maps cascade models to the resource that serializes them.
17
+ *
18
+ * Empty on purpose: `Model.resource` is a static typed `any`, so a model
19
+ * instance type cannot reveal its resource. A code generator (or the app)
20
+ * augments this interface instead, one entry per model:
21
+ *
22
+ * @example
23
+ * declare module "@warlock.js/core" {
24
+ * interface ModelResourceRegistry {
25
+ * User: { model: User; resource: typeof UserResource };
26
+ * }
27
+ * }
28
+ *
29
+ * `Serialized<User>` then resolves to the output of `UserResource`. A model
30
+ * with no entry resolves to its serialized `data` type instead.
31
+ */
32
+ interface ModelResourceRegistry {}
33
+ /** Deepest level `Serialized` walks before giving up with `unknown`. */
34
+ type MaxSerializedDepth = 8;
35
+ type IsAny<T> = 0 extends 1 & T ? true : false;
36
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
37
+ /** Passes through untouched on both wires (`Buffer` has a `toJSON`, so it must be caught first). */
38
+ type Binary = Buffer | Uint8Array;
39
+ /** Returned whole by `serializeLoaderData` before `toJSON` is considered. */
40
+ type DevalueNative = Date | RegExp | URL | Map<any, any> | Set<any>;
41
+ /**
42
+ * Built-in classes that are not plain objects and have no `toJSON`. JSON emits
43
+ * `{}` for them (their state is not enumerable); devalue cannot encode them.
44
+ */
45
+ type OpaqueBuiltin = Error | WeakMap<any, any> | WeakSet<any> | WeakRef<any>;
46
+ type IsFunctionValued<V> = IsAny<V> extends true ? false : [Exclude<V, undefined>] extends [never] ? false : [Exclude<V, undefined>] extends [(...args: any[]) => any] ? true : false;
47
+ type IsUndefinable<V> = IsAny<V> extends true ? false : unknown extends V ? false : undefined extends V ? true : false;
48
+ /** Keys whose value is not a function: functions are dropped by JSON and by the key-removal rule. */
49
+ type DataKeys<T> = { [K in keyof T]-?: IsFunctionValued<T[K]> extends true ? never : K }[keyof T];
50
+ /** Keys that JSON omits when their value is `undefined`, so they become optional on the json wire. */
51
+ type UndefinableKeys<T> = { [K in keyof T]-?: K extends DataKeys<T> ? (IsUndefinable<T[K]> extends true ? K : never) : never }[keyof T];
52
+ type Flatten<T> = { [K in keyof T]: T[K] };
53
+ /**
54
+ * Whether `T` has members a mapped copy cannot carry (private, protected or
55
+ * `#private`). Only such a class is detectable as a class at the type level; a
56
+ * class with public members only is structurally an interface, so it is treated
57
+ * as a plain object. Mapping `keyof T` drops the non-public members, which makes
58
+ * the copy unassignable back to `T`.
59
+ */
60
+ type HasNonPublicMembers<T> = { [K in keyof T]: T[K] } extends T ? false : true;
61
+ /** Resource registered for the model type `T`, or `never` when `T` has no entry. */
62
+ type RegisteredResource<T> = { [K in keyof ModelResourceRegistry]: ModelResourceRegistry[K] extends {
63
+ model: infer M;
64
+ resource: infer R;
65
+ } ? [T] extends [M] ? [M] extends [T] ? R : never : never : never }[keyof ModelResourceRegistry];
66
+ /** What a resource class emits from `toJSON()`, serialized for the wire. */
67
+ type SerializedResource<R, W extends SerializedWire, D extends unknown[]> = R extends (new (...args: any[]) => {
68
+ toJSON(): infer O;
69
+ }) ? Serialized<O, W, D> : unknown;
70
+ type SerializedModel<T, W extends SerializedWire, D extends unknown[]> = [RegisteredResource<T>] extends [never] ? T extends {
71
+ data: infer Data;
72
+ } ? Serialized<Data, W, [...D, 0]> : never : SerializedResource<RegisteredResource<T>, W, [...D, 0]>;
73
+ type SerializedJsonObject<T, D extends unknown[]> = Flatten<{ [K in keyof T as K extends Exclude<DataKeys<T>, UndefinableKeys<T>> ? K : never]-?: Serialized<T[K], "json", [...D, 0]> } & { [K in keyof T as K extends UndefinableKeys<T> ? K : never]+?: Serialized<Exclude<T[K], undefined>, "json", [...D, 0]> }>;
74
+ type SerializedDevalueObject<T, D extends unknown[]> = { -readonly [K in keyof T as K extends DataKeys<T> ? K : never]: Serialized<T[K], "devalue", [...D, 0]> };
75
+ type SerializedObject<T, W extends SerializedWire, D extends unknown[]> = W extends "json" ? SerializedJsonObject<T, D> : SerializedDevalueObject<T, D>;
76
+ /**
77
+ * The type of what a client receives after Warlock serializes a value of type
78
+ * `T`. It mirrors `Response.parse` (`"json"`, the default) and
79
+ * `serializeLoaderData` (`"devalue"`), branch for branch and in the same order:
80
+ *
81
+ * 1. `any` stays `any`; `unknown` stays `unknown`; primitives pass through.
82
+ * 2. `Buffer` / `Uint8Array` pass through on both wires.
83
+ * 3. devalue: `Date`, `RegExp`, `URL`, `Map`, `Set` stay native.
84
+ * json: `Map<K, V>` becomes `Record<K, V'>`.
85
+ * 4. A cascade `Model`: the output of its registered resource (see
86
+ * {@link ModelResourceRegistry}), else its serialized `data` type.
87
+ * 5. Anything with `toJSON()`: the serialized (awaited) result. This is where a
88
+ * `Date` becomes a `string` on json.
89
+ * 6. Arrays and tuples map item by item; other iterables (a `Set` on json,
90
+ * generators) become arrays.
91
+ * 7. Functions are removed from objects (and are `never` on their own).
92
+ * 8. Objects are mapped key by key. On json a key whose value can be
93
+ * `undefined` becomes optional, because `JSON.stringify` omits it.
94
+ *
95
+ * Plain object vs class instance cannot be decided by the type system in
96
+ * general. The rule used: only a class with non-public (private, protected or
97
+ * `#private`) members, or a built-in such as `Error`, is treated as a class
98
+ * instance without `toJSON`. It maps to its public data properties on json
99
+ * (`Error` to `{}`) and to `never` on devalue, where devalue throws at render
100
+ * time. Any other object type is treated as plain.
101
+ *
102
+ * Nesting is walked up to a fixed depth, then the result is `unknown`.
103
+ *
104
+ * @example
105
+ * type UserPayload = Serialized<User>; // resource output or serialized data
106
+ * type PageData = Serialized<LoaderReturn, "devalue">;
107
+ */
108
+ type Serialized<T, W extends SerializedWire = "json", D extends unknown[] = []> = IsAny<T> extends true ? any : unknown extends T ? unknown : D["length"] extends MaxSerializedDepth ? unknown : T extends Primitive ? T : T extends Binary ? T : W extends "devalue" ? T extends DevalueNative ? T : T extends PromiseLike<infer V> ? Serialized<V, W, D> : SerializedStructure<T, W, D> : T extends Map<infer K, infer V> ? Record<Extract<K, PropertyKey>, Serialized<V, W, D>> : SerializedStructure<T, W, D>;
109
+ type SerializedStructure<T, W extends SerializedWire, D extends unknown[]> = T extends Model<any> ? SerializedModel<T, W, D> : T extends {
110
+ toJSON(...args: any[]): infer R;
111
+ } ? Serialized<Awaited<R>, W, [...D, 0]> : T extends readonly unknown[] ? { -readonly [K in keyof T]: Serialized<T[K], W, D> } : T extends Iterable<infer I> ? Serialized<I, W, D>[] : T extends ((...args: any[]) => any) ? never : T extends OpaqueBuiltin ? W extends "json" ? {} : never : HasNonPublicMembers<T> extends true ? W extends "json" ? SerializedObject<T, W, D> : never : SerializedObject<T, W, D>;
112
+ //#endregion
113
+ export { ModelResourceRegistry, Serialized, SerializedWire };
114
+ //# sourceMappingURL=serialized.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialized.d.mts","names":[],"sources":["../../../../../../../core/src/http/serialized.ts"],"mappings":";;;;;AAYA;;;;AAA0B;AAoB1B;;;KApBY,cAAA;AAoB0B;AAAG;;;;AAGlB;AAAA;;;;AAEQ;AAAA;;;;AAEjB;AAAA;AAPwB,UAArB,qBAAA;;KAGZ,kBAAA;AAAA,KAEA,KAAA,oBAAyB,CAAC;AAAA,KAE1B,SAAA;;KAGA,MAAA,GAAS,MAAA,GAAS,UAAU;;KAG5B,aAAA,GAAgB,IAAA,GAAO,MAAA,GAAS,GAAA,GAAM,GAAA,aAAgB,GAAA;;;;;KAMtD,aAAA,GAAgB,KAAA,GAAQ,OAAA,aAAoB,OAAA,QAAe,OAAA;AAAA,KAE3D,gBAAA,MACH,KAAA,CAAM,CAAA,0BAED,OAAA,CAAQ,CAAA,yCAEN,OAAA,CAAQ,CAAA,2BAA4B,IAAA;AAAA,KAIxC,aAAA,MACH,KAAA,CAAM,CAAA,yCAA0C,CAAA,6BAA8B,CAAA;;KAG3E,QAAA,oBACS,CAAA,KAAM,gBAAA,CAAiB,CAAA,CAAE,CAAA,0BAA2B,CAAA,SAC1D,CAAA;AAvBsD;AAAA,KA0BzD,eAAA,oBACS,CAAA,KAAM,CAAA,SAAU,QAAA,CAAS,CAAA,KAAM,aAAA,CAAc,CAAA,CAAE,CAAA,kBAAmB,CAAA,0BACxE,CAAA;AAAA,KAEH,OAAA,oBAA2B,CAAA,GAAI,CAAA,CAAE,CAAA;;;;;;;;KASjC,mBAAA,oBAAuC,CAAA,GAAI,CAAA,CAAE,CAAA,YAAa,CAAA;;KAG1D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AA,GACA,CAAA,SAAU,MAAA,GACR,CAAA,GACA,CAAA,qBACE,CAAA,SAAU,aAAA,GACR,CAAA,GAGA,CAAA,SAAU,WAAA,YACR,UAAA,CAAW,CAAA,EAAG,CAAA,EAAG,CAAA,IACjB,mBAAA,CAAoB,CAAA,EAAG,CAAA,EAAG,CAAA,IAC9B,CAAA,SAAU,GAAA,qBACR,MAAA,CAAO,OAAA,CAAQ,CAAA,EAAG,WAAA,GAAc,UAAA,CAAW,CAAA,EAAG,CAAA,EAAG,CAAA,KACjD,mBAAA,CAAoB,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA,KAErC,mBAAA,cAAiC,cAAA,yBAAuC,CAAA,SAAU,KAAA,QACnF,eAAA,CAAgB,CAAA,EAAG,CAAA,EAAG,CAAA,IACtB,CAAA;EAAY,MAAA,IAAU,IAAA;AAAA,IACpB,UAAA,CAAW,OAAA,CAAQ,CAAA,GAAI,CAAA,MAAO,CAAA,QAC9B,CAAA,sDAC0B,CAAA,GAAI,UAAA,CAAW,CAAA,CAAE,CAAA,GAAI,CAAA,EAAG,CAAA,MAChD,CAAA,SAAU,QAAA,YACR,UAAA,CAAW,CAAA,EAAG,CAAA,EAAG,CAAA,MACjB,CAAA,cAAc,IAAA,2BAEZ,CAAA,SAAU,aAAA,GACR,CAAA,+BAGA,mBAAA,CAAoB,CAAA,iBAClB,CAAA,kBACE,gBAAA,CAAiB,CAAA,EAAG,CAAA,EAAG,CAAA,YAEzB,gBAAA,CAAiB,CAAA,EAAG,CAAA,EAAG,CAAA"}
package/esm/index.d.mts CHANGED
@@ -64,11 +64,12 @@ import { deriveTraceId, parseTraceparentTraceId } from "./http/tracing/trace-id.
64
64
  import { TracingContextSource, buildTracingContext, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, isTracingEnabled, registerTracingHooks, resetTracingConfigForTests, resolveTracingConfig } from "./http/tracing/tracing-dispatcher.mjs";
65
65
  import { RequestContextStore, requestContext, useCurrentUser, useRequest, useRequestStore } from "./http/context/request-context.mjs";
66
66
  import { requestMemo } from "./http/context/request-memo.mjs";
67
+ import { ModelResourceRegistry, Serialized, SerializedWire } from "./http/serialized.mjs";
67
68
  import { LocalizedObject, getLocalized } from "./utils/get-localized.mjs";
68
69
  import { ResourceFieldBuilder } from "./resource/resource-field-builder.mjs";
69
70
  import { Resource, ResourceConstructor, ResourceContract } from "./resource/resource.mjs";
70
- import { ResourceArraySchema, ResourceCastType, ResourceFieldBuilderDateOutputOptions, ResourceFieldConfig, ResourceOutputValueCastType, ResourceSchema, ResourceSelfReference, ResponseBodyValue, ResponseSchema } from "./resource/types.mjs";
71
- import { GroupedRoutesOptions, HttpContext, Middleware, MiddlewareResponse, NamedApiRoute, PartialPick, RequestControllerContract, RequestHandler, RequestHandlerType, RequestHandlerValidation, RequestMethod, ResourceMethod, RestfulMiddleware, Route, RouteOptions, RouteResource, RouterGroupCallback, RouterStacks } from "./router/types.mjs";
71
+ import { BaseCastOutput, CastOutput, FieldOutput, ResourceArraySchema, ResourceCastType, ResourceFieldBuilderDateOutputOptions, ResourceFieldConfig, ResourceOutput, ResourceOutputOf, ResourceOutputValueCastType, ResourceSchema, ResourceSelfReference, ResponseBodyOutput, ResponseBodyValue, ResponseSchema, ResponseSchemaOutput } from "./resource/types.mjs";
72
+ import { GroupedRoutesOptions, HttpContext, Middleware, MiddlewareResponse, NamedApiRoute, NamedApiRoutesOptions, PartialPick, RequestControllerContract, RequestHandler, RequestHandlerType, RequestHandlerValidation, RequestMethod, ResourceMethod, RestfulMiddleware, Route, RouteOptions, RouteResource, RouterGroupCallback, RouterStacks } from "./router/types.mjs";
72
73
  import { PositionalHandlerSuspect, clearPositionalHandlerSuspects, describePositionalHandlerSuspect, forgetPositionalHandlerSuspects, inspectHandlerSignature, listPositionalHandlerSuspects, looksLikePositionalHandler, reportPositionalHandlerSuspects } from "./router/positional-handler-diagnostics.mjs";
73
74
  import { matchesDerivedRouteName, routeNameMethodSuffix } from "./router/route-name-method-suffix.mjs";
74
75
  import { RouteRegistry } from "./router/route-registry.mjs";
@@ -138,6 +139,9 @@ import { renderReactMail } from "./mail/react-mail.mjs";
138
139
  import { sendMail } from "./mail/send-mail.mjs";
139
140
  import { Mail } from "./mail/mail.mjs";
140
141
  import { assertMailCount, assertMailSent, captureMail, clearTestMailbox, findMailsBySubject, findMailsTo, getLastMail, getMailboxSize, getTestMailbox, wasMailSentTo, wasMailSentWithSubject } from "./mail/test-mailbox.mjs";
142
+ import { AuthDescriptor, OpenApiBuildResult, OpenApiComponents, OpenApiContext, OpenApiDocument, OpenApiOperation, OpenApiParameter, OpenApiRequestBody, OpenApiResponse, OpenApiRouteInput, OpenApiSchema, OpenApiSecurityRequirement, OpenApiSecurityScheme, OpenApiValidationResponseConfig, WarningSink } from "./openapi/types.mjs";
143
+ import { getDevelopmentOpenApiDocument, registerDevelopmentOpenApiProvider } from "./openapi/development-openapi-provider.mjs";
144
+ import { OPENAPI_JSON_SCHEMA_DIALECT, buildOpenApiDocument } from "./openapi/build-openapi-document.mjs";
141
145
  import { renderReact } from "./react/index.mjs";
142
146
  import { RepositoryManager } from "./repositories/repository.manager.mjs";
143
147
  import { RepositoryAdapterContract } from "./repositories/contracts/repository-adapter.contract.mjs";
@@ -182,9 +186,10 @@ import { WarlockConfigManager, isUnknownTsExtensionError, warlockConfigManager }
182
186
  import { env } from "@mongez/dotenv";
183
187
  import { colors } from "@mongez/copper";
184
188
  export * from "@mongez/localization";
185
- export { $registerUseCase, $unregisterUseCase, APP_ROLES, AccessConnector, AggregateExpressionInput, AggregateExpressions, AiConnector, AllRepositoryOptions, AppConfigurations, AppRole, Application, BOOT_SIGNAL_ENV_KEY, BOOT_SIGNAL_VERSION, BadRequestError, BadSchemaUseCaseError, BaseConnector, type BenchmarkChannel, type BenchmarkConfigurations, type BenchmarkErrorResult, type BenchmarkOptions, BenchmarkProfiler, type BenchmarkProfilerOptions, type BenchmarkResult, BenchmarkSnapshots, type BenchmarkSnapshotsOptions, type BenchmarkStats, type BenchmarkSuccessResult, BootContext, BootListener, BootSignal, BootSignalType, BootValidator, CLICommand, type CLICommandAction, type CLICommandOption, type CLICommandOptions, type CLICommandPreload, type CLICommandSource, CacheConnector, type CacheMiddlewareOptions, CachedRepositoryOptions, type CapturedMail, CascadeAdapter, CascadeQueryBuilder, ChunkCallback, ClosableServer, CloudDriver, CloudStorageDriverContract, CloudStorageDriverOptions, CloudStorageFileData, type CommandActionData, type ConcurrencyLimitOptions, ConfigKey, ConfigKeyRegistry, ConfigName, ConfigRegistry, ConfigSpecialHandlers, ConflictError, Connector, ConnectorBuildContext, ConnectorBuildContribution, ConnectorBuildGenerateResult, ConnectorEsbuildPatch, ConnectorLifecyclePhase, ConnectorName, ConnectorPriority, ConnectorsManager, ConsoleChannel, ContainerTypes, CookieJarUnavailableError, CookieOptions, CspConfig, CsrfOriginCheckReason, CsrfOriginVerdict, CursorPaginationOptions, CursorPaginationResult, DEFAULT_CSP_DIRECTIVES, DOSpacesDriver, DatabaseCacheDriver, type DatabaseCacheOptions, DatabaseConnector, DatabaseLog, DatabaseLogModel, DatabaseLogOptions, DecodedAccessToken, DefineResourceOptions, DeleteManyResult, DetectedImageFormat, type DevelopmentModelModuleEntry, type DevelopmentModelModuleState, type DevelopmentModelModules, EncryptionConfigurations, EncryptionPasswordConfigurations, Environment, EventSubscription, ExistsExceptCurrentIdRuleOptions, ExistsExceptCurrentUserRuleOptions, FastifyInstance, FileNamingStrategy, FileValidationOptions, FileValidator, FileVisibility, FilterFunction, FilterOperator, FilterOptions, FilterRule, FilterRules, ForbiddenError, GenerateImageVariantsOptions, GeneratedImageDescriptor, GeneratedImageVariant, GroupByFields, GroupedRoutesOptions, HealthCheck, HealthStatus, HeraldConnector, HttpConfigurations, HttpConnector, HttpContext, HttpError, HttpErrorCodes, HttpReadyReport, HttpServerRebuiltListener, HttpTracingConfig, type IdempotencyOptions, Image, ImageFormat, ImageInput, ImageTransformCallback, ImageTransformConfig, ImageTransformOptions, ImageVariantDefinition, ImageVariantFit, ImageVariantOutputFormat, ImageVariantsConfigError, InvalidCspDirectiveError, type IpFilterOptions, ListOptions, LocalDriver, LocalStorageDriverOptions, LocaleDictionaryEntries, LocaleDictionaryError, LocalizedObject, LogConfigurations, LoggerConnector, MAIL_EVENTS, Mail, type MailAddress, type MailAttachment, type MailConfigurations, MailError, type MailErrorCode, type MailEvents, type MailMode, type MailOptions, type MailPriority, type MailResult, MailerConnector, type MailersConfig, type MaintenanceOptions, Middleware, MiddlewareResponse, MimeTypes, NamedApiRoute, NoopChannel, type NormalizedMail, NotAcceptableError, NotAllowedError, NotificationsConnector, PaginationMode, PaginationResult, ParsedLocaleDictionary, PartialMiddleware, PartialPick, Path, PipeableReactStream, PipelineOptions, PortInUseError, PositionalHandlerSuspect, PrefixConfig, PrefixOptions, PresignedOptions, PresignedUploadOptions, PutDirectoryOptions, PutDirectoryResult, PutFromUrlOptions, PutOptions, QueryBuilderContract, Queue, R2Driver, R2StorageDriverOptions, type RateLimitOptions, RegisterConfiguredConnectorsOptions, RegisterResource, RegisteredUseCase, RepositoryAdapterContract, RepositoryConfigurations, RepositoryEvent, RepositoryManager, RepositoryOptions, RepositoryOptionsWithCursor, RepositoryOptionsWithPages, Request, RequestContextStore, RequestController, RequestControllerContract, RequestEvent, RequestHandler, RequestHandlerType, RequestHandlerValidation, RequestLocals, RequestLog, RequestMethod, RequestTranslator, type ResolvedCLICommandOption, ResolvedImageVariantsConfig, Resource, ResourceArraySchema, ResourceCastType, ResourceConstructor, ResourceContract, ResourceFieldBuilder, ResourceFieldBuilderDateOutputOptions, ResourceFieldConfig, ResourceMethod, ResourceNotFoundError, ResourceOutputValueCastType, ResourceSchema, ResourceSelfReference, Response, ResponseBodyValue, ResponseEvent, ResponseSSEController, ResponseSchema, ResponseStatus, ResponseStreamController, Restful, RestfulMiddleware, ReturnedResponse, Route, RouteOptions, RouteRegistry, RouteResource, Router, RouterGroupCallback, RouterStacks, RuntimeStrategy, S3Driver, type SESConfigurations, type SMTPConfigurations, SafeFetchOptions, SafeFetchResult, SaveAsOptions, SaveMode, SaveOptions, ScopedStorage, ScopedStorageContract, SeedClock, SeedContext, SeedRecordRef, SeedResult, Seeder, SeederDependencyCycleError, SeederMetadata, SendBufferOptions, SendFileOptions, ServerError, ShutdownListener, SocketAdapterFactory, SocketConnector, SocketOptions, Storage, StorageCapabilityError, StorageConfigurations, StorageConnector, StorageCopyEventPayload, StorageDriverConfig, StorageDriverContextStore, StorageDriverContract, StorageDriverName, StorageDriverRegistry, StorageDriverType, StorageError, StorageErrorOptions, StorageEventHandler, StorageEventPayload, StorageEventType, StorageFile, StorageFileData, StorageFileInfo, StorageManagerContract, StorageNotInitializedError, StoragePutEventPayload, StreamReactResponseOptions, TemporaryTokenError, TemporaryTokenPayload, TemporaryTokenValidation, TracingContext, TracingContextSource, TracingHooks, TracingPhaseInfo, TracingRequestEndInfo, Track, TrackableModel, TypedAllRepositoryOptions, TypedRepositoryOptions, TypedRepositoryOptionsWithCursor, TypedRepositoryOptionsWithPages, UPDATE_MANY_BATCH_SIZE, UPLOADS_DEFAULTS, UnAuthorizedError, UniqueExceptCurrentIdRuleOptions, UniqueExceptCurrentUserRuleOptions, UnknownSeederDependencyError, UploadedFile, UploadedFileImageOptions, UploadedFileJson, UploadedFileQuery, UploadsConfigurations, UploadsImagesConfigurations, UseCase, UseCaseAfterMiddleware, UseCaseBeforeMiddleware, UseCaseBroadcastChannel, UseCaseBroadcastEvent, UseCaseBroadcastOption, UseCaseConfigurations, UseCaseContext, UseCaseErrorResult, UseCaseEventsCallbacksMap, UseCaseGuard, UseCaseHandler, UseCaseOnExecutingContext, UseCaseResult, UseCaseRuntimeOptions, UseCaseWithSchema, ValidationConfiguration, VariantOutputFormat, VariantSourceFormat, WarlockConfig, WarlockConfigManager, WatermarkConfig, WhereOperator, XMLable, addUseCaseHistory, anyMatch, app, appLog, appPath, applyCspHeader, assertConfiguredHttpPortIsFree, assertMailCount, assertMailSent, assertNoReservedConnectorNames, assertPortIsAvailable, assertSitesRequireWebRole, assertUniqueConnectorNames, assetsUrl, bootstrap, broadcastUseCaseResult, buildCspHeaderValue, buildIdempotencyCacheKey, buildTracingContext, cachePath, captureMail, clearPositionalHandlerSuspects, clearTestMailbox, closeAllMailers, closeMailer, closeServerWithTimeout, colors, command, config, configPath, configSpecialHandlers, connectorsManager, container, createHttpApplication, createRequestStore, decrypt, defaultHttpConfigurations, defineConfig, defineResource, deriveTraceId, describePositionalHandlerSuspect, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, displayEnvironmentMode, encrypt, ensureFatalIsVisible, env, environment, existsExceptCurrentIdRule, existsExceptCurrentUserRule, fetchLatestVersion, fileExtensionRule, fileRule, fileTypeRule, findMailsBySubject, findMailsTo, fireLifecycleEvent, forgetPositionalHandlerSuspects, generateImageVariants, generateMailId, getDefaultMailConfig, getHttpReadyReport, getHttpServer, getLastMail, getLocalized, getMailEventName, getMailMode, getMailboxSize, getMailer, getMailerConfig, getMimeType, getPoolStats, getPublicUrl, getRoles, getSites, getSocketServer, getTestMailbox, getUseCase, getUseCaseHistory, getUseCases, globalEventsCallbacksMap, globalUseCasesEvents, hasRole, hashBody, hashPassword, health, hmacHash, httpConfig, imageRule, increaseUseCaseFailedCalls, increaseUseCaseSuccessCalls, inspectHandlerSignature, ipMatches, isAllowedCsrfOrigin, isBootSignal, isDevelopmentMode, isNewerVersion, isPortAvailable, isPrivateOrReservedIp, isProductionMode, isTestMode, isTracingEnabled, isUnknownTsExtensionError, isValidIdempotencyKey, listPositionalHandlerSuspects, loadS3, logResponse, logsPath, looksLikePositionalHandler, mailEvents, matchesDerivedRouteName, measure, mergeCspDirectives, middleware, normalizeOrigin, normalizeRequestPath, normalizeRoutePath, notifyHttpServerRebuilt, onHttpServerRebuilt, originOf, ownOrigin, parseLocaleDictionary, parseRoles, parseSites, parseSize, parseTraceparentTraceId, paths, preflightConfiguredHttpPort, promiseAllObject, publicPath, publicUrl, registerAppConfig, registerConfiguredConnectors, registerGroupedTranslationKeys, registerHttpPlugins, registerLocaleDictionary, registerTracingHooks, remedyLines, renderReact, renderReactMail, reportPositionalHandlerSuspects, requestContext, requestMemo, requiresDefaultCsrfGuard, resetHttpReadyReport, resetMailConfig, resetRolesCacheForTests, resetTracingConfigForTests, resolveCspConfig, resolveCsrfOriginVerdict, resolveMailConfig, resolveTracingConfig, resolveWithinRoot, rootPath, routeNameMethodSuffix, router, runDefaultCsrfGuard, runPipeline, safeFetchToBuffer, sanitizePath, seeder, sendBootSignal, sendMail, serializeCspDirectives, servesHttp, setBaseUrl, setConfig, setEnvironment, setHttpReadyReport, setLogConfigurations, setMailConfigurations, setMailMode, shouldPreflightHttpPort, sleep, sluggable, srcPath, startHttpServer, stopHttpApplication, storage, storageConfig, storageConfigurations, storageDriverContext, storagePath, streamReactResponse, t, tempPath, toJson, uniqueExceptCurrentIdRule, uniqueExceptCurrentUserRule, unregisterLocaleDictionary, uploadedFileController, uploadedFileMetadataSchema, uploadsConfig, uploadsPath, uploadsUrl, url, useCase, useComputedModel, useComputedSlug, useCurrentUser, useHashedPassword, useRequest, useRequestStore, validateCspConfigAtBoot, validateCspDirectives, verifyMailer, verifyPassword, warlockConfigManager, warlockPath, wasMailSentTo, wasMailSentWithSubject, wrapResponseInDataKey };
189
+ export { $registerUseCase, $unregisterUseCase, APP_ROLES, AccessConnector, AggregateExpressionInput, AggregateExpressions, AiConnector, AllRepositoryOptions, AppConfigurations, AppRole, Application, AuthDescriptor, BOOT_SIGNAL_ENV_KEY, BOOT_SIGNAL_VERSION, BadRequestError, BadSchemaUseCaseError, BaseCastOutput, BaseConnector, type BenchmarkChannel, type BenchmarkConfigurations, type BenchmarkErrorResult, type BenchmarkOptions, BenchmarkProfiler, type BenchmarkProfilerOptions, type BenchmarkResult, BenchmarkSnapshots, type BenchmarkSnapshotsOptions, type BenchmarkStats, type BenchmarkSuccessResult, BootContext, BootListener, BootSignal, BootSignalType, BootValidator, CLICommand, type CLICommandAction, type CLICommandOption, type CLICommandOptions, type CLICommandPreload, type CLICommandSource, CacheConnector, type CacheMiddlewareOptions, CachedRepositoryOptions, type CapturedMail, CascadeAdapter, CascadeQueryBuilder, CastOutput, ChunkCallback, ClosableServer, CloudDriver, CloudStorageDriverContract, CloudStorageDriverOptions, CloudStorageFileData, type CommandActionData, type ConcurrencyLimitOptions, ConfigKey, ConfigKeyRegistry, ConfigName, ConfigRegistry, ConfigSpecialHandlers, ConflictError, Connector, ConnectorBuildContext, ConnectorBuildContribution, ConnectorBuildGenerateResult, ConnectorEsbuildPatch, ConnectorLifecyclePhase, ConnectorName, ConnectorPriority, ConnectorsManager, ConsoleChannel, ContainerTypes, CookieJarUnavailableError, CookieOptions, CspConfig, CsrfOriginCheckReason, CsrfOriginVerdict, CursorPaginationOptions, CursorPaginationResult, DEFAULT_CSP_DIRECTIVES, DOSpacesDriver, DatabaseCacheDriver, type DatabaseCacheOptions, DatabaseConnector, DatabaseLog, DatabaseLogModel, DatabaseLogOptions, DecodedAccessToken, DefineResourceOptions, DeleteManyResult, DetectedImageFormat, type DevelopmentModelModuleEntry, type DevelopmentModelModuleState, type DevelopmentModelModules, EncryptionConfigurations, EncryptionPasswordConfigurations, Environment, EventSubscription, ExistsExceptCurrentIdRuleOptions, ExistsExceptCurrentUserRuleOptions, FastifyInstance, FieldOutput, FileNamingStrategy, FileValidationOptions, FileValidator, FileVisibility, FilterFunction, FilterOperator, FilterOptions, FilterRule, FilterRules, ForbiddenError, GenerateImageVariantsOptions, GeneratedImageDescriptor, GeneratedImageVariant, GroupByFields, GroupedRoutesOptions, HealthCheck, HealthStatus, HeraldConnector, HttpConfigurations, HttpConnector, HttpContext, HttpError, HttpErrorCodes, HttpReadyReport, HttpServerRebuiltListener, HttpTracingConfig, type IdempotencyOptions, Image, ImageFormat, ImageInput, ImageTransformCallback, ImageTransformConfig, ImageTransformOptions, ImageVariantDefinition, ImageVariantFit, ImageVariantOutputFormat, ImageVariantsConfigError, InvalidCspDirectiveError, type IpFilterOptions, ListOptions, LocalDriver, LocalStorageDriverOptions, LocaleDictionaryEntries, LocaleDictionaryError, LocalizedObject, LogConfigurations, LoggerConnector, MAIL_EVENTS, Mail, type MailAddress, type MailAttachment, type MailConfigurations, MailError, type MailErrorCode, type MailEvents, type MailMode, type MailOptions, type MailPriority, type MailResult, MailerConnector, type MailersConfig, type MaintenanceOptions, Middleware, MiddlewareResponse, MimeTypes, ModelResourceRegistry, NamedApiRoute, NamedApiRoutesOptions, NoopChannel, type NormalizedMail, NotAcceptableError, NotAllowedError, NotificationsConnector, OPENAPI_JSON_SCHEMA_DIALECT, OpenApiBuildResult, OpenApiComponents, OpenApiContext, OpenApiDocument, OpenApiOperation, OpenApiParameter, OpenApiRequestBody, OpenApiResponse, OpenApiRouteInput, OpenApiSchema, OpenApiSecurityRequirement, OpenApiSecurityScheme, OpenApiValidationResponseConfig, PaginationMode, PaginationResult, ParsedLocaleDictionary, PartialMiddleware, PartialPick, Path, PipeableReactStream, PipelineOptions, PortInUseError, PositionalHandlerSuspect, PrefixConfig, PrefixOptions, PresignedOptions, PresignedUploadOptions, PutDirectoryOptions, PutDirectoryResult, PutFromUrlOptions, PutOptions, QueryBuilderContract, Queue, R2Driver, R2StorageDriverOptions, type RateLimitOptions, RegisterConfiguredConnectorsOptions, RegisterResource, RegisteredUseCase, RepositoryAdapterContract, RepositoryConfigurations, RepositoryEvent, RepositoryManager, RepositoryOptions, RepositoryOptionsWithCursor, RepositoryOptionsWithPages, Request, RequestContextStore, RequestController, RequestControllerContract, RequestEvent, RequestHandler, RequestHandlerType, RequestHandlerValidation, RequestLocals, RequestLog, RequestMethod, RequestTranslator, type ResolvedCLICommandOption, ResolvedImageVariantsConfig, Resource, ResourceArraySchema, ResourceCastType, ResourceConstructor, ResourceContract, ResourceFieldBuilder, ResourceFieldBuilderDateOutputOptions, ResourceFieldConfig, ResourceMethod, ResourceNotFoundError, ResourceOutput, ResourceOutputOf, ResourceOutputValueCastType, ResourceSchema, ResourceSelfReference, Response, ResponseBodyOutput, ResponseBodyValue, ResponseEvent, ResponseSSEController, ResponseSchema, ResponseSchemaOutput, ResponseStatus, ResponseStreamController, Restful, RestfulMiddleware, ReturnedResponse, Route, RouteOptions, RouteRegistry, RouteResource, Router, RouterGroupCallback, RouterStacks, RuntimeStrategy, S3Driver, type SESConfigurations, type SMTPConfigurations, SafeFetchOptions, SafeFetchResult, SaveAsOptions, SaveMode, SaveOptions, ScopedStorage, ScopedStorageContract, SeedClock, SeedContext, SeedRecordRef, SeedResult, Seeder, SeederDependencyCycleError, SeederMetadata, SendBufferOptions, SendFileOptions, Serialized, SerializedWire, ServerError, ShutdownListener, SocketAdapterFactory, SocketConnector, SocketOptions, Storage, StorageCapabilityError, StorageConfigurations, StorageConnector, StorageCopyEventPayload, StorageDriverConfig, StorageDriverContextStore, StorageDriverContract, StorageDriverName, StorageDriverRegistry, StorageDriverType, StorageError, StorageErrorOptions, StorageEventHandler, StorageEventPayload, StorageEventType, StorageFile, StorageFileData, StorageFileInfo, StorageManagerContract, StorageNotInitializedError, StoragePutEventPayload, StreamReactResponseOptions, TemporaryTokenError, TemporaryTokenPayload, TemporaryTokenValidation, TracingContext, TracingContextSource, TracingHooks, TracingPhaseInfo, TracingRequestEndInfo, Track, TrackableModel, TypedAllRepositoryOptions, TypedRepositoryOptions, TypedRepositoryOptionsWithCursor, TypedRepositoryOptionsWithPages, UPDATE_MANY_BATCH_SIZE, UPLOADS_DEFAULTS, UnAuthorizedError, UniqueExceptCurrentIdRuleOptions, UniqueExceptCurrentUserRuleOptions, UnknownSeederDependencyError, UploadedFile, UploadedFileImageOptions, UploadedFileJson, UploadedFileQuery, UploadsConfigurations, UploadsImagesConfigurations, UseCase, UseCaseAfterMiddleware, UseCaseBeforeMiddleware, UseCaseBroadcastChannel, UseCaseBroadcastEvent, UseCaseBroadcastOption, UseCaseConfigurations, UseCaseContext, UseCaseErrorResult, UseCaseEventsCallbacksMap, UseCaseGuard, UseCaseHandler, UseCaseOnExecutingContext, UseCaseResult, UseCaseRuntimeOptions, UseCaseWithSchema, ValidationConfiguration, VariantOutputFormat, VariantSourceFormat, WarlockConfig, WarlockConfigManager, WarningSink, WatermarkConfig, WhereOperator, XMLable, addUseCaseHistory, anyMatch, app, appLog, appPath, applyCspHeader, assertConfiguredHttpPortIsFree, assertMailCount, assertMailSent, assertNoReservedConnectorNames, assertPortIsAvailable, assertSitesRequireWebRole, assertUniqueConnectorNames, assetsUrl, bootstrap, broadcastUseCaseResult, buildCspHeaderValue, buildIdempotencyCacheKey, buildOpenApiDocument, buildTracingContext, cachePath, captureMail, clearPositionalHandlerSuspects, clearTestMailbox, closeAllMailers, closeMailer, closeServerWithTimeout, colors, command, config, configPath, configSpecialHandlers, connectorsManager, container, createHttpApplication, createRequestStore, decrypt, defaultHttpConfigurations, defineConfig, defineResource, deriveTraceId, describePositionalHandlerSuspect, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, displayEnvironmentMode, encrypt, ensureFatalIsVisible, env, environment, existsExceptCurrentIdRule, existsExceptCurrentUserRule, fetchLatestVersion, fileExtensionRule, fileRule, fileTypeRule, findMailsBySubject, findMailsTo, fireLifecycleEvent, forgetPositionalHandlerSuspects, generateImageVariants, generateMailId, getDefaultMailConfig, getDevelopmentOpenApiDocument, getHttpReadyReport, getHttpServer, getLastMail, getLocalized, getMailEventName, getMailMode, getMailboxSize, getMailer, getMailerConfig, getMimeType, getPoolStats, getPublicUrl, getRoles, getSites, getSocketServer, getTestMailbox, getUseCase, getUseCaseHistory, getUseCases, globalEventsCallbacksMap, globalUseCasesEvents, hasRole, hashBody, hashPassword, health, hmacHash, httpConfig, imageRule, increaseUseCaseFailedCalls, increaseUseCaseSuccessCalls, inspectHandlerSignature, ipMatches, isAllowedCsrfOrigin, isBootSignal, isDevelopmentMode, isNewerVersion, isPortAvailable, isPrivateOrReservedIp, isProductionMode, isTestMode, isTracingEnabled, isUnknownTsExtensionError, isValidIdempotencyKey, listPositionalHandlerSuspects, loadS3, logResponse, logsPath, looksLikePositionalHandler, mailEvents, matchesDerivedRouteName, measure, mergeCspDirectives, middleware, normalizeOrigin, normalizeRequestPath, normalizeRoutePath, notifyHttpServerRebuilt, onHttpServerRebuilt, originOf, ownOrigin, parseLocaleDictionary, parseRoles, parseSites, parseSize, parseTraceparentTraceId, paths, preflightConfiguredHttpPort, promiseAllObject, publicPath, publicUrl, registerAppConfig, registerConfiguredConnectors, registerDevelopmentOpenApiProvider, registerGroupedTranslationKeys, registerHttpPlugins, registerLocaleDictionary, registerTracingHooks, remedyLines, renderReact, renderReactMail, reportPositionalHandlerSuspects, requestContext, requestMemo, requiresDefaultCsrfGuard, resetHttpReadyReport, resetMailConfig, resetRolesCacheForTests, resetTracingConfigForTests, resolveCspConfig, resolveCsrfOriginVerdict, resolveMailConfig, resolveTracingConfig, resolveWithinRoot, rootPath, routeNameMethodSuffix, router, runDefaultCsrfGuard, runPipeline, safeFetchToBuffer, sanitizePath, seeder, sendBootSignal, sendMail, serializeCspDirectives, servesHttp, setBaseUrl, setConfig, setEnvironment, setHttpReadyReport, setLogConfigurations, setMailConfigurations, setMailMode, shouldPreflightHttpPort, sleep, sluggable, srcPath, startHttpServer, stopHttpApplication, storage, storageConfig, storageConfigurations, storageDriverContext, storagePath, streamReactResponse, t, tempPath, toJson, uniqueExceptCurrentIdRule, uniqueExceptCurrentUserRule, unregisterLocaleDictionary, uploadedFileController, uploadedFileMetadataSchema, uploadsConfig, uploadsPath, uploadsUrl, url, useCase, useComputedModel, useComputedSlug, useCurrentUser, useHashedPassword, useRequest, useRequestStore, validateCspConfigAtBoot, validateCspDirectives, verifyMailer, verifyPassword, warlockConfigManager, warlockPath, wasMailSentTo, wasMailSentWithSubject, wrapResponseInDataKey };
186
190
  import "./config/types.mjs";
187
191
  import "./http/request.mjs";
192
+ import "./http/serialized.mjs";
188
193
  import "./http/types.mjs";
189
194
  import "./storage/types.mjs";
190
195
  import "./validation/types.mjs";
package/esm/index.mjs CHANGED
@@ -150,6 +150,9 @@ import "./encryption/index.mjs";
150
150
  import { LocaleDictionaryError, parseLocaleDictionary } from "./localization/parse-locale-dictionary.mjs";
151
151
  import { registerGroupedTranslationKeys, registerLocaleDictionary, unregisterLocaleDictionary } from "./localization/register-locale-dictionary.mjs";
152
152
  import "./localization/index.mjs";
153
+ import { getDevelopmentOpenApiDocument, registerDevelopmentOpenApiProvider } from "./openapi/development-openapi-provider.mjs";
154
+ import { OPENAPI_JSON_SCHEMA_DIALECT, buildOpenApiDocument } from "./openapi/build-openapi-document.mjs";
155
+ import "./openapi/index.mjs";
153
156
  import { CascadeQueryBuilder } from "./repositories/adapters/cascade/cascade-query-builder.mjs";
154
157
  import { CascadeAdapter, UPDATE_MANY_BATCH_SIZE } from "./repositories/adapters/cascade/cascade-adapter.mjs";
155
158
  import { RepositoryManager } from "./repositories/repository.manager.mjs";
@@ -178,4 +181,4 @@ import { colors } from "@mongez/copper";
178
181
 
179
182
  export * from "@mongez/localization"
180
183
 
181
- export { $registerUseCase, $unregisterUseCase, APP_ROLES, AccessConnector, AiConnector, Application, BOOT_SIGNAL_ENV_KEY, BOOT_SIGNAL_VERSION, BadRequestError, BadSchemaUseCaseError, BaseConnector, BenchmarkProfiler, BenchmarkSnapshots, CLICommand, CacheConnector, CascadeAdapter, CascadeQueryBuilder, CloudDriver, ConfigSpecialHandlers, ConflictError, ConnectorLifecyclePhase, ConnectorPriority, ConnectorsManager, ConsoleChannel, CookieJarUnavailableError, DEFAULT_CSP_DIRECTIVES, DOSpacesDriver, DatabaseCacheDriver, DatabaseConnector, DatabaseLog, DatabaseLogModel, FileValidator, ForbiddenError, HeraldConnector, HttpConnector, HttpError, HttpErrorCodes, Image, ImageVariantsConfigError, InvalidCspDirectiveError, LocalDriver, LocaleDictionaryError, LoggerConnector, MAIL_EVENTS, Mail, MailError, MailerConnector, MimeTypes, NoopChannel, NotAcceptableError, NotAllowedError, NotificationsConnector, Path, PortInUseError, Queue, R2Driver, RegisterResource, RepositoryManager, Request, RequestController, RequestLog, Resource, ResourceFieldBuilder, ResourceNotFoundError, Response, ResponseStatus, Restful, RouteRegistry, Router, S3Driver, ScopedStorage, SeederDependencyCycleError, ServerError, SocketConnector, Storage, StorageCapabilityError, StorageConnector, StorageError, StorageFile, StorageNotInitializedError, UPDATE_MANY_BATCH_SIZE, UPLOADS_DEFAULTS, UnAuthorizedError, UnknownSeederDependencyError, UploadedFile, WarlockConfigManager, addUseCaseHistory, anyMatch, app, appLog, appPath, applyCspHeader, assertConfiguredHttpPortIsFree, assertMailCount, assertMailSent, assertNoReservedConnectorNames, assertPortIsAvailable, assertSitesRequireWebRole, assertUniqueConnectorNames, assetsUrl, bootstrap, broadcastUseCaseResult, buildCspHeaderValue, buildIdempotencyCacheKey, buildTracingContext, cachePath, captureMail, clearPositionalHandlerSuspects, clearTestMailbox, closeAllMailers, closeMailer, closeServerWithTimeout, colors, command, config, configPath, configSpecialHandlers, connectorsManager, container, createHttpApplication, createRequestStore, decrypt, defaultHttpConfigurations, defineConfig, defineResource, deriveTraceId, describePositionalHandlerSuspect, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, displayEnvironmentMode, encrypt, ensureFatalIsVisible, env, environment, existsExceptCurrentIdRule, existsExceptCurrentUserRule, fetchLatestVersion, fileExtensionRule, fileRule, fileTypeRule, findMailsBySubject, findMailsTo, fireLifecycleEvent, forgetPositionalHandlerSuspects, generateImageVariants, generateMailId, getDefaultMailConfig, getHttpReadyReport, getHttpServer, getLastMail, getLocalized, getMailEventName, getMailMode, getMailboxSize, getMailer, getMailerConfig, getMimeType, getPoolStats, getPublicUrl, getRoles, getSites, getSocketServer, getTestMailbox, getUseCase, getUseCaseHistory, getUseCases, globalEventsCallbacksMap, globalUseCasesEvents, hasRole, hashBody, hashPassword, health, hmacHash, httpConfig, imageRule, increaseUseCaseFailedCalls, increaseUseCaseSuccessCalls, inspectHandlerSignature, ipMatches, isAllowedCsrfOrigin, isBootSignal, isDevelopmentMode, isNewerVersion, isPortAvailable, isPrivateOrReservedIp, isProductionMode, isTestMode, isTracingEnabled, isUnknownTsExtensionError, isValidIdempotencyKey, listPositionalHandlerSuspects, loadS3, logResponse, logsPath, looksLikePositionalHandler, mailEvents, matchesDerivedRouteName, measure, mergeCspDirectives, middleware, normalizeOrigin, normalizeRequestPath, normalizeRoutePath, notifyHttpServerRebuilt, onHttpServerRebuilt, originOf, ownOrigin, parseLocaleDictionary, parseRoles, parseSites, parseSize, parseTraceparentTraceId, paths, preflightConfiguredHttpPort, promiseAllObject, publicPath, publicUrl, registerAppConfig, registerConfiguredConnectors, registerGroupedTranslationKeys, registerHttpPlugins, registerLocaleDictionary, registerTracingHooks, remedyLines, renderReact, renderReactMail, reportPositionalHandlerSuspects, requestContext, requestMemo, requiresDefaultCsrfGuard, resetHttpReadyReport, resetMailConfig, resetRolesCacheForTests, resetTracingConfigForTests, resolveCspConfig, resolveCsrfOriginVerdict, resolveMailConfig, resolveTracingConfig, resolveWithinRoot, rootPath, routeNameMethodSuffix, router, runDefaultCsrfGuard, runPipeline, safeFetchToBuffer, sanitizePath, seeder, sendBootSignal, sendMail, serializeCspDirectives, servesHttp, setBaseUrl, setConfig, setEnvironment, setHttpReadyReport, setLogConfigurations, setMailConfigurations, setMailMode, shouldPreflightHttpPort, sleep, sluggable, srcPath, startHttpServer, stopHttpApplication, storage, storageConfig, storageConfigurations, storageDriverContext, storagePath, streamReactResponse, t, tempPath, toJson, uniqueExceptCurrentIdRule, uniqueExceptCurrentUserRule, unregisterLocaleDictionary, uploadedFileController, uploadedFileMetadataSchema, uploadsConfig, uploadsPath, uploadsUrl, url, useCase, useComputedModel, useComputedSlug, useCurrentUser, useHashedPassword, useRequest, useRequestStore, validateCspConfigAtBoot, validateCspDirectives, verifyMailer, verifyPassword, warlockConfigManager, warlockPath, wasMailSentTo, wasMailSentWithSubject, wrapResponseInDataKey };
184
+ export { $registerUseCase, $unregisterUseCase, APP_ROLES, AccessConnector, AiConnector, Application, BOOT_SIGNAL_ENV_KEY, BOOT_SIGNAL_VERSION, BadRequestError, BadSchemaUseCaseError, BaseConnector, BenchmarkProfiler, BenchmarkSnapshots, CLICommand, CacheConnector, CascadeAdapter, CascadeQueryBuilder, CloudDriver, ConfigSpecialHandlers, ConflictError, ConnectorLifecyclePhase, ConnectorPriority, ConnectorsManager, ConsoleChannel, CookieJarUnavailableError, DEFAULT_CSP_DIRECTIVES, DOSpacesDriver, DatabaseCacheDriver, DatabaseConnector, DatabaseLog, DatabaseLogModel, FileValidator, ForbiddenError, HeraldConnector, HttpConnector, HttpError, HttpErrorCodes, Image, ImageVariantsConfigError, InvalidCspDirectiveError, LocalDriver, LocaleDictionaryError, LoggerConnector, MAIL_EVENTS, Mail, MailError, MailerConnector, MimeTypes, NoopChannel, NotAcceptableError, NotAllowedError, NotificationsConnector, OPENAPI_JSON_SCHEMA_DIALECT, Path, PortInUseError, Queue, R2Driver, RegisterResource, RepositoryManager, Request, RequestController, RequestLog, Resource, ResourceFieldBuilder, ResourceNotFoundError, Response, ResponseStatus, Restful, RouteRegistry, Router, S3Driver, ScopedStorage, SeederDependencyCycleError, ServerError, SocketConnector, Storage, StorageCapabilityError, StorageConnector, StorageError, StorageFile, StorageNotInitializedError, UPDATE_MANY_BATCH_SIZE, UPLOADS_DEFAULTS, UnAuthorizedError, UnknownSeederDependencyError, UploadedFile, WarlockConfigManager, addUseCaseHistory, anyMatch, app, appLog, appPath, applyCspHeader, assertConfiguredHttpPortIsFree, assertMailCount, assertMailSent, assertNoReservedConnectorNames, assertPortIsAvailable, assertSitesRequireWebRole, assertUniqueConnectorNames, assetsUrl, bootstrap, broadcastUseCaseResult, buildCspHeaderValue, buildIdempotencyCacheKey, buildOpenApiDocument, buildTracingContext, cachePath, captureMail, clearPositionalHandlerSuspects, clearTestMailbox, closeAllMailers, closeMailer, closeServerWithTimeout, colors, command, config, configPath, configSpecialHandlers, connectorsManager, container, createHttpApplication, createRequestStore, decrypt, defaultHttpConfigurations, defineConfig, defineResource, deriveTraceId, describePositionalHandlerSuspect, dispatchPhase, dispatchRequestEnd, dispatchRequestStart, displayEnvironmentMode, encrypt, ensureFatalIsVisible, env, environment, existsExceptCurrentIdRule, existsExceptCurrentUserRule, fetchLatestVersion, fileExtensionRule, fileRule, fileTypeRule, findMailsBySubject, findMailsTo, fireLifecycleEvent, forgetPositionalHandlerSuspects, generateImageVariants, generateMailId, getDefaultMailConfig, getDevelopmentOpenApiDocument, getHttpReadyReport, getHttpServer, getLastMail, getLocalized, getMailEventName, getMailMode, getMailboxSize, getMailer, getMailerConfig, getMimeType, getPoolStats, getPublicUrl, getRoles, getSites, getSocketServer, getTestMailbox, getUseCase, getUseCaseHistory, getUseCases, globalEventsCallbacksMap, globalUseCasesEvents, hasRole, hashBody, hashPassword, health, hmacHash, httpConfig, imageRule, increaseUseCaseFailedCalls, increaseUseCaseSuccessCalls, inspectHandlerSignature, ipMatches, isAllowedCsrfOrigin, isBootSignal, isDevelopmentMode, isNewerVersion, isPortAvailable, isPrivateOrReservedIp, isProductionMode, isTestMode, isTracingEnabled, isUnknownTsExtensionError, isValidIdempotencyKey, listPositionalHandlerSuspects, loadS3, logResponse, logsPath, looksLikePositionalHandler, mailEvents, matchesDerivedRouteName, measure, mergeCspDirectives, middleware, normalizeOrigin, normalizeRequestPath, normalizeRoutePath, notifyHttpServerRebuilt, onHttpServerRebuilt, originOf, ownOrigin, parseLocaleDictionary, parseRoles, parseSites, parseSize, parseTraceparentTraceId, paths, preflightConfiguredHttpPort, promiseAllObject, publicPath, publicUrl, registerAppConfig, registerConfiguredConnectors, registerDevelopmentOpenApiProvider, registerGroupedTranslationKeys, registerHttpPlugins, registerLocaleDictionary, registerTracingHooks, remedyLines, renderReact, renderReactMail, reportPositionalHandlerSuspects, requestContext, requestMemo, requiresDefaultCsrfGuard, resetHttpReadyReport, resetMailConfig, resetRolesCacheForTests, resetTracingConfigForTests, resolveCspConfig, resolveCsrfOriginVerdict, resolveMailConfig, resolveTracingConfig, resolveWithinRoot, rootPath, routeNameMethodSuffix, router, runDefaultCsrfGuard, runPipeline, safeFetchToBuffer, sanitizePath, seeder, sendBootSignal, sendMail, serializeCspDirectives, servesHttp, setBaseUrl, setConfig, setEnvironment, setHttpReadyReport, setLogConfigurations, setMailConfigurations, setMailMode, shouldPreflightHttpPort, sleep, sluggable, srcPath, startHttpServer, stopHttpApplication, storage, storageConfig, storageConfigurations, storageDriverContext, storagePath, streamReactResponse, t, tempPath, toJson, uniqueExceptCurrentIdRule, uniqueExceptCurrentUserRule, unregisterLocaleDictionary, uploadedFileController, uploadedFileMetadataSchema, uploadsConfig, uploadsPath, uploadsUrl, url, useCase, useComputedModel, useComputedSlug, useCurrentUser, useHashedPassword, useRequest, useRequestStore, validateCspConfigAtBoot, validateCspDirectives, verifyMailer, verifyPassword, warlockConfigManager, warlockPath, wasMailSentTo, wasMailSentWithSubject, wrapResponseInDataKey };
@@ -0,0 +1,17 @@
1
+ import { OpenApiBuildResult, OpenApiContext, OpenApiRouteInput } from "./types.mjs";
2
+
3
+ //#region ../core/src/openapi/build-openapi-document.d.ts
4
+ /** `jsonSchemaDialect` of every document: OpenAPI 3.1 schemas are JSON Schema 2020-12. */
5
+ declare const OPENAPI_JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
6
+ /**
7
+ * Build an OpenAPI 3.1 document from registered routes.
8
+ *
9
+ * Pure: it reads the routes it is given (`router.list()` in the app), converts Seal schemas
10
+ * with `toJsonSchema("draft-2020-12")` and returns plain JSON plus the gaps it found as
11
+ * `warnings`. It never throws for a single route it cannot document; that route is
12
+ * documented as far as possible and a warning explains what was left out.
13
+ */
14
+ declare function buildOpenApiDocument(routes: readonly OpenApiRouteInput[], context: OpenApiContext): OpenApiBuildResult;
15
+ //#endregion
16
+ export { OPENAPI_JSON_SCHEMA_DIALECT, buildOpenApiDocument };
17
+ //# sourceMappingURL=build-openapi-document.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-openapi-document.d.mts","names":[],"sources":["../../../../../../../core/src/openapi/build-openapi-document.ts"],"mappings":";;;;cA2Ba,2BAAA;AAAb;;;;AAAwC;AA8BxC;;;AA9BA,iBA8BgB,oBAAA,CACd,MAAA,WAAiB,iBAAA,IACjB,OAAA,EAAS,cAAA,GACR,kBAAA"}
@@ -0,0 +1,124 @@
1
+ import { buildDeclaredResponses } from "./response-schemas.mjs";
2
+ import { buildUnauthorizedResponse, buildValidationFailedResponse, resolveValidationResponse } from "./error-responses.mjs";
3
+ import { buildOperationId, expandMethods, firstSegmentTag, toOpenApiPath } from "./paths.mjs";
4
+ import { buildRequestParts } from "./request-schemas.mjs";
5
+ import { SchemaRegistry } from "./schema-registry.mjs";
6
+ import { SecuritySchemes, readRouteAuth } from "./security.mjs";
7
+
8
+ //#region ../core/src/openapi/build-openapi-document.ts
9
+ /** `jsonSchemaDialect` of every document: OpenAPI 3.1 schemas are JSON Schema 2020-12. */
10
+ const OPENAPI_JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
11
+ const UNSAFE_METHODS = [
12
+ "post",
13
+ "put",
14
+ "patch",
15
+ "delete"
16
+ ];
17
+ function describeAuth(auth, method) {
18
+ const lines = [];
19
+ if (auth.userTypes.length > 0) lines.push(`Requires an authenticated user of type: ${auth.userTypes.join(", ")}.`);
20
+ if (auth.sources.some((source) => typeof source !== "string") && UNSAFE_METHODS.includes(method)) lines.push("When authenticating with the cookie, the request must also carry a same-origin Origin or Referer header (CSRF guard).");
21
+ return lines;
22
+ }
23
+ /**
24
+ * Build an OpenAPI 3.1 document from registered routes.
25
+ *
26
+ * Pure: it reads the routes it is given (`router.list()` in the app), converts Seal schemas
27
+ * with `toJsonSchema("draft-2020-12")` and returns plain JSON plus the gaps it found as
28
+ * `warnings`. It never throws for a single route it cannot document; that route is
29
+ * documented as far as possible and a warning explains what was left out.
30
+ */
31
+ function buildOpenApiDocument(routes, context) {
32
+ const warnings = [];
33
+ const registry = new SchemaRegistry(context.resolveResourceName, (message) => warnings.push(message));
34
+ const security = new SecuritySchemes();
35
+ const validationShape = resolveValidationResponse(context.validationResponse);
36
+ const paths = {};
37
+ const tags = /* @__PURE__ */ new Set();
38
+ const operationIds = /* @__PURE__ */ new Set();
39
+ for (const route of routes) {
40
+ if (route.isPage && !context.includePages) continue;
41
+ const methods = expandMethods(route.method);
42
+ const label = `${String(route.method).toUpperCase()} ${route.path}`;
43
+ const warn = (message) => warnings.push(`${label}: ${message}`);
44
+ if (methods.length === 0) {
45
+ warn(`unsupported method "${String(route.method)}", route skipped.`);
46
+ continue;
47
+ }
48
+ const handler = route.handler;
49
+ const validation = handler?.validation;
50
+ const auth = readRouteAuth(route.middleware, warn);
51
+ const tag = firstSegmentTag(route.path);
52
+ const pathKey = toOpenApiPath(route.path);
53
+ if (validation?.validate) warn("validation.validate is custom middleware and is not documented.");
54
+ for (const method of methods) {
55
+ paths[pathKey] ??= {};
56
+ if (paths[pathKey][method]) {
57
+ warn(`${method.toUpperCase()} ${pathKey} is already documented by an earlier route; this one is skipped.`);
58
+ continue;
59
+ }
60
+ let operationId = buildOperationId(route.name, method, route.path, methods.length > 1);
61
+ if (operationIds.has(operationId)) {
62
+ let suffix = 2;
63
+ while (operationIds.has(`${operationId}_${suffix}`)) suffix++;
64
+ warn(`operationId "${operationId}" is already used; renamed to "${operationId}_${suffix}".`);
65
+ operationId = `${operationId}_${suffix}`;
66
+ }
67
+ operationIds.add(operationId);
68
+ const description = [route.description ?? handler?.description, ...auth ? describeAuth(auth, method) : []].filter((line) => typeof line === "string" && line.length > 0);
69
+ const request = buildRequestParts({
70
+ method,
71
+ path: route.path,
72
+ validation,
73
+ warn
74
+ });
75
+ const responses = route.isPage ? { "200": {
76
+ description: "HTML page",
77
+ content: { "text/html": { schema: { type: "string" } } }
78
+ } } : buildDeclaredResponses(handler?.responseSchema, registry, warn);
79
+ if (!Object.keys(responses).some((status) => status.startsWith("2"))) responses["200"] = { description: "Successful response" };
80
+ if (validation?.schema) {
81
+ const failed = buildValidationFailedResponse(validationShape, registry);
82
+ responses[failed.status] ??= failed.response;
83
+ }
84
+ if (auth) responses["401"] ??= buildUnauthorizedResponse(registry);
85
+ if (tag) tags.add(tag);
86
+ const operation = {
87
+ operationId,
88
+ ...route.label ? { summary: route.label } : {},
89
+ ...description.length > 0 ? { description: description.join("\n\n") } : {},
90
+ ...tag ? { tags: [tag] } : {},
91
+ ...request.parameters.length > 0 ? { parameters: request.parameters } : {},
92
+ ...request.requestBody ? { requestBody: request.requestBody } : {},
93
+ responses: sortResponses(responses),
94
+ ...auth ? { security: security.requirementsFor(auth) } : {}
95
+ };
96
+ paths[pathKey][method] = operation;
97
+ }
98
+ }
99
+ const document = {
100
+ openapi: "3.1.0",
101
+ jsonSchemaDialect: OPENAPI_JSON_SCHEMA_DIALECT,
102
+ info: { ...context.info },
103
+ ...context.servers && context.servers.length > 0 ? { servers: context.servers.map((url) => ({ url })) } : {},
104
+ ...tags.size > 0 ? { tags: [...tags].sort().map((name) => ({ name })) } : {},
105
+ paths
106
+ };
107
+ const hasSchemas = Object.keys(registry.schemas).length > 0;
108
+ if (hasSchemas || security.hasSchemes()) {
109
+ document.components = {};
110
+ if (hasSchemas) document.components.schemas = registry.schemas;
111
+ if (security.hasSchemes()) document.components.securitySchemes = security.schemes;
112
+ }
113
+ return {
114
+ document,
115
+ warnings: [...new Set(warnings)]
116
+ };
117
+ }
118
+ function sortResponses(responses) {
119
+ return Object.fromEntries(Object.entries(responses).sort(([first], [second]) => first.localeCompare(second)));
120
+ }
121
+
122
+ //#endregion
123
+ export { OPENAPI_JSON_SCHEMA_DIALECT, buildOpenApiDocument };
124
+ //# sourceMappingURL=build-openapi-document.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-openapi-document.mjs","names":[],"sources":["../../../../../../../core/src/openapi/build-openapi-document.ts"],"sourcesContent":["import {\n buildUnauthorizedResponse,\n buildValidationFailedResponse,\n resolveValidationResponse,\n} from \"./error-responses\";\nimport {\n buildOperationId,\n expandMethods,\n firstSegmentTag,\n toOpenApiPath,\n type OpenApiMethod,\n} from \"./paths\";\nimport { buildRequestParts } from \"./request-schemas\";\nimport { buildDeclaredResponses } from \"./response-schemas\";\nimport { SchemaRegistry } from \"./schema-registry\";\nimport { readRouteAuth, SecuritySchemes } from \"./security\";\nimport type {\n AuthDescriptor,\n OpenApiBuildResult,\n OpenApiContext,\n OpenApiDocument,\n OpenApiOperation,\n OpenApiResponse,\n OpenApiRouteInput,\n} from \"./types\";\n\n/** `jsonSchemaDialect` of every document: OpenAPI 3.1 schemas are JSON Schema 2020-12. */\nexport const OPENAPI_JSON_SCHEMA_DIALECT = \"https://json-schema.org/draft/2020-12/schema\";\n\nconst UNSAFE_METHODS: readonly OpenApiMethod[] = [\"post\", \"put\", \"patch\", \"delete\"];\n\nfunction describeAuth(auth: AuthDescriptor, method: OpenApiMethod): string[] {\n const lines: string[] = [];\n\n if (auth.userTypes.length > 0) {\n lines.push(`Requires an authenticated user of type: ${auth.userTypes.join(\", \")}.`);\n }\n\n const usesCookie = auth.sources.some((source) => typeof source !== \"string\");\n\n if (usesCookie && UNSAFE_METHODS.includes(method)) {\n lines.push(\n \"When authenticating with the cookie, the request must also carry a same-origin Origin or Referer header (CSRF guard).\",\n );\n }\n\n return lines;\n}\n\n/**\n * Build an OpenAPI 3.1 document from registered routes.\n *\n * Pure: it reads the routes it is given (`router.list()` in the app), converts Seal schemas\n * with `toJsonSchema(\"draft-2020-12\")` and returns plain JSON plus the gaps it found as\n * `warnings`. It never throws for a single route it cannot document; that route is\n * documented as far as possible and a warning explains what was left out.\n */\nexport function buildOpenApiDocument(\n routes: readonly OpenApiRouteInput[],\n context: OpenApiContext,\n): OpenApiBuildResult {\n const warnings: string[] = [];\n const registry = new SchemaRegistry(context.resolveResourceName, (message) => warnings.push(message));\n const security = new SecuritySchemes();\n const validationShape = resolveValidationResponse(context.validationResponse);\n const paths: OpenApiDocument[\"paths\"] = {};\n const tags = new Set<string>();\n const operationIds = new Set<string>();\n\n for (const route of routes) {\n if (route.isPage && !context.includePages) {\n continue;\n }\n\n const methods = expandMethods(route.method);\n const label = `${String(route.method).toUpperCase()} ${route.path}`;\n const warn = (message: string) => warnings.push(`${label}: ${message}`);\n\n if (methods.length === 0) {\n warn(`unsupported method \"${String(route.method)}\", route skipped.`);\n\n continue;\n }\n\n const handler = route.handler as OpenApiRouteInput[\"handler\"] | undefined;\n const validation = handler?.validation;\n const auth = readRouteAuth(route.middleware, warn);\n const tag = firstSegmentTag(route.path);\n const pathKey = toOpenApiPath(route.path);\n\n if (validation?.validate) {\n warn(\"validation.validate is custom middleware and is not documented.\");\n }\n\n for (const method of methods) {\n paths[pathKey] ??= {};\n\n if (paths[pathKey][method]) {\n warn(`${method.toUpperCase()} ${pathKey} is already documented by an earlier route; this one is skipped.`);\n\n continue;\n }\n\n let operationId = buildOperationId(route.name, method, route.path, methods.length > 1);\n\n if (operationIds.has(operationId)) {\n let suffix = 2;\n\n while (operationIds.has(`${operationId}_${suffix}`)) {\n suffix++;\n }\n\n warn(`operationId \"${operationId}\" is already used; renamed to \"${operationId}_${suffix}\".`);\n operationId = `${operationId}_${suffix}`;\n }\n\n operationIds.add(operationId);\n\n const description = [\n route.description ?? handler?.description,\n ...(auth ? describeAuth(auth, method) : []),\n ].filter((line): line is string => typeof line === \"string\" && line.length > 0);\n\n const request = buildRequestParts({ method, path: route.path, validation, warn });\n\n const responses: Record<string, OpenApiResponse> = route.isPage\n ? { \"200\": { description: \"HTML page\", content: { \"text/html\": { schema: { type: \"string\" } } } } }\n : buildDeclaredResponses(handler?.responseSchema, registry, warn);\n\n if (!Object.keys(responses).some((status) => status.startsWith(\"2\"))) {\n responses[\"200\"] = { description: \"Successful response\" };\n }\n\n if (validation?.schema) {\n const failed = buildValidationFailedResponse(validationShape, registry);\n\n responses[failed.status] ??= failed.response;\n }\n\n if (auth) {\n responses[\"401\"] ??= buildUnauthorizedResponse(registry);\n }\n\n if (tag) {\n tags.add(tag);\n }\n\n // Built in reading order: identity, prose, inputs, outputs, security.\n const operation: OpenApiOperation = {\n operationId,\n ...(route.label ? { summary: route.label } : {}),\n ...(description.length > 0 ? { description: description.join(\"\\n\\n\") } : {}),\n ...(tag ? { tags: [tag] } : {}),\n ...(request.parameters.length > 0 ? { parameters: request.parameters } : {}),\n ...(request.requestBody ? { requestBody: request.requestBody } : {}),\n responses: sortResponses(responses),\n ...(auth ? { security: security.requirementsFor(auth) } : {}),\n };\n\n paths[pathKey][method] = operation;\n }\n }\n\n // Keys in reading order: header, servers, tags, paths, components.\n const document: OpenApiDocument = {\n openapi: \"3.1.0\",\n jsonSchemaDialect: OPENAPI_JSON_SCHEMA_DIALECT,\n info: { ...context.info },\n ...(context.servers && context.servers.length > 0\n ? { servers: context.servers.map((url) => ({ url })) }\n : {}),\n ...(tags.size > 0 ? { tags: [...tags].sort().map((name) => ({ name })) } : {}),\n paths,\n };\n\n const hasSchemas = Object.keys(registry.schemas).length > 0;\n\n if (hasSchemas || security.hasSchemes()) {\n document.components = {};\n\n if (hasSchemas) {\n document.components.schemas = registry.schemas;\n }\n\n if (security.hasSchemes()) {\n document.components.securitySchemes = security.schemes;\n }\n }\n\n return { document, warnings: [...new Set(warnings)] };\n}\n\nfunction sortResponses(responses: Record<string, OpenApiResponse>): Record<string, OpenApiResponse> {\n return Object.fromEntries(\n Object.entries(responses).sort(([first], [second]) => first.localeCompare(second)),\n );\n}\n"],"mappings":";;;;;;;;;AA2BA,MAAa,8BAA8B;AAE3C,MAAM,iBAA2C;CAAC;CAAQ;CAAO;CAAS;AAAQ;AAElF,SAAS,aAAa,MAAsB,QAAiC;CAC3E,MAAM,QAAkB,CAAC;CAEzB,IAAI,KAAK,UAAU,SAAS,GAC1B,MAAM,KAAK,2CAA2C,KAAK,UAAU,KAAK,IAAI,EAAE,EAAE;CAKpF,IAFmB,KAAK,QAAQ,MAAM,WAAW,OAAO,WAAW,QAEtD,KAAK,eAAe,SAAS,MAAM,GAC9C,MAAM,KACJ,uHACF;CAGF,OAAO;AACT;;;;;;;;;AAUA,SAAgB,qBACd,QACA,SACoB;CACpB,MAAM,WAAqB,CAAC;C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GAEA,MAAM,QAAQ,CAAC,UAAU;EAC3B;CACF;CAGA,MAAM,WAA4B;EAChC,SAAS;EACT,mBAAmB;EACnB,MAAM,EAAE,GAAG,QAAQ,KAAK;EACxB,GAAI,QAAQ,WAAW,QAAQ,QAAQ,SAAS,IAC5C,EAAE,SAAS,QAAQ,QAAQ,KAAK,SAAS,EAAE,IAAI,EAAE,EAAE,IACnD,CAAC;EACL,GAAI,KAAK,OAAO,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,UAAU,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC;EAC5E;CACF;CAEA,MAAM,aAAa,OAAO,KAAK,SAAS,OAAO,CAAC,CAAC,SAAS;CAE1D,IAAI,cAAc,SAAS,WAAW,GAAG;EACvC,SAAS,aAAa,CAAC;EAEvB,IAAI,YACF,SAAS,WAAW,UAAU,SAAS;EAGzC,IAAI,SAAS,WAAW,GACtB,SAAS,WAAW,kBAAkB,SAAS;CAEnD;CAEA,OAAO;EAAE;EAAU,UAAU,CAAC,GAAG,IAAI,IAAI,QAAQ,CAAC;CAAE;AACtD;AAEA,SAAS,cAAc,WAA6E;CAClG,OAAO,OAAO,YACZ,OAAO,QAAQ,SAAS,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,MAAM,cAAc,MAAM,CAAC,CACnF;AACF"}
@@ -0,0 +1,89 @@
1
+ //#region ../core/src/openapi/cast-schema.ts
2
+ /**
3
+ * JSON Schema of the DEFAULT date output of a resource field (`iso`, `format`, `timestamp`
4
+ * and `humanTime` on; `timezone`, `locale` and `offset` off), matching `BaseCastOutput<"date">`.
5
+ */
6
+ const DEFAULT_DATE_SCHEMA = {
7
+ type: "object",
8
+ properties: {
9
+ iso: {
10
+ type: "string",
11
+ format: "date-time"
12
+ },
13
+ format: { type: "string" },
14
+ timestamp: { type: "number" },
15
+ humanTime: { type: "string" }
16
+ },
17
+ required: [
18
+ "iso",
19
+ "format",
20
+ "timestamp",
21
+ "humanTime"
22
+ ]
23
+ };
24
+ function baseCastSchema(base) {
25
+ switch (base) {
26
+ case "string":
27
+ case "localized": return { type: "string" };
28
+ case "url":
29
+ case "uploadsUrl":
30
+ case "storageUrl": return {
31
+ type: "string",
32
+ format: "uri"
33
+ };
34
+ case "number":
35
+ case "float": return { type: "number" };
36
+ case "int": return { type: "integer" };
37
+ case "boolean": return { type: "boolean" };
38
+ case "object": return { type: "object" };
39
+ case "array": return { type: "array" };
40
+ case "date": return structuredClone(DEFAULT_DATE_SCHEMA);
41
+ default: return;
42
+ }
43
+ }
44
+ /**
45
+ * Make a schema accept `null` too, the 3.1 way: `type: [T, "null"]`. A schema without a plain
46
+ * `type` (a `$ref`, `{}`) is wrapped in `anyOf` with `{ type: "null" }`.
47
+ */
48
+ function makeNullable(schema) {
49
+ if (typeof schema.type === "string") return {
50
+ ...schema,
51
+ type: [schema.type, "null"]
52
+ };
53
+ if (Array.isArray(schema.type)) return schema.type.includes("null") ? schema : {
54
+ ...schema,
55
+ type: [...schema.type, "null"]
56
+ };
57
+ return { anyOf: [schema, { type: "null" }] };
58
+ }
59
+ /**
60
+ * JSON Schema of a resource cast string, suffixes included (`"string"`, `"number?"`,
61
+ * `"string[]"`, `"date[]?"`). `?` means "always present, value or null"; `[]` wraps the base
62
+ * in an array, and with `?` it is the array that may be null.
63
+ *
64
+ * @returns `undefined` for a cast this mapper does not know.
65
+ */
66
+ function castToJsonSchema(cast) {
67
+ let base = cast;
68
+ let nullable = false;
69
+ let isArray = false;
70
+ if (base.endsWith("?")) {
71
+ nullable = true;
72
+ base = base.slice(0, -1);
73
+ }
74
+ if (base.endsWith("[]")) {
75
+ isArray = true;
76
+ base = base.slice(0, -2);
77
+ }
78
+ const baseSchema = baseCastSchema(base);
79
+ if (!baseSchema) return;
80
+ const shaped = isArray ? {
81
+ type: "array",
82
+ items: baseSchema
83
+ } : baseSchema;
84
+ return nullable ? makeNullable(shaped) : shaped;
85
+ }
86
+
87
+ //#endregion
88
+ export { castToJsonSchema };
89
+ //# sourceMappingURL=cast-schema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cast-schema.mjs","names":[],"sources":["../../../../../../../core/src/openapi/cast-schema.ts"],"sourcesContent":["import type { OpenApiSchema } from \"./types\";\n\n/**\n * JSON Schema of the DEFAULT date output of a resource field (`iso`, `format`, `timestamp`\n * and `humanTime` on; `timezone`, `locale` and `offset` off), matching `BaseCastOutput<\"date\">`.\n */\nconst DEFAULT_DATE_SCHEMA: OpenApiSchema = {\n type: \"object\",\n properties: {\n iso: { type: \"string\", format: \"date-time\" },\n format: { type: \"string\" },\n timestamp: { type: \"number\" },\n humanTime: { type: \"string\" },\n },\n required: [\"iso\", \"format\", \"timestamp\", \"humanTime\"],\n};\n\nfunction baseCastSchema(base: string): OpenApiSchema | undefined {\n switch (base) {\n case \"string\":\n case \"localized\":\n return { type: \"string\" };\n case \"url\":\n case \"uploadsUrl\":\n case \"storageUrl\":\n return { type: \"string\", format: \"uri\" };\n case \"number\":\n case \"float\":\n return { type: \"number\" };\n case \"int\":\n return { type: \"integer\" };\n case \"boolean\":\n return { type: \"boolean\" };\n case \"object\":\n return { type: \"object\" };\n case \"array\":\n return { type: \"array\" };\n case \"date\":\n return structuredClone(DEFAULT_DATE_SCHEMA);\n default:\n return undefined;\n }\n}\n\n/**\n * Make a schema accept `null` too, the 3.1 way: `type: [T, \"null\"]`. A schema without a plain\n * `type` (a `$ref`, `{}`) is wrapped in `anyOf` with `{ type: \"null\" }`.\n */\nexport function makeNullable(schema: OpenApiSchema): OpenApiSchema {\n if (typeof schema.type === \"string\") {\n return { ...schema, type: [schema.type, \"null\"] };\n }\n\n if (Array.isArray(schema.type)) {\n return schema.type.includes(\"null\") ? schema : { ...schema, type: [...schema.type, \"null\"] };\n }\n\n return { anyOf: [schema, { type: \"null\" }] };\n}\n\n/**\n * JSON Schema of a resource cast string, suffixes included (`\"string\"`, `\"number?\"`,\n * `\"string[]\"`, `\"date[]?\"`). `?` means \"always present, value or null\"; `[]` wraps the base\n * in an array, and with `?` it is the array that may be null.\n *\n * @returns `undefined` for a cast this mapper does not know.\n */\nexport function castToJsonSchema(cast: string): OpenApiSchema | undefined {\n let base = cast;\n let nullable = false;\n let isArray = false;\n\n if (base.endsWith(\"?\")) {\n nullable = true;\n base = base.slice(0, -1);\n }\n\n if (base.endsWith(\"[]\")) {\n isArray = true;\n base = base.slice(0, -2);\n }\n\n const baseSchema = baseCastSchema(base);\n\n if (!baseSchema) {\n return undefined;\n }\n\n const shaped: OpenApiSchema = isArray ? { type: \"array\", items: baseSchema } : baseSchema;\n\n return nullable ? makeNullable(shaped) : shaped;\n}\n"],"mappings":";;;;;AAMA,MAAM,sBAAqC;CACzC,MAAM;CACN,YAAY;EACV,KAAK;GAAE,MAAM;GAAU,QAAQ;EAAY;EAC3C,QAAQ,EAAE,MAAM,SAAS;EACzB,WAAW,EAAE,MAAM,SAAS;EAC5B,WAAW,EAAE,MAAM,SAAS;CAC9B;CACA,UAAU;EAAC;EAAO;EAAU;EAAa;CAAW;AACtD;AAEA,SAAS,eAAe,MAAyC;CAC/D,QAAQ,MAAR;EACE,KAAK;EACL,KAAK,aACH,OAAO,EAAE,MAAM,SAAS;EAC1B,KAAK;EACL,KAAK;EACL,KAAK,cACH,OAAO;GAAE,MAAM;GAAU,QAAQ;EAAM;EACzC,KAAK;EACL,KAAK,SACH,OAAO,EAAE,MAAM,SAAS;EAC1B,KAAK,OACH,OAAO,EAAE,MAAM,UAAU;EAC3B,KAAK,WACH,OAAO,EAAE,MAAM,UAAU;EAC3B,KAAK,UACH,OAAO,EAAE,MAAM,SAAS;EAC1B,KAAK,SACH,OAAO,EAAE,MAAM,QAAQ;EACzB,KAAK,QACH,OAAO,gBAAgB,mBAAmB;EAC5C,SACE;CACJ;AACF;;;;;AAMA,SAAgB,aAAa,QAAsC;CACjE,IAAI,OAAO,OAAO,SAAS,UACzB,OAAO;EAAE,GAAG;EAAQ,MAAM,CAAC,OAAO,MAAM,MAAM;CAAE;CAGlD,IAAI,MAAM,QAAQ,OAAO,IAAI,GAC3B,OAAO,OAAO,KAAK,SAAS,MAAM,IAAI,SAAS;EAAE,GAAG;EAAQ,MAAM,CAAC,GAAG,OAAO,MAAM,MAAM;CAAE;CAG7F,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,EAAE;AAC7C;;;;;;;;AASA,SAAgB,iBAAiB,MAAyC;CACxE,IAAI,OAAO;CACX,IAAI,WAAW;CACf,IAAI,UAAU;CAEd,IAAI,KAAK,SAAS,GAAG,GAAG;EACtB,WAAW;EACX,OAAO,KAAK,MAAM,GAAG,EAAE;CACzB;CAEA,IAAI,KAAK,SAAS,IAAI,GAAG;EACvB,UAAU;EACV,OAAO,KAAK,MAAM,GAAG,EAAE;CACzB;CAEA,MAAM,aAAa,eAAe,IAAI;CAEtC,IAAI,CAAC,YACH;CAGF,MAAM,SAAwB,UAAU;EAAE,MAAM;EAAS,OAAO;CAAW,IAAI;CAE/E,OAAO,WAAW,aAAa,MAAM,IAAI;AAC3C"}
@@ -0,0 +1,40 @@
1
+ import { runRegistrationChild } from "../production/registration-child-runner.mjs";
2
+ import { OPENAPI_RESULT_MESSAGE, parseOpenApiChildResult } from "./openapi-protocol.mjs";
3
+
4
+ //#region ../core/src/openapi/collect-openapi-document.ts
5
+ /**
6
+ * Build the app's OpenAPI document in a fresh process.
7
+ *
8
+ * Uses the same registration child as `warlock build` (it imports the route modules without
9
+ * booting connectors) in OpenAPI mode: the document is built inside the child, where the Seal
10
+ * schemas and resource classes live, and only the finished JSON crosses IPC.
11
+ */
12
+ function collectOpenApiDocument(options = {}) {
13
+ const cwd = options.cwd ?? process.cwd();
14
+ const openapi = {
15
+ version: 1,
16
+ ...options.title !== void 0 ? { title: options.title } : {},
17
+ ...options.server !== void 0 ? { server: options.server } : {},
18
+ ...options.includePages !== void 0 ? { includePages: options.includePages } : {}
19
+ };
20
+ return runRegistrationChild({
21
+ cwd,
22
+ timeoutMs: options.timeoutMs,
23
+ childEntry: options.childEntry,
24
+ forkProcess: options.forkProcess,
25
+ request: {
26
+ version: 1,
27
+ cwd,
28
+ environment: options.environment,
29
+ runtimeStrategy: options.runtimeStrategy,
30
+ openapi
31
+ },
32
+ resultMessageType: OPENAPI_RESULT_MESSAGE,
33
+ resultNoun: "document",
34
+ readResult: (message) => parseOpenApiChildResult(message.result)
35
+ });
36
+ }
37
+
38
+ //#endregion
39
+ export { collectOpenApiDocument };
40
+ //# sourceMappingURL=collect-openapi-document.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-openapi-document.mjs","names":[],"sources":["../../../../../../../core/src/openapi/collect-openapi-document.ts"],"sourcesContent":["import {\n runRegistrationChild,\n type RegistrationChildForker,\n} from \"../production/registration-child-runner\";\nimport type { Environment, RuntimeStrategy } from \"../utils/environment\";\nimport {\n OPENAPI_PROTOCOL_VERSION,\n OPENAPI_RESULT_MESSAGE,\n parseOpenApiChildResult,\n type OpenApiChildRequestOptions,\n type OpenApiChildResult,\n} from \"./openapi-protocol\";\n\nexport type CollectOpenApiDocumentOptions = Readonly<{\n cwd?: string;\n environment?: Environment;\n runtimeStrategy?: RuntimeStrategy;\n timeoutMs?: number;\n childEntry?: string;\n forkProcess?: RegistrationChildForker;\n title?: string;\n server?: string;\n includePages?: boolean;\n}>;\n\n/**\n * Build the app's OpenAPI document in a fresh process.\n *\n * Uses the same registration child as `warlock build` (it imports the route modules without\n * booting connectors) in OpenAPI mode: the document is built inside the child, where the Seal\n * schemas and resource classes live, and only the finished JSON crosses IPC.\n */\nexport function collectOpenApiDocument(\n options: CollectOpenApiDocumentOptions = {},\n): Promise<OpenApiChildResult> {\n const cwd = options.cwd ?? process.cwd();\n const openapi: OpenApiChildRequestOptions = {\n version: OPENAPI_PROTOCOL_VERSION,\n ...(options.title !== undefined ? { title: options.title } : {}),\n ...(options.server !== undefined ? { server: options.server } : {}),\n ...(options.includePages !== undefined ? { includePages: options.includePages } : {}),\n };\n\n return runRegistrationChild<OpenApiChildResult>({\n cwd,\n timeoutMs: options.timeoutMs,\n childEntry: options.childEntry,\n forkProcess: options.forkProcess,\n request: {\n version: 1,\n cwd,\n environment: options.environment,\n runtimeStrategy: options.runtimeStrategy,\n openapi,\n },\n resultMessageType: OPENAPI_RESULT_MESSAGE,\n resultNoun: \"document\",\n readResult: (message) => parseOpenApiChildResult(message.result),\n });\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgB,uBACd,UAAyC,CAAC,GACb;CAC7B,MAAM,MAAM,QAAQ,OAAO,QAAQ,IAAI;CACvC,MAAM,UAAsC;EAC1C;EACA,GAAI,QAAQ,UAAU,SAAY,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;EAC9D,GAAI,QAAQ,WAAW,SAAY,EAAE,QAAQ,QAAQ,OAAO,IAAI,CAAC;EACjE,GAAI,QAAQ,iBAAiB,SAAY,EAAE,cAAc,QAAQ,aAAa,IAAI,CAAC;CACrF;CAEA,OAAO,qBAAyC;EAC9C;EACA,WAAW,QAAQ;EACnB,YAAY,QAAQ;EACpB,aAAa,QAAQ;EACrB,SAAS;GACP,SAAS;GACT;GACA,aAAa,QAAQ;GACrB,iBAAiB,QAAQ;GACzB;EACF;EACA,mBAAmB;EACnB,YAAY;EACZ,aAAa,YAAY,wBAAwB,QAAQ,MAAM;CACjE,CAAC;AACH"}
@@ -0,0 +1,17 @@
1
+ import { OpenApiBuildResult } from "./types.mjs";
2
+
3
+ //#region ../core/src/openapi/development-openapi-provider.d.ts
4
+ type DevelopmentOpenApiProvider = () => Promise<OpenApiBuildResult>;
5
+ /**
6
+ * Called by the dev server at startup. The builder lives under `dev-server/`, so the
7
+ * production entry never reaches it; this registry is the only thing the root exports.
8
+ */
9
+ declare function registerDevelopmentOpenApiProvider(build: DevelopmentOpenApiProvider): void;
10
+ /**
11
+ * The OpenAPI document for the routes registered in this process, built by the dev
12
+ * server's provider. Throws outside `warlock dev`, where no provider is registered.
13
+ */
14
+ declare function getDevelopmentOpenApiDocument(): Promise<OpenApiBuildResult>;
15
+ //#endregion
16
+ export { getDevelopmentOpenApiDocument, registerDevelopmentOpenApiProvider };
17
+ //# sourceMappingURL=development-openapi-provider.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development-openapi-provider.d.mts","names":[],"sources":["../../../../../../../core/src/openapi/development-openapi-provider.ts"],"mappings":";;;KAEK,0BAAA,SAAmC,OAAO,CAAC,kBAAA;;AAFE;;;iBAUlC,kCAAA,CAAmC,KAAiC,EAA1B,0BAA0B;AARlB;AAQlE;;;AARkE,iBAgB5C,6BAAA,IAAiC,OAAO,CAAC,kBAAA"}