@aglyn/aglyn 1.15.0 → 1.15.2
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/package.json +11 -11
- package/src/lib/app-utils/buy-now-pay-later.d.ts +45 -0
- package/src/lib/app-utils/buy-now-pay-later.js +68 -0
- package/src/lib/app-utils/buy-now-pay-later.js.map +1 -0
- package/src/lib/app-utils/contexts.d.ts +1 -0
- package/src/lib/app-utils/contexts.js +1 -0
- package/src/lib/app-utils/contexts.js.map +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js +2 -0
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +3 -3
- package/src/lib/app-utils/docs-help.generated.js +9 -0
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +4 -4
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +127 -75
- package/src/lib/app-utils/plan-entitlements.js +120 -77
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/plugin-bundle-checks.d.ts +14 -2
- package/src/lib/app-utils/plugin-bundle-checks.js +82 -7
- package/src/lib/app-utils/plugin-bundle-checks.js.map +1 -1
- package/src/lib/app-utils/plugin-connection-editor.d.ts +48 -0
- package/src/lib/app-utils/plugin-connection-editor.js +46 -0
- package/src/lib/app-utils/plugin-connection-editor.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-record.d.ts +42 -0
- package/src/lib/app-utils/plugin-connection-record.js +48 -0
- package/src/lib/app-utils/plugin-connection-record.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-records-context.d.ts +23 -0
- package/src/lib/app-utils/plugin-connection-records-context.js +29 -0
- package/src/lib/app-utils/plugin-connection-records-context.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-records.d.ts +42 -0
- package/src/lib/app-utils/plugin-connection-records.js +56 -0
- package/src/lib/app-utils/plugin-connection-records.js.map +1 -0
- package/src/lib/app-utils/plugin-connections.d.ts +320 -0
- package/src/lib/app-utils/plugin-connections.js +895 -0
- package/src/lib/app-utils/plugin-connections.js.map +1 -0
- package/src/lib/app-utils/plugin-elements.d.ts +104 -0
- package/src/lib/app-utils/plugin-elements.js +128 -0
- package/src/lib/app-utils/plugin-elements.js.map +1 -0
- package/src/lib/app-utils/plugin-manifest.d.ts +20 -75
- package/src/lib/app-utils/plugin-manifest.js +65 -100
- package/src/lib/app-utils/plugin-manifest.js.map +1 -1
- package/src/lib/app-utils/realm-elements-context.d.ts +16 -0
- package/src/lib/app-utils/realm-elements-context.js +16 -0
- package/src/lib/app-utils/realm-elements-context.js.map +1 -1
- package/src/lib/app-utils/realm-host-surface.generated.js +1 -0
- package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
- package/src/lib/app-utils/release-flags.d.ts +1 -1
- package/src/lib/app-utils/release-flags.js +11 -0
- package/src/lib/app-utils/release-flags.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +1 -0
- package/src/lib/app-utils/server.js +2 -0
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/plugin-manager/feature-plugins.d.ts +25 -0
- package/src/lib/plugin-manager/feature-plugins.js +10 -0
- package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
- package/src/lib/plugin-manager/first-party-plugins.generated.js +11 -0
- package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
- package/src/lib/plugin-manager/index.d.ts +1 -0
- package/src/lib/plugin-manager/index.js +1 -0
- package/src/lib/plugin-manager/index.js.map +1 -1
- package/src/lib/plugin-manager/plugin-artifact-inventory.d.ts +5 -0
- package/src/lib/plugin-manager/plugin-artifact-inventory.js.map +1 -1
- package/src/lib/plugin-manager/plugin-site-csp.d.ts +36 -0
- package/src/lib/plugin-manager/plugin-site-csp.js +50 -1
- package/src/lib/plugin-manager/plugin-site-csp.js.map +1 -1
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js +61 -59
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
- package/src/lib/plugin-manager/site-page-enricher-services.d.ts +35 -0
- package/src/lib/plugin-manager/site-page-enricher-services.js +35 -0
- package/src/lib/plugin-manager/site-page-enricher-services.js.map +1 -0
- package/src/lib/plugin-manager/site-page-hooks.js +16 -3
- package/src/lib/plugin-manager/site-page-hooks.js.map +1 -1
|
@@ -35,6 +35,7 @@ export * from './plugin-contributions';
|
|
|
35
35
|
export * from './plugin-loader';
|
|
36
36
|
export * from './realm-plugins';
|
|
37
37
|
export * from './site-page-hooks';
|
|
38
|
+
export * from './site-page-enricher-services';
|
|
38
39
|
export * from './site-runtime';
|
|
39
40
|
export * from './feature-plugins';
|
|
40
41
|
export * from './plugin-bridge';
|
|
@@ -37,6 +37,7 @@ export * from "./plugin-contributions.js";
|
|
|
37
37
|
export * from "./plugin-loader.js";
|
|
38
38
|
export * from "./realm-plugins.js";
|
|
39
39
|
export * from "./site-page-hooks.js";
|
|
40
|
+
export * from "./site-page-enricher-services.js";
|
|
40
41
|
export * from "./site-runtime.js";
|
|
41
42
|
export * from "./feature-plugins.js";
|
|
42
43
|
export * from "./plugin-bridge.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { default } from './plugin-manager'\nexport * from './plugin-manager'\nexport * from './billing-webhook-hooks'\nexport * from './custom-fields'\nexport * from './editor-sessions'\nexport * from './enabled-plugins'\nexport * from './install-presets'\nexport * from './plugin-config'\nexport * from './plugin-jobs'\nexport * from './plugin-permissions'\nexport * from './plugin-services'\nexport * from './plugin-resource-drafts'\n// `plugin-figures` is imported by its own path, never from here: it serves\n// server-side readers only, and this barrel is on every published page.\nexport * from './plugin-activity-actions'\nexport * from './plugin-entitlements'\nexport * from './plugin-events'\nexport * from './plugin-user-erasure'\n// `plugin-org-erasure` is server-only too: import it by its own path.\nexport * from './plugin-styles'\nexport * from './plugin-contributions'\nexport * from './plugin-loader'\nexport * from './realm-plugins'\nexport * from './site-page-hooks'\nexport * from './site-runtime'\nexport * from './feature-plugins'\nexport * from './plugin-bridge'\n"],"names":["default"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,OAAO,QAAQ,sBAAkB;AAC1C,cAAc,sBAAkB;AAChC,cAAc,6BAAyB;AACvC,cAAc,qBAAiB;AAC/B,cAAc,uBAAmB;AACjC,cAAc,uBAAmB;AACjC,cAAc,uBAAmB;AACjC,cAAc,qBAAiB;AAC/B,cAAc,mBAAe;AAC7B,cAAc,0BAAsB;AACpC,cAAc,uBAAmB;AACjC,cAAc,8BAA0B;AACxC,2EAA2E;AAC3E,wEAAwE;AACxE,cAAc,+BAA2B;AACzC,cAAc,2BAAuB;AACrC,cAAc,qBAAiB;AAC/B,cAAc,2BAAuB;AACrC,sEAAsE;AACtE,cAAc,qBAAiB;AAC/B,cAAc,4BAAwB;AACtC,cAAc,qBAAiB;AAC/B,cAAc,qBAAiB;AAC/B,cAAc,uBAAmB;AACjC,cAAc,oBAAgB;AAC9B,cAAc,uBAAmB;AACjC,cAAc,qBAAiB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { default } from './plugin-manager'\nexport * from './plugin-manager'\nexport * from './billing-webhook-hooks'\nexport * from './custom-fields'\nexport * from './editor-sessions'\nexport * from './enabled-plugins'\nexport * from './install-presets'\nexport * from './plugin-config'\nexport * from './plugin-jobs'\nexport * from './plugin-permissions'\nexport * from './plugin-services'\nexport * from './plugin-resource-drafts'\n// `plugin-figures` is imported by its own path, never from here: it serves\n// server-side readers only, and this barrel is on every published page.\nexport * from './plugin-activity-actions'\nexport * from './plugin-entitlements'\nexport * from './plugin-events'\nexport * from './plugin-user-erasure'\n// `plugin-org-erasure` is server-only too: import it by its own path.\nexport * from './plugin-styles'\nexport * from './plugin-contributions'\nexport * from './plugin-loader'\nexport * from './realm-plugins'\nexport * from './site-page-hooks'\nexport * from './site-page-enricher-services'\nexport * from './site-runtime'\nexport * from './feature-plugins'\nexport * from './plugin-bridge'\n"],"names":["default"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,OAAO,QAAQ,sBAAkB;AAC1C,cAAc,sBAAkB;AAChC,cAAc,6BAAyB;AACvC,cAAc,qBAAiB;AAC/B,cAAc,uBAAmB;AACjC,cAAc,uBAAmB;AACjC,cAAc,uBAAmB;AACjC,cAAc,qBAAiB;AAC/B,cAAc,mBAAe;AAC7B,cAAc,0BAAsB;AACpC,cAAc,uBAAmB;AACjC,cAAc,8BAA0B;AACxC,2EAA2E;AAC3E,wEAAwE;AACxE,cAAc,+BAA2B;AACzC,cAAc,2BAAuB;AACrC,cAAc,qBAAiB;AAC/B,cAAc,2BAAuB;AACrC,sEAAsE;AACtE,cAAc,qBAAiB;AAC/B,cAAc,4BAAwB;AACtC,cAAc,qBAAiB;AAC/B,cAAc,qBAAiB;AAC/B,cAAc,uBAAmB;AACjC,cAAc,mCAA+B;AAC7C,cAAc,oBAAgB;AAC9B,cAAc,uBAAmB;AACjC,cAAc,qBAAiB"}
|
|
@@ -56,6 +56,11 @@ export interface PluginArtifactVersion extends PluginArtifactClaim {
|
|
|
56
56
|
declaredNetwork: readonly string[];
|
|
57
57
|
/** What the manifest says it contributes, or `null` when it says nothing. */
|
|
58
58
|
declaredContributions: unknown;
|
|
59
|
+
/**
|
|
60
|
+
* The manifest's declared connections (AGL-4193), or `null` when it
|
|
61
|
+
* declares none. Optional so a source written before them still reads.
|
|
62
|
+
*/
|
|
63
|
+
declaredConnections?: unknown;
|
|
59
64
|
/**
|
|
60
65
|
* Caches a fresh verdict on THIS version.
|
|
61
66
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-artifact-inventory.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * WHO CLAIMS THE BYTES IN THE ARTIFACTS BUCKET (AGL-3080).\n *\n * Two scheduled jobs sweep the plugin-artifacts bucket. The reaper deletes\n * every object no stored version claims; the re-verifier re-runs the static\n * checker over the bytes and writes each verdict back. Both are the\n * PLATFORM's jobs — the bucket is platform infrastructure, the object path\n * is the loader's convention, the verifier is the trust lint, and the cron\n * that fires them is the console's. Both also had to read\n * `pluginVersions` and `marketplaceListings` to do it, which is a plugin's\n * storage reached around the plugin, from an `/api/admin` route.\n *\n * So the plugin answers WHAT IT STORES and the console decides what to do\n * about it. The sibling of `core.site-cache` with the direction reversed:\n * there the shell offers a capability down, here the owner of the documents\n * answers a question the shell cannot answer for itself.\n *\n * ## ⛔ AN ABSENT OR PARTIAL INVENTORY REFUSES THE RUN\n *\n * Decide the failure direction first — {@link PLUGIN_ARTIFACT_INVENTORY} and\n * `core.site-cache` look alike and fail opposite ways.\n *\n * Every object the reaper deletes is deleted precisely because nothing\n * claimed it, the bucket has no object versioning, and a claim that was\n * never read looks exactly like a claim that does not exist. An empty answer\n * is therefore the most dangerous answer this contract can give: read as\n * \"nothing is claimed\", it empties the bucket permanently.\n *\n * {@link pluginArtifactClaims} can never hand back an empty list that means\n * \"could not read\". It answers a discriminated result — a caller reading\n * `rows` on a refusal does not compile, which is the point — and nothing\n * registered, a throw, and a walk that hit the caller's own ceiling all\n * arrive as `outcome: 'refused'` with a sentence the run prints.\n *\n * ## `listingId`, and why the word is not minted fresh here\n *\n * The bucket's object path is `artifacts/{listingId}/{version}/{sha}.bundle`\n * and both the serving route and `planArtifactReap` already read it that\n * way. A second vocabulary for the same segment is the defect `e32405cb5`\n * removed from the capacity gates — two names for one thing, kept agreeing\n * by hand — so this contract uses the path's word. A future plugin that\n * stores artifacts inherits a noun that is not about it; renaming the\n * segment everywhere is the honest fix, and it is not this change.\n */\n\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginService,\n} from './plugin-services'\n\n/** A verdict written back onto a stored version by the re-verifier. */\nexport interface PluginArtifactVerdict {\n ok: boolean\n problems: unknown[]\n checks: unknown\n /** The exact bytes the verdict was computed over. */\n sha256: string\n verifierVersion: number\n}\n\n/** What keeps one object in the bucket alive. */\nexport interface PluginArtifactClaim {\n /** The object path's first segment — the owning record's id. */\n listingId: string\n /** The version string, the object path's second segment. */\n version: string\n /** The exact bytes claimed, the object path's third segment. */\n sha256: string\n /**\n * Whether the owning record still exists.\n *\n * FALSE is reported and never reaped: the platform does not cascade a\n * delete into subcollections and an install resolves a version by path, so\n * the bytes of a hard-deleted record are still being loaded by somebody.\n */\n ownerLive: boolean\n}\n\n/** A claim, plus everything the re-verifier needs to judge the bytes. */\nexport interface PluginArtifactVersion extends PluginArtifactClaim {\n /** A name for the run's report; falls back to the id. */\n ownerName: string\n /** The owner's review state as the report prints it, or `'unknown'`. */\n reviewStatus: string\n /** How many installs are on this version, for the regression report. */\n activeInstalls: number\n /** Where a human opens this version, or `''` when there is no page. */\n reviewLink: string\n /** The cached verdict, or `undefined` when nothing has checked these bytes. */\n storedVerdict?: unknown\n /** Origins the version's manifest declares it will reach. */\n declaredNetwork: readonly string[]\n /** What the manifest says it contributes, or `null` when it says nothing. */\n declaredContributions: unknown\n /**\n * Caches a fresh verdict on THIS version.\n *\n * A method on the row rather than a lookup on the source, because the row\n * is where the plugin already holds the document it read — asking it to\n * find the document again by id would be a second query per version, and\n * a version's document id and its `version` field are not guaranteed to be\n * the same string, so the second lookup could write to a sibling document\n * that nothing reads.\n *\n * MAY REJECT, and the caller treats that as a cache miss. The verdict is a\n * cache; the report a person reads has already been computed, and a sweep\n * that stopped at the first write failure would leave the rest of the\n * platform unchecked over one.\n */\n record(verdict: PluginArtifactVerdict): Promise<void>\n}\n\n/**\n * The shape both listings answer with: trusted rows, or a refusal.\n *\n * ⛔ THE DISCRIMINANT IS A STRING, AND IT HAS TO BE. This repo compiles with\n * `strictNullChecks: false` (tsconfig.base.json), and TypeScript does not\n * narrow a BOOLEAN-literal discriminant under it — `if (!answer.complete)`\n * compiles to no narrowing at all, so `answer.reason` is an error and, worse,\n * `answer.rows` stays readable on the refusal branch. That is precisely the\n * misread this contract exists to make impossible, so the flag that carries\n * it is a word.\n */\nexport type PluginArtifactListing<T> =\n | {\n outcome: 'listed'\n rows: readonly T[]\n /** Documents read, for the run's report. */\n scanned: number\n }\n | {\n outcome: 'refused'\n /** Why the answer cannot be trusted, in the words the run prints. */\n reason: string\n /** How far the walk got before it stopped. */\n scanned: number\n }\n\nexport interface PluginArtifactInventorySource {\n /**\n * Every claim on the bucket, completely or not at all.\n *\n * Separate from {@link listVersions} so the reaper can read the two path\n * segments and the hash and leave the manifests on the server. It does not\n * change what is BILLED — storage charges per document either way — but a\n * version document carries its whole manifest, and a weekly sweep of every\n * version on the platform should not drag all of them across the wire.\n *\n * `maxScanned` is the CALLER's refusal threshold, not the walk's page\n * size: past it the answer must be `refused`, because a claim set this run\n * could not finish reading cannot be reaped against.\n */\n listClaims(options: {\n maxScanned: number\n }): Promise<PluginArtifactListing<PluginArtifactClaim>>\n /** Every stored version with what a re-verification needs to judge it. */\n listVersions(options: {\n maxScanned: number\n }): Promise<PluginArtifactListing<PluginArtifactVersion>>\n}\n\n/**\n * One implementation. Two would each answer about their own storage and the\n * reaper would delete what the other one claims — the exact mistake the\n * refusal shape exists to prevent, arriving by a different door.\n */\nexport const PLUGIN_ARTIFACT_INVENTORY =\n definePluginServiceContract<PluginArtifactInventorySource>(\n 'core.plugin-artifact-inventory',\n { multiple: false },\n )\n\n/** Installs the owner of the artifacts bucket's documents. */\nexport function registerPluginArtifactInventory(\n source: PluginArtifactInventorySource,\n options?: { pluginId?: string },\n): void {\n if (\n typeof source?.listClaims !== 'function' ||\n typeof source?.listVersions !== 'function'\n ) {\n throw new Error(\n 'a plugin artifact inventory needs listClaims and listVersions ' +\n 'functions',\n )\n }\n registerPluginService(PLUGIN_ARTIFACT_INVENTORY, source, {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n })\n}\n\n/** Whether anything owns the artifacts bucket on this deployment. */\nexport function hasPluginArtifactInventory(): boolean {\n return Boolean(resolvePluginService(PLUGIN_ARTIFACT_INVENTORY))\n}\n\n/** The refusal both readers answer with when nothing owns the bucket. */\nfunction unowned(): PluginArtifactListing<never> {\n console.error(\n '[artifact-inventory] nothing owns the artifacts bucket, so no run may ' +\n 'conclude that an object is unclaimed. The owning plugin registers ' +\n 'this on the consoleApi surface.',\n )\n return {\n outcome: 'refused',\n reason:\n 'No plugin owns the stored artifacts on this deployment, so nothing ' +\n 'can say which objects are still claimed.',\n scanned: 0,\n }\n}\n\n/** Guards one listing's answer. Never throws; never invents rows. */\nasync function trustedListing<T>(\n read: () => Promise<PluginArtifactListing<T>>,\n): Promise<PluginArtifactListing<T>> {\n try {\n const result = await read()\n // A source that answered `listed` with no rows is a bug in the source,\n // and reaping on it would delete every object in the bucket. Refusing\n // costs a week; the alternative cannot be undone.\n if (result.outcome === 'listed' && !Array.isArray(result.rows)) {\n return {\n outcome: 'refused',\n reason: 'The artifact inventory returned no rows.',\n scanned: 0,\n }\n }\n return result\n } catch (error) {\n console.error('[artifact-inventory] listing failed', error)\n return {\n outcome: 'refused',\n reason: 'The artifact inventory could not be read.',\n scanned: 0,\n }\n }\n}\n\n/**\n * Every claim on the bucket, or why the answer cannot be trusted.\n *\n * NEVER THROWS and never answers an empty list that means \"could not read\" —\n * see the module docblock for what an empty list would cost.\n */\nexport async function pluginArtifactClaims(options: {\n maxScanned: number\n}): Promise<PluginArtifactListing<PluginArtifactClaim>> {\n const source = resolvePluginService(PLUGIN_ARTIFACT_INVENTORY)\n if (!source) return unowned()\n return trustedListing(() => source.listClaims(options))\n}\n\n/** Every stored version with what a re-verification needs to judge it. */\nexport async function pluginArtifactVersions(options: {\n maxScanned: number\n}): Promise<PluginArtifactListing<PluginArtifactVersion>> {\n const source = resolvePluginService(PLUGIN_ARTIFACT_INVENTORY)\n if (!source) return unowned()\n return trustedListing(() => source.listVersions(options))\n}\n"],"names":["definePluginServiceContract","registerPluginService","resolvePluginService","PLUGIN_ARTIFACT_INVENTORY","multiple","registerPluginArtifactInventory","source","options","listClaims","listVersions","Error","pluginId","hasPluginArtifactInventory","Boolean","unowned","console","error","outcome","reason","scanned","trustedListing","read","result","Array","isArray","rows","pluginArtifactClaims","pluginArtifactVersions"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,SACEA,2BAA2B,EAC3BC,qBAAqB,EACrBC,oBAAoB,QACf,uBAAmB;AAiH1B;;;;CAIC,GACD,O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AAI,CAACG,QAAQ,OAAOQ;IACpB,OAAOM,eAAe,IAAMd,OAAOG,YAAY,CAACF;AAClD"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-artifact-inventory.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * WHO CLAIMS THE BYTES IN THE ARTIFACTS BUCKET (AGL-3080).\n *\n * Two scheduled jobs sweep the plugin-artifacts bucket. The reaper deletes\n * every object no stored version claims; the re-verifier re-runs the static\n * checker over the bytes and writes each verdict back. Both are the\n * PLATFORM's jobs — the bucket is platform infrastructure, the object path\n * is the loader's convention, the verifier is the trust lint, and the cron\n * that fires them is the console's. Both also had to read\n * `pluginVersions` and `marketplaceListings` to do it, which is a plugin's\n * storage reached around the plugin, from an `/api/admin` route.\n *\n * So the plugin answers WHAT IT STORES and the console decides what to do\n * about it. The sibling of `core.site-cache` with the direction reversed:\n * there the shell offers a capability down, here the owner of the documents\n * answers a question the shell cannot answer for itself.\n *\n * ## ⛔ AN ABSENT OR PARTIAL INVENTORY REFUSES THE RUN\n *\n * Decide the failure direction first — {@link PLUGIN_ARTIFACT_INVENTORY} and\n * `core.site-cache` look alike and fail opposite ways.\n *\n * Every object the reaper deletes is deleted precisely because nothing\n * claimed it, the bucket has no object versioning, and a claim that was\n * never read looks exactly like a claim that does not exist. An empty answer\n * is therefore the most dangerous answer this contract can give: read as\n * \"nothing is claimed\", it empties the bucket permanently.\n *\n * {@link pluginArtifactClaims} can never hand back an empty list that means\n * \"could not read\". It answers a discriminated result — a caller reading\n * `rows` on a refusal does not compile, which is the point — and nothing\n * registered, a throw, and a walk that hit the caller's own ceiling all\n * arrive as `outcome: 'refused'` with a sentence the run prints.\n *\n * ## `listingId`, and why the word is not minted fresh here\n *\n * The bucket's object path is `artifacts/{listingId}/{version}/{sha}.bundle`\n * and both the serving route and `planArtifactReap` already read it that\n * way. A second vocabulary for the same segment is the defect `e32405cb5`\n * removed from the capacity gates — two names for one thing, kept agreeing\n * by hand — so this contract uses the path's word. A future plugin that\n * stores artifacts inherits a noun that is not about it; renaming the\n * segment everywhere is the honest fix, and it is not this change.\n */\n\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginService,\n} from './plugin-services'\n\n/** A verdict written back onto a stored version by the re-verifier. */\nexport interface PluginArtifactVerdict {\n ok: boolean\n problems: unknown[]\n checks: unknown\n /** The exact bytes the verdict was computed over. */\n sha256: string\n verifierVersion: number\n}\n\n/** What keeps one object in the bucket alive. */\nexport interface PluginArtifactClaim {\n /** The object path's first segment — the owning record's id. */\n listingId: string\n /** The version string, the object path's second segment. */\n version: string\n /** The exact bytes claimed, the object path's third segment. */\n sha256: string\n /**\n * Whether the owning record still exists.\n *\n * FALSE is reported and never reaped: the platform does not cascade a\n * delete into subcollections and an install resolves a version by path, so\n * the bytes of a hard-deleted record are still being loaded by somebody.\n */\n ownerLive: boolean\n}\n\n/** A claim, plus everything the re-verifier needs to judge the bytes. */\nexport interface PluginArtifactVersion extends PluginArtifactClaim {\n /** A name for the run's report; falls back to the id. */\n ownerName: string\n /** The owner's review state as the report prints it, or `'unknown'`. */\n reviewStatus: string\n /** How many installs are on this version, for the regression report. */\n activeInstalls: number\n /** Where a human opens this version, or `''` when there is no page. */\n reviewLink: string\n /** The cached verdict, or `undefined` when nothing has checked these bytes. */\n storedVerdict?: unknown\n /** Origins the version's manifest declares it will reach. */\n declaredNetwork: readonly string[]\n /** What the manifest says it contributes, or `null` when it says nothing. */\n declaredContributions: unknown\n /**\n * The manifest's declared connections (AGL-4193), or `null` when it\n * declares none. Optional so a source written before them still reads.\n */\n declaredConnections?: unknown\n /**\n * Caches a fresh verdict on THIS version.\n *\n * A method on the row rather than a lookup on the source, because the row\n * is where the plugin already holds the document it read — asking it to\n * find the document again by id would be a second query per version, and\n * a version's document id and its `version` field are not guaranteed to be\n * the same string, so the second lookup could write to a sibling document\n * that nothing reads.\n *\n * MAY REJECT, and the caller treats that as a cache miss. The verdict is a\n * cache; the report a person reads has already been computed, and a sweep\n * that stopped at the first write failure would leave the rest of the\n * platform unchecked over one.\n */\n record(verdict: PluginArtifactVerdict): Promise<void>\n}\n\n/**\n * The shape both listings answer with: trusted rows, or a refusal.\n *\n * ⛔ THE DISCRIMINANT IS A STRING, AND IT HAS TO BE. This repo compiles with\n * `strictNullChecks: false` (tsconfig.base.json), and TypeScript does not\n * narrow a BOOLEAN-literal discriminant under it — `if (!answer.complete)`\n * compiles to no narrowing at all, so `answer.reason` is an error and, worse,\n * `answer.rows` stays readable on the refusal branch. That is precisely the\n * misread this contract exists to make impossible, so the flag that carries\n * it is a word.\n */\nexport type PluginArtifactListing<T> =\n | {\n outcome: 'listed'\n rows: readonly T[]\n /** Documents read, for the run's report. */\n scanned: number\n }\n | {\n outcome: 'refused'\n /** Why the answer cannot be trusted, in the words the run prints. */\n reason: string\n /** How far the walk got before it stopped. */\n scanned: number\n }\n\nexport interface PluginArtifactInventorySource {\n /**\n * Every claim on the bucket, completely or not at all.\n *\n * Separate from {@link listVersions} so the reaper can read the two path\n * segments and the hash and leave the manifests on the server. It does not\n * change what is BILLED — storage charges per document either way — but a\n * version document carries its whole manifest, and a weekly sweep of every\n * version on the platform should not drag all of them across the wire.\n *\n * `maxScanned` is the CALLER's refusal threshold, not the walk's page\n * size: past it the answer must be `refused`, because a claim set this run\n * could not finish reading cannot be reaped against.\n */\n listClaims(options: {\n maxScanned: number\n }): Promise<PluginArtifactListing<PluginArtifactClaim>>\n /** Every stored version with what a re-verification needs to judge it. */\n listVersions(options: {\n maxScanned: number\n }): Promise<PluginArtifactListing<PluginArtifactVersion>>\n}\n\n/**\n * One implementation. Two would each answer about their own storage and the\n * reaper would delete what the other one claims — the exact mistake the\n * refusal shape exists to prevent, arriving by a different door.\n */\nexport const PLUGIN_ARTIFACT_INVENTORY =\n definePluginServiceContract<PluginArtifactInventorySource>(\n 'core.plugin-artifact-inventory',\n { multiple: false },\n )\n\n/** Installs the owner of the artifacts bucket's documents. */\nexport function registerPluginArtifactInventory(\n source: PluginArtifactInventorySource,\n options?: { pluginId?: string },\n): void {\n if (\n typeof source?.listClaims !== 'function' ||\n typeof source?.listVersions !== 'function'\n ) {\n throw new Error(\n 'a plugin artifact inventory needs listClaims and listVersions ' +\n 'functions',\n )\n }\n registerPluginService(PLUGIN_ARTIFACT_INVENTORY, source, {\n ...(options?.pluginId ? { pluginId: options.pluginId } : {}),\n })\n}\n\n/** Whether anything owns the artifacts bucket on this deployment. */\nexport function hasPluginArtifactInventory(): boolean {\n return Boolean(resolvePluginService(PLUGIN_ARTIFACT_INVENTORY))\n}\n\n/** The refusal both readers answer with when nothing owns the bucket. */\nfunction unowned(): PluginArtifactListing<never> {\n console.error(\n '[artifact-inventory] nothing owns the artifacts bucket, so no run may ' +\n 'conclude that an object is unclaimed. The owning plugin registers ' +\n 'this on the consoleApi surface.',\n )\n return {\n outcome: 'refused',\n reason:\n 'No plugin owns the stored artifacts on this deployment, so nothing ' +\n 'can say which objects are still claimed.',\n scanned: 0,\n }\n}\n\n/** Guards one listing's answer. Never throws; never invents rows. */\nasync function trustedListing<T>(\n read: () => Promise<PluginArtifactListing<T>>,\n): Promise<PluginArtifactListing<T>> {\n try {\n const result = await read()\n // A source that answered `listed` with no rows is a bug in the source,\n // and reaping on it would delete every object in the bucket. Refusing\n // costs a week; the alternative cannot be undone.\n if (result.outcome === 'listed' && !Array.isArray(result.rows)) {\n return {\n outcome: 'refused',\n reason: 'The artifact inventory returned no rows.',\n scanned: 0,\n }\n }\n return result\n } catch (error) {\n console.error('[artifact-inventory] listing failed', error)\n return {\n outcome: 'refused',\n reason: 'The artifact inventory could not be read.',\n scanned: 0,\n }\n }\n}\n\n/**\n * Every claim on the bucket, or why the answer cannot be trusted.\n *\n * NEVER THROWS and never answers an empty list that means \"could not read\" —\n * see the module docblock for what an empty list would cost.\n */\nexport async function pluginArtifactClaims(options: {\n maxScanned: number\n}): Promise<PluginArtifactListing<PluginArtifactClaim>> {\n const source = resolvePluginService(PLUGIN_ARTIFACT_INVENTORY)\n if (!source) return unowned()\n return trustedListing(() => source.listClaims(options))\n}\n\n/** Every stored version with what a re-verification needs to judge it. */\nexport async function pluginArtifactVersions(options: {\n maxScanned: number\n}): Promise<PluginArtifactListing<PluginArtifactVersion>> {\n const source = resolvePluginService(PLUGIN_ARTIFACT_INVENTORY)\n if (!source) return unowned()\n return trustedListing(() => source.listVersions(options))\n}\n"],"names":["definePluginServiceContract","registerPluginService","resolvePluginService","PLUGIN_ARTIFACT_INVENTORY","multiple","registerPluginArtifactInventory","source","options","listClaims","listVersions","Error","pluginId","hasPluginArtifactInventory","Boolean","unowned","console","error","outcome","reason","scanned","trustedListing","read","result","Array","isArray","rows","pluginArtifactClaims","pluginArtifactVersions"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,SACEA,2BAA2B,EAC3BC,qBAAqB,EACrBC,oBAAoB,QACf,uBAAmB;AAsH1B;;;;CAIC,GACD,OAAO,MAAMC,4BACXH,4BACE,kCACA;IAAEI,UAAU;AAAM,GACnB;AAEH,4DAA4D,GAC5D,OAAO,SAASC,gCACdC,MAAqC,EACrCC,OAA+B;IAE/B,IACE,QAAOD,0BAAAA,OAAQE,UAAU,MAAK,cAC9B,QAAOF,0BAAAA,OAAQG,YAAY,MAAK,YAChC;QACA,MAAM,IAAIC,MACR,mEACE;IAEN;IACAT,sBAAsBE,2BAA2BG,QAAQ,aACnDC,CAAAA,2BAAAA,QAASI,QAAQ,IAAG;QAAEA,UAAUJ,QAAQI,QAAQ;IAAC,IAAI,CAAC;AAE9D;AAEA,mEAAmE,GACnE,OAAO,SAASC;IACd,OAAOC,QAAQX,qBAAqBC;AACtC;AAEA,uEAAuE,GACvE,SAASW;IACPC,QAAQC,KAAK,CACX,2EACE,uEACA;IAEJ,OAAO;QACLC,SAAS;QACTC,QACE,wEACA;QACFC,SAAS;IACX;AACF;AAEA,mEAAmE,GACnE,eAAeC,eACbC,IAA6C;IAE7C,IAAI;QACF,MAAMC,SAAS,MAAMD;QACrB,uEAAuE;QACvE,sEAAsE;QACtE,kDAAkD;QAClD,IAAIC,OAAOL,OAAO,KAAK,YAAY,CAACM,MAAMC,OAAO,CAACF,OAAOG,IAAI,GAAG;YAC9D,OAAO;gBACLR,SAAS;gBACTC,QAAQ;gBACRC,SAAS;YACX;QACF;QACA,OAAOG;IACT,EAAE,OAAON,OAAO;QACdD,QAAQC,KAAK,CAAC,uCAAuCA;QACrD,OAAO;YACLC,SAAS;YACTC,QAAQ;YACRC,SAAS;QACX;IACF;AACF;AAEA;;;;;CAKC,GACD,OAAO,eAAeO,qBAAqBnB,OAE1C;IACC,MAAMD,SAASJ,qBAAqBC;IACpC,IAAI,CAACG,QAAQ,OAAOQ;IACpB,OAAOM,eAAe,IAAMd,OAAOE,UAAU,CAACD;AAChD;AAEA,wEAAwE,GACxE,OAAO,eAAeoB,uBAAuBpB,OAE5C;IACC,MAAMD,SAASJ,qBAAqBC;IACpC,IAAI,CAACG,QAAQ,OAAOQ;IACpB,OAAOM,eAAe,IAAMd,OAAOG,YAAY,CAACF;AAClD"}
|
|
@@ -56,3 +56,39 @@ export declare function pluginSiteCspHostsFor(declaration: PluginSiteCspDeclarat
|
|
|
56
56
|
export declare function pluginSiteCspHosts(enabledPluginIds: readonly string[], settingsByPlugin: Readonly<Record<string, Record<string, unknown> | null | undefined>>, declared?: readonly PluginSiteCspDeclaration[]): Record<PluginSiteCspDirective, string[]>;
|
|
57
57
|
/** The declared plugins among a site's enabled set: the settings worth reading. */
|
|
58
58
|
export declare function pluginSiteCspPluginsToRead(enabledPluginIds: readonly string[], declared?: readonly PluginSiteCspDeclaration[]): string[];
|
|
59
|
+
/**
|
|
60
|
+
* A plugin whose hosts are not known when the platform is built — the
|
|
61
|
+
* marketplace, whose installed plugins each declare the image hosts their
|
|
62
|
+
* elements show (`capabilities.imageHosts`) — answers them per site instead
|
|
63
|
+
* of declaring them in `plugins.config.json`. The verdict asks every source
|
|
64
|
+
* beside the declared plugins above, and the hosts ride the same owner-list
|
|
65
|
+
* parse in `security-origins.js`, so a source can widen a directive only by
|
|
66
|
+
* hosts that parse there, and only on the sites it names them for.
|
|
67
|
+
*/
|
|
68
|
+
export interface PluginSiteCspSource {
|
|
69
|
+
/** The hosts this site needs admitted, by directive; none is `{}`. */
|
|
70
|
+
hosts(input: {
|
|
71
|
+
hostId: string;
|
|
72
|
+
orgId: string | null;
|
|
73
|
+
}): Promise<PluginSiteCspHosts>;
|
|
74
|
+
}
|
|
75
|
+
export declare const PLUGIN_SITE_CSP_SOURCES: import("./plugin-services").PluginServiceContract<PluginSiteCspSource>;
|
|
76
|
+
/**
|
|
77
|
+
* Registers a plugin's per-site host source. The owner is the loader's marker
|
|
78
|
+
* when a register fn is running, else `options.pluginId`; with neither the
|
|
79
|
+
* registration throws.
|
|
80
|
+
*/
|
|
81
|
+
export declare function registerPluginSiteCspSource(source: PluginSiteCspSource, options?: {
|
|
82
|
+
pluginId?: string;
|
|
83
|
+
}): void;
|
|
84
|
+
/**
|
|
85
|
+
* What every registered source answers for one site, by directive,
|
|
86
|
+
* de-duplicated. A source that throws, or answers anything but a list of
|
|
87
|
+
* strings for a directive, adds nothing for it: the policy is never widened
|
|
88
|
+
* by an answer this did not parse, and one source's failure costs only its
|
|
89
|
+
* own hosts.
|
|
90
|
+
*/
|
|
91
|
+
export declare function pluginSiteCspSourceHosts(input: {
|
|
92
|
+
hostId: string;
|
|
93
|
+
orgId: string | null;
|
|
94
|
+
}): Promise<Record<PluginSiteCspDirective, string[]>>;
|
|
@@ -37,7 +37,9 @@
|
|
|
37
37
|
* held to the same parse as an owner's own entries: a bare hostname or one
|
|
38
38
|
* leading `*.`, made `https://`. A `wss://` connection to an admitted host is
|
|
39
39
|
* covered by its `https://` source (CSP Level 3 scheme matching).
|
|
40
|
-
*/ import {
|
|
40
|
+
*/ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
|
|
41
|
+
import { PLUGIN_SITE_CSP_DECLARED } from "./first-party-plugins.generated.js";
|
|
42
|
+
import { definePluginServiceContract, registerPluginService, resolvePluginServices } from "./plugin-services.js";
|
|
41
43
|
/** The directives a plugin may widen; the enforced, owner-widenable ones. */ export const PLUGIN_SITE_CSP_DIRECTIVES = [
|
|
42
44
|
'connect',
|
|
43
45
|
'frame',
|
|
@@ -99,5 +101,52 @@
|
|
|
99
101
|
const enabled = new Set(enabledPluginIds);
|
|
100
102
|
return declared.map((declaration)=>declaration.pluginId).filter((pluginId)=>enabled.has(pluginId));
|
|
101
103
|
}
|
|
104
|
+
export const PLUGIN_SITE_CSP_SOURCES = definePluginServiceContract('core.site-csp-source', {
|
|
105
|
+
multiple: true
|
|
106
|
+
});
|
|
107
|
+
/**
|
|
108
|
+
* Registers a plugin's per-site host source. The owner is the loader's marker
|
|
109
|
+
* when a register fn is running, else `options.pluginId`; with neither the
|
|
110
|
+
* registration throws.
|
|
111
|
+
*/ export function registerPluginSiteCspSource(source, options) {
|
|
112
|
+
var _ref, _getRegisteringPluginId;
|
|
113
|
+
const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
|
|
114
|
+
if (!pluginId) throw new Error('a site CSP source was registered with no owner');
|
|
115
|
+
registerPluginService(PLUGIN_SITE_CSP_SOURCES, source, {
|
|
116
|
+
pluginId
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* What every registered source answers for one site, by directive,
|
|
121
|
+
* de-duplicated. A source that throws, or answers anything but a list of
|
|
122
|
+
* strings for a directive, adds nothing for it: the policy is never widened
|
|
123
|
+
* by an answer this did not parse, and one source's failure costs only its
|
|
124
|
+
* own hosts.
|
|
125
|
+
*/ export async function pluginSiteCspSourceHosts(input) {
|
|
126
|
+
const out = Object.fromEntries(PLUGIN_SITE_CSP_DIRECTIVES.map((directive)=>[
|
|
127
|
+
directive,
|
|
128
|
+
[]
|
|
129
|
+
]));
|
|
130
|
+
const sources = resolvePluginServices(PLUGIN_SITE_CSP_SOURCES);
|
|
131
|
+
if (!sources.length) return out;
|
|
132
|
+
const answers = await Promise.all(sources.map(async ({ pluginId, impl })=>{
|
|
133
|
+
try {
|
|
134
|
+
return await impl.hosts(input);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
console.error(`site CSP source of "${pluginId}" failed`, error);
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
139
|
+
}));
|
|
140
|
+
for (const answer of answers){
|
|
141
|
+
for (const directive of PLUGIN_SITE_CSP_DIRECTIVES){
|
|
142
|
+
const hosts = answer == null ? void 0 : answer[directive];
|
|
143
|
+
if (!Array.isArray(hosts)) continue;
|
|
144
|
+
for (const host of hosts){
|
|
145
|
+
if (typeof host === 'string' && !out[directive].includes(host)) out[directive].push(host);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
102
151
|
|
|
103
152
|
//# sourceMappingURL=plugin-site-csp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-csp.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * WHAT A PLUGIN'S SITE FEATURE NEEDS THE PUBLISHED PAGE'S POLICY TO ADMIT\n * (AGL-3698).\n *\n * The tenant enforces `connect-src`, `frame-src`, `img-src`, `media-src` and\n * `font-src` (AGL-1152). A plugin that loads a vendor's widget on a site —\n * the merchant's own live chat is the first — needs that vendor's hosts in\n * those directives, and only on the sites that switched the feature on:\n * pinning them for every site would make every published page's policy\n * describe a vendor most of them never load.\n *\n * So a plugin DECLARES the hosts in `plugins.config.json` (`siteCsp`), keyed\n * by the value of one field of its site settings document\n * (`hosts/{hostId}/pluginSettings/{pluginId}`), and switched by another. The\n * generator compiles the declaration into `first-party-plugins.generated.ts`,\n * and the tenant's lockdown verdict — the route that already hands the\n * middleware every per-site list — reads the settings document of each\n * declared plugin the site runs and adds the chosen variant's hosts. Core\n * names no vendor and no plugin.\n *\n * The hosts ride the owner-list path in `security-origins.js`, so they are\n * held to the same parse as an owner's own entries: a bare hostname or one\n * leading `*.`, made `https://`. A `wss://` connection to an admitted host is\n * covered by its `https://` source (CSP Level 3 scheme matching).\n */\n\nimport { PLUGIN_SITE_CSP_DECLARED } from './first-party-plugins.generated'\n\n/** The directives a plugin may widen; the enforced, owner-widenable ones. */\nexport const PLUGIN_SITE_CSP_DIRECTIVES = [\n 'connect',\n 'frame',\n 'img',\n 'media',\n 'font',\n] as const\n\nexport type PluginSiteCspDirective = (typeof PLUGIN_SITE_CSP_DIRECTIVES)[number]\n\nexport type PluginSiteCspHosts = Partial<\n Record<PluginSiteCspDirective, readonly string[]>\n>\n\n/** One plugin's declaration, as the generator compiles it. */\nexport interface PluginSiteCspDeclaration {\n pluginId: string\n /** The settings field that must be exactly `true` for anything to be admitted. */\n switchField: string\n /**\n * The settings field whose value names the variant. Absent for a plugin\n * with one set of hosts, which declares a single `default` variant.\n */\n variantField?: string\n /** A settings field that must hold a non-empty string, or nothing loads. */\n requiredField?: string\n /** The hosts each variant needs, by directive. */\n variants: Readonly<Record<string, PluginSiteCspHosts>>\n}\n\n/** Every first-party declaration, compiled from `plugins.config.json`. */\nexport function pluginSiteCspDeclarations(): readonly PluginSiteCspDeclaration[] {\n return PLUGIN_SITE_CSP_DECLARED\n}\n\n/**\n * The hosts one plugin's stored settings admit, or none.\n *\n * Fails CLOSED on every malformed input: a switch that is not exactly `true`,\n * an unknown variant, an empty required field. The settings document is\n * written through the plugin's own route, but a reader of a policy input\n * trusts nothing it did not parse.\n */\nexport function pluginSiteCspHostsFor(\n declaration: PluginSiteCspDeclaration,\n settings: Record<string, unknown> | null | undefined,\n): PluginSiteCspHosts {\n if (!settings || settings[declaration.switchField] !== true) return {}\n if (declaration.requiredField) {\n const required = settings[declaration.requiredField]\n if (typeof required !== 'string' || !required.trim()) return {}\n }\n const variant = declaration.variantField\n ? settings[declaration.variantField]\n : 'default'\n if (typeof variant !== 'string') return {}\n if (!Object.prototype.hasOwnProperty.call(declaration.variants, variant)) {\n return {}\n }\n return declaration.variants[variant] ?? {}\n}\n\n/**\n * The union of what every declared plugin the site runs admits, by\n * directive, de-duplicated and in declaration order.\n *\n * `settingsByPlugin` holds the stored settings document of each plugin the\n * caller read; a plugin missing from `enabledPluginIds` admits nothing even\n * when its settings are present, because a switched-off plugin loads nothing\n * on the page.\n */\nexport function pluginSiteCspHosts(\n enabledPluginIds: readonly string[],\n settingsByPlugin: Readonly<Record<string, Record<string, unknown> | null | undefined>>,\n declared: readonly PluginSiteCspDeclaration[] = PLUGIN_SITE_CSP_DECLARED,\n): Record<PluginSiteCspDirective, string[]> {\n const out = Object.fromEntries(\n PLUGIN_SITE_CSP_DIRECTIVES.map((directive) => [directive, [] as string[]]),\n ) as Record<PluginSiteCspDirective, string[]>\n const enabled = new Set(enabledPluginIds)\n for (const declaration of declared) {\n if (!enabled.has(declaration.pluginId)) continue\n const hosts = pluginSiteCspHostsFor(\n declaration,\n settingsByPlugin[declaration.pluginId],\n )\n for (const directive of PLUGIN_SITE_CSP_DIRECTIVES) {\n for (const host of hosts[directive] ?? []) {\n if (!out[directive].includes(host)) out[directive].push(host)\n }\n }\n }\n return out\n}\n\n/** The declared plugins among a site's enabled set: the settings worth reading. */\nexport function pluginSiteCspPluginsToRead(\n enabledPluginIds: readonly string[],\n declared: readonly PluginSiteCspDeclaration[] = PLUGIN_SITE_CSP_DECLARED,\n): string[] {\n const enabled = new Set(enabledPluginIds)\n return declared\n .map((declaration) => declaration.pluginId)\n .filter((pluginId) => enabled.has(pluginId))\n}\n"],"names":["PLUGIN_SITE_CSP_DECLARED","PLUGIN_SITE_CSP_DIRECTIVES","pluginSiteCspDeclarations","pluginSiteCspHostsFor","declaration","settings","switchField","requiredField","required","trim","variant","variantField","Object","prototype","hasOwnProperty","call","variants","pluginSiteCspHosts","enabledPluginIds","settingsByPlugin","declared","out","fromEntries","map","directive","enabled","Set","has","pluginId","hosts","host","includes","push","pluginSiteCspPluginsToRead","filter"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GAED,SAASA,wBAAwB,QAAQ,qCAAiC;AAE1E,2EAA2E,GAC3E,OAAO,MAAMC,6BAA6B;IACxC;IACA;IACA;IACA;IACA;CACD,CAAS;AAwBV,wEAAwE,GACxE,OAAO,SAASC;IACd,OAAOF;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASG,sBACdC,WAAqC,EACrCC,QAAoD;QAc7CD;IAZP,IAAI,CAACC,YAAYA,QAAQ,CAACD,YAAYE,WAAW,CAAC,KAAK,MAAM,OAAO,CAAC;IACrE,IAAIF,YAAYG,aAAa,EAAE;QAC7B,MAAMC,WAAWH,QAAQ,CAACD,YAAYG,aAAa,CAAC;QACpD,IAAI,OAAOC,aAAa,YAAY,CAACA,SAASC,IAAI,IAAI,OAAO,CAAC;IAChE;IACA,MAAMC,UAAUN,YAAYO,YA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ugin-site-csp.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * WHAT A PLUGIN'S SITE FEATURE NEEDS THE PUBLISHED PAGE'S POLICY TO ADMIT\n * (AGL-3698).\n *\n * The tenant enforces `connect-src`, `frame-src`, `img-src`, `media-src` and\n * `font-src` (AGL-1152). A plugin that loads a vendor's widget on a site —\n * the merchant's own live chat is the first — needs that vendor's hosts in\n * those directives, and only on the sites that switched the feature on:\n * pinning them for every site would make every published page's policy\n * describe a vendor most of them never load.\n *\n * So a plugin DECLARES the hosts in `plugins.config.json` (`siteCsp`), keyed\n * by the value of one field of its site settings document\n * (`hosts/{hostId}/pluginSettings/{pluginId}`), and switched by another. The\n * generator compiles the declaration into `first-party-plugins.generated.ts`,\n * and the tenant's lockdown verdict — the route that already hands the\n * middleware every per-site list — reads the settings document of each\n * declared plugin the site runs and adds the chosen variant's hosts. Core\n * names no vendor and no plugin.\n *\n * The hosts ride the owner-list path in `security-origins.js`, so they are\n * held to the same parse as an owner's own entries: a bare hostname or one\n * leading `*.`, made `https://`. A `wss://` connection to an admitted host is\n * covered by its `https://` source (CSP Level 3 scheme matching).\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { PLUGIN_SITE_CSP_DECLARED } from './first-party-plugins.generated'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginServices,\n} from './plugin-services'\n\n/** The directives a plugin may widen; the enforced, owner-widenable ones. */\nexport const PLUGIN_SITE_CSP_DIRECTIVES = [\n 'connect',\n 'frame',\n 'img',\n 'media',\n 'font',\n] as const\n\nexport type PluginSiteCspDirective = (typeof PLUGIN_SITE_CSP_DIRECTIVES)[number]\n\nexport type PluginSiteCspHosts = Partial<\n Record<PluginSiteCspDirective, readonly string[]>\n>\n\n/** One plugin's declaration, as the generator compiles it. */\nexport interface PluginSiteCspDeclaration {\n pluginId: string\n /** The settings field that must be exactly `true` for anything to be admitted. */\n switchField: string\n /**\n * The settings field whose value names the variant. Absent for a plugin\n * with one set of hosts, which declares a single `default` variant.\n */\n variantField?: string\n /** A settings field that must hold a non-empty string, or nothing loads. */\n requiredField?: string\n /** The hosts each variant needs, by directive. */\n variants: Readonly<Record<string, PluginSiteCspHosts>>\n}\n\n/** Every first-party declaration, compiled from `plugins.config.json`. */\nexport function pluginSiteCspDeclarations(): readonly PluginSiteCspDeclaration[] {\n return PLUGIN_SITE_CSP_DECLARED\n}\n\n/**\n * The hosts one plugin's stored settings admit, or none.\n *\n * Fails CLOSED on every malformed input: a switch that is not exactly `true`,\n * an unknown variant, an empty required field. The settings document is\n * written through the plugin's own route, but a reader of a policy input\n * trusts nothing it did not parse.\n */\nexport function pluginSiteCspHostsFor(\n declaration: PluginSiteCspDeclaration,\n settings: Record<string, unknown> | null | undefined,\n): PluginSiteCspHosts {\n if (!settings || settings[declaration.switchField] !== true) return {}\n if (declaration.requiredField) {\n const required = settings[declaration.requiredField]\n if (typeof required !== 'string' || !required.trim()) return {}\n }\n const variant = declaration.variantField\n ? settings[declaration.variantField]\n : 'default'\n if (typeof variant !== 'string') return {}\n if (!Object.prototype.hasOwnProperty.call(declaration.variants, variant)) {\n return {}\n }\n return declaration.variants[variant] ?? {}\n}\n\n/**\n * The union of what every declared plugin the site runs admits, by\n * directive, de-duplicated and in declaration order.\n *\n * `settingsByPlugin` holds the stored settings document of each plugin the\n * caller read; a plugin missing from `enabledPluginIds` admits nothing even\n * when its settings are present, because a switched-off plugin loads nothing\n * on the page.\n */\nexport function pluginSiteCspHosts(\n enabledPluginIds: readonly string[],\n settingsByPlugin: Readonly<Record<string, Record<string, unknown> | null | undefined>>,\n declared: readonly PluginSiteCspDeclaration[] = PLUGIN_SITE_CSP_DECLARED,\n): Record<PluginSiteCspDirective, string[]> {\n const out = Object.fromEntries(\n PLUGIN_SITE_CSP_DIRECTIVES.map((directive) => [directive, [] as string[]]),\n ) as Record<PluginSiteCspDirective, string[]>\n const enabled = new Set(enabledPluginIds)\n for (const declaration of declared) {\n if (!enabled.has(declaration.pluginId)) continue\n const hosts = pluginSiteCspHostsFor(\n declaration,\n settingsByPlugin[declaration.pluginId],\n )\n for (const directive of PLUGIN_SITE_CSP_DIRECTIVES) {\n for (const host of hosts[directive] ?? []) {\n if (!out[directive].includes(host)) out[directive].push(host)\n }\n }\n }\n return out\n}\n\n/** The declared plugins among a site's enabled set: the settings worth reading. */\nexport function pluginSiteCspPluginsToRead(\n enabledPluginIds: readonly string[],\n declared: readonly PluginSiteCspDeclaration[] = PLUGIN_SITE_CSP_DECLARED,\n): string[] {\n const enabled = new Set(enabledPluginIds)\n return declared\n .map((declaration) => declaration.pluginId)\n .filter((pluginId) => enabled.has(pluginId))\n}\n\n/* ------------------------------------------------------------------ */\n/* Hosts a plugin answers per site at request time (AGL-4195) */\n/* ------------------------------------------------------------------ */\n\n/**\n * A plugin whose hosts are not known when the platform is built — the\n * marketplace, whose installed plugins each declare the image hosts their\n * elements show (`capabilities.imageHosts`) — answers them per site instead\n * of declaring them in `plugins.config.json`. The verdict asks every source\n * beside the declared plugins above, and the hosts ride the same owner-list\n * parse in `security-origins.js`, so a source can widen a directive only by\n * hosts that parse there, and only on the sites it names them for.\n */\nexport interface PluginSiteCspSource {\n /** The hosts this site needs admitted, by directive; none is `{}`. */\n hosts(input: { hostId: string; orgId: string | null }): Promise<PluginSiteCspHosts>\n}\n\nexport const PLUGIN_SITE_CSP_SOURCES = definePluginServiceContract<PluginSiteCspSource>(\n 'core.site-csp-source',\n { multiple: true },\n)\n\n/**\n * Registers a plugin's per-site host source. The owner is the loader's marker\n * when a register fn is running, else `options.pluginId`; with neither the\n * registration throws.\n */\nexport function registerPluginSiteCspSource(\n source: PluginSiteCspSource,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) throw new Error('a site CSP source was registered with no owner')\n registerPluginService(PLUGIN_SITE_CSP_SOURCES, source, { pluginId })\n}\n\n/**\n * What every registered source answers for one site, by directive,\n * de-duplicated. A source that throws, or answers anything but a list of\n * strings for a directive, adds nothing for it: the policy is never widened\n * by an answer this did not parse, and one source's failure costs only its\n * own hosts.\n */\nexport async function pluginSiteCspSourceHosts(input: {\n hostId: string\n orgId: string | null\n}): Promise<Record<PluginSiteCspDirective, string[]>> {\n const out = Object.fromEntries(\n PLUGIN_SITE_CSP_DIRECTIVES.map((directive) => [directive, [] as string[]]),\n ) as Record<PluginSiteCspDirective, string[]>\n const sources = resolvePluginServices(PLUGIN_SITE_CSP_SOURCES)\n if (!sources.length) return out\n const answers = await Promise.all(\n sources.map(async ({ pluginId, impl }) => {\n try {\n return await impl.hosts(input)\n } catch (error) {\n console.error(`site CSP source of \"${pluginId}\" failed`, error)\n return {}\n }\n }),\n )\n for (const answer of answers) {\n for (const directive of PLUGIN_SITE_CSP_DIRECTIVES) {\n const hosts = (answer as PluginSiteCspHosts | null | undefined)?.[directive]\n if (!Array.isArray(hosts)) continue\n for (const host of hosts) {\n if (typeof host === 'string' && !out[directive].includes(host)) out[directive].push(host)\n }\n }\n }\n return out\n}\n"],"names":["getRegisteringPluginId","PLUGIN_SITE_CSP_DECLARED","definePluginServiceContract","registerPluginService","resolvePluginServices","PLUGIN_SITE_CSP_DIRECTIVES","pluginSiteCspDeclarations","pluginSiteCspHostsFor","declaration","settings","switchField","requiredField","required","trim","variant","variantField","Object","prototype","hasOwnProperty","call","variants","pluginSiteCspHosts","enabledPluginIds","settingsByPlugin","declared","out","fromEntries","map","directive","enabled","Set","has","pluginId","hosts","host","includes","push","pluginSiteCspPluginsToRead","filter","PLUGIN_SITE_CSP_SOURCES","multiple","registerPluginSiteCspSource","source","options","Error","pluginSiteCspSourceHosts","input","sources","length","answers","Promise","all","impl","error","console","answer","Array","isArray"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GAED,SAASA,sBAAsB,QAAQ,qCAAiC;AACxE,SAASC,wBAAwB,QAAQ,qCAAiC;AAC1E,SACEC,2BAA2B,EAC3BC,qBAAqB,EACrBC,qBAAqB,QAChB,uBAAmB;AAE1B,2EAA2E,GAC3E,OAAO,MAAMC,6BAA6B;IACxC;IACA;IACA;IACA;IACA;CACD,CAAS;AAwBV,wEAAwE,GACxE,OAAO,SAASC;IACd,OAAOL;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASM,sBACdC,WAAqC,EACrCC,QAAoD;QAc7CD;IAZP,IAAI,CAACC,YAAYA,QAAQ,CAACD,YAAYE,WAAW,CAAC,KAAK,MAAM,OAAO,CAAC;IACrE,IAAIF,YAAYG,aAAa,EAAE;QAC7B,MAAMC,WAAWH,QAAQ,CAACD,YAAYG,aAAa,CAAC;QACpD,IAAI,OAAOC,aAAa,YAAY,CAACA,SAASC,IAAI,IAAI,OAAO,CAAC;IAChE;IACA,MAAMC,UAAUN,YAAYO,YAAY,GACpCN,QAAQ,CAACD,YAAYO,YAAY,CAAC,GAClC;IACJ,IAAI,OAAOD,YAAY,UAAU,OAAO,CAAC;IACzC,IAAI,CAACE,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACX,YAAYY,QAAQ,EAAEN,UAAU;QACxE,OAAO,CAAC;IACV;IACA,QAAON,gCAAAA,YAAYY,QAAQ,CAACN,QAAQ,YAA7BN,gCAAiC,CAAC;AAC3C;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASa,mBACdC,gBAAmC,EACnCC,gBAAsF,EACtFC,WAAgDvB,wBAAwB;IAExE,MAAMwB,MAAMT,OAAOU,WAAW,CAC5BrB,2BAA2BsB,GAAG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YAACA;YAAW,EAAE;SAAa;IAE3E,MAAMmB,UAAU3C,sBAAsBmC;IACtC,IAAI,CAACQ,QAAQC,MAAM,EAAE,OAAOvB;IAC5B,MAAMwB,UAAU,MAAMC,QAAQC,GAAG,CAC/BJ,QAAQpB,GAAG,CAAC,OAAO,EAAEK,QAAQ,EAAEoB,IAAI,EAAE;QACnC,IAAI;YACF,OAAO,MAAMA,KAAKnB,KAAK,CAACa;QAC1B,EAAE,OAAOO,OAAO;YACdC,QAAQD,KAAK,CAAC,CAAC,oBAAoB,EAAErB,SAAS,QAAQ,CAAC,EAAEqB;YACzD,OAAO,CAAC;QACV;IACF;IAEF,KAAK,MAAME,UAAUN,QAAS;QAC5B,KAAK,MAAMrB,aAAavB,2BAA4B;YAClD,MAAM4B,QAASsB,0BAAD,AAACA,MAAkD,CAAC3B,UAAU;YAC5E,IAAI,CAAC4B,MAAMC,OAAO,CAACxB,QAAQ;YAC3B,KAAK,MAAMC,QAAQD,MAAO;gBACxB,IAAI,OAAOC,SAAS,YAAY,CAACT,GAAG,CAACG,UAAU,CAACO,QAAQ,CAACD,OAAOT,GAAG,CAACG,UAAU,CAACQ,IAAI,CAACF;YACtF;QACF;IACF;IACA,OAAOT;AACT"}
|
|
@@ -9,14 +9,15 @@ import * as m1 from "../app-utils/binding-tokens.js";
|
|
|
9
9
|
import * as m2 from "../app-utils/enabled-plugins-context.js";
|
|
10
10
|
import * as m3 from "../app-utils/functions.js";
|
|
11
11
|
import * as m4 from "../app-utils/node-identity.js";
|
|
12
|
-
import * as m5 from "../app-utils/
|
|
13
|
-
import * as m6 from "../app-utils/
|
|
14
|
-
import * as m7 from "../app-utils/
|
|
15
|
-
import * as m8 from "../
|
|
16
|
-
import * as m9 from "../foundation/constants/
|
|
17
|
-
import * as m10 from "../foundation/
|
|
18
|
-
import * as m11 from "
|
|
19
|
-
import * as m12 from "
|
|
12
|
+
import * as m5 from "../app-utils/plugin-connection-record.js";
|
|
13
|
+
import * as m6 from "../app-utils/screen-link-context-value.js";
|
|
14
|
+
import * as m7 from "../app-utils/site-context.js";
|
|
15
|
+
import * as m8 from "../app-utils/variables.js";
|
|
16
|
+
import * as m9 from "../foundation/constants/components.js";
|
|
17
|
+
import * as m10 from "../foundation/constants/shared.js";
|
|
18
|
+
import * as m11 from "../foundation/definitions/components.types.js";
|
|
19
|
+
import * as m12 from "./feature-plugins.js";
|
|
20
|
+
import * as m13 from "../types/nodes.js";
|
|
20
21
|
export const AGLYN_HOST_SURFACE = Object.freeze({
|
|
21
22
|
Aglyn: m0.Aglyn,
|
|
22
23
|
aglyn: m0.aglyn,
|
|
@@ -56,57 +57,58 @@ export const AGLYN_HOST_SURFACE = Object.freeze({
|
|
|
56
57
|
parseFunctionParameterOptions: m3.parseFunctionParameterOptions,
|
|
57
58
|
NodeIdentityContext: m4.NodeIdentityContext,
|
|
58
59
|
useNodeId: m4.useNodeId,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
60
|
+
usePluginConnectionRecord: m5.usePluginConnectionRecord,
|
|
61
|
+
ScreenLinkContext: m6.ScreenLinkContext,
|
|
62
|
+
PREVIEW_REFUSED_STATUS: m7.PREVIEW_REFUSED_STATUS,
|
|
63
|
+
PREVIEW_WRITE_BLOCKED_EVENT: m7.PREVIEW_WRITE_BLOCKED_EVENT,
|
|
64
|
+
SiteContext: m7.SiteContext,
|
|
65
|
+
isPreviewRefusal: m7.isPreviewRefusal,
|
|
66
|
+
useSite: m7.useSite,
|
|
67
|
+
useSiteFetch: m7.useSiteFetch,
|
|
68
|
+
HOST_VARIABLE_TYPE_LABELS: m8.HOST_VARIABLE_TYPE_LABELS,
|
|
69
|
+
VARIABLE_NAME_PATTERN: m8.VARIABLE_NAME_PATTERN,
|
|
70
|
+
attachFunctionDefinitions: m8.attachFunctionDefinitions,
|
|
71
|
+
formatVariableValue: m8.formatVariableValue,
|
|
72
|
+
functionGlobals: m8.functionGlobals,
|
|
73
|
+
hasBindings: m8.hasBindings,
|
|
74
|
+
isVariableName: m8.isVariableName,
|
|
75
|
+
resolveBindings: m8.resolveBindings,
|
|
76
|
+
resolveNodesBindings: m8.resolveNodesBindings,
|
|
77
|
+
COMPONENT_CATEGORY_ORDER: m9.COMPONENT_CATEGORY_ORDER,
|
|
78
|
+
ComponentCategory: m9.ComponentCategory,
|
|
79
|
+
REUSABLE_COMPONENT_CATEGORY: m9.REUSABLE_COMPONENT_CATEGORY,
|
|
80
|
+
REUSABLE_EMAIL_BLOCK_CATEGORY: m9.REUSABLE_EMAIL_BLOCK_CATEGORY,
|
|
81
|
+
FEATURE_FLAG: m10.FEATURE_FLAG,
|
|
82
|
+
RICH_TEXT_COMMANDS: m10.RICH_TEXT_COMMANDS,
|
|
83
|
+
FieldComponentType: m11.FieldComponentType,
|
|
84
|
+
FieldValidatorType: m11.FieldValidatorType,
|
|
85
|
+
LinealDirectiveFlag: m11.LinealDirectiveFlag,
|
|
86
|
+
CONSOLE_HOST_GATED_WIDGET_SLOTS: m12.CONSOLE_HOST_GATED_WIDGET_SLOTS,
|
|
87
|
+
CONSOLE_SEARCH_LOAD_POINT: m12.CONSOLE_SEARCH_LOAD_POINT,
|
|
88
|
+
CONSOLE_STAFF_WIDGET_SLOTS: m12.CONSOLE_STAFF_WIDGET_SLOTS,
|
|
89
|
+
CONSOLE_WIDGET_SLOTS: m12.CONSOLE_WIDGET_SLOTS,
|
|
90
|
+
MUI_BUNDLE_ID: m12.MUI_BUNDLE_ID,
|
|
91
|
+
THEME_PRESETS_LOAD_POINT: m12.THEME_PRESETS_LOAD_POINT,
|
|
92
|
+
defineUiFeatureBundle: m12.defineUiFeatureBundle,
|
|
93
|
+
isConsoleHostGatedWidgetSlot: m12.isConsoleHostGatedWidgetSlot,
|
|
94
|
+
isConsoleStaffWidgetSlot: m12.isConsoleStaffWidgetSlot,
|
|
95
|
+
listConsoleExtensions: m12.listConsoleExtensions,
|
|
96
|
+
listConsoleNavItems: m12.listConsoleNavItems,
|
|
97
|
+
listConsoleOrgNavItems: m12.listConsoleOrgNavItems,
|
|
98
|
+
listConsoleProviders: m12.listConsoleProviders,
|
|
99
|
+
listConsolePublicPages: m12.listConsolePublicPages,
|
|
100
|
+
listConsoleSearchSources: m12.listConsoleSearchSources,
|
|
101
|
+
listConsoleStaffPages: m12.listConsoleStaffPages,
|
|
102
|
+
listConsoleThemePresets: m12.listConsoleThemePresets,
|
|
103
|
+
listConsoleWidgets: m12.listConsoleWidgets,
|
|
104
|
+
normalizeConsolePublicPath: m12.normalizeConsolePublicPath,
|
|
105
|
+
registerConsoleExtension: m12.registerConsoleExtension,
|
|
106
|
+
resolveConsoleOrgPluginPage: m12.resolveConsoleOrgPluginPage,
|
|
107
|
+
resolveConsolePluginPage: m12.resolveConsolePluginPage,
|
|
108
|
+
resolveConsolePublicPage: m12.resolveConsolePublicPage,
|
|
109
|
+
resolveConsoleStaffPage: m12.resolveConsoleStaffPage,
|
|
110
|
+
unregisterConsoleExtension: m12.unregisterConsoleExtension,
|
|
111
|
+
NodeType: m13.NodeType
|
|
110
112
|
});
|
|
111
113
|
|
|
112
114
|
//# sourceMappingURL=realm-host-aglyn.generated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/realm-host-aglyn.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-realm-host-exports.mjs\n *\n * The realm plugin surface of `@aglyn/aglyn` (AGL-3392): what a signed\n * bundle reads from core. Imported only by the lazily loaded host module.\n */\n/* eslint-disable */\n\nimport * as m0 from \"../aglyn\"\nimport * as m1 from \"../app-utils/binding-tokens\"\nimport * as m2 from \"../app-utils/enabled-plugins-context\"\nimport * as m3 from \"../app-utils/functions\"\nimport * as m4 from \"../app-utils/node-identity\"\nimport * as m5 from \"../app-utils/screen-link-context-value\"\nimport * as m6 from \"../app-utils/site-context\"\nimport * as m7 from \"../app-utils/variables\"\nimport * as m8 from \"../foundation/constants/components\"\nimport * as m9 from \"../foundation/constants/shared\"\nimport * as m10 from \"../foundation/definitions/components.types\"\nimport * as m11 from \"./feature-plugins\"\nimport * as m12 from \"../types/nodes\"\n\nexport const AGLYN_HOST_SURFACE: Readonly<Record<string, unknown>> = Object.freeze({\n Aglyn: m0.Aglyn,\n aglyn: m0.aglyn,\n canvas: m0.canvas,\n components: m0.components,\n emitter: m0.emitter,\n logger: m0.logger,\n plugins: m0.plugins,\n FUNCTION_TOKEN_PATTERN: m1.FUNCTION_TOKEN_PATTERN,\n MISSING_BINDING_LABEL: m1.MISSING_BINDING_LABEL,\n NAME_TOKEN_PATTERN: m1.NAME_TOKEN_PATTERN,\n VARIABLE_ID_TOKEN_PATTERN: m1.VARIABLE_ID_TOKEN_PATTERN,\n bindingTokenNeedsDeep: m1.bindingTokenNeedsDeep,\n displayBindingTokens: m1.displayBindingTokens,\n editableBindingTokens: m1.editableBindingTokens,\n formatFunctionIdToken: m1.formatFunctionIdToken,\n formatVariableIdToken: m1.formatVariableIdToken,\n keyById: m1.keyById,\n nodesReferenceBinding: m1.nodesReferenceBinding,\n normalizeBindingTokens: m1.normalizeBindingTokens,\n rewriteBindingTokensDeep: m1.rewriteBindingTokensDeep,\n textReferencesBinding: m1.textReferencesBinding,\n CATEGORY_REQUIRED_CAPABILITY: m2.CATEGORY_REQUIRED_CAPABILITY,\n EnabledPluginsContext: m2.EnabledPluginsContext,\n isCategoryCapabilityEnabled: m2.isCategoryCapabilityEnabled,\n isFromEnabledPlugin: m2.isFromEnabledPlugin,\n isSwitchedOffForRenderedSite: m2.isSwitchedOffForRenderedSite,\n useEnabledPlugins: m2.useEnabledPlugins,\n FUNCTION_BUILTIN_NAMES: m3.FUNCTION_BUILTIN_NAMES,\n FUNCTION_MAX_OPERATIONS: m3.FUNCTION_MAX_OPERATIONS,\n evaluateExpression: m3.evaluateExpression,\n evaluateHostFunction: m3.evaluateHostFunction,\n expressionIdentifiers: m3.expressionIdentifiers,\n expressionSyntaxError: m3.expressionSyntaxError,\n formatFunctionParameterOptions: m3.formatFunctionParameterOptions,\n functionReferencedNames: m3.functionReferencedNames,\n parseFunctionParameterOptions: m3.parseFunctionParameterOptions,\n NodeIdentityContext: m4.NodeIdentityContext,\n useNodeId: m4.useNodeId,\n ScreenLinkContext: m5.ScreenLinkContext,\n PREVIEW_REFUSED_STATUS: m6.PREVIEW_REFUSED_STATUS,\n PREVIEW_WRITE_BLOCKED_EVENT: m6.PREVIEW_WRITE_BLOCKED_EVENT,\n SiteContext: m6.SiteContext,\n isPreviewRefusal: m6.isPreviewRefusal,\n useSite: m6.useSite,\n useSiteFetch: m6.useSiteFetch,\n HOST_VARIABLE_TYPE_LABELS: m7.HOST_VARIABLE_TYPE_LABELS,\n VARIABLE_NAME_PATTERN: m7.VARIABLE_NAME_PATTERN,\n attachFunctionDefinitions: m7.attachFunctionDefinitions,\n formatVariableValue: m7.formatVariableValue,\n functionGlobals: m7.functionGlobals,\n hasBindings: m7.hasBindings,\n isVariableName: m7.isVariableName,\n resolveBindings: m7.resolveBindings,\n resolveNodesBindings: m7.resolveNodesBindings,\n COMPONENT_CATEGORY_ORDER: m8.COMPONENT_CATEGORY_ORDER,\n ComponentCategory: m8.ComponentCategory,\n REUSABLE_COMPONENT_CATEGORY: m8.REUSABLE_COMPONENT_CATEGORY,\n REUSABLE_EMAIL_BLOCK_CATEGORY: m8.REUSABLE_EMAIL_BLOCK_CATEGORY,\n FEATURE_FLAG: m9.FEATURE_FLAG,\n RICH_TEXT_COMMANDS: m9.RICH_TEXT_COMMANDS,\n FieldComponentType: m10.FieldComponentType,\n FieldValidatorType: m10.FieldValidatorType,\n LinealDirectiveFlag: m10.LinealDirectiveFlag,\n CONSOLE_HOST_GATED_WIDGET_SLOTS: m11.CONSOLE_HOST_GATED_WIDGET_SLOTS,\n CONSOLE_SEARCH_LOAD_POINT: m11.CONSOLE_SEARCH_LOAD_POINT,\n CONSOLE_STAFF_WIDGET_SLOTS: m11.CONSOLE_STAFF_WIDGET_SLOTS,\n CONSOLE_WIDGET_SLOTS: m11.CONSOLE_WIDGET_SLOTS,\n MUI_BUNDLE_ID: m11.MUI_BUNDLE_ID,\n THEME_PRESETS_LOAD_POINT: m11.THEME_PRESETS_LOAD_POINT,\n defineUiFeatureBundle: m11.defineUiFeatureBundle,\n isConsoleHostGatedWidgetSlot: m11.isConsoleHostGatedWidgetSlot,\n isConsoleStaffWidgetSlot: m11.isConsoleStaffWidgetSlot,\n listConsoleExtensions: m11.listConsoleExtensions,\n listConsoleNavItems: m11.listConsoleNavItems,\n listConsoleOrgNavItems: m11.listConsoleOrgNavItems,\n listConsoleProviders: m11.listConsoleProviders,\n listConsolePublicPages: m11.listConsolePublicPages,\n listConsoleSearchSources: m11.listConsoleSearchSources,\n listConsoleStaffPages: m11.listConsoleStaffPages,\n listConsoleThemePresets: m11.listConsoleThemePresets,\n listConsoleWidgets: m11.listConsoleWidgets,\n normalizeConsolePublicPath: m11.normalizeConsolePublicPath,\n registerConsoleExtension: m11.registerConsoleExtension,\n resolveConsoleOrgPluginPage: m11.resolveConsoleOrgPluginPage,\n resolveConsolePluginPage: m11.resolveConsolePluginPage,\n resolveConsolePublicPage: m11.resolveConsolePublicPage,\n resolveConsoleStaffPage: m11.resolveConsoleStaffPage,\n unregisterConsoleExtension: m11.unregisterConsoleExtension,\n NodeType: m12.NodeType,\n})\n"],"names":["m0","m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11","m12","AGLYN_HOST_SURFACE","Object","freeze","Aglyn","aglyn","canvas","components","emitter","logger","plugins","FUNCTION_TOKEN_PATTERN","MISSING_BINDING_LABEL","NAME_TOKEN_PATTERN","VARIABLE_ID_TOKEN_PATTERN","bindingTokenNeedsDeep","displayBindingTokens","editableBindingTokens","formatFunctionIdToken","formatVariableIdToken","keyById","nodesReferenceBinding","normalizeBindingTokens","rewriteBindingTokensDeep","textReferencesBinding","CATEGORY_REQUIRED_CAPABILITY","EnabledPluginsContext","isCategoryCapabilityEnabled","isFromEnabledPlugin","isSwitchedOffForRenderedSite","useEnabledPlugins","FUNCTION_BUILTIN_NAMES","FUNCTION_MAX_OPERATIONS","evaluateExpression","evaluateHostFunction","expressionIdentifiers","expressionSyntaxError","formatFunctionParameterOptions","functionReferencedNames","parseFunctionParameterOptions","NodeIdentityContext","useNodeId","ScreenLinkContext","PREVIEW_REFUSED_STATUS","PREVIEW_WRITE_BLOCKED_EVENT","SiteContext","isPreviewRefusal","useSite","useSiteFetch","HOST_VARIABLE_TYPE_LABELS","VARIABLE_NAME_PATTERN","attachFunctionDefinitions","formatVariableValue","functionGlobals","hasBindings","isVariableName","resolveBindings","resolveNodesBindings","COMPONENT_CATEGORY_ORDER","ComponentCategory","REUSABLE_COMPONENT_CATEGORY","REUSABLE_EMAIL_BLOCK_CATEGORY","FEATURE_FLAG","RICH_TEXT_COMMANDS","FieldComponentType","FieldValidatorType","LinealDirectiveFlag","CONSOLE_HOST_GATED_WIDGET_SLOTS","CONSOLE_SEARCH_LOAD_POINT","CONSOLE_STAFF_WIDGET_SLOTS","CONSOLE_WIDGET_SLOTS","MUI_BUNDLE_ID","THEME_PRESETS_LOAD_POINT","defineUiFeatureBundle","isConsoleHostGatedWidgetSlot","isConsoleStaffWidgetSlot","listConsoleExtensions","listConsoleNavItems","listConsoleOrgNavItems","listConsoleProviders","listConsolePublicPages","listConsoleSearchSources","listConsoleStaffPages","listConsoleThemePresets","listConsoleWidgets","normalizeConsolePublicPath","registerConsoleExtension","resolveConsoleOrgPluginPage","resolveConsolePluginPage","resolveConsolePublicPage","resolveConsoleStaffPage","unregisterConsoleExtension","NodeType"],"mappings":"AAAA;;;;;;CAMC,GACD,kBAAkB,GAElB,YAAYA,QAAQ,cAAU;AAC9B,YAAYC,QAAQ,iCAA6B;AACjD,YAAYC,QAAQ,0CAAsC;AAC1D,YAAYC,QAAQ,4BAAwB;AAC5C,YAAYC,QAAQ,gCAA4B;AAChD,YAAYC,QAAQ,4CAAwC;AAC5D,YAAYC,QAAQ,+BAA2B;AAC/C,YAAYC,QAAQ,4BAAwB;AAC5C,YAAYC,QAAQ,wCAAoC;AACxD,YAAYC,QAAQ,oCAAgC;AACpD,YAAYC,SAAS,gDAA4C;AACjE,YAAYC,SAAS,uBAAmB;AACxC,YAAYC,SAAS,oBAAgB;AAErC,OAAO,MAAMC,qBAAwDC,OAAOC,MAAM,CAAC;IACjFC,OAAOhB,GAAGgB,KAAK;IACfC,OAAOjB,GAAGiB,KAAK;IACfC,QAAQlB,GAAGkB,MAAM;IACjBC,YAAYnB,GAAGmB,UAAU;IACzBC,SAASpB,GAAGoB,OAAO;IACnBC,QAAQrB,GAAGqB,MAAM;IACjBC,SAAStB,GAAGsB,OAAO;IACnBC,wBAAwBtB,GAAGsB,sBAAsB;IACjDC,uBAAuBvB,GAAGuB,qBAAqB;IAC/CC,oBAAoBxB,GAAGwB,kBAAkB;IACzCC,2BAA2BzB,GAAGyB,yBAAyB;IACvDC,uBAAuB1B,GAAG0B,qBAAqB;IAC/CC,sBAAsB3B,GAAG2B,oBAAoB;IAC7CC,uBAAuB5B,GAAG4B,qB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wBAAwB;IACtDC,0BAA0B1F,IAAI0F,wBAAwB;IACtDC,yBAAyB3F,IAAI2F,uBAAuB;IACpDC,4BAA4B5F,IAAI4F,0BAA0B;IAC1DC,UAAU5F,IAAI4F,QAAQ;AACxB,GAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/realm-host-aglyn.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-realm-host-exports.mjs\n *\n * The realm plugin surface of `@aglyn/aglyn` (AGL-3392): what a signed\n * bundle reads from core. Imported only by the lazily loaded host module.\n */\n/* eslint-disable */\n\nimport * as m0 from \"../aglyn\"\nimport * as m1 from \"../app-utils/binding-tokens\"\nimport * as m2 from \"../app-utils/enabled-plugins-context\"\nimport * as m3 from \"../app-utils/functions\"\nimport * as m4 from \"../app-utils/node-identity\"\nimport * as m5 from \"../app-utils/plugin-connection-record\"\nimport * as m6 from \"../app-utils/screen-link-context-value\"\nimport * as m7 from \"../app-utils/site-context\"\nimport * as m8 from \"../app-utils/variables\"\nimport * as m9 from \"../foundation/constants/components\"\nimport * as m10 from \"../foundation/constants/shared\"\nimport * as m11 from \"../foundation/definitions/components.types\"\nimport * as m12 from \"./feature-plugins\"\nimport * as m13 from \"../types/nodes\"\n\nexport const AGLYN_HOST_SURFACE: Readonly<Record<string, unknown>> = Object.freeze({\n Aglyn: m0.Aglyn,\n aglyn: m0.aglyn,\n canvas: m0.canvas,\n components: m0.components,\n emitter: m0.emitter,\n logger: m0.logger,\n plugins: m0.plugins,\n FUNCTION_TOKEN_PATTERN: m1.FUNCTION_TOKEN_PATTERN,\n MISSING_BINDING_LABEL: m1.MISSING_BINDING_LABEL,\n NAME_TOKEN_PATTERN: m1.NAME_TOKEN_PATTERN,\n VARIABLE_ID_TOKEN_PATTERN: m1.VARIABLE_ID_TOKEN_PATTERN,\n bindingTokenNeedsDeep: m1.bindingTokenNeedsDeep,\n displayBindingTokens: m1.displayBindingTokens,\n editableBindingTokens: m1.editableBindingTokens,\n formatFunctionIdToken: m1.formatFunctionIdToken,\n formatVariableIdToken: m1.formatVariableIdToken,\n keyById: m1.keyById,\n nodesReferenceBinding: m1.nodesReferenceBinding,\n normalizeBindingTokens: m1.normalizeBindingTokens,\n rewriteBindingTokensDeep: m1.rewriteBindingTokensDeep,\n textReferencesBinding: m1.textReferencesBinding,\n CATEGORY_REQUIRED_CAPABILITY: m2.CATEGORY_REQUIRED_CAPABILITY,\n EnabledPluginsContext: m2.EnabledPluginsContext,\n isCategoryCapabilityEnabled: m2.isCategoryCapabilityEnabled,\n isFromEnabledPlugin: m2.isFromEnabledPlugin,\n isSwitchedOffForRenderedSite: m2.isSwitchedOffForRenderedSite,\n useEnabledPlugins: m2.useEnabledPlugins,\n FUNCTION_BUILTIN_NAMES: m3.FUNCTION_BUILTIN_NAMES,\n FUNCTION_MAX_OPERATIONS: m3.FUNCTION_MAX_OPERATIONS,\n evaluateExpression: m3.evaluateExpression,\n evaluateHostFunction: m3.evaluateHostFunction,\n expressionIdentifiers: m3.expressionIdentifiers,\n expressionSyntaxError: m3.expressionSyntaxError,\n formatFunctionParameterOptions: m3.formatFunctionParameterOptions,\n functionReferencedNames: m3.functionReferencedNames,\n parseFunctionParameterOptions: m3.parseFunctionParameterOptions,\n NodeIdentityContext: m4.NodeIdentityContext,\n useNodeId: m4.useNodeId,\n usePluginConnectionRecord: m5.usePluginConnectionRecord,\n ScreenLinkContext: m6.ScreenLinkContext,\n PREVIEW_REFUSED_STATUS: m7.PREVIEW_REFUSED_STATUS,\n PREVIEW_WRITE_BLOCKED_EVENT: m7.PREVIEW_WRITE_BLOCKED_EVENT,\n SiteContext: m7.SiteContext,\n isPreviewRefusal: m7.isPreviewRefusal,\n useSite: m7.useSite,\n useSiteFetch: m7.useSiteFetch,\n HOST_VARIABLE_TYPE_LABELS: m8.HOST_VARIABLE_TYPE_LABELS,\n VARIABLE_NAME_PATTERN: m8.VARIABLE_NAME_PATTERN,\n attachFunctionDefinitions: m8.attachFunctionDefinitions,\n formatVariableValue: m8.formatVariableValue,\n functionGlobals: m8.functionGlobals,\n hasBindings: m8.hasBindings,\n isVariableName: m8.isVariableName,\n resolveBindings: m8.resolveBindings,\n resolveNodesBindings: m8.resolveNodesBindings,\n COMPONENT_CATEGORY_ORDER: m9.COMPONENT_CATEGORY_ORDER,\n ComponentCategory: m9.ComponentCategory,\n REUSABLE_COMPONENT_CATEGORY: m9.REUSABLE_COMPONENT_CATEGORY,\n REUSABLE_EMAIL_BLOCK_CATEGORY: m9.REUSABLE_EMAIL_BLOCK_CATEGORY,\n FEATURE_FLAG: m10.FEATURE_FLAG,\n RICH_TEXT_COMMANDS: m10.RICH_TEXT_COMMANDS,\n FieldComponentType: m11.FieldComponentType,\n FieldValidatorType: m11.FieldValidatorType,\n LinealDirectiveFlag: m11.LinealDirectiveFlag,\n CONSOLE_HOST_GATED_WIDGET_SLOTS: m12.CONSOLE_HOST_GATED_WIDGET_SLOTS,\n CONSOLE_SEARCH_LOAD_POINT: m12.CONSOLE_SEARCH_LOAD_POINT,\n CONSOLE_STAFF_WIDGET_SLOTS: m12.CONSOLE_STAFF_WIDGET_SLOTS,\n CONSOLE_WIDGET_SLOTS: m12.CONSOLE_WIDGET_SLOTS,\n MUI_BUNDLE_ID: m12.MUI_BUNDLE_ID,\n THEME_PRESETS_LOAD_POINT: m12.THEME_PRESETS_LOAD_POINT,\n defineUiFeatureBundle: m12.defineUiFeatureBundle,\n isConsoleHostGatedWidgetSlot: m12.isConsoleHostGatedWidgetSlot,\n isConsoleStaffWidgetSlot: m12.isConsoleStaffWidgetSlot,\n listConsoleExtensions: m12.listConsoleExtensions,\n listConsoleNavItems: m12.listConsoleNavItems,\n listConsoleOrgNavItems: m12.listConsoleOrgNavItems,\n listConsoleProviders: m12.listConsoleProviders,\n listConsolePublicPages: m12.listConsolePublicPages,\n listConsoleSearchSources: m12.listConsoleSearchSources,\n listConsoleStaffPages: m12.listConsoleStaffPages,\n listConsoleThemePresets: m12.listConsoleThemePresets,\n listConsoleWidgets: m12.listConsoleWidgets,\n normalizeConsolePublicPath: m12.normalizeConsolePublicPath,\n registerConsoleExtension: m12.registerConsoleExtension,\n resolveConsoleOrgPluginPage: m12.resolveConsoleOrgPluginPage,\n resolveConsolePluginPage: m12.resolveConsolePluginPage,\n resolveConsolePublicPage: m12.resolveConsolePublicPage,\n resolveConsoleStaffPage: m12.resolveConsoleStaffPage,\n unregisterConsoleExtension: m12.unregisterConsoleExtension,\n NodeType: m13.NodeType,\n})\n"],"names":["m0","m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11","m12","m13","AGLYN_HOST_SURFACE","Object","freeze","Aglyn","aglyn","canvas","components","emitter","logger","plugins","FUNCTION_TOKEN_PATTERN","MISSING_BINDING_LABEL","NAME_TOKEN_PATTERN","VARIABLE_ID_TOKEN_PATTERN","bindingTokenNeedsDeep","displayBindingTokens","editableBindingTokens","formatFunctionIdToken","formatVariableIdToken","keyById","nodesReferenceBinding","normalizeBindingTokens","rewriteBindingTokensDeep","textReferencesBinding","CATEGORY_REQUIRED_CAPABILITY","EnabledPluginsContext","isCategoryCapabilityEnabled","isFromEnabledPlugin","isSwitchedOffForRenderedSite","useEnabledPlugins","FUNCTION_BUILTIN_NAMES","FUNCTION_MAX_OPERATIONS","evaluateExpression","evaluateHostFunction","expressionIdentifiers","expressionSyntaxError","formatFunctionParameterOptions","functionReferencedNames","parseFunctionParameterOptions","NodeIdentityContext","useNodeId","usePluginConnectionRecord","ScreenLinkContext","PREVIEW_REFUSED_STATUS","PREVIEW_WRITE_BLOCKED_EVENT","SiteContext","isPreviewRefusal","useSite","useSiteFetch","HOST_VARIABLE_TYPE_LABELS","VARIABLE_NAME_PATTERN","attachFunctionDefinitions","formatVariableValue","functionGlobals","hasBindings","isVariableName","resolveBindings","resolveNodesBindings","COMPONENT_CATEGORY_ORDER","ComponentCategory","REUSABLE_COMPONENT_CATEGORY","REUSABLE_EMAIL_BLOCK_CATEGORY","FEATURE_FLAG","RICH_TEXT_COMMANDS","FieldComponentType","FieldValidatorType","LinealDirectiveFlag","CONSOLE_HOST_GATED_WIDGET_SLOTS","CONSOLE_SEARCH_LOAD_POINT","CONSOLE_STAFF_WIDGET_SLOTS","CONSOLE_WIDGET_SLOTS","MUI_BUNDLE_ID","THEME_PRESETS_LOAD_POINT","defineUiFeatureBundle","isConsoleHostGatedWidgetSlot","isConsoleStaffWidgetSlot","listConsoleExtensions","listConsoleNavItems","listConsoleOrgNavItems","listConsoleProviders","listConsolePublicPages","listConsoleSearchSources","listConsoleStaffPages","listConsoleThemePresets","listConsoleWidgets","normalizeConsolePublicPath","registerConsoleExtension","resolveConsoleOrgPluginPage","resolveConsolePluginPage","resolveConsolePublicPage","resolveConsoleStaffPage","unregisterConsoleExtension","NodeType"],"mappings":"AAAA;;;;;;CAMC,GACD,kBAAkB,GAElB,YAAYA,QAAQ,cAAU;AAC9B,YAAYC,QAAQ,iCAA6B;AACjD,YAAYC,QAAQ,0CAAsC;AAC1D,YAAYC,QAAQ,4BAAwB;AAC5C,YAAYC,QAAQ,gCAA4B;AAChD,YAAYC,QAAQ,2CAAuC;AAC3D,YAAYC,QAAQ,4CAAwC;AAC5D,YAAYC,QAAQ,+BAA2B;AAC/C,YAAYC,QAAQ,4BAAwB;AAC5C,YAAYC,QAAQ,wCAAoC;AACxD,YAAYC,SAAS,oCAAgC;AACrD,YAAYC,SAAS,gDAA4C;AACjE,YAAYC,SAAS,uBAAmB;AACxC,YAAYC,SAAS,oBAAgB;AAErC,OAAO,MAAMC,qBAAwDC,OAAOC,MAAM,CAAC;IACjFC,OAAOjB,GAAGiB,KAAK;IACfC,OAAOlB,GAAGkB,KAAK;IACfC,QAAQnB,GAAGmB,MAAM;IACjBC,YAAYpB,GAAGoB,UAAU;IACzBC,SAASrB,GAAGqB,OAAO;IACnBC,QAAQtB,GAAGsB,MAAM;IACjBC,SAASvB,GAAGuB,OAAO;IACnBC,wBAAwBvB,GAAGuB,sB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wBAAwB;IACtDC,uBAAuBpF,IAAIoF,qBAAqB;IAChDC,yBAAyBrF,IAAIqF,uBAAuB;IACpDC,oBAAoBtF,IAAIsF,kBAAkB;IAC1CC,4BAA4BvF,IAAIuF,0BAA0B;IAC1DC,0BAA0BxF,IAAIwF,wBAAwB;IACtDC,6BAA6BzF,IAAIyF,2BAA2B;IAC5DC,0BAA0B1F,IAAI0F,wBAAwB;IACtDC,0BAA0B3F,IAAI2F,wBAAwB;IACtDC,yBAAyB5F,IAAI4F,uBAAuB;IACpDC,4BAA4B7F,IAAI6F,0BAA0B;IAC1DC,UAAU7F,IAAI6F,QAAQ;AACxB,GAAE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { SitePageEnricher } from './site-page-hooks';
|
|
18
|
+
/**
|
|
19
|
+
* Enrichers registered from a plugin's BOOT declarations (AGL-4195), which
|
|
20
|
+
* `instrumentation.ts` runs in a compilation of its own: a module-scope list
|
|
21
|
+
* filled there is empty where the page route reads it (AGL-3947). These live
|
|
22
|
+
* in the plugin-service registry, on `globalThis`, so the route sees them. A
|
|
23
|
+
* plugin registering again replaces its own (by `key`), and the owner is
|
|
24
|
+
* named at registration, so the page's "who contributed" narrowing holds.
|
|
25
|
+
*
|
|
26
|
+
* Plugins registering from a surface the route itself loads (`tenantApi`)
|
|
27
|
+
* keep using `registerSitePageEnricher` (`site-page-hooks.ts`), which runs
|
|
28
|
+
* these after its own.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SITE_PAGE_ENRICHER_SERVICES: import("./plugin-services").PluginServiceContract<SitePageEnricher>;
|
|
31
|
+
/** Registers a boot-time enricher; see {@link SITE_PAGE_ENRICHER_SERVICES}. */
|
|
32
|
+
export declare function registerSitePageEnricherService(fn: SitePageEnricher, options?: {
|
|
33
|
+
pluginId?: string;
|
|
34
|
+
key?: string;
|
|
35
|
+
}): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { definePluginServiceContract, registerPluginService } from "./plugin-services.js";
|
|
17
|
+
/**
|
|
18
|
+
* Enrichers registered from a plugin's BOOT declarations (AGL-4195), which
|
|
19
|
+
* `instrumentation.ts` runs in a compilation of its own: a module-scope list
|
|
20
|
+
* filled there is empty where the page route reads it (AGL-3947). These live
|
|
21
|
+
* in the plugin-service registry, on `globalThis`, so the route sees them. A
|
|
22
|
+
* plugin registering again replaces its own (by `key`), and the owner is
|
|
23
|
+
* named at registration, so the page's "who contributed" narrowing holds.
|
|
24
|
+
*
|
|
25
|
+
* Plugins registering from a surface the route itself loads (`tenantApi`)
|
|
26
|
+
* keep using `registerSitePageEnricher` (`site-page-hooks.ts`), which runs
|
|
27
|
+
* these after its own.
|
|
28
|
+
*/ export const SITE_PAGE_ENRICHER_SERVICES = definePluginServiceContract('core.site-page-enricher', {
|
|
29
|
+
multiple: true
|
|
30
|
+
});
|
|
31
|
+
/** Registers a boot-time enricher; see {@link SITE_PAGE_ENRICHER_SERVICES}. */ export function registerSitePageEnricherService(fn, options) {
|
|
32
|
+
registerPluginService(SITE_PAGE_ENRICHER_SERVICES, fn, options);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=site-page-enricher-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/site-page-enricher-services.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { definePluginServiceContract, registerPluginService } from './plugin-services'\nimport type { SitePageEnricher } from './site-page-hooks'\n\n/**\n * Enrichers registered from a plugin's BOOT declarations (AGL-4195), which\n * `instrumentation.ts` runs in a compilation of its own: a module-scope list\n * filled there is empty where the page route reads it (AGL-3947). These live\n * in the plugin-service registry, on `globalThis`, so the route sees them. A\n * plugin registering again replaces its own (by `key`), and the owner is\n * named at registration, so the page's \"who contributed\" narrowing holds.\n *\n * Plugins registering from a surface the route itself loads (`tenantApi`)\n * keep using `registerSitePageEnricher` (`site-page-hooks.ts`), which runs\n * these after its own.\n */\nexport const SITE_PAGE_ENRICHER_SERVICES = definePluginServiceContract<SitePageEnricher>(\n 'core.site-page-enricher',\n { multiple: true },\n)\n\n/** Registers a boot-time enricher; see {@link SITE_PAGE_ENRICHER_SERVICES}. */\nexport function registerSitePageEnricherService(\n fn: SitePageEnricher,\n options?: { pluginId?: string; key?: string },\n): void {\n registerPluginService(SITE_PAGE_ENRICHER_SERVICES, fn, options)\n}\n\n"],"names":["definePluginServiceContract","registerPluginService","SITE_PAGE_ENRICHER_SERVICES","multiple","registerSitePageEnricherService","fn","options"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,2BAA2B,EAAEC,qBAAqB,QAAQ,uBAAmB;AAGtF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,8BAA8BF,4BACzC,2BACA;IAAEG,UAAU;AAAK,GAClB;AAED,6EAA6E,GAC7E,OAAO,SAASC,gCACdC,EAAoB,EACpBC,OAA6C;IAE7CL,sBAAsBC,6BAA6BG,IAAIC;AACzD"}
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
// `/server` entry, and importing it from this shared barrel formed a cycle
|
|
18
18
|
// that left the binding missing at runtime (AGL-1289).
|
|
19
19
|
import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
|
|
20
|
+
import { resolvePluginServices } from "./plugin-services.js";
|
|
21
|
+
import { SITE_PAGE_ENRICHER_SERVICES } from "./site-page-enricher-services.js";
|
|
20
22
|
const redirectResolvers = [];
|
|
21
23
|
const pageResolvers = [];
|
|
22
24
|
const enrichers = [];
|
|
@@ -97,12 +99,24 @@ export async function runSitePageEnrichers(context) {
|
|
|
97
99
|
// preserves — so two enrichers contributing the same key resolve exactly as
|
|
98
100
|
// they did when the loop was sequential, and `contributors` keeps its
|
|
99
101
|
// insertion order.
|
|
100
|
-
|
|
102
|
+
//
|
|
103
|
+
// The route's own list first, then the boot's (AGL-4195), each with its owner.
|
|
104
|
+
const all = [
|
|
105
|
+
...enrichers.map((enricher)=>({
|
|
106
|
+
enricher,
|
|
107
|
+
owner: enricherOwners.get(enricher)
|
|
108
|
+
})),
|
|
109
|
+
...resolvePluginServices(SITE_PAGE_ENRICHER_SERVICES).map(({ impl, pluginId })=>({
|
|
110
|
+
enricher: impl,
|
|
111
|
+
owner: pluginId
|
|
112
|
+
}))
|
|
113
|
+
];
|
|
114
|
+
const settled = await Promise.allSettled(all.map(async ({ enricher })=>{
|
|
101
115
|
var _ref;
|
|
102
116
|
return (_ref = await enricher(context)) != null ? _ref : {};
|
|
103
117
|
}));
|
|
104
118
|
for (const [index, outcome] of settled.entries()){
|
|
105
|
-
const
|
|
119
|
+
const { owner } = all[index];
|
|
106
120
|
try {
|
|
107
121
|
if (outcome.status === 'rejected') throw outcome.reason;
|
|
108
122
|
const result = outcome.value;
|
|
@@ -123,7 +137,6 @@ export async function runSitePageEnrichers(context) {
|
|
|
123
137
|
// off presence would mark it a contributor everywhere and the
|
|
124
138
|
// attribution would be worth nothing.
|
|
125
139
|
if (Object.values(result).some((value)=>!isEmptyContribution(value))) {
|
|
126
|
-
const owner = enricherOwners.get(enricher);
|
|
127
140
|
if (owner) contributors.add(owner);
|
|
128
141
|
else unattributed = true;
|
|
129
142
|
}
|