@aglyn/aglyn 1.20.0 → 1.20.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.
@@ -14,6 +14,25 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { PLUGIN_HOST_KEYED_COLLECTIONS } from './first-party-plugins.generated';
18
+ export { PLUGIN_HOST_KEYED_COLLECTIONS };
19
+ /**
20
+ * A plugin's top-level collection whose documents name one site in a field
21
+ * and no organization (AGL-4214): a POS register's customer-display state, its
22
+ * pairing codes and its tokens. Neither the site's tree nor a workspace sweep
23
+ * by `orgId` reaches them, so the owner declares them in `plugins.config.json`
24
+ * (`hostKeyedCollections`) and `eraseHost` sweeps each by that field. Compiled
25
+ * rather than registered, because a site delete cannot rely on the owner
26
+ * being loaded in the process doing it.
27
+ */
28
+ export interface PluginHostKeyedCollection {
29
+ /** The plugin that declared it. */
30
+ pluginId: string;
31
+ /** The top-level collection. */
32
+ name: string;
33
+ /** The field naming the site a document belongs to. */
34
+ siteField: string;
35
+ }
17
36
  /** The site a preview or an erase is about, and the workspace that owns it. */
18
37
  export interface PluginSiteResourceRequest {
19
38
  orgId: string;
@@ -43,6 +43,8 @@ var _globalScope_ERASERS_KEY;
43
43
  * in every server process that can delete a site.
44
44
  */ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
45
45
  import { runPluginDeclarationsRepair } from "./plugin-declarations-repair.js";
46
+ import { PLUGIN_HOST_KEYED_COLLECTIONS } from "./first-party-plugins.generated.js";
47
+ export { PLUGIN_HOST_KEYED_COLLECTIONS };
46
48
  /**
47
49
  * One list per process, on `globalThis` (AGL-3464): the app registers its
48
50
  * plugins' declarations from `instrumentation.ts`, which Next compiles apart
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-resources.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 * A PLUGIN'S SHARE OF DELETING A SITE (AGL-4003).\n *\n * Deleting a site (`eraseHost`) destroys what the platform holds for it: its\n * document tree, its Storage, its routing, and the organization documents a\n * plugin declares as the site's (`orgCollections` with a `siteField`). Some\n * plugin resources belong to the ORGANIZATION and are shared with sites by a\n * scope list instead — a dataset shared with one site, or with several. Which\n * of those are the site's own, and what becomes of the rest, is the plugin's\n * to say, so the plugin registers a site-resource eraser here:\n *\n * - `preview` lists what deleting the site would take — the resources shared\n * with this site alone, each with how many items it holds — and how many it\n * shares with other sites, which stay. The Delete site card shows it before\n * anyone confirms, so it must change nothing.\n * - `erase` erases the resources shared with this site alone, items and all,\n * and takes the site off the sharing of the ones it shares with others. It\n * answers how many it erased.\n *\n * Erasers run in registration order and are ISOLATED, like every trailing\n * cleanup of a site delete: a throw is logged against its plugin and does not\n * stop the next one or the delete. A preview that throws is reported as\n * `null` for its plugin, so the card can say the list is incomplete rather\n * than show an empty one.\n *\n * Registered from a plugin's `serverDeclarations`, so the eraser is in place\n * in every server process that can delete a site.\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { runPluginDeclarationsRepair } from './plugin-declarations-repair'\n\n/** The site a preview or an erase is about, and the workspace that owns it. */\nexport interface PluginSiteResourceRequest {\n orgId: string\n hostId: string\n}\n\n/** One resource that goes with the site. */\nexport interface PluginSiteResourceGoing {\n id: string\n /** Its name, as the plugin's own page shows it. */\n name: string\n /** How many items it holds; `null` where they could not be counted. */\n items: number | null\n}\n\n/** What deleting the site does to one plugin's resources. */\nexport interface PluginSiteResourcePreview {\n /** What one resource is called, and several: `['dataset', 'datasets']`. */\n noun: readonly [string, string]\n /** What one of its items is called, and several: `['record', 'records']`. */\n itemNoun: readonly [string, string]\n /** Shared with this site alone: erased with every item. */\n going: PluginSiteResourceGoing[]\n /** Shared with this site and others: they stay, and lose this site. */\n staying: number\n}\n\nexport interface PluginSiteResourceEraser {\n /** What deleting the site would take. Reads only. */\n preview(request: PluginSiteResourceRequest): Promise<PluginSiteResourcePreview>\n /** Erases the site's own resources; answers how many it erased. */\n erase(request: PluginSiteResourceRequest): Promise<number>\n}\n\ninterface Registration {\n pluginId: string\n eraser: PluginSiteResourceEraser\n}\n\n/**\n * One list per process, on `globalThis` (AGL-3464): the app registers its\n * plugins' declarations from `instrumentation.ts`, which Next compiles apart\n * from the route that deletes a site, and a module-scoped list is filled in\n * one copy and read empty in the other.\n */\nconst ERASERS_KEY = Symbol.for('@aglyn/aglyn:plugin-site-resource-erasers')\n\nconst globalScope = globalThis as typeof globalThis & {\n [ERASERS_KEY]?: Registration[]\n}\n\nconst registrations: Registration[] =\n globalScope[ERASERS_KEY] ?? (globalScope[ERASERS_KEY] = [])\n\n/**\n * Registers a plugin's site-resource eraser. Owner = the loader's marker\n * inside a register fn, else `options.pluginId`; an eraser with neither\n * throws. One per plugin: registering again replaces the plugin's earlier\n * eraser in place, so a module evaluated twice does not erase twice.\n */\nexport function registerPluginSiteResourceEraser(\n eraser: PluginSiteResourceEraser,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'a plugin site-resource eraser was registered with no owner: pass ' +\n '{ pluginId } when registering outside a plugin register fn',\n )\n }\n if (typeof eraser?.preview !== 'function' || typeof eraser?.erase !== 'function') {\n throw new Error('a site-resource eraser needs a preview and an erase function')\n }\n const index = registrations.findIndex((entry) => entry.pluginId === pluginId)\n if (index >= 0) registrations[index] = { pluginId, eraser }\n else registrations.push({ pluginId, eraser })\n}\n\n/**\n * The erasers in place, after running the app's boot step once when none is:\n * a boot whose declarations failed must not read as a workspace with nothing\n * shared with the site.\n */\nasync function registered(): Promise<Registration[]> {\n if (!registrations.length) {\n await runPluginDeclarationsRepair().catch((error: unknown) => {\n console.error('[plugins] the declarations repair failed before a site delete', error)\n })\n }\n return [...registrations]\n}\n\n/** One plugin's preview, or `null` where its preview failed. */\nexport interface PluginSiteResourcePreviewRow {\n pluginId: string\n preview: PluginSiteResourcePreview | null\n}\n\n/**\n * Every plugin's preview, in registration order. Never throws: a preview that\n * fails is logged and answered as `null` for its plugin.\n */\nexport async function previewPluginSiteResources(\n request: PluginSiteResourceRequest,\n): Promise<PluginSiteResourcePreviewRow[]> {\n const rows: PluginSiteResourcePreviewRow[] = []\n for (const { pluginId, eraser } of await registered()) {\n try {\n rows.push({ pluginId, preview: await eraser.preview(request) })\n } catch (error) {\n console.error(\n `[plugins] ${pluginId} could not list what goes with site ${request.hostId}`,\n error,\n )\n rows.push({ pluginId, preview: null })\n }\n }\n return rows\n}\n\n/**\n * Runs every eraser, in registration order, and answers how many resources\n * each erased by plugin id, or `null` for one that threw. Never throws.\n */\nexport async function erasePluginSiteResources(\n request: PluginSiteResourceRequest,\n): Promise<Record<string, number | null>> {\n const erased: Record<string, number | null> = {}\n for (const { pluginId, eraser } of await registered()) {\n try {\n erased[pluginId] = await eraser.erase(request)\n } catch (error) {\n erased[pluginId] = null\n console.error(`[plugins] ${pluginId} failed to erase site ${request.hostId}'s resources`, error)\n }\n }\n return erased\n}\n\n/** The plugins with a site-resource eraser, in the order they run. */\nexport function listPluginSiteResourceErasers(): string[] {\n return registrations.map((entry) => entry.pluginId)\n}\n\n/** Test seam: forget every eraser. */\nexport function resetPluginSiteResourceErasersForTests(): void {\n registrations.length = 0\n}\n"],"names":["globalScope","getRegisteringPluginId","runPluginDeclarationsRepair","ERASERS_KEY","Symbol","for","globalThis","registrations","registerPluginSiteResourceEraser","eraser","options","pluginId","trim","Error","preview","erase","index","findIndex","entry","push","registered","length","catch","error","console","previewPluginSiteResources","request","rows","hostId","erasePluginSiteResources","erased","listPluginSiteResourceErasers","map","resetPluginSiteResourceErasersForTests"],"mappings":"IAqGEA;AArGF;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GAED,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SAASC,2BAA2B,QAAQ,kCAA8B;AAyC1E;;;;;CAKC,GACD,MAAMC,cAAcC,OAAOC,GAAG,CAAC;AAE/B,MAAML,cAAcM;AAIpB,MAAMC,iBACJP,2BAAAA,WAAW,CAACG,YAAY,YAAxBH,2BAA6BA,WAAW,CAACG,YAAY,GAAG,EAAE;AAE5D;;;;;CAKC,GACD,OAAO,SAASK,iCACdC,MAAgC,EAChCC,OAA+B;QAEbT,MAAAA;IAAlB,MAAMU,WAAW,EAACV,QAAAA,0BAAAA,oCAAAA,0BAA4BS,2BAAAA,QAASC,QAAQ,YAA7CV,OAAiD,IAAIW,IAAI;IAC3E,IAAI,CAACD,UAAU;QACb,MAAM,IAAIE,MACR,sEACE;IAEN;IACA,IAAI,QAAOJ,0BAAAA,OAAQK,OAAO,MAAK,cAAc,QAAOL,0BAAAA,OAAQM,KAAK,MAAK,YAAY;QAChF,MAAM,IAAIF,MAAM;IAClB;IACA,MAAMG,QAAQT,cAAcU,SAAS,CAAC,CAACC,QAAUA,MAAMP,QAAQ,KAAKA;IACpE,IAAIK,SAAS,GAAGT,aAAa,CAACS,MAAM,GAAG;QAAEL;QAAUF;IAAO;SACrDF,cAAcY,IAAI,CAAC;QAAER;QAAUF;IAAO;AAC7C;AAEA;;;;CAIC,GACD,eAAeW;IACb,IAAI,CAACb,cAAcc,MAAM,EAAE;QACzB,MAAMnB,8BAA8BoB,KAAK,CAAC,CAACC;YACzCC,QAAQD,KAAK,CAAC,iEAAiEA;QACjF;IACF;IACA,OAAO;WAAIhB;KAAc;AAC3B;AAQA;;;CAGC,GACD,OAAO,eAAekB,2BACpBC,OAAkC;IAElC,MAAMC,OAAuC,EAAE;IAC/C,KAAK,MAAM,EAAEhB,QAAQ,EAAEF,MAAM,EAAE,IAAI,CAAA,MAAMW,YAAW,EAAG;QACrD,IAAI;YACFO,KAAKR,IAAI,CAAC;gBAAER;gBAAUG,SAAS,MAAML,OAAOK,OAAO,CAACY;YAAS;QAC/D,EAAE,OAAOH,OAAO;YACdC,QAAQD,KAAK,CACX,CAAC,UAAU,EAAEZ,SAAS,oCAAoC,EAAEe,QAAQE,MAAM,EAAE,EAC5EL;YAEFI,KAAKR,IAAI,CAAC;gBAAER;gBAAUG,SAAS;YAAK;QACtC;IACF;IACA,OAAOa;AACT;AAEA;;;CAGC,GACD,OAAO,eAAeE,yBACpBH,OAAkC;IAElC,MAAMI,SAAwC,CAAC;IAC/C,KAAK,MAAM,EAAEnB,QAAQ,EAAEF,MAAM,EAAE,IAAI,CAAA,MAAMW,YAAW,EAAG;QACrD,IAAI;YACFU,MAAM,CAACnB,SAAS,GAAG,MAAMF,OAAOM,KAAK,CAACW;QACxC,EAAE,OAAOH,OAAO;YACdO,MAAM,CAACnB,SAAS,GAAG;YACnBa,QAAQD,KAAK,CAAC,CAAC,UAAU,EAAEZ,SAAS,sBAAsB,EAAEe,QAAQE,MAAM,CAAC,YAAY,CAAC,EAAEL;QAC5F;IACF;IACA,OAAOO;AACT;AAEA,oEAAoE,GACpE,OAAO,SAASC;IACd,OAAOxB,cAAcyB,GAAG,CAAC,CAACd,QAAUA,MAAMP,QAAQ;AACpD;AAEA,oCAAoC,GACpC,OAAO,SAASsB;IACd1B,cAAcc,MAAM,GAAG;AACzB"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-site-resources.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 * A PLUGIN'S SHARE OF DELETING A SITE (AGL-4003).\n *\n * Deleting a site (`eraseHost`) destroys what the platform holds for it: its\n * document tree, its Storage, its routing, and the organization documents a\n * plugin declares as the site's (`orgCollections` with a `siteField`). Some\n * plugin resources belong to the ORGANIZATION and are shared with sites by a\n * scope list instead — a dataset shared with one site, or with several. Which\n * of those are the site's own, and what becomes of the rest, is the plugin's\n * to say, so the plugin registers a site-resource eraser here:\n *\n * - `preview` lists what deleting the site would take — the resources shared\n * with this site alone, each with how many items it holds — and how many it\n * shares with other sites, which stay. The Delete site card shows it before\n * anyone confirms, so it must change nothing.\n * - `erase` erases the resources shared with this site alone, items and all,\n * and takes the site off the sharing of the ones it shares with others. It\n * answers how many it erased.\n *\n * Erasers run in registration order and are ISOLATED, like every trailing\n * cleanup of a site delete: a throw is logged against its plugin and does not\n * stop the next one or the delete. A preview that throws is reported as\n * `null` for its plugin, so the card can say the list is incomplete rather\n * than show an empty one.\n *\n * Registered from a plugin's `serverDeclarations`, so the eraser is in place\n * in every server process that can delete a site.\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { runPluginDeclarationsRepair } from './plugin-declarations-repair'\nimport { PLUGIN_HOST_KEYED_COLLECTIONS } from './first-party-plugins.generated'\n\nexport { PLUGIN_HOST_KEYED_COLLECTIONS }\n\n/**\n * A plugin's top-level collection whose documents name one site in a field\n * and no organization (AGL-4214): a POS register's customer-display state, its\n * pairing codes and its tokens. Neither the site's tree nor a workspace sweep\n * by `orgId` reaches them, so the owner declares them in `plugins.config.json`\n * (`hostKeyedCollections`) and `eraseHost` sweeps each by that field. Compiled\n * rather than registered, because a site delete cannot rely on the owner\n * being loaded in the process doing it.\n */\nexport interface PluginHostKeyedCollection {\n /** The plugin that declared it. */\n pluginId: string\n /** The top-level collection. */\n name: string\n /** The field naming the site a document belongs to. */\n siteField: string\n}\n\n/** The site a preview or an erase is about, and the workspace that owns it. */\nexport interface PluginSiteResourceRequest {\n orgId: string\n hostId: string\n}\n\n/** One resource that goes with the site. */\nexport interface PluginSiteResourceGoing {\n id: string\n /** Its name, as the plugin's own page shows it. */\n name: string\n /** How many items it holds; `null` where they could not be counted. */\n items: number | null\n}\n\n/** What deleting the site does to one plugin's resources. */\nexport interface PluginSiteResourcePreview {\n /** What one resource is called, and several: `['dataset', 'datasets']`. */\n noun: readonly [string, string]\n /** What one of its items is called, and several: `['record', 'records']`. */\n itemNoun: readonly [string, string]\n /** Shared with this site alone: erased with every item. */\n going: PluginSiteResourceGoing[]\n /** Shared with this site and others: they stay, and lose this site. */\n staying: number\n}\n\nexport interface PluginSiteResourceEraser {\n /** What deleting the site would take. Reads only. */\n preview(request: PluginSiteResourceRequest): Promise<PluginSiteResourcePreview>\n /** Erases the site's own resources; answers how many it erased. */\n erase(request: PluginSiteResourceRequest): Promise<number>\n}\n\ninterface Registration {\n pluginId: string\n eraser: PluginSiteResourceEraser\n}\n\n/**\n * One list per process, on `globalThis` (AGL-3464): the app registers its\n * plugins' declarations from `instrumentation.ts`, which Next compiles apart\n * from the route that deletes a site, and a module-scoped list is filled in\n * one copy and read empty in the other.\n */\nconst ERASERS_KEY = Symbol.for('@aglyn/aglyn:plugin-site-resource-erasers')\n\nconst globalScope = globalThis as typeof globalThis & {\n [ERASERS_KEY]?: Registration[]\n}\n\nconst registrations: Registration[] =\n globalScope[ERASERS_KEY] ?? (globalScope[ERASERS_KEY] = [])\n\n/**\n * Registers a plugin's site-resource eraser. Owner = the loader's marker\n * inside a register fn, else `options.pluginId`; an eraser with neither\n * throws. One per plugin: registering again replaces the plugin's earlier\n * eraser in place, so a module evaluated twice does not erase twice.\n */\nexport function registerPluginSiteResourceEraser(\n eraser: PluginSiteResourceEraser,\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'a plugin site-resource eraser was registered with no owner: pass ' +\n '{ pluginId } when registering outside a plugin register fn',\n )\n }\n if (typeof eraser?.preview !== 'function' || typeof eraser?.erase !== 'function') {\n throw new Error('a site-resource eraser needs a preview and an erase function')\n }\n const index = registrations.findIndex((entry) => entry.pluginId === pluginId)\n if (index >= 0) registrations[index] = { pluginId, eraser }\n else registrations.push({ pluginId, eraser })\n}\n\n/**\n * The erasers in place, after running the app's boot step once when none is:\n * a boot whose declarations failed must not read as a workspace with nothing\n * shared with the site.\n */\nasync function registered(): Promise<Registration[]> {\n if (!registrations.length) {\n await runPluginDeclarationsRepair().catch((error: unknown) => {\n console.error('[plugins] the declarations repair failed before a site delete', error)\n })\n }\n return [...registrations]\n}\n\n/** One plugin's preview, or `null` where its preview failed. */\nexport interface PluginSiteResourcePreviewRow {\n pluginId: string\n preview: PluginSiteResourcePreview | null\n}\n\n/**\n * Every plugin's preview, in registration order. Never throws: a preview that\n * fails is logged and answered as `null` for its plugin.\n */\nexport async function previewPluginSiteResources(\n request: PluginSiteResourceRequest,\n): Promise<PluginSiteResourcePreviewRow[]> {\n const rows: PluginSiteResourcePreviewRow[] = []\n for (const { pluginId, eraser } of await registered()) {\n try {\n rows.push({ pluginId, preview: await eraser.preview(request) })\n } catch (error) {\n console.error(\n `[plugins] ${pluginId} could not list what goes with site ${request.hostId}`,\n error,\n )\n rows.push({ pluginId, preview: null })\n }\n }\n return rows\n}\n\n/**\n * Runs every eraser, in registration order, and answers how many resources\n * each erased by plugin id, or `null` for one that threw. Never throws.\n */\nexport async function erasePluginSiteResources(\n request: PluginSiteResourceRequest,\n): Promise<Record<string, number | null>> {\n const erased: Record<string, number | null> = {}\n for (const { pluginId, eraser } of await registered()) {\n try {\n erased[pluginId] = await eraser.erase(request)\n } catch (error) {\n erased[pluginId] = null\n console.error(`[plugins] ${pluginId} failed to erase site ${request.hostId}'s resources`, error)\n }\n }\n return erased\n}\n\n/** The plugins with a site-resource eraser, in the order they run. */\nexport function listPluginSiteResourceErasers(): string[] {\n return registrations.map((entry) => entry.pluginId)\n}\n\n/** Test seam: forget every eraser. */\nexport function resetPluginSiteResourceErasersForTests(): void {\n registrations.length = 0\n}\n"],"names":["globalScope","getRegisteringPluginId","runPluginDeclarationsRepair","PLUGIN_HOST_KEYED_COLLECTIONS","ERASERS_KEY","Symbol","for","globalThis","registrations","registerPluginSiteResourceEraser","eraser","options","pluginId","trim","Error","preview","erase","index","findIndex","entry","push","registered","length","catch","error","console","previewPluginSiteResources","request","rows","hostId","erasePluginSiteResources","erased","listPluginSiteResourceErasers","map","resetPluginSiteResourceErasersForTests"],"mappings":"IA0HEA;AA1HF;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GAED,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SAASC,2BAA2B,QAAQ,kCAA8B;AAC1E,SAASC,6BAA6B,QAAQ,qCAAiC;AAE/E,SAASA,6BAA6B,GAAE;AA2DxC;;;;;CAKC,GACD,MAAMC,cAAcC,OAAOC,GAAG,CAAC;AAE/B,MAAMN,cAAcO;AAIpB,MAAMC,iBACJR,2BAAAA,WAAW,CAACI,YAAY,YAAxBJ,2BAA6BA,WAAW,CAACI,YAAY,GAAG,EAAE;AAE5D;;;;;CAKC,GACD,OAAO,SAASK,iCACdC,MAAgC,EAChCC,OAA+B;QAEbV,MAAAA;IAAlB,MAAMW,WAAW,EAACX,QAAAA,0BAAAA,oCAAAA,0BAA4BU,2BAAAA,QAASC,QAAQ,YAA7CX,OAAiD,IAAIY,IAAI;IAC3E,IAAI,CAACD,UAAU;QACb,MAAM,IAAIE,MACR,sEACE;IAEN;IACA,IAAI,QAAOJ,0BAAAA,OAAQK,OAAO,MAAK,cAAc,QAAOL,0BAAAA,OAAQM,KAAK,MAAK,YAAY;QAChF,MAAM,IAAIF,MAAM;IAClB;IACA,MAAMG,QAAQT,cAAcU,SAAS,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