@wildo-ai/external-connectors-public 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/.native.tsbuildinfo +1 -0
- package/dist/esm/app/compose-frontend-app-providers.d.ts.map +1 -1
- package/dist/esm/app/compose-frontend-app-providers.js +5 -2
- package/dist/esm/app/compose-frontend-app-providers.js.map +1 -1
- package/dist/esm/app/compose-hydrated-frontend-app-providers.d.ts +33 -0
- package/dist/esm/app/compose-hydrated-frontend-app-providers.d.ts.map +1 -0
- package/dist/esm/app/compose-hydrated-frontend-app-providers.js +41 -0
- package/dist/esm/app/compose-hydrated-frontend-app-providers.js.map +1 -0
- package/dist/esm/app/engine-frontend-app-provider-registry.d.ts.map +1 -1
- package/dist/esm/app/engine-frontend-app-provider-registry.js +8 -0
- package/dist/esm/app/engine-frontend-app-provider-registry.js.map +1 -1
- package/dist/esm/app/frontend-app-provider-module.types.d.ts +141 -15
- package/dist/esm/app/frontend-app-provider-module.types.d.ts.map +1 -1
- package/dist/esm/app/frontend-app-provider-module.types.js +7 -6
- package/dist/esm/app/frontend-app-provider-module.types.js.map +1 -1
- package/dist/esm/app/frontend-app-provider-registry.types.d.ts.map +1 -1
- package/dist/esm/app/index.d.ts +4 -0
- package/dist/esm/app/index.d.ts.map +1 -1
- package/dist/esm/app/index.js +4 -0
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/companion-exports.d.ts +71 -13
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js +130 -18
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/engine-frontend-providers-package.d.ts +7 -0
- package/dist/esm/engine-frontend-providers-package.d.ts.map +1 -0
- package/dist/esm/engine-frontend-providers-package.js +7 -0
- package/dist/esm/engine-frontend-providers-package.js.map +1 -0
- package/dist/esm/providers/algolia/algolia.frontend-techdoc.module.d.ts.map +1 -1
- package/dist/esm/providers/algolia/algolia.frontend-techdoc.module.js +26 -4
- package/dist/esm/providers/algolia/algolia.frontend-techdoc.module.js.map +1 -1
- package/dist/esm/providers/algolia/index.d.ts.map +1 -1
- package/dist/esm/providers/apple/apple.frontend-app.module.d.ts.map +1 -1
- package/dist/esm/providers/apple/apple.frontend-app.module.js +16 -4
- package/dist/esm/providers/apple/apple.frontend-app.module.js.map +1 -1
- package/dist/esm/providers/apple/index.d.ts.map +1 -1
- package/dist/esm/providers/github/github.frontend-app.module.d.ts.map +1 -1
- package/dist/esm/providers/github/github.frontend-app.module.js +15 -4
- package/dist/esm/providers/github/github.frontend-app.module.js.map +1 -1
- package/dist/esm/providers/github/index.d.ts.map +1 -1
- package/dist/esm/providers/google/google.frontend-app.module.d.ts +9 -0
- package/dist/esm/providers/google/google.frontend-app.module.d.ts.map +1 -1
- package/dist/esm/providers/google/google.frontend-app.module.js +28 -4
- package/dist/esm/providers/google/google.frontend-app.module.js.map +1 -1
- package/dist/esm/providers/google/index.d.ts.map +1 -1
- package/dist/esm/providers/google-drive/google-drive.frontend-app.module.d.ts +17 -0
- package/dist/esm/providers/google-drive/google-drive.frontend-app.module.d.ts.map +1 -0
- package/dist/esm/providers/google-drive/google-drive.frontend-app.module.js +66 -0
- package/dist/esm/providers/google-drive/google-drive.frontend-app.module.js.map +1 -0
- package/dist/esm/providers/google-drive/index.d.ts +2 -0
- package/dist/esm/providers/google-drive/index.d.ts.map +1 -0
- package/dist/esm/providers/google-drive/index.js +2 -0
- package/dist/esm/providers/google-drive/index.js.map +1 -0
- package/dist/esm/providers/microsoft/index.d.ts.map +1 -1
- package/dist/esm/providers/microsoft/microsoft.frontend-app.module.d.ts +6 -0
- package/dist/esm/providers/microsoft/microsoft.frontend-app.module.d.ts.map +1 -1
- package/dist/esm/providers/microsoft/microsoft.frontend-app.module.js +21 -4
- package/dist/esm/providers/microsoft/microsoft.frontend-app.module.js.map +1 -1
- package/dist/esm/providers/microsoft-onedrive/index.d.ts +2 -0
- package/dist/esm/providers/microsoft-onedrive/index.d.ts.map +1 -0
- package/dist/esm/providers/microsoft-onedrive/index.js +2 -0
- package/dist/esm/providers/microsoft-onedrive/index.js.map +1 -0
- package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.d.ts +13 -0
- package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.d.ts.map +1 -0
- package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.js +44 -0
- package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.js.map +1 -0
- package/dist/esm/providers/posthog/index.d.ts.map +1 -1
- package/dist/esm/providers/posthog/posthog.frontend-website.module.d.ts +19 -0
- package/dist/esm/providers/posthog/posthog.frontend-website.module.d.ts.map +1 -1
- package/dist/esm/providers/posthog/posthog.frontend-website.module.js +65 -4
- package/dist/esm/providers/posthog/posthog.frontend-website.module.js.map +1 -1
- package/dist/esm/providers/recaptcha/index.d.ts.map +1 -1
- package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.d.ts.map +1 -1
- package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js +24 -4
- package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js.map +1 -1
- package/dist/esm/providers/sentry/sentry.frontend-app.module.d.ts +57 -0
- package/dist/esm/providers/sentry/sentry.frontend-app.module.d.ts.map +1 -0
- package/dist/esm/providers/sentry/sentry.frontend-app.module.js +141 -0
- package/dist/esm/providers/sentry/sentry.frontend-app.module.js.map +1 -0
- package/dist/esm/providers/sentry/sentry.frontend-website.module.d.ts +27 -0
- package/dist/esm/providers/sentry/sentry.frontend-website.module.d.ts.map +1 -1
- package/dist/esm/providers/sentry/sentry.frontend-website.module.js +79 -4
- package/dist/esm/providers/sentry/sentry.frontend-website.module.js.map +1 -1
- package/dist/esm/providers/stripe/index.d.ts.map +1 -1
- package/dist/esm/providers/stripe/stripe.frontend-app.module.d.ts.map +1 -1
- package/dist/esm/providers/stripe/stripe.frontend-app.module.js +15 -4
- package/dist/esm/providers/stripe/stripe.frontend-app.module.js.map +1 -1
- package/dist/esm/shared/activate-frontend-provider-sdks.d.ts +88 -0
- package/dist/esm/shared/activate-frontend-provider-sdks.d.ts.map +1 -0
- package/dist/esm/shared/activate-frontend-provider-sdks.js +110 -0
- package/dist/esm/shared/activate-frontend-provider-sdks.js.map +1 -0
- package/dist/esm/shared/frontend-provider-surface.types.d.ts +253 -0
- package/dist/esm/shared/frontend-provider-surface.types.d.ts.map +1 -0
- package/dist/esm/shared/frontend-provider-surface.types.js +94 -0
- package/dist/esm/shared/frontend-provider-surface.types.js.map +1 -0
- package/dist/esm/shared/hydrate-frontend-providers.d.ts +157 -0
- package/dist/esm/shared/hydrate-frontend-providers.d.ts.map +1 -0
- package/dist/esm/shared/hydrate-frontend-providers.js +310 -0
- package/dist/esm/shared/hydrate-frontend-providers.js.map +1 -0
- package/dist/esm/techdoc/compose-frontend-techdoc-providers.d.ts.map +1 -1
- package/dist/esm/techdoc/compose-frontend-techdoc-providers.js +5 -2
- package/dist/esm/techdoc/compose-frontend-techdoc-providers.js.map +1 -1
- package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.d.ts +33 -0
- package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.d.ts.map +1 -0
- package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.js +41 -0
- package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.js.map +1 -0
- package/dist/esm/techdoc/engine-frontend-techdoc-provider-registry.d.ts.map +1 -1
- package/dist/esm/techdoc/frontend-techdoc-provider-module.types.d.ts +61 -4
- package/dist/esm/techdoc/frontend-techdoc-provider-module.types.d.ts.map +1 -1
- package/dist/esm/techdoc/frontend-techdoc-provider-module.types.js +5 -3
- package/dist/esm/techdoc/frontend-techdoc-provider-module.types.js.map +1 -1
- package/dist/esm/techdoc/frontend-techdoc-provider-registry.types.d.ts.map +1 -1
- package/dist/esm/techdoc/index.d.ts +4 -0
- package/dist/esm/techdoc/index.d.ts.map +1 -1
- package/dist/esm/techdoc/index.js +4 -0
- package/dist/esm/techdoc/index.js.map +1 -1
- package/dist/esm/website/compose-frontend-website-providers.d.ts.map +1 -1
- package/dist/esm/website/compose-frontend-website-providers.js +5 -2
- package/dist/esm/website/compose-frontend-website-providers.js.map +1 -1
- package/dist/esm/website/compose-hydrated-frontend-website-providers.d.ts +33 -0
- package/dist/esm/website/compose-hydrated-frontend-website-providers.d.ts.map +1 -0
- package/dist/esm/website/compose-hydrated-frontend-website-providers.js +41 -0
- package/dist/esm/website/compose-hydrated-frontend-website-providers.js.map +1 -0
- package/dist/esm/website/engine-frontend-website-provider-registry.d.ts.map +1 -1
- package/dist/esm/website/engine-frontend-website-provider-registry.js +5 -1
- package/dist/esm/website/engine-frontend-website-provider-registry.js.map +1 -1
- package/dist/esm/website/frontend-website-provider-module.types.d.ts +63 -3
- package/dist/esm/website/frontend-website-provider-module.types.d.ts.map +1 -1
- package/dist/esm/website/frontend-website-provider-module.types.js +7 -2
- package/dist/esm/website/frontend-website-provider-module.types.js.map +1 -1
- package/dist/esm/website/frontend-website-provider-registry.types.d.ts.map +1 -1
- package/dist/esm/website/index.d.ts +4 -0
- package/dist/esm/website/index.d.ts.map +1 -1
- package/dist/esm/website/index.js +4 -0
- package/dist/esm/website/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +15 -3
- package/dist/esm/providers/sentry/index.d.ts +0 -2
- package/dist/esm/providers/sentry/index.d.ts.map +0 -1
- package/dist/esm/providers/sentry/index.js +0 -2
- package/dist/esm/providers/sentry/index.js.map +0 -1
|
@@ -4,22 +4,25 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Intentionally HOLDS NO SECRETS — this type lives in
|
|
6
6
|
* `@wildo-ai/external-connectors-public/app`, the browser-bound side
|
|
7
|
-
* of the trust-zone split
|
|
8
|
-
*
|
|
7
|
+
* of the trust-zone split.
|
|
8
|
+
*
|
|
9
|
+
* The module is the CODE half of a provider's frontend surface. Its DATA half
|
|
10
|
+
* is `FrontendProviderEntry`, hydrated on first paint via
|
|
11
|
+
* `FrontendAppBootstrapPayload.frontendProviders`; the two are joined at
|
|
12
|
+
* runtime by `composeHydratedFrontendAppProviders` rather than one being cast
|
|
13
|
+
* to the other.
|
|
9
14
|
*
|
|
10
15
|
* The `publicConfig` slice is the only place public configuration flows
|
|
11
16
|
* to the frontend (e.g. Stripe publishable keys, OAuth client IDs).
|
|
12
|
-
* Consumers refine it at the use site via per-providerCapability shapes.
|
|
13
17
|
*
|
|
14
18
|
* I18n ownership stays at the consuming frontend surface: provider modules
|
|
15
19
|
* export translation-ready keys on `metadata`, while React/UI code resolves
|
|
16
20
|
* those keys through the app i18n service at render time. Do not freeze
|
|
17
21
|
* localized button labels or provider names into `publicConfig`.
|
|
18
|
-
*
|
|
19
|
-
* See `.cursor/plans/provider-registration-refactor-implementation-plan.md`
|
|
20
|
-
* §Phase 0.7.
|
|
21
22
|
*/
|
|
22
|
-
import type {
|
|
23
|
+
import type { FileStorageAccepted, ProviderComplianceProfile } from '@wildo-ai/saas-models/public-runtime';
|
|
24
|
+
import type { ProviderFrontendCspFootprintDeclaration, ProviderFrontendScriptDeclaration, ProviderMetadata, ProviderCapability, ProviderProtocol } from '@wildo-ai/saas-models/public-runtime';
|
|
25
|
+
import type { ProviderFrontendComponents, ProviderFrontendPublicConfigSchema, ProviderFrontendSdk } from '../shared/frontend-provider-surface.types';
|
|
23
26
|
/** @wildo_source:part:start external-connectors.app.frontend-provider-module facet:layer:frontend facet:family:provider */
|
|
24
27
|
/**
|
|
25
28
|
* The browser-bound provider module an application authors for its main
|
|
@@ -28,16 +31,37 @@ import type { ProviderMetadata, ProviderCapability, ProviderProtocol } from '@wi
|
|
|
28
31
|
* Import from `@wildo-ai/external-connectors-public/app`. The module is a
|
|
29
32
|
* plain object — no class, no registration call: the app re-exports it
|
|
30
33
|
* through its `./frontend-providers` package entry and appends a matching
|
|
31
|
-
* companion contribution; the framework
|
|
32
|
-
*
|
|
34
|
+
* companion contribution; the framework joins it with the provider's hydrated
|
|
35
|
+
* entry on first paint.
|
|
33
36
|
*
|
|
34
37
|
* NEVER put a secret in this object — it ships to the browser. `publicConfig`
|
|
35
38
|
* is the only channel for public runtime configuration (publishable keys,
|
|
36
|
-
* client IDs, picker constraints)
|
|
37
|
-
*
|
|
38
|
-
* translation-ready
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* client IDs, picker constraints). Author `metadata` ONLY through
|
|
40
|
+
* `defineProviderMetadata({ ref, packageName, tier, origin })` (#328): it
|
|
41
|
+
* derives the translation-ready display-name key and records the provider's
|
|
42
|
+
* identity — package, tier (an application-owned file picker is CATALOGUE: it
|
|
43
|
+
* binds no engine slot), vendor and origin. Never a frozen localized string,
|
|
44
|
+
* never a hand-written identity.
|
|
45
|
+
*
|
|
46
|
+
* ## Two channels, and which fields ride which
|
|
47
|
+
*
|
|
48
|
+
* `metadata`, `providerCapabilities`, `protocols`, `publicConfig`, `csp` and
|
|
49
|
+
* `scripts` are DATA: they are projected onto the provider's entry, travel as
|
|
50
|
+
* JSON, and are what the CLI reads when it composes the service's
|
|
51
|
+
* Content-Security-Policy — it cannot execute this module, because it is a Node
|
|
52
|
+
* process and this module is browser-bound.
|
|
53
|
+
*
|
|
54
|
+
* `sdk.activate` and `publicConfigSchema` are CODE. They reach a bundle only
|
|
55
|
+
* because the bundle imports this module, through the generated
|
|
56
|
+
* `frontend-providers.generated.ts` that `wildo config sync` writes for each
|
|
57
|
+
* frontend service. They are never serialized; a JSON channel would drop them
|
|
58
|
+
* without a word.
|
|
59
|
+
*
|
|
60
|
+
* A worked module declaring every field is in
|
|
61
|
+
* `frontend-app-provider.example.ts`, beside this file. It lives there rather
|
|
62
|
+
* than in an `@example` block here because the package's typecheck compiles it:
|
|
63
|
+
* the inline version shipped for a session showing three of the CSP footprint's
|
|
64
|
+
* six buckets while the type required all six, and nothing caught it.
|
|
41
65
|
*/
|
|
42
66
|
export interface FrontendAppProviderModule {
|
|
43
67
|
metadata: ProviderMetadata;
|
|
@@ -47,9 +71,111 @@ export interface FrontendAppProviderModule {
|
|
|
47
71
|
* Public configuration the frontend needs at runtime. Strongly typed
|
|
48
72
|
* via per-providerCapability shapes downstream — the registry stores
|
|
49
73
|
* them as `unknown` so the registry shape stays stable across apps
|
|
50
|
-
* that augment provider capabilities.
|
|
74
|
+
* that augment provider capabilities. Declare `publicConfigSchema`
|
|
75
|
+
* beside it to have the framework validate it once, at hydration,
|
|
76
|
+
* instead of each use site coercing it by hand.
|
|
51
77
|
*/
|
|
52
78
|
publicConfig?: Readonly<Record<string, unknown>>;
|
|
79
|
+
/**
|
|
80
|
+
* Origins this provider needs the SaaS app's composed CSP to admit.
|
|
81
|
+
*
|
|
82
|
+
* DATA: projected onto the provider entry and read by `resolveCspPolicy`'s
|
|
83
|
+
* provider layer, per service and per environment. Declaring it here is what
|
|
84
|
+
* removes the alternative — hand-editing script / frame / connect origins in
|
|
85
|
+
* every application's config, for every environment.
|
|
86
|
+
*
|
|
87
|
+
* Name only the buckets you reach; the framework fills in the rest. For an
|
|
88
|
+
* endpoint you CANNOT know — one the application configures, such as a
|
|
89
|
+
* monitoring DSN, an analytics host, a self-hosted deployment — declare where
|
|
90
|
+
* it lives instead of guessing what it is:
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* csp: {
|
|
94
|
+
* derivedOrigins: [
|
|
95
|
+
* { publicConfigKey: 'dsn', bucket: ProviderFrontendCspOriginBucket.CONNECT },
|
|
96
|
+
* ],
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* The framework reads that key out of your own `publicConfig` and takes its
|
|
101
|
+
* URL origin. That is what stops an application authoring the same host twice
|
|
102
|
+
* — once as your configuration, once in its CSP — where the copy that drifts
|
|
103
|
+
* fails only in production, because development is report-only.
|
|
104
|
+
*/
|
|
105
|
+
csp?: ProviderFrontendCspFootprintDeclaration;
|
|
106
|
+
/**
|
|
107
|
+
* Third-party `<script>` tags the surface must add for this provider — the
|
|
108
|
+
* case a dynamic `import()` cannot serve, because the vendor ships a
|
|
109
|
+
* global-installing tag rather than an npm module.
|
|
110
|
+
*
|
|
111
|
+
* DATA. Each declared `src`'s origin MUST also appear in `csp.scriptOrigins`
|
|
112
|
+
* — `projectFrontendProviderContribution` refuses the provider otherwise,
|
|
113
|
+
* because the policy it contributes to would block its own script, and only
|
|
114
|
+
* where CSP enforces, so the failure would first appear in production.
|
|
115
|
+
*/
|
|
116
|
+
scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;
|
|
117
|
+
/**
|
|
118
|
+
* The provider's vendor SDK: which package (DATA) and how to load and start
|
|
119
|
+
* it (CODE).
|
|
120
|
+
*
|
|
121
|
+
* `activate` must reach its package through a DYNAMIC `import()`, so the SDK
|
|
122
|
+
* is a separate chunk and no page pays for a provider it does not use.
|
|
123
|
+
*/
|
|
124
|
+
sdk?: ProviderFrontendSdk;
|
|
125
|
+
/**
|
|
126
|
+
* Components this provider contributes, keyed by the capability each fills
|
|
127
|
+
* and loaded on demand. CODE: it reaches a bundle only through the generated
|
|
128
|
+
* `frontend-providers.generated.ts`, never through the JSON entry.
|
|
129
|
+
*
|
|
130
|
+
* Several providers may offer a component for ONE capability — two file
|
|
131
|
+
* pickers, two meeting embeds — and that is the point: the surface presents
|
|
132
|
+
* the choice rather than silently taking whichever the registry happened to
|
|
133
|
+
* index first.
|
|
134
|
+
*/
|
|
135
|
+
components?: ProviderFrontendComponents;
|
|
136
|
+
/**
|
|
137
|
+
* The `z_file` storage this provider's file picker fronts (#394 P5). Declare
|
|
138
|
+
* it when the picker delivers a `REMOTE_REFERENCE`: the bytes stay at the
|
|
139
|
+
* vendor, so the FILES row lands in this storage and only a field whose
|
|
140
|
+
* `storageAccepted` names it may receive the link. Leave it undeclared for a
|
|
141
|
+
* picker that delivers bytes — those are ingested into the field's own
|
|
142
|
+
* storage and offered to every field.
|
|
143
|
+
*
|
|
144
|
+
* The backend serves the same storage through an `IFileStorageProvider`
|
|
145
|
+
* keyed by this member that names this provider back as its
|
|
146
|
+
* `connectedProviderRef`; the framework pins the two declarations equal.
|
|
147
|
+
*/
|
|
148
|
+
fileStorage?: FileStorageAccepted;
|
|
149
|
+
/**
|
|
150
|
+
* Validator for this provider's own `publicConfig`, as a Standard Schema v1
|
|
151
|
+
* value (a Zod 4 schema satisfies it as-is).
|
|
152
|
+
*
|
|
153
|
+
* CODE, and the answer to a real defect: `publicConfig` is
|
|
154
|
+
* `Record<string, unknown>`, and each consuming site was coercing it by hand,
|
|
155
|
+
* so a renamed key yielded `undefined` and a silently wrong provider. With a
|
|
156
|
+
* schema declared, the framework validates once at hydration and a mismatch
|
|
157
|
+
* says which key and why.
|
|
158
|
+
*/
|
|
159
|
+
publicConfigSchema?: ProviderFrontendPublicConfigSchema;
|
|
160
|
+
/**
|
|
161
|
+
* The vendor's deployment model, processing regions and legal entity — the primitives a
|
|
162
|
+
* processor register and a transfer statement are derived from.
|
|
163
|
+
*
|
|
164
|
+
* OPTIONAL, matching the backend contract, because a provider whose author has not stated them
|
|
165
|
+
* must still load. Absent means the APPLICATION has to declare them on its own register entry,
|
|
166
|
+
* where its contract with the vendor makes them checkable.
|
|
167
|
+
*
|
|
168
|
+
* Why a FRONTEND provider needs this at least as much as a backend one (#345): this module
|
|
169
|
+
* executes in the DATA SUBJECT'S BROWSER. It loads third-party script, may set storage, and
|
|
170
|
+
* talks to the vendor directly — the application's backend never sees the call. Product
|
|
171
|
+
* analytics, error monitoring, a captcha and a payment element are precisely the third-party
|
|
172
|
+
* recipients a privacy notice has to name, and the operator controls them LESS than a backend
|
|
173
|
+
* provider routed through their own infrastructure.
|
|
174
|
+
*
|
|
175
|
+
* See `ProviderComplianceProfileSchema` for each field's meaning and for the refusal that a
|
|
176
|
+
* `VENDOR_HOSTED` provider declaring no region cannot support a transfer statement.
|
|
177
|
+
*/
|
|
178
|
+
complianceProfile?: ProviderComplianceProfile;
|
|
53
179
|
}
|
|
54
180
|
/** @wildo_source:part:end external-connectors.app.frontend-provider-module */
|
|
55
181
|
//# sourceMappingURL=frontend-app-provider-module.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-app-provider-module.types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frontend-app-provider-module.types.d.ts","sourceRoot":"","sources":["../../../src/app/frontend-app-provider-module.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAE3G,OAAO,KAAK,EACV,uCAAuC,EACvC,iCAAiC,EACjC,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,0BAA0B,EAC1B,kCAAkC,EAClC,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAEnD,2HAA2H;AAC3H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,oBAAoB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC3C;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,GAAG,CAAC,EAAE,uCAAuC,CAAC;IAC9C;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,iCAAiC,CAAC,CAAC;IAC3D;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC;;;;;;;;;OASG;IACH,kBAAkB,CAAC,EAAE,kCAAkC,CAAC;IACxD;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;CAC/C;AACD,8EAA8E"}
|
|
@@ -4,20 +4,21 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Intentionally HOLDS NO SECRETS — this type lives in
|
|
6
6
|
* `@wildo-ai/external-connectors-public/app`, the browser-bound side
|
|
7
|
-
* of the trust-zone split
|
|
8
|
-
*
|
|
7
|
+
* of the trust-zone split.
|
|
8
|
+
*
|
|
9
|
+
* The module is the CODE half of a provider's frontend surface. Its DATA half
|
|
10
|
+
* is `FrontendProviderEntry`, hydrated on first paint via
|
|
11
|
+
* `FrontendAppBootstrapPayload.frontendProviders`; the two are joined at
|
|
12
|
+
* runtime by `composeHydratedFrontendAppProviders` rather than one being cast
|
|
13
|
+
* to the other.
|
|
9
14
|
*
|
|
10
15
|
* The `publicConfig` slice is the only place public configuration flows
|
|
11
16
|
* to the frontend (e.g. Stripe publishable keys, OAuth client IDs).
|
|
12
|
-
* Consumers refine it at the use site via per-providerCapability shapes.
|
|
13
17
|
*
|
|
14
18
|
* I18n ownership stays at the consuming frontend surface: provider modules
|
|
15
19
|
* export translation-ready keys on `metadata`, while React/UI code resolves
|
|
16
20
|
* those keys through the app i18n service at render time. Do not freeze
|
|
17
21
|
* localized button labels or provider names into `publicConfig`.
|
|
18
|
-
*
|
|
19
|
-
* See `.cursor/plans/provider-registration-refactor-implementation-plan.md`
|
|
20
|
-
* §Phase 0.7.
|
|
21
22
|
*/
|
|
22
23
|
/** @wildo_source:part:end external-connectors.app.frontend-provider-module */
|
|
23
24
|
//# sourceMappingURL=frontend-app-provider-module.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-app-provider-module.types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frontend-app-provider-module.types.js","sourceRoot":"","sources":["../../../src/app/frontend-app-provider-module.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA2KH,8EAA8E","sourcesContent":["/**\n * `FrontendAppProviderModule` — browser-bound facet of a provider for\n * the main SaaS-app frontend (`AppFrontendType.SAAS_APP`).\n *\n * Intentionally HOLDS NO SECRETS — this type lives in\n * `@wildo-ai/external-connectors-public/app`, the browser-bound side\n * of the trust-zone split.\n *\n * The module is the CODE half of a provider's frontend surface. Its DATA half\n * is `FrontendProviderEntry`, hydrated on first paint via\n * `FrontendAppBootstrapPayload.frontendProviders`; the two are joined at\n * runtime by `composeHydratedFrontendAppProviders` rather than one being cast\n * to the other.\n *\n * The `publicConfig` slice is the only place public configuration flows\n * to the frontend (e.g. Stripe publishable keys, OAuth client IDs).\n *\n * I18n ownership stays at the consuming frontend surface: provider modules\n * export translation-ready keys on `metadata`, while React/UI code resolves\n * those keys through the app i18n service at render time. Do not freeze\n * localized button labels or provider names into `publicConfig`.\n */\n\nimport type { FileStorageAccepted, ProviderComplianceProfile } from '@wildo-ai/saas-models/public-runtime';\n\nimport type {\n ProviderFrontendCspFootprintDeclaration,\n ProviderFrontendScriptDeclaration,\n ProviderMetadata,\n ProviderCapability,\n ProviderProtocol,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type {\n ProviderFrontendComponents,\n ProviderFrontendPublicConfigSchema,\n ProviderFrontendSdk,\n} from '../shared/frontend-provider-surface.types';\n\n/** @wildo_source:part:start external-connectors.app.frontend-provider-module facet:layer:frontend facet:family:provider */\n/**\n * The browser-bound provider module an application authors for its main\n * SaaS-app frontend.\n *\n * Import from `@wildo-ai/external-connectors-public/app`. The module is a\n * plain object — no class, no registration call: the app re-exports it\n * through its `./frontend-providers` package entry and appends a matching\n * companion contribution; the framework joins it with the provider's hydrated\n * entry on first paint.\n *\n * NEVER put a secret in this object — it ships to the browser. `publicConfig`\n * is the only channel for public runtime configuration (publishable keys,\n * client IDs, picker constraints). Author `metadata` ONLY through\n * `defineProviderMetadata({ ref, packageName, tier, origin })` (#328): it\n * derives the translation-ready display-name key and records the provider's\n * identity — package, tier (an application-owned file picker is CATALOGUE: it\n * binds no engine slot), vendor and origin. Never a frozen localized string,\n * never a hand-written identity.\n *\n * ## Two channels, and which fields ride which\n *\n * `metadata`, `providerCapabilities`, `protocols`, `publicConfig`, `csp` and\n * `scripts` are DATA: they are projected onto the provider's entry, travel as\n * JSON, and are what the CLI reads when it composes the service's\n * Content-Security-Policy — it cannot execute this module, because it is a Node\n * process and this module is browser-bound.\n *\n * `sdk.activate` and `publicConfigSchema` are CODE. They reach a bundle only\n * because the bundle imports this module, through the generated\n * `frontend-providers.generated.ts` that `wildo config sync` writes for each\n * frontend service. They are never serialized; a JSON channel would drop them\n * without a word.\n *\n * A worked module declaring every field is in\n * `frontend-app-provider.example.ts`, beside this file. It lives there rather\n * than in an `@example` block here because the package's typecheck compiles it:\n * the inline version shipped for a session showing three of the CSP footprint's\n * six buckets while the type required all six, and nothing caught it.\n */\nexport interface FrontendAppProviderModule {\n metadata: ProviderMetadata;\n providerCapabilities: ReadonlyArray<ProviderCapability>;\n protocols: ReadonlyArray<ProviderProtocol>;\n /**\n * Public configuration the frontend needs at runtime. Strongly typed\n * via per-providerCapability shapes downstream — the registry stores\n * them as `unknown` so the registry shape stays stable across apps\n * that augment provider capabilities. Declare `publicConfigSchema`\n * beside it to have the framework validate it once, at hydration,\n * instead of each use site coercing it by hand.\n */\n publicConfig?: Readonly<Record<string, unknown>>;\n /**\n * Origins this provider needs the SaaS app's composed CSP to admit.\n *\n * DATA: projected onto the provider entry and read by `resolveCspPolicy`'s\n * provider layer, per service and per environment. Declaring it here is what\n * removes the alternative — hand-editing script / frame / connect origins in\n * every application's config, for every environment.\n *\n * Name only the buckets you reach; the framework fills in the rest. For an\n * endpoint you CANNOT know — one the application configures, such as a\n * monitoring DSN, an analytics host, a self-hosted deployment — declare where\n * it lives instead of guessing what it is:\n *\n * ```ts\n * csp: {\n * derivedOrigins: [\n * { publicConfigKey: 'dsn', bucket: ProviderFrontendCspOriginBucket.CONNECT },\n * ],\n * }\n * ```\n *\n * The framework reads that key out of your own `publicConfig` and takes its\n * URL origin. That is what stops an application authoring the same host twice\n * — once as your configuration, once in its CSP — where the copy that drifts\n * fails only in production, because development is report-only.\n */\n csp?: ProviderFrontendCspFootprintDeclaration;\n /**\n * Third-party `<script>` tags the surface must add for this provider — the\n * case a dynamic `import()` cannot serve, because the vendor ships a\n * global-installing tag rather than an npm module.\n *\n * DATA. Each declared `src`'s origin MUST also appear in `csp.scriptOrigins`\n * — `projectFrontendProviderContribution` refuses the provider otherwise,\n * because the policy it contributes to would block its own script, and only\n * where CSP enforces, so the failure would first appear in production.\n */\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /**\n * The provider's vendor SDK: which package (DATA) and how to load and start\n * it (CODE).\n *\n * `activate` must reach its package through a DYNAMIC `import()`, so the SDK\n * is a separate chunk and no page pays for a provider it does not use.\n */\n sdk?: ProviderFrontendSdk;\n /**\n * Components this provider contributes, keyed by the capability each fills\n * and loaded on demand. CODE: it reaches a bundle only through the generated\n * `frontend-providers.generated.ts`, never through the JSON entry.\n *\n * Several providers may offer a component for ONE capability — two file\n * pickers, two meeting embeds — and that is the point: the surface presents\n * the choice rather than silently taking whichever the registry happened to\n * index first.\n */\n components?: ProviderFrontendComponents;\n /**\n * The `z_file` storage this provider's file picker fronts (#394 P5). Declare\n * it when the picker delivers a `REMOTE_REFERENCE`: the bytes stay at the\n * vendor, so the FILES row lands in this storage and only a field whose\n * `storageAccepted` names it may receive the link. Leave it undeclared for a\n * picker that delivers bytes — those are ingested into the field's own\n * storage and offered to every field.\n *\n * The backend serves the same storage through an `IFileStorageProvider`\n * keyed by this member that names this provider back as its\n * `connectedProviderRef`; the framework pins the two declarations equal.\n */\n fileStorage?: FileStorageAccepted;\n /**\n * Validator for this provider's own `publicConfig`, as a Standard Schema v1\n * value (a Zod 4 schema satisfies it as-is).\n *\n * CODE, and the answer to a real defect: `publicConfig` is\n * `Record<string, unknown>`, and each consuming site was coercing it by hand,\n * so a renamed key yielded `undefined` and a silently wrong provider. With a\n * schema declared, the framework validates once at hydration and a mismatch\n * says which key and why.\n */\n publicConfigSchema?: ProviderFrontendPublicConfigSchema;\n /**\n * The vendor's deployment model, processing regions and legal entity — the primitives a\n * processor register and a transfer statement are derived from.\n *\n * OPTIONAL, matching the backend contract, because a provider whose author has not stated them\n * must still load. Absent means the APPLICATION has to declare them on its own register entry,\n * where its contract with the vendor makes them checkable.\n *\n * Why a FRONTEND provider needs this at least as much as a backend one (#345): this module\n * executes in the DATA SUBJECT'S BROWSER. It loads third-party script, may set storage, and\n * talks to the vendor directly — the application's backend never sees the call. Product\n * analytics, error monitoring, a captcha and a payment element are precisely the third-party\n * recipients a privacy notice has to name, and the operator controls them LESS than a backend\n * provider routed through their own infrastructure.\n *\n * See `ProviderComplianceProfileSchema` for each field's meaning and for the refusal that a\n * `VENDOR_HOSTED` provider declaring no region cannot support a transfer statement.\n */\n complianceProfile?: ProviderComplianceProfile;\n}\n/** @wildo_source:part:end external-connectors.app.frontend-provider-module */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-app-provider-registry.types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frontend-app-provider-registry.types.d.ts","sourceRoot":"","sources":["../../../src/app/frontend-app-provider-registry.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG;IAC5C,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;CAC5C,CAAC;AAEF,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,CAAC;IAEjF,gBAAgB,CAAC,GAAG,EAAE,sBAAsB,GAAG,yBAAyB,GAAG,SAAS,CAAC;IAErF,gCAAgC,CAC9B,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAE5C,gCAAgC,CAC9B,kBAAkB,EAAE,kBAAkB,GACrC,yBAAyB,GAAG,SAAS,CAAC;CAC1C"}
|
package/dist/esm/app/index.d.ts
CHANGED
|
@@ -7,4 +7,8 @@ export * from './frontend-app-provider-module.types';
|
|
|
7
7
|
export * from './frontend-app-provider-registry.types';
|
|
8
8
|
export * from './compose-frontend-app-providers';
|
|
9
9
|
export * from './engine-frontend-app-provider-registry';
|
|
10
|
+
export * from './compose-hydrated-frontend-app-providers';
|
|
11
|
+
export * from '../shared/frontend-provider-surface.types';
|
|
12
|
+
export * from '../shared/hydrate-frontend-providers';
|
|
13
|
+
export * from '../shared/activate-frontend-provider-sdks';
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC"}
|
package/dist/esm/app/index.js
CHANGED
|
@@ -7,4 +7,8 @@ export * from './frontend-app-provider-module.types.js';
|
|
|
7
7
|
export * from './frontend-app-provider-registry.types.js';
|
|
8
8
|
export * from './compose-frontend-app-providers.js';
|
|
9
9
|
export * from './engine-frontend-app-provider-registry.js';
|
|
10
|
+
export * from './compose-hydrated-frontend-app-providers.js';
|
|
11
|
+
export * from '../shared/frontend-provider-surface.types.js';
|
|
12
|
+
export * from '../shared/hydrate-frontend-providers.js';
|
|
13
|
+
export * from '../shared/activate-frontend-provider-sdks.js';
|
|
10
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC","sourcesContent":["/**\n * Public surface of `@wildo-ai/external-connectors-public/app`.\n *\n * Browser-bound, no secrets. Phase 1 wires `composeFrontendAppProviders`.\n */\n\nexport * from './frontend-app-provider-module.types';\nexport * from './frontend-app-provider-registry.types';\nexport * from './compose-frontend-app-providers';\nexport * from './engine-frontend-app-provider-registry';\nexport * from './compose-hydrated-frontend-app-providers';\nexport * from '../shared/frontend-provider-surface.types';\nexport * from '../shared/hydrate-frontend-providers';\nexport * from '../shared/activate-frontend-provider-sdks';\n"]}
|
|
@@ -8,19 +8,27 @@
|
|
|
8
8
|
* keyed to a frontend service-type via `serviceType` (closed
|
|
9
9
|
* `AppFrontendType` enum).
|
|
10
10
|
*
|
|
11
|
-
* NOT auto-discovered
|
|
12
|
-
*
|
|
13
|
-
* (platform-config-lib) walks
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* dogfood pattern: Wonder Todos's `app` /
|
|
20
|
-
* `provider-contributions.ts` map `EngineFrontend*ProviderRegistry.modules`
|
|
21
|
-
* and add app-owned entries (e.g. its file-picker provider).
|
|
22
|
-
*
|
|
23
|
-
*
|
|
11
|
+
* NOT auto-discovered — and this package is now the EXCEPTION rather than the rule,
|
|
12
|
+
* which is the part to read carefully. `discoverSaasProviderCompanionContributions`
|
|
13
|
+
* (platform-config-lib) walks each runtime owner declared in `wildo.saas.config.ts`
|
|
14
|
+
* AND every provider package it depends on, admitting the scraped catalogue,
|
|
15
|
+
* `@wildo-ai/provider-*` and — since #358 — the engine's BACKEND connector package
|
|
16
|
+
* `@wildo-ai/external-connectors-private` by exact name. It does not admit this one.
|
|
17
|
+
* So these arrays reach a generated `provider-catalog.types.ts` / runtime artifact
|
|
18
|
+
* only when an app's frontend `provider-contributions.ts` re-derives them from the
|
|
19
|
+
* same registries — which is exactly the dogfood pattern: Wonder Todos's `app` /
|
|
20
|
+
* `website` `provider-contributions.ts` map `EngineFrontend*ProviderRegistry.modules`
|
|
21
|
+
* and add app-owned entries (e.g. its file-picker provider).
|
|
22
|
+
*
|
|
23
|
+
* A `frontendService` target additionally requires a `frontendEntry` payload for
|
|
24
|
+
* bootstrap materialization, which the discovery validator refuses without — so the
|
|
25
|
+
* frontend case is not merely un-admitted, it carries a payload the backend case
|
|
26
|
+
* has no equivalent of. Admitting this package would have to answer that first.
|
|
27
|
+
*
|
|
28
|
+
* (This paragraph used to end "Wiring the discovery walker to load engine connector
|
|
29
|
+
* packages directly is a tracked follow-up, not the current contract." Half of that
|
|
30
|
+
* shipped in #358 and the sentence did not distinguish the two packages, so it read
|
|
31
|
+
* as false about the backend and true here.)
|
|
24
32
|
*
|
|
25
33
|
* NOT for browser consumption. This module is loaded only by Node-side
|
|
26
34
|
* tooling (`wildo config sync` and the `discoverSaasProviderCompanionContributions`
|
|
@@ -28,7 +36,57 @@
|
|
|
28
36
|
* remain the browser-shipped surface; this `./companion` subpath is
|
|
29
37
|
* tooling-only.
|
|
30
38
|
*/
|
|
39
|
+
import { AppFrontendType, type ProviderFrontendCspFootprintDeclaration, type ProviderFrontendScriptDeclaration, type ProviderFrontendComponentDescriptor, type ProviderFrontendSdkDescriptor, type ProviderMetadata } from '@wildo-ai/saas-models/public-runtime';
|
|
31
40
|
import { type ProviderCompanionContribution, type RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';
|
|
41
|
+
import type { FileStorageAccepted } from '@wildo-ai/saas-models/public-runtime';
|
|
42
|
+
/**
|
|
43
|
+
* The facet-agnostic view of a frontend provider module this projection reads.
|
|
44
|
+
*
|
|
45
|
+
* Only the DATA half appears here, and that is the contract rather than an
|
|
46
|
+
* omission: this file is loaded by NODE-side tooling (`wildo config sync` and
|
|
47
|
+
* the discovery walker), which cannot execute a browser-bound module's
|
|
48
|
+
* `sdk.activate` and must never try. What it CAN read is the descriptor beside
|
|
49
|
+
* it — which package the SDK lives in — and that is what the bundle-isolation
|
|
50
|
+
* policy, an application's dependency alignment and a human reading a bundle
|
|
51
|
+
* report need.
|
|
52
|
+
*/
|
|
53
|
+
interface FrontendProviderModuleShape {
|
|
54
|
+
metadata: ProviderMetadata;
|
|
55
|
+
providerCapabilities: ReadonlyArray<string>;
|
|
56
|
+
protocols: ReadonlyArray<string>;
|
|
57
|
+
publicConfig?: Readonly<Record<string, unknown>>;
|
|
58
|
+
csp?: ProviderFrontendCspFootprintDeclaration;
|
|
59
|
+
scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;
|
|
60
|
+
sdk?: {
|
|
61
|
+
readonly descriptor: ProviderFrontendSdkDescriptor;
|
|
62
|
+
};
|
|
63
|
+
components?: Readonly<Record<string, ProviderFrontendComponentDescriptor & {
|
|
64
|
+
readonly load?: unknown;
|
|
65
|
+
}>>;
|
|
66
|
+
fileStorage?: FileStorageAccepted;
|
|
67
|
+
publicConfigSchema?: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Turns a frontend provider module into the companion contribution tooling
|
|
71
|
+
* reads — the ONE place a facet module becomes a discovery record.
|
|
72
|
+
*
|
|
73
|
+
* Exported because the engine is not the only producer. Every
|
|
74
|
+
* `@wildo-ai/provider-<ref>` package's own `./companion` barrel has to do
|
|
75
|
+
* exactly this for its own facet modules, and a projection each package
|
|
76
|
+
* hand-rolls is a projection that drifts: the DATA half of the frontend
|
|
77
|
+
* surface would end up carried by some packages and dropped by others, and a
|
|
78
|
+
* dropped CSP footprint is invisible until a provider is blocked in production.
|
|
79
|
+
*
|
|
80
|
+
* What crosses and what does not is the whole contract. `csp`, `scripts` and
|
|
81
|
+
* the SDK DESCRIPTOR cross, because tooling has to read them without executing
|
|
82
|
+
* anything — this runs in Node and a facet module is browser-bound. The
|
|
83
|
+
* executable half — `sdk.activate`, `publicConfigSchema` — does NOT, and cannot:
|
|
84
|
+
* the contribution is serialized to JSON on its way into the generated
|
|
85
|
+
* artifact, so a function would be dropped by `JSON.stringify` with no error
|
|
86
|
+
* anywhere. Code reaches a bundle through the generated
|
|
87
|
+
* `frontend-providers.generated.ts` instead.
|
|
88
|
+
*/
|
|
89
|
+
export declare function projectFrontendProviderContribution(module: FrontendProviderModuleShape, serviceType: AppFrontendType, runtimeImportPath: string): ProviderCompanionContribution;
|
|
32
90
|
/** One contribution per `EngineFrontendAppProviderRegistry` module, targeting `SAAS_APP`. */
|
|
33
91
|
export declare const engineFrontendAppProviderContributions: ProviderCompanionContribution[];
|
|
34
92
|
/** One contribution per `EngineFrontendTechdocProviderRegistry` module, targeting `TECH_DOC`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-exports.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"companion-exports.d.ts","sourceRoot":"","sources":["../../src/companion-exports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,eAAe,EAIf,KAAK,uCAAuC,EAC5C,KAAK,iCAAiC,EACtC,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAClC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAoChF;;;;;;;;;;GAUG;AACH,UAAU,2BAA2B;IACnC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,GAAG,CAAC,EAAE,uCAAuC,CAAC;IAC9C,OAAO,CAAC,EAAE,aAAa,CAAC,iCAAiC,CAAC,CAAC;IAC3D,GAAG,CAAC,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,6BAA6B,CAAA;KAAE,CAAC;IAC7D,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mCAAmC,GAAG;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC,CAAC;IACzG,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAqDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,2BAA2B,EACnC,WAAW,EAAE,eAAe,EAC5B,iBAAiB,EAAE,MAAM,GACxB,6BAA6B,CAyD/B;AAED,6FAA6F;AAC7F,eAAO,MAAM,sCAAsC,EAAE,6BAA6B,EAG/E,CAAC;AAEJ,iGAAiG;AACjG,eAAO,MAAM,0CAA0C,EAAE,6BAA6B,EAGnF,CAAC;AAEJ,uGAAuG;AACvG,eAAO,MAAM,0CAA0C,EAAE,6BAA6B,EAGnF,CAAC;AAEJ,sGAAsG;AACtG,eAAO,MAAM,mCAAmC,EAAE,6BAA6B,EAI9E,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,EAAE,4BAEvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -8,19 +8,27 @@
|
|
|
8
8
|
* keyed to a frontend service-type via `serviceType` (closed
|
|
9
9
|
* `AppFrontendType` enum).
|
|
10
10
|
*
|
|
11
|
-
* NOT auto-discovered
|
|
12
|
-
*
|
|
13
|
-
* (platform-config-lib) walks
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* dogfood pattern: Wonder Todos's `app` /
|
|
20
|
-
* `provider-contributions.ts` map `EngineFrontend*ProviderRegistry.modules`
|
|
21
|
-
* and add app-owned entries (e.g. its file-picker provider).
|
|
22
|
-
*
|
|
23
|
-
*
|
|
11
|
+
* NOT auto-discovered — and this package is now the EXCEPTION rather than the rule,
|
|
12
|
+
* which is the part to read carefully. `discoverSaasProviderCompanionContributions`
|
|
13
|
+
* (platform-config-lib) walks each runtime owner declared in `wildo.saas.config.ts`
|
|
14
|
+
* AND every provider package it depends on, admitting the scraped catalogue,
|
|
15
|
+
* `@wildo-ai/provider-*` and — since #358 — the engine's BACKEND connector package
|
|
16
|
+
* `@wildo-ai/external-connectors-private` by exact name. It does not admit this one.
|
|
17
|
+
* So these arrays reach a generated `provider-catalog.types.ts` / runtime artifact
|
|
18
|
+
* only when an app's frontend `provider-contributions.ts` re-derives them from the
|
|
19
|
+
* same registries — which is exactly the dogfood pattern: Wonder Todos's `app` /
|
|
20
|
+
* `website` `provider-contributions.ts` map `EngineFrontend*ProviderRegistry.modules`
|
|
21
|
+
* and add app-owned entries (e.g. its file-picker provider).
|
|
22
|
+
*
|
|
23
|
+
* A `frontendService` target additionally requires a `frontendEntry` payload for
|
|
24
|
+
* bootstrap materialization, which the discovery validator refuses without — so the
|
|
25
|
+
* frontend case is not merely un-admitted, it carries a payload the backend case
|
|
26
|
+
* has no equivalent of. Admitting this package would have to answer that first.
|
|
27
|
+
*
|
|
28
|
+
* (This paragraph used to end "Wiring the discovery walker to load engine connector
|
|
29
|
+
* packages directly is a tracked follow-up, not the current contract." Half of that
|
|
30
|
+
* shipped in #358 and the sentence did not distinguish the two packages, so it read
|
|
31
|
+
* as false about the backend and true here.)
|
|
24
32
|
*
|
|
25
33
|
* NOT for browser consumption. This module is loaded only by Node-side
|
|
26
34
|
* tooling (`wildo config sync` and the `discoverSaasProviderCompanionContributions`
|
|
@@ -28,8 +36,10 @@
|
|
|
28
36
|
* remain the browser-shipped surface; this `./companion` subpath is
|
|
29
37
|
* tooling-only.
|
|
30
38
|
*/
|
|
31
|
-
import { AppFrontendType, } from '@wildo-ai/saas-models/public-runtime';
|
|
39
|
+
import { AppFrontendType, normalizeProviderFrontendCspFootprint, } from '@wildo-ai/saas-models/public-runtime';
|
|
32
40
|
import { PROVIDER_CAPABILITY_TO_ENGINE_CAPABILITY, } from '@wildo-ai/saas-models';
|
|
41
|
+
import { readDeclaredPublicConfigKeys } from '@wildo-ai/saas-models/public-runtime';
|
|
42
|
+
import { projectFrontendComponentDescriptors } from './shared/frontend-provider-surface.types.js';
|
|
33
43
|
import { EngineFrontendAppProviderRegistry } from './app/engine-frontend-app-provider-registry.js';
|
|
34
44
|
import { EngineFrontendTechdocProviderRegistry } from './techdoc/engine-frontend-techdoc-provider-registry.js';
|
|
35
45
|
import { EngineFrontendWebsiteProviderRegistry } from './website/engine-frontend-website-provider-registry.js';
|
|
@@ -60,15 +70,117 @@ function deriveEngineCapabilities(providerCapabilities) {
|
|
|
60
70
|
}
|
|
61
71
|
return Array.from(slots);
|
|
62
72
|
}
|
|
63
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Refuses a provider whose declared `<script>` origin it did not also grant
|
|
75
|
+
* itself in `csp.scriptOrigins`.
|
|
76
|
+
*
|
|
77
|
+
* The three facet module types have carried this rule in prose since the fields
|
|
78
|
+
* landed, and prose is not a check. The failure it prevents is the worst shape
|
|
79
|
+
* this surface has: the provider ships, the script tag is injected, the composed
|
|
80
|
+
* policy does not admit its origin, and the browser refuses it — in PRODUCTION
|
|
81
|
+
* ONLY, because development is report-only. The provider looks configured, the
|
|
82
|
+
* page looks fine locally, and the capability is simply absent for real users.
|
|
83
|
+
*
|
|
84
|
+
* Absolute rather than conditional on the application's own policy, and that is
|
|
85
|
+
* the point: a provider cannot know whether the application it lands in
|
|
86
|
+
* happens to allow-list its vendor, and relying on that is exactly the
|
|
87
|
+
* hand-editing per app, per service, per environment that declaring a footprint
|
|
88
|
+
* exists to remove. Restating an origin the app would have allowed anyway costs
|
|
89
|
+
* nothing — CSP source lists are a union.
|
|
90
|
+
*
|
|
91
|
+
* Thrown, not reported, and only HERE. This runs where the author is: in the
|
|
92
|
+
* provider package's own `./companion` barrel and in the CLI's discovery walk,
|
|
93
|
+
* so `wildo config sync` fails with the provider, the script and the missing
|
|
94
|
+
* origin named. The backend's fallback projection deliberately does NOT repeat
|
|
95
|
+
* it — refusing there would take an application's boot down for a provider
|
|
96
|
+
* authoring mistake, long after the person who could fix it has gone.
|
|
97
|
+
*/
|
|
98
|
+
function assertDeclaredScriptOriginsAreGranted(module) {
|
|
99
|
+
const declaredScriptOrigins = new Set(module.csp?.scriptOrigins ?? []);
|
|
100
|
+
for (const script of module.scripts ?? []) {
|
|
101
|
+
let origin;
|
|
102
|
+
try {
|
|
103
|
+
origin = new URL(script.src).origin;
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw new Error(`Frontend provider "${module.metadata.ref}" declares a script whose src is not an absolute URL: `
|
|
107
|
+
+ `"${script.src}". A script declaration names a third-party origin, so the framework can neither `
|
|
108
|
+
+ 'resolve it nor grant it in the composed Content-Security-Policy.');
|
|
109
|
+
}
|
|
110
|
+
if (!declaredScriptOrigins.has(origin)) {
|
|
111
|
+
throw new Error(`Frontend provider "${module.metadata.ref}" declares the script "${script.src}" but does not list `
|
|
112
|
+
+ `"${origin}" in csp.scriptOrigins. The policy this provider contributes to would then block its own `
|
|
113
|
+
+ 'script — and only where CSP enforces, so the failure would first appear in production. Add the '
|
|
114
|
+
+ 'origin to the provider\'s csp.scriptOrigins.');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Turns a frontend provider module into the companion contribution tooling
|
|
120
|
+
* reads — the ONE place a facet module becomes a discovery record.
|
|
121
|
+
*
|
|
122
|
+
* Exported because the engine is not the only producer. Every
|
|
123
|
+
* `@wildo-ai/provider-<ref>` package's own `./companion` barrel has to do
|
|
124
|
+
* exactly this for its own facet modules, and a projection each package
|
|
125
|
+
* hand-rolls is a projection that drifts: the DATA half of the frontend
|
|
126
|
+
* surface would end up carried by some packages and dropped by others, and a
|
|
127
|
+
* dropped CSP footprint is invisible until a provider is blocked in production.
|
|
128
|
+
*
|
|
129
|
+
* What crosses and what does not is the whole contract. `csp`, `scripts` and
|
|
130
|
+
* the SDK DESCRIPTOR cross, because tooling has to read them without executing
|
|
131
|
+
* anything — this runs in Node and a facet module is browser-bound. The
|
|
132
|
+
* executable half — `sdk.activate`, `publicConfigSchema` — does NOT, and cannot:
|
|
133
|
+
* the contribution is serialized to JSON on its way into the generated
|
|
134
|
+
* artifact, so a function would be dropped by `JSON.stringify` with no error
|
|
135
|
+
* anywhere. Code reaches a bundle through the generated
|
|
136
|
+
* `frontend-providers.generated.ts` instead.
|
|
137
|
+
*/
|
|
138
|
+
export function projectFrontendProviderContribution(module, serviceType, runtimeImportPath) {
|
|
139
|
+
assertDeclaredScriptOriginsAreGranted(module);
|
|
64
140
|
const frontendEntry = {
|
|
65
141
|
metadata: module.metadata,
|
|
66
142
|
providerCapabilities: [...module.providerCapabilities],
|
|
67
143
|
protocols: [...module.protocols],
|
|
68
144
|
publicConfig: module.publicConfig,
|
|
145
|
+
// The DATA half of the frontend surface (#332). It has to travel with the
|
|
146
|
+
// contribution because the CSP of a service is composed by the CLI, from
|
|
147
|
+
// the materialized artifact, long before any browser loads the module that
|
|
148
|
+
// declares it — and the CLI cannot execute that module to ask.
|
|
149
|
+
// Normalized here, once: a provider AUTHORS the buckets it reaches and the
|
|
150
|
+
// wire carries all of them, so the CSP composer never branches on absence
|
|
151
|
+
// and the hydration join compares two shapes of the same kind.
|
|
152
|
+
csp: module.csp === undefined ? undefined : normalizeProviderFrontendCspFootprint(module.csp),
|
|
153
|
+
scripts: module.scripts === undefined ? undefined : [...module.scripts],
|
|
154
|
+
sdk: module.sdk?.descriptor,
|
|
155
|
+
// The DATA half of each contributed component (#380). `load` is stripped
|
|
156
|
+
// HERE rather than left to `JSON.stringify` to drop it: a function that
|
|
157
|
+
// disappears silently on its way through a serializer is the failure this
|
|
158
|
+
// whole two-channel split exists to remove, and stripping it explicitly is
|
|
159
|
+
// what makes the projection's contract readable at the projection.
|
|
160
|
+
//
|
|
161
|
+
// Rebuilt field by field rather than spread-minus-`load`, so a future field
|
|
162
|
+
// on the declaration is a COMPILE decision about whether it crosses the wire
|
|
163
|
+
// instead of one that crosses by default. `sdk` makes the same choice by
|
|
164
|
+
// naming `descriptor`; this is the same rule where the shape is a map.
|
|
165
|
+
components: projectFrontendComponentDescriptors(module.components),
|
|
166
|
+
// The keys the module's `publicConfigSchema` declares, as DATA (#394 P3).
|
|
167
|
+
// The schema itself is CODE and stays behind; this list is what lets
|
|
168
|
+
// `wildo config sync` refuse an application-supplied key the module never
|
|
169
|
+
// reads, at the moment it is typed rather than when a picker opens.
|
|
170
|
+
publicConfigKeys: readDeclaredPublicConfigKeys(module.publicConfigSchema)?.slice(),
|
|
171
|
+
// The z_file storage the picker fronts (#394 P5) — an enum member, so it
|
|
172
|
+
// crosses the wire as-is; the chooser filters on it and the hydration join
|
|
173
|
+
// compares it to the CODE side.
|
|
174
|
+
fileStorage: module.fileStorage,
|
|
69
175
|
};
|
|
70
176
|
return {
|
|
71
177
|
ref: module.metadata.ref,
|
|
178
|
+
identity: {
|
|
179
|
+
packageName: module.metadata.packageName,
|
|
180
|
+
tier: module.metadata.tier,
|
|
181
|
+
vendor: module.metadata.vendor,
|
|
182
|
+
origin: module.metadata.origin,
|
|
183
|
+
},
|
|
72
184
|
runtimeImportPath,
|
|
73
185
|
runtimeTargets: [{ kind: 'frontendService', serviceType }],
|
|
74
186
|
engineCapabilities: deriveEngineCapabilities(module.providerCapabilities),
|
|
@@ -81,11 +193,11 @@ function projectFrontendModule(module, serviceType, runtimeImportPath) {
|
|
|
81
193
|
};
|
|
82
194
|
}
|
|
83
195
|
/** One contribution per `EngineFrontendAppProviderRegistry` module, targeting `SAAS_APP`. */
|
|
84
|
-
export const engineFrontendAppProviderContributions = Array.from(EngineFrontendAppProviderRegistry.modules.values()).map((module) =>
|
|
196
|
+
export const engineFrontendAppProviderContributions = Array.from(EngineFrontendAppProviderRegistry.modules.values()).map((module) => projectFrontendProviderContribution(module, AppFrontendType.SAAS_APP, APP_RUNTIME_IMPORT_PATH));
|
|
85
197
|
/** One contribution per `EngineFrontendTechdocProviderRegistry` module, targeting `TECH_DOC`. */
|
|
86
|
-
export const engineFrontendTechdocProviderContributions = Array.from(EngineFrontendTechdocProviderRegistry.modules.values()).map((module) =>
|
|
198
|
+
export const engineFrontendTechdocProviderContributions = Array.from(EngineFrontendTechdocProviderRegistry.modules.values()).map((module) => projectFrontendProviderContribution(module, AppFrontendType.TECH_DOC, TECHDOC_RUNTIME_IMPORT_PATH));
|
|
87
199
|
/** One contribution per `EngineFrontendWebsiteProviderRegistry` module, targeting `STATIC_WEBSITE`. */
|
|
88
|
-
export const engineFrontendWebsiteProviderContributions = Array.from(EngineFrontendWebsiteProviderRegistry.modules.values()).map((module) =>
|
|
200
|
+
export const engineFrontendWebsiteProviderContributions = Array.from(EngineFrontendWebsiteProviderRegistry.modules.values()).map((module) => projectFrontendProviderContribution(module, AppFrontendType.STATIC_WEBSITE, WEBSITE_RUNTIME_IMPORT_PATH));
|
|
89
201
|
/** Stable union — order: app providers, then techdoc, then website (matches the registry imports). */
|
|
90
202
|
export const engineFrontendProviderContributions = [
|
|
91
203
|
...engineFrontendAppProviderContributions,
|