@mailwoman/api-kit 9.3.0 → 10.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.
- package/lib/engine-stamp.ts +8 -2
- package/lib/openapi.ts +27 -0
- package/out/engine-stamp.d.ts +7 -1
- package/out/engine-stamp.d.ts.map +1 -1
- package/out/engine-stamp.js +8 -2
- package/out/engine-stamp.js.map +1 -1
- package/out/error.js.map +1 -1
- package/out/openapi.d.ts +13 -0
- package/out/openapi.d.ts.map +1 -1
- package/out/openapi.js +21 -0
- package/out/openapi.js.map +1 -1
- package/package.json +2 -2
package/lib/engine-stamp.ts
CHANGED
|
@@ -32,9 +32,15 @@ export const EngineStampSchema = z
|
|
|
32
32
|
* field. Applied at the ROUTE, never on an outcome schema, so an outcome schema keeps describing what the engine
|
|
33
33
|
* produces (the schema drift pin in `mailwoman` depends on that) and the OpenAPI document references the outcome
|
|
34
34
|
* component through `allOf` instead of cloning it.
|
|
35
|
+
*
|
|
36
|
+
* `name` registers the stamped shape as its own component, and it is required rather than optional because an unnamed
|
|
37
|
+
* intersection is inlined at every use: a generator then has no name to give the type and invents one from the position
|
|
38
|
+
* it appears in — `PhotonResponse::Variant0`, or a flattened per-operation clone of an outcome that already has a name.
|
|
39
|
+
* Naming it keeps one `$ref` per stamped shape, which is what makes a generated client's type names follow the
|
|
40
|
+
* document's.
|
|
35
41
|
*/
|
|
36
|
-
export function stampedResponseSchema<S extends z.ZodTypeAny>(schema: S) {
|
|
37
|
-
return z.intersection(schema, z.object({ engine: EngineStampSchema.optional() }))
|
|
42
|
+
export function stampedResponseSchema<S extends z.ZodTypeAny>(schema: S, name: string) {
|
|
43
|
+
return z.intersection(schema, z.object({ engine: EngineStampSchema.optional() })).openapi(name)
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
/**
|
package/lib/openapi.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import type { OpenAPIHono } from "@hono/zod-openapi"
|
|
12
12
|
import { writeLocalTextFile } from "@mailwoman/core/fs/writers"
|
|
13
|
+
import { readPackageJSON } from "@mailwoman/core/module/resolve-from"
|
|
13
14
|
|
|
14
15
|
type OpenAPISecurityRequirements = Parameters<OpenAPIHono["getOpenAPI31Document"]>[0]["security"]
|
|
15
16
|
|
|
@@ -35,6 +36,32 @@ export interface OpenAPIDocInfo {
|
|
|
35
36
|
security?: OpenAPISecurityRequirements
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
/**
|
|
40
|
+
* The three document fields a served package takes from its own manifest, read at load rather than imported as a
|
|
41
|
+
* module: a JSON import makes `tsc` copy the manifest into `out/`, where it becomes the package scope for the compiled
|
|
42
|
+
* tree and breaks every `#` import in it.
|
|
43
|
+
*
|
|
44
|
+
* Each of the four served packages (`api`, `libpostal`, `nominatim`, `photon`) publishes a document naming itself, so
|
|
45
|
+
* the read and the mapping live here rather than four times over. A manifest missing any of the three raises: the
|
|
46
|
+
* document has no meaningful form without them, and every manifest here carries all three.
|
|
47
|
+
*
|
|
48
|
+
* @param base The CALLER's `import.meta.url`. The package resolves through the graph of the workspace that declares it,
|
|
49
|
+
* which is what `resolve-from` exists for; resolving from here would answer through `@mailwoman/api-kit`'s instead.
|
|
50
|
+
*/
|
|
51
|
+
export async function readServedDocumentInfo(
|
|
52
|
+
base: string,
|
|
53
|
+
packageName: string
|
|
54
|
+
): Promise<Pick<OpenAPIDocInfo, "title" | "version" | "description">> {
|
|
55
|
+
const manifest = await readPackageJSON(base, packageName)
|
|
56
|
+
const { name, version, description } = manifest
|
|
57
|
+
|
|
58
|
+
if (!name || !version || !description) {
|
|
59
|
+
throw new Error(`${packageName}/package.json must declare name, version and description for its OpenAPI document`)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return { title: name, version, description }
|
|
63
|
+
}
|
|
64
|
+
|
|
38
65
|
/**
|
|
39
66
|
* Split an `OpenAPIDocInfo` into the document's `info` block and its top-level sibling fields.
|
|
40
67
|
*/
|
package/out/engine-stamp.d.ts
CHANGED
|
@@ -27,8 +27,14 @@ export declare const EngineStampSchema: z.ZodObject<{
|
|
|
27
27
|
* field. Applied at the ROUTE, never on an outcome schema, so an outcome schema keeps describing what the engine
|
|
28
28
|
* produces (the schema drift pin in `mailwoman` depends on that) and the OpenAPI document references the outcome
|
|
29
29
|
* component through `allOf` instead of cloning it.
|
|
30
|
+
*
|
|
31
|
+
* `name` registers the stamped shape as its own component, and it is required rather than optional because an unnamed
|
|
32
|
+
* intersection is inlined at every use: a generator then has no name to give the type and invents one from the position
|
|
33
|
+
* it appears in — `PhotonResponse::Variant0`, or a flattened per-operation clone of an outcome that already has a name.
|
|
34
|
+
* Naming it keeps one `$ref` per stamped shape, which is what makes a generated client's type names follow the
|
|
35
|
+
* document's.
|
|
30
36
|
*/
|
|
31
|
-
export declare function stampedResponseSchema<S extends z.ZodTypeAny>(schema: S): z.ZodIntersection<S, z.ZodObject<{
|
|
37
|
+
export declare function stampedResponseSchema<S extends z.ZodTypeAny>(schema: S, name: string): z.ZodIntersection<S, z.ZodObject<{
|
|
32
38
|
engine: z.ZodOptional<z.ZodObject<{
|
|
33
39
|
name: z.ZodLiteral<"mailwoman">;
|
|
34
40
|
version: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-stamp.d.ts","sourceRoot":"","sources":["../lib/engine-stamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;kBAQ2B,CAAA;AAEzD
|
|
1
|
+
{"version":3,"file":"engine-stamp.d.ts","sourceRoot":"","sources":["../lib/engine-stamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;kBAQ2B,CAAA;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM;;;;;;;;mBAEpF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,iBAAiB,CAUnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC/C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,WAAW,GAAG,SAAS,GAC5B,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,CAE9B"}
|
package/out/engine-stamp.js
CHANGED
|
@@ -27,9 +27,15 @@ export const EngineStampSchema = z
|
|
|
27
27
|
* field. Applied at the ROUTE, never on an outcome schema, so an outcome schema keeps describing what the engine
|
|
28
28
|
* produces (the schema drift pin in `mailwoman` depends on that) and the OpenAPI document references the outcome
|
|
29
29
|
* component through `allOf` instead of cloning it.
|
|
30
|
+
*
|
|
31
|
+
* `name` registers the stamped shape as its own component, and it is required rather than optional because an unnamed
|
|
32
|
+
* intersection is inlined at every use: a generator then has no name to give the type and invents one from the position
|
|
33
|
+
* it appears in — `PhotonResponse::Variant0`, or a flattened per-operation clone of an outcome that already has a name.
|
|
34
|
+
* Naming it keeps one `$ref` per stamped shape, which is what makes a generated client's type names follow the
|
|
35
|
+
* document's.
|
|
30
36
|
*/
|
|
31
|
-
export function stampedResponseSchema(schema) {
|
|
32
|
-
return z.intersection(schema, z.object({ engine: EngineStampSchema.optional() }));
|
|
37
|
+
export function stampedResponseSchema(schema, name) {
|
|
38
|
+
return z.intersection(schema, z.object({ engine: EngineStampSchema.optional() })).openapi(name);
|
|
33
39
|
}
|
|
34
40
|
/**
|
|
35
41
|
* `Server` names the engine and its license branch; `Link: rel="license"` is the registered relation (RFC 8288) that
|
package/out/engine-stamp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-stamp.js","sourceRoot":"","sources":["../lib/engine-stamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAIrC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAChC,YAAY,CAAC;IACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC;KACD,OAAO,CAAC,aAAa,CAAkC,CAAA;AAEzD
|
|
1
|
+
{"version":3,"file":"engine-stamp.js","sourceRoot":"","sources":["../lib/engine-stamp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAA;AAIrC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAChC,YAAY,CAAC;IACb,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC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AAO,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,gBAAgB,EAAE,2BAA2B,CAAC,CAAA;AACtF,CAAC"}
|
package/out/openapi.d.ts
CHANGED
|
@@ -45,6 +45,19 @@ export interface OpenAPIDocInfo {
|
|
|
45
45
|
}>;
|
|
46
46
|
security?: OpenAPISecurityRequirements;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* The three document fields a served package takes from its own manifest, read at load rather than imported as a
|
|
50
|
+
* module: a JSON import makes `tsc` copy the manifest into `out/`, where it becomes the package scope for the compiled
|
|
51
|
+
* tree and breaks every `#` import in it.
|
|
52
|
+
*
|
|
53
|
+
* Each of the four served packages (`api`, `libpostal`, `nominatim`, `photon`) publishes a document naming itself, so
|
|
54
|
+
* the read and the mapping live here rather than four times over. A manifest missing any of the three raises: the
|
|
55
|
+
* document has no meaningful form without them, and every manifest here carries all three.
|
|
56
|
+
*
|
|
57
|
+
* @param base The CALLER's `import.meta.url`. The package resolves through the graph of the workspace that declares it,
|
|
58
|
+
* which is what `resolve-from` exists for; resolving from here would answer through `@mailwoman/api-kit`'s instead.
|
|
59
|
+
*/
|
|
60
|
+
export declare function readServedDocumentInfo(base: string, packageName: string): Promise<Pick<OpenAPIDocInfo, "title" | "version" | "description">>;
|
|
48
61
|
/**
|
|
49
62
|
* Mount the OpenAPI 3.1 document endpoint on `app` (default `/openapi.json`).
|
|
50
63
|
*/
|
package/out/openapi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../lib/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../lib/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,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wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,SAAkB,GAAG,IAAI,CAItG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAezG;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACzC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,cAAc,EACpB,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1C,OAAO,CAAC,IAAI,CAAC,CAWf;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;;;;;;;EAK7D"}
|
package/out/openapi.js
CHANGED
|
@@ -8,6 +8,27 @@
|
|
|
8
8
|
* (progenitor), replacing the old hand-downgrade step.
|
|
9
9
|
*/
|
|
10
10
|
import { writeLocalTextFile } from "@mailwoman/core/fs/writers";
|
|
11
|
+
import { readPackageJSON } from "@mailwoman/core/module/resolve-from";
|
|
12
|
+
/**
|
|
13
|
+
* The three document fields a served package takes from its own manifest, read at load rather than imported as a
|
|
14
|
+
* module: a JSON import makes `tsc` copy the manifest into `out/`, where it becomes the package scope for the compiled
|
|
15
|
+
* tree and breaks every `#` import in it.
|
|
16
|
+
*
|
|
17
|
+
* Each of the four served packages (`api`, `libpostal`, `nominatim`, `photon`) publishes a document naming itself, so
|
|
18
|
+
* the read and the mapping live here rather than four times over. A manifest missing any of the three raises: the
|
|
19
|
+
* document has no meaningful form without them, and every manifest here carries all three.
|
|
20
|
+
*
|
|
21
|
+
* @param base The CALLER's `import.meta.url`. The package resolves through the graph of the workspace that declares it,
|
|
22
|
+
* which is what `resolve-from` exists for; resolving from here would answer through `@mailwoman/api-kit`'s instead.
|
|
23
|
+
*/
|
|
24
|
+
export async function readServedDocumentInfo(base, packageName) {
|
|
25
|
+
const manifest = await readPackageJSON(base, packageName);
|
|
26
|
+
const { name, version, description } = manifest;
|
|
27
|
+
if (!name || !version || !description) {
|
|
28
|
+
throw new Error(`${packageName}/package.json must declare name, version and description for its OpenAPI document`);
|
|
29
|
+
}
|
|
30
|
+
return { title: name, version, description };
|
|
31
|
+
}
|
|
11
32
|
/**
|
|
12
33
|
* Split an `OpenAPIDocInfo` into the document's `info` block and its top-level sibling fields.
|
|
13
34
|
*/
|
package/out/openapi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../lib/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../lib/openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AA0BrE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,IAAY,EACZ,WAAmB;IAEnB,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IACzD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAA;IAE/C,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,mFAAmF,CAAC,CAAA;IACnH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAA;AAC7C,CA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G,EAAE,IAAI,CAAC,CAAA;IACpD,6GAA6G;IAC7G,2BAA2B;IAC3B,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAA;IAErE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACzC,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAI,WAAmB,EAAE,MAAS;IAC7D,OAAO;QACN,WAAW;QACX,OAAO,EAAE,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,EAAE;KAC3C,CAAA;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/api-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "API plumbing for Mailwoman's HTTP surfaces — Hono node serve wrapper, OpenAPI emit helpers, shared wire atoms. Plumbing only: domain schemas live with their routes.",
|
|
5
5
|
"license": "AGPL-3.0-only OR LicenseRef-Commercial",
|
|
6
6
|
"repository": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"@hono/node-server": "^2.1.1",
|
|
74
74
|
"@hono/zod-openapi": "^1.6.3",
|
|
75
|
-
"@mailwoman/core": "
|
|
75
|
+
"@mailwoman/core": "10.0.0",
|
|
76
76
|
"hono": "^4.13.7",
|
|
77
77
|
"zod": "^4.5.4"
|
|
78
78
|
}
|