@wildo-ai/saas-technical-doc 1.1.1
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/LICENSE +34 -0
- package/dist/esm/.builder.pid +9 -0
- package/dist/esm/build/csp-emit.d.ts +9 -0
- package/dist/esm/build/csp-emit.d.ts.map +1 -0
- package/dist/esm/build/csp-emit.js +8 -0
- package/dist/esm/build/csp-emit.js.map +1 -0
- package/dist/esm/build/load-materialized-frontend-providers.d.ts +9 -0
- package/dist/esm/build/load-materialized-frontend-providers.d.ts.map +1 -0
- package/dist/esm/build/load-materialized-frontend-providers.js +9 -0
- package/dist/esm/build/load-materialized-frontend-providers.js.map +1 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts +66 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.js +195 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.js.map +1 -0
- package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.d.ts +36 -0
- package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.js +71 -0
- package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.js.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts +37 -0
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js +1865 -0
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.d.ts +22 -0
- package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.js +31 -0
- package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.js.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts +31 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js +33 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.d.ts +13 -0
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js +93 -0
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js.map +1 -0
- package/dist/esm/companion/content/application-consumer-documentation-content-loader.d.ts +52 -0
- package/dist/esm/companion/content/application-consumer-documentation-content-loader.d.ts.map +1 -0
- package/dist/esm/companion/content/application-consumer-documentation-content-loader.js +191 -0
- package/dist/esm/companion/content/application-consumer-documentation-content-loader.js.map +1 -0
- package/dist/esm/companion/index.d.ts +39 -0
- package/dist/esm/companion/index.d.ts.map +1 -0
- package/dist/esm/companion/index.js +39 -0
- package/dist/esm/companion/index.js.map +1 -0
- package/dist/esm/companion/openapi-generator.d.ts +94 -0
- package/dist/esm/companion/openapi-generator.d.ts.map +1 -0
- package/dist/esm/companion/openapi-generator.js +1562 -0
- package/dist/esm/companion/openapi-generator.js.map +1 -0
- package/dist/esm/companion/operation-projection.schemas.d.ts +797 -0
- package/dist/esm/companion/operation-projection.schemas.d.ts.map +1 -0
- package/dist/esm/companion/operation-projection.schemas.js +610 -0
- package/dist/esm/companion/operation-projection.schemas.js.map +1 -0
- package/dist/esm/companion/publish-result.types.d.ts +124 -0
- package/dist/esm/companion/publish-result.types.d.ts.map +1 -0
- package/dist/esm/companion/publish-result.types.js +28 -0
- package/dist/esm/companion/publish-result.types.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.d.ts +26 -0
- package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.js +63 -0
- package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-build-measurement.d.ts +23 -0
- package/dist/esm/companion/rendering/technical-documentation-build-measurement.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-build-measurement.js +104 -0
- package/dist/esm/companion/rendering/technical-documentation-build-measurement.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts +9 -0
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js +421 -0
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.d.ts +72 -0
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js +204 -0
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts +9 -0
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js +106 -0
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.d.ts +43 -0
- package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.js +88 -0
- package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.d.ts +7 -0
- package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.js +51 -0
- package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-render-model.d.ts +45 -0
- package/dist/esm/companion/rendering/technical-documentation-render-model.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-render-model.js +178 -0
- package/dist/esm/companion/rendering/technical-documentation-render-model.js.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts +3 -0
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts.map +1 -0
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js +49 -0
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js.map +1 -0
- package/dist/esm/companion/spec-to-operation-doc.d.ts +176 -0
- package/dist/esm/companion/spec-to-operation-doc.d.ts.map +1 -0
- package/dist/esm/companion/spec-to-operation-doc.js +326 -0
- package/dist/esm/companion/spec-to-operation-doc.js.map +1 -0
- package/dist/esm/companion/technical-documentation-asset-path.d.ts +16 -0
- package/dist/esm/companion/technical-documentation-asset-path.d.ts.map +1 -0
- package/dist/esm/companion/technical-documentation-asset-path.js +19 -0
- package/dist/esm/companion/technical-documentation-asset-path.js.map +1 -0
- package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts +14 -0
- package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts.map +1 -0
- package/dist/esm/companion/technical-documentation-capture-execution-port.js +1 -0
- package/dist/esm/companion/technical-documentation-capture-execution-port.js.map +1 -0
- package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts +25 -0
- package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts.map +1 -0
- package/dist/esm/companion/technical-documentation-diagram-materializer.js +86 -0
- package/dist/esm/companion/technical-documentation-diagram-materializer.js.map +1 -0
- package/dist/esm/companion/technical-documentation-placeholder-materializer.d.ts +17 -0
- package/dist/esm/companion/technical-documentation-placeholder-materializer.d.ts.map +1 -0
- package/dist/esm/companion/technical-documentation-placeholder-materializer.js +63 -0
- package/dist/esm/companion/technical-documentation-placeholder-materializer.js.map +1 -0
- package/dist/esm/companion/zod-to-openapi.d.ts +67 -0
- package/dist/esm/companion/zod-to-openapi.d.ts.map +1 -0
- package/dist/esm/companion/zod-to-openapi.js +211 -0
- package/dist/esm/companion/zod-to-openapi.js.map +1 -0
- package/dist/esm/companion-exports.d.ts +32 -0
- package/dist/esm/companion-exports.d.ts.map +1 -0
- package/dist/esm/companion-exports.js +32 -0
- package/dist/esm/companion-exports.js.map +1 -0
- package/dist/esm/config/define-tech-doc-config.d.ts +38 -0
- package/dist/esm/config/define-tech-doc-config.d.ts.map +1 -0
- package/dist/esm/config/define-tech-doc-config.js +40 -0
- package/dist/esm/config/define-tech-doc-config.js.map +1 -0
- package/dist/esm/config/index.d.ts +22 -0
- package/dist/esm/config/index.d.ts.map +1 -0
- package/dist/esm/config/index.js +22 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts +204 -0
- package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts.map +1 -0
- package/dist/esm/config/wildo-tech-doc-config.schemas.js +192 -0
- package/dist/esm/config/wildo-tech-doc-config.schemas.js.map +1 -0
- package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.d.ts +82 -0
- package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.d.ts.map +1 -0
- package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.js +114 -0
- package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.js.map +1 -0
- package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts +420 -0
- package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts.map +1 -0
- package/dist/esm/content/application-consumer-documentation-content.techdoc.js +9619 -0
- package/dist/esm/content/application-consumer-documentation-content.techdoc.js.map +1 -0
- package/dist/esm/content.exports.d.ts +9 -0
- package/dist/esm/content.exports.d.ts.map +1 -0
- package/dist/esm/content.exports.js +9 -0
- package/dist/esm/content.exports.js.map +1 -0
- package/dist/esm/index.d.ts +26 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +26 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/openapi/api-reference-link-index.d.ts +98 -0
- package/dist/esm/openapi/api-reference-link-index.d.ts.map +1 -0
- package/dist/esm/openapi/api-reference-link-index.js +301 -0
- package/dist/esm/openapi/api-reference-link-index.js.map +1 -0
- package/dist/esm/openapi/api-reference-targets.d.ts +71 -0
- package/dist/esm/openapi/api-reference-targets.d.ts.map +1 -0
- package/dist/esm/openapi/api-reference-targets.js +114 -0
- package/dist/esm/openapi/api-reference-targets.js.map +1 -0
- package/dist/esm/openapi/index.d.ts +20 -0
- package/dist/esm/openapi/index.d.ts.map +1 -0
- package/dist/esm/openapi/index.js +20 -0
- package/dist/esm/openapi/index.js.map +1 -0
- package/dist/esm/openapi/openapi-generation-output.schemas.d.ts +80 -0
- package/dist/esm/openapi/openapi-generation-output.schemas.d.ts.map +1 -0
- package/dist/esm/openapi/openapi-generation-output.schemas.js +76 -0
- package/dist/esm/openapi/openapi-generation-output.schemas.js.map +1 -0
- package/dist/esm/openapi-reference-model.exports.d.ts +10 -0
- package/dist/esm/openapi-reference-model.exports.d.ts.map +1 -0
- package/dist/esm/openapi-reference-model.exports.js +10 -0
- package/dist/esm/openapi-reference-model.exports.js.map +1 -0
- package/dist/esm/runtime/AuthExchangePage.d.ts +84 -0
- package/dist/esm/runtime/AuthExchangePage.d.ts.map +1 -0
- package/dist/esm/runtime/AuthExchangePage.js +188 -0
- package/dist/esm/runtime/AuthExchangePage.js.map +1 -0
- package/dist/esm/runtime/DocsAuthContext.d.ts +119 -0
- package/dist/esm/runtime/DocsAuthContext.d.ts.map +1 -0
- package/dist/esm/runtime/DocsAuthContext.js +171 -0
- package/dist/esm/runtime/DocsAuthContext.js.map +1 -0
- package/dist/esm/runtime/decode-jwt-claims.d.ts +39 -0
- package/dist/esm/runtime/decode-jwt-claims.d.ts.map +1 -0
- package/dist/esm/runtime/decode-jwt-claims.js +86 -0
- package/dist/esm/runtime/decode-jwt-claims.js.map +1 -0
- package/dist/esm/runtime/docs-auth-client.d.ts +193 -0
- package/dist/esm/runtime/docs-auth-client.d.ts.map +1 -0
- package/dist/esm/runtime/docs-auth-client.js +211 -0
- package/dist/esm/runtime/docs-auth-client.js.map +1 -0
- package/dist/esm/runtime/docs-auth-session.schemas.d.ts +77 -0
- package/dist/esm/runtime/docs-auth-session.schemas.d.ts.map +1 -0
- package/dist/esm/runtime/docs-auth-session.schemas.js +50 -0
- package/dist/esm/runtime/docs-auth-session.schemas.js.map +1 -0
- package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts +17 -0
- package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts.map +1 -0
- package/dist/esm/runtime/frontend-provider-registry.techdoc.js +23 -0
- package/dist/esm/runtime/frontend-provider-registry.techdoc.js.map +1 -0
- package/dist/esm/runtime/index.d.ts +57 -0
- package/dist/esm/runtime/index.d.ts.map +1 -0
- package/dist/esm/runtime/index.js +76 -0
- package/dist/esm/runtime/index.js.map +1 -0
- package/dist/esm/runtime/openapi-reference-conservation.d.ts +20 -0
- package/dist/esm/runtime/openapi-reference-conservation.d.ts.map +1 -0
- package/dist/esm/runtime/openapi-reference-conservation.js +102 -0
- package/dist/esm/runtime/openapi-reference-conservation.js.map +1 -0
- package/dist/esm/runtime/openapi-reference-model.d.ts +224 -0
- package/dist/esm/runtime/openapi-reference-model.d.ts.map +1 -0
- package/dist/esm/runtime/openapi-reference-model.js +579 -0
- package/dist/esm/runtime/openapi-reference-model.js.map +1 -0
- package/dist/esm/runtime/openapi-reference-view.d.ts +13 -0
- package/dist/esm/runtime/openapi-reference-view.d.ts.map +1 -0
- package/dist/esm/runtime/openapi-reference-view.js +284 -0
- package/dist/esm/runtime/openapi-reference-view.js.map +1 -0
- package/dist/esm/runtime/use-docs-auth-session.d.ts +26 -0
- package/dist/esm/runtime/use-docs-auth-session.d.ts.map +1 -0
- package/dist/esm/runtime/use-docs-auth-session.js +34 -0
- package/dist/esm/runtime/use-docs-auth-session.js.map +1 -0
- package/dist/esm/runtime/use-docs-frontend-provider-registry.d.ts +3 -0
- package/dist/esm/runtime/use-docs-frontend-provider-registry.d.ts.map +1 -0
- package/dist/esm/runtime/use-docs-frontend-provider-registry.js +5 -0
- package/dist/esm/runtime/use-docs-frontend-provider-registry.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +117 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Materializes the framework's deterministic PNG stand-in for a product screenshot.
|
|
3
|
+
*
|
|
4
|
+
* Screenshot placeholders and Playwright captures intentionally share one media and
|
|
5
|
+
* path contract: refining provisional documentation changes bytes and evidence at the
|
|
6
|
+
* same `assets/captures/<semantic-ref>.png` URL. The authored description is embedded
|
|
7
|
+
* as UTF-8 PNG metadata while the rendered Markdown/MDX retains the actual image alt.
|
|
8
|
+
*/
|
|
9
|
+
export declare function materializeTechnicalDocumentationPlaceholder(input: {
|
|
10
|
+
readonly assetRef: string;
|
|
11
|
+
readonly altText: string;
|
|
12
|
+
}): {
|
|
13
|
+
readonly bytes: Uint8Array;
|
|
14
|
+
readonly byteDigest: string;
|
|
15
|
+
readonly mediaType: 'image/png';
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=technical-documentation-placeholder-materializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"technical-documentation-placeholder-materializer.d.ts","sourceRoot":"","sources":["../../../../src/companion/technical-documentation-placeholder-materializer.ts"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AACH,wBAAgB,4CAA4C,CAAC,KAAK,EAAE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,GAAG;IACF,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC,CAgCA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { deflateSync } from 'node:zlib';
|
|
2
|
+
import { technicalDocumentationSha256Bytes } from './rendering/technical-documentation-render-model.js';
|
|
3
|
+
const PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
4
|
+
const WIDTH = 720;
|
|
5
|
+
const HEIGHT = 512;
|
|
6
|
+
function crc32(bytes) {
|
|
7
|
+
let crc = 0xffffffff;
|
|
8
|
+
for (const byte of bytes) {
|
|
9
|
+
crc ^= byte;
|
|
10
|
+
for (let bit = 0; bit < 8; bit += 1)
|
|
11
|
+
crc = (crc >>> 1) ^ (0xedb88320 & -(crc & 1));
|
|
12
|
+
}
|
|
13
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
14
|
+
}
|
|
15
|
+
function pngChunk(kind, data) {
|
|
16
|
+
const type = Buffer.from(kind, 'ascii');
|
|
17
|
+
const body = Buffer.from(data);
|
|
18
|
+
const length = Buffer.alloc(4);
|
|
19
|
+
length.writeUInt32BE(body.byteLength);
|
|
20
|
+
const checksum = Buffer.alloc(4);
|
|
21
|
+
checksum.writeUInt32BE(crc32(Buffer.concat([type, body])));
|
|
22
|
+
return Buffer.concat([length, type, body, checksum]);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Materializes the framework's deterministic PNG stand-in for a product screenshot.
|
|
26
|
+
*
|
|
27
|
+
* Screenshot placeholders and Playwright captures intentionally share one media and
|
|
28
|
+
* path contract: refining provisional documentation changes bytes and evidence at the
|
|
29
|
+
* same `assets/captures/<semantic-ref>.png` URL. The authored description is embedded
|
|
30
|
+
* as UTF-8 PNG metadata while the rendered Markdown/MDX retains the actual image alt.
|
|
31
|
+
*/
|
|
32
|
+
export function materializeTechnicalDocumentationPlaceholder(input) {
|
|
33
|
+
const header = Buffer.alloc(13);
|
|
34
|
+
header.writeUInt32BE(WIDTH, 0);
|
|
35
|
+
header.writeUInt32BE(HEIGHT, 4);
|
|
36
|
+
header[8] = 8;
|
|
37
|
+
header[9] = 2;
|
|
38
|
+
const rowLength = 1 + (WIDTH * 3);
|
|
39
|
+
const raster = Buffer.alloc(rowLength * HEIGHT);
|
|
40
|
+
for (let y = 0; y < HEIGHT; y += 1) {
|
|
41
|
+
const rowOffset = y * rowLength;
|
|
42
|
+
raster[rowOffset] = 0;
|
|
43
|
+
for (let x = 0; x < WIDTH; x += 1) {
|
|
44
|
+
const pixelOffset = rowOffset + 1 + (x * 3);
|
|
45
|
+
const border = x < 10 || y < 10 || x >= WIDTH - 10 || y >= HEIGHT - 10;
|
|
46
|
+
const diagonal = Math.abs((x / WIDTH) - (y / HEIGHT)) < 0.012 || Math.abs((1 - (x / WIDTH)) - (y / HEIGHT)) < 0.012;
|
|
47
|
+
const color = border || diagonal ? [113, 113, 122] : [244, 244, 245];
|
|
48
|
+
raster[pixelOffset] = color[0];
|
|
49
|
+
raster[pixelOffset + 1] = color[1];
|
|
50
|
+
raster[pixelOffset + 2] = color[2];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const description = Buffer.from(`Description\0\0\0\0\0Awaiting product capture — ${input.assetRef} — ${input.altText}`, 'utf8');
|
|
54
|
+
const bytes = Buffer.concat([
|
|
55
|
+
PNG_SIGNATURE,
|
|
56
|
+
pngChunk('IHDR', header),
|
|
57
|
+
pngChunk('iTXt', description),
|
|
58
|
+
pngChunk('IDAT', deflateSync(raster, { level: 9 })),
|
|
59
|
+
pngChunk('IEND', Buffer.alloc(0)),
|
|
60
|
+
]);
|
|
61
|
+
return { bytes, byteDigest: technicalDocumentationSha256Bytes(bytes), mediaType: 'image/png' };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=technical-documentation-placeholder-materializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"technical-documentation-placeholder-materializer.js","sourceRoot":"","sources":["../../../../src/companion/techn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CAAC;AACjG,CAAC","sourcesContent":["import { deflateSync } from 'node:zlib';\n\nimport { technicalDocumentationSha256Bytes } from './rendering/technical-documentation-render-model';\n\nconst PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);\nconst WIDTH = 720;\nconst HEIGHT = 512;\n\nfunction crc32(bytes: Uint8Array): number {\n let crc = 0xffffffff;\n for (const byte of bytes) {\n crc ^= byte;\n for (let bit = 0; bit < 8; bit += 1) crc = (crc >>> 1) ^ (0xedb88320 & -(crc & 1));\n }\n return (crc ^ 0xffffffff) >>> 0;\n}\n\nfunction pngChunk(kind: string, data: Uint8Array): Buffer {\n const type = Buffer.from(kind, 'ascii');\n const body = Buffer.from(data);\n const length = Buffer.alloc(4);\n length.writeUInt32BE(body.byteLength);\n const checksum = Buffer.alloc(4);\n checksum.writeUInt32BE(crc32(Buffer.concat([type, body])));\n return Buffer.concat([length, type, body, checksum]);\n}\n\n/**\n * Materializes the framework's deterministic PNG stand-in for a product screenshot.\n *\n * Screenshot placeholders and Playwright captures intentionally share one media and\n * path contract: refining provisional documentation changes bytes and evidence at the\n * same `assets/captures/<semantic-ref>.png` URL. The authored description is embedded\n * as UTF-8 PNG metadata while the rendered Markdown/MDX retains the actual image alt.\n */\nexport function materializeTechnicalDocumentationPlaceholder(input: {\n readonly assetRef: string;\n readonly altText: string;\n}): {\n readonly bytes: Uint8Array;\n readonly byteDigest: string;\n readonly mediaType: 'image/png';\n} {\n const header = Buffer.alloc(13);\n header.writeUInt32BE(WIDTH, 0);\n header.writeUInt32BE(HEIGHT, 4);\n header[8] = 8;\n header[9] = 2;\n\n const rowLength = 1 + (WIDTH * 3);\n const raster = Buffer.alloc(rowLength * HEIGHT);\n for (let y = 0; y < HEIGHT; y += 1) {\n const rowOffset = y * rowLength;\n raster[rowOffset] = 0;\n for (let x = 0; x < WIDTH; x += 1) {\n const pixelOffset = rowOffset + 1 + (x * 3);\n const border = x < 10 || y < 10 || x >= WIDTH - 10 || y >= HEIGHT - 10;\n const diagonal = Math.abs((x / WIDTH) - (y / HEIGHT)) < 0.012 || Math.abs((1 - (x / WIDTH)) - (y / HEIGHT)) < 0.012;\n const color = border || diagonal ? [113, 113, 122] : [244, 244, 245];\n raster[pixelOffset] = color[0];\n raster[pixelOffset + 1] = color[1];\n raster[pixelOffset + 2] = color[2];\n }\n }\n\n const description = Buffer.from(`Description\\0\\0\\0\\0\\0Awaiting product capture — ${input.assetRef} — ${input.altText}`, 'utf8');\n const bytes = Buffer.concat([\n PNG_SIGNATURE,\n pngChunk('IHDR', header),\n pngChunk('iTXt', description),\n pngChunk('IDAT', deflateSync(raster, { level: 9 })),\n pngChunk('IEND', Buffer.alloc(0)),\n ]);\n return { bytes, byteDigest: technicalDocumentationSha256Bytes(bytes), mediaType: 'image/png' };\n}\n\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wildo-package @wildo-ai/saas-technical-doc/companion (Zod helper)
|
|
3
|
+
*
|
|
4
|
+
* Single-purpose helper that converts a (possibly absent) Zod schema
|
|
5
|
+
* into a JSON Schema fragment suitable for splicing into an OpenAPI
|
|
6
|
+
* 3.1 `requestBody.content['application/json'].schema` or
|
|
7
|
+
* `responses.<status>.content['application/json'].schema` slot.
|
|
8
|
+
*
|
|
9
|
+
* # Why this lives in `engine/saas-technical-doc/src/companion/`
|
|
10
|
+
*
|
|
11
|
+
* The OpenAPI generator (`openapi-generator.ts`) consumes
|
|
12
|
+
* `OperationProjection.requestBodySchema` / `responseBodySchema` as
|
|
13
|
+
* opaque `unknown` values that get spliced verbatim into the emitted
|
|
14
|
+
* YAML. The conversion from Zod schema → JSON Schema MUST happen
|
|
15
|
+
* before the projection is handed to the generator (the generator is
|
|
16
|
+
* decorator-framework-free and intentionally does not depend on the
|
|
17
|
+
* caller's Zod runtime).
|
|
18
|
+
*
|
|
19
|
+
* Today every companion behavior that builds an
|
|
20
|
+
* `OpenApiGenerationInput` re-implements this conversion inline. Two
|
|
21
|
+
* problems:
|
|
22
|
+
*
|
|
23
|
+
* 1. Future companion behaviors (e.g. a per-route schema-export
|
|
24
|
+
* command, an SDK-codegen pre-pass, a "show this resource's
|
|
25
|
+
* DTO" debug endpoint) would copy the same five lines of
|
|
26
|
+
* `z.toJSONSchema(...)` boilerplate, forking the trade-off
|
|
27
|
+
* decisions (`null` semantics for absent schemas, `unknown`
|
|
28
|
+
* return type, throw-vs-swallow on conversion failure).
|
|
29
|
+
*
|
|
30
|
+
* 2. The wonder-todos behavior currently buries the helper as a
|
|
31
|
+
* `function` declaration after 300 lines of unrelated projector
|
|
32
|
+
* logic — discoverable only by grepping `toJSONSchema` across
|
|
33
|
+
* the workspace.
|
|
34
|
+
*
|
|
35
|
+
* Promoting the helper to the engine companion subpath gives every
|
|
36
|
+
* future caller one stable import (
|
|
37
|
+
* `import { convertZodSchemaToOpenApiSchema } from
|
|
38
|
+
* '@wildo-ai/saas-technical-doc/companion'`), a single JSDoc
|
|
39
|
+
* authority on the conversion contract, and a unit-tested surface
|
|
40
|
+
* the generator's own tests can rely on indirectly.
|
|
41
|
+
*
|
|
42
|
+
* # Why we don't import from `@wildo-ai/saas-models`
|
|
43
|
+
*
|
|
44
|
+
* Same K-3 boundary the rest of `companion/` honors: the helper
|
|
45
|
+
* imports from `'zod'` directly (the runtime the user app already
|
|
46
|
+
* brings via its DTOs) and never touches `@wildo-ai/saas-models`'s
|
|
47
|
+
* decorator-bootstrapping root barrel.
|
|
48
|
+
*
|
|
49
|
+
* @wildo-boundary
|
|
50
|
+
* This file imports ONLY from `zod` — no React, no
|
|
51
|
+
* `@wildo-ai/saas-models`, no decorator framework. Mirrors the
|
|
52
|
+
* boundary contract of `operation-projection.schemas.ts`.
|
|
53
|
+
*/
|
|
54
|
+
import { z } from 'zod';
|
|
55
|
+
/**
|
|
56
|
+
* Sentinel returned when no schema is present. The OpenAPI generator
|
|
57
|
+
* inspects for `null` to decide whether to omit the `requestBody`
|
|
58
|
+
* block entirely or emit a `204 No Content`-style response — see
|
|
59
|
+
* `openapi-generator.ts` for the consumption rules. Promoting this
|
|
60
|
+
* to a typed null (rather than `undefined`) makes the absence
|
|
61
|
+
* semantics explicit at the wire format and survives the JSON
|
|
62
|
+
* round-trip the introspection subprocess does on the way to the
|
|
63
|
+
* parent companion process.
|
|
64
|
+
*/
|
|
65
|
+
export type OpenApiSchemaFragmentOrNull = unknown | null;
|
|
66
|
+
export declare const convertZodSchemaToOpenApiSchema: (schema: z.ZodSchema<unknown> | undefined) => OpenApiSchemaFragmentOrNull;
|
|
67
|
+
//# sourceMappingURL=zod-to-openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-openapi.d.ts","sourceRoot":"","sources":["../../../../src/companion/zod-to-openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,GAAG,IAAI,CAAC;AA4GzD,eAAO,MAAM,+BAA+B,GAC1C,QAAQ,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,KACvC,2BAqDF,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wildo-package @wildo-ai/saas-technical-doc/companion (Zod helper)
|
|
3
|
+
*
|
|
4
|
+
* Single-purpose helper that converts a (possibly absent) Zod schema
|
|
5
|
+
* into a JSON Schema fragment suitable for splicing into an OpenAPI
|
|
6
|
+
* 3.1 `requestBody.content['application/json'].schema` or
|
|
7
|
+
* `responses.<status>.content['application/json'].schema` slot.
|
|
8
|
+
*
|
|
9
|
+
* # Why this lives in `engine/saas-technical-doc/src/companion/`
|
|
10
|
+
*
|
|
11
|
+
* The OpenAPI generator (`openapi-generator.ts`) consumes
|
|
12
|
+
* `OperationProjection.requestBodySchema` / `responseBodySchema` as
|
|
13
|
+
* opaque `unknown` values that get spliced verbatim into the emitted
|
|
14
|
+
* YAML. The conversion from Zod schema → JSON Schema MUST happen
|
|
15
|
+
* before the projection is handed to the generator (the generator is
|
|
16
|
+
* decorator-framework-free and intentionally does not depend on the
|
|
17
|
+
* caller's Zod runtime).
|
|
18
|
+
*
|
|
19
|
+
* Today every companion behavior that builds an
|
|
20
|
+
* `OpenApiGenerationInput` re-implements this conversion inline. Two
|
|
21
|
+
* problems:
|
|
22
|
+
*
|
|
23
|
+
* 1. Future companion behaviors (e.g. a per-route schema-export
|
|
24
|
+
* command, an SDK-codegen pre-pass, a "show this resource's
|
|
25
|
+
* DTO" debug endpoint) would copy the same five lines of
|
|
26
|
+
* `z.toJSONSchema(...)` boilerplate, forking the trade-off
|
|
27
|
+
* decisions (`null` semantics for absent schemas, `unknown`
|
|
28
|
+
* return type, throw-vs-swallow on conversion failure).
|
|
29
|
+
*
|
|
30
|
+
* 2. The wonder-todos behavior currently buries the helper as a
|
|
31
|
+
* `function` declaration after 300 lines of unrelated projector
|
|
32
|
+
* logic — discoverable only by grepping `toJSONSchema` across
|
|
33
|
+
* the workspace.
|
|
34
|
+
*
|
|
35
|
+
* Promoting the helper to the engine companion subpath gives every
|
|
36
|
+
* future caller one stable import (
|
|
37
|
+
* `import { convertZodSchemaToOpenApiSchema } from
|
|
38
|
+
* '@wildo-ai/saas-technical-doc/companion'`), a single JSDoc
|
|
39
|
+
* authority on the conversion contract, and a unit-tested surface
|
|
40
|
+
* the generator's own tests can rely on indirectly.
|
|
41
|
+
*
|
|
42
|
+
* # Why we don't import from `@wildo-ai/saas-models`
|
|
43
|
+
*
|
|
44
|
+
* Same K-3 boundary the rest of `companion/` honors: the helper
|
|
45
|
+
* imports from `'zod'` directly (the runtime the user app already
|
|
46
|
+
* brings via its DTOs) and never touches `@wildo-ai/saas-models`'s
|
|
47
|
+
* decorator-bootstrapping root barrel.
|
|
48
|
+
*
|
|
49
|
+
* @wildo-boundary
|
|
50
|
+
* This file imports ONLY from `zod` — no React, no
|
|
51
|
+
* `@wildo-ai/saas-models`, no decorator framework. Mirrors the
|
|
52
|
+
* boundary contract of `operation-projection.schemas.ts`.
|
|
53
|
+
*/
|
|
54
|
+
import { z } from 'zod';
|
|
55
|
+
/**
|
|
56
|
+
* Convert an optional Zod schema into a JSON Schema fragment via
|
|
57
|
+
* Zod 4's native `z.toJSONSchema()` API.
|
|
58
|
+
*
|
|
59
|
+
* # Contract
|
|
60
|
+
*
|
|
61
|
+
* - `undefined` input → `null` output. Use this branch for "no
|
|
62
|
+
* body" / "no response payload" semantics. The OpenAPI generator
|
|
63
|
+
* omits the corresponding block.
|
|
64
|
+
* - Non-`undefined` input → result of `z.toJSONSchema(schema)`.
|
|
65
|
+
* Even an empty `z.object({})` produces a defined fragment;
|
|
66
|
+
* callers that want to express "empty object body" should pass
|
|
67
|
+
* the empty object schema explicitly.
|
|
68
|
+
*
|
|
69
|
+
* # Date handling
|
|
70
|
+
*
|
|
71
|
+
* `Date` has no native JSON Schema / OpenAPI 3.1 type, so Zod 4's
|
|
72
|
+
* `z.toJSONSchema()` throws on it by default (`"Date cannot be
|
|
73
|
+
* represented in JSON Schema"`). Resource DTOs are full of date fields
|
|
74
|
+
* (`createdAt`, `updatedAt`, `dueDate`, …), so the default behavior
|
|
75
|
+
* makes OpenAPI generation impossible for any realistic app. We map
|
|
76
|
+
* `Date` to its honest on-the-wire form — an ISO-8601 `string` with
|
|
77
|
+
* `format: 'date-time'` — via the `override` hook below.
|
|
78
|
+
*
|
|
79
|
+
* # Default handling (dynamic date defaults are dropped)
|
|
80
|
+
*
|
|
81
|
+
* The framework stamps audit fields with `z.date().default(() => new Date())`
|
|
82
|
+
* (`createdAt` / `updatedAt` on essentially every resource). `z.toJSONSchema()`
|
|
83
|
+
* serialises ONE evaluation of that default into the JSON-Schema `default:`
|
|
84
|
+
* keyword — and because Zod's `def.defaultValue` is a getter that RE-INVOKES
|
|
85
|
+
* `() => new Date()` on every read, each per-operation conversion bakes a
|
|
86
|
+
* DIFFERENT "now" into the docs. That is wrong on two counts, so the `override`
|
|
87
|
+
* hook strips it (leaving the honest `string` / `date-time` shape intact):
|
|
88
|
+
*
|
|
89
|
+
* 1. **Determinism.** Volatile timestamps break byte-stable regeneration —
|
|
90
|
+
* the generator's K-4 contract (`openapi-generator.ts`): unchanged input
|
|
91
|
+
* ⇒ byte-identical YAML. Without the strip, dozens of `default:` values
|
|
92
|
+
* churn on every publish.
|
|
93
|
+
* 2. **Semantics.** These fields are `.excludeFromCreate().excludeFromUpdate()`
|
|
94
|
+
* (server-populated, never client-supplied), so a documented `default:` is
|
|
95
|
+
* meaningless on a request body (the field is absent) and on a response
|
|
96
|
+
* body (the server always sends a real value). A "now" default is a
|
|
97
|
+
* write-time server stamp, not a client-facing API constant.
|
|
98
|
+
*
|
|
99
|
+
* The strip is keyed on the RESOLVED default VALUE being a `Date` (not the
|
|
100
|
+
* inner Zod type) so every wrapper ordering is covered (`.default()`,
|
|
101
|
+
* `.optional().default()`, `.nullable().default()`, `.min(...).default()` all
|
|
102
|
+
* resolve to a Date). STATIC / stable defaults — `'draft'`, `0`, a
|
|
103
|
+
* fresh-container `() => ({})` — are documentable constants and are preserved.
|
|
104
|
+
*
|
|
105
|
+
* # Failure mode
|
|
106
|
+
*
|
|
107
|
+
* Mapping `Date` requires `unrepresentable: 'any'` (Zod's
|
|
108
|
+
* `unrepresentable` flag is global, and the `override` hook runs only
|
|
109
|
+
* AFTER the per-node processor, so with the default `'throw'` the date
|
|
110
|
+
* node throws before the override can rewrite it). `'any'` would
|
|
111
|
+
* otherwise let EVERY unrepresentable type silently degrade to an open
|
|
112
|
+
* `{}` schema — exactly the "silently-partial OpenAPI doc" this helper
|
|
113
|
+
* was written to avoid. So the override RE-IMPOSES fail-loud for the
|
|
114
|
+
* genuinely non-serialisable Zod types (raw transforms, symbols,
|
|
115
|
+
* functions, maps, sets, bigints, …) — see
|
|
116
|
+
* `UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES`. The throw propagates verbatim
|
|
117
|
+
* so the companion HTTP response surfaces the real failure (which
|
|
118
|
+
* resource / operation / DTO) instead of producing a partial document.
|
|
119
|
+
*
|
|
120
|
+
* # Why this helper exists rather than inlining `z.toJSONSchema`
|
|
121
|
+
*
|
|
122
|
+
* Three reasons:
|
|
123
|
+
*
|
|
124
|
+
* 1. Encodes the `undefined → null` mapping that the
|
|
125
|
+
* `OperationProjectionSchema` wire format requires (the schema
|
|
126
|
+
* types `requestBodySchema` / `responseBodySchema` as
|
|
127
|
+
* `z.unknown().nullable()` — a stray `undefined` would fail the
|
|
128
|
+
* Zod parse on the parent process side after the JSON
|
|
129
|
+
* round-trip drops the field entirely).
|
|
130
|
+
* 2. Returns the `unknown` type the projection contract uses,
|
|
131
|
+
* saving every caller from a redundant cast.
|
|
132
|
+
* 3. Provides a single doc anchor for future "what does the
|
|
133
|
+
* generator do with this output" questions — search-discoverable
|
|
134
|
+
* by helper name rather than spread across copies of
|
|
135
|
+
* `z.toJSONSchema(...)` in every companion behavior.
|
|
136
|
+
*/
|
|
137
|
+
/**
|
|
138
|
+
* Zod `def.type` values that have NO honest OpenAPI 3.1 representation
|
|
139
|
+
* and must therefore fail loud rather than degrade to an open `{}`
|
|
140
|
+
* schema.
|
|
141
|
+
*
|
|
142
|
+
* Keyed by `def.type` — the same discriminant `z.toJSONSchema()`
|
|
143
|
+
* dispatches on internally (`ctx.processors[def.type]`). `date` and
|
|
144
|
+
* `bigint` are deliberately ABSENT: both ARE representable on the wire
|
|
145
|
+
* (`date` → ISO-8601 `string`; `bigint` → 64-bit `integer`, the shape
|
|
146
|
+
* `z_money` amounts use) and are remapped in the `override` hook. If a
|
|
147
|
+
* future Zod release adds a new unrepresentable type, add its `def.type`
|
|
148
|
+
* here in the same change so generation keeps failing loud on it.
|
|
149
|
+
*/
|
|
150
|
+
const UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES = new Set([
|
|
151
|
+
'symbol',
|
|
152
|
+
'undefined',
|
|
153
|
+
'void',
|
|
154
|
+
'custom',
|
|
155
|
+
'function',
|
|
156
|
+
'transform',
|
|
157
|
+
'map',
|
|
158
|
+
'set',
|
|
159
|
+
]);
|
|
160
|
+
export const convertZodSchemaToOpenApiSchema = (schema) => {
|
|
161
|
+
if (!schema)
|
|
162
|
+
return null;
|
|
163
|
+
return z.toJSONSchema(schema, {
|
|
164
|
+
// `'any'` suppresses the built-in throw for unrepresentable types
|
|
165
|
+
// so the `override` below can remap `Date` → `string`/`date-time`.
|
|
166
|
+
// Fail-loud for the genuinely non-serialisable types is re-imposed
|
|
167
|
+
// in the override (see UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES).
|
|
168
|
+
unrepresentable: 'any',
|
|
169
|
+
override: (ctx) => {
|
|
170
|
+
const def = ctx.zodSchema._zod.def;
|
|
171
|
+
const defType = def.type;
|
|
172
|
+
if (defType === 'date') {
|
|
173
|
+
ctx.jsonSchema.type = 'string';
|
|
174
|
+
ctx.jsonSchema.format = 'date-time';
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
// Drop a dynamic date default (`z.date().default(() => new Date())`) — a
|
|
178
|
+
// write-time server stamp that `z.toJSONSchema()` bakes as a volatile
|
|
179
|
+
// "now" into `default:`, breaking byte-stable regeneration and misdocu-
|
|
180
|
+
// menting a server-populated field. Keyed on the RESOLVED value being a
|
|
181
|
+
// `Date` so every wrapper ordering is covered; static / stable defaults
|
|
182
|
+
// (`'draft'`, `0`, `() => ({})`) are preserved. See the "# Default
|
|
183
|
+
// handling" section on this helper for the full rationale.
|
|
184
|
+
if (defType === 'default'
|
|
185
|
+
&& 'default' in ctx.jsonSchema
|
|
186
|
+
&& def.defaultValue instanceof Date) {
|
|
187
|
+
delete ctx.jsonSchema.default;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (defType === 'bigint') {
|
|
191
|
+
// `bigint` is the framework's money/large-integer storage type
|
|
192
|
+
// (`z_money` amounts are minor-unit cents as bigint). It IS
|
|
193
|
+
// representable: a 64-bit integer. `format: 'int64'` is the OpenAPI
|
|
194
|
+
// convention for a value that may exceed JS Number safe-integer range
|
|
195
|
+
// and is therefore frequently string-encoded on the wire — codegen
|
|
196
|
+
// tooling handles int64 specially. Honest, and never an open `{}`.
|
|
197
|
+
ctx.jsonSchema.type = 'integer';
|
|
198
|
+
ctx.jsonSchema.format = 'int64';
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES.has(defType)) {
|
|
202
|
+
const where = ctx.path.length > 0 ? ctx.path.join('.') : '<root>';
|
|
203
|
+
throw new Error(`convertZodSchemaToOpenApiSchema: Zod type "${defType}" at "${where}" has no `
|
|
204
|
+
+ 'OpenAPI 3.1 representation. Expose a serialisable shape on the operation DTO, '
|
|
205
|
+
+ 'or exclude the field from the API surface — emitting an open "{}" schema here '
|
|
206
|
+
+ 'would silently ship a misleading API document.');
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=zod-to-openapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod-to-openapi.js","sourceRoot":"","sources":["../../../../src/companion/zod-to-openapi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AACH;;;;;;;;;;;;GAYG;AACH,MAAM,mCAAmC,GAAwB,IAAI,GAAG,CAAC;IACvE,QAAQ;IACR,WAAW;IACX,MAAM;IACN,QAAQ;IACR,UAAU;IACV,WAAW;IACX,KAAK;IACL,KAAK;CACN,CAAC,CAAC;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K,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAClE,MAAM,IAAI,KAAK,CACb,8CAA8C,OAAO,SAAS,KAAK,WAAW;sBAC5E,gFAAgF;sBAChF,gFAAgF;sBAChF,gDAAgD,CACnD,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["/**\n * @wildo-package @wildo-ai/saas-technical-doc/companion (Zod helper)\n *\n * Single-purpose helper that converts a (possibly absent) Zod schema\n * into a JSON Schema fragment suitable for splicing into an OpenAPI\n * 3.1 `requestBody.content['application/json'].schema` or\n * `responses.<status>.content['application/json'].schema` slot.\n *\n * # Why this lives in `engine/saas-technical-doc/src/companion/`\n *\n * The OpenAPI generator (`openapi-generator.ts`) consumes\n * `OperationProjection.requestBodySchema` / `responseBodySchema` as\n * opaque `unknown` values that get spliced verbatim into the emitted\n * YAML. The conversion from Zod schema → JSON Schema MUST happen\n * before the projection is handed to the generator (the generator is\n * decorator-framework-free and intentionally does not depend on the\n * caller's Zod runtime).\n *\n * Today every companion behavior that builds an\n * `OpenApiGenerationInput` re-implements this conversion inline. Two\n * problems:\n *\n * 1. Future companion behaviors (e.g. a per-route schema-export\n * command, an SDK-codegen pre-pass, a \"show this resource's\n * DTO\" debug endpoint) would copy the same five lines of\n * `z.toJSONSchema(...)` boilerplate, forking the trade-off\n * decisions (`null` semantics for absent schemas, `unknown`\n * return type, throw-vs-swallow on conversion failure).\n *\n * 2. The wonder-todos behavior currently buries the helper as a\n * `function` declaration after 300 lines of unrelated projector\n * logic — discoverable only by grepping `toJSONSchema` across\n * the workspace.\n *\n * Promoting the helper to the engine companion subpath gives every\n * future caller one stable import (\n * `import { convertZodSchemaToOpenApiSchema } from\n * '@wildo-ai/saas-technical-doc/companion'`), a single JSDoc\n * authority on the conversion contract, and a unit-tested surface\n * the generator's own tests can rely on indirectly.\n *\n * # Why we don't import from `@wildo-ai/saas-models`\n *\n * Same K-3 boundary the rest of `companion/` honors: the helper\n * imports from `'zod'` directly (the runtime the user app already\n * brings via its DTOs) and never touches `@wildo-ai/saas-models`'s\n * decorator-bootstrapping root barrel.\n *\n * @wildo-boundary\n * This file imports ONLY from `zod` — no React, no\n * `@wildo-ai/saas-models`, no decorator framework. Mirrors the\n * boundary contract of `operation-projection.schemas.ts`.\n */\n\nimport { z } from 'zod';\n\n/**\n * Sentinel returned when no schema is present. The OpenAPI generator\n * inspects for `null` to decide whether to omit the `requestBody`\n * block entirely or emit a `204 No Content`-style response — see\n * `openapi-generator.ts` for the consumption rules. Promoting this\n * to a typed null (rather than `undefined`) makes the absence\n * semantics explicit at the wire format and survives the JSON\n * round-trip the introspection subprocess does on the way to the\n * parent companion process.\n */\nexport type OpenApiSchemaFragmentOrNull = unknown | null;\n\n/**\n * Convert an optional Zod schema into a JSON Schema fragment via\n * Zod 4's native `z.toJSONSchema()` API.\n *\n * # Contract\n *\n * - `undefined` input → `null` output. Use this branch for \"no\n * body\" / \"no response payload\" semantics. The OpenAPI generator\n * omits the corresponding block.\n * - Non-`undefined` input → result of `z.toJSONSchema(schema)`.\n * Even an empty `z.object({})` produces a defined fragment;\n * callers that want to express \"empty object body\" should pass\n * the empty object schema explicitly.\n *\n * # Date handling\n *\n * `Date` has no native JSON Schema / OpenAPI 3.1 type, so Zod 4's\n * `z.toJSONSchema()` throws on it by default (`\"Date cannot be\n * represented in JSON Schema\"`). Resource DTOs are full of date fields\n * (`createdAt`, `updatedAt`, `dueDate`, …), so the default behavior\n * makes OpenAPI generation impossible for any realistic app. We map\n * `Date` to its honest on-the-wire form — an ISO-8601 `string` with\n * `format: 'date-time'` — via the `override` hook below.\n *\n * # Default handling (dynamic date defaults are dropped)\n *\n * The framework stamps audit fields with `z.date().default(() => new Date())`\n * (`createdAt` / `updatedAt` on essentially every resource). `z.toJSONSchema()`\n * serialises ONE evaluation of that default into the JSON-Schema `default:`\n * keyword — and because Zod's `def.defaultValue` is a getter that RE-INVOKES\n * `() => new Date()` on every read, each per-operation conversion bakes a\n * DIFFERENT \"now\" into the docs. That is wrong on two counts, so the `override`\n * hook strips it (leaving the honest `string` / `date-time` shape intact):\n *\n * 1. **Determinism.** Volatile timestamps break byte-stable regeneration —\n * the generator's K-4 contract (`openapi-generator.ts`): unchanged input\n * ⇒ byte-identical YAML. Without the strip, dozens of `default:` values\n * churn on every publish.\n * 2. **Semantics.** These fields are `.excludeFromCreate().excludeFromUpdate()`\n * (server-populated, never client-supplied), so a documented `default:` is\n * meaningless on a request body (the field is absent) and on a response\n * body (the server always sends a real value). A \"now\" default is a\n * write-time server stamp, not a client-facing API constant.\n *\n * The strip is keyed on the RESOLVED default VALUE being a `Date` (not the\n * inner Zod type) so every wrapper ordering is covered (`.default()`,\n * `.optional().default()`, `.nullable().default()`, `.min(...).default()` all\n * resolve to a Date). STATIC / stable defaults — `'draft'`, `0`, a\n * fresh-container `() => ({})` — are documentable constants and are preserved.\n *\n * # Failure mode\n *\n * Mapping `Date` requires `unrepresentable: 'any'` (Zod's\n * `unrepresentable` flag is global, and the `override` hook runs only\n * AFTER the per-node processor, so with the default `'throw'` the date\n * node throws before the override can rewrite it). `'any'` would\n * otherwise let EVERY unrepresentable type silently degrade to an open\n * `{}` schema — exactly the \"silently-partial OpenAPI doc\" this helper\n * was written to avoid. So the override RE-IMPOSES fail-loud for the\n * genuinely non-serialisable Zod types (raw transforms, symbols,\n * functions, maps, sets, bigints, …) — see\n * `UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES`. The throw propagates verbatim\n * so the companion HTTP response surfaces the real failure (which\n * resource / operation / DTO) instead of producing a partial document.\n *\n * # Why this helper exists rather than inlining `z.toJSONSchema`\n *\n * Three reasons:\n *\n * 1. Encodes the `undefined → null` mapping that the\n * `OperationProjectionSchema` wire format requires (the schema\n * types `requestBodySchema` / `responseBodySchema` as\n * `z.unknown().nullable()` — a stray `undefined` would fail the\n * Zod parse on the parent process side after the JSON\n * round-trip drops the field entirely).\n * 2. Returns the `unknown` type the projection contract uses,\n * saving every caller from a redundant cast.\n * 3. Provides a single doc anchor for future \"what does the\n * generator do with this output\" questions — search-discoverable\n * by helper name rather than spread across copies of\n * `z.toJSONSchema(...)` in every companion behavior.\n */\n/**\n * Zod `def.type` values that have NO honest OpenAPI 3.1 representation\n * and must therefore fail loud rather than degrade to an open `{}`\n * schema.\n *\n * Keyed by `def.type` — the same discriminant `z.toJSONSchema()`\n * dispatches on internally (`ctx.processors[def.type]`). `date` and\n * `bigint` are deliberately ABSENT: both ARE representable on the wire\n * (`date` → ISO-8601 `string`; `bigint` → 64-bit `integer`, the shape\n * `z_money` amounts use) and are remapped in the `override` hook. If a\n * future Zod release adds a new unrepresentable type, add its `def.type`\n * here in the same change so generation keeps failing loud on it.\n */\nconst UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES: ReadonlySet<string> = new Set([\n 'symbol',\n 'undefined',\n 'void',\n 'custom',\n 'function',\n 'transform',\n 'map',\n 'set',\n]);\n\nexport const convertZodSchemaToOpenApiSchema = (\n schema: z.ZodSchema<unknown> | undefined,\n): OpenApiSchemaFragmentOrNull => {\n if (!schema) return null;\n return z.toJSONSchema(schema, {\n // `'any'` suppresses the built-in throw for unrepresentable types\n // so the `override` below can remap `Date` → `string`/`date-time`.\n // Fail-loud for the genuinely non-serialisable types is re-imposed\n // in the override (see UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES).\n unrepresentable: 'any',\n override: (ctx) => {\n const def = ctx.zodSchema._zod.def;\n const defType = def.type;\n if (defType === 'date') {\n ctx.jsonSchema.type = 'string';\n ctx.jsonSchema.format = 'date-time';\n return;\n }\n // Drop a dynamic date default (`z.date().default(() => new Date())`) — a\n // write-time server stamp that `z.toJSONSchema()` bakes as a volatile\n // \"now\" into `default:`, breaking byte-stable regeneration and misdocu-\n // menting a server-populated field. Keyed on the RESOLVED value being a\n // `Date` so every wrapper ordering is covered; static / stable defaults\n // (`'draft'`, `0`, `() => ({})`) are preserved. See the \"# Default\n // handling\" section on this helper for the full rationale.\n if (\n defType === 'default'\n && 'default' in ctx.jsonSchema\n && (def as { defaultValue?: unknown }).defaultValue instanceof Date\n ) {\n delete ctx.jsonSchema.default;\n return;\n }\n if (defType === 'bigint') {\n // `bigint` is the framework's money/large-integer storage type\n // (`z_money` amounts are minor-unit cents as bigint). It IS\n // representable: a 64-bit integer. `format: 'int64'` is the OpenAPI\n // convention for a value that may exceed JS Number safe-integer range\n // and is therefore frequently string-encoded on the wire — codegen\n // tooling handles int64 specially. Honest, and never an open `{}`.\n ctx.jsonSchema.type = 'integer';\n ctx.jsonSchema.format = 'int64';\n return;\n }\n if (UNREPRESENTABLE_FAIL_LOUD_DEF_TYPES.has(defType)) {\n const where = ctx.path.length > 0 ? ctx.path.join('.') : '<root>';\n throw new Error(\n `convertZodSchemaToOpenApiSchema: Zod type \"${defType}\" at \"${where}\" has no `\n + 'OpenAPI 3.1 representation. Expose a serialisable shape on the operation DTO, '\n + 'or exclude the field from the API surface — emitting an open \"{}\" schema here '\n + 'would silently ship a misleading API document.',\n );\n }\n },\n });\n};\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wildo-package @wildo-ai/saas-technical-doc (companion entry)
|
|
3
|
+
*
|
|
4
|
+
* Narrow, React-free entry point for companion-side OpenAPI generation and
|
|
5
|
+
* exact engine-owned application-consumer documentation content.
|
|
6
|
+
* Consumed by:
|
|
7
|
+
* - `examples/<app>/.wildo-saas/wildo-dev-companion/` companion controllers
|
|
8
|
+
* that walk the app's resource definitions and emit
|
|
9
|
+
* the normal and application-administration YAML/JSON OpenAPI documents.
|
|
10
|
+
*
|
|
11
|
+
* @wildo-boundary
|
|
12
|
+
* This file MUST re-export ONLY from `./companion/**` and the shared
|
|
13
|
+
* schemas under `./openapi/**`.
|
|
14
|
+
* It MUST NOT import or re-export anything from:
|
|
15
|
+
* - `./runtime/**` (React + DOM + fetch — browser-only).
|
|
16
|
+
* It MUST NOT import React or `react-dom`.
|
|
17
|
+
*
|
|
18
|
+
* Enforced by review until a programmatic boundary lint lands (cf.
|
|
19
|
+
* the equivalent rule in `engine/saas-website/src/companion-exports.ts`).
|
|
20
|
+
*
|
|
21
|
+
* The companion surface ships
|
|
22
|
+
* `OperationProjectionSchema` (input contract), `OpenApiGenerationInputSchema`
|
|
23
|
+
* (top-level wire format), and the pure-function `generateOpenApiDocuments`
|
|
24
|
+
* entry point that produces the `OpenApiGenerationOutput` declared in
|
|
25
|
+
* `./openapi/`. It also ships the verified application-consumer content
|
|
26
|
+
* loader and the reusable framework projection/rendering pipeline. Reusable
|
|
27
|
+
* authored content and its portable identity contracts live behind `./content`;
|
|
28
|
+
* the browser runtime remains isolated behind `./runtime`.
|
|
29
|
+
*/
|
|
30
|
+
export * from './openapi/index';
|
|
31
|
+
export * from './companion/index';
|
|
32
|
+
//# sourceMappingURL=companion-exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-exports.d.ts","sourceRoot":"","sources":["../../../src/companion-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wildo-package @wildo-ai/saas-technical-doc (companion entry)
|
|
3
|
+
*
|
|
4
|
+
* Narrow, React-free entry point for companion-side OpenAPI generation and
|
|
5
|
+
* exact engine-owned application-consumer documentation content.
|
|
6
|
+
* Consumed by:
|
|
7
|
+
* - `examples/<app>/.wildo-saas/wildo-dev-companion/` companion controllers
|
|
8
|
+
* that walk the app's resource definitions and emit
|
|
9
|
+
* the normal and application-administration YAML/JSON OpenAPI documents.
|
|
10
|
+
*
|
|
11
|
+
* @wildo-boundary
|
|
12
|
+
* This file MUST re-export ONLY from `./companion/**` and the shared
|
|
13
|
+
* schemas under `./openapi/**`.
|
|
14
|
+
* It MUST NOT import or re-export anything from:
|
|
15
|
+
* - `./runtime/**` (React + DOM + fetch — browser-only).
|
|
16
|
+
* It MUST NOT import React or `react-dom`.
|
|
17
|
+
*
|
|
18
|
+
* Enforced by review until a programmatic boundary lint lands (cf.
|
|
19
|
+
* the equivalent rule in `engine/saas-website/src/companion-exports.ts`).
|
|
20
|
+
*
|
|
21
|
+
* The companion surface ships
|
|
22
|
+
* `OperationProjectionSchema` (input contract), `OpenApiGenerationInputSchema`
|
|
23
|
+
* (top-level wire format), and the pure-function `generateOpenApiDocuments`
|
|
24
|
+
* entry point that produces the `OpenApiGenerationOutput` declared in
|
|
25
|
+
* `./openapi/`. It also ships the verified application-consumer content
|
|
26
|
+
* loader and the reusable framework projection/rendering pipeline. Reusable
|
|
27
|
+
* authored content and its portable identity contracts live behind `./content`;
|
|
28
|
+
* the browser runtime remains isolated behind `./runtime`.
|
|
29
|
+
*/
|
|
30
|
+
export * from './openapi/index.js';
|
|
31
|
+
export * from './companion/index.js';
|
|
32
|
+
//# sourceMappingURL=companion-exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-exports.js","sourceRoot":"","sources":["../../../src/companion-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC","sourcesContent":["/**\n * @wildo-package @wildo-ai/saas-technical-doc (companion entry)\n *\n * Narrow, React-free entry point for companion-side OpenAPI generation and\n * exact engine-owned application-consumer documentation content.\n * Consumed by:\n * - `examples/<app>/.wildo-saas/wildo-dev-companion/` companion controllers\n * that walk the app's resource definitions and emit\n * the normal and application-administration YAML/JSON OpenAPI documents.\n *\n * @wildo-boundary\n * This file MUST re-export ONLY from `./companion/**` and the shared\n * schemas under `./openapi/**`.\n * It MUST NOT import or re-export anything from:\n * - `./runtime/**` (React + DOM + fetch — browser-only).\n * It MUST NOT import React or `react-dom`.\n *\n * Enforced by review until a programmatic boundary lint lands (cf.\n * the equivalent rule in `engine/saas-website/src/companion-exports.ts`).\n *\n * The companion surface ships\n * `OperationProjectionSchema` (input contract), `OpenApiGenerationInputSchema`\n * (top-level wire format), and the pure-function `generateOpenApiDocuments`\n * entry point that produces the `OpenApiGenerationOutput` declared in\n * `./openapi/`. It also ships the verified application-consumer content\n * loader and the reusable framework projection/rendering pipeline. Reusable\n * authored content and its portable identity contracts live behind `./content`;\n * the browser runtime remains isolated behind `./runtime`.\n */\n\nexport * from './openapi/index';\nexport * from './companion/index';\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Author helper for `wildo.tech-doc.config.ts` files.
|
|
3
|
+
*
|
|
4
|
+
* `defineTechnicalDocConfig({...})` mirrors the `defineSaasConfig` /
|
|
5
|
+
* `defineInfraEnvConfig` helpers from `@wildo-ai/platform-config-lib`:
|
|
6
|
+
* it wraps `WildoTechnicalDocConfigSchema.parse(...)` with full IDE
|
|
7
|
+
* autocompletion on the input shape and runs Zod validation
|
|
8
|
+
* (fail-closed on typos / unknown keys / out-of-range values).
|
|
9
|
+
*
|
|
10
|
+
* As of `auth-hardening.md` Slice B B-Step 1 + B-Step 3 (shipped
|
|
11
|
+
* 2026-04-19), every documented field on `WildoTechnicalDocConfig`
|
|
12
|
+
* has a real runtime consumer (`csp?` flows through the build-time
|
|
13
|
+
* generator at `platform-config-lib/src/project-config/shared/csp-emit.ts`).
|
|
14
|
+
* The previous `@unimplemented` warner was retired in the same commit;
|
|
15
|
+
* if a future field lands here without a consumer, re-introduce the
|
|
16
|
+
* warner pattern from the git history of this file (commits before
|
|
17
|
+
* the Slice B B-Step 1 landing).
|
|
18
|
+
*/
|
|
19
|
+
import { type WildoTechnicalDocConfig, type WildoTechnicalDocConfigInput } from './wildo-tech-doc-config.schemas';
|
|
20
|
+
/**
|
|
21
|
+
* Define a per-service technical-documentation config. Provides full
|
|
22
|
+
* IDE autocompletion on the input shape and runs Zod validation
|
|
23
|
+
* (fail-closed on typos / unknown keys / out-of-range values).
|
|
24
|
+
*
|
|
25
|
+
* Throws on validation failure — same contract as `defineSaasConfig`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { defineTechnicalDocConfig } from '@wildo-ai/saas-technical-doc';
|
|
30
|
+
*
|
|
31
|
+
* export default defineTechnicalDocConfig({
|
|
32
|
+
* supportedApiVersion: '1.0.0',
|
|
33
|
+
* publicMarketingTitle: 'Wonder Todos — Technical Documentation',
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function defineTechnicalDocConfig(config: WildoTechnicalDocConfigInput): WildoTechnicalDocConfig;
|
|
38
|
+
//# sourceMappingURL=define-tech-doc-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-tech-doc-config.d.ts","sourceRoot":"","sources":["../../../../src/config/define-tech-doc-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EAClC,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,4BAA4B,GACnC,uBAAuB,CAEzB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Author helper for `wildo.tech-doc.config.ts` files.
|
|
3
|
+
*
|
|
4
|
+
* `defineTechnicalDocConfig({...})` mirrors the `defineSaasConfig` /
|
|
5
|
+
* `defineInfraEnvConfig` helpers from `@wildo-ai/platform-config-lib`:
|
|
6
|
+
* it wraps `WildoTechnicalDocConfigSchema.parse(...)` with full IDE
|
|
7
|
+
* autocompletion on the input shape and runs Zod validation
|
|
8
|
+
* (fail-closed on typos / unknown keys / out-of-range values).
|
|
9
|
+
*
|
|
10
|
+
* As of `auth-hardening.md` Slice B B-Step 1 + B-Step 3 (shipped
|
|
11
|
+
* 2026-04-19), every documented field on `WildoTechnicalDocConfig`
|
|
12
|
+
* has a real runtime consumer (`csp?` flows through the build-time
|
|
13
|
+
* generator at `platform-config-lib/src/project-config/shared/csp-emit.ts`).
|
|
14
|
+
* The previous `@unimplemented` warner was retired in the same commit;
|
|
15
|
+
* if a future field lands here without a consumer, re-introduce the
|
|
16
|
+
* warner pattern from the git history of this file (commits before
|
|
17
|
+
* the Slice B B-Step 1 landing).
|
|
18
|
+
*/
|
|
19
|
+
import { WildoTechnicalDocConfigSchema, } from './wildo-tech-doc-config.schemas.js';
|
|
20
|
+
/**
|
|
21
|
+
* Define a per-service technical-documentation config. Provides full
|
|
22
|
+
* IDE autocompletion on the input shape and runs Zod validation
|
|
23
|
+
* (fail-closed on typos / unknown keys / out-of-range values).
|
|
24
|
+
*
|
|
25
|
+
* Throws on validation failure — same contract as `defineSaasConfig`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { defineTechnicalDocConfig } from '@wildo-ai/saas-technical-doc';
|
|
30
|
+
*
|
|
31
|
+
* export default defineTechnicalDocConfig({
|
|
32
|
+
* supportedApiVersion: '1.0.0',
|
|
33
|
+
* publicMarketingTitle: 'Wonder Todos — Technical Documentation',
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function defineTechnicalDocConfig(config) {
|
|
38
|
+
return WildoTechnicalDocConfigSchema.parse(config);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=define-tech-doc-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-tech-doc-config.js","sourceRoot":"","sources":["../../../../src/config/define-tech-doc-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,6BAA6B,GAG9B,MAAM,iCAAiC,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,wBAAwB,CACtC,MAAoC;IAEpC,OAAO,6BAA6B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * @fileoverview Author helper for `wildo.tech-doc.config.ts` files.\n *\n * `defineTechnicalDocConfig({...})` mirrors the `defineSaasConfig` /\n * `defineInfraEnvConfig` helpers from `@wildo-ai/platform-config-lib`:\n * it wraps `WildoTechnicalDocConfigSchema.parse(...)` with full IDE\n * autocompletion on the input shape and runs Zod validation\n * (fail-closed on typos / unknown keys / out-of-range values).\n *\n * As of `auth-hardening.md` Slice B B-Step 1 + B-Step 3 (shipped\n * 2026-04-19), every documented field on `WildoTechnicalDocConfig`\n * has a real runtime consumer (`csp?` flows through the build-time\n * generator at `platform-config-lib/src/project-config/shared/csp-emit.ts`).\n * The previous `@unimplemented` warner was retired in the same commit;\n * if a future field lands here without a consumer, re-introduce the\n * warner pattern from the git history of this file (commits before\n * the Slice B B-Step 1 landing).\n */\n\nimport {\n WildoTechnicalDocConfigSchema,\n type WildoTechnicalDocConfig,\n type WildoTechnicalDocConfigInput,\n} from './wildo-tech-doc-config.schemas';\n\n/**\n * Define a per-service technical-documentation config. Provides full\n * IDE autocompletion on the input shape and runs Zod validation\n * (fail-closed on typos / unknown keys / out-of-range values).\n *\n * Throws on validation failure — same contract as `defineSaasConfig`.\n *\n * @example\n * ```ts\n * import { defineTechnicalDocConfig } from '@wildo-ai/saas-technical-doc';\n *\n * export default defineTechnicalDocConfig({\n * supportedApiVersion: '1.0.0',\n * publicMarketingTitle: 'Wonder Todos — Technical Documentation',\n * });\n * ```\n */\nexport function defineTechnicalDocConfig(\n config: WildoTechnicalDocConfigInput,\n): WildoTechnicalDocConfig {\n return WildoTechnicalDocConfigSchema.parse(config);\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wildo-ai/saas-technical-doc` — config surface.
|
|
3
|
+
*
|
|
4
|
+
* Per-service `wildo.tech-doc.config.ts` schema + `defineTechnicalDocConfig`
|
|
5
|
+
* helper. Co-located with the engine package that owns the recipe
|
|
6
|
+
* registry + OpenAPI generator so a new base recipe ships in a single
|
|
7
|
+
* PR with no cross-package allow-list to keep in sync (see
|
|
8
|
+
* `wildo-tech-doc-config.schemas.ts` JSDoc for the architectural
|
|
9
|
+
* rationale behind moving this out of `platform-config-lib`).
|
|
10
|
+
*
|
|
11
|
+
* @wildo-boundary
|
|
12
|
+
* This sub-tree is Node-side only (the `defineTechnicalDocConfig`
|
|
13
|
+
* helper writes to `process.stderr` via the `@unimplemented`
|
|
14
|
+
* warner). It MUST NOT be imported from `../runtime/**` or any
|
|
15
|
+
* browser-bundled code path. The Docusaurus build at the app
|
|
16
|
+
* level loads the per-service `wildo.tech-doc.config.ts` via the
|
|
17
|
+
* companion or via a Node-side helper, NEVER from the rendered
|
|
18
|
+
* docs bundle.
|
|
19
|
+
*/
|
|
20
|
+
export * from './define-tech-doc-config';
|
|
21
|
+
export * from './wildo-tech-doc-config.schemas';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wildo-ai/saas-technical-doc` — config surface.
|
|
3
|
+
*
|
|
4
|
+
* Per-service `wildo.tech-doc.config.ts` schema + `defineTechnicalDocConfig`
|
|
5
|
+
* helper. Co-located with the engine package that owns the recipe
|
|
6
|
+
* registry + OpenAPI generator so a new base recipe ships in a single
|
|
7
|
+
* PR with no cross-package allow-list to keep in sync (see
|
|
8
|
+
* `wildo-tech-doc-config.schemas.ts` JSDoc for the architectural
|
|
9
|
+
* rationale behind moving this out of `platform-config-lib`).
|
|
10
|
+
*
|
|
11
|
+
* @wildo-boundary
|
|
12
|
+
* This sub-tree is Node-side only (the `defineTechnicalDocConfig`
|
|
13
|
+
* helper writes to `process.stderr` via the `@unimplemented`
|
|
14
|
+
* warner). It MUST NOT be imported from `../runtime/**` or any
|
|
15
|
+
* browser-bundled code path. The Docusaurus build at the app
|
|
16
|
+
* level loads the per-service `wildo.tech-doc.config.ts` via the
|
|
17
|
+
* companion or via a Node-side helper, NEVER from the rendered
|
|
18
|
+
* docs bundle.
|
|
19
|
+
*/
|
|
20
|
+
export * from './define-tech-doc-config.js';
|
|
21
|
+
export * from './wildo-tech-doc-config.schemas.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC","sourcesContent":["/**\n * `@wildo-ai/saas-technical-doc` — config surface.\n *\n * Per-service `wildo.tech-doc.config.ts` schema + `defineTechnicalDocConfig`\n * helper. Co-located with the engine package that owns the recipe\n * registry + OpenAPI generator so a new base recipe ships in a single\n * PR with no cross-package allow-list to keep in sync (see\n * `wildo-tech-doc-config.schemas.ts` JSDoc for the architectural\n * rationale behind moving this out of `platform-config-lib`).\n *\n * @wildo-boundary\n * This sub-tree is Node-side only (the `defineTechnicalDocConfig`\n * helper writes to `process.stderr` via the `@unimplemented`\n * warner). It MUST NOT be imported from `../runtime/**` or any\n * browser-bundled code path. The Docusaurus build at the app\n * level loads the per-service `wildo.tech-doc.config.ts` via the\n * companion or via a Node-side helper, NEVER from the rendered\n * docs bundle.\n */\n\nexport * from './define-tech-doc-config';\nexport * from './wildo-tech-doc-config.schemas';\n"]}
|