@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.
Files changed (216) hide show
  1. package/LICENSE +34 -0
  2. package/dist/esm/.builder.pid +9 -0
  3. package/dist/esm/build/csp-emit.d.ts +9 -0
  4. package/dist/esm/build/csp-emit.d.ts.map +1 -0
  5. package/dist/esm/build/csp-emit.js +8 -0
  6. package/dist/esm/build/csp-emit.js.map +1 -0
  7. package/dist/esm/build/load-materialized-frontend-providers.d.ts +9 -0
  8. package/dist/esm/build/load-materialized-frontend-providers.d.ts.map +1 -0
  9. package/dist/esm/build/load-materialized-frontend-providers.js +9 -0
  10. package/dist/esm/build/load-materialized-frontend-providers.js.map +1 -0
  11. package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts +66 -0
  12. package/dist/esm/companion/application-documentation/application-organization-role-documentation.d.ts.map +1 -0
  13. package/dist/esm/companion/application-documentation/application-organization-role-documentation.js +195 -0
  14. package/dist/esm/companion/application-documentation/application-organization-role-documentation.js.map +1 -0
  15. package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.d.ts +36 -0
  16. package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.d.ts.map +1 -0
  17. package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.js +71 -0
  18. package/dist/esm/companion/application-documentation/application-organization-unit-resource-documentation.js.map +1 -0
  19. package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts +37 -0
  20. package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.d.ts.map +1 -0
  21. package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js +1865 -0
  22. package/dist/esm/companion/application-documentation/technical-documentation-engine-content-bundle.js.map +1 -0
  23. package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.d.ts +22 -0
  24. package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.d.ts.map +1 -0
  25. package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.js +31 -0
  26. package/dist/esm/companion/application-documentation/technical-documentation-operational-evidence.js.map +1 -0
  27. package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts +31 -0
  28. package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.d.ts.map +1 -0
  29. package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js +33 -0
  30. package/dist/esm/companion/application-documentation/technical-documentation-private-derivation.js.map +1 -0
  31. package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.d.ts +13 -0
  32. package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.d.ts.map +1 -0
  33. package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js +93 -0
  34. package/dist/esm/companion/application-documentation/technical-documentation-publication-policy.js.map +1 -0
  35. package/dist/esm/companion/content/application-consumer-documentation-content-loader.d.ts +52 -0
  36. package/dist/esm/companion/content/application-consumer-documentation-content-loader.d.ts.map +1 -0
  37. package/dist/esm/companion/content/application-consumer-documentation-content-loader.js +191 -0
  38. package/dist/esm/companion/content/application-consumer-documentation-content-loader.js.map +1 -0
  39. package/dist/esm/companion/index.d.ts +39 -0
  40. package/dist/esm/companion/index.d.ts.map +1 -0
  41. package/dist/esm/companion/index.js +39 -0
  42. package/dist/esm/companion/index.js.map +1 -0
  43. package/dist/esm/companion/openapi-generator.d.ts +94 -0
  44. package/dist/esm/companion/openapi-generator.d.ts.map +1 -0
  45. package/dist/esm/companion/openapi-generator.js +1562 -0
  46. package/dist/esm/companion/openapi-generator.js.map +1 -0
  47. package/dist/esm/companion/operation-projection.schemas.d.ts +797 -0
  48. package/dist/esm/companion/operation-projection.schemas.d.ts.map +1 -0
  49. package/dist/esm/companion/operation-projection.schemas.js +610 -0
  50. package/dist/esm/companion/operation-projection.schemas.js.map +1 -0
  51. package/dist/esm/companion/publish-result.types.d.ts +124 -0
  52. package/dist/esm/companion/publish-result.types.d.ts.map +1 -0
  53. package/dist/esm/companion/publish-result.types.js +28 -0
  54. package/dist/esm/companion/publish-result.types.js.map +1 -0
  55. package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.d.ts +26 -0
  56. package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.d.ts.map +1 -0
  57. package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.js +63 -0
  58. package/dist/esm/companion/rendering/technical-documentation-authorized-bundle-reader.js.map +1 -0
  59. package/dist/esm/companion/rendering/technical-documentation-build-measurement.d.ts +23 -0
  60. package/dist/esm/companion/rendering/technical-documentation-build-measurement.d.ts.map +1 -0
  61. package/dist/esm/companion/rendering/technical-documentation-build-measurement.js +104 -0
  62. package/dist/esm/companion/rendering/technical-documentation-build-measurement.js.map +1 -0
  63. package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts +9 -0
  64. package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.d.ts.map +1 -0
  65. package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js +421 -0
  66. package/dist/esm/companion/rendering/technical-documentation-docusaurus-renderer.js.map +1 -0
  67. package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.d.ts +72 -0
  68. package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.d.ts.map +1 -0
  69. package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js +204 -0
  70. package/dist/esm/companion/rendering/technical-documentation-managed-tree-validator.js.map +1 -0
  71. package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts +9 -0
  72. package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.d.ts.map +1 -0
  73. package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js +106 -0
  74. package/dist/esm/companion/rendering/technical-documentation-markdown-renderer.js.map +1 -0
  75. package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.d.ts +43 -0
  76. package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.d.ts.map +1 -0
  77. package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.js +88 -0
  78. package/dist/esm/companion/rendering/technical-documentation-mdx-escaping.js.map +1 -0
  79. package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.d.ts +7 -0
  80. package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.d.ts.map +1 -0
  81. package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.js +51 -0
  82. package/dist/esm/companion/rendering/technical-documentation-openapi-renderer.js.map +1 -0
  83. package/dist/esm/companion/rendering/technical-documentation-render-model.d.ts +45 -0
  84. package/dist/esm/companion/rendering/technical-documentation-render-model.d.ts.map +1 -0
  85. package/dist/esm/companion/rendering/technical-documentation-render-model.js +178 -0
  86. package/dist/esm/companion/rendering/technical-documentation-render-model.js.map +1 -0
  87. package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts +3 -0
  88. package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.d.ts.map +1 -0
  89. package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js +49 -0
  90. package/dist/esm/companion/rendering/technical-documentation-search-index-renderer.js.map +1 -0
  91. package/dist/esm/companion/spec-to-operation-doc.d.ts +176 -0
  92. package/dist/esm/companion/spec-to-operation-doc.d.ts.map +1 -0
  93. package/dist/esm/companion/spec-to-operation-doc.js +326 -0
  94. package/dist/esm/companion/spec-to-operation-doc.js.map +1 -0
  95. package/dist/esm/companion/technical-documentation-asset-path.d.ts +16 -0
  96. package/dist/esm/companion/technical-documentation-asset-path.d.ts.map +1 -0
  97. package/dist/esm/companion/technical-documentation-asset-path.js +19 -0
  98. package/dist/esm/companion/technical-documentation-asset-path.js.map +1 -0
  99. package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts +14 -0
  100. package/dist/esm/companion/technical-documentation-capture-execution-port.d.ts.map +1 -0
  101. package/dist/esm/companion/technical-documentation-capture-execution-port.js +1 -0
  102. package/dist/esm/companion/technical-documentation-capture-execution-port.js.map +1 -0
  103. package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts +25 -0
  104. package/dist/esm/companion/technical-documentation-diagram-materializer.d.ts.map +1 -0
  105. package/dist/esm/companion/technical-documentation-diagram-materializer.js +86 -0
  106. package/dist/esm/companion/technical-documentation-diagram-materializer.js.map +1 -0
  107. package/dist/esm/companion/technical-documentation-placeholder-materializer.d.ts +17 -0
  108. package/dist/esm/companion/technical-documentation-placeholder-materializer.d.ts.map +1 -0
  109. package/dist/esm/companion/technical-documentation-placeholder-materializer.js +63 -0
  110. package/dist/esm/companion/technical-documentation-placeholder-materializer.js.map +1 -0
  111. package/dist/esm/companion/zod-to-openapi.d.ts +67 -0
  112. package/dist/esm/companion/zod-to-openapi.d.ts.map +1 -0
  113. package/dist/esm/companion/zod-to-openapi.js +211 -0
  114. package/dist/esm/companion/zod-to-openapi.js.map +1 -0
  115. package/dist/esm/companion-exports.d.ts +32 -0
  116. package/dist/esm/companion-exports.d.ts.map +1 -0
  117. package/dist/esm/companion-exports.js +32 -0
  118. package/dist/esm/companion-exports.js.map +1 -0
  119. package/dist/esm/config/define-tech-doc-config.d.ts +38 -0
  120. package/dist/esm/config/define-tech-doc-config.d.ts.map +1 -0
  121. package/dist/esm/config/define-tech-doc-config.js +40 -0
  122. package/dist/esm/config/define-tech-doc-config.js.map +1 -0
  123. package/dist/esm/config/index.d.ts +22 -0
  124. package/dist/esm/config/index.d.ts.map +1 -0
  125. package/dist/esm/config/index.js +22 -0
  126. package/dist/esm/config/index.js.map +1 -0
  127. package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts +204 -0
  128. package/dist/esm/config/wildo-tech-doc-config.schemas.d.ts.map +1 -0
  129. package/dist/esm/config/wildo-tech-doc-config.schemas.js +192 -0
  130. package/dist/esm/config/wildo-tech-doc-config.schemas.js.map +1 -0
  131. package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.d.ts +82 -0
  132. package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.d.ts.map +1 -0
  133. package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.js +114 -0
  134. package/dist/esm/content/application-consumer-documentation-content-manifest.schemas.js.map +1 -0
  135. package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts +420 -0
  136. package/dist/esm/content/application-consumer-documentation-content.techdoc.d.ts.map +1 -0
  137. package/dist/esm/content/application-consumer-documentation-content.techdoc.js +9619 -0
  138. package/dist/esm/content/application-consumer-documentation-content.techdoc.js.map +1 -0
  139. package/dist/esm/content.exports.d.ts +9 -0
  140. package/dist/esm/content.exports.d.ts.map +1 -0
  141. package/dist/esm/content.exports.js +9 -0
  142. package/dist/esm/content.exports.js.map +1 -0
  143. package/dist/esm/index.d.ts +26 -0
  144. package/dist/esm/index.d.ts.map +1 -0
  145. package/dist/esm/index.js +26 -0
  146. package/dist/esm/index.js.map +1 -0
  147. package/dist/esm/openapi/api-reference-link-index.d.ts +98 -0
  148. package/dist/esm/openapi/api-reference-link-index.d.ts.map +1 -0
  149. package/dist/esm/openapi/api-reference-link-index.js +301 -0
  150. package/dist/esm/openapi/api-reference-link-index.js.map +1 -0
  151. package/dist/esm/openapi/api-reference-targets.d.ts +71 -0
  152. package/dist/esm/openapi/api-reference-targets.d.ts.map +1 -0
  153. package/dist/esm/openapi/api-reference-targets.js +114 -0
  154. package/dist/esm/openapi/api-reference-targets.js.map +1 -0
  155. package/dist/esm/openapi/index.d.ts +20 -0
  156. package/dist/esm/openapi/index.d.ts.map +1 -0
  157. package/dist/esm/openapi/index.js +20 -0
  158. package/dist/esm/openapi/index.js.map +1 -0
  159. package/dist/esm/openapi/openapi-generation-output.schemas.d.ts +80 -0
  160. package/dist/esm/openapi/openapi-generation-output.schemas.d.ts.map +1 -0
  161. package/dist/esm/openapi/openapi-generation-output.schemas.js +76 -0
  162. package/dist/esm/openapi/openapi-generation-output.schemas.js.map +1 -0
  163. package/dist/esm/openapi-reference-model.exports.d.ts +10 -0
  164. package/dist/esm/openapi-reference-model.exports.d.ts.map +1 -0
  165. package/dist/esm/openapi-reference-model.exports.js +10 -0
  166. package/dist/esm/openapi-reference-model.exports.js.map +1 -0
  167. package/dist/esm/runtime/AuthExchangePage.d.ts +84 -0
  168. package/dist/esm/runtime/AuthExchangePage.d.ts.map +1 -0
  169. package/dist/esm/runtime/AuthExchangePage.js +188 -0
  170. package/dist/esm/runtime/AuthExchangePage.js.map +1 -0
  171. package/dist/esm/runtime/DocsAuthContext.d.ts +119 -0
  172. package/dist/esm/runtime/DocsAuthContext.d.ts.map +1 -0
  173. package/dist/esm/runtime/DocsAuthContext.js +171 -0
  174. package/dist/esm/runtime/DocsAuthContext.js.map +1 -0
  175. package/dist/esm/runtime/decode-jwt-claims.d.ts +39 -0
  176. package/dist/esm/runtime/decode-jwt-claims.d.ts.map +1 -0
  177. package/dist/esm/runtime/decode-jwt-claims.js +86 -0
  178. package/dist/esm/runtime/decode-jwt-claims.js.map +1 -0
  179. package/dist/esm/runtime/docs-auth-client.d.ts +193 -0
  180. package/dist/esm/runtime/docs-auth-client.d.ts.map +1 -0
  181. package/dist/esm/runtime/docs-auth-client.js +211 -0
  182. package/dist/esm/runtime/docs-auth-client.js.map +1 -0
  183. package/dist/esm/runtime/docs-auth-session.schemas.d.ts +77 -0
  184. package/dist/esm/runtime/docs-auth-session.schemas.d.ts.map +1 -0
  185. package/dist/esm/runtime/docs-auth-session.schemas.js +50 -0
  186. package/dist/esm/runtime/docs-auth-session.schemas.js.map +1 -0
  187. package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts +17 -0
  188. package/dist/esm/runtime/frontend-provider-registry.techdoc.d.ts.map +1 -0
  189. package/dist/esm/runtime/frontend-provider-registry.techdoc.js +23 -0
  190. package/dist/esm/runtime/frontend-provider-registry.techdoc.js.map +1 -0
  191. package/dist/esm/runtime/index.d.ts +57 -0
  192. package/dist/esm/runtime/index.d.ts.map +1 -0
  193. package/dist/esm/runtime/index.js +76 -0
  194. package/dist/esm/runtime/index.js.map +1 -0
  195. package/dist/esm/runtime/openapi-reference-conservation.d.ts +20 -0
  196. package/dist/esm/runtime/openapi-reference-conservation.d.ts.map +1 -0
  197. package/dist/esm/runtime/openapi-reference-conservation.js +102 -0
  198. package/dist/esm/runtime/openapi-reference-conservation.js.map +1 -0
  199. package/dist/esm/runtime/openapi-reference-model.d.ts +224 -0
  200. package/dist/esm/runtime/openapi-reference-model.d.ts.map +1 -0
  201. package/dist/esm/runtime/openapi-reference-model.js +579 -0
  202. package/dist/esm/runtime/openapi-reference-model.js.map +1 -0
  203. package/dist/esm/runtime/openapi-reference-view.d.ts +13 -0
  204. package/dist/esm/runtime/openapi-reference-view.d.ts.map +1 -0
  205. package/dist/esm/runtime/openapi-reference-view.js +284 -0
  206. package/dist/esm/runtime/openapi-reference-view.js.map +1 -0
  207. package/dist/esm/runtime/use-docs-auth-session.d.ts +26 -0
  208. package/dist/esm/runtime/use-docs-auth-session.d.ts.map +1 -0
  209. package/dist/esm/runtime/use-docs-auth-session.js +34 -0
  210. package/dist/esm/runtime/use-docs-auth-session.js.map +1 -0
  211. package/dist/esm/runtime/use-docs-frontend-provider-registry.d.ts +3 -0
  212. package/dist/esm/runtime/use-docs-frontend-provider-registry.d.ts.map +1 -0
  213. package/dist/esm/runtime/use-docs-frontend-provider-registry.js +5 -0
  214. package/dist/esm/runtime/use-docs-frontend-provider-registry.js.map +1 -0
  215. package/dist/tsconfig.build.tsbuildinfo +1 -0
  216. package/package.json +117 -0
package/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ Copyright (c) 2026 P2C Consulting, s.à r.l.-S
2
+ RCS Luxembourg B307591
3
+ 6C, Porte de France, L-4360 Esch-sur-Alzette, Luxembourg
4
+
5
+ All rights reserved.
6
+
7
+ This software and its accompanying materials (the "Software") are the
8
+ confidential and proprietary property of P2C Consulting, s.à r.l.-S (the
9
+ "Licensor"). The Software is made available for viewing only. No licence,
10
+ right, or permission of any kind is granted by its publication or by its
11
+ availability on any package registry or source repository.
12
+
13
+ Without the Licensor's prior written permission, you may not use, copy,
14
+ reproduce, modify, adapt, translate, merge, publish, distribute, sublicense,
15
+ sell, host, or create derivative works of the Software, in whole or in part,
16
+ nor use it to provide a service to any third party.
17
+
18
+ Publication of the Software in any public registry is for distribution to
19
+ authorised recipients and for technical evaluation of its packaging only. It
20
+ does not place the Software in the public domain, does not constitute an open
21
+ source release, and does not waive any right of the Licensor.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
+
30
+ Third-party components distributed with the Software remain governed by their
31
+ own licences.
32
+
33
+ Contact: P2C Consulting, s.à r.l.-S, 6C, Porte de France, L-4360
34
+ Esch-sur-Alzette, Luxembourg.
@@ -0,0 +1,9 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "writerPid": 95135,
4
+ "orchestratorPid": 94847,
5
+ "orchestratorSessionId": null,
6
+ "orchestratorStartedAt": "Mon Aug 31 09:18:19 2026",
7
+ "distDirectory": "/Users/paulcayon/Projects/Wildo.ai/dev/wildo-ai/engine/saas-technical-doc/dist/esm",
8
+ "acquiredAt": "2026-08-31T07:18:20.748Z"
9
+ }
@@ -0,0 +1,9 @@
1
+ import { emitCspArtifacts as emitPlatformCspArtifacts, resolveCspPolicy as resolvePlatformCspPolicy, rewriteNginxCspMarkerPairs as rewritePlatformNginxCspMarkerPairs, rewriteNginxCspMarkerPairsString as rewritePlatformNginxCspMarkerPairsString, type CspEmitArtifacts, type ResolvedCspDirectiveMap, type ResolvedCspPolicy, type ResolveCspPolicyInput, type RewriteNginxResult } from '@wildo-ai/platform-config-lib';
2
+ export type { CspEmitArtifacts, ResolvedCspDirectiveMap, ResolvedCspPolicy, ResolveCspPolicyInput, RewriteNginxResult, };
3
+ export declare const NGINX_CSP_BEGIN_MARKER = "# >>> wildo csp begin";
4
+ export declare const NGINX_CSP_END_MARKER = "# <<< wildo csp end";
5
+ export declare const resolveCspPolicy: typeof resolvePlatformCspPolicy;
6
+ export declare const emitCspArtifacts: typeof emitPlatformCspArtifacts;
7
+ export declare const rewriteNginxCspMarkerPairs: typeof rewritePlatformNginxCspMarkerPairs;
8
+ export declare const rewriteNginxCspMarkerPairsString: typeof rewritePlatformNginxCspMarkerPairsString;
9
+ //# sourceMappingURL=csp-emit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp-emit.d.ts","sourceRoot":"","sources":["../../../../src/build/csp-emit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,wBAAwB,EAG5C,gBAAgB,IAAI,wBAAwB,EAC5C,0BAA0B,IAAI,kCAAkC,EAChE,gCAAgC,IAAI,wCAAwC,EAC5E,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,+BAA+B,CAAC;AAEvC,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,CAAC;AAEF,eAAO,MAAM,sBAAsB,0BAAkC,CAAC;AACtE,eAAO,MAAM,oBAAoB,wBAAgC,CAAC;AAClE,eAAO,MAAM,gBAAgB,iCAA2B,CAAC;AACzD,eAAO,MAAM,gBAAgB,iCAA2B,CAAC;AACzD,eAAO,MAAM,0BAA0B,2CAAqC,CAAC;AAC7E,eAAO,MAAM,gCAAgC,iDAA2C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { emitCspArtifacts as emitPlatformCspArtifacts, NGINX_CSP_BEGIN_MARKER as PLATFORM_NGINX_CSP_BEGIN_MARKER, NGINX_CSP_END_MARKER as PLATFORM_NGINX_CSP_END_MARKER, resolveCspPolicy as resolvePlatformCspPolicy, rewriteNginxCspMarkerPairs as rewritePlatformNginxCspMarkerPairs, rewriteNginxCspMarkerPairsString as rewritePlatformNginxCspMarkerPairsString, } from '@wildo-ai/platform-config-lib';
2
+ export const NGINX_CSP_BEGIN_MARKER = PLATFORM_NGINX_CSP_BEGIN_MARKER;
3
+ export const NGINX_CSP_END_MARKER = PLATFORM_NGINX_CSP_END_MARKER;
4
+ export const resolveCspPolicy = resolvePlatformCspPolicy;
5
+ export const emitCspArtifacts = emitPlatformCspArtifacts;
6
+ export const rewriteNginxCspMarkerPairs = rewritePlatformNginxCspMarkerPairs;
7
+ export const rewriteNginxCspMarkerPairsString = rewritePlatformNginxCspMarkerPairsString;
8
+ //# sourceMappingURL=csp-emit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csp-emit.js","sourceRoot":"","sources":["../../../../src/build/csp-emit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,wBAAwB,EAC5C,sBAAsB,IAAI,+BAA+B,EACzD,oBAAoB,IAAI,6BAA6B,EACrD,gBAAgB,IAAI,wBAAwB,EAC5C,0BAA0B,IAAI,kCAAkC,EAChE,gCAAgC,IAAI,wCAAwC,GAM7E,MAAM,+BAA+B,CAAC;AAUvC,MAAM,CAAC,MAAM,sBAAsB,GAAG,+BAA+B,CAAC;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAA6B,CAAC;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AACzD,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AACzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAC7E,MAAM,CAAC,MAAM,gCAAgC,GAAG,wCAAwC,CAAC","sourcesContent":["import {\n emitCspArtifacts as emitPlatformCspArtifacts,\n NGINX_CSP_BEGIN_MARKER as PLATFORM_NGINX_CSP_BEGIN_MARKER,\n NGINX_CSP_END_MARKER as PLATFORM_NGINX_CSP_END_MARKER,\n resolveCspPolicy as resolvePlatformCspPolicy,\n rewriteNginxCspMarkerPairs as rewritePlatformNginxCspMarkerPairs,\n rewriteNginxCspMarkerPairsString as rewritePlatformNginxCspMarkerPairsString,\n type CspEmitArtifacts,\n type ResolvedCspDirectiveMap,\n type ResolvedCspPolicy,\n type ResolveCspPolicyInput,\n type RewriteNginxResult,\n} from '@wildo-ai/platform-config-lib';\n\nexport type {\n CspEmitArtifacts,\n ResolvedCspDirectiveMap,\n ResolvedCspPolicy,\n ResolveCspPolicyInput,\n RewriteNginxResult,\n};\n\nexport const NGINX_CSP_BEGIN_MARKER = PLATFORM_NGINX_CSP_BEGIN_MARKER;\nexport const NGINX_CSP_END_MARKER = PLATFORM_NGINX_CSP_END_MARKER;\nexport const resolveCspPolicy = resolvePlatformCspPolicy;\nexport const emitCspArtifacts = emitPlatformCspArtifacts;\nexport const rewriteNginxCspMarkerPairs = rewritePlatformNginxCspMarkerPairs;\nexport const rewriteNginxCspMarkerPairsString = rewritePlatformNginxCspMarkerPairsString;\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Re-export of the canonical frontend-providers loader helpers.
3
+ * The implementation lives in `@wildo-ai/platform-config-lib`
4
+ * (`provider-runtime-artifacts.ts`) so the website + tech-doc + any
5
+ * future build-time consumer share one source of truth — see the
6
+ * dedup-rationale JSDoc on `loadMaterializedFrontendProviders` there.
7
+ */
8
+ export { loadMaterializedFrontendProviders, resolveFrontendServicesArtifactPath, } from '@wildo-ai/platform-config-lib';
9
+ //# sourceMappingURL=load-materialized-frontend-providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-materialized-frontend-providers.d.ts","sourceRoot":"","sources":["../../../../src/build/load-materialized-frontend-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,iCAAiC,EACjC,mCAAmC,GACpC,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Re-export of the canonical frontend-providers loader helpers.
3
+ * The implementation lives in `@wildo-ai/platform-config-lib`
4
+ * (`provider-runtime-artifacts.ts`) so the website + tech-doc + any
5
+ * future build-time consumer share one source of truth — see the
6
+ * dedup-rationale JSDoc on `loadMaterializedFrontendProviders` there.
7
+ */
8
+ export { loadMaterializedFrontendProviders, resolveFrontendServicesArtifactPath, } from '@wildo-ai/platform-config-lib';
9
+ //# sourceMappingURL=load-materialized-frontend-providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-materialized-frontend-providers.js","sourceRoot":"","sources":["../../../../src/build/load-materialized-frontend-providers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,iCAAiC,EACjC,mCAAmC,GACpC,MAAM,+BAA+B,CAAC","sourcesContent":["/**\n * Re-export of the canonical frontend-providers loader helpers.\n * The implementation lives in `@wildo-ai/platform-config-lib`\n * (`provider-runtime-artifacts.ts`) so the website + tech-doc + any\n * future build-time consumer share one source of truth — see the\n * dedup-rationale JSDoc on `loadMaterializedFrontendProviders` there.\n */\nexport {\n loadMaterializedFrontendProviders,\n resolveFrontendServicesArtifactPath,\n} from '@wildo-ai/platform-config-lib';\n"]}
@@ -0,0 +1,66 @@
1
+ import { ResourcePrimaryScope } from '@wildo-ai/saas-models';
2
+ import type { ApplicationOrganizationRolesDocumentationFact } from './technical-documentation-engine-content-bundle';
3
+ export declare const APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_REF: "source:companion-projection:organization-roles";
4
+ /** Advances when this projection's shape changes; it is the fact's version wherever provenance cites it. */
5
+ export declare const APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_VERSION = 1;
6
+ /** Minimal application/engine role specification needed by consumer documentation. */
7
+ export interface ApplicationRoleDocumentationSource {
8
+ readonly ref: string;
9
+ readonly purpose: string | null;
10
+ readonly businessRole: string | null;
11
+ readonly authorityBoundary: string | null;
12
+ readonly useWhen: string | null;
13
+ readonly avoidWhen: string | null;
14
+ readonly businessConstraints: readonly string[] | null;
15
+ }
16
+ /**
17
+ * Application-independent organization-role projection before UI labels are
18
+ * joined. The introspection subprocess can safely emit this JSON-only shape;
19
+ * the parent companion later joins the application's primary-locale labels.
20
+ */
21
+ export interface ApplicationOrganizationRoleDocumentationSource {
22
+ readonly role: string;
23
+ readonly inheritFrom: string | null;
24
+ readonly purpose: string;
25
+ readonly businessRole: string | null;
26
+ readonly authorityBoundary: string;
27
+ readonly useWhen: string;
28
+ readonly avoidWhen: string;
29
+ readonly businessConstraints: readonly string[];
30
+ }
31
+ /** Complete consumer-visible role documentation after the application label join. */
32
+ export interface ApplicationOrganizationRoleDocumentation extends ApplicationOrganizationRoleDocumentationSource {
33
+ readonly label: string;
34
+ readonly description: string;
35
+ }
36
+ interface ApplicationRoleConfigurationProjectionInput {
37
+ readonly role?: string;
38
+ readonly inheritFrom?: string;
39
+ readonly relatedPrimaryScope: ResourcePrimaryScope;
40
+ }
41
+ /**
42
+ * Index companion-exported role specifications by their runtime role token.
43
+ * Engine and application-defined roles intentionally share this namespace.
44
+ */
45
+ export declare function indexApplicationRoleDocumentationSources(roleSpecifications: Record<string, unknown> | undefined): ReadonlyMap<string, ApplicationRoleDocumentationSource>;
46
+ /**
47
+ * Resolve every framework and application-defined organization role from the
48
+ * application's merged runtime registry and authored role specifications.
49
+ * Application-scoped roles are deliberately excluded from this organization
50
+ * administration reference.
51
+ */
52
+ export declare function projectApplicationOrganizationRoleDocumentationSources(customRoles: Readonly<Record<string, ApplicationRoleConfigurationProjectionInput>> | undefined, roleSpecsByRef: ReadonlyMap<string, ApplicationRoleDocumentationSource>): readonly ApplicationOrganizationRoleDocumentationSource[];
53
+ /**
54
+ * Join role semantics to the exact primary-locale labels shown by the
55
+ * application. Missing values fail closed: publishing a guessed label would
56
+ * make the guide disagree with member-management and role-picker UI.
57
+ */
58
+ export declare function resolveApplicationOrganizationRoleDocumentation(roles: readonly ApplicationOrganizationRoleDocumentationSource[], primaryLocaleLabels: Readonly<Record<string, string>>): readonly ApplicationOrganizationRoleDocumentation[];
59
+ /**
60
+ * Materialize the reusable Markdown fact consumed by the Roles and permissions
61
+ * topic. This function knows no application identity: different applications
62
+ * receive different role inputs and therefore different facts.
63
+ */
64
+ export declare function createApplicationOrganizationRolesDocumentationFact(roles: readonly ApplicationOrganizationRoleDocumentation[]): ApplicationOrganizationRolesDocumentationFact;
65
+ export {};
66
+ //# sourceMappingURL=application-organization-role-documentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-organization-role-documentation.d.ts","sourceRoot":"","sources":["../../../../../src/companion/application-documentation/application-organization-role-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,iDAAiD,CAAC;AAErH,eAAO,MAAM,uDAAuD,EAAG,gDAAyD,CAAC;AACjI,4GAA4G;AAC5G,eAAO,MAAM,2DAA2D,IAAI,CAAC;AAE7E,sFAAsF;AACtF,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CACxD;AAED;;;;GAIG;AACH,MAAM,WAAW,8CAA8C;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAA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AK,EAAE,SAAS,wCAAwC,EAAE,GACzD,6CAA6C,CAgC/C"}
@@ -0,0 +1,195 @@
1
+ import { CORE_ORG_ROLES, DEFAULT_ORGANIZATION_ROLES, ResourcePrimaryScope, } from '@wildo-ai/saas-models';
2
+ export const APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_REF = 'source:companion-projection:organization-roles';
3
+ /** Advances when this projection's shape changes; it is the fact's version wherever provenance cites it. */
4
+ export const APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_VERSION = 1;
5
+ /**
6
+ * Index companion-exported role specifications by their runtime role token.
7
+ * Engine and application-defined roles intentionally share this namespace.
8
+ */
9
+ export function indexApplicationRoleDocumentationSources(roleSpecifications) {
10
+ const result = new Map();
11
+ for (const candidate of Object.values(roleSpecifications ?? {})) {
12
+ if (!isPlainObject(candidate) || typeof candidate.ref !== 'string' || candidate.ref.length === 0)
13
+ continue;
14
+ if (result.has(candidate.ref)) {
15
+ throw new Error(`application organization-role projector: duplicate role specification for '${candidate.ref}'`);
16
+ }
17
+ result.set(candidate.ref, {
18
+ ref: candidate.ref,
19
+ purpose: nonEmptyStringOrNull(candidate.purpose),
20
+ businessRole: nonEmptyStringOrNull(candidate.businessRole),
21
+ authorityBoundary: nonEmptyStringOrNull(candidate.authorityBoundary),
22
+ useWhen: nonEmptyStringOrNull(candidate.useWhen),
23
+ avoidWhen: nonEmptyStringOrNull(candidate.avoidWhen),
24
+ businessConstraints: nonEmptyStringArrayOrNull(candidate.businessConstraints),
25
+ });
26
+ }
27
+ return result;
28
+ }
29
+ /**
30
+ * Resolve every framework and application-defined organization role from the
31
+ * application's merged runtime registry and authored role specifications.
32
+ * Application-scoped roles are deliberately excluded from this organization
33
+ * administration reference.
34
+ */
35
+ export function projectApplicationOrganizationRoleDocumentationSources(customRoles, roleSpecsByRef) {
36
+ const configured = new Map();
37
+ for (const config of Object.values(DEFAULT_ORGANIZATION_ROLES)) {
38
+ if (typeof config.role !== 'string' || config.role.length === 0) {
39
+ throw new Error('application organization-role projector: framework organization role configuration has no role token');
40
+ }
41
+ configured.set(config.role, { ...config, role: config.role });
42
+ }
43
+ for (const config of Object.values(customRoles ?? {})) {
44
+ if (typeof config.role !== 'string' || config.role.length === 0) {
45
+ throw new Error('application organization-role projector: application organization role configuration has no role token');
46
+ }
47
+ if (configured.has(config.role)) {
48
+ throw new Error(`application organization-role projector: application role '${config.role}' collides with a framework organization role`);
49
+ }
50
+ configured.set(config.role, { ...config, role: config.role });
51
+ }
52
+ return Object.freeze([...configured.values()]
53
+ .filter((config) => config.relatedPrimaryScope === ResourcePrimaryScope.ORGANIZATIONS)
54
+ .map((config) => {
55
+ const specification = roleSpecsByRef.get(config.role);
56
+ if (specification === undefined
57
+ || specification.purpose === null
58
+ || specification.authorityBoundary === null
59
+ || specification.useWhen === null
60
+ || specification.avoidWhen === null
61
+ || specification.businessConstraints === null) {
62
+ throw new Error(`application organization-role projector: organization role '${config.role}' has no companion-exported role specification with complete consumer guidance`);
63
+ }
64
+ return Object.freeze({
65
+ role: config.role,
66
+ inheritFrom: config.inheritFrom ?? null,
67
+ purpose: specification.purpose,
68
+ businessRole: specification.businessRole,
69
+ authorityBoundary: specification.authorityBoundary,
70
+ useWhen: specification.useWhen,
71
+ avoidWhen: specification.avoidWhen,
72
+ businessConstraints: specification.businessConstraints,
73
+ });
74
+ })
75
+ .sort((left, right) => left.role.localeCompare(right.role, 'en-US')));
76
+ }
77
+ /**
78
+ * Join role semantics to the exact primary-locale labels shown by the
79
+ * application. Missing values fail closed: publishing a guessed label would
80
+ * make the guide disagree with member-management and role-picker UI.
81
+ */
82
+ export function resolveApplicationOrganizationRoleDocumentation(roles, primaryLocaleLabels) {
83
+ return Object.freeze(roles.map((role) => Object.freeze({
84
+ ...role,
85
+ label: requiredRoleLabel(primaryLocaleLabels, role.role, 'label'),
86
+ description: requiredRoleLabel(primaryLocaleLabels, role.role, 'description'),
87
+ })));
88
+ }
89
+ /**
90
+ * Materialize the reusable Markdown fact consumed by the Roles and permissions
91
+ * topic. This function knows no application identity: different applications
92
+ * receive different role inputs and therefore different facts.
93
+ */
94
+ export function createApplicationOrganizationRolesDocumentationFact(roles) {
95
+ if (roles.length === 0)
96
+ throw new Error('technical documentation requires at least one resolved organization role');
97
+ if (new Set(roles.map((role) => role.role)).size !== roles.length) {
98
+ throw new Error('technical documentation received duplicate resolved organization roles');
99
+ }
100
+ const roleByIdentifier = new Map(roles.map((role) => [role.role, role]));
101
+ const hierarchyDepthByRole = new Map(roles.map((role) => [role.role, hierarchyDepth(role, roleByIdentifier)]));
102
+ // Readers compare authority from broadest to narrowest. Derive that order
103
+ // from the actual inheritance chain; sibling branches use visible labels and
104
+ // stable role tokens only as deterministic tie-breakers.
105
+ const canonicalRoles = [...roles].sort((left, right) => hierarchyDepthByRole.get(right.role) - hierarchyDepthByRole.get(left.role)
106
+ || left.label.localeCompare(right.label, 'en-US')
107
+ || left.role.localeCompare(right.role, 'en-US'));
108
+ const roleSections = canonicalRoles.map((role) => {
109
+ const inheritedRole = role.inheritFrom === null ? undefined : roleByIdentifier.get(role.inheritFrom);
110
+ const inheritance = role.inheritFrom === null
111
+ ? 'This role does not inherit another organization role.'
112
+ : `This role includes the permissions of **${markdownText(inheritedRole?.label ?? role.inheritFrom)}** (${inlineCode(role.inheritFrom)}).`;
113
+ const limits = [role.avoidWhen, ...role.businessConstraints]
114
+ .map((constraint) => `- ${markdownProse(constraint)}`)
115
+ .join('\n');
116
+ return `### ${markdownText(role.label)}\n\n${markdownText(role.description)}\n\n- **Where it applies:** ${markdownProse(role.authorityBoundary)}\n- **Inherited access:** ${inheritance}\n- **Technical identifier:** ${inlineCode(role.role)}\n\n#### Can do\n\n${markdownProse(role.purpose)}\n\n${markdownProse(role.useWhen)}\n\n#### Cannot do\n\n${limits}\n\n#### Can assign\n\n${roleAssignmentMarkdown(role, roleByIdentifier)}`;
117
+ }).join('\n\n');
118
+ return Object.freeze({
119
+ sourceRef: APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_REF,
120
+ markdown: `These are all the organization roles available in this application. Their names and short descriptions match the application's primary-language interface; the technical identifier is included so you can recognize the same role in an access request, audit record, or API response.\n\n${roleSections}\n\n> **How inherited access works:** when one role includes another, it receives the included role’s permissions as well as its own. The reverse is not true: assigning the included role never grants the higher role.`,
121
+ sourceVersion: APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_VERSION,
122
+ });
123
+ }
124
+ function hierarchyDepth(role, roleByIdentifier, ancestors = new Set()) {
125
+ if (role.inheritFrom === null)
126
+ return 0;
127
+ if (ancestors.has(role.role)) {
128
+ throw new Error(`technical documentation organization-role hierarchy contains a cycle at ${role.role}`);
129
+ }
130
+ const inheritedRole = roleByIdentifier.get(role.inheritFrom);
131
+ if (inheritedRole === undefined) {
132
+ throw new Error(`technical documentation organization role ${role.role} inherits absent role ${role.inheritFrom}`);
133
+ }
134
+ return 1 + hierarchyDepth(inheritedRole, roleByIdentifier, new Set([...ancestors, role.role]));
135
+ }
136
+ /**
137
+ * Explain the standard organization-role assignment ceiling from the exact
138
+ * application role graph. This deliberately does not flatten custom roles into
139
+ * a total order: sibling custom branches are outside one another's ceiling.
140
+ * A role must also inherit the administrator gate before it can use the
141
+ * standard membership and unit-assignment controls at all.
142
+ */
143
+ function roleAssignmentMarkdown(role, roleByIdentifier) {
144
+ const effectiveRoles = [];
145
+ let current = role;
146
+ const visited = new Set();
147
+ while (current !== undefined) {
148
+ if (visited.has(current.role)) {
149
+ throw new Error(`technical documentation organization-role hierarchy contains a cycle at ${current.role}`);
150
+ }
151
+ visited.add(current.role);
152
+ effectiveRoles.push(current);
153
+ current = current.inheritFrom === null ? undefined : roleByIdentifier.get(current.inheritFrom);
154
+ }
155
+ if (!effectiveRoles.some((candidate) => candidate.role === CORE_ORG_ROLES.ORG_ADMIN)) {
156
+ return 'This role cannot use the standard organization-membership or organization-unit assignment controls. It therefore cannot assign an organization or unit role through those controls.';
157
+ }
158
+ const assignableRoles = effectiveRoles
159
+ .map((candidate) => `**${markdownText(candidate.label)}** (${inlineCode(candidate.role)})`)
160
+ .join(', ');
161
+ return `Through the standard membership and unit-assignment controls, this role can assign: ${assignableRoles}. It cannot assign a role outside this inheritance chain unless the person also holds another organization-wide role whose chain includes it.`;
162
+ }
163
+ function requiredRoleLabel(labels, role, field) {
164
+ const key = `roles.${role}.${field}`;
165
+ const value = labels[key];
166
+ if (typeof value !== 'string' || value.trim().length === 0) {
167
+ throw new Error(`application organization-role documentation requires primary-locale label '${key}'; generate the application's role labels before publishing documentation`);
168
+ }
169
+ return value.trim();
170
+ }
171
+ function nonEmptyStringOrNull(value) {
172
+ return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;
173
+ }
174
+ function nonEmptyStringArrayOrNull(value) {
175
+ if (!Array.isArray(value) || value.length === 0)
176
+ return null;
177
+ const normalized = value.map(nonEmptyStringOrNull);
178
+ return normalized.every((entry) => entry !== null)
179
+ ? Object.freeze(normalized)
180
+ : null;
181
+ }
182
+ function isPlainObject(value) {
183
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
184
+ }
185
+ function markdownText(value) {
186
+ return value.replaceAll(/\s+/g, ' ').trim().replaceAll('\\', '\\\\').replaceAll(/([`*_[\]<>#|])/g, '\\$1');
187
+ }
188
+ /** Role specifications intentionally author small inline-Markdown semantics. */
189
+ function markdownProse(value) {
190
+ return value.replaceAll(/\s+/g, ' ').trim();
191
+ }
192
+ function inlineCode(value) {
193
+ return `\`${value.replaceAll('`', '&#96;')}\``;
194
+ }
195
+ //# sourceMappingURL=application-organization-role-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-organization-role-documentation.js","sourceRoot":"","sources":["../../../../../src/companion/application-documentation/application-organization-role-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAM/B,MAAM,CAAC,MAAM,uDAAuD,GAAG,gDAAyD,CA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IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACnD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;QACjE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;QAC3B,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC7G,CAAC;AAED,gFAAgF;AAChF,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,KAAK,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC;AACjD,CAAC","sourcesContent":["import {\n CORE_ORG_ROLES,\n DEFAULT_ORGANIZATION_ROLES,\n ResourcePrimaryScope,\n} from '@wildo-ai/saas-models';\nimport {\n} from '@wildo-ai/saas-specifications/technical-documentation';\n\nimport type { ApplicationOrganizationRolesDocumentationFact } from './technical-documentation-engine-content-bundle';\n\nexport const APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_REF = 'source:companion-projection:organization-roles' as const;\n/** Advances when this projection's shape changes; it is the fact's version wherever provenance cites it. */\nexport const APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_VERSION = 1;\n\n/** Minimal application/engine role specification needed by consumer documentation. */\nexport interface ApplicationRoleDocumentationSource {\n readonly ref: string;\n readonly purpose: string | null;\n readonly businessRole: string | null;\n readonly authorityBoundary: string | null;\n readonly useWhen: string | null;\n readonly avoidWhen: string | null;\n readonly businessConstraints: readonly string[] | null;\n}\n\n/**\n * Application-independent organization-role projection before UI labels are\n * joined. The introspection subprocess can safely emit this JSON-only shape;\n * the parent companion later joins the application's primary-locale labels.\n */\nexport interface ApplicationOrganizationRoleDocumentationSource {\n readonly role: string;\n readonly inheritFrom: string | null;\n readonly purpose: string;\n readonly businessRole: string | null;\n readonly authorityBoundary: string;\n readonly useWhen: string;\n readonly avoidWhen: string;\n readonly businessConstraints: readonly string[];\n}\n\n/** Complete consumer-visible role documentation after the application label join. */\nexport interface ApplicationOrganizationRoleDocumentation extends ApplicationOrganizationRoleDocumentationSource {\n readonly label: string;\n readonly description: string;\n}\n\ninterface ApplicationRoleConfigurationProjectionInput {\n readonly role?: string;\n readonly inheritFrom?: string;\n readonly relatedPrimaryScope: ResourcePrimaryScope;\n}\n\n/**\n * Index companion-exported role specifications by their runtime role token.\n * Engine and application-defined roles intentionally share this namespace.\n */\nexport function indexApplicationRoleDocumentationSources(\n roleSpecifications: Record<string, unknown> | undefined,\n): ReadonlyMap<string, ApplicationRoleDocumentationSource> {\n const result = new Map<string, ApplicationRoleDocumentationSource>();\n for (const candidate of Object.values(roleSpecifications ?? {})) {\n if (!isPlainObject(candidate) || typeof candidate.ref !== 'string' || candidate.ref.length === 0) continue;\n if (result.has(candidate.ref)) {\n throw new Error(`application organization-role projector: duplicate role specification for '${candidate.ref}'`);\n }\n result.set(candidate.ref, {\n ref: candidate.ref,\n purpose: nonEmptyStringOrNull(candidate.purpose),\n businessRole: nonEmptyStringOrNull(candidate.businessRole),\n authorityBoundary: nonEmptyStringOrNull(candidate.authorityBoundary),\n useWhen: nonEmptyStringOrNull(candidate.useWhen),\n avoidWhen: nonEmptyStringOrNull(candidate.avoidWhen),\n businessConstraints: nonEmptyStringArrayOrNull(candidate.businessConstraints),\n });\n }\n return result;\n}\n\n/**\n * Resolve every framework and application-defined organization role from the\n * application's merged runtime registry and authored role specifications.\n * Application-scoped roles are deliberately excluded from this organization\n * administration reference.\n */\nexport function projectApplicationOrganizationRoleDocumentationSources(\n customRoles: Readonly<Record<string, ApplicationRoleConfigurationProjectionInput>> | undefined,\n roleSpecsByRef: ReadonlyMap<string, ApplicationRoleDocumentationSource>,\n): readonly ApplicationOrganizationRoleDocumentationSource[] {\n const configured = new Map<string, ApplicationRoleConfigurationProjectionInput & { readonly role: string }>();\n for (const config of Object.values(DEFAULT_ORGANIZATION_ROLES)) {\n if (typeof config.role !== 'string' || config.role.length === 0) {\n throw new Error('application organization-role projector: framework organization role configuration has no role token');\n }\n configured.set(config.role, { ...config, role: config.role });\n }\n for (const config of Object.values(customRoles ?? {})) {\n if (typeof config.role !== 'string' || config.role.length === 0) {\n throw new Error('application organization-role projector: application organization role configuration has no role token');\n }\n if (configured.has(config.role)) {\n throw new Error(`application organization-role projector: application role '${config.role}' collides with a framework organization role`);\n }\n configured.set(config.role, { ...config, role: config.role });\n }\n\n return Object.freeze([...configured.values()]\n .filter((config) => config.relatedPrimaryScope === ResourcePrimaryScope.ORGANIZATIONS)\n .map((config) => {\n const specification = roleSpecsByRef.get(config.role);\n if (\n specification === undefined\n || specification.purpose === null\n || specification.authorityBoundary === null\n || specification.useWhen === null\n || specification.avoidWhen === null\n || specification.businessConstraints === null\n ) {\n throw new Error(\n `application organization-role projector: organization role '${config.role}' has no companion-exported role specification with complete consumer guidance`,\n );\n }\n return Object.freeze({\n role: config.role,\n inheritFrom: config.inheritFrom ?? null,\n purpose: specification.purpose,\n businessRole: specification.businessRole,\n authorityBoundary: specification.authorityBoundary,\n useWhen: specification.useWhen,\n avoidWhen: specification.avoidWhen,\n businessConstraints: specification.businessConstraints,\n });\n })\n .sort((left, right) => left.role.localeCompare(right.role, 'en-US')));\n}\n\n/**\n * Join role semantics to the exact primary-locale labels shown by the\n * application. Missing values fail closed: publishing a guessed label would\n * make the guide disagree with member-management and role-picker UI.\n */\nexport function resolveApplicationOrganizationRoleDocumentation(\n roles: readonly ApplicationOrganizationRoleDocumentationSource[],\n primaryLocaleLabels: Readonly<Record<string, string>>,\n): readonly ApplicationOrganizationRoleDocumentation[] {\n return Object.freeze(roles.map((role) => Object.freeze({\n ...role,\n label: requiredRoleLabel(primaryLocaleLabels, role.role, 'label'),\n description: requiredRoleLabel(primaryLocaleLabels, role.role, 'description'),\n })));\n}\n\n/**\n * Materialize the reusable Markdown fact consumed by the Roles and permissions\n * topic. This function knows no application identity: different applications\n * receive different role inputs and therefore different facts.\n */\nexport function createApplicationOrganizationRolesDocumentationFact(\n roles: readonly ApplicationOrganizationRoleDocumentation[],\n): ApplicationOrganizationRolesDocumentationFact {\n if (roles.length === 0) throw new Error('technical documentation requires at least one resolved organization role');\n if (new Set(roles.map((role) => role.role)).size !== roles.length) {\n throw new Error('technical documentation received duplicate resolved organization roles');\n }\n\n const roleByIdentifier = new Map(roles.map((role) => [role.role, role]));\n const hierarchyDepthByRole = new Map(roles.map((role) => [role.role, hierarchyDepth(role, roleByIdentifier)]));\n // Readers compare authority from broadest to narrowest. Derive that order\n // from the actual inheritance chain; sibling branches use visible labels and\n // stable role tokens only as deterministic tie-breakers.\n const canonicalRoles = [...roles].sort((left, right) =>\n hierarchyDepthByRole.get(right.role)! - hierarchyDepthByRole.get(left.role)!\n || left.label.localeCompare(right.label, 'en-US')\n || left.role.localeCompare(right.role, 'en-US'));\n\n const roleSections = canonicalRoles.map((role) => {\n const inheritedRole = role.inheritFrom === null ? undefined : roleByIdentifier.get(role.inheritFrom);\n const inheritance = role.inheritFrom === null\n ? 'This role does not inherit another organization role.'\n : `This role includes the permissions of **${markdownText(inheritedRole?.label ?? role.inheritFrom)}** (${inlineCode(role.inheritFrom)}).`;\n const limits = [role.avoidWhen, ...role.businessConstraints]\n .map((constraint) => `- ${markdownProse(constraint)}`)\n .join('\\n');\n return `### ${markdownText(role.label)}\\n\\n${markdownText(role.description)}\\n\\n- **Where it applies:** ${markdownProse(role.authorityBoundary)}\\n- **Inherited access:** ${inheritance}\\n- **Technical identifier:** ${inlineCode(role.role)}\\n\\n#### Can do\\n\\n${markdownProse(role.purpose)}\\n\\n${markdownProse(role.useWhen)}\\n\\n#### Cannot do\\n\\n${limits}\\n\\n#### Can assign\\n\\n${roleAssignmentMarkdown(role, roleByIdentifier)}`;\n }).join('\\n\\n');\n\n return Object.freeze({\n sourceRef: APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_REF,\n markdown: `These are all the organization roles available in this application. Their names and short descriptions match the application's primary-language interface; the technical identifier is included so you can recognize the same role in an access request, audit record, or API response.\\n\\n${roleSections}\\n\\n> **How inherited access works:** when one role includes another, it receives the included role’s permissions as well as its own. The reverse is not true: assigning the included role never grants the higher role.`,\n sourceVersion: APPLICATION_ORGANIZATION_ROLES_DOCUMENTATION_SOURCE_VERSION,\n });\n}\n\nfunction hierarchyDepth(\n role: ApplicationOrganizationRoleDocumentation,\n roleByIdentifier: ReadonlyMap<string, ApplicationOrganizationRoleDocumentation>,\n ancestors = new Set<string>(),\n): number {\n if (role.inheritFrom === null) return 0;\n if (ancestors.has(role.role)) {\n throw new Error(`technical documentation organization-role hierarchy contains a cycle at ${role.role}`);\n }\n const inheritedRole = roleByIdentifier.get(role.inheritFrom);\n if (inheritedRole === undefined) {\n throw new Error(`technical documentation organization role ${role.role} inherits absent role ${role.inheritFrom}`);\n }\n return 1 + hierarchyDepth(inheritedRole, roleByIdentifier, new Set([...ancestors, role.role]));\n}\n\n/**\n * Explain the standard organization-role assignment ceiling from the exact\n * application role graph. This deliberately does not flatten custom roles into\n * a total order: sibling custom branches are outside one another's ceiling.\n * A role must also inherit the administrator gate before it can use the\n * standard membership and unit-assignment controls at all.\n */\nfunction roleAssignmentMarkdown(\n role: ApplicationOrganizationRoleDocumentation,\n roleByIdentifier: ReadonlyMap<string, ApplicationOrganizationRoleDocumentation>,\n): string {\n const effectiveRoles: ApplicationOrganizationRoleDocumentation[] = [];\n let current: ApplicationOrganizationRoleDocumentation | undefined = role;\n const visited = new Set<string>();\n while (current !== undefined) {\n if (visited.has(current.role)) {\n throw new Error(`technical documentation organization-role hierarchy contains a cycle at ${current.role}`);\n }\n visited.add(current.role);\n effectiveRoles.push(current);\n current = current.inheritFrom === null ? undefined : roleByIdentifier.get(current.inheritFrom);\n }\n\n if (!effectiveRoles.some((candidate) => candidate.role === CORE_ORG_ROLES.ORG_ADMIN)) {\n return 'This role cannot use the standard organization-membership or organization-unit assignment controls. It therefore cannot assign an organization or unit role through those controls.';\n }\n\n const assignableRoles = effectiveRoles\n .map((candidate) => `**${markdownText(candidate.label)}** (${inlineCode(candidate.role)})`)\n .join(', ');\n return `Through the standard membership and unit-assignment controls, this role can assign: ${assignableRoles}. It cannot assign a role outside this inheritance chain unless the person also holds another organization-wide role whose chain includes it.`;\n}\n\nfunction requiredRoleLabel(\n labels: Readonly<Record<string, string>>,\n role: string,\n field: 'label' | 'description',\n): string {\n const key = `roles.${role}.${field}`;\n const value = labels[key];\n if (typeof value !== 'string' || value.trim().length === 0) {\n throw new Error(\n `application organization-role documentation requires primary-locale label '${key}'; generate the application's role labels before publishing documentation`,\n );\n }\n return value.trim();\n}\n\nfunction nonEmptyStringOrNull(value: unknown): string | null {\n return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;\n}\n\nfunction nonEmptyStringArrayOrNull(value: unknown): readonly string[] | null {\n if (!Array.isArray(value) || value.length === 0) return null;\n const normalized = value.map(nonEmptyStringOrNull);\n return normalized.every((entry): entry is string => entry !== null)\n ? Object.freeze(normalized)\n : null;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction markdownText(value: string): string {\n return value.replaceAll(/\\s+/g, ' ').trim().replaceAll('\\\\', '\\\\\\\\').replaceAll(/([`*_[\\]<>#|])/g, '\\\\$1');\n}\n\n/** Role specifications intentionally author small inline-Markdown semantics. */\nfunction markdownProse(value: string): string {\n return value.replaceAll(/\\s+/g, ' ').trim();\n}\n\nfunction inlineCode(value: string): string {\n return `\\`${value.replaceAll('`', '&#96;')}\\``;\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import type { ResourceTag } from '../operation-projection.schemas';
2
+ export declare const APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF: "source:companion-projection:organization-unit-aware-resources";
3
+ /** Advances when this projection's shape changes; it is the fact's version wherever provenance cites it. */
4
+ export declare const APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_VERSION = 1;
5
+ /** Exact Markdown fact composed into the organization-unit task pages. */
6
+ export interface ApplicationOrganizationUnitResourcesDocumentationFact {
7
+ readonly sourceRef: typeof APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF;
8
+ readonly markdown: string;
9
+ readonly sourceVersion: number;
10
+ }
11
+ /**
12
+ * Consumer-safe view of one application resource that explicitly opts into
13
+ * organization-unit narrowing. The internal field holding the unit identity is
14
+ * deliberately absent: administrators need to know which business information
15
+ * is narrowed, not how its persistence schema implements that decision.
16
+ */
17
+ export interface ApplicationOrganizationUnitResourceDocumentation {
18
+ readonly resourceIdentifier: string;
19
+ readonly label: string;
20
+ readonly purpose: string;
21
+ }
22
+ /**
23
+ * Project the exact startup declaration into a small consumer-safe fact list.
24
+ *
25
+ * The declaration is the only authority for inclusion. A unit-shaped URL, a
26
+ * relationship to organization units, or a similarly named field is not
27
+ * evidence that runtime authorization narrows the resource. Every included
28
+ * resource must also have specification-owned purpose prose; publication fails
29
+ * rather than exposing a raw identifier with no explanation.
30
+ */
31
+ export declare function projectApplicationOrganizationUnitResourceDocumentation(organizationUnitNarrowing: Readonly<Partial<Record<string, {
32
+ readonly unitFieldName: string;
33
+ }>>> | undefined, resourceTags: readonly ResourceTag[]): readonly ApplicationOrganizationUnitResourceDocumentation[];
34
+ /** Materialize the application-specific list inserted into unit-access guides. */
35
+ export declare function createApplicationOrganizationUnitResourcesDocumentationFact(resources: readonly ApplicationOrganizationUnitResourceDocumentation[]): ApplicationOrganizationUnitResourcesDocumentationFact;
36
+ //# sourceMappingURL=application-organization-unit-resource-documentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-organization-unit-resource-documentation.d.ts","sourceRoot":"","sources":["../../../../../src/companion/application-documentation/application-organization-unit-resource-documentation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,eAAO,MAAM,gEAAgE,EAC3E,+DAAwE,CAAC;AAC3E,4GAA4G;AAC5G,eAAO,MAAM,oEAAoE,IAAI,CAAC;AAEtF,0EAA0E;AAC1E,MAAM,WAAW,qDAAqD;IACpE,QAAQ,CAAC,SAAS,EAAE,OAAO,gEAAgE,CAAC;IAC5F,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;GAKG;AACH,MAAM,WAAW,gDAAgD;IAC/D,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,uDAAuD,CACrE,yBAAyB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC,GAAG,SAAS,EAC5G,YAAY,EAAE,SAAS,WAAW,EAAE,GACnC,SAAS,gDAAgD,EAAE,CA4B7D;AAED,kFAAkF;AAClF,wBAAgB,2DAA2D,CACzE,SAAS,EAAE,SAAS,gDAAgD,EAAE,GACrE,qDAAqD,CAiBvD"}
@@ -0,0 +1,71 @@
1
+ export const APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF = 'source:companion-projection:organization-unit-aware-resources';
2
+ /** Advances when this projection's shape changes; it is the fact's version wherever provenance cites it. */
3
+ export const APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_VERSION = 1;
4
+ /**
5
+ * Project the exact startup declaration into a small consumer-safe fact list.
6
+ *
7
+ * The declaration is the only authority for inclusion. A unit-shaped URL, a
8
+ * relationship to organization units, or a similarly named field is not
9
+ * evidence that runtime authorization narrows the resource. Every included
10
+ * resource must also have specification-owned purpose prose; publication fails
11
+ * rather than exposing a raw identifier with no explanation.
12
+ */
13
+ export function projectApplicationOrganizationUnitResourceDocumentation(organizationUnitNarrowing, resourceTags) {
14
+ const tagsByIdentifier = new Map();
15
+ for (const tag of resourceTags) {
16
+ if (tagsByIdentifier.has(tag.name)) {
17
+ throw new Error(`application organization-unit resource projector: duplicate resource tag '${tag.name}'`);
18
+ }
19
+ tagsByIdentifier.set(tag.name, tag);
20
+ }
21
+ return Object.freeze(Object.entries(organizationUnitNarrowing ?? {})
22
+ .filter((entry) => entry[1] !== undefined)
23
+ .map(([resourceIdentifier, declaration]) => {
24
+ if (declaration.unitFieldName.trim().length === 0) {
25
+ throw new Error(`application organization-unit resource projector: '${resourceIdentifier}' has an empty narrowing field declaration`);
26
+ }
27
+ const tag = tagsByIdentifier.get(resourceIdentifier);
28
+ if (tag?.description === undefined || tag.description.trim().length === 0) {
29
+ throw new Error(`application organization-unit resource projector: narrowed resource '${resourceIdentifier}' has no specification-owned purpose`);
30
+ }
31
+ return Object.freeze({
32
+ resourceIdentifier,
33
+ label: resourceDisplayLabel(resourceIdentifier),
34
+ purpose: tag.description.trim(),
35
+ });
36
+ })
37
+ .sort((left, right) => left.label.localeCompare(right.label, 'en-US') || left.resourceIdentifier.localeCompare(right.resourceIdentifier, 'en-US')));
38
+ }
39
+ /** Materialize the application-specific list inserted into unit-access guides. */
40
+ export function createApplicationOrganizationUnitResourcesDocumentationFact(resources) {
41
+ if (new Set(resources.map((resource) => resource.resourceIdentifier)).size !== resources.length) {
42
+ throw new Error('technical documentation received duplicate organization-unit-aware resources');
43
+ }
44
+ const canonicalResources = [...resources]
45
+ .sort((left, right) => left.label.localeCompare(right.label, 'en-US') || left.resourceIdentifier.localeCompare(right.resourceIdentifier, 'en-US'));
46
+ const markdown = canonicalResources.length === 0
47
+ ? '**This application does not currently declare any business resource as organization-unit-aware.** A unit assignment therefore grants no additional access until the application publishes such a resource.'
48
+ : `This application currently applies organization-unit access to:\n\n${canonicalResources
49
+ .map((resource) => `- **${markdownText(resource.label)}** — ${markdownText(resource.purpose)}`)
50
+ .join('\n')}\n\nOnly the resources listed here use unit assignments. Other application information continues to follow its organization-wide operation rules.`;
51
+ return Object.freeze({
52
+ sourceRef: APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF,
53
+ markdown,
54
+ sourceVersion: APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_VERSION,
55
+ });
56
+ }
57
+ /** Match the native API-reference fallback without changing resource identity. */
58
+ function resourceDisplayLabel(identifier) {
59
+ return identifier
60
+ .replaceAll(/([a-z0-9])([A-Z])/g, '$1 $2')
61
+ .replaceAll(/[-_]+/g, ' ')
62
+ .trim()
63
+ .split(/\s+/u)
64
+ .filter(Boolean)
65
+ .map((word) => (/^[A-Z0-9]+$/u.test(word) ? word : `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`))
66
+ .join(' ');
67
+ }
68
+ function markdownText(value) {
69
+ return value.replaceAll(/\s+/g, ' ').trim().replaceAll('\\', '\\\\').replaceAll(/([`*_[\]<>#|])/g, '\\$1');
70
+ }
71
+ //# sourceMappingURL=application-organization-unit-resource-documentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-organization-unit-resource-documentation.js","sourceRoot":"","sources":["../../../../../src/companion/application-documentation/application-organization-unit-resource-documentation.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,gEAAgE,GAC3E,+DAAwE,CAAC;AAC3E,4GAA4G;AAC5G,MAAM,CAAC,MAAM,oEAAoE,GAAG,CAAC,CAAC;AAqBtF;;;;;;;;GAQG;AACH,MAAM,UAAU,uDAAuD,CACrE,yBAA4G,EAC5G,YAAoC;IAEpC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAC;IACxD,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,IAAI,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,6EAA6E,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;QAC5G,CAAC;QACD,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,IAAI,EAAE,CAAC;SACjE,MAAM,CAAC,CAAC,KAAK,EAAyD,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;SAChG,GAAG,CAAC,CAAC,CAAC,kBAAkB,EAAE,WAAW,CAAC,EAAE,EAAE;QACzC,IAAI,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,sDAAsD,kBAAkB,4CAA4C,CAAC,CAAC;QACxI,CAAC;QACD,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACrD,IAAI,GAAG,EAAE,WAAW,KAAK,SAAS,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,EA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B;aACvF,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;aAC9F,IAAI,CAAC,IAAI,CAAC,mJAAmJ,CAAC;IAEnK,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS,EAAE,gEAAgE;QAC3E,QAAQ;QACR,aAAa,EAAE,oEAAoE;KACpF,CAAC,CAAC;AACL,CAAC;AAED,kFAAkF;AAClF,SAAS,oBAAoB,CAAC,UAAkB;IAC9C,OAAO,UAAU;SACd,UAAU,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACzC,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC;SACzB,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,CAAC;SACb,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SACnH,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["import {\n} from '@wildo-ai/saas-specifications/technical-documentation';\n\nimport type { ResourceTag } from '../operation-projection.schemas';\n\nexport const APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF =\n 'source:companion-projection:organization-unit-aware-resources' as const;\n/** Advances when this projection's shape changes; it is the fact's version wherever provenance cites it. */\nexport const APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_VERSION = 1;\n\n/** Exact Markdown fact composed into the organization-unit task pages. */\nexport interface ApplicationOrganizationUnitResourcesDocumentationFact {\n readonly sourceRef: typeof APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF;\n readonly markdown: string;\n readonly sourceVersion: number;\n}\n\n/**\n * Consumer-safe view of one application resource that explicitly opts into\n * organization-unit narrowing. The internal field holding the unit identity is\n * deliberately absent: administrators need to know which business information\n * is narrowed, not how its persistence schema implements that decision.\n */\nexport interface ApplicationOrganizationUnitResourceDocumentation {\n readonly resourceIdentifier: string;\n readonly label: string;\n readonly purpose: string;\n}\n\n/**\n * Project the exact startup declaration into a small consumer-safe fact list.\n *\n * The declaration is the only authority for inclusion. A unit-shaped URL, a\n * relationship to organization units, or a similarly named field is not\n * evidence that runtime authorization narrows the resource. Every included\n * resource must also have specification-owned purpose prose; publication fails\n * rather than exposing a raw identifier with no explanation.\n */\nexport function projectApplicationOrganizationUnitResourceDocumentation(\n organizationUnitNarrowing: Readonly<Partial<Record<string, { readonly unitFieldName: string }>>> | undefined,\n resourceTags: readonly ResourceTag[],\n): readonly ApplicationOrganizationUnitResourceDocumentation[] {\n const tagsByIdentifier = new Map<string, ResourceTag>();\n for (const tag of resourceTags) {\n if (tagsByIdentifier.has(tag.name)) {\n throw new Error(`application organization-unit resource projector: duplicate resource tag '${tag.name}'`);\n }\n tagsByIdentifier.set(tag.name, tag);\n }\n\n return Object.freeze(Object.entries(organizationUnitNarrowing ?? {})\n .filter((entry): entry is [string, { readonly unitFieldName: string }] => entry[1] !== undefined)\n .map(([resourceIdentifier, declaration]) => {\n if (declaration.unitFieldName.trim().length === 0) {\n throw new Error(`application organization-unit resource projector: '${resourceIdentifier}' has an empty narrowing field declaration`);\n }\n const tag = tagsByIdentifier.get(resourceIdentifier);\n if (tag?.description === undefined || tag.description.trim().length === 0) {\n throw new Error(\n `application organization-unit resource projector: narrowed resource '${resourceIdentifier}' has no specification-owned purpose`,\n );\n }\n return Object.freeze({\n resourceIdentifier,\n label: resourceDisplayLabel(resourceIdentifier),\n purpose: tag.description.trim(),\n });\n })\n .sort((left, right) => left.label.localeCompare(right.label, 'en-US') || left.resourceIdentifier.localeCompare(right.resourceIdentifier, 'en-US')));\n}\n\n/** Materialize the application-specific list inserted into unit-access guides. */\nexport function createApplicationOrganizationUnitResourcesDocumentationFact(\n resources: readonly ApplicationOrganizationUnitResourceDocumentation[],\n): ApplicationOrganizationUnitResourcesDocumentationFact {\n if (new Set(resources.map((resource) => resource.resourceIdentifier)).size !== resources.length) {\n throw new Error('technical documentation received duplicate organization-unit-aware resources');\n }\n const canonicalResources = [...resources]\n .sort((left, right) => left.label.localeCompare(right.label, 'en-US') || left.resourceIdentifier.localeCompare(right.resourceIdentifier, 'en-US'));\n const markdown = canonicalResources.length === 0\n ? '**This application does not currently declare any business resource as organization-unit-aware.** A unit assignment therefore grants no additional access until the application publishes such a resource.'\n : `This application currently applies organization-unit access to:\\n\\n${canonicalResources\n .map((resource) => `- **${markdownText(resource.label)}** — ${markdownText(resource.purpose)}`)\n .join('\\n')}\\n\\nOnly the resources listed here use unit assignments. Other application information continues to follow its organization-wide operation rules.`;\n\n return Object.freeze({\n sourceRef: APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_REF,\n markdown,\n sourceVersion: APPLICATION_ORGANIZATION_UNIT_RESOURCES_DOCUMENTATION_SOURCE_VERSION,\n });\n}\n\n/** Match the native API-reference fallback without changing resource identity. */\nfunction resourceDisplayLabel(identifier: string): string {\n return identifier\n .replaceAll(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replaceAll(/[-_]+/g, ' ')\n .trim()\n .split(/\\s+/u)\n .filter(Boolean)\n .map((word) => (/^[A-Z0-9]+$/u.test(word) ? word : `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`))\n .join(' ');\n}\n\nfunction markdownText(value: string): string {\n return value.replaceAll(/\\s+/g, ' ').trim().replaceAll('\\\\', '\\\\\\\\').replaceAll(/([`*_[\\]<>#|])/g, '\\\\$1');\n}\n"]}
@@ -0,0 +1,37 @@
1
+ import { TechnicalDocumentationAccessClass, TechnicalDocumentationReaderAudience, TechnicalDocumentationUnitKind, type TechnicalDocumentationApplicabilityRequirementV1, type TechnicalDocumentationApiReferenceTargetV1, type TechnicalDocumentationUnitV1 } from '@wildo-ai/saas-specifications/technical-documentation';
2
+ import { type EngineDocumentationSpecificationCatalogV1 } from '@wildo-ai/saas-specifications/companion';
3
+ import type { LoadedApplicationConsumerDocumentationContentBundleV1 } from '../content/application-consumer-documentation-content-loader';
4
+ import { APPLICATION_CONSUMER_DOCUMENTATION_COMPANION_PROJECTION_SOURCE_PREFIX } from '../../content/application-consumer-documentation-content-manifest.schemas';
5
+ import { type ApplicationOrganizationUnitResourcesDocumentationFact } from './application-organization-unit-resource-documentation';
6
+ export interface EngineContentUnitDefinition {
7
+ readonly kind: TechnicalDocumentationUnitKind;
8
+ readonly readerAudiences: readonly TechnicalDocumentationReaderAudience[];
9
+ readonly accessClass: TechnicalDocumentationAccessClass;
10
+ readonly applicabilityRequirements: readonly TechnicalDocumentationApplicabilityRequirementV1[];
11
+ readonly relatedUnitRefs: readonly string[];
12
+ readonly apiReferenceTargets?: readonly {
13
+ readonly label: string;
14
+ readonly target: TechnicalDocumentationApiReferenceTargetV1;
15
+ }[];
16
+ }
17
+ /** Public, semantic role inventory supplied by the resolved application companion. */
18
+ export interface ApplicationOrganizationRolesDocumentationFact {
19
+ readonly sourceRef: `${typeof APPLICATION_CONSUMER_DOCUMENTATION_COMPANION_PROJECTION_SOURCE_PREFIX}${string}`;
20
+ readonly markdown: string;
21
+ readonly sourceVersion: number;
22
+ }
23
+ /**
24
+ * The engine-owned editorial topology: each verified authored unit has one
25
+ * consumer-documentation role and an explicit set of reader destinations.
26
+ *
27
+ * This is deliberately separate from Markdown. Markdown owns the narrative
28
+ * and title; this map owns type, audience, publication posture and navigation
29
+ * relationships, allowing the projector to reject a mismatched content set.
30
+ */
31
+ export declare const ENGINE_CONTENT_UNIT_DEFINITIONS: Readonly<Record<string, EngineContentUnitDefinition>>;
32
+ /**
33
+ * Compiles verified engine content and the two explicit application facts
34
+ * (organization roles and unit-aware resources) into private documentation.
35
+ */
36
+ export declare function projectEngineApplicationConsumerContentBundle(bundle: LoadedApplicationConsumerDocumentationContentBundleV1, engineSpecificationCatalog: EngineDocumentationSpecificationCatalogV1, unitDefinitions?: Readonly<Record<string, EngineContentUnitDefinition>>, applicationOrganizationRolesFact?: ApplicationOrganizationRolesDocumentationFact, applicationOrganizationUnitResourcesFact?: ApplicationOrganizationUnitResourcesDocumentationFact): TechnicalDocumentationUnitV1[];
37
+ //# sourceMappingURL=technical-documentation-engine-content-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"technical-documentation-engine-content-bundle.d.ts","sourceRoot":"","sources":["../../../../../src/companion/application-documentation/technical-documentation-engine-content-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iCAAiC,EAQjC,oCAAoC,EAGpC,8BAA8B,EAE9B,KAAK,gDAAgD,EACrD,KAAK,0CAA0C,EAG/C,KAAK,4BAA4B,EAClC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAGL,KAAK,yCAAyC,EAC/C,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,qDAAqD,EAAE,MAAM,8DAA8D,CAAC;AAC1I,OAAO,EACL,qEAAqE,EAGtE,MAAM,2EAA2E,CAAC;AAEnF,OAAO,EAEL,KAAK,qDAAqD,EAC3D,MAAM,wDAAwD,CAAC;AAEhE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAC;IAC9C,QAAQ,CAAC,eAAe,EAAE,SAAS,oCAAoC,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