@wildo-ai/saas-technical-doc 1.1.2 → 1.1.4
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/dist/esm/build/csp-emit.d.ts.map +1 -1
- package/dist/esm/build/load-materialized-frontend-providers.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-administration-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-administration-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-authentication-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.d.ts +25 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.js +28 -1
- package/dist/esm/companion/application-documentation/application-connection-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-domain-documentation.d.ts +133 -0
- package/dist/esm/companion/application-documentation/application-domain-documentation.d.ts.map +1 -0
- package/dist/esm/companion/application-documentation/application-domain-documentation.js +243 -0
- package/dist/esm/companion/application-documentation/application-domain-documentation.js.map +1 -0
- package/dist/esm/companion/application-documentation/application-integration-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-integration-documentation.js +23 -0
- package/dist/esm/companion/application-documentation/application-integration-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts +30 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.js +38 -0
- package/dist/esm/companion/application-documentation/application-organization-role-documentation.js.map +1 -1
- package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts +61 -1
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js +255 -218
- package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts +2 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js +1 -0
- package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.d.ts.map +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js +1 -1
- package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js.map +1 -1
- package/dist/esm/companion/content/application-consumer-documentation-content-loader.d.ts.map +1 -1
- package/dist/esm/companion/index.d.ts +2 -1
- package/dist/esm/companion/index.d.ts.map +1 -1
- package/dist/esm/companion/index.js +2 -1
- package/dist/esm/companion/index.js.map +1 -1
- package/dist/esm/companion/manual-controller-route-projection.d.ts +112 -0
- package/dist/esm/companion/manual-controller-route-projection.d.ts.map +1 -0
- package/dist/esm/companion/manual-controller-route-projection.js +249 -0
- package/dist/esm/companion/manual-controller-route-projection.js.map +1 -0
- package/dist/esm/companion/openapi-generator.d.ts +16 -0
- package/dist/esm/companion/openapi-generator.d.ts.map +1 -1
- package/dist/esm/companion/openapi-generator.js +493 -26
- package/dist/esm/companion/openapi-generator.js.map +1 -1
- package/dist/esm/companion/operation-projection.schemas.d.ts +44 -0
- package/dist/esm/companion/operation-projection.schemas.d.ts.map +1 -1
- package/dist/esm/companion/operation-projection.schemas.js +37 -0
- package/dist/esm/companion/operation-projection.schemas.js.map +1 -1
- package/dist/esm/companion/publish-result.types.d.ts +37 -4
- package/dist/esm/companion/publish-result.types.d.ts.map +1 -1
- package/dist/esm/companion/publish-result.types.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts +7 -1
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js +34 -18
- package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js +8 -1
- package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-render-model.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-render-model.js +30 -13
- package/dist/esm/companion/rendering/technical-documentation-render-model.js.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts +10 -0
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts.map +1 -1
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js +10 -15
- package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js.map +1 -1
- package/dist/esm/companion/technical-documentation-asset-path.d.ts.map +1 -1
- package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts +27 -1
- package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts.map +1 -1
- package/dist/esm/companion/technical-documentation-capture-execution-port.js.map +1 -1
- package/dist/esm/companion/technical-documentation-diagram-definitions.d.ts +33 -0
- package/dist/esm/companion/technical-documentation-diagram-definitions.d.ts.map +1 -0
- package/dist/esm/companion/technical-documentation-diagram-definitions.js +54 -0
- package/dist/esm/companion/technical-documentation-diagram-definitions.js.map +1 -0
- package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts +10 -18
- package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts.map +1 -1
- package/dist/esm/companion/technical-documentation-diagram-materializer.js +9 -39
- package/dist/esm/companion/technical-documentation-diagram-materializer.js.map +1 -1
- package/dist/esm/companion/technical-documentation-placeholder-materializer.d.ts.map +1 -1
- package/dist/esm/companion/zod-to-openapi.d.ts.map +1 -1
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/config/define-tech-doc-config.d.ts.map +1 -1
- package/dist/esm/config/index.d.ts.map +1 -1
- package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts +8 -4
- package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts.map +1 -1
- package/dist/esm/config/wildo-tech-doc-config.schemas.js +8 -4
- package/dist/esm/config/wildo-tech-doc-config.schemas.js.map +1 -1
- package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.d.ts.map +1 -1
- package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts +42 -64
- package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts.map +1 -1
- package/dist/esm/content/application-consumer-documentation-content.techdoc.js +164 -925
- package/dist/esm/content/application-consumer-documentation-content.techdoc.js.map +1 -1
- package/dist/esm/content.exports.d.ts.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/openapi/api-reference-link-index.d.ts.map +1 -1
- package/dist/esm/openapi/index.d.ts.map +1 -1
- package/dist/esm/openapi/openapi-generation-output.schemas.d.ts.map +1 -1
- package/dist/esm/openapi-reference-model.exports.d.ts.map +1 -1
- package/dist/esm/runtime/AuthExchangePage.d.ts.map +1 -1
- package/dist/esm/runtime/DocsAuthContext.d.ts +16 -1
- package/dist/esm/runtime/DocsAuthContext.d.ts.map +1 -1
- package/dist/esm/runtime/DocsAuthContext.js +18 -2
- package/dist/esm/runtime/DocsAuthContext.js.map +1 -1
- package/dist/esm/runtime/decode-jwt-claims.d.ts.map +1 -1
- package/dist/esm/runtime/docs-auth-client.d.ts.map +1 -1
- package/dist/esm/runtime/docs-auth-session.schemas.d.ts.map +1 -1
- package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts +35 -13
- package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts.map +1 -1
- package/dist/esm/runtime/frontend-provider-registry.techdoc.js +28 -19
- package/dist/esm/runtime/frontend-provider-registry.techdoc.js.map +1 -1
- package/dist/esm/runtime/index.d.ts +1 -0
- package/dist/esm/runtime/index.d.ts.map +1 -1
- package/dist/esm/runtime/index.js +1 -0
- package/dist/esm/runtime/index.js.map +1 -1
- package/dist/esm/runtime/openapi-reference-conservation.d.ts.map +1 -1
- package/dist/esm/runtime/use-docs-auth-session.d.ts.map +1 -1
- package/dist/esm/runtime/use-docs-frontend-provider-registry.d.ts.map +1 -1
- package/dist/esm/runtime/use-docs-provider-sdks.d.ts +21 -0
- package/dist/esm/runtime/use-docs-provider-sdks.d.ts.map +1 -0
- package/dist/esm/runtime/use-docs-provider-sdks.js +49 -0
- package/dist/esm/runtime/use-docs-provider-sdks.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts +0 -9
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts.map +0 -1
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js +0 -111
- package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildo-ai/saas-technical-doc",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Generated-application technical documentation engine — application-consumer content, verified OpenAPI projection, rendering, publication validation, and the lightweight browser runtime used by documentation portals.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Wildo AI",
|
|
@@ -50,10 +50,11 @@
|
|
|
50
50
|
"test:watch": "vitest"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@wildo-ai/
|
|
54
|
-
"@wildo-ai/
|
|
55
|
-
"@wildo-ai/saas-
|
|
56
|
-
"@wildo-ai/
|
|
53
|
+
"@wildo-ai/external-connectors-public": "1.1.4",
|
|
54
|
+
"@wildo-ai/platform-config-lib": "1.1.4",
|
|
55
|
+
"@wildo-ai/saas-models": "1.1.4",
|
|
56
|
+
"@wildo-ai/saas-specifications": "1.1.4",
|
|
57
|
+
"@wildo-ai/zod-decorators": "1.1.4",
|
|
57
58
|
"yaml": "^2.3.4",
|
|
58
59
|
"zod": "4.3.6"
|
|
59
60
|
},
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type TechnicalDocumentationApiReferenceTargetV1, type TechnicalDocumentationResolvedAssetBundleManifestV1 } from '@wildo-ai/saas-specifications/technical-documentation';
|
|
2
|
-
import { type TechnicalDocumentationRenderModel, type TechnicalDocumentationRendererResult } from './technical-documentation-render-model';
|
|
3
|
-
export declare function renderTechnicalDocumentationMarkdown(input: {
|
|
4
|
-
readonly model: TechnicalDocumentationRenderModel;
|
|
5
|
-
readonly resolvedAssetBundle: TechnicalDocumentationResolvedAssetBundleManifestV1;
|
|
6
|
-
readonly assetBytesByPath: ReadonlyMap<string, Uint8Array>;
|
|
7
|
-
readonly resolveApiReferenceTarget?: (target: TechnicalDocumentationApiReferenceTargetV1) => string;
|
|
8
|
-
}): TechnicalDocumentationRendererResult;
|
|
9
|
-
//# sourceMappingURL=technical-documentation-markdown-renderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"technical-documentation-markdown-renderer.d.ts","sourceRoot":"","sources":["../../../../../src/companion/rendering/technical-documentation-markdown-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,0CAA0C,EAC/C,KAAK,mDAAmD,EAEzD,MAAM,uDAAuD,CAAC;AAG/D,OAAO,EAEL,KAAK,iCAAiC,EACtC,KAAK,oCAAoC,EAE1C,MAAM,wCAAwC,CAAC;AA+DhD,wBAAgB,oCAAoC,CAAC,KAAK,EAAE;IAC1D,QAAQ,CAAC,KAAK,EAAE,iCAAiC,CAAC;IAClD,QAAQ,CAAC,mBAAmB,EAAE,mDAAmD,CAAC;IAClF,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC3D,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CAAC,MAAM,EAAE,0CAA0C,KAAK,MAAM,CAAC;CACrG,GAAG,oCAAoC,CAkDvC"}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { TechnicalDocumentationAssetResolutionStatus, TechnicalDocumentationLinkKind, TechnicalDocumentationOutputKind, TechnicalDocumentationRendererKind, } from '@wildo-ai/saas-specifications/technical-documentation';
|
|
2
|
-
import { isImplicitLeadSection, pruneUnpublishedSiteLinks } from './technical-documentation-markdown-links.js';
|
|
3
|
-
import { createTechnicalDocumentationRendererExecution, ENGINE_UNIT_ROUTES, } from './technical-documentation-render-model.js';
|
|
4
|
-
import { technicalDocumentationAssetFileStem, } from '../technical-documentation-asset-path.js';
|
|
5
|
-
/**
|
|
6
|
-
* Statuses whose asset carries real bytes at a real path, and therefore renders.
|
|
7
|
-
*
|
|
8
|
-
* `PLACEHOLDER` belongs here with `RESOLVED`: the framework materializes a stand-in image,
|
|
9
|
-
* so the page shows a picture rather than a hole. That is the whole distinction from
|
|
10
|
-
* `MISSING` — both mean "the real capture has not run", but only one of them SHIPS
|
|
11
|
-
* something. Rendering is a question about bytes; whether provisional imagery may be
|
|
12
|
-
* published at all is an environment policy decided at publication, not here.
|
|
13
|
-
*/
|
|
14
|
-
const RENDERABLE_ASSET_STATUSES = new Set([
|
|
15
|
-
TechnicalDocumentationAssetResolutionStatus.PLACEHOLDER,
|
|
16
|
-
TechnicalDocumentationAssetResolutionStatus.RESOLVED,
|
|
17
|
-
]);
|
|
18
|
-
const MARKDOWN_RENDERER_REF = 'technical-documentation:renderer/markdown';
|
|
19
|
-
function relativeMarkdownPath(sourcePath, targetPath) {
|
|
20
|
-
const relativePath = path.relative(path.dirname(sourcePath), targetPath);
|
|
21
|
-
return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;
|
|
22
|
-
}
|
|
23
|
-
function renderLink(link, model, sourcePath, resolveApiReferenceTarget) {
|
|
24
|
-
if (link.kind === TechnicalDocumentationLinkKind.UNIT) {
|
|
25
|
-
const targetPath = model.unitPathByRef.get(link.targetUnitRef);
|
|
26
|
-
if (targetPath === undefined)
|
|
27
|
-
throw new Error(`technical-documentation link target is not in the authorized render model: ${link.targetUnitRef}`);
|
|
28
|
-
return `- [${link.label}](${relativeMarkdownPath(sourcePath, `markdown/${targetPath}.md`)})`;
|
|
29
|
-
}
|
|
30
|
-
if (link.kind === TechnicalDocumentationLinkKind.EXTERNAL)
|
|
31
|
-
return `- [${link.label}](${link.externalUrl})`;
|
|
32
|
-
if (link.kind === TechnicalDocumentationLinkKind.API_REFERENCE) {
|
|
33
|
-
if (resolveApiReferenceTarget === undefined)
|
|
34
|
-
throw new Error(`technical-documentation API-reference link was not resolved before Markdown rendering: ${link.linkRef}`);
|
|
35
|
-
return `- [${link.label}](${resolveApiReferenceTarget(link.apiReferenceTarget)})`;
|
|
36
|
-
}
|
|
37
|
-
return `- ${link.label}`;
|
|
38
|
-
}
|
|
39
|
-
function renderUnit(unit, model, assetPathByRef, resolveApiReferenceTarget) {
|
|
40
|
-
const unitPath = model.unitPathByRef.get(unit.unitRef);
|
|
41
|
-
if (unitPath === undefined)
|
|
42
|
-
throw new Error(`technical-documentation render model has no path for ${unit.unitRef}`);
|
|
43
|
-
const sourcePath = `markdown/${unitPath}.md`;
|
|
44
|
-
const publishedPaths = new Set(model.unitPathByRef.values());
|
|
45
|
-
const sections = unit.sections.map((section, index) => {
|
|
46
|
-
const body = pruneUnpublishedSiteLinks(section.bodyMarkdown, publishedPaths, ENGINE_UNIT_ROUTES);
|
|
47
|
-
return isImplicitLeadSection(section, index) ? body : `## ${section.heading}\n\n${body}`;
|
|
48
|
-
}).join('\n\n');
|
|
49
|
-
const links = unit.links.length === 0 ? '' : `\n\n## Related\n\n${unit.links.map((link) => renderLink(link, model, sourcePath, resolveApiReferenceTarget)).join('\n')}`;
|
|
50
|
-
const figures = unit.assetRequests.flatMap((request) => {
|
|
51
|
-
const assetPath = assetPathByRef.get(request.assetRef);
|
|
52
|
-
return assetPath === undefined ? [] : [`})`];
|
|
53
|
-
});
|
|
54
|
-
const assetSection = figures.length === 0 ? '' : `\n\n## Product view\n\n${figures.join('\n\n')}`;
|
|
55
|
-
return `# ${unit.title}\n\n${unit.summary}\n\n${sections}${assetSection}${links}\n`;
|
|
56
|
-
}
|
|
57
|
-
export function renderTechnicalDocumentationMarkdown(input) {
|
|
58
|
-
const assetPathByRef = new Map(input.resolvedAssetBundle.resolvedAssetSet.assets.flatMap((asset) => RENDERABLE_ASSET_STATUSES.has(asset.status) ? [[asset.assetRef, asset.normalizedRelativePath]] : []));
|
|
59
|
-
const sourceUnitRefsByAssetRef = new Map();
|
|
60
|
-
for (const unit of input.model.units) {
|
|
61
|
-
for (const request of unit.assetRequests) {
|
|
62
|
-
const owners = sourceUnitRefsByAssetRef.get(request.assetRef) ?? [];
|
|
63
|
-
owners.push(unit.unitRef);
|
|
64
|
-
sourceUnitRefsByAssetRef.set(request.assetRef, owners);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const assetFiles = input.resolvedAssetBundle.resolvedAssetSet.assets.flatMap((asset) => {
|
|
68
|
-
if (!RENDERABLE_ASSET_STATUSES.has(asset.status))
|
|
69
|
-
return [];
|
|
70
|
-
const path = asset.normalizedRelativePath;
|
|
71
|
-
const bytes = input.assetBytesByPath.get(path);
|
|
72
|
-
if (bytes === undefined)
|
|
73
|
-
throw new Error(`technical-documentation Markdown asset bytes are absent: ${path}`);
|
|
74
|
-
const sourceUnitRefs = [...(sourceUnitRefsByAssetRef.get(asset.assetRef) ?? [])].sort();
|
|
75
|
-
if (sourceUnitRefs.length === 0)
|
|
76
|
-
throw new Error(`technical-documentation resolved asset has no authorized unit owner: ${asset.assetRef}`);
|
|
77
|
-
return [{
|
|
78
|
-
outputRef: `technical-documentation:output/markdown-asset/${technicalDocumentationAssetFileStem(asset.assetRef)}`,
|
|
79
|
-
rendererRef: MARKDOWN_RENDERER_REF,
|
|
80
|
-
outputKind: TechnicalDocumentationOutputKind.ASSET,
|
|
81
|
-
sourceUnitRefs,
|
|
82
|
-
normalizedRelativePath: path,
|
|
83
|
-
mediaType: asset.mediaType,
|
|
84
|
-
bytes,
|
|
85
|
-
}];
|
|
86
|
-
});
|
|
87
|
-
return {
|
|
88
|
-
execution: createTechnicalDocumentationRendererExecution({
|
|
89
|
-
rendererKind: TechnicalDocumentationRendererKind.MARKDOWN,
|
|
90
|
-
rendererRef: MARKDOWN_RENDERER_REF,
|
|
91
|
-
rendererVersion: 1,
|
|
92
|
-
configurationRef: 'technical-documentation:renderer-configuration/markdown-v1',
|
|
93
|
-
}),
|
|
94
|
-
files: [...input.model.units.map((unit) => {
|
|
95
|
-
const path = input.model.unitPathByRef.get(unit.unitRef);
|
|
96
|
-
return {
|
|
97
|
-
// Keep the complete route identity: final path segments are not a
|
|
98
|
-
// globally unique page identity once consumer documentation has domains.
|
|
99
|
-
outputRef: `technical-documentation:output/markdown/${path.split('/').join(':')}`,
|
|
100
|
-
rendererRef: MARKDOWN_RENDERER_REF,
|
|
101
|
-
outputKind: TechnicalDocumentationOutputKind.MARKDOWN_DOCUMENT,
|
|
102
|
-
sourceUnitRefs: [unit.unitRef],
|
|
103
|
-
normalizedRelativePath: `markdown/${path}.md`,
|
|
104
|
-
mediaType: 'text/markdown',
|
|
105
|
-
bytes: Buffer.from(renderUnit(unit, input.model, assetPathByRef, input.resolveApiReferenceTarget), 'utf8'),
|
|
106
|
-
};
|
|
107
|
-
}), ...assetFiles],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
import { posix as path } from 'node:path';
|
|
111
|
-
//# sourceMappingURL=technical-documentation-markdown-renderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"technical-documentation-markdown-renderer.js","sourceRoot":"","sources":["../../../../../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,CAAC;AACD,OAAO,EAAE,KAAK,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC","sourcesContent":["import {\n TechnicalDocumentationAssetResolutionStatus,\n TechnicalDocumentationLinkKind,\n TechnicalDocumentationOutputKind,\n TechnicalDocumentationRendererKind,\n type TechnicalDocumentationLinkV1,\n type TechnicalDocumentationApiReferenceTargetV1,\n type TechnicalDocumentationResolvedAssetBundleManifestV1,\n type TechnicalDocumentationUnitV1,\n} from '@wildo-ai/saas-specifications/technical-documentation';\nimport { isImplicitLeadSection, pruneUnpublishedSiteLinks } from './technical-documentation-markdown-links';\n\nimport {\n createTechnicalDocumentationRendererExecution,\n type TechnicalDocumentationRenderModel,\n type TechnicalDocumentationRendererResult,\n ENGINE_UNIT_ROUTES,\n} from './technical-documentation-render-model';\nimport {\n technicalDocumentationAssetFileStem,\n} from '../technical-documentation-asset-path';\n\n/**\n * Statuses whose asset carries real bytes at a real path, and therefore renders.\n *\n * `PLACEHOLDER` belongs here with `RESOLVED`: the framework materializes a stand-in image,\n * so the page shows a picture rather than a hole. That is the whole distinction from\n * `MISSING` — both mean \"the real capture has not run\", but only one of them SHIPS\n * something. Rendering is a question about bytes; whether provisional imagery may be\n * published at all is an environment policy decided at publication, not here.\n */\nconst RENDERABLE_ASSET_STATUSES: ReadonlySet<TechnicalDocumentationAssetResolutionStatus> = new Set([\n TechnicalDocumentationAssetResolutionStatus.PLACEHOLDER,\n TechnicalDocumentationAssetResolutionStatus.RESOLVED,\n]);\n\nconst MARKDOWN_RENDERER_REF = 'technical-documentation:renderer/markdown';\n\nfunction relativeMarkdownPath(sourcePath: string, targetPath: string): string {\n const relativePath = path.relative(path.dirname(sourcePath), targetPath);\n return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n}\n\nfunction renderLink(link: TechnicalDocumentationLinkV1, model: TechnicalDocumentationRenderModel, sourcePath: string, resolveApiReferenceTarget?: (target: TechnicalDocumentationApiReferenceTargetV1) => string): string {\n if (link.kind === TechnicalDocumentationLinkKind.UNIT) {\n const targetPath = model.unitPathByRef.get(link.targetUnitRef as string);\n if (targetPath === undefined) throw new Error(`technical-documentation link target is not in the authorized render model: ${link.targetUnitRef}`);\n return `- [${link.label}](${relativeMarkdownPath(sourcePath, `markdown/${targetPath}.md`)})`;\n }\n if (link.kind === TechnicalDocumentationLinkKind.EXTERNAL) return `- [${link.label}](${link.externalUrl})`;\n if (link.kind === TechnicalDocumentationLinkKind.API_REFERENCE) {\n if (resolveApiReferenceTarget === undefined) throw new Error(`technical-documentation API-reference link was not resolved before Markdown rendering: ${link.linkRef}`);\n return `- [${link.label}](${resolveApiReferenceTarget(link.apiReferenceTarget as TechnicalDocumentationApiReferenceTargetV1)})`;\n }\n return `- ${link.label}`;\n}\n\nfunction renderUnit(\n unit: TechnicalDocumentationUnitV1,\n model: TechnicalDocumentationRenderModel,\n assetPathByRef: ReadonlyMap<string, string>,\n resolveApiReferenceTarget?: (target: TechnicalDocumentationApiReferenceTargetV1) => string,\n): string {\n const unitPath = model.unitPathByRef.get(unit.unitRef);\n if (unitPath === undefined) throw new Error(`technical-documentation render model has no path for ${unit.unitRef}`);\n const sourcePath = `markdown/${unitPath}.md`;\n const publishedPaths = new Set(model.unitPathByRef.values());\n const sections = unit.sections.map((section, index) => {\n const body = pruneUnpublishedSiteLinks(section.bodyMarkdown, publishedPaths, ENGINE_UNIT_ROUTES);\n return isImplicitLeadSection(section, index) ? body : `## ${section.heading}\\n\\n${body}`;\n }).join('\\n\\n');\n const links = unit.links.length === 0 ? '' : `\\n\\n## Related\\n\\n${unit.links.map((link) => renderLink(link, model, sourcePath, resolveApiReferenceTarget)).join('\\n')}`;\n const figures = unit.assetRequests.flatMap((request) => {\n const assetPath = assetPathByRef.get(request.assetRef);\n return assetPath === undefined ? [] : [`})`];\n });\n const assetSection = figures.length === 0 ? '' : `\\n\\n## Product view\\n\\n${figures.join('\\n\\n')}`;\n return `# ${unit.title}\\n\\n${unit.summary}\\n\\n${sections}${assetSection}${links}\\n`;\n}\n\nexport function renderTechnicalDocumentationMarkdown(input: {\n readonly model: TechnicalDocumentationRenderModel;\n readonly resolvedAssetBundle: TechnicalDocumentationResolvedAssetBundleManifestV1;\n readonly assetBytesByPath: ReadonlyMap<string, Uint8Array>;\n readonly resolveApiReferenceTarget?: (target: TechnicalDocumentationApiReferenceTargetV1) => string;\n}): TechnicalDocumentationRendererResult {\n const assetPathByRef = new Map(input.resolvedAssetBundle.resolvedAssetSet.assets.flatMap((asset) =>\n RENDERABLE_ASSET_STATUSES.has(asset.status) ? [[asset.assetRef, asset.normalizedRelativePath as string]] : []));\n const sourceUnitRefsByAssetRef = new Map<string, string[]>();\n for (const unit of input.model.units) {\n for (const request of unit.assetRequests) {\n const owners = sourceUnitRefsByAssetRef.get(request.assetRef) ?? [];\n owners.push(unit.unitRef);\n sourceUnitRefsByAssetRef.set(request.assetRef, owners);\n }\n }\n const assetFiles = input.resolvedAssetBundle.resolvedAssetSet.assets.flatMap((asset) => {\n if (!RENDERABLE_ASSET_STATUSES.has(asset.status)) return [];\n const path = asset.normalizedRelativePath as string;\n const bytes = input.assetBytesByPath.get(path);\n if (bytes === undefined) throw new Error(`technical-documentation Markdown asset bytes are absent: ${path}`);\n const sourceUnitRefs = [...(sourceUnitRefsByAssetRef.get(asset.assetRef) ?? [])].sort();\n if (sourceUnitRefs.length === 0) throw new Error(`technical-documentation resolved asset has no authorized unit owner: ${asset.assetRef}`);\n return [{\n outputRef: `technical-documentation:output/markdown-asset/${technicalDocumentationAssetFileStem(asset.assetRef)}`,\n rendererRef: MARKDOWN_RENDERER_REF,\n outputKind: TechnicalDocumentationOutputKind.ASSET,\n sourceUnitRefs,\n normalizedRelativePath: path,\n mediaType: asset.mediaType,\n bytes,\n }];\n });\n return {\n execution: createTechnicalDocumentationRendererExecution({\n rendererKind: TechnicalDocumentationRendererKind.MARKDOWN,\n rendererRef: MARKDOWN_RENDERER_REF,\n rendererVersion: 1,\n configurationRef: 'technical-documentation:renderer-configuration/markdown-v1',\n }),\n files: [...input.model.units.map((unit) => {\n const path = input.model.unitPathByRef.get(unit.unitRef) as string;\n return {\n // Keep the complete route identity: final path segments are not a\n // globally unique page identity once consumer documentation has domains.\n outputRef: `technical-documentation:output/markdown/${path.split('/').join(':')}`,\n rendererRef: MARKDOWN_RENDERER_REF,\n outputKind: TechnicalDocumentationOutputKind.MARKDOWN_DOCUMENT,\n sourceUnitRefs: [unit.unitRef],\n normalizedRelativePath: `markdown/${path}.md`,\n mediaType: 'text/markdown',\n bytes: Buffer.from(renderUnit(unit, input.model, assetPathByRef, input.resolveApiReferenceTarget), 'utf8'),\n };\n }), ...assetFiles],\n };\n}\nimport { posix as path } from 'node:path';\n"]}
|