@aglyn/aglyn 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/account-preferences.d.ts +15 -13
  3. package/src/lib/app-utils/account-preferences.js +20 -20
  4. package/src/lib/app-utils/account-preferences.js.map +1 -1
  5. package/src/lib/app-utils/crm.d.ts +3 -1
  6. package/src/lib/app-utils/crm.js +6 -3
  7. package/src/lib/app-utils/crm.js.map +1 -1
  8. package/src/lib/app-utils/docs-help-sections.generated.js +10 -4
  9. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  10. package/src/lib/app-utils/docs-help.generated.d.ts +2 -2
  11. package/src/lib/app-utils/docs-help.generated.js +8 -0
  12. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  13. package/src/lib/app-utils/docs-index.generated.js +117 -96
  14. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  15. package/src/lib/app-utils/host-permissions.d.ts +12 -0
  16. package/src/lib/app-utils/host-permissions.js +26 -1
  17. package/src/lib/app-utils/host-permissions.js.map +1 -1
  18. package/src/lib/app-utils/markdown-lite.js +8 -1
  19. package/src/lib/app-utils/markdown-lite.js.map +1 -1
  20. package/src/lib/app-utils/media-asset-facts.d.ts +2 -2
  21. package/src/lib/app-utils/media-asset-facts.js +4 -3
  22. package/src/lib/app-utils/media-asset-facts.js.map +1 -1
  23. package/src/lib/app-utils/media-cdn-scope.d.ts +19 -4
  24. package/src/lib/app-utils/media-cdn-scope.js +19 -5
  25. package/src/lib/app-utils/media-cdn-scope.js.map +1 -1
  26. package/src/lib/app-utils/media-ref.d.ts +10 -6
  27. package/src/lib/app-utils/media-ref.js +34 -8
  28. package/src/lib/app-utils/media-ref.js.map +1 -1
  29. package/src/lib/app-utils/org-permissions.d.ts +7 -0
  30. package/src/lib/app-utils/org-permissions.js +2 -0
  31. package/src/lib/app-utils/org-permissions.js.map +1 -1
  32. package/src/lib/app-utils/org-role-grants.d.ts +13 -0
  33. package/src/lib/app-utils/org-role-grants.js +9 -5
  34. package/src/lib/app-utils/org-role-grants.js.map +1 -1
  35. package/src/lib/app-utils/person-erasure.d.ts +8 -0
  36. package/src/lib/app-utils/person-erasure.js +6 -0
  37. package/src/lib/app-utils/person-erasure.js.map +1 -1
  38. package/src/lib/app-utils/scope-tokens.d.ts +132 -3
  39. package/src/lib/app-utils/scope-tokens.js +276 -3
  40. package/src/lib/app-utils/scope-tokens.js.map +1 -1
  41. package/src/lib/app-utils/site-placement.d.ts +56 -0
  42. package/src/lib/app-utils/site-placement.js +88 -0
  43. package/src/lib/app-utils/site-placement.js.map +1 -0
  44. package/src/lib/app-utils/site-preview.d.ts +6 -2
  45. package/src/lib/app-utils/site-preview.js +5 -3
  46. package/src/lib/app-utils/site-preview.js.map +1 -1
  47. package/src/lib/app-utils/site-unavailable.d.ts +4 -7
  48. package/src/lib/app-utils/site-unavailable.js +4 -8
  49. package/src/lib/app-utils/site-unavailable.js.map +1 -1
  50. package/src/lib/app-utils/transfer-launcher-context.d.ts +17 -1
  51. package/src/lib/app-utils/transfer-launcher-context.js.map +1 -1
  52. package/src/lib/data-transfer/access.d.ts +10 -18
  53. package/src/lib/data-transfer/access.js +21 -25
  54. package/src/lib/data-transfer/access.js.map +1 -1
  55. package/src/lib/data-transfer/resource.d.ts +13 -14
  56. package/src/lib/data-transfer/resource.js +9 -10
  57. package/src/lib/data-transfer/resource.js.map +1 -1
  58. package/src/lib/foundation/definitions/org-billing.types.js +2 -2
  59. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  60. package/src/lib/foundation/definitions/platform.types.d.ts +1 -1
  61. package/src/lib/foundation/definitions/platform.types.js.map +1 -1
  62. package/src/lib/foundation/definitions/write-deny-coverage.util.d.ts +1 -1
  63. package/src/lib/foundation/definitions/write-deny-coverage.util.js +1 -1
  64. package/src/lib/foundation/definitions/write-deny-coverage.util.js.map +1 -1
  65. package/src/lib/plugin-manager/first-party-plugins.generated.js +4 -5
  66. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  67. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +18 -0
  68. package/src/lib/plugin-manager/plugin-contact-capture.js +26 -0
  69. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  70. package/src/lib/plugin-manager/plugin-entitlements.d.ts +12 -0
  71. package/src/lib/plugin-manager/plugin-entitlements.js +3 -1
  72. package/src/lib/plugin-manager/plugin-entitlements.js.map +1 -1
  73. package/src/lib/plugin-manager/plugin-person-erasure-notes.d.ts +61 -0
  74. package/src/lib/plugin-manager/plugin-person-erasure-notes.js +114 -0
  75. package/src/lib/plugin-manager/plugin-person-erasure-notes.js.map +1 -0
  76. package/src/lib/plugin-manager/plugin-scope-sharing.d.ts +52 -0
  77. package/src/lib/plugin-manager/plugin-scope-sharing.generated.d.ts +10 -0
  78. package/src/lib/plugin-manager/plugin-scope-sharing.generated.js +82 -0
  79. package/src/lib/plugin-manager/plugin-scope-sharing.generated.js.map +1 -0
  80. package/src/lib/plugin-manager/plugin-scope-sharing.js +85 -0
  81. package/src/lib/plugin-manager/plugin-scope-sharing.js.map +1 -0
  82. package/src/lib/plugin-manager/plugin-site-starters.d.ts +7 -0
  83. package/src/lib/plugin-manager/plugin-site-starters.js.map +1 -1
  84. package/src/lib/plugin-manager/plugin-transfer-resources.d.ts +56 -1
  85. package/src/lib/plugin-manager/plugin-transfer-resources.js +13 -0
  86. package/src/lib/plugin-manager/plugin-transfer-resources.js.map +1 -1
@@ -0,0 +1,10 @@
1
+ /**
2
+ * GENERATED FILE — do not edit. Regenerate with:
3
+ * node tools/scripts/generate-plugin-manifests.mjs
4
+ *
5
+ * The collections plugins keep documents shared with all sites except some
6
+ * (AGL-4047): each plugin's `scopeSharingCollections` block in
7
+ * plugins.config.json. Core's `plugin-scope-sharing.ts` reads them.
8
+ */
9
+ import type { ResolvedScopeSharingCollection } from './plugin-scope-sharing';
10
+ export declare const PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED: readonly ResolvedScopeSharingCollection[];
@@ -0,0 +1,82 @@
1
+ /**
2
+ * GENERATED FILE — do not edit. Regenerate with:
3
+ * node tools/scripts/generate-plugin-manifests.mjs
4
+ *
5
+ * The collections plugins keep documents shared with all sites except some
6
+ * (AGL-4047): each plugin's `scopeSharingCollections` block in
7
+ * plugins.config.json. Core's `plugin-scope-sharing.ts` reads them.
8
+ */ export const PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED = [
9
+ {
10
+ "pluginId": "crm",
11
+ "name": "contacts",
12
+ "patch": true,
13
+ "maxIncluded": 30,
14
+ "keepSiteFields": [
15
+ "hostId",
16
+ "capturedByHostIds"
17
+ ]
18
+ },
19
+ {
20
+ "pluginId": "crm",
21
+ "name": "leads",
22
+ "patch": true,
23
+ "maxIncluded": 30,
24
+ "keepSiteFields": [
25
+ "hostId",
26
+ "capturedByHostIds"
27
+ ]
28
+ },
29
+ {
30
+ "pluginId": "crm",
31
+ "name": "companies",
32
+ "patch": true,
33
+ "maxIncluded": 30,
34
+ "keepSiteFields": [
35
+ "hostId",
36
+ "capturedByHostIds"
37
+ ]
38
+ },
39
+ {
40
+ "pluginId": "crm",
41
+ "name": "deals",
42
+ "patch": true,
43
+ "maxIncluded": 30,
44
+ "keepSiteFields": [
45
+ "hostId",
46
+ "capturedByHostIds"
47
+ ]
48
+ },
49
+ {
50
+ "pluginId": "crm",
51
+ "name": "crmTasks",
52
+ "patch": true,
53
+ "maxIncluded": 30,
54
+ "keepSiteFields": [
55
+ "hostId",
56
+ "capturedByHostIds"
57
+ ]
58
+ },
59
+ {
60
+ "pluginId": "crm",
61
+ "name": "crmActivities",
62
+ "maxIncluded": 30,
63
+ "keepSiteFields": [
64
+ "hostId",
65
+ "capturedByHostIds"
66
+ ]
67
+ },
68
+ {
69
+ "pluginId": "data",
70
+ "name": "datasets"
71
+ },
72
+ {
73
+ "pluginId": "marketing",
74
+ "name": "emailCampaigns"
75
+ },
76
+ {
77
+ "pluginId": "workflows",
78
+ "name": "automations"
79
+ }
80
+ ];
81
+
82
+ //# sourceMappingURL=plugin-scope-sharing.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-scope-sharing.generated.ts"],"sourcesContent":["/**\n * GENERATED FILE — do not edit. Regenerate with:\n * node tools/scripts/generate-plugin-manifests.mjs\n *\n * The collections plugins keep documents shared with all sites except some\n * (AGL-4047): each plugin's `scopeSharingCollections` block in\n * plugins.config.json. Core's `plugin-scope-sharing.ts` reads them.\n */\n\nimport type { ResolvedScopeSharingCollection } from './plugin-scope-sharing'\n\nexport const PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED: readonly ResolvedScopeSharingCollection[] = [\n {\n \"pluginId\": \"crm\",\n \"name\": \"contacts\",\n \"patch\": true,\n \"maxIncluded\": 30,\n \"keepSiteFields\": [\n \"hostId\",\n \"capturedByHostIds\"\n ]\n },\n {\n \"pluginId\": \"crm\",\n \"name\": \"leads\",\n \"patch\": true,\n \"maxIncluded\": 30,\n \"keepSiteFields\": [\n \"hostId\",\n \"capturedByHostIds\"\n ]\n },\n {\n \"pluginId\": \"crm\",\n \"name\": \"companies\",\n \"patch\": true,\n \"maxIncluded\": 30,\n \"keepSiteFields\": [\n \"hostId\",\n \"capturedByHostIds\"\n ]\n },\n {\n \"pluginId\": \"crm\",\n \"name\": \"deals\",\n \"patch\": true,\n \"maxIncluded\": 30,\n \"keepSiteFields\": [\n \"hostId\",\n \"capturedByHostIds\"\n ]\n },\n {\n \"pluginId\": \"crm\",\n \"name\": \"crmTasks\",\n \"patch\": true,\n \"maxIncluded\": 30,\n \"keepSiteFields\": [\n \"hostId\",\n \"capturedByHostIds\"\n ]\n },\n {\n \"pluginId\": \"crm\",\n \"name\": \"crmActivities\",\n \"maxIncluded\": 30,\n \"keepSiteFields\": [\n \"hostId\",\n \"capturedByHostIds\"\n ]\n },\n {\n \"pluginId\": \"data\",\n \"name\": \"datasets\"\n },\n {\n \"pluginId\": \"marketing\",\n \"name\": \"emailCampaigns\"\n },\n {\n \"pluginId\": \"workflows\",\n \"name\": \"automations\"\n }\n]\n"],"names":["PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED"],"mappings":"AAAA;;;;;;;CAOC,GAID,OAAO,MAAMA,4CAAuF;IAClG;QACE,YAAY;QACZ,QAAQ;QACR,SAAS;QACT,eAAe;QACf,kBAAkB;YAChB;YACA;SACD;IACH;IACA;QACE,YAAY;QACZ,QAAQ;QACR,SAAS;QACT,eAAe;QACf,kBAAkB;YAChB;YACA;SACD;IACH;IACA;QACE,YAAY;QACZ,QAAQ;QACR,SAAS;QACT,eAAe;QACf,kBAAkB;YAChB;YACA;SACD;IACH;IACA;QACE,YAAY;QACZ,QAAQ;QACR,SAAS;QACT,eAAe;QACf,kBAAkB;YAChB;YACA;SACD;IACH;IACA;QACE,YAAY;QACZ,QAAQ;QACR,SAAS;QACT,eAAe;QACf,kBAAkB;YAChB;YACA;SACD;IACH;IACA;QACE,YAAY;QACZ,QAAQ;QACR,eAAe;QACf,kBAAkB;YAChB;YACA;SACD;IACH;IACA;QACE,YAAY;QACZ,QAAQ;IACV;IACA;QACE,YAAY;QACZ,QAAQ;IACV;IACA;QACE,YAAY;QACZ,QAAQ;IACV;CACD,CAAA"}
@@ -0,0 +1,85 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ var _globalScope_PATCHES_KEY;
3
+ /**
4
+ * @license
5
+ * Copyright 2026 Aglyn LLC
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */ /**
19
+ * WHICH COLLECTIONS HOLD DOCUMENTS SHARED WITH "ALL SITES EXCEPT…" (AGL-4047).
20
+ *
21
+ * Such a document names its included sites in `visibleTo`, so that list has
22
+ * to change when a site joins or leaves the workspace. One sweep does that for
23
+ * every collection (`scope-sharing-sweep.ts`), and it can only walk what it
24
+ * has been told about, so a plugin declares its collections in the
25
+ * `scopeSharingCollections` block of `plugins.config.json`, compiled like its
26
+ * other storage. Media belongs to the platform and is listed here.
27
+ *
28
+ * A collection whose documents store fields derived from `visibleTo` declares
29
+ * `patch: true` and registers the function that recomputes them. The sweep
30
+ * refuses to write such a collection while the function is missing, because a
31
+ * `visibleTo` written without them leaves a document its list cannot find.
32
+ */ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
33
+ import { PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED } from "./plugin-scope-sharing.generated.js";
34
+ /** The platform's own: media belongs to no plugin. */ const CORE_SCOPE_SHARING_COLLECTIONS = [
35
+ {
36
+ pluginId: 'core',
37
+ name: 'media'
38
+ },
39
+ {
40
+ pluginId: 'core',
41
+ name: 'mediaFolders'
42
+ }
43
+ ];
44
+ /**
45
+ * Every collection the sweep walks, in a stable order: a sweep's cursor names
46
+ * a position in this list, and resuming relies on the ones before it being done.
47
+ */ export function listScopeSharingCollections() {
48
+ return [
49
+ ...CORE_SCOPE_SHARING_COLLECTIONS,
50
+ ...PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED
51
+ ].map((row)=>_extends({}, row));
52
+ }
53
+ /**
54
+ * One map per process, on `globalThis`, for the reason `plugin-site-resources`
55
+ * gives: the declarations register from `instrumentation.ts`, which Next
56
+ * compiles apart from the route that runs the sweep.
57
+ */ const PATCHES_KEY = Symbol.for('@aglyn/aglyn:plugin-scope-sharing-patches');
58
+ const globalScope = globalThis;
59
+ const patches = (_globalScope_PATCHES_KEY = globalScope[PATCHES_KEY]) != null ? _globalScope_PATCHES_KEY : globalScope[PATCHES_KEY] = new Map();
60
+ /**
61
+ * Registers the patch for collections a plugin declared with `patch: true`.
62
+ * Refuses a collection another plugin declared, or one declared without it.
63
+ */ export function registerPluginScopeSharingPatch(collections, patch, options) {
64
+ var _ref, _getRegisteringPluginId;
65
+ const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
66
+ if (!pluginId) {
67
+ throw new Error('a scope-sharing patch was registered with no owner: pass { pluginId } ' + 'when registering outside a plugin register fn');
68
+ }
69
+ for (const name of collections){
70
+ const declared = PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED.find((row)=>row.name === name);
71
+ if ((declared == null ? void 0 : declared.pluginId) !== pluginId || !declared.patch) {
72
+ throw new Error(`${pluginId} did not declare ${name} with patch: true in scopeSharingCollections`);
73
+ }
74
+ }
75
+ for (const name of collections)patches.set(name, patch);
76
+ }
77
+ /** The patch registered for a collection, or `null`. */ export function scopeSharingPatchFor(collection) {
78
+ var _patches_get;
79
+ return (_patches_get = patches.get(collection)) != null ? _patches_get : null;
80
+ }
81
+ /** Test seam: forget every patch. */ export function resetScopeSharingPatchesForTests() {
82
+ patches.clear();
83
+ }
84
+
85
+ //# sourceMappingURL=plugin-scope-sharing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-scope-sharing.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 * WHICH COLLECTIONS HOLD DOCUMENTS SHARED WITH \"ALL SITES EXCEPT…\" (AGL-4047).\n *\n * Such a document names its included sites in `visibleTo`, so that list has\n * to change when a site joins or leaves the workspace. One sweep does that for\n * every collection (`scope-sharing-sweep.ts`), and it can only walk what it\n * has been told about, so a plugin declares its collections in the\n * `scopeSharingCollections` block of `plugins.config.json`, compiled like its\n * other storage. Media belongs to the platform and is listed here.\n *\n * A collection whose documents store fields derived from `visibleTo` declares\n * `patch: true` and registers the function that recomputes them. The sweep\n * refuses to write such a collection while the function is missing, because a\n * `visibleTo` written without them leaves a document its list cannot find.\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED } from './plugin-scope-sharing.generated'\n\n/** One collection under `orgs/{orgId}` whose documents can be all-except. */\nexport interface ScopeSharingCollection {\n /** The subcollection, spelled as Firestore holds it. */\n name: string\n /** Stored fields follow `visibleTo`: a patch function is registered. */\n patch?: boolean\n /** The most sites one document may reach; past it the list stops widening. */\n maxIncluded?: number\n /** Fields naming sites that stay included though they are excluded. */\n keepSiteFields?: string[]\n}\n\n/** A declaration with its owner; `core` for what the platform holds itself. */\nexport type ResolvedScopeSharingCollection = ScopeSharingCollection & {\n pluginId: string\n}\n\n/** The platform's own: media belongs to no plugin. */\nconst CORE_SCOPE_SHARING_COLLECTIONS: readonly ResolvedScopeSharingCollection[] = [\n { pluginId: 'core', name: 'media' },\n { pluginId: 'core', name: 'mediaFolders' },\n]\n\n/**\n * Every collection the sweep walks, in a stable order: a sweep's cursor names\n * a position in this list, and resuming relies on the ones before it being done.\n */\nexport function listScopeSharingCollections(): ResolvedScopeSharingCollection[] {\n return [\n ...CORE_SCOPE_SHARING_COLLECTIONS,\n ...PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED,\n ].map((row) => ({ ...row }))\n}\n\n/**\n * Recomputes the fields a document derives from its scope: `next` is the whole\n * document as it will be stored, and the answer is merged into the write.\n */\nexport type ScopeSharingPatch = (\n collection: string,\n next: Record<string, unknown>,\n) => Promise<Record<string, unknown>> | Record<string, unknown>\n\n/**\n * One map per process, on `globalThis`, for the reason `plugin-site-resources`\n * gives: the declarations register from `instrumentation.ts`, which Next\n * compiles apart from the route that runs the sweep.\n */\nconst PATCHES_KEY = Symbol.for('@aglyn/aglyn:plugin-scope-sharing-patches')\n\nconst globalScope = globalThis as typeof globalThis & {\n [PATCHES_KEY]?: Map<string, ScopeSharingPatch>\n}\n\nconst patches: Map<string, ScopeSharingPatch> =\n globalScope[PATCHES_KEY] ?? (globalScope[PATCHES_KEY] = new Map())\n\n/**\n * Registers the patch for collections a plugin declared with `patch: true`.\n * Refuses a collection another plugin declared, or one declared without it.\n */\nexport function registerPluginScopeSharingPatch(\n collections: readonly string[],\n patch: ScopeSharingPatch,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'a scope-sharing patch was registered with no owner: pass { pluginId } ' +\n 'when registering outside a plugin register fn',\n )\n }\n for (const name of collections) {\n const declared = PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED.find((row) => row.name === name)\n if (declared?.pluginId !== pluginId || !declared.patch) {\n throw new Error(`${pluginId} did not declare ${name} with patch: true in scopeSharingCollections`)\n }\n }\n for (const name of collections) patches.set(name, patch)\n}\n\n/** The patch registered for a collection, or `null`. */\nexport function scopeSharingPatchFor(collection: string): ScopeSharingPatch | null {\n return patches.get(collection) ?? null\n}\n\n/** Test seam: forget every patch. */\nexport function resetScopeSharingPatchesForTests(): void {\n patches.clear()\n}\n"],"names":["globalScope","getRegisteringPluginId","PLUGIN_SCOPE_SHARING_COLLECTIONS_DECLARED","CORE_SCOPE_SHARING_COLLECTIONS","pluginId","name","listScopeSharingCollections","map","row","PATCHES_KEY","Symbol","for","globalThis","patches","Map","registerPluginScopeSharingPatch","collections","patch","options","trim","Error","declared","find","set","scopeSharingPatchFor","collection","get","resetScopeSharingPatchesForTests","clear"],"mappings":";IA2FEA;AA3FF;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SAASC,yCAAyC,QAAQ,sCAAkC;AAmB5F,oDAAoD,GACpD,MAAMC,iCAA4E;IAChF;QAAEC,UAAU;QAAQC,MAAM;IAAQ;IAClC;QAAED,UAAU;QAAQC,MAAM;IAAe;CAC1C;AAED;;;CAGC,GACD,OAAO,SAASC;IACd,OAAO;WACFH;WACAD;KACJ,CAACK,GAAG,CAAC,CAACC,MAAS,aAAKA;AACvB;AAWA;;;;CAIC,GACD,MAAMC,cAAcC,OAAOC,GAAG,CAAC;AAE/B,MAAMX,cAAcY;AAIpB,MAAMC,WACJb,2BAAAA,WAAW,CAACS,YAAY,YAAxBT,2BAA6BA,WAAW,CAACS,YAAY,GAAG,IAAIK;AAE9D;;;CAGC,GACD,OAAO,SAASC,gCACdC,WAA8B,EAC9BC,KAAwB,EACxBC,OAA+B;QAEbjB,MAAAA;IAAlB,MAAMG,WAAW,EAACH,QAAAA,0BAAAA,oCAAAA,0BAA4BiB,2BAAAA,QAASd,QAAQ,YAA7CH,OAAiD,IAAIkB,IAAI;IAC3E,IAAI,CAACf,UAAU;QACb,MAAM,IAAIgB,MACR,2EACE;IAEN;IACA,KAAK,MAAMf,QAAQW,YAAa;QAC9B,MAAMK,WAAWnB,0CAA0CoB,IAAI,CAAC,CAACd,MAAQA,IAAIH,IAAI,KAAKA;QACtF,IAAIgB,CAAAA,4BAAAA,SAAUjB,QAAQ,MAAKA,YAAY,CAACiB,SAASJ,KAAK,EAAE;YACtD,MAAM,IAAIG,MAAM,GAAGhB,SAAS,iBAAiB,EAAEC,KAAK,4CAA4C,CAAC;QACnG;IACF;IACA,KAAK,MAAMA,QAAQW,YAAaH,QAAQU,GAAG,CAAClB,MAAMY;AACpD;AAEA,sDAAsD,GACtD,OAAO,SAASO,qBAAqBC,UAAkB;QAC9CZ;IAAP,QAAOA,eAAAA,QAAQa,GAAG,CAACD,uBAAZZ,eAA2B;AACpC;AAEA,mCAAmC,GACnC,OAAO,SAASc;IACdd,QAAQe,KAAK;AACf"}
@@ -53,6 +53,13 @@ export interface SiteStarterSummary {
53
53
  * say; a free starter needs no purchase either way.
54
54
  */
55
55
  owned?: boolean;
56
+ /**
57
+ * Why this person cannot buy it, in one sentence, when the source knows they
58
+ * cannot (AGL-4047). The surface keeps Buy on screen, switched off, with
59
+ * these words; absent, anyone may buy it. Read for the person who asked, like
60
+ * `owned`.
61
+ */
62
+ buyBlockedReason?: string;
56
63
  }
57
64
  /** Who is asking: the workspace the site will belong to, and the person. */
58
65
  export interface SiteStarterViewer {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-starters.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 type {\n SiteStarterChoice,\n SiteStarterFacets,\n SiteStarterPayload,\n} from '../app-utils/site-starter'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginService,\n} from './plugin-services'\n\n/**\n * Where site starters come from, as the console's SERVER reads them\n * (AGL-4049).\n *\n * \"Create site\" offers a starter for every site, chosen before the site\n * exists, and the site is created from the one picked. The starters are\n * listings a plugin keeps — searched, priced and bought there — so the core\n * names the two questions the create path asks and one plugin answers them:\n * which starters match a search, and what a picked one creates. With none\n * registered there are no starters to offer, and the create path keeps its\n * own default site.\n */\n\n/** One starter as a search lists it. */\nexport interface SiteStarterSummary {\n listingId: string\n displayName: string\n description: string\n /** Who made it, as the search shows them. */\n authorName: string\n /** Published by the platform itself; listed first. */\n official: boolean\n /** The price in US dollars; 0 for free. */\n priceUsd: number\n previewImageUrl: string | null\n facets: SiteStarterFacets\n /**\n * What kind of site it is, in words a card shows (\"Restaurant & café\"), or\n * `null` where it names none. Optional: a source with no such words still\n * satisfies the seam, and `facets.kind` stays the id a search filters on.\n */\n category?: string | null\n /**\n * The asking workspace may create from it without paying (AGL-4049):\n * bought already, or its own. Read for the person who asked, so it is set\n * only by an answer that knows who that is, and absent where it does not\n * say; a free starter needs no purchase either way.\n */\n owned?: boolean\n}\n\n/** Who is asking: the workspace the site will belong to, and the person. */\nexport interface SiteStarterViewer {\n orgId: string | null\n uid: string\n}\n\nexport interface PluginSiteStarterSource {\n /** The starters matching a search, best first, at most `limit` of them. */\n search(\n input: { word: string; filter: Partial<SiteStarterFacets>; limit: number },\n viewer: SiteStarterViewer,\n ): Promise<SiteStarterSummary[]>\n /**\n * What a picked starter creates, or why this viewer cannot have it: 402\n * while a priced starter is unpaid (with its price), 403 when the viewer may\n * not install it, 404 when it is gone.\n */\n resolve(\n choice: SiteStarterChoice,\n viewer: SiteStarterViewer,\n ): Promise<SiteStarterPayload | { error: string; status: 402 | 403 | 404; priceUsd?: number }>\n /**\n * Records that a site was created from a starter; best-effort, never throws.\n * Optional, so a source that does not count installs still satisfies the seam.\n */\n installed?(choice: SiteStarterChoice, viewer: SiteStarterViewer, site: { hostId: string }): Promise<void>\n /**\n * One starter as a search would list it for this viewer, or `null` when it\n * is not one they may see (AGL-4049): what the create path records a site\n * was started from, and the name it files the starter's theme under, and\n * what \"Choose your starter\" shows for a pick it restores. Best-effort.\n * Optional, so a source that cannot describe a single listing still\n * satisfies the seam; read it through {@link describeSiteStarter}.\n */\n describe?(choice: SiteStarterChoice, viewer: SiteStarterViewer): Promise<SiteStarterSummary | null>\n}\n\nexport const PLUGIN_SITE_STARTERS = definePluginServiceContract<PluginSiteStarterSource>(\n 'core.site-starters',\n { multiple: false },\n)\n\n/** Registers the plugin that serves site starters. One per deployment; a second is refused. */\nexport function registerPluginSiteStarterSource(\n impl: PluginSiteStarterSource,\n options: { pluginId: string },\n): void {\n registerPluginService(PLUGIN_SITE_STARTERS, impl, { pluginId: options.pluginId })\n}\n\n/** The registered starter source, or `null` when no plugin serves starters. */\nexport function resolveSiteStarterSource(): PluginSiteStarterSource | null {\n return resolvePluginService(PLUGIN_SITE_STARTERS) ?? null\n}\n\n/**\n * A starter as the source describes it, or `null` when the source cannot say\n * (AGL-4049): no `describe`, a listing the viewer may not see, or a source\n * that failed. Never throws, because nothing it answers is required: the\n * create path falls back to the payload's own facts, and the picker to the\n * search.\n */\nexport async function describeSiteStarter(\n source: PluginSiteStarterSource | null,\n choice: SiteStarterChoice,\n viewer: SiteStarterViewer,\n): Promise<SiteStarterSummary | null> {\n if (!source?.describe || !choice?.listingId) return null\n try {\n const summary = await source.describe(choice, viewer)\n return summary && typeof summary === 'object' && summary.listingId === choice.listingId ? summary : null\n } catch (error) {\n console.error('[site-starters] describe failed', { listingId: choice.listingId, error })\n return null\n }\n}\n"],"names":["definePluginServiceContract","registerPluginService","resolvePluginService","PLUGIN_SITE_STARTERS","multiple","registerPluginSiteStarterSource","impl","options","pluginId","resolveSiteStarterSource","describeSiteStarter","source","choice","viewer","describe","listingId","summary","error","console"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAOD,SACEA,2BAA2B,EAC3BC,qBAAqB,EACrBC,oBAAoB,QACf,uBAAmB;AAgF1B,OAAO,MAAMC,uBAAuBH,4BAClC,sBACA;IAAEI,UAAU;AAAM,GACnB;AAED,6FAA6F,GAC7F,OAAO,SAASC,gCACdC,IAA6B,EAC7BC,OAA6B;IAE7BN,sBAAsBE,sBAAsBG,MAAM;QAAEE,UAAUD,QAAQC,QAAQ;IAAC;AACjF;AAEA,6EAA6E,GAC7E,OAAO,SAASC;QACPP;IAAP,QAAOA,wBAAAA,qBAAqBC,iCAArBD,wBAA8C;AACvD;AAEA;;;;;;CAMC,GACD,OAAO,eAAeQ,oBACpBC,MAAsC,EACtCC,MAAyB,EACzBC,MAAyB;IAEzB,IAAI,EAACF,0BAAAA,OAAQG,QAAQ,KAAI,EAACF,0BAAAA,OAAQG,SAAS,GAAE,OAAO;IACpD,IAAI;QACF,MAAMC,UAAU,MAAML,OAAOG,QAAQ,CAACF,QAAQC;QAC9C,OAAOG,WAAW,OAAOA,YAAY,YAAYA,QAAQD,SAAS,KAAKH,OAAOG,SAAS,GAAGC,UAAU;IACtG,EAAE,OAAOC,OAAO;QACdC,QAAQD,KAAK,CAAC,mCAAmC;YAAEF,WAAWH,OAAOG,SAAS;YAAEE;QAAM;QACtF,OAAO;IACT;AACF"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-starters.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 type {\n SiteStarterChoice,\n SiteStarterFacets,\n SiteStarterPayload,\n} from '../app-utils/site-starter'\nimport {\n definePluginServiceContract,\n registerPluginService,\n resolvePluginService,\n} from './plugin-services'\n\n/**\n * Where site starters come from, as the console's SERVER reads them\n * (AGL-4049).\n *\n * \"Create site\" offers a starter for every site, chosen before the site\n * exists, and the site is created from the one picked. The starters are\n * listings a plugin keeps — searched, priced and bought there — so the core\n * names the two questions the create path asks and one plugin answers them:\n * which starters match a search, and what a picked one creates. With none\n * registered there are no starters to offer, and the create path keeps its\n * own default site.\n */\n\n/** One starter as a search lists it. */\nexport interface SiteStarterSummary {\n listingId: string\n displayName: string\n description: string\n /** Who made it, as the search shows them. */\n authorName: string\n /** Published by the platform itself; listed first. */\n official: boolean\n /** The price in US dollars; 0 for free. */\n priceUsd: number\n previewImageUrl: string | null\n facets: SiteStarterFacets\n /**\n * What kind of site it is, in words a card shows (\"Restaurant & café\"), or\n * `null` where it names none. Optional: a source with no such words still\n * satisfies the seam, and `facets.kind` stays the id a search filters on.\n */\n category?: string | null\n /**\n * The asking workspace may create from it without paying (AGL-4049):\n * bought already, or its own. Read for the person who asked, so it is set\n * only by an answer that knows who that is, and absent where it does not\n * say; a free starter needs no purchase either way.\n */\n owned?: boolean\n /**\n * Why this person cannot buy it, in one sentence, when the source knows they\n * cannot (AGL-4047). The surface keeps Buy on screen, switched off, with\n * these words; absent, anyone may buy it. Read for the person who asked, like\n * `owned`.\n */\n buyBlockedReason?: string\n}\n\n/** Who is asking: the workspace the site will belong to, and the person. */\nexport interface SiteStarterViewer {\n orgId: string | null\n uid: string\n}\n\nexport interface PluginSiteStarterSource {\n /** The starters matching a search, best first, at most `limit` of them. */\n search(\n input: { word: string; filter: Partial<SiteStarterFacets>; limit: number },\n viewer: SiteStarterViewer,\n ): Promise<SiteStarterSummary[]>\n /**\n * What a picked starter creates, or why this viewer cannot have it: 402\n * while a priced starter is unpaid (with its price), 403 when the viewer may\n * not install it, 404 when it is gone.\n */\n resolve(\n choice: SiteStarterChoice,\n viewer: SiteStarterViewer,\n ): Promise<SiteStarterPayload | { error: string; status: 402 | 403 | 404; priceUsd?: number }>\n /**\n * Records that a site was created from a starter; best-effort, never throws.\n * Optional, so a source that does not count installs still satisfies the seam.\n */\n installed?(choice: SiteStarterChoice, viewer: SiteStarterViewer, site: { hostId: string }): Promise<void>\n /**\n * One starter as a search would list it for this viewer, or `null` when it\n * is not one they may see (AGL-4049): what the create path records a site\n * was started from, and the name it files the starter's theme under, and\n * what \"Choose your starter\" shows for a pick it restores. Best-effort.\n * Optional, so a source that cannot describe a single listing still\n * satisfies the seam; read it through {@link describeSiteStarter}.\n */\n describe?(choice: SiteStarterChoice, viewer: SiteStarterViewer): Promise<SiteStarterSummary | null>\n}\n\nexport const PLUGIN_SITE_STARTERS = definePluginServiceContract<PluginSiteStarterSource>(\n 'core.site-starters',\n { multiple: false },\n)\n\n/** Registers the plugin that serves site starters. One per deployment; a second is refused. */\nexport function registerPluginSiteStarterSource(\n impl: PluginSiteStarterSource,\n options: { pluginId: string },\n): void {\n registerPluginService(PLUGIN_SITE_STARTERS, impl, { pluginId: options.pluginId })\n}\n\n/** The registered starter source, or `null` when no plugin serves starters. */\nexport function resolveSiteStarterSource(): PluginSiteStarterSource | null {\n return resolvePluginService(PLUGIN_SITE_STARTERS) ?? null\n}\n\n/**\n * A starter as the source describes it, or `null` when the source cannot say\n * (AGL-4049): no `describe`, a listing the viewer may not see, or a source\n * that failed. Never throws, because nothing it answers is required: the\n * create path falls back to the payload's own facts, and the picker to the\n * search.\n */\nexport async function describeSiteStarter(\n source: PluginSiteStarterSource | null,\n choice: SiteStarterChoice,\n viewer: SiteStarterViewer,\n): Promise<SiteStarterSummary | null> {\n if (!source?.describe || !choice?.listingId) return null\n try {\n const summary = await source.describe(choice, viewer)\n return summary && typeof summary === 'object' && summary.listingId === choice.listingId ? summary : null\n } catch (error) {\n console.error('[site-starters] describe failed', { listingId: choice.listingId, error })\n return null\n }\n}\n"],"names":["definePluginServiceContract","registerPluginService","resolvePluginService","PLUGIN_SITE_STARTERS","multiple","registerPluginSiteStarterSource","impl","options","pluginId","resolveSiteStarterSource","describeSiteStarter","source","choice","viewer","describe","listingId","summary","error","console"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAOD,SACEA,2BAA2B,EAC3BC,qBAAqB,EACrBC,oBAAoB,QACf,uBAAmB;AAuF1B,OAAO,MAAMC,uBAAuBH,4BAClC,sBACA;IAAEI,UAAU;AAAM,GACnB;AAED,6FAA6F,GAC7F,OAAO,SAASC,gCACdC,IAA6B,EAC7BC,OAA6B;IAE7BN,sBAAsBE,sBAAsBG,MAAM;QAAEE,UAAUD,QAAQC,QAAQ;IAAC;AACjF;AAEA,6EAA6E,GAC7E,OAAO,SAASC;QACPP;IAAP,QAAOA,wBAAAA,qBAAqBC,iCAArBD,wBAA8C;AACvD;AAEA;;;;;;CAMC,GACD,OAAO,eAAeQ,oBACpBC,MAAsC,EACtCC,MAAyB,EACzBC,MAAyB;IAEzB,IAAI,EAACF,0BAAAA,OAAQG,QAAQ,KAAI,EAACF,0BAAAA,OAAQG,SAAS,GAAE,OAAO;IACpD,IAAI;QACF,MAAMC,UAAU,MAAML,OAAOG,QAAQ,CAACF,QAAQC;QAC9C,OAAOG,WAAW,OAAOA,YAAY,YAAYA,QAAQD,SAAS,KAAKH,OAAOG,SAAS,GAAGC,UAAU;IACtG,EAAE,OAAOC,OAAO;QACdC,QAAQD,KAAK,CAAC,mCAAmC;YAAEF,WAAWH,OAAOG,SAAS;YAAEE;QAAM;QACtF,OAAO;IACT;AACF"}
@@ -29,6 +29,7 @@ import type { TransferChunk, TransferRowResult, TransferUndoEntry, TransferUndoS
29
29
  import { type TransferField, type TransferResourceDescriptor } from '../data-transfer/resource';
30
30
  import { type TransferPlanRequiredResponse } from '../data-transfer/transfer-api';
31
31
  import type { MdiIconProps } from '../types/nodes';
32
+ import type { PluginIndexedRecord } from './plugin-record-index';
32
33
  /**
33
34
  * WHAT A PLUGIN CAN IMPORT AND EXPORT (AGL-3523), the extension point every
34
35
  * import wizard, export dialog and transfer job reads.
@@ -497,7 +498,7 @@ export interface TransferPackageHooks<T = unknown> {
497
498
  * {@link TransferPackageHooks} member — checked against the declaration at
498
499
  * registration.
499
500
  */
500
- export type PluginTransferResource = Partial<TransferRecordsHooks> & Partial<TransferPackageHooks> & TransferPlanGateHooks;
501
+ export type PluginTransferResource = Partial<TransferRecordsHooks> & TransferImportAccessHooks & Partial<TransferPackageHooks> & TransferPlanGateHooks;
501
502
  /** The workspace a plan question is asked about, as the gate read it. */
502
503
  export interface TransferPlanSubject {
503
504
  /** The resource key, naming the instance for one declared with `instances`. */
@@ -524,6 +525,40 @@ export interface TransferPlanGateHooks {
524
525
  */
525
526
  planGate?(subject: TransferPlanSubject, intent: TransferAccessIntent): Promise<TransferPlanRefusal | null> | TransferPlanRefusal | null;
526
527
  }
528
+ /** Who is asking to import into a resource, as the gate read them. */
529
+ export interface TransferImportAccessSubject {
530
+ /** The resource key, naming the instance for one declared with `instances`. */
531
+ resource: string;
532
+ orgId: string;
533
+ uid: string;
534
+ /** The caller's workspace membership. */
535
+ member: Readonly<Record<string, unknown>>;
536
+ }
537
+ /** The import hook a resource may answer with, beside its kind's. */
538
+ export interface TransferImportAccessHooks {
539
+ /**
540
+ * Whether this member may import into THIS instance of the resource
541
+ * (AGL-4047), in place of `data.manage` on the workspace: for records whose
542
+ * answer depends on where the instance is placed, which the declaration
543
+ * cannot say. Answers the refusal's permission key when it refuses, so the
544
+ * gate names the right one. May read the database and load its module with
545
+ * its first call.
546
+ */
547
+ importAccess?(subject: TransferImportAccessSubject): Promise<TransferImportAccessVerdict> | TransferImportAccessVerdict;
548
+ }
549
+ /** A resource's own answer on importing: allowed, or the permission that is missing. */
550
+ export type TransferImportAccessVerdict = {
551
+ allowed: true;
552
+ } | {
553
+ allowed: false;
554
+ permission: string;
555
+ };
556
+ /**
557
+ * The resource's own answer on importing into this instance, or `null` when
558
+ * it has none (or its server half cannot be reached, which the route that
559
+ * needs it answers) and the gate's `data.manage` stands.
560
+ */
561
+ export declare function transferImportAccess(subject: TransferImportAccessSubject): Promise<TransferImportAccessVerdict | null>;
527
562
  /**
528
563
  * The refusal a resource with no `planGate` gets: its plan feature as
529
564
  * `code`, and a sentence naming the plan that includes it, from the same
@@ -681,6 +716,26 @@ export interface PluginTransferResourceUi {
681
716
  * resource to the plugin's own surface.
682
717
  */
683
718
  instancesFrom?: string;
719
+ /**
720
+ * For a resource whose server half answers `importAccess`: that answer for one
721
+ * instance the hub lists, from what the browser already holds, so its Import
722
+ * says what the route will. Not a security boundary: the route still decides.
723
+ */
724
+ instanceImportAccess?(subject: TransferInstanceImportSubject): TransferInstanceImportAnswer;
725
+ }
726
+ /** What a resource is asked about one listed instance. */
727
+ export interface TransferInstanceImportSubject {
728
+ /** The instance, as its record list reads it. */
729
+ record: PluginIndexedRecord;
730
+ /** The signed-in member's document. */
731
+ member: Readonly<Record<string, unknown>>;
732
+ /** Their custom role, when they carry one and it could be read. */
733
+ customRole: Readonly<Record<string, unknown>> | null;
734
+ }
735
+ /** The answer, and the refusal to show beside a switched-off Import. */
736
+ export interface TransferInstanceImportAnswer {
737
+ allowed: boolean;
738
+ reason: string;
684
739
  }
685
740
  /**
686
741
  * Registers the client half of a resource the plugin declared, from its
@@ -52,6 +52,19 @@ import { runPluginDeclarationsRepair } from "./plugin-declarations-repair.js";
52
52
  }) : enabled);
53
53
  return listDeclaredTransferResources().filter((one)=>one.scope === subject.scope && running.has(one.pluginId));
54
54
  }
55
+ /**
56
+ * The resource's own answer on importing into this instance, or `null` when
57
+ * it has none (or its server half cannot be reached, which the route that
58
+ * needs it answers) and the gate's `data.manage` stands.
59
+ */ export async function transferImportAccess(subject) {
60
+ let hook;
61
+ try {
62
+ hook = (await resolveTransferResource(subject.resource)).impl.importAccess;
63
+ } catch (unused) {
64
+ hook = undefined;
65
+ }
66
+ return hook ? hook(subject) : null;
67
+ }
55
68
  /** "Companies" → "companies", "CRM fields" unchanged: the label inside a sentence. */ function inSentence(label) {
56
69
  return /^[A-Z][a-z]/.test(label) ? label.charAt(0).toLowerCase() + label.slice(1) : label;
57
70
  }