@aglyn/tenant-data-admin 1.0.0-beta.269 → 1.0.0-beta.270

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 (35) hide show
  1. package/package.json +7 -7
  2. package/src/lib/render-cache.d.ts +10 -3
  3. package/src/lib/render-cache.js +10 -3
  4. package/src/lib/render-cache.js.map +1 -1
  5. package/src/lib/server/billing-addons.d.ts +8 -6
  6. package/src/lib/server/billing-addons.js +19 -8
  7. package/src/lib/server/billing-addons.js.map +1 -1
  8. package/src/lib/server/configured-url-fetch.d.ts +26 -0
  9. package/src/lib/server/configured-url-fetch.js +68 -0
  10. package/src/lib/server/configured-url-fetch.js.map +1 -1
  11. package/src/lib/server/custom-domain-redirects.d.ts +50 -0
  12. package/src/lib/server/custom-domain-redirects.js +61 -0
  13. package/src/lib/server/custom-domain-redirects.js.map +1 -0
  14. package/src/lib/server/host-custom-domain.d.ts +125 -0
  15. package/src/lib/server/host-custom-domain.js +395 -0
  16. package/src/lib/server/host-custom-domain.js.map +1 -0
  17. package/src/lib/server/host-released-names.d.ts +1 -2
  18. package/src/lib/server/host-released-names.js +4 -2
  19. package/src/lib/server/host-released-names.js.map +1 -1
  20. package/src/lib/server/media-photo-links.d.ts +196 -0
  21. package/src/lib/server/media-photo-links.js +290 -0
  22. package/src/lib/server/media-photo-links.js.map +1 -0
  23. package/src/lib/server/organizations.d.ts +25 -1
  24. package/src/lib/server/organizations.js +62 -2
  25. package/src/lib/server/organizations.js.map +1 -1
  26. package/src/lib/server/personal-data-export.js +21 -1
  27. package/src/lib/server/personal-data-export.js.map +1 -1
  28. package/src/lib/server/push-delivery.js +32 -14
  29. package/src/lib/server/push-delivery.js.map +1 -1
  30. package/src/lib/server/tenant-dns-check.d.ts +58 -0
  31. package/src/lib/server/tenant-dns-check.js +197 -0
  32. package/src/lib/server/tenant-dns-check.js.map +1 -0
  33. package/src/tenancy.d.ts +4 -0
  34. package/src/tenancy.js +8 -0
  35. package/src/tenancy.js.map +1 -1
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * WHETHER A NAME POINTS AT THE TENANT EDGE: the check behind
19
+ * `/api/domains/verify`, here so a caller with no request of its own reads
20
+ * the same answer (AGL-3963). The domains plugin's one-click DNS asks it after
21
+ * a DNS provider wrote the records, and its sweep asks it again for a session
22
+ * whose owner closed the tab; neither can import the console app, and a
23
+ * second copy of this rule is how the displayed target and the accepted one
24
+ * came apart before (AGL-733).
25
+ *
26
+ * The targets are `@aglyn/aglyn/app-utils/tenant-dns-targets`, the values the
27
+ * connect card prints.
28
+ */
29
+ /** A domain as the check accepts one: labels of letters, digits and hyphens. */
30
+ export declare const TENANT_DNS_DOMAIN_PATTERN: RegExp;
31
+ /** What the check found for one name, as `/api/domains/verify` answers it. */
32
+ export interface TenantDnsCheck {
33
+ domain: string;
34
+ /** The name's CNAME targets, lowercased; empty when it carries none. */
35
+ records: string[];
36
+ /** The CNAME target a subdomain must name. */
37
+ expected: string;
38
+ verified: boolean;
39
+ /** Set when an apex passed by the addresses it lands on. */
40
+ matchedBy?: 'apex-address';
41
+ /** Addresses answering for the name that are not ours (AGL-1913). */
42
+ strayAddresses?: string[];
43
+ }
44
+ /**
45
+ * Resolves `domain` and answers whether it points at the tenant edge: its
46
+ * CNAME names `CNAME_TARGET`, or, carrying no CNAME, its addresses are ours.
47
+ *
48
+ * `softPass` accepts ANY CNAME and belongs to local development alone, where
49
+ * nothing points at the edge. A caller passes `isDevelopmentRuntime()` and
50
+ * never a guess: a soft pass that keys on a missing hosting variable is the
51
+ * AGL-2180 hole, where any domain with any CNAME verified on a container.
52
+ *
53
+ * Expects a lowercased name that matched {@link TENANT_DNS_DOMAIN_PATTERN}.
54
+ * Never throws: an unreachable resolver reads as no records.
55
+ */
56
+ export declare function checkTenantDnsPointing(domain: string, options?: {
57
+ softPass?: boolean;
58
+ }): Promise<TenantDnsCheck>;
@@ -0,0 +1,197 @@
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 { CNAME_TARGET, HOST_APEX_ADDRESSES } from "@aglyn/aglyn/app-utils/tenant-dns-targets";
18
+ import { promises as dns, Resolver as CallbackResolver } from "dns";
19
+ import { PUBLIC_DNS_RESOLVERS as PUBLIC_RESOLVERS } from "./dns-probe.js";
20
+ /**
21
+ * WHETHER A NAME POINTS AT THE TENANT EDGE: the check behind
22
+ * `/api/domains/verify`, here so a caller with no request of its own reads
23
+ * the same answer (AGL-3963). The domains plugin's one-click DNS asks it after
24
+ * a DNS provider wrote the records, and its sweep asks it again for a session
25
+ * whose owner closed the tab; neither can import the console app, and a
26
+ * second copy of this rule is how the displayed target and the accepted one
27
+ * came apart before (AGL-733).
28
+ *
29
+ * The targets are `@aglyn/aglyn/app-utils/tenant-dns-targets`, the values the
30
+ * connect card prints.
31
+ */ /** A domain as the check accepts one: labels of letters, digits and hyphens. */ export const TENANT_DNS_DOMAIN_PATTERN = /^(?!-)[a-z0-9-]{1,63}(\.[a-z0-9-]{1,63})+$/i;
32
+ /**
33
+ * Resolve against public resolvers rather than the runtime's default (AGL-734).
34
+ *
35
+ * A stale zone left over from a nameserver migration made Vercel's own resolver
36
+ * return NXDOMAIN for records that every public resolver could see — so a
37
+ * correctly-configured domain reported "no CNAME record found" indefinitely,
38
+ * while `dig` from anywhere else resolved it fine. Pinning the resolver makes
39
+ * the check depend on public DNS, which is what the customer's browser will use
40
+ * anyway, instead of on whatever cache a given lambda inherited.
41
+ *
42
+ * Falls back to the default resolver if the pinned ones are unreachable, so a
43
+ * blocked egress path degrades to today's behaviour rather than failing shut.
44
+ */ async function resolveCnameRecords(domain) {
45
+ const normalise = (records)=>records.map((record)=>record.toLowerCase().replace(/\.$/, ''));
46
+ try {
47
+ const resolver = new CallbackResolver();
48
+ resolver.setServers(PUBLIC_RESOLVERS);
49
+ const records = await new Promise((resolve, reject)=>{
50
+ resolver.resolveCname(domain, (error, addresses)=>error ? reject(error) : resolve(addresses));
51
+ });
52
+ return normalise(records);
53
+ } catch (error) {
54
+ // ENOTFOUND/ENODATA are real answers — the name has no CNAME. Only fall
55
+ // back when the pinned resolvers could not be reached at all.
56
+ const code = error == null ? void 0 : error.code;
57
+ if (code === 'ENOTFOUND' || code === 'ENODATA' || code === 'NXDOMAIN') {
58
+ return [];
59
+ }
60
+ try {
61
+ return normalise(await dns.resolveCname(domain));
62
+ } catch (unused) {
63
+ return [];
64
+ }
65
+ }
66
+ }
67
+ async function resolveARecords(domain) {
68
+ const lookup = async (resolver)=>resolver ? new Promise((resolve, reject)=>{
69
+ resolver.resolve4(domain, (error, addresses)=>error ? reject(error) : resolve(addresses));
70
+ }) : dns.resolve4(domain);
71
+ try {
72
+ const resolver = new CallbackResolver();
73
+ resolver.setServers(PUBLIC_RESOLVERS);
74
+ return await lookup(resolver);
75
+ } catch (error) {
76
+ const code = error == null ? void 0 : error.code;
77
+ if (code === 'ENOTFOUND' || code === 'ENODATA' || code === 'NXDOMAIN') {
78
+ return [];
79
+ }
80
+ try {
81
+ return await lookup();
82
+ } catch (unused) {
83
+ return [];
84
+ }
85
+ }
86
+ }
87
+ /**
88
+ * An apex (`aglyn.com`) cannot carry a CNAME — RFC 1034 forbids one alongside
89
+ * the SOA/NS records every zone apex must have. So the CNAME check below can
90
+ * never pass for a bare domain, and until this existed the wizard simply
91
+ * refused every apex: customers could connect `www.` and nothing else.
92
+ *
93
+ * Instead, compare where the domain actually lands against where the CNAME
94
+ * target lands. Both sides are resolved at check time rather than compared to
95
+ * a hardcoded address list, because the edge IPs behind `sites.aglyn.app` are
96
+ * the host's to change — pinning them here would turn a routine infrastructure
97
+ * change into every customer's domain reporting itself broken.
98
+ *
99
+ * An intersection, not equality: the two names legitimately return different
100
+ * subsets of the same anycast pool from one lookup to the next.
101
+ *
102
+ * `HOST_APEX_ADDRESSES` covers the case the intersection cannot: our platform
103
+ * host publishes a small anycast pool for every apex it serves, routing by
104
+ * `Host` rather than by IP. An apex pointed there therefore never shares an
105
+ * address with `sites.aglyn.app`, yet is configured correctly.
106
+ *
107
+ * The list has to span the host's WHOLE pool, not just the address we happen
108
+ * to have used. It shipped with only `76.76.21.21` — the host's legacy
109
+ * address, which still resolves but is no longer what a newly-pointed apex
110
+ * lands on, so every new customer would have failed the very check this
111
+ * fallback exists to let them pass. Our own zones are the proof: after taking
112
+ * the host's recommended records, `aglyn.com` and `aglyn.io` resolve into the
113
+ * `216.198.79.x` / `64.29.17.x` range and not one of them is the legacy
114
+ * address. Keep the legacy entry — zones still pointed at it work fine.
115
+ *
116
+ * Accepting an address match is deliberately a weaker claim — "this domain
117
+ * resolves to our platform" rather than "to this account". That is sound
118
+ * because it is not the ownership check: attaching a domain to the project is,
119
+ * and the platform performs that itself. This only answers "has DNS been
120
+ * pointed yet", which is what the customer is actually stuck on. Configurable
121
+ * so the next range expansion is an env edit rather than a patch.
122
+ *
123
+ * The list itself lives in `tenant-dns-targets.ts` beside `CNAME_TARGET`, so the
124
+ * wizard prints an address this check will actually accept rather than keeping
125
+ * its own copy under a different env var (AGL-1275) — that env edit is exactly
126
+ * the move which used to leave the two disagreeing.
127
+ */ /**
128
+ * The `stray` half exists because the intersection above is deliberately an
129
+ * `some`, and a name can answer with our addresses AND somebody else's at the
130
+ * same time (AGL-1913).
131
+ *
132
+ * That is the shape a stale A record makes: a previous host's address left in
133
+ * the zone answers alongside a correct ALIAS, the resolver hands out whichever
134
+ * it likes, and the site loads for one visitor and not the next. Every check we
135
+ * had reported that domain as verified, because it is — some of the time — and
136
+ * "it works when I try it" is exactly why nobody finds it.
137
+ *
138
+ * Reported, not refused. Refusing would mean treating "an address we do not
139
+ * recognise" as proof of misconfiguration, and the recognised set is an env var
140
+ * plus a live lookup of one hostname: the day the platform widens its pool
141
+ * ahead of our config, refusing would fail every correctly-pointed apex at
142
+ * once. A warning costs a confused customer nothing and cannot take the flow
143
+ * down.
144
+ */ async function apexPointsAtTenantEdge(domain) {
145
+ const [domainAddresses, targetAddresses] = await Promise.all([
146
+ resolveARecords(domain),
147
+ resolveARecords(CNAME_TARGET)
148
+ ]);
149
+ if (!domainAddresses.length) return {
150
+ matched: false,
151
+ stray: []
152
+ };
153
+ const acceptable = new Set([
154
+ ...targetAddresses,
155
+ ...HOST_APEX_ADDRESSES
156
+ ]);
157
+ return {
158
+ matched: domainAddresses.some((address)=>acceptable.has(address)),
159
+ stray: domainAddresses.filter((address)=>!acceptable.has(address))
160
+ };
161
+ }
162
+ /**
163
+ * Resolves `domain` and answers whether it points at the tenant edge: its
164
+ * CNAME names `CNAME_TARGET`, or, carrying no CNAME, its addresses are ours.
165
+ *
166
+ * `softPass` accepts ANY CNAME and belongs to local development alone, where
167
+ * nothing points at the edge. A caller passes `isDevelopmentRuntime()` and
168
+ * never a guess: a soft pass that keys on a missing hosting variable is the
169
+ * AGL-2180 hole, where any domain with any CNAME verified on a container.
170
+ *
171
+ * Expects a lowercased name that matched {@link TENANT_DNS_DOMAIN_PATTERN}.
172
+ * Never throws: an unreachable resolver reads as no records.
173
+ */ export async function checkTenantDnsPointing(domain, options = {}) {
174
+ // NXDOMAIN / no CNAME comes back as an empty list — reported as unverified.
175
+ const records = await resolveCnameRecords(domain);
176
+ const cnameVerified = records.includes(CNAME_TARGET) || options.softPass === true && records.length > 0;
177
+ // Only fall back to the address comparison when there is no CNAME at all.
178
+ // A domain that DOES carry a CNAME but points somewhere else must keep
179
+ // failing — otherwise "pointed at the wrong place" and "pointed at an apex"
180
+ // would verify identically.
181
+ const apex = records.length ? {
182
+ matched: false,
183
+ stray: []
184
+ } : await apexPointsAtTenantEdge(domain);
185
+ return _extends({
186
+ domain,
187
+ records,
188
+ expected: CNAME_TARGET,
189
+ verified: cnameVerified || apex.matched
190
+ }, apex.matched && {
191
+ matchedBy: 'apex-address'
192
+ }, apex.stray.length ? {
193
+ strayAddresses: apex.stray
194
+ } : {});
195
+ }
196
+
197
+ //# sourceMappingURL=tenant-dns-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/tenant/data/admin/src/lib/server/tenant-dns-check.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 { CNAME_TARGET, HOST_APEX_ADDRESSES } from '@aglyn/aglyn/app-utils/tenant-dns-targets'\nimport { promises as dns, Resolver as CallbackResolver } from 'dns'\nimport { PUBLIC_DNS_RESOLVERS as PUBLIC_RESOLVERS } from './dns-probe'\n\n/**\n * WHETHER A NAME POINTS AT THE TENANT EDGE: the check behind\n * `/api/domains/verify`, here so a caller with no request of its own reads\n * the same answer (AGL-3963). The domains plugin's one-click DNS asks it after\n * a DNS provider wrote the records, and its sweep asks it again for a session\n * whose owner closed the tab; neither can import the console app, and a\n * second copy of this rule is how the displayed target and the accepted one\n * came apart before (AGL-733).\n *\n * The targets are `@aglyn/aglyn/app-utils/tenant-dns-targets`, the values the\n * connect card prints.\n */\n\n/** A domain as the check accepts one: labels of letters, digits and hyphens. */\nexport const TENANT_DNS_DOMAIN_PATTERN = /^(?!-)[a-z0-9-]{1,63}(\\.[a-z0-9-]{1,63})+$/i\n\n/**\n * Resolve against public resolvers rather than the runtime's default (AGL-734).\n *\n * A stale zone left over from a nameserver migration made Vercel's own resolver\n * return NXDOMAIN for records that every public resolver could see — so a\n * correctly-configured domain reported \"no CNAME record found\" indefinitely,\n * while `dig` from anywhere else resolved it fine. Pinning the resolver makes\n * the check depend on public DNS, which is what the customer's browser will use\n * anyway, instead of on whatever cache a given lambda inherited.\n *\n * Falls back to the default resolver if the pinned ones are unreachable, so a\n * blocked egress path degrades to today's behaviour rather than failing shut.\n */\n\nasync function resolveCnameRecords(domain: string): Promise<string[]> {\n const normalise = (records: string[]) =>\n records.map((record) => record.toLowerCase().replace(/\\.$/, ''))\n try {\n const resolver = new CallbackResolver()\n resolver.setServers(PUBLIC_RESOLVERS)\n const records = await new Promise<string[]>((resolve, reject) => {\n resolver.resolveCname(domain, (error, addresses) =>\n error ? reject(error) : resolve(addresses),\n )\n })\n return normalise(records)\n } catch (error) {\n // ENOTFOUND/ENODATA are real answers — the name has no CNAME. Only fall\n // back when the pinned resolvers could not be reached at all.\n const code = (error as NodeJS.ErrnoException)?.code\n if (code === 'ENOTFOUND' || code === 'ENODATA' || code === 'NXDOMAIN') {\n return []\n }\n try {\n return normalise(await dns.resolveCname(domain))\n } catch {\n return []\n }\n }\n}\n\nasync function resolveARecords(domain: string): Promise<string[]> {\n const lookup = async (resolver?: CallbackResolver) =>\n resolver\n ? new Promise<string[]>((resolve, reject) => {\n resolver.resolve4(domain, (error, addresses) =>\n error ? reject(error) : resolve(addresses),\n )\n })\n : dns.resolve4(domain)\n try {\n const resolver = new CallbackResolver()\n resolver.setServers(PUBLIC_RESOLVERS)\n return await lookup(resolver)\n } catch (error) {\n const code = (error as NodeJS.ErrnoException)?.code\n if (code === 'ENOTFOUND' || code === 'ENODATA' || code === 'NXDOMAIN') {\n return []\n }\n try {\n return await lookup()\n } catch {\n return []\n }\n }\n}\n\n/**\n * An apex (`aglyn.com`) cannot carry a CNAME — RFC 1034 forbids one alongside\n * the SOA/NS records every zone apex must have. So the CNAME check below can\n * never pass for a bare domain, and until this existed the wizard simply\n * refused every apex: customers could connect `www.` and nothing else.\n *\n * Instead, compare where the domain actually lands against where the CNAME\n * target lands. Both sides are resolved at check time rather than compared to\n * a hardcoded address list, because the edge IPs behind `sites.aglyn.app` are\n * the host's to change — pinning them here would turn a routine infrastructure\n * change into every customer's domain reporting itself broken.\n *\n * An intersection, not equality: the two names legitimately return different\n * subsets of the same anycast pool from one lookup to the next.\n *\n * `HOST_APEX_ADDRESSES` covers the case the intersection cannot: our platform\n * host publishes a small anycast pool for every apex it serves, routing by\n * `Host` rather than by IP. An apex pointed there therefore never shares an\n * address with `sites.aglyn.app`, yet is configured correctly.\n *\n * The list has to span the host's WHOLE pool, not just the address we happen\n * to have used. It shipped with only `76.76.21.21` — the host's legacy\n * address, which still resolves but is no longer what a newly-pointed apex\n * lands on, so every new customer would have failed the very check this\n * fallback exists to let them pass. Our own zones are the proof: after taking\n * the host's recommended records, `aglyn.com` and `aglyn.io` resolve into the\n * `216.198.79.x` / `64.29.17.x` range and not one of them is the legacy\n * address. Keep the legacy entry — zones still pointed at it work fine.\n *\n * Accepting an address match is deliberately a weaker claim — \"this domain\n * resolves to our platform\" rather than \"to this account\". That is sound\n * because it is not the ownership check: attaching a domain to the project is,\n * and the platform performs that itself. This only answers \"has DNS been\n * pointed yet\", which is what the customer is actually stuck on. Configurable\n * so the next range expansion is an env edit rather than a patch.\n *\n * The list itself lives in `tenant-dns-targets.ts` beside `CNAME_TARGET`, so the\n * wizard prints an address this check will actually accept rather than keeping\n * its own copy under a different env var (AGL-1275) — that env edit is exactly\n * the move which used to leave the two disagreeing.\n */\n/**\n * The `stray` half exists because the intersection above is deliberately an\n * `some`, and a name can answer with our addresses AND somebody else's at the\n * same time (AGL-1913).\n *\n * That is the shape a stale A record makes: a previous host's address left in\n * the zone answers alongside a correct ALIAS, the resolver hands out whichever\n * it likes, and the site loads for one visitor and not the next. Every check we\n * had reported that domain as verified, because it is — some of the time — and\n * \"it works when I try it\" is exactly why nobody finds it.\n *\n * Reported, not refused. Refusing would mean treating \"an address we do not\n * recognise\" as proof of misconfiguration, and the recognised set is an env var\n * plus a live lookup of one hostname: the day the platform widens its pool\n * ahead of our config, refusing would fail every correctly-pointed apex at\n * once. A warning costs a confused customer nothing and cannot take the flow\n * down.\n */\nasync function apexPointsAtTenantEdge(\n domain: string,\n): Promise<{ matched: boolean; stray: string[] }> {\n const [domainAddresses, targetAddresses] = await Promise.all([\n resolveARecords(domain),\n resolveARecords(CNAME_TARGET),\n ])\n if (!domainAddresses.length) return { matched: false, stray: [] }\n const acceptable = new Set([...targetAddresses, ...HOST_APEX_ADDRESSES])\n return {\n matched: domainAddresses.some((address) => acceptable.has(address)),\n stray: domainAddresses.filter((address) => !acceptable.has(address)),\n }\n}\n\n/** What the check found for one name, as `/api/domains/verify` answers it. */\nexport interface TenantDnsCheck {\n domain: string\n /** The name's CNAME targets, lowercased; empty when it carries none. */\n records: string[]\n /** The CNAME target a subdomain must name. */\n expected: string\n verified: boolean\n /** Set when an apex passed by the addresses it lands on. */\n matchedBy?: 'apex-address'\n /** Addresses answering for the name that are not ours (AGL-1913). */\n strayAddresses?: string[]\n}\n\n/**\n * Resolves `domain` and answers whether it points at the tenant edge: its\n * CNAME names `CNAME_TARGET`, or, carrying no CNAME, its addresses are ours.\n *\n * `softPass` accepts ANY CNAME and belongs to local development alone, where\n * nothing points at the edge. A caller passes `isDevelopmentRuntime()` and\n * never a guess: a soft pass that keys on a missing hosting variable is the\n * AGL-2180 hole, where any domain with any CNAME verified on a container.\n *\n * Expects a lowercased name that matched {@link TENANT_DNS_DOMAIN_PATTERN}.\n * Never throws: an unreachable resolver reads as no records.\n */\nexport async function checkTenantDnsPointing(\n domain: string,\n options: { softPass?: boolean } = {},\n): Promise<TenantDnsCheck> {\n // NXDOMAIN / no CNAME comes back as an empty list — reported as unverified.\n const records = await resolveCnameRecords(domain)\n const cnameVerified =\n records.includes(CNAME_TARGET) || (options.softPass === true && records.length > 0)\n // Only fall back to the address comparison when there is no CNAME at all.\n // A domain that DOES carry a CNAME but points somewhere else must keep\n // failing — otherwise \"pointed at the wrong place\" and \"pointed at an apex\"\n // would verify identically.\n const apex = records.length\n ? { matched: false, stray: [] as string[] }\n : await apexPointsAtTenantEdge(domain)\n return {\n domain,\n records,\n expected: CNAME_TARGET,\n verified: cnameVerified || apex.matched,\n // Which rule passed, so the wizard can explain itself rather than just\n // showing a tick.\n ...(apex.matched && { matchedBy: 'apex-address' as const }),\n // Addresses answering for the name that are not ours. A verified domain\n // with a non-empty list here is the one that loads intermittently.\n ...(apex.stray.length ? { strayAddresses: apex.stray } : {}),\n }\n}\n"],"names":["CNAME_TARGET","HOST_APEX_ADDRESSES","promises","dns","Resolver","CallbackResolver","PUBLIC_DNS_RESOLVERS","PUBLIC_RESOLVERS","TENANT_DNS_DOMAIN_PATTERN","resolveCnameRecords","domain","normalise","records","map","record","toLowerCase","replace","resolver","setServers","Promise","resolve","reject","resolveCname","error","addresses","code","resolveARecords","lookup","resolve4","apexPointsAtTenantEdge","domainAddresses","targetAddresses","all","length","matched","stray","acceptable","Set","some","address","has","filter","checkTenantDnsPointing","options","cnameVerified","includes","softPass","apex","expected","verified","matchedBy","strayAddresses"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,YAAY,EAAEC,mBAAmB,QAAQ,4CAA2C;AAC7F,SAASC,YAAYC,GAAG,EAAEC,YAAYC,gBAA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AEkB,gBAAgBJ,KAAKZ,KAAK;IAAC,IAAI,CAAC;AAE9D"}
package/src/tenancy.d.ts CHANGED
@@ -25,6 +25,7 @@ export type { MerchantAccountReadiness, MerchantAccountReadinessInput, PaymentMo
25
25
  export * from './lib/server/auth-handoff';
26
26
  export * from './lib/server/console-domains';
27
27
  export * from './lib/server/dns-probe';
28
+ export * from './lib/server/tenant-dns-check';
28
29
  export * from './lib/server/sending-domains';
29
30
  export * from './lib/server/sender-readiness';
30
31
  export * from './lib/server/host-sending-domain';
@@ -62,6 +63,8 @@ export * from './lib/server/firebase-admin';
62
63
  export * from './lib/server/free-workspace-cap';
63
64
  export * from './lib/server/ga4-measurement-protocol';
64
65
  export * from './lib/server/host-memberships';
66
+ export * from './lib/server/host-custom-domain';
67
+ export * from './lib/server/custom-domain-redirects';
65
68
  export * from './lib/server/host-visitor-records';
66
69
  export * from './lib/server/list-members';
67
70
  export * from './lib/server/lockdown';
@@ -105,6 +108,7 @@ export * from './lib/server/media-strong-digest';
105
108
  export * from './lib/server/media-tombstone';
106
109
  export * from './lib/server/media-delivery-regeneration';
107
110
  export * from './lib/server/media-variants';
111
+ export * from './lib/server/media-photo-links';
108
112
  export * from './lib/server/serve-media-cdn';
109
113
  export * from './lib/server/serve-plugin-fetch';
110
114
  export * from './lib/server/configured-url-fetch';
package/src/tenancy.js CHANGED
@@ -27,6 +27,9 @@ export { merchantAccountIsReady, merchantAccountReadiness, paymentProvider } fro
27
27
  export * from "./lib/server/auth-handoff.js";
28
28
  export * from "./lib/server/console-domains.js";
29
29
  export * from "./lib/server/dns-probe.js";
30
+ // Whether a name points at the tenant edge, for the verify route and the
31
+ // domains plugin's one-click DNS (AGL-3963).
32
+ export * from "./lib/server/tenant-dns-check.js";
30
33
  export * from "./lib/server/sending-domains.js";
31
34
  export * from "./lib/server/sender-readiness.js";
32
35
  export * from "./lib/server/host-sending-domain.js";
@@ -85,6 +88,10 @@ export * from "./lib/server/firebase-admin.js";
85
88
  export * from "./lib/server/free-workspace-cap.js";
86
89
  export * from "./lib/server/ga4-measurement-protocol.js";
87
90
  export * from "./lib/server/host-memberships.js";
91
+ // Connecting a name to a site, for the attach route and for plugins that
92
+ // bought the name (AGL-3961).
93
+ export * from "./lib/server/host-custom-domain.js";
94
+ export * from "./lib/server/custom-domain-redirects.js";
88
95
  export * from "./lib/server/host-visitor-records.js";
89
96
  export * from "./lib/server/list-members.js";
90
97
  export * from "./lib/server/lockdown.js";
@@ -134,6 +141,7 @@ export * from "./lib/server/media-strong-digest.js";
134
141
  export * from "./lib/server/media-tombstone.js";
135
142
  export * from "./lib/server/media-delivery-regeneration.js";
136
143
  export * from "./lib/server/media-variants.js";
144
+ export * from "./lib/server/media-photo-links.js";
137
145
  export * from "./lib/server/serve-media-cdn.js";
138
146
  export * from "./lib/server/serve-plugin-fetch.js";
139
147
  export * from "./lib/server/configured-url-fetch.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'\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'\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/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","payment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,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// 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'\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,c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