@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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wildo-ai/saas-technical-doc/content` — reusable application-consumer documentation content and portable identity contracts.
|
|
3
|
+
*
|
|
4
|
+
* This entry point is deliberately neutral: it contains no filesystem access, application discovery, runtime evidence, publication policy, React or
|
|
5
|
+
* browser runtime. Application companions may combine this engine-owned content with accepted application semantics and authorized operational evidence.
|
|
6
|
+
*/
|
|
7
|
+
export * from './content/application-consumer-documentation-content-manifest.schemas';
|
|
8
|
+
export * from './content/application-consumer-documentation-content.techdoc';
|
|
9
|
+
//# sourceMappingURL=content.exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.exports.d.ts","sourceRoot":"","sources":["../../../src/content.exports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uEAAuE,CAAC;AACtF,cAAc,8DAA8D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@wildo-ai/saas-technical-doc/content` — reusable application-consumer documentation content and portable identity contracts.
|
|
3
|
+
*
|
|
4
|
+
* This entry point is deliberately neutral: it contains no filesystem access, application discovery, runtime evidence, publication policy, React or
|
|
5
|
+
* browser runtime. Application companions may combine this engine-owned content with accepted application semantics and authorized operational evidence.
|
|
6
|
+
*/
|
|
7
|
+
export * from './content/application-consumer-documentation-content-manifest.schemas.js';
|
|
8
|
+
export * from './content/application-consumer-documentation-content.techdoc.js';
|
|
9
|
+
//# sourceMappingURL=content.exports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.exports.js","sourceRoot":"","sources":["../../../src/content.exports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uEAAuE,CAAC;AACtF,cAAc,8DAA8D,CAAC","sourcesContent":["/**\n * `@wildo-ai/saas-technical-doc/content` — reusable application-consumer documentation content and portable identity contracts.\n *\n * This entry point is deliberately neutral: it contains no filesystem access, application discovery, runtime evidence, publication policy, React or\n * browser runtime. Application companions may combine this engine-owned content with accepted application semantics and authorized operational evidence.\n */\n\nexport * from './content/application-consumer-documentation-content-manifest.schemas';\nexport * from './content/application-consumer-documentation-content.techdoc';\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wildo-package @wildo-ai/saas-technical-doc
|
|
3
|
+
*
|
|
4
|
+
* SaaS technical documentation engine — portable OpenAPI contracts and the
|
|
5
|
+
* strict per-service documentation configuration authoring surface. Framework
|
|
6
|
+
* consumer prose is exposed separately through `./content`; companion-side
|
|
7
|
+
* projection and rendering live under `./companion`.
|
|
8
|
+
*
|
|
9
|
+
* @wildo-boundary
|
|
10
|
+
* - This barrel re-exports the shared (Node + companion + Docusaurus
|
|
11
|
+
* build) surface: OpenAPI generation output types and the per-service
|
|
12
|
+
* config schema + define helper.
|
|
13
|
+
* - The browser-only React + fetch runtime lives in `./runtime/` and is
|
|
14
|
+
* re-exported via the package's `./runtime` subpath export — NOT here.
|
|
15
|
+
* - The Node-only OpenAPI generator code lives in `./companion/` and is
|
|
16
|
+
* re-exported via the package's `./companion` subpath export — NOT here.
|
|
17
|
+
* - This separation keeps the docs Docusaurus bundle from accidentally
|
|
18
|
+
* pulling Node-only code, and keeps the companion subprocess from
|
|
19
|
+
* accidentally pulling React.
|
|
20
|
+
* - `defineTechnicalDocConfig` parses the Node-authored service config and
|
|
21
|
+
* belongs in companion/build code. Browser code consumes already-resolved
|
|
22
|
+
* runtime artifacts through `./runtime`; it must not author configuration.
|
|
23
|
+
*/
|
|
24
|
+
export * from './openapi/index';
|
|
25
|
+
export * from './config/index';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wildo-package @wildo-ai/saas-technical-doc
|
|
3
|
+
*
|
|
4
|
+
* SaaS technical documentation engine — portable OpenAPI contracts and the
|
|
5
|
+
* strict per-service documentation configuration authoring surface. Framework
|
|
6
|
+
* consumer prose is exposed separately through `./content`; companion-side
|
|
7
|
+
* projection and rendering live under `./companion`.
|
|
8
|
+
*
|
|
9
|
+
* @wildo-boundary
|
|
10
|
+
* - This barrel re-exports the shared (Node + companion + Docusaurus
|
|
11
|
+
* build) surface: OpenAPI generation output types and the per-service
|
|
12
|
+
* config schema + define helper.
|
|
13
|
+
* - The browser-only React + fetch runtime lives in `./runtime/` and is
|
|
14
|
+
* re-exported via the package's `./runtime` subpath export — NOT here.
|
|
15
|
+
* - The Node-only OpenAPI generator code lives in `./companion/` and is
|
|
16
|
+
* re-exported via the package's `./companion` subpath export — NOT here.
|
|
17
|
+
* - This separation keeps the docs Docusaurus bundle from accidentally
|
|
18
|
+
* pulling Node-only code, and keeps the companion subprocess from
|
|
19
|
+
* accidentally pulling React.
|
|
20
|
+
* - `defineTechnicalDocConfig` parses the Node-authored service config and
|
|
21
|
+
* belongs in companion/build code. Browser code consumes already-resolved
|
|
22
|
+
* runtime artifacts through `./runtime`; it must not author configuration.
|
|
23
|
+
*/
|
|
24
|
+
export * from './openapi/index.js';
|
|
25
|
+
export * from './config/index.js';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC","sourcesContent":["/**\n * @wildo-package @wildo-ai/saas-technical-doc\n *\n * SaaS technical documentation engine — portable OpenAPI contracts and the\n * strict per-service documentation configuration authoring surface. Framework\n * consumer prose is exposed separately through `./content`; companion-side\n * projection and rendering live under `./companion`.\n *\n * @wildo-boundary\n * - This barrel re-exports the shared (Node + companion + Docusaurus\n * build) surface: OpenAPI generation output types and the per-service\n * config schema + define helper.\n * - The browser-only React + fetch runtime lives in `./runtime/` and is\n * re-exported via the package's `./runtime` subpath export — NOT here.\n * - The Node-only OpenAPI generator code lives in `./companion/` and is\n * re-exported via the package's `./companion` subpath export — NOT here.\n * - This separation keeps the docs Docusaurus bundle from accidentally\n * pulling Node-only code, and keeps the companion subprocess from\n * accidentally pulling React.\n * - `defineTechnicalDocConfig` parses the Node-authored service config and\n * belongs in companion/build code. Browser code consumes already-resolved\n * runtime artifacts through `./runtime`; it must not author configuration.\n */\n\nexport * from './openapi/index';\nexport * from './config/index';\n"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic links into the generated API reference.
|
|
3
|
+
*
|
|
4
|
+
* This module projects a canonical OpenAPI document into a small index of
|
|
5
|
+
* public paths. It does not describe or navigate API contracts itself: every
|
|
6
|
+
* entry is derived from standard OpenAPI fields plus the strict `x-wildo`
|
|
7
|
+
* source identities already present in the document. Guide generation can use
|
|
8
|
+
* the index to link to exact API targets without hard-coding Docusaurus URLs
|
|
9
|
+
* or duplicating operations, request DTOs, responses, or schemas.
|
|
10
|
+
*/
|
|
11
|
+
import { OpenApiSection, type OpenApiSectionOutput } from './openapi-generation-output.schemas';
|
|
12
|
+
import { type TechnicalDocumentationApiReferenceTargetV1 } from '@wildo-ai/saas-specifications/technical-documentation';
|
|
13
|
+
/** The semantic source identity a guide may resolve to a consumer API URL. */
|
|
14
|
+
export declare enum ApiReferenceLinkIdentityKind {
|
|
15
|
+
/** A generated section exists and its root page is a valid public destination. */
|
|
16
|
+
ROOT = "ROOT",
|
|
17
|
+
CATEGORY = "CATEGORY",
|
|
18
|
+
RESOURCE = "RESOURCE",
|
|
19
|
+
OPERATION_FAMILY = "OPERATION_FAMILY",
|
|
20
|
+
OPERATION_VARIANT = "OPERATION_VARIANT",
|
|
21
|
+
REQUEST = "REQUEST",
|
|
22
|
+
RESPONSE = "RESPONSE",
|
|
23
|
+
COMPONENT_SCHEMA = "COMPONENT_SCHEMA"
|
|
24
|
+
}
|
|
25
|
+
export type ApiReferenceLinkIdentity = {
|
|
26
|
+
readonly kind: ApiReferenceLinkIdentityKind.ROOT;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: ApiReferenceLinkIdentityKind.CATEGORY;
|
|
29
|
+
readonly categoryId: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: ApiReferenceLinkIdentityKind.RESOURCE;
|
|
32
|
+
readonly resourceRef: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: ApiReferenceLinkIdentityKind.OPERATION_FAMILY;
|
|
35
|
+
readonly operationFamilyRef: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: ApiReferenceLinkIdentityKind.OPERATION_VARIANT;
|
|
38
|
+
readonly operationVariantRef: string;
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: ApiReferenceLinkIdentityKind.REQUEST;
|
|
41
|
+
readonly operationVariantRef: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: ApiReferenceLinkIdentityKind.RESPONSE;
|
|
44
|
+
readonly operationVariantRef: string;
|
|
45
|
+
readonly status: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA;
|
|
48
|
+
readonly schemaName: string;
|
|
49
|
+
};
|
|
50
|
+
/** One resolved public URL. `section` keeps an identity unambiguous across both API references. */
|
|
51
|
+
export interface ApiReferenceLinkIndexEntry {
|
|
52
|
+
readonly section: OpenApiSection;
|
|
53
|
+
readonly identity: ApiReferenceLinkIdentity;
|
|
54
|
+
readonly href: string;
|
|
55
|
+
}
|
|
56
|
+
/** JSON-safe result of projecting the selected OpenAPI documents. */
|
|
57
|
+
export interface ApiReferenceLinkIndex {
|
|
58
|
+
readonly schemaVersion: 1;
|
|
59
|
+
readonly entries: readonly ApiReferenceLinkIndexEntry[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Result of asking whether one semantic guide target exists in the exact
|
|
63
|
+
* generated OpenAPI index. This is deliberately not a boolean: the named
|
|
64
|
+
* vocabulary keeps availability decisions readable at guide-composition call
|
|
65
|
+
* sites and leaves room for future source-owned states without overloading
|
|
66
|
+
* `false`.
|
|
67
|
+
*/
|
|
68
|
+
export declare enum TechnicalDocumentationApiReferenceTargetAvailability {
|
|
69
|
+
AVAILABLE = "AVAILABLE",
|
|
70
|
+
UNAVAILABLE = "UNAVAILABLE"
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates links from the exact generated OpenAPI documents.
|
|
74
|
+
*
|
|
75
|
+
* This is intentionally a fail-closed projection. An HTTP operation without
|
|
76
|
+
* the established source identity, a tag/operation resource mismatch, or a
|
|
77
|
+
* duplicate semantic target means guide links could become ambiguous, so the
|
|
78
|
+
* index is not emitted at all.
|
|
79
|
+
*/
|
|
80
|
+
export declare function createApiReferenceLinkIndex(sections: readonly OpenApiSectionOutput[]): ApiReferenceLinkIndex;
|
|
81
|
+
/** Resolves one semantic API target and fails loudly when a guide asks for unavailable documentation. */
|
|
82
|
+
export declare function resolveApiReferenceLink(index: ApiReferenceLinkIndex, section: OpenApiSection, identity: ApiReferenceLinkIdentity): string;
|
|
83
|
+
/**
|
|
84
|
+
* Answers whether a typed target exists in the generated OpenAPI index without
|
|
85
|
+
* manufacturing a URL or turning normal optional-content selection into an
|
|
86
|
+
* exception path. Included guide links must still use the strict resolver.
|
|
87
|
+
*/
|
|
88
|
+
export declare function getTechnicalDocumentationApiReferenceTargetAvailability(index: ApiReferenceLinkIndex, target: TechnicalDocumentationApiReferenceTargetV1): TechnicalDocumentationApiReferenceTargetAvailability;
|
|
89
|
+
/**
|
|
90
|
+
* Resolves a portable guide target through the generated OpenAPI index.
|
|
91
|
+
*
|
|
92
|
+
* The technical-documentation contract owns the semantic target because guide
|
|
93
|
+
* content cannot depend on the renderer package. This adapter is the only
|
|
94
|
+
* place that translates that portable target into the OpenAPI identities used
|
|
95
|
+
* to produce public consumer URLs.
|
|
96
|
+
*/
|
|
97
|
+
export declare function resolveTechnicalDocumentationApiReferenceLink(index: ApiReferenceLinkIndex, target: TechnicalDocumentationApiReferenceTargetV1): string;
|
|
98
|
+
//# sourceMappingURL=api-reference-link-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-reference-link-index.d.ts","sourceRoot":"","sources":["../../../../src/openapi/api-reference-link-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChG,OAAO,EAGL,KAAK,0CAA0C,EAChD,MAAM,uDAAuD,CAAC;AAQ/D,8EAA8E;AAC9E,oBAAY,4BAA4B;IACtC,kFAAkF;IAClF,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;CACtC;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,QAAQ,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAA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AAE,SAAS,oBAAoB,EAAE,GAAG,qBAAqB,CAyH5G;AAED,yGAAyG;AACzG,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,wBAAwB,GAAG,MAAM,CAKzI;AAwCD;;;;GAIG;AACH,wBAAgB,uDAAuD,CACrE,KAAK,EAAE,qBAAqB,EAC5B,MAAM,EAAE,0CAA0C,GACjD,oDAAoD,CAMtD;AAED;;;;;;;GAOG;AACH,wBAAgB,6CAA6C,CAC3D,KAAK,EAAE,qBAAqB,EAC5B,MAAM,EAAE,0CAA0C,GACjD,MAAM,CAGR"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic links into the generated API reference.
|
|
3
|
+
*
|
|
4
|
+
* This module projects a canonical OpenAPI document into a small index of
|
|
5
|
+
* public paths. It does not describe or navigate API contracts itself: every
|
|
6
|
+
* entry is derived from standard OpenAPI fields plus the strict `x-wildo`
|
|
7
|
+
* source identities already present in the document. Guide generation can use
|
|
8
|
+
* the index to link to exact API targets without hard-coding Docusaurus URLs
|
|
9
|
+
* or duplicating operations, request DTOs, responses, or schemas.
|
|
10
|
+
*/
|
|
11
|
+
import { OpenApiSection } from './openapi-generation-output.schemas.js';
|
|
12
|
+
import { TechnicalDocumentationApiReferenceSection, TechnicalDocumentationApiReferenceTargetKind, } from '@wildo-ai/saas-specifications/technical-documentation';
|
|
13
|
+
import { ApiReferenceTargetKind, ApplicationConsumerDocumentationRoute, applicationConsumerDocumentationTargetPath, } from './api-reference-targets.js';
|
|
14
|
+
/** The semantic source identity a guide may resolve to a consumer API URL. */
|
|
15
|
+
export var ApiReferenceLinkIdentityKind;
|
|
16
|
+
(function (ApiReferenceLinkIdentityKind) {
|
|
17
|
+
/** A generated section exists and its root page is a valid public destination. */
|
|
18
|
+
ApiReferenceLinkIdentityKind["ROOT"] = "ROOT";
|
|
19
|
+
ApiReferenceLinkIdentityKind["CATEGORY"] = "CATEGORY";
|
|
20
|
+
ApiReferenceLinkIdentityKind["RESOURCE"] = "RESOURCE";
|
|
21
|
+
ApiReferenceLinkIdentityKind["OPERATION_FAMILY"] = "OPERATION_FAMILY";
|
|
22
|
+
ApiReferenceLinkIdentityKind["OPERATION_VARIANT"] = "OPERATION_VARIANT";
|
|
23
|
+
ApiReferenceLinkIdentityKind["REQUEST"] = "REQUEST";
|
|
24
|
+
ApiReferenceLinkIdentityKind["RESPONSE"] = "RESPONSE";
|
|
25
|
+
ApiReferenceLinkIdentityKind["COMPONENT_SCHEMA"] = "COMPONENT_SCHEMA";
|
|
26
|
+
})(ApiReferenceLinkIdentityKind || (ApiReferenceLinkIdentityKind = {}));
|
|
27
|
+
/**
|
|
28
|
+
* Result of asking whether one semantic guide target exists in the exact
|
|
29
|
+
* generated OpenAPI index. This is deliberately not a boolean: the named
|
|
30
|
+
* vocabulary keeps availability decisions readable at guide-composition call
|
|
31
|
+
* sites and leaves room for future source-owned states without overloading
|
|
32
|
+
* `false`.
|
|
33
|
+
*/
|
|
34
|
+
export var TechnicalDocumentationApiReferenceTargetAvailability;
|
|
35
|
+
(function (TechnicalDocumentationApiReferenceTargetAvailability) {
|
|
36
|
+
TechnicalDocumentationApiReferenceTargetAvailability["AVAILABLE"] = "AVAILABLE";
|
|
37
|
+
TechnicalDocumentationApiReferenceTargetAvailability["UNAVAILABLE"] = "UNAVAILABLE";
|
|
38
|
+
})(TechnicalDocumentationApiReferenceTargetAvailability || (TechnicalDocumentationApiReferenceTargetAvailability = {}));
|
|
39
|
+
const OPENAPI_HTTP_METHODS = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);
|
|
40
|
+
function isRecord(value) {
|
|
41
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
42
|
+
}
|
|
43
|
+
function routeForSection(section) {
|
|
44
|
+
switch (section) {
|
|
45
|
+
case OpenApiSection.API_REFERENCE:
|
|
46
|
+
return ApplicationConsumerDocumentationRoute.API_REFERENCE;
|
|
47
|
+
case OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE:
|
|
48
|
+
return ApplicationConsumerDocumentationRoute.APPLICATION_ADMINISTRATION_API_REFERENCE;
|
|
49
|
+
default: {
|
|
50
|
+
const exhaustiveSection = section;
|
|
51
|
+
throw new Error(`Unsupported API-reference section: ${String(exhaustiveSection)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function resourceName(resourceRef) {
|
|
56
|
+
const name = resourceRef.match(/^technical-documentation:resource\/([^/]+)$/)?.[1];
|
|
57
|
+
if (name === undefined)
|
|
58
|
+
throw new Error(`API-reference resource identity is not a canonical resource ref: '${resourceRef}'`);
|
|
59
|
+
return name;
|
|
60
|
+
}
|
|
61
|
+
function familyName(operationFamilyRef) {
|
|
62
|
+
const name = operationFamilyRef.match(/^technical-documentation:resource\/[^/]+\/operation-family\/([^/]+)$/)?.[1];
|
|
63
|
+
if (name === undefined)
|
|
64
|
+
throw new Error(`API-reference family identity is not canonical: '${operationFamilyRef}'`);
|
|
65
|
+
return name;
|
|
66
|
+
}
|
|
67
|
+
function targetHref(section, target) {
|
|
68
|
+
return applicationConsumerDocumentationTargetPath(routeForSection(section), target);
|
|
69
|
+
}
|
|
70
|
+
/** The root is an index entry too: a guide may cite it only when that section was generated. */
|
|
71
|
+
function sectionRootHref(section) {
|
|
72
|
+
return applicationConsumerDocumentationTargetPath(routeForSection(section));
|
|
73
|
+
}
|
|
74
|
+
function identityKey(section, identity) {
|
|
75
|
+
switch (identity.kind) {
|
|
76
|
+
case ApiReferenceLinkIdentityKind.ROOT:
|
|
77
|
+
return `${section}\0${identity.kind}`;
|
|
78
|
+
case ApiReferenceLinkIdentityKind.CATEGORY:
|
|
79
|
+
return `${section}\0${identity.kind}\0${identity.categoryId}`;
|
|
80
|
+
case ApiReferenceLinkIdentityKind.RESOURCE:
|
|
81
|
+
return `${section}\0${identity.kind}\0${identity.resourceRef}`;
|
|
82
|
+
case ApiReferenceLinkIdentityKind.OPERATION_FAMILY:
|
|
83
|
+
return `${section}\0${identity.kind}\0${identity.operationFamilyRef}`;
|
|
84
|
+
case ApiReferenceLinkIdentityKind.OPERATION_VARIANT:
|
|
85
|
+
case ApiReferenceLinkIdentityKind.REQUEST:
|
|
86
|
+
return `${section}\0${identity.kind}\0${identity.operationVariantRef}`;
|
|
87
|
+
case ApiReferenceLinkIdentityKind.RESPONSE:
|
|
88
|
+
return `${section}\0${identity.kind}\0${identity.operationVariantRef}\0${identity.status}`;
|
|
89
|
+
case ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA:
|
|
90
|
+
return `${section}\0${identity.kind}\0${identity.schemaName}`;
|
|
91
|
+
default: {
|
|
92
|
+
const exhaustiveIdentity = identity;
|
|
93
|
+
throw new Error(`Unsupported API-reference link identity: ${JSON.stringify(exhaustiveIdentity)}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates links from the exact generated OpenAPI documents.
|
|
99
|
+
*
|
|
100
|
+
* This is intentionally a fail-closed projection. An HTTP operation without
|
|
101
|
+
* the established source identity, a tag/operation resource mismatch, or a
|
|
102
|
+
* duplicate semantic target means guide links could become ambiguous, so the
|
|
103
|
+
* index is not emitted at all.
|
|
104
|
+
*/
|
|
105
|
+
export function createApiReferenceLinkIndex(sections) {
|
|
106
|
+
const entries = [];
|
|
107
|
+
const seen = new Set();
|
|
108
|
+
const sectionSet = new Set();
|
|
109
|
+
const identityByHref = new Map();
|
|
110
|
+
const add = (section, identity, href) => {
|
|
111
|
+
const key = identityKey(section, identity);
|
|
112
|
+
if (seen.has(key))
|
|
113
|
+
throw new Error(`API-reference link identity is duplicated: ${key}`);
|
|
114
|
+
const priorIdentity = identityByHref.get(href);
|
|
115
|
+
if (priorIdentity !== undefined && priorIdentity !== key) {
|
|
116
|
+
throw new Error(`API-reference public link '${href}' is ambiguous between ${priorIdentity} and ${key}`);
|
|
117
|
+
}
|
|
118
|
+
seen.add(key);
|
|
119
|
+
identityByHref.set(href, key);
|
|
120
|
+
entries.push({ section, identity, href });
|
|
121
|
+
};
|
|
122
|
+
for (const sectionOutput of sections) {
|
|
123
|
+
if (sectionSet.has(sectionOutput.section))
|
|
124
|
+
throw new Error(`API-reference section is duplicated: ${sectionOutput.section}`);
|
|
125
|
+
sectionSet.add(sectionOutput.section);
|
|
126
|
+
const document = sectionOutput.document;
|
|
127
|
+
if (!isRecord(document) || !isRecord(document.paths))
|
|
128
|
+
throw new Error(`API-reference ${sectionOutput.section} document has no OpenAPI paths object`);
|
|
129
|
+
add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.ROOT }, sectionRootHref(sectionOutput.section));
|
|
130
|
+
const tags = new Map();
|
|
131
|
+
const usedResourceRefs = new Set();
|
|
132
|
+
const categoryMetadataById = new Map();
|
|
133
|
+
if (!Array.isArray(document.tags))
|
|
134
|
+
throw new Error(`API-reference ${sectionOutput.section} document has no resource tags`);
|
|
135
|
+
for (const tag of document.tags) {
|
|
136
|
+
if (!isRecord(tag) || typeof tag.name !== 'string' || !isRecord(tag['x-wildo']) || typeof tag['x-wildo'].resourceRef !== 'string') {
|
|
137
|
+
throw new Error(`API-reference ${sectionOutput.section} document has a malformed resource tag`);
|
|
138
|
+
}
|
|
139
|
+
if (tags.has(tag.name))
|
|
140
|
+
throw new Error(`API-reference ${sectionOutput.section} resource tag is duplicated: '${tag.name}'`);
|
|
141
|
+
const category = tag['x-wildo'].category;
|
|
142
|
+
if (category !== undefined && (!isRecord(category) || typeof category.id !== 'string' || typeof category.label !== 'string'
|
|
143
|
+
|| (category.description !== undefined && typeof category.description !== 'string'))) {
|
|
144
|
+
throw new Error(`API-reference resource tag '${tag.name}' has malformed category metadata`);
|
|
145
|
+
}
|
|
146
|
+
const categoryId = isRecord(category) && typeof category.id === 'string' ? category.id : null;
|
|
147
|
+
const categoryLabel = isRecord(category) && typeof category.label === 'string' ? category.label : null;
|
|
148
|
+
const categoryDescription = isRecord(category) && typeof category.description === 'string' ? category.description : null;
|
|
149
|
+
const tagResourceRef = tag['x-wildo'].resourceRef;
|
|
150
|
+
if (resourceName(tagResourceRef) !== tag.name)
|
|
151
|
+
throw new Error(`API-reference resource tag '${tag.name}' disagrees with its resource identity`);
|
|
152
|
+
tags.set(tag.name, { resourceRef: tagResourceRef });
|
|
153
|
+
add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.RESOURCE, resourceRef: tagResourceRef }, targetHref(sectionOutput.section, {
|
|
154
|
+
kind: ApiReferenceTargetKind.RESOURCE,
|
|
155
|
+
resourceName: tag.name,
|
|
156
|
+
}));
|
|
157
|
+
if (categoryId !== null) {
|
|
158
|
+
if (categoryLabel === null)
|
|
159
|
+
throw new Error(`API-reference resource tag '${tag.name}' has malformed category metadata`);
|
|
160
|
+
const priorMetadata = categoryMetadataById.get(categoryId);
|
|
161
|
+
if (priorMetadata !== undefined && (priorMetadata.label !== categoryLabel || priorMetadata.description !== categoryDescription)) {
|
|
162
|
+
throw new Error(`API-reference category '${categoryId}' has inconsistent source metadata`);
|
|
163
|
+
}
|
|
164
|
+
categoryMetadataById.set(categoryId, { label: categoryLabel, description: categoryDescription });
|
|
165
|
+
const categoryIdentity = { kind: ApiReferenceLinkIdentityKind.CATEGORY, categoryId };
|
|
166
|
+
const key = identityKey(sectionOutput.section, categoryIdentity);
|
|
167
|
+
if (!seen.has(key))
|
|
168
|
+
add(sectionOutput.section, categoryIdentity, targetHref(sectionOutput.section, {
|
|
169
|
+
kind: ApiReferenceTargetKind.CATEGORY,
|
|
170
|
+
categoryName: categoryId,
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const [path, pathItem] of Object.entries(document.paths)) {
|
|
175
|
+
if (!isRecord(pathItem))
|
|
176
|
+
continue;
|
|
177
|
+
for (const [method, operation] of Object.entries(pathItem)) {
|
|
178
|
+
if (!OPENAPI_HTTP_METHODS.has(method))
|
|
179
|
+
continue;
|
|
180
|
+
if (!isRecord(operation) || !isRecord(operation['x-wildo']) || typeof operation.operationId !== 'string') {
|
|
181
|
+
throw new Error(`API-reference ${method.toUpperCase()} ${path} operation has malformed identity metadata`);
|
|
182
|
+
}
|
|
183
|
+
const metadata = operation['x-wildo'];
|
|
184
|
+
if (typeof metadata.resourceRef !== 'string' || typeof metadata.operationFamilyRef !== 'string' || typeof metadata.operationVariantRef !== 'string') {
|
|
185
|
+
throw new Error(`API-reference ${method.toUpperCase()} ${path} operation has incomplete identity metadata`);
|
|
186
|
+
}
|
|
187
|
+
if (metadata.path !== path || metadata.httpVerb !== method)
|
|
188
|
+
throw new Error(`API-reference ${method.toUpperCase()} ${path} operation identity disagrees with its OpenAPI location`);
|
|
189
|
+
const tag = tags.get(resourceName(metadata.resourceRef));
|
|
190
|
+
if (tag === undefined || tag.resourceRef !== metadata.resourceRef)
|
|
191
|
+
throw new Error(`API-reference ${method.toUpperCase()} ${path} operation has no matching resource tag`);
|
|
192
|
+
usedResourceRefs.add(metadata.resourceRef);
|
|
193
|
+
const operationTarget = { kind: ApiReferenceTargetKind.OPERATION, operationId: operation.operationId };
|
|
194
|
+
const familyIdentity = { kind: ApiReferenceLinkIdentityKind.OPERATION_FAMILY, operationFamilyRef: metadata.operationFamilyRef };
|
|
195
|
+
if (!seen.has(identityKey(sectionOutput.section, familyIdentity))) {
|
|
196
|
+
add(sectionOutput.section, familyIdentity, targetHref(sectionOutput.section, {
|
|
197
|
+
kind: ApiReferenceTargetKind.OPERATION_FAMILY,
|
|
198
|
+
resourceName: resourceName(metadata.resourceRef),
|
|
199
|
+
operationName: familyName(metadata.operationFamilyRef),
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.OPERATION_VARIANT, operationVariantRef: metadata.operationVariantRef }, targetHref(sectionOutput.section, operationTarget));
|
|
203
|
+
if (isRecord(operation.requestBody)) {
|
|
204
|
+
add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.REQUEST, operationVariantRef: metadata.operationVariantRef }, targetHref(sectionOutput.section, {
|
|
205
|
+
kind: ApiReferenceTargetKind.REQUEST,
|
|
206
|
+
operationId: operation.operationId,
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
if (isRecord(operation.responses)) {
|
|
210
|
+
for (const status of Object.keys(operation.responses)) {
|
|
211
|
+
add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.RESPONSE, operationVariantRef: metadata.operationVariantRef, status }, targetHref(sectionOutput.section, {
|
|
212
|
+
kind: ApiReferenceTargetKind.RESPONSE,
|
|
213
|
+
operationId: operation.operationId,
|
|
214
|
+
status,
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (const [tagName, tag] of tags) {
|
|
221
|
+
if (!usedResourceRefs.has(tag.resourceRef)) {
|
|
222
|
+
throw new Error(`API-reference resource tag '${tagName}' has no rendered HTTP operation`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const componentSchemas = isRecord(document.components) && isRecord(document.components.schemas) ? document.components.schemas : {};
|
|
226
|
+
for (const schemaName of Object.keys(componentSchemas)) {
|
|
227
|
+
add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA, schemaName }, targetHref(sectionOutput.section, {
|
|
228
|
+
kind: ApiReferenceTargetKind.COMPONENT_SCHEMA,
|
|
229
|
+
schemaName,
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return { schemaVersion: 1, entries: entries.sort((left, right) => identityKey(left.section, left.identity).localeCompare(identityKey(right.section, right.identity))) };
|
|
234
|
+
}
|
|
235
|
+
/** Resolves one semantic API target and fails loudly when a guide asks for unavailable documentation. */
|
|
236
|
+
export function resolveApiReferenceLink(index, section, identity) {
|
|
237
|
+
const expectedKey = identityKey(section, identity);
|
|
238
|
+
const entry = index.entries.find((candidate) => identityKey(candidate.section, candidate.identity) === expectedKey);
|
|
239
|
+
if (entry === undefined)
|
|
240
|
+
throw new Error(`API-reference link target is unavailable: ${expectedKey}`);
|
|
241
|
+
return entry.href;
|
|
242
|
+
}
|
|
243
|
+
function technicalDocumentationTargetIdentity(target) {
|
|
244
|
+
const section = target.section === TechnicalDocumentationApiReferenceSection.API_REFERENCE
|
|
245
|
+
? OpenApiSection.API_REFERENCE
|
|
246
|
+
: OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE;
|
|
247
|
+
switch (target.kind) {
|
|
248
|
+
case TechnicalDocumentationApiReferenceTargetKind.ROOT:
|
|
249
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.ROOT } };
|
|
250
|
+
case TechnicalDocumentationApiReferenceTargetKind.CATEGORY:
|
|
251
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.CATEGORY, categoryId: target.categoryId } };
|
|
252
|
+
case TechnicalDocumentationApiReferenceTargetKind.RESOURCE:
|
|
253
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.RESOURCE, resourceRef: target.resourceRef } };
|
|
254
|
+
case TechnicalDocumentationApiReferenceTargetKind.OPERATION_FAMILY:
|
|
255
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.OPERATION_FAMILY, operationFamilyRef: target.operationFamilyRef } };
|
|
256
|
+
case TechnicalDocumentationApiReferenceTargetKind.OPERATION_VARIANT:
|
|
257
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.OPERATION_VARIANT, operationVariantRef: target.operationVariantRef } };
|
|
258
|
+
case TechnicalDocumentationApiReferenceTargetKind.REQUEST:
|
|
259
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.REQUEST, operationVariantRef: target.operationVariantRef } };
|
|
260
|
+
case TechnicalDocumentationApiReferenceTargetKind.RESPONSE:
|
|
261
|
+
return {
|
|
262
|
+
section,
|
|
263
|
+
identity: {
|
|
264
|
+
kind: ApiReferenceLinkIdentityKind.RESPONSE,
|
|
265
|
+
operationVariantRef: target.operationVariantRef,
|
|
266
|
+
status: target.status,
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
case TechnicalDocumentationApiReferenceTargetKind.COMPONENT_SCHEMA:
|
|
270
|
+
return { section, identity: { kind: ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA, schemaName: target.schemaName } };
|
|
271
|
+
default: {
|
|
272
|
+
const exhaustiveTarget = target;
|
|
273
|
+
throw new Error(`Unsupported technical-documentation API-reference target: ${JSON.stringify(exhaustiveTarget)}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Answers whether a typed target exists in the generated OpenAPI index without
|
|
279
|
+
* manufacturing a URL or turning normal optional-content selection into an
|
|
280
|
+
* exception path. Included guide links must still use the strict resolver.
|
|
281
|
+
*/
|
|
282
|
+
export function getTechnicalDocumentationApiReferenceTargetAvailability(index, target) {
|
|
283
|
+
const { section, identity } = technicalDocumentationTargetIdentity(target);
|
|
284
|
+
const expectedKey = identityKey(section, identity);
|
|
285
|
+
return index.entries.some((candidate) => identityKey(candidate.section, candidate.identity) === expectedKey)
|
|
286
|
+
? TechnicalDocumentationApiReferenceTargetAvailability.AVAILABLE
|
|
287
|
+
: TechnicalDocumentationApiReferenceTargetAvailability.UNAVAILABLE;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Resolves a portable guide target through the generated OpenAPI index.
|
|
291
|
+
*
|
|
292
|
+
* The technical-documentation contract owns the semantic target because guide
|
|
293
|
+
* content cannot depend on the renderer package. This adapter is the only
|
|
294
|
+
* place that translates that portable target into the OpenAPI identities used
|
|
295
|
+
* to produce public consumer URLs.
|
|
296
|
+
*/
|
|
297
|
+
export function resolveTechnicalDocumentationApiReferenceLink(index, target) {
|
|
298
|
+
const { section, identity } = technicalDocumentationTargetIdentity(target);
|
|
299
|
+
return resolveApiReferenceLink(index, section, identity);
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=api-reference-link-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-reference-link-index.js","sourceRoot":"","sources":["../../../../src/openapi/api-reference-link-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAA6B,MAAM,qCAAqC,CAAC;AAChG,OAAO,EACL,yCAAyC,EACzC,4CAA4C,GAE7C,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,sBAAsB,EACtB,qCAAqC,EACrC,0CAA0C,GAE3C,MAAM,yBAAyB,CAAC;AAEjC,8EAA8E;AAC9E,MAAM,CAAN,IAAY,4BAUX;AAVD,WAAY,4BAA4B;IACtC,kFAAkF;IAClF,6CAAa,CAAA;IACb,qDAAqB,CAAA;IACrB,qDAAqB,CAAA;IACrB,qEAAqC,CAAA;IACrC,uEAAuC,CAAA;IACvC,mDAAmB,CAAA;IACnB,qDAAqB,CAAA;IACrB,qEAAqC,CAAA;AACvC,CAAC,EAVW,4BAA4B,KAA5B,4BAA4B,QAUvC;AAyBD;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,oDAGX;AAHD,WAAY,oDAAoD;IAC9D,+EAAuB,CAAA;IACvB,mFAA2B,CAAA;AAC7B,CAAC,EAHW,oDAAoD,KAApD,oDAAoD,QAG/D;AAID,MAAM,oBAAoB,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAEjI,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,eAAe,CAAC,OAAuB;IAC9C,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,cAAc,CAAC,a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CAAC;QACnH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uDAAuD,CACrE,KAA4B,EAC5B,MAAkD;IAElD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,oCAAoC,CAAC,MAAM,CAAC,CAAC;IAC3E,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC;QAC1G,CAAC,CAAC,oDAAoD,CAAC,SAAS;QAChE,CAAC,CAAC,oDAAoD,CAAC,WAAW,CAAC;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,6CAA6C,CAC3D,KAA4B,EAC5B,MAAkD;IAElD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,oCAAoC,CAAC,MAAM,CAAC,CAAC;IAC3E,OAAO,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Semantic links into the generated API reference.\n *\n * This module projects a canonical OpenAPI document into a small index of\n * public paths. It does not describe or navigate API contracts itself: every\n * entry is derived from standard OpenAPI fields plus the strict `x-wildo`\n * source identities already present in the document. Guide generation can use\n * the index to link to exact API targets without hard-coding Docusaurus URLs\n * or duplicating operations, request DTOs, responses, or schemas.\n */\n\nimport { OpenApiSection, type OpenApiSectionOutput } from './openapi-generation-output.schemas';\nimport {\n TechnicalDocumentationApiReferenceSection,\n TechnicalDocumentationApiReferenceTargetKind,\n type TechnicalDocumentationApiReferenceTargetV1,\n} from '@wildo-ai/saas-specifications/technical-documentation';\nimport {\n ApiReferenceTargetKind,\n ApplicationConsumerDocumentationRoute,\n applicationConsumerDocumentationTargetPath,\n type ApiReferencePublicTarget,\n} from './api-reference-targets';\n\n/** The semantic source identity a guide may resolve to a consumer API URL. */\nexport enum ApiReferenceLinkIdentityKind {\n /** A generated section exists and its root page is a valid public destination. */\n ROOT = 'ROOT',\n CATEGORY = 'CATEGORY',\n RESOURCE = 'RESOURCE',\n OPERATION_FAMILY = 'OPERATION_FAMILY',\n OPERATION_VARIANT = 'OPERATION_VARIANT',\n REQUEST = 'REQUEST',\n RESPONSE = 'RESPONSE',\n COMPONENT_SCHEMA = 'COMPONENT_SCHEMA',\n}\n\nexport type ApiReferenceLinkIdentity =\n | { readonly kind: ApiReferenceLinkIdentityKind.ROOT }\n | { readonly kind: ApiReferenceLinkIdentityKind.CATEGORY; readonly categoryId: string }\n | { readonly kind: ApiReferenceLinkIdentityKind.RESOURCE; readonly resourceRef: string }\n | { readonly kind: ApiReferenceLinkIdentityKind.OPERATION_FAMILY; readonly operationFamilyRef: string }\n | { readonly kind: ApiReferenceLinkIdentityKind.OPERATION_VARIANT; readonly operationVariantRef: string }\n | { readonly kind: ApiReferenceLinkIdentityKind.REQUEST; readonly operationVariantRef: string }\n | { readonly kind: ApiReferenceLinkIdentityKind.RESPONSE; readonly operationVariantRef: string; readonly status: string }\n | { readonly kind: ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA; readonly schemaName: string };\n\n/** One resolved public URL. `section` keeps an identity unambiguous across both API references. */\nexport interface ApiReferenceLinkIndexEntry {\n readonly section: OpenApiSection;\n readonly identity: ApiReferenceLinkIdentity;\n readonly href: string;\n}\n\n/** JSON-safe result of projecting the selected OpenAPI documents. */\nexport interface ApiReferenceLinkIndex {\n readonly schemaVersion: 1;\n readonly entries: readonly ApiReferenceLinkIndexEntry[];\n}\n\n/**\n * Result of asking whether one semantic guide target exists in the exact\n * generated OpenAPI index. This is deliberately not a boolean: the named\n * vocabulary keeps availability decisions readable at guide-composition call\n * sites and leaves room for future source-owned states without overloading\n * `false`.\n */\nexport enum TechnicalDocumentationApiReferenceTargetAvailability {\n AVAILABLE = 'AVAILABLE',\n UNAVAILABLE = 'UNAVAILABLE',\n}\n\ntype UnknownRecord = Record<string, unknown>;\n\nconst OPENAPI_HTTP_METHODS: ReadonlySet<string> = new Set(['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace']);\n\nfunction isRecord(value: unknown): value is UnknownRecord {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction routeForSection(section: OpenApiSection): ApplicationConsumerDocumentationRoute {\n switch (section) {\n case OpenApiSection.API_REFERENCE:\n return ApplicationConsumerDocumentationRoute.API_REFERENCE;\n case OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE:\n return ApplicationConsumerDocumentationRoute.APPLICATION_ADMINISTRATION_API_REFERENCE;\n default: {\n const exhaustiveSection: never = section;\n throw new Error(`Unsupported API-reference section: ${String(exhaustiveSection)}`);\n }\n }\n}\n\nfunction resourceName(resourceRef: string): string {\n const name = resourceRef.match(/^technical-documentation:resource\\/([^/]+)$/)?.[1];\n if (name === undefined) throw new Error(`API-reference resource identity is not a canonical resource ref: '${resourceRef}'`);\n return name;\n}\n\nfunction familyName(operationFamilyRef: string): string {\n const name = operationFamilyRef.match(/^technical-documentation:resource\\/[^/]+\\/operation-family\\/([^/]+)$/)?.[1];\n if (name === undefined) throw new Error(`API-reference family identity is not canonical: '${operationFamilyRef}'`);\n return name;\n}\n\nfunction targetHref(section: OpenApiSection, target: ApiReferencePublicTarget): string {\n return applicationConsumerDocumentationTargetPath(routeForSection(section), target);\n}\n\n/** The root is an index entry too: a guide may cite it only when that section was generated. */\nfunction sectionRootHref(section: OpenApiSection): string {\n return applicationConsumerDocumentationTargetPath(routeForSection(section));\n}\n\nfunction identityKey(section: OpenApiSection, identity: ApiReferenceLinkIdentity): string {\n switch (identity.kind) {\n case ApiReferenceLinkIdentityKind.ROOT:\n return `${section}\\0${identity.kind}`;\n case ApiReferenceLinkIdentityKind.CATEGORY:\n return `${section}\\0${identity.kind}\\0${identity.categoryId}`;\n case ApiReferenceLinkIdentityKind.RESOURCE:\n return `${section}\\0${identity.kind}\\0${identity.resourceRef}`;\n case ApiReferenceLinkIdentityKind.OPERATION_FAMILY:\n return `${section}\\0${identity.kind}\\0${identity.operationFamilyRef}`;\n case ApiReferenceLinkIdentityKind.OPERATION_VARIANT:\n case ApiReferenceLinkIdentityKind.REQUEST:\n return `${section}\\0${identity.kind}\\0${identity.operationVariantRef}`;\n case ApiReferenceLinkIdentityKind.RESPONSE:\n return `${section}\\0${identity.kind}\\0${identity.operationVariantRef}\\0${identity.status}`;\n case ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA:\n return `${section}\\0${identity.kind}\\0${identity.schemaName}`;\n default: {\n const exhaustiveIdentity: never = identity;\n throw new Error(`Unsupported API-reference link identity: ${JSON.stringify(exhaustiveIdentity)}`);\n }\n }\n}\n\n/**\n * Creates links from the exact generated OpenAPI documents.\n *\n * This is intentionally a fail-closed projection. An HTTP operation without\n * the established source identity, a tag/operation resource mismatch, or a\n * duplicate semantic target means guide links could become ambiguous, so the\n * index is not emitted at all.\n */\nexport function createApiReferenceLinkIndex(sections: readonly OpenApiSectionOutput[]): ApiReferenceLinkIndex {\n const entries: ApiReferenceLinkIndexEntry[] = [];\n const seen = new Set<string>();\n const sectionSet = new Set<OpenApiSection>();\n const identityByHref = new Map<string, string>();\n const add = (section: OpenApiSection, identity: ApiReferenceLinkIdentity, href: string): void => {\n const key = identityKey(section, identity);\n if (seen.has(key)) throw new Error(`API-reference link identity is duplicated: ${key}`);\n const priorIdentity = identityByHref.get(href);\n if (priorIdentity !== undefined && priorIdentity !== key) {\n throw new Error(`API-reference public link '${href}' is ambiguous between ${priorIdentity} and ${key}`);\n }\n seen.add(key);\n identityByHref.set(href, key);\n entries.push({ section, identity, href });\n };\n\n for (const sectionOutput of sections) {\n if (sectionSet.has(sectionOutput.section)) throw new Error(`API-reference section is duplicated: ${sectionOutput.section}`);\n sectionSet.add(sectionOutput.section);\n const document = sectionOutput.document;\n if (!isRecord(document) || !isRecord(document.paths)) throw new Error(`API-reference ${sectionOutput.section} document has no OpenAPI paths object`);\n add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.ROOT }, sectionRootHref(sectionOutput.section));\n const tags = new Map<string, { resourceRef: string }>();\n const usedResourceRefs = new Set<string>();\n const categoryMetadataById = new Map<string, { label: string; description: string | null }>();\n if (!Array.isArray(document.tags)) throw new Error(`API-reference ${sectionOutput.section} document has no resource tags`);\n for (const tag of document.tags) {\n if (!isRecord(tag) || typeof tag.name !== 'string' || !isRecord(tag['x-wildo']) || typeof tag['x-wildo'].resourceRef !== 'string') {\n throw new Error(`API-reference ${sectionOutput.section} document has a malformed resource tag`);\n }\n if (tags.has(tag.name)) throw new Error(`API-reference ${sectionOutput.section} resource tag is duplicated: '${tag.name}'`);\n const category = tag['x-wildo'].category;\n if (category !== undefined && (!isRecord(category) || typeof category.id !== 'string' || typeof category.label !== 'string'\n || (category.description !== undefined && typeof category.description !== 'string'))) {\n throw new Error(`API-reference resource tag '${tag.name}' has malformed category metadata`);\n }\n const categoryId = isRecord(category) && typeof category.id === 'string' ? category.id : null;\n const categoryLabel = isRecord(category) && typeof category.label === 'string' ? category.label : null;\n const categoryDescription = isRecord(category) && typeof category.description === 'string' ? category.description : null;\n const tagResourceRef = tag['x-wildo'].resourceRef;\n if (resourceName(tagResourceRef) !== tag.name) throw new Error(`API-reference resource tag '${tag.name}' disagrees with its resource identity`);\n tags.set(tag.name, { resourceRef: tagResourceRef });\n add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.RESOURCE, resourceRef: tagResourceRef }, targetHref(sectionOutput.section, {\n kind: ApiReferenceTargetKind.RESOURCE,\n resourceName: tag.name,\n }));\n if (categoryId !== null) {\n if (categoryLabel === null) throw new Error(`API-reference resource tag '${tag.name}' has malformed category metadata`);\n const priorMetadata = categoryMetadataById.get(categoryId);\n if (priorMetadata !== undefined && (priorMetadata.label !== categoryLabel || priorMetadata.description !== categoryDescription)) {\n throw new Error(`API-reference category '${categoryId}' has inconsistent source metadata`);\n }\n categoryMetadataById.set(categoryId, { label: categoryLabel, description: categoryDescription });\n const categoryIdentity = { kind: ApiReferenceLinkIdentityKind.CATEGORY, categoryId } as const;\n const key = identityKey(sectionOutput.section, categoryIdentity);\n if (!seen.has(key)) add(sectionOutput.section, categoryIdentity, targetHref(sectionOutput.section, {\n kind: ApiReferenceTargetKind.CATEGORY,\n categoryName: categoryId,\n }));\n }\n }\n\n for (const [path, pathItem] of Object.entries(document.paths)) {\n if (!isRecord(pathItem)) continue;\n for (const [method, operation] of Object.entries(pathItem)) {\n if (!OPENAPI_HTTP_METHODS.has(method)) continue;\n if (!isRecord(operation) || !isRecord(operation['x-wildo']) || typeof operation.operationId !== 'string') {\n throw new Error(`API-reference ${method.toUpperCase()} ${path} operation has malformed identity metadata`);\n }\n const metadata = operation['x-wildo'];\n if (typeof metadata.resourceRef !== 'string' || typeof metadata.operationFamilyRef !== 'string' || typeof metadata.operationVariantRef !== 'string') {\n throw new Error(`API-reference ${method.toUpperCase()} ${path} operation has incomplete identity metadata`);\n }\n if (metadata.path !== path || metadata.httpVerb !== method) throw new Error(`API-reference ${method.toUpperCase()} ${path} operation identity disagrees with its OpenAPI location`);\n const tag = tags.get(resourceName(metadata.resourceRef));\n if (tag === undefined || tag.resourceRef !== metadata.resourceRef) throw new Error(`API-reference ${method.toUpperCase()} ${path} operation has no matching resource tag`);\n usedResourceRefs.add(metadata.resourceRef);\n const operationTarget = { kind: ApiReferenceTargetKind.OPERATION, operationId: operation.operationId } as const;\n const familyIdentity = { kind: ApiReferenceLinkIdentityKind.OPERATION_FAMILY, operationFamilyRef: metadata.operationFamilyRef } as const;\n if (!seen.has(identityKey(sectionOutput.section, familyIdentity))) {\n add(sectionOutput.section, familyIdentity, targetHref(sectionOutput.section, {\n kind: ApiReferenceTargetKind.OPERATION_FAMILY,\n resourceName: resourceName(metadata.resourceRef),\n operationName: familyName(metadata.operationFamilyRef),\n }));\n }\n add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.OPERATION_VARIANT, operationVariantRef: metadata.operationVariantRef }, targetHref(sectionOutput.section, operationTarget));\n if (isRecord(operation.requestBody)) {\n add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.REQUEST, operationVariantRef: metadata.operationVariantRef }, targetHref(sectionOutput.section, {\n kind: ApiReferenceTargetKind.REQUEST,\n operationId: operation.operationId,\n }));\n }\n if (isRecord(operation.responses)) {\n for (const status of Object.keys(operation.responses)) {\n add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.RESPONSE, operationVariantRef: metadata.operationVariantRef, status }, targetHref(sectionOutput.section, {\n kind: ApiReferenceTargetKind.RESPONSE,\n operationId: operation.operationId,\n status,\n }));\n }\n }\n }\n }\n\n for (const [tagName, tag] of tags) {\n if (!usedResourceRefs.has(tag.resourceRef)) {\n throw new Error(`API-reference resource tag '${tagName}' has no rendered HTTP operation`);\n }\n }\n\n const componentSchemas = isRecord(document.components) && isRecord(document.components.schemas) ? document.components.schemas : {};\n for (const schemaName of Object.keys(componentSchemas)) {\n add(sectionOutput.section, { kind: ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA, schemaName }, targetHref(sectionOutput.section, {\n kind: ApiReferenceTargetKind.COMPONENT_SCHEMA,\n schemaName,\n }));\n }\n }\n return { schemaVersion: 1, entries: entries.sort((left, right) => identityKey(left.section, left.identity).localeCompare(identityKey(right.section, right.identity))) };\n}\n\n/** Resolves one semantic API target and fails loudly when a guide asks for unavailable documentation. */\nexport function resolveApiReferenceLink(index: ApiReferenceLinkIndex, section: OpenApiSection, identity: ApiReferenceLinkIdentity): string {\n const expectedKey = identityKey(section, identity);\n const entry = index.entries.find((candidate) => identityKey(candidate.section, candidate.identity) === expectedKey);\n if (entry === undefined) throw new Error(`API-reference link target is unavailable: ${expectedKey}`);\n return entry.href;\n}\n\nfunction technicalDocumentationTargetIdentity(target: TechnicalDocumentationApiReferenceTargetV1): {\n readonly section: OpenApiSection;\n readonly identity: ApiReferenceLinkIdentity;\n} {\n const section = target.section === TechnicalDocumentationApiReferenceSection.API_REFERENCE\n ? OpenApiSection.API_REFERENCE\n : OpenApiSection.APPLICATION_ADMINISTRATION_API_REFERENCE;\n switch (target.kind) {\n case TechnicalDocumentationApiReferenceTargetKind.ROOT:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.ROOT } };\n case TechnicalDocumentationApiReferenceTargetKind.CATEGORY:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.CATEGORY, categoryId: target.categoryId } };\n case TechnicalDocumentationApiReferenceTargetKind.RESOURCE:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.RESOURCE, resourceRef: target.resourceRef } };\n case TechnicalDocumentationApiReferenceTargetKind.OPERATION_FAMILY:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.OPERATION_FAMILY, operationFamilyRef: target.operationFamilyRef } };\n case TechnicalDocumentationApiReferenceTargetKind.OPERATION_VARIANT:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.OPERATION_VARIANT, operationVariantRef: target.operationVariantRef } };\n case TechnicalDocumentationApiReferenceTargetKind.REQUEST:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.REQUEST, operationVariantRef: target.operationVariantRef } };\n case TechnicalDocumentationApiReferenceTargetKind.RESPONSE:\n return {\n section,\n identity: {\n kind: ApiReferenceLinkIdentityKind.RESPONSE,\n operationVariantRef: target.operationVariantRef,\n status: target.status,\n },\n };\n case TechnicalDocumentationApiReferenceTargetKind.COMPONENT_SCHEMA:\n return { section, identity: { kind: ApiReferenceLinkIdentityKind.COMPONENT_SCHEMA, schemaName: target.schemaName } };\n default: {\n const exhaustiveTarget: never = target;\n throw new Error(`Unsupported technical-documentation API-reference target: ${JSON.stringify(exhaustiveTarget)}`);\n }\n }\n}\n\n/**\n * Answers whether a typed target exists in the generated OpenAPI index without\n * manufacturing a URL or turning normal optional-content selection into an\n * exception path. Included guide links must still use the strict resolver.\n */\nexport function getTechnicalDocumentationApiReferenceTargetAvailability(\n index: ApiReferenceLinkIndex,\n target: TechnicalDocumentationApiReferenceTargetV1,\n): TechnicalDocumentationApiReferenceTargetAvailability {\n const { section, identity } = technicalDocumentationTargetIdentity(target);\n const expectedKey = identityKey(section, identity);\n return index.entries.some((candidate) => identityKey(candidate.section, candidate.identity) === expectedKey)\n ? TechnicalDocumentationApiReferenceTargetAvailability.AVAILABLE\n : TechnicalDocumentationApiReferenceTargetAvailability.UNAVAILABLE;\n}\n\n/**\n * Resolves a portable guide target through the generated OpenAPI index.\n *\n * The technical-documentation contract owns the semantic target because guide\n * content cannot depend on the renderer package. This adapter is the only\n * place that translates that portable target into the OpenAPI identities used\n * to produce public consumer URLs.\n */\nexport function resolveTechnicalDocumentationApiReferenceLink(\n index: ApiReferenceLinkIndex,\n target: TechnicalDocumentationApiReferenceTargetV1,\n): string {\n const { section, identity } = technicalDocumentationTargetIdentity(target);\n return resolveApiReferenceLink(index, section, identity);\n}\n"]}
|