@aglyn/tenant-data-admin 1.0.0-beta.285 → 1.0.0-beta.288

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.
@@ -0,0 +1,246 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import { artifactCreateListKeys } from "@aglyn/aglyn/app-utils/artifact-list-keys";
18
+ import { createResourceUid } from "@aglyn/aglyn/app-utils/create-resource-uid";
19
+ import { SCREEN_ROOT_PATH } from "@aglyn/aglyn/app-utils/screen-slug";
20
+ import { starterLinksById } from "@aglyn/aglyn/app-utils/site-starter-links";
21
+ import { planSiteStarterTheme } from "@aglyn/aglyn/app-utils/site-starter-theme";
22
+ import { encodeStoredNodes } from "@aglyn/aglyn/app-utils/stored-nodes";
23
+ import { THEME_LIBRARY_COLLECTION } from "@aglyn/aglyn/app-utils/theme-library";
24
+ import { listServerThemePresets } from "@aglyn/aglyn/plugin-manager/plugin-theme-presets";
25
+ import { FieldValue } from "firebase-admin/firestore";
26
+ const isRecord = (value)=>!!value && typeof value === 'object' && !Array.isArray(value);
27
+ const text = (value)=>typeof value === 'string' ? value.trim() : '';
28
+ /** Nodes as a version stores them: msgpack at rest, as `/api/hosts/versions` writes them. */ function storedNodes(nodes) {
29
+ const packed = encodeStoredNodes(nodes);
30
+ return packed ? Buffer.from(packed) : nodes;
31
+ }
32
+ /**
33
+ * The documents a site created from `install` starts with, every id minted:
34
+ * the pages' ids first, so each page's links and the layout's can name them.
35
+ */ export function siteStarterWrites(install) {
36
+ var _Object_keys_find;
37
+ const now = ()=>FieldValue.serverTimestamp();
38
+ const payload = install.payload;
39
+ const pages = (Array.isArray(payload.screens) ? payload.screens : []).filter(isRecord).map((screen)=>({
40
+ screen,
41
+ id: createResourceUid(),
42
+ versionId: createResourceUid()
43
+ }));
44
+ const layoutId = createResourceUid();
45
+ const layoutVersionId = createResourceUid();
46
+ // Routed: a page with an address that is not marked unpublished, the
47
+ // first to claim an address keeping it. Links resolve to routed pages
48
+ // first, then to a draft that names an address nobody routes.
49
+ const routing = {};
50
+ const slugToId = {};
51
+ const routed = new Set();
52
+ for (const page of pages){
53
+ const slug = text(page.screen['slug']);
54
+ if (!slug || page.screen['published'] === false || slug in slugToId) continue;
55
+ routing[page.id] = slug;
56
+ slugToId[slug] = page.id;
57
+ routed.add(page.id);
58
+ }
59
+ for (const page of pages){
60
+ const slug = text(page.screen['slug']);
61
+ if (slug && !(slug in slugToId)) slugToId[slug] = page.id;
62
+ }
63
+ const homeScreenId = (_Object_keys_find = Object.keys(routing).find((id)=>routing[id] === SCREEN_ROOT_PATH)) != null ? _Object_keys_find : null;
64
+ const screens = pages.map(({ screen, id, versionId })=>{
65
+ const isRouted = routed.has(id);
66
+ const fields = _extends({
67
+ displayName: text(screen['displayName']) || 'Page'
68
+ }, isRouted ? {
69
+ slug: routing[id]
70
+ } : {}, {
71
+ versionId
72
+ });
73
+ const description = text(screen['description']);
74
+ const nodes = starterLinksById(isRecord(screen['nodes']) ? screen['nodes'] : {}, slugToId);
75
+ return {
76
+ id,
77
+ versionId,
78
+ screen: _extends({}, fields, artifactCreateListKeys('screens', fields), {
79
+ layoutId
80
+ }, isRecord(screen['seo']) ? {
81
+ seo: screen['seo']
82
+ } : {}, description ? {
83
+ description
84
+ } : {}, isRouted ? {
85
+ publishedAt: now()
86
+ } : {}, {
87
+ createdAt: now(),
88
+ updatedAt: now()
89
+ }),
90
+ version: {
91
+ screenId: id,
92
+ displayName: 'Initial version',
93
+ nodes: storedNodes(nodes),
94
+ createdAt: now(),
95
+ updatedAt: now()
96
+ }
97
+ };
98
+ });
99
+ const source = isRecord(payload.layout) ? payload.layout : {};
100
+ const layoutFields = {
101
+ displayName: text(source['displayName']) || 'Site header and footer',
102
+ versionId: layoutVersionId
103
+ };
104
+ const layoutDescription = text(source['description']);
105
+ const layoutNodes = starterLinksById(isRecord(source['nodes']) ? source['nodes'] : {}, slugToId);
106
+ const props = Array.isArray(source['props']) && source['props'].length ? source['props'] : null;
107
+ const theme = planSiteStarterTheme({
108
+ theme: payload.theme,
109
+ presets: listServerThemePresets(),
110
+ listing: install.listing,
111
+ newId: createResourceUid
112
+ });
113
+ return {
114
+ homeScreenId,
115
+ routing,
116
+ screens,
117
+ layout: {
118
+ id: layoutId,
119
+ versionId: layoutVersionId,
120
+ layout: _extends({}, layoutFields, artifactCreateListKeys('layouts', layoutFields), layoutDescription ? {
121
+ description: layoutDescription
122
+ } : {}, {
123
+ createdAt: now(),
124
+ updatedAt: now()
125
+ }),
126
+ version: _extends({
127
+ layoutId,
128
+ displayName: 'Initial version',
129
+ nodes: storedNodes(layoutNodes)
130
+ }, props ? {
131
+ props
132
+ } : {}, {
133
+ createdAt: now(),
134
+ updatedAt: now()
135
+ })
136
+ },
137
+ host: theme.host,
138
+ themeEntries: theme.entries
139
+ };
140
+ }
141
+ /**
142
+ * Queues a starter's documents in the create transaction: every page and its
143
+ * first version, the layout and its first version (which carries the host
144
+ * id, as the default layout's does), and the theme library entries. An empty
145
+ * host's theme plan creates entries and nothing else, so a create is all a
146
+ * new site's library takes.
147
+ */ export function queueSiteStarterWrites(tx, hostRef, hostId, writes) {
148
+ for (const page of writes.screens){
149
+ const pageRef = hostRef.collection('screens').doc(page.id);
150
+ tx.set(pageRef, page.screen);
151
+ tx.set(pageRef.collection('versions').doc(page.versionId), page.version);
152
+ }
153
+ const layoutRef = hostRef.collection('layouts').doc(writes.layout.id);
154
+ tx.set(layoutRef, writes.layout.layout);
155
+ tx.set(layoutRef.collection('versions').doc(writes.layout.versionId), _extends({}, writes.layout.version, {
156
+ hostId
157
+ }));
158
+ const library = hostRef.collection(THEME_LIBRARY_COLLECTION);
159
+ for (const entry of writes.themeEntries){
160
+ if (entry.op !== 'create') continue;
161
+ tx.set(library.doc(entry.id), _extends({}, entry.data, {
162
+ createdAt: FieldValue.serverTimestamp(),
163
+ updatedAt: FieldValue.serverTimestamp()
164
+ }));
165
+ }
166
+ }
167
+ /** A listing id as a document id may be one: no path separator, nothing reserved. */ const LISTING_ID = /^[A-Za-z0-9_-]{1,128}$/;
168
+ /** A pinned version: the number of one of the listing's versions. */ const LISTING_VERSION = /^[1-9][0-9]{0,8}$/;
169
+ /**
170
+ * A create request's starter pick (`body.starter`), or `null` when it is not
171
+ * one: an object naming a listing id, and optionally the version it pins.
172
+ * The id becomes a document path on the way to the listing, so anything that
173
+ * could name another document is not a pick.
174
+ */ export function readSiteStarterChoice(value) {
175
+ if (!isRecord(value)) return null;
176
+ const listingId = text(value['listingId']);
177
+ if (!LISTING_ID.test(listingId) || /^__.*__$/.test(listingId)) return null;
178
+ const pinned = value['version'];
179
+ if (pinned === undefined || pinned === null) return {
180
+ listingId
181
+ };
182
+ const version = typeof pinned === 'number' ? String(pinned) : text(pinned);
183
+ return LISTING_VERSION.test(version) ? {
184
+ listingId,
185
+ version
186
+ } : null;
187
+ }
188
+ /**
189
+ * Why a create refuses the starter it was asked for, or `null` when the
190
+ * site can be created from it (AGL-4049). Every refusal is decided before the
191
+ * site exists, so a refused pick creates nothing, and a 402 is answered with
192
+ * what the person needs to buy it: the listing and its price. Once bought,
193
+ * the same request again creates the site.
194
+ *
195
+ * `resolved` is what the starter source answered; `pagesAllowed` is the
196
+ * plan's `screensPerHost`.
197
+ */ export function siteStarterPickRefusal(resolved, input) {
198
+ if (!isRecord(resolved)) {
199
+ return {
200
+ status: 404,
201
+ body: {
202
+ error: 'That starter is no longer available',
203
+ listingId: input.listingId
204
+ }
205
+ };
206
+ }
207
+ if ('error' in resolved) {
208
+ const status = [
209
+ 402,
210
+ 403,
211
+ 404
212
+ ].includes(resolved.status) ? resolved.status : 404;
213
+ return {
214
+ status,
215
+ body: _extends({
216
+ error: resolved.error
217
+ }, status === 402 ? {
218
+ code: 'purchase_required'
219
+ } : {}, {
220
+ listingId: input.listingId
221
+ }, typeof resolved.priceUsd === 'number' ? {
222
+ priceUsd: resolved.priceUsd
223
+ } : {})
224
+ };
225
+ }
226
+ if (resolved.mode === 'ai') {
227
+ return {
228
+ status: 409,
229
+ body: {
230
+ error: 'This starter needs the AI start, which is coming soon'
231
+ }
232
+ };
233
+ }
234
+ const pages = Array.isArray(resolved.screens) ? resolved.screens.length : 0;
235
+ if (pages > input.pagesAllowed) {
236
+ return {
237
+ status: 403,
238
+ body: {
239
+ error: `This starter has ${pages} pages; your plan includes ${input.pagesAllowed}. ` + 'Pick a smaller starter or upgrade in Billing.'
240
+ }
241
+ };
242
+ }
243
+ return null;
244
+ }
245
+
246
+ //# sourceMappingURL=provision-starter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/tenant/data/admin/src/lib/server/provision-starter.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 { artifactCreateListKeys } from '@aglyn/aglyn/app-utils/artifact-list-keys'\nimport { createResourceUid } from '@aglyn/aglyn/app-utils/create-resource-uid'\nimport { SCREEN_ROOT_PATH } from '@aglyn/aglyn/app-utils/screen-slug'\nimport type {\n SiteStarterChoice,\n SiteStarterPayload,\n} from '@aglyn/aglyn/app-utils/site-starter'\nimport { starterLinksById } from '@aglyn/aglyn/app-utils/site-starter-links'\nimport { planSiteStarterTheme } from '@aglyn/aglyn/app-utils/site-starter-theme'\nimport { encodeStoredNodes } from '@aglyn/aglyn/app-utils/stored-nodes'\nimport {\n THEME_LIBRARY_COLLECTION,\n type ThemeLibraryEntryWrite,\n} from '@aglyn/aglyn/app-utils/theme-library'\nimport { listServerThemePresets } from '@aglyn/aglyn/plugin-manager/plugin-theme-presets'\nimport {\n FieldValue,\n type DocumentReference,\n type Transaction,\n} from 'firebase-admin/firestore'\n\n/**\n * A site created from a site starter (AGL-4049): the starter twin of the\n * default site's writes (`defaultSiteWrites` and `queueStarterPages` in the\n * console's `provision-host.ts`), written by the same create transaction.\n *\n * Every page the starter carries becomes a page of the new site, its first\n * version holding the starter's nodes; the shared layout becomes the site's\n * header and footer, and every page sits in it; the theme is planned against\n * the empty host (`planSiteStarterTheme`). A page routed in the starter is\n * routed and published on the new site, and the Home page at `/` is named\n * `defaultHomeScreenId`: the platform-made page the owner's own home page\n * replaces (AGL-3478). A page with no address, or one the starter marks\n * unpublished, is a draft.\n *\n * Nodes are copied as published. A link to another page travels by slug in\n * the starter (`site-starter-links.ts`) and becomes the new page's id here;\n * a token such as `{{host.businessName}}` renders per site on its own, so\n * nothing is substituted.\n */\n\n/** A starter resolved for a create: its payload, and the listing it came from. */\nexport interface SiteStarterInstall {\n payload: SiteStarterPayload\n listing: { listingId: string; version: string | number; displayName: string }\n}\n\n/** Every document a starter's site is born with, ids minted, ready to queue. */\nexport interface SiteStarterWrites {\n /** The Home page at `/`; `null` only for a payload that failed its check. */\n homeScreenId: string | null\n /** Every published page: screen id → slug, the host's `screens` map. */\n routing: Record<string, string>\n screens: Array<{\n id: string\n versionId: string\n screen: Record<string, unknown>\n version: Record<string, unknown>\n }>\n layout: {\n id: string\n versionId: string\n layout: Record<string, unknown>\n version: Record<string, unknown>\n }\n /** Theme fields for the host's create, from `planSiteStarterTheme`. */\n host: Record<string, unknown>\n /** Theme library entries to create under the host. */\n themeEntries: ThemeLibraryEntryWrite[]\n}\n\nconst isRecord = (value: unknown): value is Record<string, any> =>\n !!value && typeof value === 'object' && !Array.isArray(value)\n\nconst text = (value: unknown): string =>\n typeof value === 'string' ? value.trim() : ''\n\n/** Nodes as a version stores them: msgpack at rest, as `/api/hosts/versions` writes them. */\nfunction storedNodes(nodes: Record<string, unknown>): unknown {\n const packed = encodeStoredNodes(nodes)\n return packed ? Buffer.from(packed) : nodes\n}\n\n/**\n * The documents a site created from `install` starts with, every id minted:\n * the pages' ids first, so each page's links and the layout's can name them.\n */\nexport function siteStarterWrites(install: SiteStarterInstall): SiteStarterWrites {\n const now = () => FieldValue.serverTimestamp()\n const payload = install.payload\n const pages = (Array.isArray(payload.screens) ? payload.screens : [])\n .filter(isRecord)\n .map((screen) => ({ screen, id: createResourceUid(), versionId: createResourceUid() }))\n const layoutId = createResourceUid()\n const layoutVersionId = createResourceUid()\n\n // Routed: a page with an address that is not marked unpublished, the\n // first to claim an address keeping it. Links resolve to routed pages\n // first, then to a draft that names an address nobody routes.\n const routing: Record<string, string> = {}\n const slugToId: Record<string, string> = {}\n const routed = new Set<string>()\n for (const page of pages) {\n const slug = text(page.screen['slug'])\n if (!slug || page.screen['published'] === false || slug in slugToId) continue\n routing[page.id] = slug\n slugToId[slug] = page.id\n routed.add(page.id)\n }\n for (const page of pages) {\n const slug = text(page.screen['slug'])\n if (slug && !(slug in slugToId)) slugToId[slug] = page.id\n }\n const homeScreenId =\n Object.keys(routing).find((id) => routing[id] === SCREEN_ROOT_PATH) ?? null\n\n const screens = pages.map(({ screen, id, versionId }) => {\n const isRouted = routed.has(id)\n const fields = {\n displayName: text(screen['displayName']) || 'Page',\n ...(isRouted ? { slug: routing[id] } : {}),\n versionId,\n }\n const description = text(screen['description'])\n const nodes = starterLinksById(isRecord(screen['nodes']) ? screen['nodes'] : {}, slugToId)\n return {\n id,\n versionId,\n screen: {\n ...fields,\n ...artifactCreateListKeys('screens', fields),\n layoutId,\n ...(isRecord(screen['seo']) ? { seo: screen['seo'] } : {}),\n ...(description ? { description } : {}),\n // What `publishScreenRoute` stamps, so the console lists a routed\n // page as Published rather than as a draft that happens to be served.\n ...(isRouted ? { publishedAt: now() } : {}),\n createdAt: now(),\n updatedAt: now(),\n },\n version: {\n screenId: id,\n displayName: 'Initial version',\n nodes: storedNodes(nodes),\n createdAt: now(),\n updatedAt: now(),\n },\n }\n })\n\n const source = isRecord(payload.layout) ? payload.layout : {}\n const layoutFields = {\n displayName: text(source['displayName']) || 'Site header and footer',\n versionId: layoutVersionId,\n }\n const layoutDescription = text(source['description'])\n const layoutNodes = starterLinksById(isRecord(source['nodes']) ? source['nodes'] : {}, slugToId)\n const props = Array.isArray(source['props']) && source['props'].length ? source['props'] : null\n\n const theme = planSiteStarterTheme({\n theme: payload.theme,\n presets: listServerThemePresets(),\n listing: install.listing,\n newId: createResourceUid,\n })\n\n return {\n homeScreenId,\n routing,\n screens,\n layout: {\n id: layoutId,\n versionId: layoutVersionId,\n layout: {\n ...layoutFields,\n ...artifactCreateListKeys('layouts', layoutFields),\n ...(layoutDescription ? { description: layoutDescription } : {}),\n createdAt: now(),\n updatedAt: now(),\n },\n version: {\n layoutId,\n displayName: 'Initial version',\n nodes: storedNodes(layoutNodes),\n // The properties the layout's tree binds to (AGL-2932), on the\n // version it is served from, as Use template writes them.\n ...(props ? { props } : {}),\n createdAt: now(),\n updatedAt: now(),\n },\n },\n host: theme.host,\n themeEntries: theme.entries,\n }\n}\n\n/**\n * Queues a starter's documents in the create transaction: every page and its\n * first version, the layout and its first version (which carries the host\n * id, as the default layout's does), and the theme library entries. An empty\n * host's theme plan creates entries and nothing else, so a create is all a\n * new site's library takes.\n */\nexport function queueSiteStarterWrites(\n tx: Transaction,\n hostRef: DocumentReference,\n hostId: string,\n writes: SiteStarterWrites,\n): void {\n for (const page of writes.screens) {\n const pageRef = hostRef.collection('screens').doc(page.id)\n tx.set(pageRef, page.screen)\n tx.set(pageRef.collection('versions').doc(page.versionId), page.version)\n }\n const layoutRef = hostRef.collection('layouts').doc(writes.layout.id)\n tx.set(layoutRef, writes.layout.layout)\n tx.set(layoutRef.collection('versions').doc(writes.layout.versionId), {\n ...writes.layout.version,\n hostId,\n })\n const library = hostRef.collection(THEME_LIBRARY_COLLECTION)\n for (const entry of writes.themeEntries) {\n if (entry.op !== 'create') continue\n tx.set(library.doc(entry.id), {\n ...(entry.data as unknown as Record<string, unknown>),\n createdAt: FieldValue.serverTimestamp(),\n updatedAt: FieldValue.serverTimestamp(),\n })\n }\n}\n\n/** A listing id as a document id may be one: no path separator, nothing reserved. */\nconst LISTING_ID = /^[A-Za-z0-9_-]{1,128}$/\n/** A pinned version: the number of one of the listing's versions. */\nconst LISTING_VERSION = /^[1-9][0-9]{0,8}$/\n\n/**\n * A create request's starter pick (`body.starter`), or `null` when it is not\n * one: an object naming a listing id, and optionally the version it pins.\n * The id becomes a document path on the way to the listing, so anything that\n * could name another document is not a pick.\n */\nexport function readSiteStarterChoice(value: unknown): SiteStarterChoice | null {\n if (!isRecord(value)) return null\n const listingId = text(value['listingId'])\n if (!LISTING_ID.test(listingId) || /^__.*__$/.test(listingId)) return null\n const pinned = value['version']\n if (pinned === undefined || pinned === null) return { listingId }\n const version = typeof pinned === 'number' ? String(pinned) : text(pinned)\n return LISTING_VERSION.test(version) ? { listingId, version } : null\n}\n\n/** The answer a create gives a starter pick it refuses: a status and its JSON body. */\nexport interface SiteStarterPickRefusal {\n status: number\n body: Record<string, unknown>\n}\n\n/**\n * Why a create refuses the starter it was asked for, or `null` when the\n * site can be created from it (AGL-4049). Every refusal is decided before the\n * site exists, so a refused pick creates nothing, and a 402 is answered with\n * what the person needs to buy it: the listing and its price. Once bought,\n * the same request again creates the site.\n *\n * `resolved` is what the starter source answered; `pagesAllowed` is the\n * plan's `screensPerHost`.\n */\nexport function siteStarterPickRefusal(\n resolved: SiteStarterPayload | { error: string; status: 402 | 403 | 404; priceUsd?: number },\n input: { listingId: string; pagesAllowed: number },\n): SiteStarterPickRefusal | null {\n if (!isRecord(resolved)) {\n return { status: 404, body: { error: 'That starter is no longer available', listingId: input.listingId } }\n }\n if ('error' in resolved) {\n const status = [402, 403, 404].includes(resolved.status) ? resolved.status : 404\n return {\n status,\n body: {\n error: resolved.error,\n ...(status === 402 ? { code: 'purchase_required' } : {}),\n listingId: input.listingId,\n ...(typeof resolved.priceUsd === 'number' ? { priceUsd: resolved.priceUsd } : {}),\n },\n }\n }\n if (resolved.mode === 'ai') {\n return { status: 409, body: { error: 'This starter needs the AI start, which is coming soon' } }\n }\n const pages = Array.isArray(resolved.screens) ? resolved.screens.length : 0\n if (pages > input.pagesAllowed) {\n return {\n status: 403,\n body: {\n error:\n `This starter has ${pages} pages; your plan includes ${input.pagesAllowed}. ` +\n 'Pick a smaller starter or upgrade in Billing.',\n },\n }\n }\n return null\n}\n"],"names":["artifactCreateListKeys","createResourceUid","SCREEN_ROOT_PATH","starterLinksById","planSiteStarterTheme","encodeStoredNodes","THEME_LIBRARY_COLLECTION","listServerThemePresets","FieldValue","isRecord","value","Array","isArray","text","trim","storedNodes","nodes","packed","Buffer","from","siteStarterWrites","install","Object","now","serverTimestamp","payload","pages","screens","filter","map","screen","id","versionId","layoutId","layoutVersionId","routing","slugToId","routed","Set","page","slug","add","homeScreenId","keys","find","isRouted","has","fields","displayName","description","seo","publishedAt","createdAt","updatedAt","version","screenId","source","layout","layoutFields","layoutDescription","layoutNodes","props","length","theme","presets","listing","newId","host","themeEntries","entries","queueSiteStarterWrites","tx","hostRef","hostId","writes","pageRef","collection","doc","set","layoutRef","library","entry","op","data","LISTING_ID","LISTING_VERSION","readSiteStarterChoice","listingId","test","pinned","undefined","String","siteStarterPickRefusal","resolved","input","status","body","error","includes","code","priceUsd","mode","pagesAllowed"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,iBAAiB,QAA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AAOF,UAAU5E,KAAK4E;IACnE,OAAOJ,gBAAgBG,IAAI,CAAClC,WAAW;QAAEiC;QAAWjC;IAAQ,IAAI;AAClE;AAQA;;;;;;;;;CASC,GACD,OAAO,SAASsC,uBACdC,QAA4F,EAC5FC,KAAkD;IAElD,IAAI,CAACrF,SAASoF,WAAW;QACvB,OAAO;YAAEE,QAAQ;YAAKC,MAAM;gBAAEC,OAAO;gBAAuCV,WAAWO,MAAMP,SAAS;YAAC;QAAE;IAC3G;IACA,IAAI,WAAWM,UAAU;QACvB,MAAME,SAAS;YAAC;YAAK;YAAK;SAAI,CAACG,QAAQ,CAACL,SAASE,MAAM,IAAIF,SAASE,MAAM,GAAG;QAC7E,OAAO;YACLA;YACAC,MAAM;gBACJC,OAAOJ,SAASI,KAAK;eACjBF,WAAW,MAAM;gBAAEI,MAAM;YAAoB,IAAI,CAAC;gBACtDZ,WAAWO,MAAMP,SAAS;eACtB,OAAOM,SAASO,QAAQ,KAAK,WAAW;gBAAEA,UAAUP,SAASO,QAAQ;YAAC,IAAI,CAAC;QAEnF;IACF;IACA,IAAIP,SAASQ,IAAI,KAAK,MAAM;QAC1B,OAAO;YAAEN,QAAQ;YAAKC,MAAM;gBAAEC,OAAO;YAAwD;QAAE;IACjG;IACA,MAAMvE,QAAQf,MAAMC,OAAO,CAACiF,SAASlE,OAAO,IAAIkE,SAASlE,OAAO,CAACmC,MAAM,GAAG;IAC1E,IAAIpC,QAAQoE,MAAMQ,YAAY,EAAE;QAC9B,OAAO;YACLP,QAAQ;YACRC,MAAM;gBACJC,OACE,CAAC,iBAAiB,EAAEvE,MAAM,2BAA2B,EAAEoE,MAAMQ,YAAY,CAAC,EAAE,CAAC,GAC7E;YACJ;QACF;IACF;IACA,OAAO;AACT"}
package/src/tenancy.d.ts CHANGED
@@ -79,6 +79,7 @@ export * from './lib/server/operator-alerts';
79
79
  export * from './lib/server/operator-health';
80
80
  export * from './lib/server/org-billing';
81
81
  export * from './lib/server/organizations';
82
+ export * from './lib/server/member-permission-overrides';
82
83
  export * from './lib/server/staff-seat';
83
84
  export * from './lib/server/upgrade-proposal';
84
85
  export * from './lib/server/duplicate-activity';
package/src/tenancy.js CHANGED
@@ -110,6 +110,8 @@ export * from "./lib/server/operator-alerts.js";
110
110
  export * from "./lib/server/operator-health.js";
111
111
  export * from "./lib/server/org-billing.js";
112
112
  export * from "./lib/server/organizations.js";
113
+ // Per-member permission overrides, org-wide and per site (AGL-4047).
114
+ export * from "./lib/server/member-permission-overrides.js";
113
115
  // Platform staff take no customer seat, and a workspace is asked to upgrade
114
116
  // as a separate step after it is handed over (AGL-3466).
115
117
  export * from "./lib/server/staff-seat.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/tenant/data/admin/src/tenancy.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 * from './lib/server/analytics-retention'\nexport * from './lib/server/api-http'\nexport * from './lib/server/api-keys'\nexport * from './lib/server/account-emails'\nexport * from './lib/server/auth-pools'\nexport * from './lib/server/client-error-report'\n// The merchant's payment account, as a contract. Its adapter is not exported:\n// a plugin asks the contract, and the doors that only need the readiness rule\n// import `@aglyn/tenant-data-admin/server/payment-provider` directly, which\n// loads no Firebase.\nexport {\n merchantAccountIsReady,\n merchantAccountReadiness,\n paymentProvider,\n} from './lib/server/payment-provider'\nexport type {\n MerchantAccountReadiness,\n MerchantAccountReadinessInput,\n PaymentMode,\n PaymentProvider,\n PaymentProviderEvent,\n} from './lib/server/payment-provider'\nexport * from './lib/server/auth-handoff'\nexport * from './lib/server/console-domains'\nexport * from './lib/server/dns-probe'\n// Whether a name points at the tenant edge, for the verify route and the\n// domains plugin's one-click DNS (AGL-3963).\nexport * from './lib/server/tenant-dns-check'\nexport * from './lib/server/sending-domains'\nexport * from './lib/server/sender-readiness'\nexport * from './lib/server/host-sending-domain'\nexport * from './lib/server/sending-domain-debt'\nexport * from './lib/server/sending-domain-recheck'\n// The hosting seam itself, so a door can ask whether this deployment is able\n// to register a name at all before it promises the caller one.\n// `workspace-domains` re-exports the pieces its own callers share with it; the\n// provider behind it is not among them.\nexport { domainProvider } from './lib/server/domain-provider'\nexport type {\n DomainProvider,\n DomainProviderId,\n DomainScope,\n} from './lib/server/domain-provider'\nexport * from './lib/server/platform-domain-names'\nexport * from './lib/server/consume-once'\nexport * from './lib/server/csp-aggregate'\nexport * from './lib/server/data-storage-gate'\nexport * from './lib/server/contact-suppression'\nexport * from './lib/server/email-suppression'\n// The double opt-in quarantine, after the module whose keying it shares and\n// whose `filterTopicSendable` is the reader that makes it a quarantine rather\n// than a stored fact.\nexport * from './lib/server/topic-subscriptions'\nexport * from './lib/server/email-unsubscribe-link'\nexport * from './lib/server/email-flow-gate'\n// Side-effecting on purpose, for the reason `email-send-rate` below is:\n// evaluating this module INSTALLS the marketing gate on `sendEmail`, so the\n// unsubscribe header, the suppression check and the frequency ceiling reach\n// every bulk sender without a call at each server entrypoint.\nexport * from './lib/server/email-marketing-gate'\n// A consent group change (AGL-3320): the carries of the three stores above,\n// and the executor that runs a change around them.\nexport * from './lib/server/consent-group-carry'\nexport * from './lib/server/consent-group-change'\n// A person's refusal kept after the record it was written on is deleted\n// (AGL-3338): the delete's write, the list gate's read, and the change's carry.\nexport * from './lib/server/retained-refusals'\nexport * from './lib/server/sms-keywords'\nexport * from './lib/server/document-id'\nexport * from './lib/server/collection-preview-token'\nexport * from './lib/server/edit-access-authz'\nexport * from './lib/server/edit-access-token'\nexport * from './lib/server/edit-hint-token'\nexport * from './lib/server/email-metering'\n// Side-effecting on purpose (AGL-2409): evaluating this module INSTALLS the\n// platform send-rate governor on `sendEmail`. Every server surface already\n// imports this barrel, so nothing has to remember to call an installer.\nexport * from './lib/server/email-send-rate'\n// Side-effecting on purpose, for the same reason (AGL-3328): evaluating this\n// module INSTALLS the deliverability preflight on `sendEmail`, so a recipient\n// whose domain takes no mail is refused, and bulk mail behind a gateway that\n// refused its sending domain twice is held, on every send path at once.\nexport * from './lib/server/email-deliverability'\nexport * from './lib/server/email-sender-reputation'\nexport * from './lib/server/erase'\nexport * from './lib/server/erase-person'\nexport * from './lib/server/dynamic-list-materialize'\nexport * from './lib/server/firebase-admin'\nexport * from './lib/server/free-workspace-cap'\nexport * from './lib/server/ga4-measurement-protocol'\nexport * from './lib/server/host-memberships'\n// Connecting a name to a site, for the attach route and for plugins that\n// bought the name (AGL-3961).\nexport * from './lib/server/host-custom-domain'\nexport * from './lib/server/custom-domain-redirects'\nexport * from './lib/server/host-visitor-records'\nexport * from './lib/server/list-members'\nexport * from './lib/server/lockdown'\nexport * from './lib/server/token-revocation'\nexport * from './lib/server/tenant-write-lockdown'\nexport * from './lib/server/outbound-send-review'\n// The same review for a published page, read where it is composed (AGL-3356).\nexport * from './lib/server/hosted-page-review'\n// Every hold, flag, lock and pause tells owners and staff through one seam (AGL-3368).\nexport * from './lib/server/risk-notice'\nexport * from './lib/server/host-email-tokens'\nexport * from './lib/server/notifications'\n// Every operator alert raises through one entry point, and every health check\n// remembers its state (AGL-3377).\nexport * from './lib/server/operator-alerts'\nexport * from './lib/server/operator-health'\nexport * from './lib/server/org-billing'\nexport * from './lib/server/organizations'\n// Platform staff take no customer seat, and a workspace is asked to upgrade\n// as a separate step after it is handed over (AGL-3466).\nexport * from './lib/server/staff-seat'\nexport * from './lib/server/upgrade-proposal'\nexport * from './lib/server/duplicate-activity'\nexport * from './lib/server/duplicate-resource'\nexport * from './lib/server/workspace-domains'\nexport * from './lib/server/membership-recover-throttle'\nexport * from './lib/server/password-reset-throttle'\nexport * from './lib/server/rate-limit-store'\nexport * from './lib/server/verify-email-cooldown'\nexport * from './lib/server/vercel-drain-signature'\nexport * from './lib/server/vercel-log-drain'\nexport * from './lib/server/visitor-write-rate-limit'\nexport * from './lib/server/card-payment-velocity'\nexport * from './lib/server/console-api-rate-limit'\nexport * from './lib/server/realm-plugins'\nexport * from './lib/server/release-flags'\nexport * from './lib/server/resolve-people'\nexport * from './lib/server/member-photo'\nexport * from './lib/server/personal-data-export'\nexport * from './lib/server/media-delivery'\nexport * from './lib/server/media-download-tokens'\nexport * from './lib/server/media-quarantine'\nexport * from './lib/server/media-signing'\nexport * from './lib/server/media-storage-path'\nexport * from './lib/server/safe-equal'\nexport * from './lib/server/media-strong-digest'\nexport * from './lib/server/media-tombstone'\nexport * from './lib/server/media-delivery-regeneration'\nexport * from './lib/server/media-variants'\nexport * from './lib/server/media-photo-links'\n// The one-screen build for a client (AGL-3958): staff hold its record.\nexport * from './lib/server/client-build'\nexport * from './lib/server/serve-media-cdn'\nexport * from './lib/server/serve-plugin-fetch'\nexport * from './lib/server/configured-url-fetch'\nexport * from './lib/server/sso-break-glass-owners'\nexport * from './lib/server/sso-domain-policy'\nexport * from './lib/server/sso-enforcement'\nexport * from './lib/server/sso-provisioning'\nexport * from './lib/server/update-existing'\nexport * from './lib/server/contact-company-link'\nexport * from './lib/server/contact-email-index'\nexport * from './lib/server/upsert-contact'\nexport * from './lib/server/crm-records'\n// The `nextTaskAtMs` a contact, a company and a deal carry, recomputed from\n// their open tasks by every server-side task writer (AGL-2661).\n// Where a one-to-one email's activity row lives and how the delivery\n// webhook advances it (AGL-2615).\n// A member's own addresses in a workspace, and the signed link that\n// confirms one (AGL-2975).\nexport * from './lib/server/member-email-aliases'\nexport * from './lib/server/user-profiles'\n// One answer to an account's name and photo, and the SSO sign-in fill of a\n// blank Auth record (AGL-3721).\nexport * from './lib/server/account-identity'\n// The one \"New account\" staff notice per account, keyed on the auth\n// record's creation (AGL-3225).\nexport * from './lib/server/new-account-announcement'\nexport * from './lib/server/legal-acceptance'\n// The person's decision about the platform's own product email, on their\n// document and on the operator's marketing contact (AGL-3185).\nexport * from './lib/server/platform-marketing-consent'\n"],"names":["merchantAccountIsReady","merchantAccountReadiness","paymentProvider","domainProvider"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,sCAAkC;AAChD,cAAc,2BAAuB;AACrC,cAAc,2BAAuB;AACrC,cAAc,iCAA6B;AAC3C,cAAc,6BAAyB;AACvC,cAAc,sCAAkC;AAChD,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,qBAAqB;AACrB,SACEA,sBAAsB,EACtBC,wBAAwB,EACxBC,eAAe,QACV,mCAA+B;AAQtC,cAAc,+BAA2B;AACzC,cAAc,kCAA8B;AAC5C,cAAc,4BAAwB;AACtC,yEAAyE;AACzE,6CAA6C;AAC7C,cAAc,mCAA+B;AAC7C,cAAc,kCAA8B;AAC5C,cAAc,mCAA+B;AAC7C,cAAc,sCAAkC;AAChD,cAAc,sCAAkC;AAChD,cAAc,yCAAqC;AACnD,6EAA6E;AAC7E,+DAA+D;AAC/D,+EAA+E;AAC/E,wCAAwC;AACxC,SAASC,cAAc,QAAQ,kCAA8B;AAM7D,cAAc,wCAAoC;AAClD,cAAc,+BAA2B;AACzC,cAAc,gCAA4B;AAC1C,cAAc,oCAAgC;AAC9C,cAAc,sCAAkC;AAChD,cAAc,oCAAgC;AAC9C,4EAA4E;AAC5E,8EAA8E;AAC9E,sBAAsB;AACtB,cAAc,sCAAkC;AAChD,cAAc,yCAAqC;AACnD,cAAc,kCAA8B;AAC5C,wEAAwE;AACxE,4EAA4E;AAC5E,4EAA4E;AAC5E,8DAA8D;AAC9D,cAAc,uCAAmC;AACjD,4EAA4E;AAC5E,mDAAmD;AACnD,cAAc,sCAAkC;AAChD,cAAc,uCAAmC;AACjD,wEAAwE;AACxE,gFAAgF;AAChF,cAAc,oCAAgC;AAC9C,cAAc,+BAA2B;AACzC,cAAc,8BAA0B;AACxC,cAAc,2CAAuC;AAC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A2B;AACzC,cAAc,uCAAmC;AACjD,cAAc,iCAA6B;AAC3C,cAAc,wCAAoC;AAClD,cAAc,mCAA+B;AAC7C,cAAc,gCAA4B;AAC1C,cAAc,qCAAiC;AAC/C,cAAc,6BAAyB;AACvC,cAAc,sCAAkC;AAChD,cAAc,kCAA8B;AAC5C,cAAc,8CAA0C;AACxD,cAAc,iCAA6B;AAC3C,cAAc,oCAAgC;AAC9C,uEAAuE;AACvE,cAAc,+BAA2B;AACzC,cAAc,kCAA8B;AAC5C,cAAc,qCAAiC;AAC/C,cAAc,uCAAmC;AACjD,cAAc,yCAAqC;AACnD,cAAc,oCAAgC;AAC9C,cAAc,kCAA8B;AAC5C,cAAc,mCAA+B;AAC7C,cAAc,kCAA8B;AAC5C,cAAc,uCAAmC;AACjD,cAAc,sCAAkC;AAChD,cAAc,iCAA6B;AAC3C,cAAc,8BAA0B;AACxC,4EAA4E;AAC5E,gEAAgE;AAChE,qEAAqE;AACrE,kCAAkC;AAClC,oEAAoE;AACpE,2BAA2B;AAC3B,cAAc,uCAAmC;AACjD,cAAc,gCAA4B;AAC1C,2EAA2E;AAC3E,gCAAgC;AAChC,cAAc,mCAA+B;AAC7C,oEAAoE;AACpE,gCAAgC;AAChC,cAAc,2CAAuC;AACrD,cAAc,mCAA+B;AAC7C,yEAAyE;AACzE,+DAA+D;AAC/D,cAAc,6CAAyC"}
1
+ {"version":3,"sources":["../../../../../../libs/tenant/data/admin/src/tenancy.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 * from './lib/server/analytics-retention'\nexport * from './lib/server/api-http'\nexport * from './lib/server/api-keys'\nexport * from './lib/server/account-emails'\nexport * from './lib/server/auth-pools'\nexport * from './lib/server/client-error-report'\n// The merchant's payment account, as a contract. Its adapter is not exported:\n// a plugin asks the contract, and the doors that only need the readiness rule\n// import `@aglyn/tenant-data-admin/server/payment-provider` directly, which\n// loads no Firebase.\nexport {\n merchantAccountIsReady,\n merchantAccountReadiness,\n paymentProvider,\n} from './lib/server/payment-provider'\nexport type {\n MerchantAccountReadiness,\n MerchantAccountReadinessInput,\n PaymentMode,\n PaymentProvider,\n PaymentProviderEvent,\n} from './lib/server/payment-provider'\nexport * from './lib/server/auth-handoff'\nexport * from './lib/server/console-domains'\nexport * from './lib/server/dns-probe'\n// Whether a name points at the tenant edge, for the verify route and the\n// domains plugin's one-click DNS (AGL-3963).\nexport * from './lib/server/tenant-dns-check'\nexport * from './lib/server/sending-domains'\nexport * from './lib/server/sender-readiness'\nexport * from './lib/server/host-sending-domain'\nexport * from './lib/server/sending-domain-debt'\nexport * from './lib/server/sending-domain-recheck'\n// The hosting seam itself, so a door can ask whether this deployment is able\n// to register a name at all before it promises the caller one.\n// `workspace-domains` re-exports the pieces its own callers share with it; the\n// provider behind it is not among them.\nexport { domainProvider } from './lib/server/domain-provider'\nexport type {\n DomainProvider,\n DomainProviderId,\n DomainScope,\n} from './lib/server/domain-provider'\nexport * from './lib/server/platform-domain-names'\nexport * from './lib/server/consume-once'\nexport * from './lib/server/csp-aggregate'\nexport * from './lib/server/data-storage-gate'\nexport * from './lib/server/contact-suppression'\nexport * from './lib/server/email-suppression'\n// The double opt-in quarantine, after the module whose keying it shares and\n// whose `filterTopicSendable` is the reader that makes it a quarantine rather\n// than a stored fact.\nexport * from './lib/server/topic-subscriptions'\nexport * from './lib/server/email-unsubscribe-link'\nexport * from './lib/server/email-flow-gate'\n// Side-effecting on purpose, for the reason `email-send-rate` below is:\n// evaluating this module INSTALLS the marketing gate on `sendEmail`, so the\n// unsubscribe header, the suppression check and the frequency ceiling reach\n// every bulk sender without a call at each server entrypoint.\nexport * from './lib/server/email-marketing-gate'\n// A consent group change (AGL-3320): the carries of the three stores above,\n// and the executor that runs a change around them.\nexport * from './lib/server/consent-group-carry'\nexport * from './lib/server/consent-group-change'\n// A person's refusal kept after the record it was written on is deleted\n// (AGL-3338): the delete's write, the list gate's read, and the change's carry.\nexport * from './lib/server/retained-refusals'\nexport * from './lib/server/sms-keywords'\nexport * from './lib/server/document-id'\nexport * from './lib/server/collection-preview-token'\nexport * from './lib/server/edit-access-authz'\nexport * from './lib/server/edit-access-token'\nexport * from './lib/server/edit-hint-token'\nexport * from './lib/server/email-metering'\n// Side-effecting on purpose (AGL-2409): evaluating this module INSTALLS the\n// platform send-rate governor on `sendEmail`. Every server surface already\n// imports this barrel, so nothing has to remember to call an installer.\nexport * from './lib/server/email-send-rate'\n// Side-effecting on purpose, for the same reason (AGL-3328): evaluating this\n// module INSTALLS the deliverability preflight on `sendEmail`, so a recipient\n// whose domain takes no mail is refused, and bulk mail behind a gateway that\n// refused its sending domain twice is held, on every send path at once.\nexport * from './lib/server/email-deliverability'\nexport * from './lib/server/email-sender-reputation'\nexport * from './lib/server/erase'\nexport * from './lib/server/erase-person'\nexport * from './lib/server/dynamic-list-materialize'\nexport * from './lib/server/firebase-admin'\nexport * from './lib/server/free-workspace-cap'\nexport * from './lib/server/ga4-measurement-protocol'\nexport * from './lib/server/host-memberships'\n// Connecting a name to a site, for the attach route and for plugins that\n// bought the name (AGL-3961).\nexport * from './lib/server/host-custom-domain'\nexport * from './lib/server/custom-domain-redirects'\nexport * from './lib/server/host-visitor-records'\nexport * from './lib/server/list-members'\nexport * from './lib/server/lockdown'\nexport * from './lib/server/token-revocation'\nexport * from './lib/server/tenant-write-lockdown'\nexport * from './lib/server/outbound-send-review'\n// The same review for a published page, read where it is composed (AGL-3356).\nexport * from './lib/server/hosted-page-review'\n// Every hold, flag, lock and pause tells owners and staff through one seam (AGL-3368).\nexport * from './lib/server/risk-notice'\nexport * from './lib/server/host-email-tokens'\nexport * from './lib/server/notifications'\n// Every operator alert raises through one entry point, and every health check\n// remembers its state (AGL-3377).\nexport * from './lib/server/operator-alerts'\nexport * from './lib/server/operator-health'\nexport * from './lib/server/org-billing'\nexport * from './lib/server/organizations'\n// Per-member permission overrides, org-wide and per site (AGL-4047).\nexport * from './lib/server/member-permission-overrides'\n// Platform staff take no customer seat, and a workspace is asked to upgrade\n// as a separate step after it is handed over (AGL-3466).\nexport * from './lib/server/staff-seat'\nexport * from './lib/server/upgrade-proposal'\nexport * from './lib/server/duplicate-activity'\nexport * from './lib/server/duplicate-resource'\nexport * from './lib/server/workspace-domains'\nexport * from './lib/server/membership-recover-throttle'\nexport * from './lib/server/password-reset-throttle'\nexport * from './lib/server/rate-limit-store'\nexport * from './lib/server/verify-email-cooldown'\nexport * from './lib/server/vercel-drain-signature'\nexport * from './lib/server/vercel-log-drain'\nexport * from './lib/server/visitor-write-rate-limit'\nexport * from './lib/server/card-payment-velocity'\nexport * from './lib/server/console-api-rate-limit'\nexport * from './lib/server/realm-plugins'\nexport * from './lib/server/release-flags'\nexport * from './lib/server/resolve-people'\nexport * from './lib/server/member-photo'\nexport * from './lib/server/personal-data-export'\nexport * from './lib/server/media-delivery'\nexport * from './lib/server/media-download-tokens'\nexport * from './lib/server/media-quarantine'\nexport * from './lib/server/media-signing'\nexport * from './lib/server/media-storage-path'\nexport * from './lib/server/safe-equal'\nexport * from './lib/server/media-strong-digest'\nexport * from './lib/server/media-tombstone'\nexport * from './lib/server/media-delivery-regeneration'\nexport * from './lib/server/media-variants'\nexport * from './lib/server/media-photo-links'\n// The one-screen build for a client (AGL-3958): staff hold its record.\nexport * from './lib/server/client-build'\nexport * from './lib/server/serve-media-cdn'\nexport * from './lib/server/serve-plugin-fetch'\nexport * from './lib/server/configured-url-fetch'\nexport * from './lib/server/sso-break-glass-owners'\nexport * from './lib/server/sso-domain-policy'\nexport * from './lib/server/sso-enforcement'\nexport * from './lib/server/sso-provisioning'\nexport * from './lib/server/update-existing'\nexport * from './lib/server/contact-company-link'\nexport * from './lib/server/contact-email-index'\nexport * from './lib/server/upsert-contact'\nexport * from './lib/server/crm-records'\n// The `nextTaskAtMs` a contact, a company and a deal carry, recomputed from\n// their open tasks by every server-side task writer (AGL-2661).\n// Where a one-to-one email's activity row lives and how the delivery\n// webhook advances it (AGL-2615).\n// A member's own addresses in a workspace, and the signed link that\n// confirms one (AGL-2975).\nexport * from './lib/server/member-email-aliases'\nexport * from './lib/server/user-profiles'\n// One answer to an account's name and photo, and the SSO sign-in fill of a\n// blank Auth record (AGL-3721).\nexport * from './lib/server/account-identity'\n// The one \"New account\" staff notice per account, keyed on the auth\n// record's creation (AGL-3225).\nexport * from './lib/server/new-account-announcement'\nexport * from './lib/server/legal-acceptance'\n// The person's decision about the platform's own product email, on their\n// document and on the operator's marketing contact (AGL-3185).\nexport * from './lib/server/platform-marketing-consent'\n"],"names":["merchantAccountIsReady","merchantAccountReadiness","paymentProvider","domainProvider"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,sCAAkC;AAChD,cAAc,2BAAuB;AACrC,cAAc,2BAAuB;AACrC,cAAc,iCAA6B;AAC3C,cAAc,6BAAyB;AACvC,cAAc,sCAAkC;AAChD,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAC5E,qBAAqB;AACrB,SACEA,sBAAsB,EACtBC,wBAAwB,EACxBC,eAAe,QACV,mCAA+B;AAQtC,cAAc,+BAA2B;AACzC,cAAc,kCAA8B;AAC5C,cAAc,4BAAwB;AACtC,yEAAyE;AACzE,6CAA6C;AAC7C,cAAc,mCAA+B;AAC7C,cAAc,kCAA8B;AAC5C,cAAc,mCAA+B;AAC7C,cAAc,sCAAkC;AAChD,cAAc,sCAAkC;AAChD,cAAc,yCAAqC;AACnD,6EAA6E;AAC7E,+DAA+D;AAC/D,+EAA+E;AAC/E,wCAAwC;AACxC,SAASC,cAAc,QAAQ,kCAA8B;AAM7D,cAAc,wC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