@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.exports.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"content.exports.d.ts","sourceRoot":"","sources":["../../src/content.exports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uEAAuE,CAAC;AACtF,cAAc,8DAA8D,CAAC"}
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-reference-link-index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"api-reference-link-index.d.ts","sourceRoot":"","sources":["../../../src/openapi/api-reference-link-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChG,OAAO,EAGL,KAAK,0CAA0C,EAChD,MAAM,uDAAuD,CAAC;AAQ/D,8EAA8E;AAC9E,oBAAY,4BAA4B;IACtC,kFAAkF;IAClF,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,gBAAgB,qBAAqB;CACtC;AAED,MAAM,MAAM,wBAAwB,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,IAAI,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,QAAQ,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACrF;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,QAAQ,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACtF;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,gBAAgB,CAAC;IAAC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAA;CAAE,GACrG;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,iBAAiB,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GACvG;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC,OAAO,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GAC7F;IAAE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+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/openapi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,qCAAqC,CAAC;AACpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-generation-output.schemas.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"openapi-generation-output.schemas.d.ts","sourceRoot":"","sources":["../../../src/openapi/openapi-generation-output.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,oBAAY,cAAc;IACxB,0EAA0E;IAC1E,aAAa,kBAAkB;IAC/B,6EAA6E;IAC7E,wCAAwC,6CAA6C;CACtF;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAS/G,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B;;;;IAIrC;;;OAGG;;kBAEH,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,6BAA6B;IACxC,2DAA2D;;IAE3D,4EAA4E;;;;;QAxB5E;;;WAGG;;;kBAuBH,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-reference-model.exports.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"openapi-reference-model.exports.d.ts","sourceRoot":"","sources":["../../src/openapi-reference-model.exports.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthExchangePage.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"AuthExchangePage.d.ts","sourceRoot":"","sources":["../../../src/runtime/AuthExchangePage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmD,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIjG;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,YAAY,GACZ,SAAS,GACT,OAAO,GACP,aAAa,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC;IAChC;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,MAAM,EAAE,kBAAkB,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,SAAS,CAAC;IACxG;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CA8FA,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type Context, type FC, type ReactNode } from 'react';
|
|
|
2
2
|
import type { FrontendProvidersBlock } from '@wildo-ai/saas-models/public-runtime';
|
|
3
3
|
import { DocsAuthClient } from './docs-auth-client';
|
|
4
4
|
import type { DocsAuthSession, DocsJwtClaims } from './docs-auth-session.schemas';
|
|
5
|
-
import { type FrontendTechdocProviderRegistry } from './frontend-provider-registry.techdoc';
|
|
5
|
+
import { type FrontendTechdocProviderRegistry, type GeneratedTechdocProviderModules } from './frontend-provider-registry.techdoc';
|
|
6
6
|
/**
|
|
7
7
|
* Result of a `beginExchange()` call surfaced to `<AuthExchangePage>`.
|
|
8
8
|
*
|
|
@@ -105,6 +105,21 @@ export declare const DocsAuthProvider: FC<{
|
|
|
105
105
|
* When omitted, the docs runtime exposes an empty provider registry.
|
|
106
106
|
*/
|
|
107
107
|
frontendProviders?: FrontendProvidersBlock;
|
|
108
|
+
/**
|
|
109
|
+
* The CODE channel for those providers (#332): the
|
|
110
|
+
* `generatedFrontendProviderModules` export of this docs service's own
|
|
111
|
+
* `src/generated/frontend-providers.generated.ts`, written by
|
|
112
|
+
* `wildo config sync`.
|
|
113
|
+
*
|
|
114
|
+
* `frontendProviders` above says WHICH providers this service turned on, in
|
|
115
|
+
* this environment; this says what code the bundle actually contains for
|
|
116
|
+
* them. Both are needed, because a JSON payload cannot carry an SDK loader
|
|
117
|
+
* and a bundle cannot know which environment it is running in.
|
|
118
|
+
*
|
|
119
|
+
* Omitted is the ordinary case for a docs site declaring no package-shipped
|
|
120
|
+
* provider: no such file is generated, so there is nothing to import.
|
|
121
|
+
*/
|
|
122
|
+
frontendProviderModules?: GeneratedTechdocProviderModules;
|
|
108
123
|
/**
|
|
109
124
|
* Runtime frontend service identity used for the `X-Frontend-Service-Name`
|
|
110
125
|
* header on exchange/handoff auth calls.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsAuthContext.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"DocsAuthContext.d.ts","sourceRoot":"","sources":["../../../src/runtime/DocsAuthContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,EAAE,EACP,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAElF,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,wBAAwB,EAAE,+BAA+B,CAAC;IACnE,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC9D,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,oBAAoB,GAAG,IAAI,CACf,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C;;;;;;;;;;;;;OAaG;IACH,uBAAuB,CAAC,EAAE,+BAA+B,CAAC;IAC1D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CA4HA,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import { decodeJwtClaims } from './decode-jwt-claims.js';
|
|
4
4
|
import { DocsAuthClient } from './docs-auth-client.js';
|
|
5
|
+
import { useDocsProviderSdks } from './use-docs-provider-sdks.js';
|
|
5
6
|
import { createFrontendTechdocProviderRegistry, } from './frontend-provider-registry.techdoc.js';
|
|
6
7
|
/**
|
|
7
8
|
* @internal — consumers should call `useDocsAuthSession()` instead of
|
|
@@ -42,7 +43,7 @@ export const DocsAuthContext = createContext(null);
|
|
|
42
43
|
* would force this package to import the inversify-bound `appConfig`
|
|
43
44
|
* provider — exactly the dependency we are avoiding.
|
|
44
45
|
*/
|
|
45
|
-
export const DocsAuthProvider = ({ children, apiBaseUrl, frontendProviders, frontendServiceName = null, client: clientOverride, }) => {
|
|
46
|
+
export const DocsAuthProvider = ({ children, apiBaseUrl, frontendProviders, frontendProviderModules, frontendServiceName = null, client: clientOverride, }) => {
|
|
46
47
|
const [session, setSession] = useState({ status: 'anonymous' });
|
|
47
48
|
/**
|
|
48
49
|
* `getAuthBearer` reads from a closure over `session` so the bearer
|
|
@@ -63,7 +64,22 @@ export const DocsAuthProvider = ({ children, apiBaseUrl, frontendProviders, fron
|
|
|
63
64
|
: null,
|
|
64
65
|
});
|
|
65
66
|
}, [apiBaseUrl, frontendServiceName, clientOverride, sessionRef]);
|
|
66
|
-
const frontendProviderRegistry = useMemo(() => createFrontendTechdocProviderRegistry(
|
|
67
|
+
const frontendProviderRegistry = useMemo(() => createFrontendTechdocProviderRegistry({
|
|
68
|
+
entries: frontendProviders,
|
|
69
|
+
modules: frontendProviderModules,
|
|
70
|
+
onDiagnostic: (diagnostic) => {
|
|
71
|
+
// The docs runtime has no logger service, and a provider that is
|
|
72
|
+
// declared but cannot fully run is a developer-facing fact that must
|
|
73
|
+
// not be silent. Never a throw: a misconfigured provider must not take
|
|
74
|
+
// the documentation site down.
|
|
75
|
+
// eslint-disable-next-line no-console
|
|
76
|
+
console.warn(`[wildo-provider] ${diagnostic.kind}: ${diagnostic.message}`);
|
|
77
|
+
},
|
|
78
|
+
}), [frontendProviders, frontendProviderModules]);
|
|
79
|
+
// Load and start the SDK of every live provider that ships one. Effect-only:
|
|
80
|
+
// Docusaurus server-renders every page at build time, and starting a vendor
|
|
81
|
+
// client there would run it inside the build.
|
|
82
|
+
useDocsProviderSdks(frontendProviderRegistry);
|
|
67
83
|
/**
|
|
68
84
|
* Auto-clear when the access token expires.
|
|
69
85
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsAuthContext.js","sourceRoot":"","sources":["../../../../src/runtime/DocsAuthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,qCAAqC,GAEtC,MAAM,sCAAsC,CAAC;AA2D9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAC1B,aAAa,CAA8B,IAAI,CAAC,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAkBxB,CAAC,EACJ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,mBAAmB,GAAG,IAAI,EAC1B,MAAM,EAAE,cAAc,GACvB,EAAE,EAAE;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAkB,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAEjF;;;;;;OAMG;IACH,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAEzC,MAAM,MAAM,GAAG,OAAO,CAAiB,GAAG,EAAE;QAC1C,IAAI,cAAc;YAAE,OAAO,cAAc,CAAC;QAC1C,OAAO,IAAI,cAAc,CAAC;YACxB,UAAU;YACV,mBAAmB;YACnB,aAAa,EAA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;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAS,YAAY,CAAI,KAAQ;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import {\n createContext,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Context,\n type FC,\n type ReactNode,\n} from 'react';\nimport type { FrontendProvidersBlock } from '@wildo-ai/saas-models/public-runtime';\nimport { decodeJwtClaims } from './decode-jwt-claims';\nimport { DocsAuthClient } from './docs-auth-client';\nimport type { DocsAuthSession, DocsJwtClaims } from './docs-auth-session.schemas';\nimport {\n createFrontendTechdocProviderRegistry,\n type FrontendTechdocProviderRegistry,\n} from './frontend-provider-registry.techdoc';\n\n/**\n * Result of a `beginExchange()` call surfaced to `<AuthExchangePage>`.\n *\n * `claims` — decoded `DocsJwtClaims` (or `null` if the access token\n * came back undecodable — treated as anonymous).\n * `returnPath` — the issuer-supplied `returnPath` from the token exchange\n * response (cross-app-jwt-propagation.md Step 5). It is\n * a TOP-LEVEL field on `TokenExchangeResponseSchema` —\n * NOT nested under `metadata`. The earlier draft of this\n * JSDoc said \"metadata.returnPath\" and the implementation\n * read `response.metadata?.returnPath` (always undefined,\n * because no such key exists on the response). H-3 in the\n * Step 5 second deep-review log fixes both the docstring\n * and the read site.\n * `null` for OAuth2-callback codes (which never carry a\n * `returnPath` at all — discriminator invariant pinned by\n * `TokenExchangeResponseSchema` JSDoc); the exchange page\n * falls back to the URL `?return=` parameter in that case\n * (defense-in-depth).\n */\nexport interface DocsBeginExchangeResult {\n readonly claims: DocsJwtClaims | null;\n readonly returnPath: string | null;\n}\n\n/**\n * Public surface of `useDocsAuthSession()`.\n *\n * `session` — discriminated union (anonymous / exchanging / authenticated).\n * `client` — the singleton `DocsAuthClient` for authenticated docs\n * runtime code that needs to request a handoff to another\n * frontend. Anonymous docs gates deep-link to the SaaS app\n * because handoff issuance requires a bearer.\n * `frontendProviderRegistry`\n * — hydrated registry of the frontend-safe provider entries\n * materialized for the active docs service. Browser-only\n * docs widgets (search, analytics, future SDK protocols)\n * read from this instead of importing generated artifacts.\n * `beginExchange` — called by `<AuthExchangePage>` when a `?code=` arrives.\n * Returns the decoded claims AND the issuer-supplied\n * top-level `returnPath` from the exchange response\n * (the SOURCE OF TRUTH for post-exchange navigation;\n * the URL `?return=` is a defense-in-depth fallback\n * only). NOT `response.metadata.returnPath` — the\n * response has no `metadata` envelope (H-3 fix).\n * `clear` — called when the user explicitly closes the docs\n * session (e.g. a \"Sign out of docs\" link). NOT called\n * on tab close — ephemeral state evaporates on its own.\n */\nexport interface DocsAuthContextValue {\n readonly session: DocsAuthSession;\n readonly client: DocsAuthClient;\n readonly frontendProviderRegistry: FrontendTechdocProviderRegistry;\n beginExchange(code: string): Promise<DocsBeginExchangeResult>;\n clear(): void;\n}\n\n/**\n * @internal — consumers should call `useDocsAuthSession()` instead of\n * touching this directly. Exported so the matching hook can `useContext`\n * it from a sibling module (Fast Refresh boundary).\n */\nexport const DocsAuthContext: Context<DocsAuthContextValue | null> =\n createContext<DocsAuthContextValue | null>(null);\n\n/**\n * In-memory React context owning the docs-site authenticated session\n * (saas-technical-doc.md K-9b).\n *\n * Storage characteristics — locked by K-9b:\n *\n * - In-memory only. NO `localStorage`, NO `sessionStorage`, NO cookies.\n * Closing the tab destroys the session.\n * - NO refresh-token loop. `/auth/token/exchange` no longer returns a\n * refresh token in the JSON body; SaaS-app receivers get refresh via the\n * HttpOnly cookie channel, while docs intentionally keeps only the access\n * token in memory. When the access token's `exp` passes, the next access\n * becomes anonymous and the user re-handshakes from the SaaS app on demand.\n * - NO BroadcastChannel cross-tab coordination. Each docs tab owns its\n * own session — opening a new tab is anonymous until it gets its own\n * `?code=` redirect.\n *\n * These choices are deliberate: the docs site is a session RECEIVER\n * (never a session OWNER), and the SaaS app is the authoritative source\n * of authentication. Replicating the SaaS app's session-management stack\n * here would force the docs Docusaurus bundle to ship inversify, the\n * resources framework, and a refresh interceptor — all of which are\n * about to be hardened (auth-hardening.md Slice A) in the SaaS app\n * specifically because they are sensitive surfaces. Keeping the docs\n * site free of those mechanisms keeps its attack surface tiny.\n *\n * The `apiBaseUrl` prop is supplied by the docs site at mount time\n * (typically read from a small `appConfig.json` shipped alongside the\n * Docusaurus bundle, or from an env var injected at build time). It is\n * not pulled from `saas-frontend-lib`'s `useApplication()` because that\n * would force this package to import the inversify-bound `appConfig`\n * provider — exactly the dependency we are avoiding.\n */\nexport const DocsAuthProvider: FC<{\n children: ReactNode;\n apiBaseUrl: string;\n /**\n * Optional materialized provider block for the active docs service.\n * When omitted, the docs runtime exposes an empty provider registry.\n */\n frontendProviders?: FrontendProvidersBlock;\n /**\n * Runtime frontend service identity used for the `X-Frontend-Service-Name`\n * header on exchange/handoff auth calls.\n */\n frontendServiceName?: string | null;\n /**\n * Optional override for tests. Production code constructs a\n * `DocsAuthClient` from `apiBaseUrl` + the in-memory bearer.\n */\n client?: DocsAuthClient;\n}> = ({\n children,\n apiBaseUrl,\n frontendProviders,\n frontendServiceName = null,\n client: clientOverride,\n}) => {\n const [session, setSession] = useState<DocsAuthSession>({ status: 'anonymous' });\n\n /**\n * `getAuthBearer` reads from a closure over `session` so the bearer\n * always reflects the *current* state without re-creating the client\n * on every state change. The `useMemo` below depends only on\n * `apiBaseUrl` so the client identity is stable across re-renders,\n * which keeps `useEffect` dependency arrays in swizzles honest.\n */\n const sessionRef = useLatestRef(session);\n\n const client = useMemo<DocsAuthClient>(() => {\n if (clientOverride) return clientOverride;\n return new DocsAuthClient({\n apiBaseUrl,\n frontendServiceName,\n getAuthBearer: () =>\n sessionRef.current.status === 'authenticated'\n ? sessionRef.current.accessToken\n : null,\n });\n }, [apiBaseUrl, frontendServiceName, clientOverride, sessionRef]);\n const frontendProviderRegistry = useMemo(\n () => createFrontendTechdocProviderRegistry(frontendProviders),\n [frontendProviders],\n );\n\n /**\n * Auto-clear when the access token expires.\n *\n * Sets a single timer based on `claims.exp`; on tick, transitions the\n * session back to `anonymous`. No polling, no refresh — the next\n * gated action will trigger a re-handshake via `requestCrossFrontendHandoff`.\n *\n * The timer is recreated whenever the session transitions to\n * `authenticated`, and cleared on unmount or on transition AWAY from\n * `authenticated` to avoid stale timers firing into a fresh session.\n */\n useEffect(() => {\n if (session.status !== 'authenticated') return;\n const msUntilExpiry = session.claims.exp * 1000 - Date.now();\n if (msUntilExpiry <= 0) {\n setSession({ status: 'anonymous' });\n return;\n }\n const handle = setTimeout(() => {\n setSession({ status: 'anonymous' });\n }, msUntilExpiry);\n return () => clearTimeout(handle);\n }, [session]);\n\n const beginExchange = useCallback(\n async (code: string): Promise<DocsBeginExchangeResult> => {\n setSession({ status: 'exchanging' });\n try {\n const response = await client.exchangeAuthCode(code);\n // `returnPath` lives at the TOP LEVEL of `TokenExchangeResponseSchema`\n // — NOT under `metadata`. Reading `response.metadata?.returnPath`\n // (the previous shape this code targeted) is silently `undefined`\n // because the schema has no `metadata` envelope. The previous\n // implementation made every docs handoff fall through to the URL\n // `?return=` value, defeating Step 5's \"response value is the\n // source of truth\" contract. See H-3 in the Step 5 second\n // deep-review log on `cross-app-jwt-propagation.md`.\n const returnPath = response.returnPath ?? null;\n const claims = decodeJwtClaims(response.accessToken);\n if (!claims) {\n /**\n * The exchange succeeded but the returned token isn't decodable.\n * Treat as anonymous rather than half-authenticated — the\n * swizzles never have to handle a `claims === null &&\n * status === 'authenticated'` corner case. We still surface\n * `returnPath` so the exchange page can navigate the user\n * somewhere sensible (e.g. `/`) instead of stranding them on\n * `/auth/exchange`.\n */\n setSession({ status: 'anonymous' });\n return { claims: null, returnPath };\n }\n setSession({ status: 'authenticated', accessToken: response.accessToken, claims });\n return { claims, returnPath };\n } catch {\n setSession({ status: 'anonymous' });\n return { claims: null, returnPath: null };\n }\n },\n [client],\n );\n\n const clear = useCallback(() => {\n setSession({ status: 'anonymous' });\n }, []);\n\n const value = useMemo<DocsAuthContextValue>(\n () => ({ session, client, frontendProviderRegistry, beginExchange, clear }),\n [session, client, frontendProviderRegistry, beginExchange, clear],\n );\n\n return <DocsAuthContext.Provider value={value}>{children}</DocsAuthContext.Provider>;\n};\n\n/**\n * Tiny ref-of-latest-value helper. Avoids pulling in a utility lib for\n * one ~6-line function. Used here so the `DocsAuthClient`'s\n * `getAuthBearer` callback always sees the freshest session without\n * re-instantiating the client.\n *\n * Implementation discipline (L-NEW-1 fix from the Step 6 third\n * deep-review log): the previous implementation mutated `ref.current`\n * DURING render (the `ref.current = value;` line ran in the function\n * body), which violates React's \"no side effects during render\"\n * invariant and produces inconsistent reads under concurrent\n * rendering — a render that gets discarded by React's scheduler can\n * still leave a stale `ref.current` behind for the next render.\n *\n * The fix is the textbook React 18 pattern: hold the value in a real\n * `useRef`, then sync it inside `useEffect` after commit.\n *\n * Trade-off acknowledged: between render and effect-flush,\n * `ref.current` lags by one render. That is SAFE for this consumer\n * because `getAuthBearer()` is only invoked ASYNCHRONOUSLY (inside a\n * `fetch()` call originated by `requestCrossFrontendHandoff()` /\n * `exchangeAuthCode()`) — by the time the bearer is read, every\n * `useEffect` from the triggering render has already flushed and\n * `ref.current` reflects the latest committed session.\n *\n * Concretely: if the user clicks an org-API navbar entry that promotes\n * the session from `anonymous` → `exchanging` → `authenticated`, the\n * next fetch the client issues sees `authenticated` (ref synced after\n * commit) — never the stale `exchanging` value, even though the\n * `useMemo` factory may have captured the closure at the earlier\n * render.\n */\nfunction useLatestRef<T>(value: T): { current: T } {\n const ref = useRef<T>(value);\n useEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DocsAuthContext.js","sourceRoot":"","sources":["../../../src/runtime/DocsAuthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,MA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,YAAG,QAAQ,GAA4B,CAAC;AACvF,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAS,YAAY,CAAI,KAAQ;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import {\n createContext,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type Context,\n type FC,\n type ReactNode,\n} from 'react';\nimport type { FrontendProvidersBlock } from '@wildo-ai/saas-models/public-runtime';\nimport { decodeJwtClaims } from './decode-jwt-claims';\nimport { DocsAuthClient } from './docs-auth-client';\nimport type { DocsAuthSession, DocsJwtClaims } from './docs-auth-session.schemas';\nimport { useDocsProviderSdks } from './use-docs-provider-sdks';\nimport {\n createFrontendTechdocProviderRegistry,\n type FrontendTechdocProviderRegistry,\n type GeneratedTechdocProviderModules,\n} from './frontend-provider-registry.techdoc';\n\n/**\n * Result of a `beginExchange()` call surfaced to `<AuthExchangePage>`.\n *\n * `claims` — decoded `DocsJwtClaims` (or `null` if the access token\n * came back undecodable — treated as anonymous).\n * `returnPath` — the issuer-supplied `returnPath` from the token exchange\n * response (cross-app-jwt-propagation.md Step 5). It is\n * a TOP-LEVEL field on `TokenExchangeResponseSchema` —\n * NOT nested under `metadata`. The earlier draft of this\n * JSDoc said \"metadata.returnPath\" and the implementation\n * read `response.metadata?.returnPath` (always undefined,\n * because no such key exists on the response). H-3 in the\n * Step 5 second deep-review log fixes both the docstring\n * and the read site.\n * `null` for OAuth2-callback codes (which never carry a\n * `returnPath` at all — discriminator invariant pinned by\n * `TokenExchangeResponseSchema` JSDoc); the exchange page\n * falls back to the URL `?return=` parameter in that case\n * (defense-in-depth).\n */\nexport interface DocsBeginExchangeResult {\n readonly claims: DocsJwtClaims | null;\n readonly returnPath: string | null;\n}\n\n/**\n * Public surface of `useDocsAuthSession()`.\n *\n * `session` — discriminated union (anonymous / exchanging / authenticated).\n * `client` — the singleton `DocsAuthClient` for authenticated docs\n * runtime code that needs to request a handoff to another\n * frontend. Anonymous docs gates deep-link to the SaaS app\n * because handoff issuance requires a bearer.\n * `frontendProviderRegistry`\n * — hydrated registry of the frontend-safe provider entries\n * materialized for the active docs service. Browser-only\n * docs widgets (search, analytics, future SDK protocols)\n * read from this instead of importing generated artifacts.\n * `beginExchange` — called by `<AuthExchangePage>` when a `?code=` arrives.\n * Returns the decoded claims AND the issuer-supplied\n * top-level `returnPath` from the exchange response\n * (the SOURCE OF TRUTH for post-exchange navigation;\n * the URL `?return=` is a defense-in-depth fallback\n * only). NOT `response.metadata.returnPath` — the\n * response has no `metadata` envelope (H-3 fix).\n * `clear` — called when the user explicitly closes the docs\n * session (e.g. a \"Sign out of docs\" link). NOT called\n * on tab close — ephemeral state evaporates on its own.\n */\nexport interface DocsAuthContextValue {\n readonly session: DocsAuthSession;\n readonly client: DocsAuthClient;\n readonly frontendProviderRegistry: FrontendTechdocProviderRegistry;\n beginExchange(code: string): Promise<DocsBeginExchangeResult>;\n clear(): void;\n}\n\n/**\n * @internal — consumers should call `useDocsAuthSession()` instead of\n * touching this directly. Exported so the matching hook can `useContext`\n * it from a sibling module (Fast Refresh boundary).\n */\nexport const DocsAuthContext: Context<DocsAuthContextValue | null> =\n createContext<DocsAuthContextValue | null>(null);\n\n/**\n * In-memory React context owning the docs-site authenticated session\n * (saas-technical-doc.md K-9b).\n *\n * Storage characteristics — locked by K-9b:\n *\n * - In-memory only. NO `localStorage`, NO `sessionStorage`, NO cookies.\n * Closing the tab destroys the session.\n * - NO refresh-token loop. `/auth/token/exchange` no longer returns a\n * refresh token in the JSON body; SaaS-app receivers get refresh via the\n * HttpOnly cookie channel, while docs intentionally keeps only the access\n * token in memory. When the access token's `exp` passes, the next access\n * becomes anonymous and the user re-handshakes from the SaaS app on demand.\n * - NO BroadcastChannel cross-tab coordination. Each docs tab owns its\n * own session — opening a new tab is anonymous until it gets its own\n * `?code=` redirect.\n *\n * These choices are deliberate: the docs site is a session RECEIVER\n * (never a session OWNER), and the SaaS app is the authoritative source\n * of authentication. Replicating the SaaS app's session-management stack\n * here would force the docs Docusaurus bundle to ship inversify, the\n * resources framework, and a refresh interceptor — all of which are\n * about to be hardened (auth-hardening.md Slice A) in the SaaS app\n * specifically because they are sensitive surfaces. Keeping the docs\n * site free of those mechanisms keeps its attack surface tiny.\n *\n * The `apiBaseUrl` prop is supplied by the docs site at mount time\n * (typically read from a small `appConfig.json` shipped alongside the\n * Docusaurus bundle, or from an env var injected at build time). It is\n * not pulled from `saas-frontend-lib`'s `useApplication()` because that\n * would force this package to import the inversify-bound `appConfig`\n * provider — exactly the dependency we are avoiding.\n */\nexport const DocsAuthProvider: FC<{\n children: ReactNode;\n apiBaseUrl: string;\n /**\n * Optional materialized provider block for the active docs service.\n * When omitted, the docs runtime exposes an empty provider registry.\n */\n frontendProviders?: FrontendProvidersBlock;\n /**\n * The CODE channel for those providers (#332): the\n * `generatedFrontendProviderModules` export of this docs service's own\n * `src/generated/frontend-providers.generated.ts`, written by\n * `wildo config sync`.\n *\n * `frontendProviders` above says WHICH providers this service turned on, in\n * this environment; this says what code the bundle actually contains for\n * them. Both are needed, because a JSON payload cannot carry an SDK loader\n * and a bundle cannot know which environment it is running in.\n *\n * Omitted is the ordinary case for a docs site declaring no package-shipped\n * provider: no such file is generated, so there is nothing to import.\n */\n frontendProviderModules?: GeneratedTechdocProviderModules;\n /**\n * Runtime frontend service identity used for the `X-Frontend-Service-Name`\n * header on exchange/handoff auth calls.\n */\n frontendServiceName?: string | null;\n /**\n * Optional override for tests. Production code constructs a\n * `DocsAuthClient` from `apiBaseUrl` + the in-memory bearer.\n */\n client?: DocsAuthClient;\n}> = ({\n children,\n apiBaseUrl,\n frontendProviders,\n frontendProviderModules,\n frontendServiceName = null,\n client: clientOverride,\n}) => {\n const [session, setSession] = useState<DocsAuthSession>({ status: 'anonymous' });\n\n /**\n * `getAuthBearer` reads from a closure over `session` so the bearer\n * always reflects the *current* state without re-creating the client\n * on every state change. The `useMemo` below depends only on\n * `apiBaseUrl` so the client identity is stable across re-renders,\n * which keeps `useEffect` dependency arrays in swizzles honest.\n */\n const sessionRef = useLatestRef(session);\n\n const client = useMemo<DocsAuthClient>(() => {\n if (clientOverride) return clientOverride;\n return new DocsAuthClient({\n apiBaseUrl,\n frontendServiceName,\n getAuthBearer: () =>\n sessionRef.current.status === 'authenticated'\n ? sessionRef.current.accessToken\n : null,\n });\n }, [apiBaseUrl, frontendServiceName, clientOverride, sessionRef]);\n const frontendProviderRegistry = useMemo(\n () =>\n createFrontendTechdocProviderRegistry({\n entries: frontendProviders,\n modules: frontendProviderModules,\n onDiagnostic: (diagnostic) => {\n // The docs runtime has no logger service, and a provider that is\n // declared but cannot fully run is a developer-facing fact that must\n // not be silent. Never a throw: a misconfigured provider must not take\n // the documentation site down.\n // eslint-disable-next-line no-console\n console.warn(`[wildo-provider] ${diagnostic.kind}: ${diagnostic.message}`);\n },\n }),\n [frontendProviders, frontendProviderModules],\n );\n\n // Load and start the SDK of every live provider that ships one. Effect-only:\n // Docusaurus server-renders every page at build time, and starting a vendor\n // client there would run it inside the build.\n useDocsProviderSdks(frontendProviderRegistry);\n\n /**\n * Auto-clear when the access token expires.\n *\n * Sets a single timer based on `claims.exp`; on tick, transitions the\n * session back to `anonymous`. No polling, no refresh — the next\n * gated action will trigger a re-handshake via `requestCrossFrontendHandoff`.\n *\n * The timer is recreated whenever the session transitions to\n * `authenticated`, and cleared on unmount or on transition AWAY from\n * `authenticated` to avoid stale timers firing into a fresh session.\n */\n useEffect(() => {\n if (session.status !== 'authenticated') return;\n const msUntilExpiry = session.claims.exp * 1000 - Date.now();\n if (msUntilExpiry <= 0) {\n setSession({ status: 'anonymous' });\n return;\n }\n const handle = setTimeout(() => {\n setSession({ status: 'anonymous' });\n }, msUntilExpiry);\n return () => clearTimeout(handle);\n }, [session]);\n\n const beginExchange = useCallback(\n async (code: string): Promise<DocsBeginExchangeResult> => {\n setSession({ status: 'exchanging' });\n try {\n const response = await client.exchangeAuthCode(code);\n // `returnPath` lives at the TOP LEVEL of `TokenExchangeResponseSchema`\n // — NOT under `metadata`. Reading `response.metadata?.returnPath`\n // (the previous shape this code targeted) is silently `undefined`\n // because the schema has no `metadata` envelope. The previous\n // implementation made every docs handoff fall through to the URL\n // `?return=` value, defeating Step 5's \"response value is the\n // source of truth\" contract. See H-3 in the Step 5 second\n // deep-review log on `cross-app-jwt-propagation.md`.\n const returnPath = response.returnPath ?? null;\n const claims = decodeJwtClaims(response.accessToken);\n if (!claims) {\n /**\n * The exchange succeeded but the returned token isn't decodable.\n * Treat as anonymous rather than half-authenticated — the\n * swizzles never have to handle a `claims === null &&\n * status === 'authenticated'` corner case. We still surface\n * `returnPath` so the exchange page can navigate the user\n * somewhere sensible (e.g. `/`) instead of stranding them on\n * `/auth/exchange`.\n */\n setSession({ status: 'anonymous' });\n return { claims: null, returnPath };\n }\n setSession({ status: 'authenticated', accessToken: response.accessToken, claims });\n return { claims, returnPath };\n } catch {\n setSession({ status: 'anonymous' });\n return { claims: null, returnPath: null };\n }\n },\n [client],\n );\n\n const clear = useCallback(() => {\n setSession({ status: 'anonymous' });\n }, []);\n\n const value = useMemo<DocsAuthContextValue>(\n () => ({ session, client, frontendProviderRegistry, beginExchange, clear }),\n [session, client, frontendProviderRegistry, beginExchange, clear],\n );\n\n return <DocsAuthContext.Provider value={value}>{children}</DocsAuthContext.Provider>;\n};\n\n/**\n * Tiny ref-of-latest-value helper. Avoids pulling in a utility lib for\n * one ~6-line function. Used here so the `DocsAuthClient`'s\n * `getAuthBearer` callback always sees the freshest session without\n * re-instantiating the client.\n *\n * Implementation discipline (L-NEW-1 fix from the Step 6 third\n * deep-review log): the previous implementation mutated `ref.current`\n * DURING render (the `ref.current = value;` line ran in the function\n * body), which violates React's \"no side effects during render\"\n * invariant and produces inconsistent reads under concurrent\n * rendering — a render that gets discarded by React's scheduler can\n * still leave a stale `ref.current` behind for the next render.\n *\n * The fix is the textbook React 18 pattern: hold the value in a real\n * `useRef`, then sync it inside `useEffect` after commit.\n *\n * Trade-off acknowledged: between render and effect-flush,\n * `ref.current` lags by one render. That is SAFE for this consumer\n * because `getAuthBearer()` is only invoked ASYNCHRONOUSLY (inside a\n * `fetch()` call originated by `requestCrossFrontendHandoff()` /\n * `exchangeAuthCode()`) — by the time the bearer is read, every\n * `useEffect` from the triggering render has already flushed and\n * `ref.current` reflects the latest committed session.\n *\n * Concretely: if the user clicks an org-API navbar entry that promotes\n * the session from `anonymous` → `exchanging` → `authenticated`, the\n * next fetch the client issues sees `authenticated` (ref synced after\n * commit) — never the stale `exchanging` value, even though the\n * `useMemo` factory may have captured the closure at the earlier\n * render.\n */\nfunction useLatestRef<T>(value: T): { current: T } {\n const ref = useRef<T>(value);\n useEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-jwt-claims.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"decode-jwt-claims.d.ts","sourceRoot":"","sources":["../../../src/runtime/decode-jwt-claims.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAoCnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-auth-client.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"docs-auth-client.d.ts","sourceRoot":"","sources":["../../../src/runtime/docs-auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,6BAA6B,EAK7B,K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oot":"","sources":["
|
|
1
|
+
{"version":3,"file":"docs-auth-session.schemas.d.ts","sourceRoot":"","sources":["../../../src/runtime/docs-auth-session.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,oBAAY,QAAQ;IAClB,SAAS,cAAc;IACvB,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,mBAAmB;;;;;kBAK9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GACxB;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC"}
|
|
@@ -1,17 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The technical doc's provider registry — now composed from BOTH channels.
|
|
3
|
+
*
|
|
4
|
+
* It used to build itself by casting each served `FrontendProviderEntry` to a
|
|
5
|
+
* module type that was an alias of that entry, which made the cast true and
|
|
6
|
+
* useless: the registry could never hold anything a JSON payload could not
|
|
7
|
+
* carry, so a provider's SDK loader had nowhere to arrive.
|
|
8
|
+
*
|
|
9
|
+
* - **DATA** — the materialized frontend-services block for THIS docs service.
|
|
10
|
+
* Authoritative for which providers are on, in this environment.
|
|
11
|
+
* - **CODE** — `generatedFrontendProviderModules` from the docs site's own
|
|
12
|
+
* `src/generated/frontend-providers.generated.ts`, written by
|
|
13
|
+
* `wildo config sync` and handed to `DocsAuthProvider` by the Root swizzle.
|
|
14
|
+
*
|
|
15
|
+
* The types are now the engine's own techdoc-facet types rather than local
|
|
16
|
+
* aliases, so a provider module authored against
|
|
17
|
+
* `@wildo-ai/external-connectors-public/techdoc` is the same type this registry
|
|
18
|
+
* holds. Re-exported under the same names so every consumer's import is
|
|
19
|
+
* unchanged.
|
|
20
|
+
*/
|
|
21
|
+
import { type FrontendProviderHydrationDiagnostic, type FrontendTechdocProviderRegistry, type GeneratedTechdocProviderModules } from '@wildo-ai/external-connectors-public/techdoc';
|
|
22
|
+
import type { FrontendProvidersBlock } from '@wildo-ai/saas-models/public-runtime';
|
|
23
|
+
export type { FrontendTechdocProviderModule, FrontendTechdocProviderRef, FrontendTechdocProviderRegistry, GeneratedTechdocProviderModules, } from '@wildo-ai/external-connectors-public/techdoc';
|
|
24
|
+
export interface CreateFrontendTechdocProviderRegistryInput {
|
|
25
|
+
/** The DATA channel: the materialized block for this docs service. */
|
|
26
|
+
readonly entries?: FrontendProvidersBlock;
|
|
27
|
+
/**
|
|
28
|
+
* The CODE channel. Absent is the ordinary case for a docs site that declares
|
|
29
|
+
* no package-shipped provider — `wildo config sync` writes no generated file,
|
|
30
|
+
* so there is nothing to import and nothing to pass.
|
|
31
|
+
*/
|
|
32
|
+
readonly modules?: GeneratedTechdocProviderModules;
|
|
33
|
+
readonly onDiagnostic?: (diagnostic: FrontendProviderHydrationDiagnostic) => void;
|
|
11
34
|
}
|
|
12
35
|
/**
|
|
13
|
-
* Tech-doc runtime registry hydrated from
|
|
14
|
-
* block for the active docs service.
|
|
36
|
+
* Tech-doc runtime registry, hydrated from both channels.
|
|
15
37
|
*/
|
|
16
|
-
export declare function createFrontendTechdocProviderRegistry(
|
|
38
|
+
export declare function createFrontendTechdocProviderRegistry(input?: CreateFrontendTechdocProviderRegistryInput): FrontendTechdocProviderRegistry;
|
|
17
39
|
//# sourceMappingURL=frontend-provider-registry.techdoc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-provider-registry.techdoc.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frontend-provider-registry.techdoc.d.ts","sourceRoot":"","sources":["../../../src/runtime/frontend-provider-registry.techdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAEL,KAAK,mCAAmC,EACxC,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,YAAY,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,8CAA8C,CAAC;AAEtD,MAAM,WAAW,0CAA0C;IACzD,sEAAsE;IACtE,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,+BAA+B,CAAC;IACnD,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,mCAAmC,KAAK,IAAI,CAAC;CACnF;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,CAAC,EAAE,0CAA0C,GACjD,+BAA+B,CAMjC"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The technical doc's provider registry — now composed from BOTH channels.
|
|
3
|
+
*
|
|
4
|
+
* It used to build itself by casting each served `FrontendProviderEntry` to a
|
|
5
|
+
* module type that was an alias of that entry, which made the cast true and
|
|
6
|
+
* useless: the registry could never hold anything a JSON payload could not
|
|
7
|
+
* carry, so a provider's SDK loader had nowhere to arrive.
|
|
8
|
+
*
|
|
9
|
+
* - **DATA** — the materialized frontend-services block for THIS docs service.
|
|
10
|
+
* Authoritative for which providers are on, in this environment.
|
|
11
|
+
* - **CODE** — `generatedFrontendProviderModules` from the docs site's own
|
|
12
|
+
* `src/generated/frontend-providers.generated.ts`, written by
|
|
13
|
+
* `wildo config sync` and handed to `DocsAuthProvider` by the Root swizzle.
|
|
14
|
+
*
|
|
15
|
+
* The types are now the engine's own techdoc-facet types rather than local
|
|
16
|
+
* aliases, so a provider module authored against
|
|
17
|
+
* `@wildo-ai/external-connectors-public/techdoc` is the same type this registry
|
|
18
|
+
* holds. Re-exported under the same names so every consumer's import is
|
|
19
|
+
* unchanged.
|
|
4
20
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
getProvidersByProviderCapability(providerCapability) {
|
|
16
|
-
return [...modules.values()].filter((provider) => provider.providerCapabilities.includes(providerCapability));
|
|
17
|
-
},
|
|
18
|
-
findProviderByProviderCapability(providerCapability) {
|
|
19
|
-
return [...modules.values()].find((provider) => provider.providerCapabilities.includes(providerCapability));
|
|
20
|
-
},
|
|
21
|
-
};
|
|
21
|
+
import { composeHydratedFrontendTechdocProviders, } from '@wildo-ai/external-connectors-public/techdoc';
|
|
22
|
+
/**
|
|
23
|
+
* Tech-doc runtime registry, hydrated from both channels.
|
|
24
|
+
*/
|
|
25
|
+
export function createFrontendTechdocProviderRegistry(input) {
|
|
26
|
+
return composeHydratedFrontendTechdocProviders({
|
|
27
|
+
entries: input?.entries,
|
|
28
|
+
modules: input?.modules,
|
|
29
|
+
onDiagnostic: input?.onDiagnostic,
|
|
30
|
+
});
|
|
22
31
|
}
|
|
23
32
|
//# sourceMappingURL=frontend-provider-registry.techdoc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-provider-registry.techdoc.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frontend-provider-registry.techdoc.js","sourceRoot":"","sources":["../../../src/runtime/frontend-provider-registry.techdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,uCAAuC,GAIxC,MAAM,8CAA8C,CAAC;AAsBtD;;GAEG;AACH,MAAM,UAAU,qCAAqC,CACnD,KAAkD;IAElD,OAAO,uCAAuC,CAAC;QAC7C,OAAO,EAAE,KAAK,EAAE,OAAO;QACvB,OAAO,EAAE,KAAK,EAAE,OAAO;QACvB,YAAY,EAAE,KAAK,EAAE,YAAY;KAClC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * The technical doc's provider registry — now composed from BOTH channels.\n *\n * It used to build itself by casting each served `FrontendProviderEntry` to a\n * module type that was an alias of that entry, which made the cast true and\n * useless: the registry could never hold anything a JSON payload could not\n * carry, so a provider's SDK loader had nowhere to arrive.\n *\n * - **DATA** — the materialized frontend-services block for THIS docs service.\n * Authoritative for which providers are on, in this environment.\n * - **CODE** — `generatedFrontendProviderModules` from the docs site's own\n * `src/generated/frontend-providers.generated.ts`, written by\n * `wildo config sync` and handed to `DocsAuthProvider` by the Root swizzle.\n *\n * The types are now the engine's own techdoc-facet types rather than local\n * aliases, so a provider module authored against\n * `@wildo-ai/external-connectors-public/techdoc` is the same type this registry\n * holds. Re-exported under the same names so every consumer's import is\n * unchanged.\n */\n\nimport {\n composeHydratedFrontendTechdocProviders,\n type FrontendProviderHydrationDiagnostic,\n type FrontendTechdocProviderRegistry,\n type GeneratedTechdocProviderModules,\n} from '@wildo-ai/external-connectors-public/techdoc';\nimport type { FrontendProvidersBlock } from '@wildo-ai/saas-models/public-runtime';\n\nexport type {\n FrontendTechdocProviderModule,\n FrontendTechdocProviderRef,\n FrontendTechdocProviderRegistry,\n GeneratedTechdocProviderModules,\n} from '@wildo-ai/external-connectors-public/techdoc';\n\nexport interface CreateFrontendTechdocProviderRegistryInput {\n /** The DATA channel: the materialized block for this docs service. */\n readonly entries?: FrontendProvidersBlock;\n /**\n * The CODE channel. Absent is the ordinary case for a docs site that declares\n * no package-shipped provider — `wildo config sync` writes no generated file,\n * so there is nothing to import and nothing to pass.\n */\n readonly modules?: GeneratedTechdocProviderModules;\n readonly onDiagnostic?: (diagnostic: FrontendProviderHydrationDiagnostic) => void;\n}\n\n/**\n * Tech-doc runtime registry, hydrated from both channels.\n */\nexport function createFrontendTechdocProviderRegistry(\n input?: CreateFrontendTechdocProviderRegistryInput,\n): FrontendTechdocProviderRegistry {\n return composeHydratedFrontendTechdocProviders({\n entries: input?.entries,\n modules: input?.modules,\n onDiagnostic: input?.onDiagnostic,\n });\n}\n"]}
|
|
@@ -50,6 +50,7 @@ export * from './frontend-provider-registry.techdoc';
|
|
|
50
50
|
export { FrontendProviderEntrySchema, FrontendProvidersBlockSchema, type FrontendProviderEntry, type FrontendProvidersBlock, } from '@wildo-ai/saas-models/public-runtime';
|
|
51
51
|
export * from './use-docs-auth-session';
|
|
52
52
|
export * from './use-docs-frontend-provider-registry';
|
|
53
|
+
export * from './use-docs-provider-sdks';
|
|
53
54
|
export * from './AuthExchangePage';
|
|
54
55
|
export * from './openapi-reference-model';
|
|
55
56
|
export * from './openapi-reference-conservation';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAuBH,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,sCAAsC,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC"}
|
|
@@ -69,6 +69,7 @@ export * from './frontend-provider-registry.techdoc.js';
|
|
|
69
69
|
export { FrontendProviderEntrySchema, FrontendProvidersBlockSchema, } from '@wildo-ai/saas-models/public-runtime';
|
|
70
70
|
export * from './use-docs-auth-session.js';
|
|
71
71
|
export * from './use-docs-frontend-provider-registry.js';
|
|
72
|
+
export * from './use-docs-provider-sdks.js';
|
|
72
73
|
export * from './AuthExchangePage.js';
|
|
73
74
|
export * from './openapi-reference-model.js';
|
|
74
75
|
export * from './openapi-reference-conservation.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAE7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAG7B,MAAM,sCAAsC,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC","sourcesContent":["/**\n * `@wildo-ai/saas-technical-doc/runtime` — browser-only auth runtime\n * for the Docusaurus-served docs site (saas-technical-doc.md K-9b).\n *\n * Public surface (consumed by the three Docusaurus swizzles per K-11):\n *\n * - `<DocsAuthProvider apiBaseUrl=\"…\">` — Root swizzle wraps children.\n * - `useDocsAuthSession()` — Navbar + DocItem swizzles read.\n * - `<AuthExchangePage />` — mounted at `/auth/exchange`.\n * - `DocsAuthClient` — direct access for the DocItem\n * swizzle's \"request handoff back\n * to app\" code path.\n * - `DocsAuthClientError` + code type — typed error branch surface.\n * - `DocsRole` / `DocsAuthSession` — discriminated-union types.\n * - `useDocsFrontendProviderRegistry()` — read the materialized frontend\n * provider registry for this docs\n * service (search / future SDK\n * widgets).\n * - `decodeJwtClaims` — exposed so apps can decode\n * access tokens issued by\n * non-handoff flows (rare;\n * reserved for advanced use).\n *\n * @wildo-boundary\n * - This sub-tree MAY use React, `react-dom`, the browser `fetch`, and\n * the browser `atob` global. It MUST NOT import:\n * - Node built-ins (`fs`, `path`, …) — would break Docusaurus\n * client bundle.\n * - `@wildo-ai/saas-frontend-lib` — entire point of K-9b\n * is to NOT pull this.\n * - inversify — reserved for the SaaS\n * app DI stack.\n * - This sub-tree MAY import shared schemas + DTO types from\n * `@wildo-ai/saas-models/public-runtime` (the lightweight subset\n * allow-listed by `runtime-bundle-isolation.test.ts`).\n * - This sub-tree MUST initialize `@wildo-ai/zod-decorators` at runtime\n * entry — see the `ensureZodDecoratorsLoaded(z)` side-effect below.\n * Skipping this leaves the docs runtime with an under-augmented Zod\n * `ZodObject` declaration, which historically caused cross-package\n * `z.infer` widening (the H-3 / M-7 cross-frontend-handoff incident,\n * see `.cursor/plans/cross-app-jwt-propagation.md`).\n * - The package's `./companion` and `./` (root) entries MUST NOT import\n * from this sub-tree (see those files' boundary blocks).\n */\n\n/**\n * Boot the project's Zod decorator augmentation for this bundle.\n *\n * `@wildo-ai/saas-models/public-runtime` re-exports schemas authored\n * against the augmented `ZodObject` interface declared by\n * `@wildo-ai/zod-decorators`. Without `ensureZodDecoratorsLoaded(z)`\n * being called once on this bundle's Zod instance, the docs runtime sees\n * a schema graph whose `.shape` access paths and `z.infer` results don't\n * match what the SaaS app sees — a silent contract drift that bit us in\n * H-3 / M-7. The call is idempotent (guarded inside the function) so\n * importing this module multiple times is a no-op after the first load.\n *\n * The bare-specifier import is allow-listed by\n * `runtime-bundle-isolation.test.ts` (revised 2026-04-19); the package\n * itself is browser-safe (it only mutates `z.ZodType.prototype`).\n */\nimport { z } from 'zod';\nimport { ensureZodDecoratorsLoaded } from '@wildo-ai/zod-decorators';\n\nensureZodDecoratorsLoaded(z);\n\nexport * from './docs-auth-session.schemas';\nexport * from './decode-jwt-claims';\nexport * from './docs-auth-client';\nexport * from './DocsAuthContext';\nexport * from './frontend-provider-registry.techdoc';\nexport {\n FrontendProviderEntrySchema,\n FrontendProvidersBlockSchema,\n type FrontendProviderEntry,\n type FrontendProvidersBlock,\n} from '@wildo-ai/saas-models/public-runtime';\nexport * from './use-docs-auth-session';\nexport * from './use-docs-frontend-provider-registry';\nexport * from './use-docs-provider-sdks';\nexport * from './AuthExchangePage';\nexport * from './openapi-reference-model';\nexport * from './openapi-reference-conservation';\nexport * from './openapi-reference-view';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-reference-conservation.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"openapi-reference-conservation.d.ts","sourceRoot":"","sources":["../../../src/runtime/openapi-reference-conservation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAwE5F;;;;GAIG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAiBjH;AAED,4EAA4E;AAC5E,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,oBAAoB,GAAG,iBAAiB,CAIjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-docs-auth-session.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"use-docs-auth-session.d.ts","sourceRoot":"","sources":["../../../src/runtime/use-docs-auth-session.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,kBAAkB,IAAI,oBAAoB,CASzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-docs-frontend-provider-registry.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"use-docs-frontend-provider-registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/use-docs-frontend-provider-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAG5F,wBAAgB,+BAA+B,IAAI,+BAA+B,CAEjF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads and starts the npm SDK of every live docs provider that declares one.
|
|
3
|
+
*
|
|
4
|
+
* The techdoc's half of the CODE channel (#332). Until this landed, the docs
|
|
5
|
+
* runtime hydrated a provider registry that nothing read — the registry was
|
|
6
|
+
* built, exposed through `useDocsFrontendProviderRegistry`, and no consumer did
|
|
7
|
+
* anything with it.
|
|
8
|
+
*
|
|
9
|
+
* Effect-only, and that is not a detail: Docusaurus server-renders every page
|
|
10
|
+
* at build time, so a vendor SDK started during the render would run inside the
|
|
11
|
+
* build process — or throw, reaching for a `window` that is not there. The
|
|
12
|
+
* runner refuses off-browser on its own; the effect keeps it from being asked
|
|
13
|
+
* in the first place.
|
|
14
|
+
*
|
|
15
|
+
* Teardown is real where the vendor offers one. An analytics or
|
|
16
|
+
* error-monitoring client that can be started and never stopped cannot honour a
|
|
17
|
+
* consent withdrawal.
|
|
18
|
+
*/
|
|
19
|
+
import type { FrontendTechdocProviderRegistry } from './frontend-provider-registry.techdoc';
|
|
20
|
+
export declare function useDocsProviderSdks(registry: FrontendTechdocProviderRegistry | undefined): void;
|
|
21
|
+
//# sourceMappingURL=use-docs-provider-sdks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-docs-provider-sdks.d.ts","sourceRoot":"","sources":["../../../src/runtime/use-docs-provider-sdks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAE5F,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,+BAA+B,GAAG,SAAS,GACpD,IAAI,CA2BN"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads and starts the npm SDK of every live docs provider that declares one.
|
|
3
|
+
*
|
|
4
|
+
* The techdoc's half of the CODE channel (#332). Until this landed, the docs
|
|
5
|
+
* runtime hydrated a provider registry that nothing read — the registry was
|
|
6
|
+
* built, exposed through `useDocsFrontendProviderRegistry`, and no consumer did
|
|
7
|
+
* anything with it.
|
|
8
|
+
*
|
|
9
|
+
* Effect-only, and that is not a detail: Docusaurus server-renders every page
|
|
10
|
+
* at build time, so a vendor SDK started during the render would run inside the
|
|
11
|
+
* build process — or throw, reaching for a `window` that is not there. The
|
|
12
|
+
* runner refuses off-browser on its own; the effect keeps it from being asked
|
|
13
|
+
* in the first place.
|
|
14
|
+
*
|
|
15
|
+
* Teardown is real where the vendor offers one. An analytics or
|
|
16
|
+
* error-monitoring client that can be started and never stopped cannot honour a
|
|
17
|
+
* consent withdrawal.
|
|
18
|
+
*/
|
|
19
|
+
import { useEffect } from 'react';
|
|
20
|
+
import { activateFrontendProviderSdks, } from '@wildo-ai/external-connectors-public/techdoc';
|
|
21
|
+
import { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';
|
|
22
|
+
export function useDocsProviderSdks(registry) {
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (registry === undefined)
|
|
25
|
+
return;
|
|
26
|
+
let unmounted = false;
|
|
27
|
+
let activated;
|
|
28
|
+
void activateFrontendProviderSdks({
|
|
29
|
+
surface: AppFrontendType.TECH_DOC,
|
|
30
|
+
modules: registry.modules.values(),
|
|
31
|
+
onDiagnostic: (diagnostic) => {
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
console.warn(`[wildo-provider-sdk] ${diagnostic.kind}: ${diagnostic.message}`);
|
|
34
|
+
},
|
|
35
|
+
}).then((result) => {
|
|
36
|
+
activated = result;
|
|
37
|
+
// Activation is asynchronous and unmount is not: if the surface went away
|
|
38
|
+
// while a vendor bundle was still downloading, stop what we just started
|
|
39
|
+
// rather than leaving a client nobody can reach.
|
|
40
|
+
if (unmounted)
|
|
41
|
+
void result.deactivateAll();
|
|
42
|
+
});
|
|
43
|
+
return () => {
|
|
44
|
+
unmounted = true;
|
|
45
|
+
void activated?.deactivateAll();
|
|
46
|
+
};
|
|
47
|
+
}, [registry]);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=use-docs-provider-sdks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-docs-provider-sdks.js","sourceRoot":"","sources":["../../../src/runtime/use-docs-provider-sdks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,4BAA4B,GAE7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,MAAM,UAAU,mBAAmB,CACjC,QAAqD;IAErD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO;QAEnC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,SAAoD,CAAC;QAEzD,KAAK,4BAA4B,CAAC;YAChC,OAAO,EAAE,eAAe,CAAC,QAAQ;YACjC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE;YAClC,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE;gBAC3B,sCAAsC;gBACtC,OAAO,CAAC,IAAI,CAAC,wBAAwB,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YACjF,CAAC;SACF,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACjB,SAAS,GAAG,MAAM,CAAC;YACnB,0EAA0E;YAC1E,yEAAyE;YACzE,iDAAiD;YACjD,IAAI,SAAS;gBAAE,KAAK,MAAM,CAAC,aAAa,EAAE,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,KAAK,SAAS,EAAE,aAAa,EAAE,CAAC;QAClC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjB,CAAC","sourcesContent":["/**\n * Loads and starts the npm SDK of every live docs provider that declares one.\n *\n * The techdoc's half of the CODE channel (#332). Until this landed, the docs\n * runtime hydrated a provider registry that nothing read — the registry was\n * built, exposed through `useDocsFrontendProviderRegistry`, and no consumer did\n * anything with it.\n *\n * Effect-only, and that is not a detail: Docusaurus server-renders every page\n * at build time, so a vendor SDK started during the render would run inside the\n * build process — or throw, reaching for a `window` that is not there. The\n * runner refuses off-browser on its own; the effect keeps it from being asked\n * in the first place.\n *\n * Teardown is real where the vendor offers one. An analytics or\n * error-monitoring client that can be started and never stopped cannot honour a\n * consent withdrawal.\n */\n\nimport { useEffect } from 'react';\nimport {\n activateFrontendProviderSdks,\n type ActivatedFrontendProviderSdks,\n} from '@wildo-ai/external-connectors-public/techdoc';\nimport { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendTechdocProviderRegistry } from './frontend-provider-registry.techdoc';\n\nexport function useDocsProviderSdks(\n registry: FrontendTechdocProviderRegistry | undefined,\n): void {\n useEffect(() => {\n if (registry === undefined) return;\n\n let unmounted = false;\n let activated: ActivatedFrontendProviderSdks | undefined;\n\n void activateFrontendProviderSdks({\n surface: AppFrontendType.TECH_DOC,\n modules: registry.modules.values(),\n onDiagnostic: (diagnostic) => {\n // eslint-disable-next-line no-console\n console.warn(`[wildo-provider-sdk] ${diagnostic.kind}: ${diagnostic.message}`);\n },\n }).then((result) => {\n activated = result;\n // Activation is asynchronous and unmount is not: if the surface went away\n // while a vendor bundle was still downloading, stop what we just started\n // rather than leaving a client nobody can reach.\n if (unmounted) void result.deactivateAll();\n });\n\n return () => {\n unmounted = true;\n void activated?.deactivateAll();\n };\n }, [registry]);\n}\n"]}
|