@odla-ai/chapter 0.47.10 → 0.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +231 -19
- package/dist/{chunk-VWDEHUNI.js → chunk-KZ2AXEZW.js} +497 -204
- package/dist/chunk-KZ2AXEZW.js.map +1 -0
- package/dist/{chunk-7MEVZEL2.js → chunk-MQ4OPZCS.js} +969 -516
- package/dist/chunk-MQ4OPZCS.js.map +1 -0
- package/dist/{copy-context-Dorxp-WK.d.ts → copy-context-BveBZglM.d.ts} +18 -7
- package/dist/index.cjs +3842 -773
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +775 -90
- package/dist/index.d.ts +775 -90
- package/dist/index.js +3835 -766
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +144 -42
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +92 -2
- package/dist/testing.d.ts +92 -2
- package/dist/testing.js +144 -42
- package/dist/testing.js.map +1 -1
- package/dist/ui/admin/index.d.ts +75 -5
- package/dist/ui/admin/index.js +3 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +4 -2
- package/dist/ui/member/index.d.ts +9 -2
- package/dist/ui/member/index.js +1 -1
- package/dist/worker/index.cjs +10549 -5504
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.d.cts +509 -9
- package/dist/worker/index.d.ts +509 -9
- package/dist/worker/index.js +8607 -3563
- package/dist/worker/index.js.map +1 -1
- package/package.json +5 -5
- package/runbooks/adopt-existing.md +44 -8
- package/dist/chunk-7MEVZEL2.js.map +0 -1
- package/dist/chunk-VWDEHUNI.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -185,6 +185,8 @@ interface ChapterSignupControl {
|
|
|
185
185
|
sourceId: string;
|
|
186
186
|
/** Follower-vault key holding the dedicated edge secret. */
|
|
187
187
|
secretName?: string;
|
|
188
|
+
/** Optional per-runtime vault keys. When present, unlisted runtimes and legacy untargeted deliveries fail closed. */
|
|
189
|
+
runtimeSecrets?: Readonly<Record<string, string>>;
|
|
188
190
|
/** Stripe mode this deployed environment accepts. */
|
|
189
191
|
stripeMode: "test" | "live";
|
|
190
192
|
}
|
|
@@ -192,6 +194,7 @@ interface ChapterSignupControl {
|
|
|
192
194
|
interface ResolvedSignupControl {
|
|
193
195
|
sourceId: string;
|
|
194
196
|
secretName: string;
|
|
197
|
+
runtimeSecrets?: Readonly<Record<string, string>>;
|
|
195
198
|
stripeMode: "test" | "live";
|
|
196
199
|
}
|
|
197
200
|
|
|
@@ -367,6 +370,9 @@ interface ChapterNetworkReader {
|
|
|
367
370
|
* receive pushed records. It must explicitly declare `readers` before any peer
|
|
368
371
|
* can browse its CRM. */
|
|
369
372
|
interface ChapterNetwork {
|
|
373
|
+
/** Require the protected super-admin tier for remote mutations and operational
|
|
374
|
+
* detail. Ordinary admins retain routine name/email directory reads. */
|
|
375
|
+
requireSuperAdminWrites?: boolean;
|
|
370
376
|
targets?: readonly ChapterNetworkTarget[];
|
|
371
377
|
readers?: readonly ChapterNetworkReader[];
|
|
372
378
|
}
|
|
@@ -421,6 +427,7 @@ interface ResolvedNetworkReader {
|
|
|
421
427
|
}
|
|
422
428
|
/** Fully-resolved leader network configuration. */
|
|
423
429
|
interface ResolvedNetwork {
|
|
430
|
+
requireSuperAdminWrites?: boolean;
|
|
424
431
|
targets: readonly ResolvedNetworkTarget[];
|
|
425
432
|
readers: readonly ResolvedNetworkReader[];
|
|
426
433
|
}
|
|
@@ -615,7 +622,9 @@ interface ChapterScheduling {
|
|
|
615
622
|
}
|
|
616
623
|
/** How a signed-in user's role is determined.
|
|
617
624
|
*
|
|
618
|
-
* - `"
|
|
625
|
+
* - `"clerk"` reads backend-only private Clerk roles for each authorization
|
|
626
|
+
* check, without trusting public metadata or stale session roles.
|
|
627
|
+
* - `"claim"` reads a role ladder from a JWT claim (the legacy member-site model:
|
|
619
628
|
* `provisional → member → admin`). Admin is the last (highest) rung; the
|
|
620
629
|
* Studio-managed super-admin tier sits above it.
|
|
621
630
|
* - `"table"` gates on the deny-all `admins` allowlist (the hub model):
|
|
@@ -623,23 +632,25 @@ interface ChapterScheduling {
|
|
|
623
632
|
*
|
|
624
633
|
* Defaults: `"claim"` in `chapter` mode, `"table"` in `hub` mode. */
|
|
625
634
|
interface ChapterAuth {
|
|
626
|
-
|
|
635
|
+
/** `clerk` reads backend-only private_metadata.role on each request, ignoring
|
|
636
|
+
* JWT/public roles. Select explicitly after the coordinated role migration. */
|
|
637
|
+
source?: "claim" | "table" | "clerk";
|
|
627
638
|
/** JWT claim holding the role, for `source: "claim"`. Default `"role"`. */
|
|
628
639
|
claim?: string;
|
|
629
|
-
/** Role ladder low→high, for
|
|
640
|
+
/** Role ladder low→high, for claim or private Clerk roles. The last entry is admin.
|
|
630
641
|
* Default `["provisional", "member", "admin"]`. */
|
|
631
642
|
ladder?: readonly string[];
|
|
632
643
|
/** Enable the Studio-managed super-admin tier — the only tier that may
|
|
633
|
-
* create/modify admins. Default: `true` for `"claim"`, `false` for `"table"`. */
|
|
644
|
+
* create/modify admins. Default: `true` for `"claim"`/`"clerk"`, `false` for `"table"`. */
|
|
634
645
|
superAdmins?: boolean;
|
|
635
646
|
/** Authority behind the super-admin tier. `"table"` preserves the legacy
|
|
636
|
-
* app allowlist; `"odla"` reads protected `$users.role
|
|
637
|
-
* for
|
|
647
|
+
* app allowlist; `"odla"` reads protected `$users.role` by exact subject ID.
|
|
648
|
+
* Default `"odla"` for private Clerk mode, `"table"` for legacy modes. */
|
|
638
649
|
superAdminSource?: "table" | "odla";
|
|
639
650
|
}
|
|
640
651
|
/** The fully-resolved auth policy (defaults applied) carried on the {@link Chapter}. */
|
|
641
652
|
interface ResolvedAuth {
|
|
642
|
-
source: "claim" | "table";
|
|
653
|
+
source: "claim" | "table" | "clerk";
|
|
643
654
|
claim: string;
|
|
644
655
|
ladder: readonly string[];
|
|
645
656
|
/** The highest ladder rung (last entry) — the "admin" gate. */
|
|
@@ -919,12 +930,13 @@ interface NetworkCommercialFact {
|
|
|
919
930
|
eventType: string;
|
|
920
931
|
eventCreated: number;
|
|
921
932
|
livemode: boolean;
|
|
922
|
-
objectKind: CommercialObjectKind | "ignored";
|
|
933
|
+
objectKind: CommercialObjectKind | "payment_intent" | "ignored";
|
|
923
934
|
objectId: string;
|
|
924
935
|
identity: CommercialIdentity;
|
|
925
936
|
applicationId?: string;
|
|
926
937
|
personId?: string;
|
|
927
938
|
membershipId?: string;
|
|
939
|
+
seatId?: string;
|
|
928
940
|
customerId?: string;
|
|
929
941
|
subscriptionId?: string;
|
|
930
942
|
invoiceId?: string;
|
|
@@ -936,6 +948,18 @@ interface NetworkCommercialFact {
|
|
|
936
948
|
currency?: string;
|
|
937
949
|
amountCents?: number;
|
|
938
950
|
amountPaidCents?: number;
|
|
951
|
+
amountReceivedCents?: number;
|
|
952
|
+
invoiceTotalCents?: number;
|
|
953
|
+
billingReason?: string;
|
|
954
|
+
invoicePaidAt?: number;
|
|
955
|
+
invoicePeriodEndsAt?: number;
|
|
956
|
+
/** Complete, non-prorated recurring invoice lines; absent when ambiguous or truncated. */
|
|
957
|
+
recurringInvoiceLines?: Array<{
|
|
958
|
+
priceId: string;
|
|
959
|
+
quantity: number;
|
|
960
|
+
startsAt: number;
|
|
961
|
+
endsAt: number;
|
|
962
|
+
}>;
|
|
939
963
|
amountRemainingCents?: number;
|
|
940
964
|
currentPeriodStart?: number;
|
|
941
965
|
currentPeriodEnd?: number;
|
|
@@ -957,6 +981,8 @@ interface NetworkCommercialException {
|
|
|
957
981
|
}
|
|
958
982
|
/** Complete deterministic view rebuilt from the append-only commercial event log. */
|
|
959
983
|
interface NetworkCommercialProjection {
|
|
984
|
+
/** Standalone named-seat payments; subscription PaymentIntents are already counted in invoices. */
|
|
985
|
+
seatPayments?: NetworkCommercialProjectedRow[];
|
|
960
986
|
customers: NetworkCommercialProjectedRow[];
|
|
961
987
|
subscriptions: NetworkCommercialProjectedRow[];
|
|
962
988
|
invoices: NetworkCommercialProjectedRow[];
|
|
@@ -997,6 +1023,7 @@ declare function reconcileStripeSnapshot(shadow: NetworkCommercialProjection, sn
|
|
|
997
1023
|
subscriptions: StripeObjectSnapshot;
|
|
998
1024
|
invoices: StripeObjectSnapshot;
|
|
999
1025
|
refunds: StripeObjectSnapshot;
|
|
1026
|
+
payments?: StripeObjectSnapshot;
|
|
1000
1027
|
}, sources: readonly NetworkCommercialSource[]): StripeCommercialReconciliation;
|
|
1001
1028
|
|
|
1002
1029
|
/** Reduce a verified Stripe event to a bounded, PII-free fact. */
|
|
@@ -1203,7 +1230,9 @@ interface ChapterRunbookHints {
|
|
|
1203
1230
|
* Build the one CLI-consumable integration for a chapter/hub: the crm_*
|
|
1204
1231
|
* namespaces + crm_config seed + route probe, merged with the chapter's own
|
|
1205
1232
|
* namespaces and a guarded `groups`-row seed. Drop it in odla.config.mjs's
|
|
1206
|
-
* `integrations` array.
|
|
1233
|
+
* `integrations` array. Claim/private-Clerk policies also seed the exact role
|
|
1234
|
+
* ladder and metadata source for Studio. Seeds are insert-only: when changing
|
|
1235
|
+
* auth policy, reconcile that stored policy explicitly before enabling editing.
|
|
1207
1236
|
*/
|
|
1208
1237
|
declare function createChapterIntegration(chapter: Chapter, options?: ChapterIntegrationOptions): ChapterIntegrationDescriptor;
|
|
1209
1238
|
|
|
@@ -1221,13 +1250,512 @@ declare function createChapterIntegration(chapter: Chapter, options?: ChapterInt
|
|
|
1221
1250
|
* `superAdminSource: "odla"` uses reserved `$users` and adds no app namespace. A `"claim"`
|
|
1222
1251
|
* chapter therefore emits the reference namespace set — `applications`,
|
|
1223
1252
|
* `groups`, `meetings`, `emailLog`, `stripeEventReceipts`,
|
|
1224
|
-
* `subscriptionCheckoutIntents`, `superAdmins` — with
|
|
1253
|
+
* `subscriptionCheckoutIntents`, `chapterAccountPolicy`, `superAdmins` — with
|
|
1225
1254
|
* no `admins` table. */
|
|
1226
1255
|
declare function chapterDb(mode: ChapterMode, auth: ResolvedAuth, includeNetworkNotes?: boolean, application?: ResolvedApplication, includeSignupControl?: boolean, includeMemberContent?: boolean, includeBuilderLibrary?: boolean, includeLeaderAdmissions?: boolean, includeNetworkPersonRegistry?: boolean, includeNetworkCommercialReadModel?: boolean): {
|
|
1227
1256
|
schema: DbSchema;
|
|
1228
1257
|
rules: DbRules;
|
|
1229
1258
|
};
|
|
1230
1259
|
|
|
1260
|
+
/** Immutable commercial policy, separate from the recurring base SKU. */
|
|
1261
|
+
interface MembershipOfferingVersion {
|
|
1262
|
+
id: string;
|
|
1263
|
+
chapterId: string;
|
|
1264
|
+
baseSkuId: string;
|
|
1265
|
+
version: number;
|
|
1266
|
+
status: "draft" | "published" | "retired";
|
|
1267
|
+
effectiveFrom: number;
|
|
1268
|
+
effectiveUntil?: number;
|
|
1269
|
+
basePriceCents: number;
|
|
1270
|
+
currency: string;
|
|
1271
|
+
interval: "month" | "year";
|
|
1272
|
+
term: {
|
|
1273
|
+
kind: "fixed_end";
|
|
1274
|
+
endsAt: number;
|
|
1275
|
+
} | {
|
|
1276
|
+
kind: "rolling_months";
|
|
1277
|
+
months: number;
|
|
1278
|
+
};
|
|
1279
|
+
autoRenew: true;
|
|
1280
|
+
paymentGraceDays: number;
|
|
1281
|
+
seatPriceCents: number;
|
|
1282
|
+
seatPurchaseWindowCalendarMonths: number;
|
|
1283
|
+
requiredDisclosures: string[];
|
|
1284
|
+
}
|
|
1285
|
+
/** Cohort qualification survives the expiration of its monetary benefit. */
|
|
1286
|
+
interface MembershipDiscountPolicyVersion {
|
|
1287
|
+
id: string;
|
|
1288
|
+
chapterId: string;
|
|
1289
|
+
version: number;
|
|
1290
|
+
status: "draft" | "published" | "retired";
|
|
1291
|
+
cohortLabel: string;
|
|
1292
|
+
cohortEligibleSkuIds: string[];
|
|
1293
|
+
discountEligibleSkuIds: string[];
|
|
1294
|
+
softTarget: number;
|
|
1295
|
+
percentOffBps: number;
|
|
1296
|
+
qualifyingStartsAt: number;
|
|
1297
|
+
qualifyingEndsAt: number;
|
|
1298
|
+
benefitDuration: {
|
|
1299
|
+
kind: "first_term" | "while_active";
|
|
1300
|
+
} | {
|
|
1301
|
+
kind: "fixed_end";
|
|
1302
|
+
endsAt: number;
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
/** Add UTC calendar months, clamping month-end dates while preserving the time. */
|
|
1306
|
+
declare function addMembershipCalendarMonths(input: number | string, months: number): number;
|
|
1307
|
+
/** Normalize one version before publishing or issuing it; never retain caller-owned nested objects. */
|
|
1308
|
+
declare function membershipOfferingVersion(value: unknown): MembershipOfferingVersion;
|
|
1309
|
+
/** Normalize cohort and discount eligibility independently; zero discount can still confer founding status. */
|
|
1310
|
+
declare function membershipDiscountPolicyVersion(value: unknown): MembershipDiscountPolicyVersion;
|
|
1311
|
+
|
|
1312
|
+
/** Frozen commercial terms supplied by the issuing membership authority, never the browser. */
|
|
1313
|
+
interface SubscriptionBillingTerms {
|
|
1314
|
+
/** Immutable offering version whose base Price is subscribed. */
|
|
1315
|
+
offeringVersionId: string;
|
|
1316
|
+
/** Immutable discount policy, independent of the base SKU and permanent cohort. */
|
|
1317
|
+
discount?: {
|
|
1318
|
+
policyVersionId: string;
|
|
1319
|
+
couponId: string;
|
|
1320
|
+
percentOffBps: number;
|
|
1321
|
+
duration: "once" | "forever";
|
|
1322
|
+
};
|
|
1323
|
+
/** Extended initial paid service end, epoch milliseconds. Renewal starts here. */
|
|
1324
|
+
initialTermEndsAt?: number;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
/** Money and service promise frozen at offer issuance, not recomputed from later policy edits. */
|
|
1328
|
+
interface MembershipCommercialOffer {
|
|
1329
|
+
offering: MembershipOfferingVersion;
|
|
1330
|
+
discountPolicy: MembershipDiscountPolicyVersion | null;
|
|
1331
|
+
issuedAt: number;
|
|
1332
|
+
founding: boolean;
|
|
1333
|
+
dueTodayCents: number;
|
|
1334
|
+
/** Fixed service end only; rolling service starts at the provider-confirmed payment. */
|
|
1335
|
+
initialTermEndsAt?: number;
|
|
1336
|
+
renewalCents: number;
|
|
1337
|
+
billingTerms: SubscriptionBillingTerms;
|
|
1338
|
+
}
|
|
1339
|
+
/** Calculate a new offer from authority-owned policy and its approved, dues-paying cohort count.
|
|
1340
|
+
* This pure function does not reserve a position or make a shadow ledger authoritative.
|
|
1341
|
+
* Persist the returned promise before accepting consent or performing provider I/O.
|
|
1342
|
+
*/
|
|
1343
|
+
declare function createMembershipCommercialOffer(input: {
|
|
1344
|
+
offering: unknown;
|
|
1345
|
+
discountPolicy?: unknown;
|
|
1346
|
+
approvedFoundingCount: number;
|
|
1347
|
+
now: number;
|
|
1348
|
+
/** Coupon identity must be partitioned by app, environment, runtime and immutable policy. */
|
|
1349
|
+
couponId?: string;
|
|
1350
|
+
}): MembershipCommercialOffer;
|
|
1351
|
+
|
|
1352
|
+
/** Verified source identity supplied by the server adapter, never by a browser's price payload. */
|
|
1353
|
+
interface MembershipOfferRequest {
|
|
1354
|
+
offerId: string;
|
|
1355
|
+
applicationId: string;
|
|
1356
|
+
appId: string;
|
|
1357
|
+
chapterId: string;
|
|
1358
|
+
environment: string;
|
|
1359
|
+
runtime: string;
|
|
1360
|
+
skuId: string;
|
|
1361
|
+
now: number;
|
|
1362
|
+
lifetimeMs: number;
|
|
1363
|
+
}
|
|
1364
|
+
/** Durable pre-payment promise. The opaque digest is what the member acknowledges. */
|
|
1365
|
+
interface IssuedMembershipOffer {
|
|
1366
|
+
id: string;
|
|
1367
|
+
applicationId: string;
|
|
1368
|
+
appId: string;
|
|
1369
|
+
chapterId: string;
|
|
1370
|
+
environment: string;
|
|
1371
|
+
runtime: string;
|
|
1372
|
+
skuId: string;
|
|
1373
|
+
issuedAt: number;
|
|
1374
|
+
expiresAt: number;
|
|
1375
|
+
digest: string;
|
|
1376
|
+
contract: MembershipCommercialOffer;
|
|
1377
|
+
}
|
|
1378
|
+
/** Stable request identity shared by the issuer and a verifying follower. */
|
|
1379
|
+
declare function membershipOfferIdForRequest(input: Pick<MembershipOfferRequest, "appId" | "chapterId" | "environment" | "runtime" | "applicationId"> & {
|
|
1380
|
+
requestId: string;
|
|
1381
|
+
}): Promise<string>;
|
|
1382
|
+
/** Validate and copy a trusted authority response before saving it as a chapter projection.
|
|
1383
|
+
* This verifies the complete target, normalized money promise and digest; it does not
|
|
1384
|
+
* authenticate its transport or make caller-supplied offers authoritative.
|
|
1385
|
+
*/
|
|
1386
|
+
declare function verifyIssuedMembershipOffer(value: unknown, expected: MembershipOfferRequest): Promise<IssuedMembershipOffer>;
|
|
1387
|
+
/** Issue in the network data scope with a revision fence against policy/cohort changes.
|
|
1388
|
+
* The authority state must be explicitly initialized and every policy/count mutation
|
|
1389
|
+
* must increment its revision in the same transaction. Shadow data never qualifies.
|
|
1390
|
+
* This function neither calls Stripe nor grants access. Its caller authenticates the
|
|
1391
|
+
* source deployment before invoking it and must enforce expiry before checkout starts.
|
|
1392
|
+
*/
|
|
1393
|
+
declare function issueMembershipCommercialOffer(db: ChapterDb, input: MembershipOfferRequest): Promise<IssuedMembershipOffer>;
|
|
1394
|
+
|
|
1395
|
+
/** A dedicated two-sided edge: no chapter receives the network database credential. */
|
|
1396
|
+
interface MembershipAuthorityPeer {
|
|
1397
|
+
appId: string;
|
|
1398
|
+
chapterId: string;
|
|
1399
|
+
environment: string;
|
|
1400
|
+
runtime: string;
|
|
1401
|
+
secretName: string;
|
|
1402
|
+
/** Authority-configured, product-separated recurring named-seat Price. Omit to disable seat commands. */
|
|
1403
|
+
seatPriceId?: string;
|
|
1404
|
+
}
|
|
1405
|
+
/** Business API configuration, independent of the browser UI. May be mounted in
|
|
1406
|
+
* the existing BNF backend using its existing odla database; no extra app required.
|
|
1407
|
+
*/
|
|
1408
|
+
interface MembershipAuthorityHandlerOptions {
|
|
1409
|
+
peers: readonly MembershipAuthorityPeer[];
|
|
1410
|
+
/** Connect to the network owner's database (BNF), never a chapter projection. */
|
|
1411
|
+
makeDb: () => ChapterDb;
|
|
1412
|
+
now?: () => number;
|
|
1413
|
+
offerLifetimeMs: number;
|
|
1414
|
+
/** Network vault slot; never supplied by a caller. Defaults to stripe_secret_key. */
|
|
1415
|
+
stripeSecretName?: string;
|
|
1416
|
+
}
|
|
1417
|
+
/** Signed server-to-server route; the runtime is included in the signed request target. */
|
|
1418
|
+
declare const MEMBERSHIP_AUTHORITY_PATH = "/api/membership-authority";
|
|
1419
|
+
/** Create the narrow signed offer issuer. Authentication maps each dedicated edge
|
|
1420
|
+
* to an exact app/chapter/environment/runtime; callers cannot select another scope,
|
|
1421
|
+
* provide prices, grant roles, or run arbitrary network database operations.
|
|
1422
|
+
* Replayed signed requests are safe because issuance is durably idempotent.
|
|
1423
|
+
*/
|
|
1424
|
+
declare function createMembershipAuthorityHandler(options: MembershipAuthorityHandlerOptions): (req: Request) => Promise<Response>;
|
|
1425
|
+
|
|
1426
|
+
/** Per-tier policy overrides prevent a chapter-wide price claim leaking into another SKU. */
|
|
1427
|
+
interface TierPaymentPolicy {
|
|
1428
|
+
refundPolicyText: string;
|
|
1429
|
+
trustCopy?: string;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
/** Server-owned source identity; the browser never supplies an offer or its price. */
|
|
1433
|
+
interface MembershipQuoteTarget {
|
|
1434
|
+
appId: string;
|
|
1435
|
+
chapterId: string;
|
|
1436
|
+
environment: string;
|
|
1437
|
+
runtime: string;
|
|
1438
|
+
applicationId: string;
|
|
1439
|
+
skuId: string;
|
|
1440
|
+
}
|
|
1441
|
+
/** Host transport adapter; may call the signed edge or an in-process network command. */
|
|
1442
|
+
type MembershipOfferIssuer = (input: MembershipQuoteTarget & {
|
|
1443
|
+
requestId: string;
|
|
1444
|
+
}) => Promise<IssuedMembershipOffer>;
|
|
1445
|
+
|
|
1446
|
+
/** A consented offer, bound once to the follower's immutable provider Price and quote. */
|
|
1447
|
+
interface MembershipCheckoutBindingInput extends MembershipQuoteTarget {
|
|
1448
|
+
offerId: string;
|
|
1449
|
+
offerDigest: string;
|
|
1450
|
+
quoteDigest: string;
|
|
1451
|
+
priceId: string;
|
|
1452
|
+
}
|
|
1453
|
+
/** Content-free authority receipt. It does not mean paid, approved, or entitled. */
|
|
1454
|
+
interface MembershipCheckoutBinding extends MembershipCheckoutBindingInput {
|
|
1455
|
+
id: string;
|
|
1456
|
+
boundAt: number;
|
|
1457
|
+
}
|
|
1458
|
+
/** Stable per-application binding identity, separate from an individual offer generation. */
|
|
1459
|
+
declare function membershipCheckoutBindingId(input: MembershipQuoteTarget): Promise<string>;
|
|
1460
|
+
/** Validate an authenticated transport's receipt and discard all undeclared fields. */
|
|
1461
|
+
declare function verifyMembershipCheckoutBinding(value: unknown, input: MembershipCheckoutBindingInput): Promise<MembershipCheckoutBinding>;
|
|
1462
|
+
/** Bind accepted terms in the network transaction before any provider creation.
|
|
1463
|
+
* Replays preserve an already-bound offer after its issuance window ends.
|
|
1464
|
+
* A different offer/Price/consent for the same application is never a second purchase.
|
|
1465
|
+
*/
|
|
1466
|
+
declare function bindMembershipCheckout(db: ChapterDb, input: MembershipCheckoutBindingInput, now: number): Promise<MembershipCheckoutBinding>;
|
|
1467
|
+
|
|
1468
|
+
/** References only. Money facts must already exist in the verified network Stripe event log. */
|
|
1469
|
+
interface ConfirmMembershipPaymentInput extends MembershipQuoteTarget {
|
|
1470
|
+
eventId: string;
|
|
1471
|
+
providerSubscriptionId: string;
|
|
1472
|
+
providerCustomerId: string;
|
|
1473
|
+
}
|
|
1474
|
+
/** The network identity remains source-linked until an explicit canonical Person link exists. */
|
|
1475
|
+
interface MembershipPaymentReceipt {
|
|
1476
|
+
membershipId: string;
|
|
1477
|
+
status: string;
|
|
1478
|
+
initialTermStartedAt: number;
|
|
1479
|
+
initialTermEndsAt: number;
|
|
1480
|
+
cohort: string;
|
|
1481
|
+
memberNumber?: number;
|
|
1482
|
+
}
|
|
1483
|
+
/** Stable network membership identity for the exact chapter application and runtime. */
|
|
1484
|
+
declare function networkMembershipId(input: MembershipQuoteTarget): Promise<string>;
|
|
1485
|
+
/** Commit payment and the pending primary entitlement together, before chapter access can advance.
|
|
1486
|
+
* An authenticated Chapter supplies references, never a paid amount or a synthetic Person id.
|
|
1487
|
+
* A missing independently verified Stripe fact is retryable; browser success is not evidence.
|
|
1488
|
+
*/
|
|
1489
|
+
declare function confirmMembershipPayment(db: ChapterDb, input: ConfirmMembershipPaymentInput, now: number): Promise<MembershipPaymentReceipt>;
|
|
1490
|
+
|
|
1491
|
+
/** Session identity attested by the signed chapter adapter, never a browser's email_verified flag. */
|
|
1492
|
+
interface NamedSeatRecipientInput extends MembershipQuoteTarget {
|
|
1493
|
+
seatId: string;
|
|
1494
|
+
recipientApplicationId: string;
|
|
1495
|
+
recipientUserId: string;
|
|
1496
|
+
verifiedRecipientEmail: string;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
/** Verified full initial refund and subscription cancellation, not a browser assertion. */
|
|
1500
|
+
interface MembershipRefundReceipt {
|
|
1501
|
+
membershipId: string;
|
|
1502
|
+
status: "refunded";
|
|
1503
|
+
refundedCents: number;
|
|
1504
|
+
subscriptionCanceled: true;
|
|
1505
|
+
}
|
|
1506
|
+
/** Refund the frozen initial membership purchase; retain cohort and member order permanently.
|
|
1507
|
+
* The adapter authenticates the operator. Pending state prevents new access while provider effects retry.
|
|
1508
|
+
*/
|
|
1509
|
+
declare function refundNetworkMembership(db: ChapterDb, input: MembershipQuoteTarget, secretKey: string, now: number): Promise<MembershipRefundReceipt>;
|
|
1510
|
+
|
|
1511
|
+
/** Current authoritative billing state; a chapter projection must not derive it from arrival order. */
|
|
1512
|
+
interface MembershipRenewalReceipt {
|
|
1513
|
+
membershipId: string;
|
|
1514
|
+
status: string;
|
|
1515
|
+
termEndsAt: number;
|
|
1516
|
+
graceEndsAt: number;
|
|
1517
|
+
autoRenew: boolean;
|
|
1518
|
+
}
|
|
1519
|
+
/** Apply independently verified renewal success/failure, including co-terminating named seats.
|
|
1520
|
+
* The period and immutable Price set, not webhook delivery order, fence progression.
|
|
1521
|
+
*/
|
|
1522
|
+
declare function reconcileMembershipRenewal(db: ChapterDb, input: MembershipQuoteTarget & {
|
|
1523
|
+
eventId: string;
|
|
1524
|
+
}, now: number): Promise<MembershipRenewalReceipt>;
|
|
1525
|
+
|
|
1526
|
+
/** Short-lived decision from current network state; never a durable bearer capability. */
|
|
1527
|
+
interface MembershipAccessReceipt {
|
|
1528
|
+
membershipId: string;
|
|
1529
|
+
allowed: boolean;
|
|
1530
|
+
status: string;
|
|
1531
|
+
accessEndsAt: number;
|
|
1532
|
+
revision: number;
|
|
1533
|
+
}
|
|
1534
|
+
/** Enforce term/grace expiry even when a webhook, cron, or Clerk role update is delayed. */
|
|
1535
|
+
declare function readMembershipAccess(db: ChapterDb, input: MembershipQuoteTarget, now: number): Promise<MembershipAccessReceipt>;
|
|
1536
|
+
/** Reject an invalid network receipt before a chapter grants private-content access. */
|
|
1537
|
+
declare function verifyMembershipAccessReceipt(value: unknown, input: MembershipQuoteTarget, now: number): Promise<MembershipAccessReceipt>;
|
|
1538
|
+
|
|
1539
|
+
/** Named-seat offer for the authenticated purchaser, not a transferable gift or arbitrary quantity. */
|
|
1540
|
+
interface NamedSeatOffer {
|
|
1541
|
+
membershipId: string;
|
|
1542
|
+
amountCents: number;
|
|
1543
|
+
currency: string;
|
|
1544
|
+
interval: "year" | "month";
|
|
1545
|
+
termEndsAt: number;
|
|
1546
|
+
purchaseEndsAt: number;
|
|
1547
|
+
autoRenew: boolean;
|
|
1548
|
+
eligible: boolean;
|
|
1549
|
+
digest: string;
|
|
1550
|
+
seat?: {
|
|
1551
|
+
seatId: string;
|
|
1552
|
+
status: string;
|
|
1553
|
+
recipientName: string;
|
|
1554
|
+
recipientEmail: string;
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
/** Stable commercial consent fingerprint; eligibility is always checked again at checkout. */
|
|
1558
|
+
declare function namedSeatOfferDigest(offer: Omit<NamedSeatOffer, "digest">): Promise<string>;
|
|
1559
|
+
/** Read the frozen offering and any existing seat without reserving or charging anything. */
|
|
1560
|
+
declare function readNamedSeatOffer(db: ChapterDb, input: MembershipQuoteTarget, now: number): Promise<NamedSeatOffer>;
|
|
1561
|
+
|
|
1562
|
+
/** Identity attested by the recipient's chapter after checking Clerk's verified primary email. */
|
|
1563
|
+
interface NamedSeatInvitationRequest {
|
|
1564
|
+
appId: string;
|
|
1565
|
+
chapterId: string;
|
|
1566
|
+
environment: string;
|
|
1567
|
+
runtime: string;
|
|
1568
|
+
seatId: string;
|
|
1569
|
+
recipientUserId: string;
|
|
1570
|
+
verifiedRecipientEmail: string;
|
|
1571
|
+
}
|
|
1572
|
+
/** Recipient-visible invitation; no purchaser contact information or provider credentials. */
|
|
1573
|
+
interface NamedSeatInvitation {
|
|
1574
|
+
seatId: string;
|
|
1575
|
+
primaryApplicationId: string;
|
|
1576
|
+
skuId: string;
|
|
1577
|
+
recipientName: string;
|
|
1578
|
+
status: string;
|
|
1579
|
+
acceptanceEndsAt: number;
|
|
1580
|
+
termEndsAt: number;
|
|
1581
|
+
}
|
|
1582
|
+
/** Resolve the invitation only for its named, verified person (or already bound user ID). */
|
|
1583
|
+
declare function readNamedSeatInvitation(db: ChapterDb, input: NamedSeatInvitationRequest, now: number): Promise<NamedSeatInvitation>;
|
|
1584
|
+
/** Recipient access requires both current primary membership and this exact bound seat's entitlement. */
|
|
1585
|
+
declare function readNamedSeatAccess(db: ChapterDb, input: MembershipQuoteTarget & {
|
|
1586
|
+
seatId: string;
|
|
1587
|
+
recipientUserId: string;
|
|
1588
|
+
recipientApplicationId: string;
|
|
1589
|
+
}, now: number): Promise<MembershipAccessReceipt>;
|
|
1590
|
+
|
|
1591
|
+
/** Exact configured chapter/runtime serviced by one scheduled network worker. */
|
|
1592
|
+
type MembershipEffectScope = Pick<MembershipQuoteTarget, "appId" | "chapterId" | "environment" | "runtime">;
|
|
1593
|
+
/** Downstream requests carry only identifiers; the signed chapter receiver reads current state and deduplicates by effectId. */
|
|
1594
|
+
interface MembershipChapterEffect extends MembershipQuoteTarget {
|
|
1595
|
+
effectId: string;
|
|
1596
|
+
seatId: string;
|
|
1597
|
+
kind: "invite_named_recipient" | "grant_named_recipient_access" | "revoke_named_recipient_access";
|
|
1598
|
+
}
|
|
1599
|
+
/** Recover provider effects and expired invitations from durable state, independently of browser/webhook retries.
|
|
1600
|
+
* The optional chapter adapter must return a durable, idempotent receipt. An absent adapter leaves work visibly pending.
|
|
1601
|
+
* Provider HTTP timeouts, ambiguous receipts and scope conflicts never become success or an unbounded automatic retry loop.
|
|
1602
|
+
*/
|
|
1603
|
+
declare function drainMembershipEffects(db: ChapterDb, options: {
|
|
1604
|
+
scope: MembershipEffectScope;
|
|
1605
|
+
stripeSecretKey: string;
|
|
1606
|
+
limit?: number;
|
|
1607
|
+
deliverChapterEffect?: (input: MembershipChapterEffect) => Promise<{
|
|
1608
|
+
effectId: string;
|
|
1609
|
+
complete: true;
|
|
1610
|
+
}>;
|
|
1611
|
+
}, now: number): Promise<{
|
|
1612
|
+
complete: number;
|
|
1613
|
+
pending: number;
|
|
1614
|
+
expired: number;
|
|
1615
|
+
more: boolean;
|
|
1616
|
+
}>;
|
|
1617
|
+
|
|
1618
|
+
/** Minimal chapter-owned delivery data, fetched over the authenticated runtime edge, never from a browser payload. */
|
|
1619
|
+
interface MembershipChapterEffectData extends MembershipChapterEffect {
|
|
1620
|
+
recipientName: string;
|
|
1621
|
+
recipientEmail: string;
|
|
1622
|
+
recipientUserId: string | null;
|
|
1623
|
+
recipientApplicationId: string | null;
|
|
1624
|
+
acceptanceEndsAt: number;
|
|
1625
|
+
termEndsAt: number;
|
|
1626
|
+
applicable: boolean;
|
|
1627
|
+
}
|
|
1628
|
+
/** Read current effect eligibility and the named recipient from the authoritative seat, not a stale queued message. */
|
|
1629
|
+
declare function readMembershipChapterEffect(db: ChapterDb, input: MembershipChapterEffect, now: number): Promise<MembershipChapterEffectData>;
|
|
1630
|
+
|
|
1631
|
+
/** Inputs supplied by an authenticated chapter backend; no browser credentials cross this edge. */
|
|
1632
|
+
interface RequestMembershipOfferOptions {
|
|
1633
|
+
secret: string;
|
|
1634
|
+
targetUrl: string;
|
|
1635
|
+
appId: string;
|
|
1636
|
+
chapterId: string;
|
|
1637
|
+
environment: string;
|
|
1638
|
+
runtime: string;
|
|
1639
|
+
applicationId: string;
|
|
1640
|
+
skuId: string;
|
|
1641
|
+
requestId: string;
|
|
1642
|
+
/** A configured service binding may replace public fetch, but must not fall back when absent. */
|
|
1643
|
+
fetch?: typeof globalThis.fetch;
|
|
1644
|
+
}
|
|
1645
|
+
/** Request and verify one durable network offer before any payment provider call. */
|
|
1646
|
+
declare function requestMembershipCommercialOffer(options: RequestMembershipOfferOptions): Promise<IssuedMembershipOffer>;
|
|
1647
|
+
/** Bind the exact consent and Price before Stripe is contacted. */
|
|
1648
|
+
declare function requestMembershipCheckoutBinding(options: MembershipCheckoutBindingInput & Pick<RequestMembershipOfferOptions, "secret" | "targetUrl" | "fetch">): Promise<MembershipCheckoutBinding>;
|
|
1649
|
+
type AuthorityTransport = Pick<RequestMembershipOfferOptions, "secret" | "targetUrl" | "fetch">;
|
|
1650
|
+
/** Fetch current delivery state; the caller cannot substitute an email, account, term, or entitlement. */
|
|
1651
|
+
declare function requestMembershipChapterEffect(options: MembershipChapterEffect & AuthorityTransport): Promise<MembershipChapterEffectData>;
|
|
1652
|
+
/** Only the named buyer's prepared payment details; no network credentials or canonical PII. */
|
|
1653
|
+
interface NamedSeatCheckoutReceipt {
|
|
1654
|
+
seatId: string;
|
|
1655
|
+
paymentIntentId: string;
|
|
1656
|
+
clientSecret: string;
|
|
1657
|
+
amountCents: number;
|
|
1658
|
+
currency: string;
|
|
1659
|
+
termEndsAt: number;
|
|
1660
|
+
status: string;
|
|
1661
|
+
}
|
|
1662
|
+
/** Result of attesting one verified recipient's acceptance or completed Journey. */
|
|
1663
|
+
interface NamedSeatRecipientReceipt {
|
|
1664
|
+
seatId: string;
|
|
1665
|
+
status: string;
|
|
1666
|
+
recipientApplicationId: string;
|
|
1667
|
+
}
|
|
1668
|
+
/** Full seat-only refund. The purchaser's primary subscription is not canceled. */
|
|
1669
|
+
interface NamedSeatRefundReceipt {
|
|
1670
|
+
seatId: string;
|
|
1671
|
+
status: "refunded";
|
|
1672
|
+
refundedCents: number;
|
|
1673
|
+
subscriptionCanceled: false;
|
|
1674
|
+
}
|
|
1675
|
+
/** Refund a declined recipient's exact bound seat; the caller authenticates the chapter operator. */
|
|
1676
|
+
declare function requestNamedSeatDecline(options: NamedSeatRecipientInput & AuthorityTransport): Promise<NamedSeatRefundReceipt>;
|
|
1677
|
+
/** Verified purchaser identity and their named recipient, with no caller-selected pricing. */
|
|
1678
|
+
type NamedSeatCheckoutRequest = MembershipQuoteTarget & {
|
|
1679
|
+
recipientName: string;
|
|
1680
|
+
recipientEmail: string;
|
|
1681
|
+
purchaserEmail: string;
|
|
1682
|
+
purchaserUserId: string;
|
|
1683
|
+
};
|
|
1684
|
+
/** Reserve the exact recipient before freezing local consent, without contacting a payment provider. */
|
|
1685
|
+
declare function requestNamedSeatReservation(options: NamedSeatCheckoutRequest & AuthorityTransport): Promise<Pick<NamedSeatCheckoutReceipt, "seatId" | "amountCents" | "currency" | "termEndsAt">>;
|
|
1686
|
+
/** Reference to an independent network Stripe fact, never caller-supplied payment amounts. */
|
|
1687
|
+
type NamedSeatEvidenceRequest = MembershipQuoteTarget & {
|
|
1688
|
+
seatId: string;
|
|
1689
|
+
eventId: string;
|
|
1690
|
+
};
|
|
1691
|
+
/** Read an authenticated purchaser's seat terms and existing named recipient. */
|
|
1692
|
+
declare function requestNamedSeatOffer(options: MembershipQuoteTarget & AuthorityTransport): Promise<NamedSeatOffer>;
|
|
1693
|
+
/** Look up one invitation only after the chapter verifies the recipient's current primary email. */
|
|
1694
|
+
declare function requestNamedSeatInvitation(options: NamedSeatInvitationRequest & AuthorityTransport): Promise<NamedSeatInvitation>;
|
|
1695
|
+
/** Check the exact recipient's current entitlement rather than relying on a cached account role. */
|
|
1696
|
+
declare function requestNamedSeatAccess(options: MembershipQuoteTarget & {
|
|
1697
|
+
seatId: string;
|
|
1698
|
+
recipientUserId: string;
|
|
1699
|
+
recipientApplicationId: string;
|
|
1700
|
+
} & AuthorityTransport): Promise<MembershipAccessReceipt>;
|
|
1701
|
+
/** Prepare one named purchase through the configured network Price, never a caller-selected Price. */
|
|
1702
|
+
declare function requestNamedSeatCheckout(options: NamedSeatCheckoutRequest & AuthorityTransport): Promise<NamedSeatCheckoutReceipt>;
|
|
1703
|
+
/** Forward only the reference to independently verified network payment evidence. */
|
|
1704
|
+
declare function requestNamedSeatPayment(options: NamedSeatEvidenceRequest & AuthorityTransport): Promise<{
|
|
1705
|
+
seatId: string;
|
|
1706
|
+
reconciled: true;
|
|
1707
|
+
}>;
|
|
1708
|
+
/** Forward a complete seat refund without changing the purchaser's membership. */
|
|
1709
|
+
declare function requestNamedSeatRefund(options: NamedSeatEvidenceRequest & AuthorityTransport): Promise<{
|
|
1710
|
+
seatId: string;
|
|
1711
|
+
reconciled: true;
|
|
1712
|
+
}>;
|
|
1713
|
+
/** Claim only the verified named recipient's invitation. */
|
|
1714
|
+
declare function requestNamedSeatAcceptance(options: NamedSeatRecipientInput & AuthorityTransport): Promise<NamedSeatRecipientReceipt>;
|
|
1715
|
+
/** Attest that recipient's own completed Journey. */
|
|
1716
|
+
declare function requestNamedSeatApproval(options: NamedSeatRecipientInput & AuthorityTransport): Promise<NamedSeatRecipientReceipt>;
|
|
1717
|
+
/** Reconcile local provider references against independently signed network Stripe facts. */
|
|
1718
|
+
declare function requestMembershipPayment(options: ConfirmMembershipPaymentInput & AuthorityTransport): Promise<MembershipPaymentReceipt>;
|
|
1719
|
+
/** Attest durable chapter Journey approval; the network alone assigns order and entitlement. */
|
|
1720
|
+
declare function requestMembershipApproval(options: MembershipQuoteTarget & AuthorityTransport): Promise<MembershipPaymentReceipt>;
|
|
1721
|
+
/** Refund only the network's frozen initial invoice and cancel its subscription. Caller must authenticate the operator first. */
|
|
1722
|
+
declare function requestMembershipRefund(options: MembershipQuoteTarget & AuthorityTransport): Promise<MembershipRefundReceipt>;
|
|
1723
|
+
/** Advance billing only from independently verified network invoice evidence. */
|
|
1724
|
+
declare function requestMembershipRenewal(options: MembershipQuoteTarget & {
|
|
1725
|
+
eventId: string;
|
|
1726
|
+
} & AuthorityTransport): Promise<MembershipRenewalReceipt>;
|
|
1727
|
+
/** Read current entitlement for one authenticated member; network outages must fail closed. */
|
|
1728
|
+
declare function requestMembershipAccess(options: MembershipQuoteTarget & AuthorityTransport): Promise<MembershipAccessReceipt>;
|
|
1729
|
+
|
|
1730
|
+
/** The signed chapter adapter attests that its own Journey approval is durable.
|
|
1731
|
+
* Payment, cohort and order come exclusively from network authority records.
|
|
1732
|
+
* An issued paid founding promise is honored even after the soft target is reached.
|
|
1733
|
+
*/
|
|
1734
|
+
declare function approveNetworkMembership(db: ChapterDb, input: MembershipQuoteTarget, now: number): Promise<MembershipPaymentReceipt>;
|
|
1735
|
+
|
|
1736
|
+
/** Validate a trusted transport response before using it to advance a chapter Journey. */
|
|
1737
|
+
declare function verifyMembershipPaymentReceipt(value: unknown, target: MembershipQuoteTarget): Promise<MembershipPaymentReceipt>;
|
|
1738
|
+
|
|
1739
|
+
/** Reconcile invoices, cancellation settings and provider-initiated full initial refunds from independent evidence.
|
|
1740
|
+
* Current Stripe reads arbitrate out-of-order subscription events. Only paid invoices extend a membership term.
|
|
1741
|
+
*/
|
|
1742
|
+
declare function reconcileMembershipBilling(db: ChapterDb, input: MembershipQuoteTarget & {
|
|
1743
|
+
eventId: string;
|
|
1744
|
+
}, now: number, stripeSecretName?: string): Promise<MembershipRenewalReceipt>;
|
|
1745
|
+
|
|
1746
|
+
/** Opt-in network-scope schema. Do not install as independent chapter authorities. */
|
|
1747
|
+
declare const membershipOfferEntities: Record<string, Entity>;
|
|
1748
|
+
/** Browser callers cannot read, issue or alter commercial promises. */
|
|
1749
|
+
declare const membershipOfferRules: DbRules;
|
|
1750
|
+
|
|
1751
|
+
/** Authoritative network purchase records, installed once in the network scope.
|
|
1752
|
+
* A canonical Person link is optional until explicit reconciliation; source identity is not.
|
|
1753
|
+
* These records must never be populated by a shadow projection writer.
|
|
1754
|
+
*/
|
|
1755
|
+
declare const membershipAuthorityEntities: Record<string, Entity>;
|
|
1756
|
+
/** Backend-only authority; browser roles, including a network admin, cannot directly change these rows. */
|
|
1757
|
+
declare const membershipAuthorityRules: DbRules;
|
|
1758
|
+
|
|
1231
1759
|
/** Validate one complete parent or chapter authoring layer with actionable paths. */
|
|
1232
1760
|
declare function validateMemberContentDocument(input: unknown, options?: MemberContentValidationOptions): MemberContentValidationResult;
|
|
1233
1761
|
/** Validate or fail closed with every actionable document error. */
|
|
@@ -1572,7 +2100,7 @@ declare function createBuilderLibraryEnvelope(document: BuilderLibraryDocument):
|
|
|
1572
2100
|
|
|
1573
2101
|
/** The default shared CRM graph: people (with the application/member pipeline)
|
|
1574
2102
|
* plus businesses and the `works_at` relation, in both modes. */
|
|
1575
|
-
declare function defaultCrm(
|
|
2103
|
+
declare function defaultCrm(mode: ChapterMode): CrmConfig;
|
|
1576
2104
|
|
|
1577
2105
|
/** The `groups` row (attrs) for `chapter` mode. Missing config falls back to
|
|
1578
2106
|
* empty copy / defaults, so a minimal config still provisions cleanly. */
|
|
@@ -1664,11 +2192,10 @@ declare function render(template: string, vars: Record<string, string>): string;
|
|
|
1664
2192
|
*/
|
|
1665
2193
|
declare function renderTemplateBody(group: EmailGroup, template: string, vars: Record<string, string>): string | null;
|
|
1666
2194
|
/**
|
|
1667
|
-
* E1 (
|
|
2195
|
+
* E1 (confirmed delivery): given prior `emailLog` rows for a `dedupeKey`, has the
|
|
1668
2196
|
* mail already been delivered? A prior row with **no error** means yes — the
|
|
1669
|
-
* caller short-circuits the resend.
|
|
1670
|
-
*
|
|
1671
|
-
* can still succeed.
|
|
2197
|
+
* caller short-circuits the resend. Pending/uncertain rows carry an error marker;
|
|
2198
|
+
* the orchestration layer must reconcile those rather than blindly resending.
|
|
1672
2199
|
*/
|
|
1673
2200
|
declare function isAlreadySent(priorRows: ReadonlyArray<{
|
|
1674
2201
|
error?: unknown;
|
|
@@ -1729,10 +2256,12 @@ interface NotifyDeps {
|
|
|
1729
2256
|
envName: string;
|
|
1730
2257
|
sender?: MailSender;
|
|
1731
2258
|
from?: string;
|
|
2259
|
+
/** Runtime-local non-production inbox; never changes the shared chapter setting. */
|
|
2260
|
+
debugEmail?: string;
|
|
1732
2261
|
now: () => number;
|
|
1733
2262
|
newId: () => string;
|
|
1734
2263
|
}
|
|
1735
|
-
/** One templated send. `dedupeKey`
|
|
2264
|
+
/** One templated send. `dedupeKey` identifies one durable delivery workflow. */
|
|
1736
2265
|
interface NotifyInput {
|
|
1737
2266
|
group: EmailGroup;
|
|
1738
2267
|
template: string;
|
|
@@ -1749,15 +2278,30 @@ interface NotifyResult {
|
|
|
1749
2278
|
reason?: string;
|
|
1750
2279
|
}
|
|
1751
2280
|
/**
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
* transport when one is wired and the plan calls for it, and records an emailLog
|
|
1755
|
-
* row either way (success keyed for exactly-once, failure unkeyed for retry).
|
|
2281
|
+
* Claim before sending. Confirmed sends short-circuit; uncertain sends never
|
|
2282
|
+
* automatically repeat. Non-production redirect/log-only safeguards still apply.
|
|
1756
2283
|
*/
|
|
1757
2284
|
declare function sendTemplated(deps: NotifyDeps, input: NotifyInput): Promise<NotifyResult>;
|
|
1758
2285
|
/** Project a `groups` row into the {@link EmailGroup} the email pipeline reads. */
|
|
1759
2286
|
declare function emailGroupFrom(row: Record<string, unknown>): EmailGroup;
|
|
1760
2287
|
|
|
2288
|
+
/** Evidence from an authenticated operator resolving an uncertain provider outcome. */
|
|
2289
|
+
interface LifecycleDeliveryResolution {
|
|
2290
|
+
id: string;
|
|
2291
|
+
groupId: string;
|
|
2292
|
+
expectedAttempt: number;
|
|
2293
|
+
expectedState: "sending" | "uncertain";
|
|
2294
|
+
decision: "confirmed_delivered" | "confirmed_not_delivered";
|
|
2295
|
+
actorId: string;
|
|
2296
|
+
reason: string;
|
|
2297
|
+
messageId?: string;
|
|
2298
|
+
}
|
|
2299
|
+
/** Resolve only the exact reviewed attempt. This never sends mail itself.
|
|
2300
|
+
* A confirmed non-delivery permits the original workflow to retry its frozen payload.
|
|
2301
|
+
* It must not be used merely because a message has not yet appeared in an inbox.
|
|
2302
|
+
*/
|
|
2303
|
+
declare function reconcileLifecycleDelivery(db: ChapterDb, input: LifecycleDeliveryResolution, now: number): Promise<void>;
|
|
2304
|
+
|
|
1761
2305
|
/**
|
|
1762
2306
|
* Apply defaults + validate the pipeline config. With no config, the complete
|
|
1763
2307
|
* reference pipeline. With `stages` given but the subsets omitted, the subsets
|
|
@@ -1780,6 +2324,17 @@ declare function canBook(status: string, p: ResolvedPipeline): boolean;
|
|
|
1780
2324
|
/** May an application be approved (→ member) from this status? */
|
|
1781
2325
|
declare function canApprove(status: string, p: ResolvedPipeline): boolean;
|
|
1782
2326
|
|
|
2327
|
+
/** Provider evidence retained from a signed initial invoice, not browser success. */
|
|
2328
|
+
interface MembershipInvoiceEvidence {
|
|
2329
|
+
invoiceId?: string;
|
|
2330
|
+
subscriptionId?: string;
|
|
2331
|
+
customerId?: string;
|
|
2332
|
+
currency?: string;
|
|
2333
|
+
total?: number;
|
|
2334
|
+
amountPaid?: number;
|
|
2335
|
+
status?: string;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
1783
2338
|
/** A group row's payment configuration, as far as readiness cares. */
|
|
1784
2339
|
interface PaymentsGroup {
|
|
1785
2340
|
stripePublishableKey?: string | null;
|
|
@@ -1814,16 +2369,30 @@ type WebhookEvent = ({
|
|
|
1814
2369
|
kind: "gift_revoked";
|
|
1815
2370
|
giftIntentId: string;
|
|
1816
2371
|
reason: "refunded" | "canceled";
|
|
2372
|
+
} | {
|
|
2373
|
+
kind: "seat_paid" | "seat_refunded";
|
|
2374
|
+
seatId: string;
|
|
2375
|
+
applicationId?: string;
|
|
2376
|
+
customerId?: string;
|
|
1817
2377
|
} | {
|
|
1818
2378
|
kind: "first_payment";
|
|
1819
2379
|
applicationId?: string;
|
|
1820
2380
|
customerId?: string;
|
|
1821
2381
|
renewalAt?: number;
|
|
2382
|
+
invoice?: MembershipInvoiceEvidence;
|
|
1822
2383
|
} | {
|
|
1823
2384
|
kind: "renewal";
|
|
1824
2385
|
applicationId?: string;
|
|
1825
2386
|
customerId?: string;
|
|
1826
2387
|
renewalAt?: number;
|
|
2388
|
+
} | {
|
|
2389
|
+
kind: "renewal_failed";
|
|
2390
|
+
applicationId?: string;
|
|
2391
|
+
customerId?: string;
|
|
2392
|
+
} | {
|
|
2393
|
+
kind: "subscription_changed";
|
|
2394
|
+
applicationId?: string;
|
|
2395
|
+
customerId?: string;
|
|
1827
2396
|
} | {
|
|
1828
2397
|
kind: "refunded";
|
|
1829
2398
|
applicationId?: string;
|
|
@@ -1857,7 +2426,9 @@ declare function findApplicationRef(obj: Record<string, unknown>): {
|
|
|
1857
2426
|
/** Normalize a verified Stripe event into a {@link WebhookEvent}. `invoice.paid`
|
|
1858
2427
|
* splits into first_payment vs renewal by `billing_reason`; refunds and
|
|
1859
2428
|
* cancellations map directly; everything else is ignored (acked, not retried). */
|
|
1860
|
-
declare function normalizeWebhookEvent(event: StripeEvent
|
|
2429
|
+
declare function normalizeWebhookEvent(event: StripeEvent, options?: {
|
|
2430
|
+
requireProviderPayment?: boolean;
|
|
2431
|
+
}): WebhookEvent;
|
|
1861
2432
|
/** First-payment patch: advance submitted→paid_pending_vetting (never any other
|
|
1862
2433
|
* transition) and record the renewal date. Empty when nothing changed, so the
|
|
1863
2434
|
* caller can skip the write. */
|
|
@@ -1869,14 +2440,15 @@ declare function firstPaymentPatch(currentStatus: string, renewalAt?: number): {
|
|
|
1869
2440
|
declare function renewalPatch(renewalAt: number): {
|
|
1870
2441
|
renewalAt: number;
|
|
1871
2442
|
};
|
|
1872
|
-
/**
|
|
1873
|
-
* issues the Stripe refund but never sets this; the webhook does). */
|
|
2443
|
+
/** A verified full refund closes the paid lifecycle and its renewal display. */
|
|
1874
2444
|
declare function refundedPatch(): {
|
|
1875
2445
|
status: "refunded";
|
|
2446
|
+
renewalAt: 0;
|
|
1876
2447
|
};
|
|
1877
2448
|
/** Subscription-cancellation patch. */
|
|
1878
2449
|
declare function canceledPatch(): {
|
|
1879
2450
|
canceled: true;
|
|
2451
|
+
renewalAt: 0;
|
|
1880
2452
|
};
|
|
1881
2453
|
|
|
1882
2454
|
/** Current wire version for parent-authored admission decisions. */
|
|
@@ -1997,7 +2569,7 @@ declare function hasDisclaimerAck(fields: Record<string, unknown>): boolean;
|
|
|
1997
2569
|
* them. Pure; returns `undefined` when there is nothing to write.
|
|
1998
2570
|
*/
|
|
1999
2571
|
declare function applicantProfile(chapter: Chapter, fields: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
2000
|
-
/** A validated submission, or a
|
|
2572
|
+
/** A validated submission, or a validation/duplicate-email error the route returns.
|
|
2001
2573
|
* `disclaimerAckAt` reports what THIS request recorded — a number when consent
|
|
2002
2574
|
* was stamped, `null` when none was supplied. It is always present so a missing
|
|
2003
2575
|
* consent record is visible in the response rather than silently absent from a
|
|
@@ -2011,6 +2583,8 @@ type SubmitResult = {
|
|
|
2011
2583
|
} | {
|
|
2012
2584
|
ok: false;
|
|
2013
2585
|
error: string;
|
|
2586
|
+
code?: string;
|
|
2587
|
+
status?: number;
|
|
2014
2588
|
};
|
|
2015
2589
|
/**
|
|
2016
2590
|
* Submit a membership application (B2 + B3). Validates the configured required
|
|
@@ -2020,6 +2594,9 @@ type SubmitResult = {
|
|
|
2020
2594
|
* create two applications. The application id is derived from that same stable
|
|
2021
2595
|
* input, so the duplicate response returns the first request's canonical id
|
|
2022
2596
|
* rather than a fresh, nonexistent one. Idempotency is package-enforced.
|
|
2597
|
+
* A unique normalized signup email key prevents concurrent submissions with
|
|
2598
|
+
* different ids from creating two applications; a conflict returns status 409.
|
|
2599
|
+
* Apply the current Chapter schema before deploying this writer.
|
|
2023
2600
|
* `now`/`newId` are injected (deterministic in tests).
|
|
2024
2601
|
*/
|
|
2025
2602
|
declare function submitApplication(db: ChapterDb, chapter: Chapter, fields: Record<string, unknown>, opts: {
|
|
@@ -2034,6 +2611,8 @@ declare function submitApplication(db: ChapterDb, chapter: Chapter, fields: Reco
|
|
|
2034
2611
|
admissionGrant?: AdmissionGrantRow;
|
|
2035
2612
|
/** Server-validated gift offer selected from active signed control. */
|
|
2036
2613
|
giftOfferId?: string;
|
|
2614
|
+
/** Server-selected deployment partition, including free applications. */
|
|
2615
|
+
runtime?: string;
|
|
2037
2616
|
}): Promise<SubmitResult>;
|
|
2038
2617
|
/** The `groups`-row fields the join config exposes. */
|
|
2039
2618
|
interface JoinConfigGroup {
|
|
@@ -2275,6 +2854,15 @@ interface NetworkStageTransition {
|
|
|
2275
2854
|
interface NetworkRecordEdit {
|
|
2276
2855
|
fields: NetworkEditableField[];
|
|
2277
2856
|
allowedStages: NetworkStageTransition[];
|
|
2857
|
+
/** Durable application operation awaiting reconciliation by its original operator. */
|
|
2858
|
+
pendingAction?: {
|
|
2859
|
+
mutationId: string;
|
|
2860
|
+
stage: string;
|
|
2861
|
+
expectedStage: string;
|
|
2862
|
+
expectedRevision: number;
|
|
2863
|
+
actorId: string;
|
|
2864
|
+
actorEmail?: string;
|
|
2865
|
+
};
|
|
2278
2866
|
}
|
|
2279
2867
|
/** Signed follower mutation dispatched by a leader admin. Exactly one of
|
|
2280
2868
|
* `fields` or `stage` is present. */
|
|
@@ -2374,34 +2962,12 @@ interface ProjectionDeps {
|
|
|
2374
2962
|
/** Safe defaults when a target does not declare an explicit field allowlist. */
|
|
2375
2963
|
declare const DEFAULT_SHARE_FIELDS: Readonly<Record<string, readonly string[]>>;
|
|
2376
2964
|
|
|
2377
|
-
/** Map a shared prospect to a crm `person` input (only the fields the default
|
|
2378
|
-
* person type accepts). Name falls back to first+last, then the email. */
|
|
2379
|
-
declare function sharedPersonInput(person: SharedPerson): Record<string, unknown>;
|
|
2380
|
-
/** Backward-compatible display tag retained while structured origin rows are
|
|
2381
|
-
* the durable leader-id → local-record mapping. */
|
|
2382
|
-
declare function networkSourceTag(type: string, hubRecordId: string, sourceId?: string): string;
|
|
2383
|
-
/** Normalize the backwards-compatible person/business shapes into the versioned
|
|
2384
|
-
* generic record envelope the receiver writes. */
|
|
2385
|
-
declare function normalizeSharedRecord(record: SharedPerson | SharedBusiness | SharedRecord, fallbackSourceId?: string): NormalizedSharedRecord;
|
|
2386
|
-
/** Build the allowlisted payload sent from one leader CRM record to a target.
|
|
2387
|
-
* A target with an explicit `fields` map only accepts the types it lists. */
|
|
2388
|
-
declare function sharedRecordFromCrm(crm: Crm, record: CrmRecord, target: ResolvedNetworkTarget, sourceId?: string): SharedRecord;
|
|
2389
|
-
/**
|
|
2390
|
-
* Upsert a leader-shared CRM record into this follower. Accepts the original
|
|
2391
|
-
* person wire shape plus the versioned generic shape. Re-shares resolve through
|
|
2392
|
-
* a durable provenance tag; people/businesses also converge by natural key.
|
|
2393
|
-
*/
|
|
2394
|
-
declare function projectSharedRecord(deps: ProjectionDeps, shared: SharedPerson | SharedBusiness | SharedRecord, options?: {
|
|
2395
|
-
sourceId?: string;
|
|
2396
|
-
sourceUrl?: string;
|
|
2397
|
-
}): Promise<{
|
|
2398
|
-
recordId: string;
|
|
2399
|
-
}>;
|
|
2400
2965
|
/** An arriving applicant, as far as the CRM projection cares. `extra` carries the
|
|
2401
2966
|
* site-configured `crmFields` (values from the application), merged on top of the
|
|
2402
2967
|
* built-in identity/contact set. */
|
|
2403
2968
|
interface Applicant {
|
|
2404
2969
|
applicationId: string;
|
|
2970
|
+
tierId?: string;
|
|
2405
2971
|
email: string;
|
|
2406
2972
|
firstName?: string;
|
|
2407
2973
|
lastName?: string;
|
|
@@ -2424,13 +2990,36 @@ declare function projectApplicant(deps: ProjectionDeps, applicant: Applicant): P
|
|
|
2424
2990
|
recordId: string;
|
|
2425
2991
|
}>;
|
|
2426
2992
|
|
|
2993
|
+
/** Map a shared prospect to a crm `person` input (only the fields the default
|
|
2994
|
+
* person type accepts). Name falls back to first+last, then the email. */
|
|
2995
|
+
declare function sharedPersonInput(person: SharedPerson): Record<string, unknown>;
|
|
2996
|
+
/** Backward-compatible display tag retained while structured origin rows are
|
|
2997
|
+
* the durable leader-id → local-record mapping. */
|
|
2998
|
+
declare function networkSourceTag(type: string, hubRecordId: string, sourceId?: string): string;
|
|
2999
|
+
/** Normalize the backwards-compatible person/business shapes into the versioned
|
|
3000
|
+
* generic record envelope the receiver writes. */
|
|
3001
|
+
declare function normalizeSharedRecord(record: SharedPerson | SharedBusiness | SharedRecord, fallbackSourceId?: string): NormalizedSharedRecord;
|
|
3002
|
+
/** Build the allowlisted payload sent from one leader CRM record to a target.
|
|
3003
|
+
* A target with an explicit `fields` map only accepts the types it lists. */
|
|
3004
|
+
declare function sharedRecordFromCrm(crm: Crm, record: CrmRecord, target: ResolvedNetworkTarget, sourceId?: string): SharedRecord;
|
|
3005
|
+
/**
|
|
3006
|
+
* Upsert a leader-shared CRM record into this follower. Accepts the original
|
|
3007
|
+
* person wire shape plus the versioned generic shape. Re-shares resolve through
|
|
3008
|
+
* a durable provenance tag; people/businesses also converge by natural key.
|
|
3009
|
+
*/
|
|
3010
|
+
declare function projectSharedRecord(deps: ProjectionDeps, shared: SharedPerson | SharedBusiness | SharedRecord, options?: {
|
|
3011
|
+
sourceId?: string;
|
|
3012
|
+
sourceUrl?: string;
|
|
3013
|
+
}): Promise<{
|
|
3014
|
+
recordId: string;
|
|
3015
|
+
}>;
|
|
3016
|
+
|
|
2427
3017
|
/** The crm `person` input for one application row: the built-in identity/contact
|
|
2428
3018
|
* fields plus each configured `crmFields` value present on the row. */
|
|
2429
3019
|
declare function personInputFromApp(chapter: Chapter, app: Record<string, unknown>): Record<string, unknown>;
|
|
2430
|
-
/** Upsert the person record for one application
|
|
2431
|
-
*
|
|
2432
|
-
*
|
|
2433
|
-
* account-only rows not in the pipeline. Throws on failure (the backfill route
|
|
3020
|
+
/** Upsert the person record for one application and mirror its stage, billing
|
|
3021
|
+
* snapshot, and Clerk identity. Account-only identities must use
|
|
3022
|
+
* syncAccountToCrm. Throws on failure (the backfill route
|
|
2434
3023
|
* counts; the operational call sites wrap in `.catch`). */
|
|
2435
3024
|
declare function syncApplicationToCrm(deps: ProjectionDeps & {
|
|
2436
3025
|
chapter: Chapter;
|
|
@@ -2439,8 +3028,8 @@ declare function syncApplicationToCrm(deps: ProjectionDeps & {
|
|
|
2439
3028
|
stage?: string;
|
|
2440
3029
|
}): Promise<string | null>;
|
|
2441
3030
|
/** Backfill / repair: project every application (newest per person) and every
|
|
2442
|
-
*
|
|
2443
|
-
*
|
|
3031
|
+
* `$users` row into the CRM without giving accounts an application or stage.
|
|
3032
|
+
* Pages are bounded; callers receive errors rather than a false success. */
|
|
2444
3033
|
declare function backfillCrm(deps: ProjectionDeps & {
|
|
2445
3034
|
chapter: Chapter;
|
|
2446
3035
|
}): Promise<{
|
|
@@ -2490,16 +3079,15 @@ type StripeResult = StripeRequestResult<Record<string, unknown>>;
|
|
|
2490
3079
|
* of each re-deriving the auth + encoding. */
|
|
2491
3080
|
declare function stripeCall(sk: string, method: "GET" | "POST" | "DELETE", path: string, params?: Record<string, unknown>, idempotencyKey?: string): Promise<StripeResult>;
|
|
2492
3081
|
|
|
2493
|
-
/** The outcome of
|
|
2494
|
-
*
|
|
2495
|
-
* state we wanted anyway. */
|
|
3082
|
+
/** The outcome of provisioning. An existing identifier is a conflict unless
|
|
3083
|
+
* the account proves it belongs to the original application being retried. */
|
|
2496
3084
|
interface ClerkResult {
|
|
2497
3085
|
ok: boolean;
|
|
2498
3086
|
status: number;
|
|
2499
3087
|
/** Stable Clerk user id returned by a successful fresh account create. */
|
|
2500
3088
|
userId?: string;
|
|
2501
3089
|
existed?: boolean;
|
|
2502
|
-
/**
|
|
3090
|
+
/** Legacy result field; signup never refreshes an existing account. */
|
|
2503
3091
|
refreshed?: boolean;
|
|
2504
3092
|
}
|
|
2505
3093
|
/** Inputs for a Clerk invitation. */
|
|
@@ -2518,9 +3106,8 @@ declare function clerkInviteRequest(input: ClerkInviteInput): {
|
|
|
2518
3106
|
path: string;
|
|
2519
3107
|
body: Record<string, unknown>;
|
|
2520
3108
|
};
|
|
2521
|
-
/** POST
|
|
2522
|
-
*
|
|
2523
|
-
* reporting a failure the caller would have to special-case. */
|
|
3109
|
+
/** POST a new invitation. Existing identifiers and all validation failures are
|
|
3110
|
+
* rejected; invitations never authorize changes to an existing account. */
|
|
2524
3111
|
declare function createClerkInvitation(secretKey: string, input: ClerkInviteInput, fetchImpl?: typeof fetch): Promise<ClerkResult>;
|
|
2525
3112
|
/** Inputs for a server-side Clerk user create. */
|
|
2526
3113
|
interface ClerkUserInput {
|
|
@@ -2531,9 +3118,8 @@ interface ClerkUserInput {
|
|
|
2531
3118
|
publicMetadata?: Record<string, unknown>;
|
|
2532
3119
|
/** Backend-only account signals and profile data. */
|
|
2533
3120
|
privateMetadata?: Record<string, unknown>;
|
|
2534
|
-
/**
|
|
2535
|
-
*
|
|
2536
|
-
* values on a newly-created user. Defaults to the create metadata. */
|
|
3121
|
+
/** @deprecated Ignored. Use an explicitly authorized metadata update for repairs;
|
|
3122
|
+
* signup must never modify an account found by email. */
|
|
2537
3123
|
repairMetadata?: ClerkMetadataInput;
|
|
2538
3124
|
}
|
|
2539
3125
|
/** Build the Clerk Backend API user-create request. The account is created
|
|
@@ -2555,19 +3141,21 @@ declare function updateClerkUserMetadata(secretKey: string, userId: string, inpu
|
|
|
2555
3141
|
/** Look a Clerk account up by email and merge its metadata.
|
|
2556
3142
|
*
|
|
2557
3143
|
* Returns `false` when no matching user can be resolved or Clerk rejects the
|
|
2558
|
-
* lookup or update.
|
|
2559
|
-
*
|
|
3144
|
+
* lookup or update. This is an explicit administrative repair primitive;
|
|
3145
|
+
* never call it from public signup or use email knowledge as authorization.
|
|
2560
3146
|
*/
|
|
2561
3147
|
declare function updateClerkUserMetadataByEmail(secretKey: string, email: string, input: ClerkMetadataInput, fetchImpl?: typeof fetch): Promise<boolean>;
|
|
2562
|
-
/** Create
|
|
2563
|
-
*
|
|
2564
|
-
*
|
|
2565
|
-
* supplied public/private metadata on the existing account so a re-application
|
|
2566
|
-
* repairs a previously missed create (`refreshed: true`). */
|
|
3148
|
+
/** Create a new passwordless account. A provider collision never patches the
|
|
3149
|
+
* existing account. A retry may return its id only when backend-private metadata
|
|
3150
|
+
* already names the same original application, preserving all current claims. */
|
|
2567
3151
|
declare function createClerkUser(secretKey: string, input: ClerkUserInput, fetchImpl?: typeof fetch): Promise<ClerkResult>;
|
|
2568
3152
|
|
|
3153
|
+
/** Backend metadata field selected for all role reads and writes. */
|
|
3154
|
+
type ClerkRoleMetadata = "public" | "private";
|
|
3155
|
+
/** Resolve one source for authorization, roster, guards and lifecycle writers. */
|
|
3156
|
+
declare function clerkRoleMetadata(auth: ResolvedAuth): ClerkRoleMetadata;
|
|
2569
3157
|
/** A Clerk user as chapter's role layer sees it. `role` defaults to the lowest
|
|
2570
|
-
* rung when
|
|
3158
|
+
* rung when the selected metadata source carries none. Raw public/private metadata is
|
|
2571
3159
|
* returned only from this backend helper; `profile` and `applicationId` are the
|
|
2572
3160
|
* normalized Chapter-owned private signals. */
|
|
2573
3161
|
interface ClerkUserRecord {
|
|
@@ -2582,20 +3170,57 @@ interface ClerkUserRecord {
|
|
|
2582
3170
|
/** Look a Clerk user up by email. `null` when no such user — or when the lookup
|
|
2583
3171
|
* fails (a role gate treats an unresolvable user as absent, matching the site's
|
|
2584
3172
|
* own fallback). Role defaults to provisional when unset. */
|
|
2585
|
-
declare function clerkGetUserByEmail(secretKey: string, email: string, fetchImpl?: typeof fetch): Promise<ClerkUserRecord | null>;
|
|
3173
|
+
declare function clerkGetUserByEmail(secretKey: string, email: string, fetchImpl?: typeof fetch, source?: ClerkRoleMetadata): Promise<ClerkUserRecord | null>;
|
|
2586
3174
|
/** Fetch a Clerk user by id, for role-change gating. `null` when missing or on a
|
|
2587
3175
|
* failed lookup. Role defaults to provisional when unset. */
|
|
2588
|
-
declare function clerkGetUser(secretKey: string, id: string, fetchImpl?: typeof fetch): Promise<ClerkUserRecord | null>;
|
|
3176
|
+
declare function clerkGetUser(secretKey: string, id: string, fetchImpl?: typeof fetch, source?: ClerkRoleMetadata): Promise<ClerkUserRecord | null>;
|
|
2589
3177
|
/** List ALL Clerk users with their roles, auto-paginating. A membership community
|
|
2590
3178
|
* outgrows one page, and a fixed `limit=100` would silently drop members from the
|
|
2591
3179
|
* admin roster with no error — so this pages (offset in steps of {@link PAGE})
|
|
2592
3180
|
* until a short page. A page fetch that fails THROWS rather than returning a
|
|
2593
3181
|
* partial list, so the caller never mistakes a truncated roster for the whole. */
|
|
2594
|
-
declare function clerkListUsers(secretKey: string, fetchImpl?: typeof fetch): Promise<ClerkUserRecord[]>;
|
|
2595
|
-
/**
|
|
2596
|
-
*
|
|
2597
|
-
|
|
2598
|
-
|
|
3182
|
+
declare function clerkListUsers(secretKey: string, fetchImpl?: typeof fetch, source?: ClerkRoleMetadata): Promise<ClerkUserRecord[]>;
|
|
3183
|
+
/** Merge only the selected role key. Private mode removes the legacy public role
|
|
3184
|
+
* atomically while preserving profiles/foreign keys. No private-to-public fallback. */
|
|
3185
|
+
declare function clerkSetRole(secretKey: string, id: string, role: string, fetchImpl?: typeof fetch, source?: ClerkRoleMetadata): Promise<boolean>;
|
|
3186
|
+
|
|
3187
|
+
/** Operator-supplied evidence for EVERY active runtime sharing this Clerk instance.
|
|
3188
|
+
* Resolve the expected inventory from odla, not from only the current checkout.
|
|
3189
|
+
* Readiness means the private-role build is staged and old role writers paused. */
|
|
3190
|
+
interface PrivateRoleRuntimeProof {
|
|
3191
|
+
runtime: string;
|
|
3192
|
+
version: string;
|
|
3193
|
+
privateRoleReady: boolean;
|
|
3194
|
+
roleWritesPaused: boolean;
|
|
3195
|
+
}
|
|
3196
|
+
/** Fresh operator-reviewed inventory for a dev-only migration dry run.
|
|
3197
|
+
* This evidence is not write authority and the planner performs no provider I/O. */
|
|
3198
|
+
interface PrivateRoleMigrationInput {
|
|
3199
|
+
environment: string;
|
|
3200
|
+
expectedRuntimes: readonly string[];
|
|
3201
|
+
runtimes: readonly PrivateRoleRuntimeProof[];
|
|
3202
|
+
/** Existing active protected odla grants, resolved by exact Clerk subject.
|
|
3203
|
+
* Never derive this set from public/private Clerk metadata or legacy tables. */
|
|
3204
|
+
protectedSuperAdminUserIds: readonly string[];
|
|
3205
|
+
users: readonly ClerkUserRecord[];
|
|
3206
|
+
ladder: readonly string[];
|
|
3207
|
+
}
|
|
3208
|
+
/** Dry-run only: does not change Clerk, odla roles, runtime configuration or keys.
|
|
3209
|
+
* Conflicting sources require review. A successful plan is NOT an atomic lock;
|
|
3210
|
+
* keep all writers paused and re-read the exact role fields before each write.
|
|
3211
|
+
* Resume requires a new plan; never replay a stale snapshot over newer roles. */
|
|
3212
|
+
declare function planPrivateRoleMigration(input: PrivateRoleMigrationInput): {
|
|
3213
|
+
ready: boolean;
|
|
3214
|
+
blockers: string[];
|
|
3215
|
+
changes: {
|
|
3216
|
+
userId: string;
|
|
3217
|
+
role: string;
|
|
3218
|
+
publicRole: unknown;
|
|
3219
|
+
privateRole: unknown;
|
|
3220
|
+
}[];
|
|
3221
|
+
alreadyCurrent: number;
|
|
3222
|
+
totalUsers: number;
|
|
3223
|
+
};
|
|
2599
3224
|
|
|
2600
3225
|
/** Which auth mode a secret is required for: `"client"` (publishable key only) or
|
|
2601
3226
|
* `"full"` (server-side profile/role reads + writes, needing the vault secret). */
|
|
@@ -2672,7 +3297,7 @@ interface IntegrationDescriptor {
|
|
|
2672
3297
|
* the one public `setting` (the `pk_*` publishable key, served to the SPA), the
|
|
2673
3298
|
* `secrets` auth mode `"full"` needs in the tenant vault, BOTH sync directions —
|
|
2674
3299
|
* the inbound `$users` webhook mirror (`provider->odla`) and the outbound
|
|
2675
|
-
* public
|
|
3300
|
+
* selected private-role (or legacy public-role) / private-profile write via `clerk_secret_key` (`odla->provider`,
|
|
2676
3301
|
* chapter's `clerk.ts`) — and the `provision` split. Data only; it performs
|
|
2677
3302
|
* none of it.
|
|
2678
3303
|
*/
|
|
@@ -2942,9 +3567,10 @@ type TierGroupRow = TierGroup & {
|
|
|
2942
3567
|
};
|
|
2943
3568
|
/**
|
|
2944
3569
|
* Every tier a group offers, ordered, including the implicit tier synthesized
|
|
2945
|
-
* for a chapter
|
|
2946
|
-
*
|
|
2947
|
-
*
|
|
3570
|
+
* for a chapter with a successfully read empty tier collection. Unavailable,
|
|
3571
|
+
* malformed, or unprovisioned storage fails closed; it must never turn an
|
|
3572
|
+
* outage into an implicit free or legacy-price membership. Retiring all stored
|
|
3573
|
+
* tiers leaves no offers rather than reviving the legacy group price.
|
|
2948
3574
|
*/
|
|
2949
3575
|
declare function loadTiers(db: ChapterDb, group: TierGroupRow): Promise<ChapterTier[]>;
|
|
2950
3576
|
/** The tiers a join page may show: active, and joinable as configured. */
|
|
@@ -3053,6 +3679,8 @@ interface SignupControlPolicy {
|
|
|
3053
3679
|
trustCopy?: string;
|
|
3054
3680
|
commitmentText?: string;
|
|
3055
3681
|
normsText?: string;
|
|
3682
|
+
/** Price-specific refund/trust copy, keyed by an explicitly declared tier. */
|
|
3683
|
+
tierPolicies?: Readonly<Record<string, TierPaymentPolicy>>;
|
|
3056
3684
|
}
|
|
3057
3685
|
/** Bounded semantic design tokens delegated to the chapter signup surface. */
|
|
3058
3686
|
interface SignupControlTheme {
|
|
@@ -3084,6 +3712,14 @@ interface SignupControlDocument {
|
|
|
3084
3712
|
interface SignupControlEnvelope {
|
|
3085
3713
|
digest: string;
|
|
3086
3714
|
document: SignupControlDocument;
|
|
3715
|
+
/** Signed transport identity, deliberately excluded from the shared document digest. */
|
|
3716
|
+
deliveryTarget?: SignupControlRuntimeTarget;
|
|
3717
|
+
}
|
|
3718
|
+
/** Exact deployment receiving a shared data-environment revision. */
|
|
3719
|
+
interface SignupControlRuntimeTarget {
|
|
3720
|
+
appId: string;
|
|
3721
|
+
environment: string;
|
|
3722
|
+
runtime: string;
|
|
3087
3723
|
}
|
|
3088
3724
|
/** Exact follower acknowledgement for one accepted or replayed revision. */
|
|
3089
3725
|
interface SignupControlReceipt {
|
|
@@ -3091,6 +3727,8 @@ interface SignupControlReceipt {
|
|
|
3091
3727
|
target: {
|
|
3092
3728
|
chapterId: string;
|
|
3093
3729
|
environment: string;
|
|
3730
|
+
appId?: string;
|
|
3731
|
+
runtime?: string;
|
|
3094
3732
|
};
|
|
3095
3733
|
revision: number;
|
|
3096
3734
|
digest: string;
|
|
@@ -3098,7 +3736,7 @@ interface SignupControlReceipt {
|
|
|
3098
3736
|
acknowledgedAt: number;
|
|
3099
3737
|
}
|
|
3100
3738
|
/** Stable reason codes returned when a follower refuses desired state. */
|
|
3101
|
-
type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision" | "materialization_failed";
|
|
3739
|
+
type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_runtime" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision" | "materialization_failed";
|
|
3102
3740
|
/** Normalized document result returned by the package validator. */
|
|
3103
3741
|
type SignupControlValidation = {
|
|
3104
3742
|
ok: true;
|
|
@@ -3218,8 +3856,18 @@ interface ChapterPromotionInput {
|
|
|
3218
3856
|
/** Export the provider-independent pieces of one exact active signup revision. */
|
|
3219
3857
|
declare function exportChapterPromotion(input: ChapterPromotionInput): Promise<PromotionAdapterResult>;
|
|
3220
3858
|
|
|
3221
|
-
/**
|
|
3859
|
+
/** Logical aggregate boundary, not a requirement for a separate database/app. */
|
|
3222
3860
|
type MemberSystemScope = "network" | "chapter" | "provider";
|
|
3861
|
+
/** Business ownership is independent of the reusable command implementation.
|
|
3862
|
+
* Network records live in BNF's existing odla database. Protected platform roles
|
|
3863
|
+
* are not business records and remain writable only by odla administration.
|
|
3864
|
+
*/
|
|
3865
|
+
declare const MEMBER_SYSTEM_RECORD_OWNERS: {
|
|
3866
|
+
readonly network: "built-not-found";
|
|
3867
|
+
readonly chapter: "owning-chapter";
|
|
3868
|
+
readonly provider: "originating-provider";
|
|
3869
|
+
readonly protectedRoles: "odla-platform";
|
|
3870
|
+
};
|
|
3223
3871
|
/** Durable authority allowed to write a member-system field. */
|
|
3224
3872
|
type MemberSystemWriter = "network_person" | "chapter_journey" | "network_membership" | "network_entitlement" | "network_seat" | "network_discount_policy" | "network_referral_ledger" | "network_investment_ledger" | "network_commercial_projection" | "clerk" | "stripe";
|
|
3225
3873
|
/** Read model that may receive an allowlisted field. */
|
|
@@ -3237,7 +3885,9 @@ interface MemberFieldAuthority {
|
|
|
3237
3885
|
sensitivity: MemberFieldSensitivity;
|
|
3238
3886
|
memberAccess: MemberFieldSelfAccess;
|
|
3239
3887
|
}
|
|
3240
|
-
/** Each field has one
|
|
3888
|
+
/** Each field has one aggregate command writer. BNF owns network aggregates and
|
|
3889
|
+
* hosts their server commands; bnf_admin names a read projection, not a credential.
|
|
3890
|
+
*/
|
|
3241
3891
|
declare const MEMBER_SYSTEM_AUTHORITY_MATRIX: readonly MemberFieldAuthority[];
|
|
3242
3892
|
/** Fields a member may change through self-service. */
|
|
3243
3893
|
declare const MEMBER_SELF_EDITABLE_FIELDS: Set<string>;
|
|
@@ -3254,7 +3904,11 @@ interface MemberSystemWriteIntent {
|
|
|
3254
3904
|
}
|
|
3255
3905
|
/** Result of checking a proposed mutation against surface, writer, and revision rules. */
|
|
3256
3906
|
type MemberSystemWriteDisposition = "apply" | "reject_bnf_surface" | "reject_unknown_field" | "reject_wrong_writer" | "reject_stale_revision";
|
|
3257
|
-
/**
|
|
3907
|
+
/** Validate an aggregate command, not a user's authorization. A bare BNF surface
|
|
3908
|
+
* label is still insufficient: its backend must select the field's specific
|
|
3909
|
+
* writer after authenticating and authorizing the caller. This helper cannot
|
|
3910
|
+
* constrain an unrestricted database credential or grant protected platform roles.
|
|
3911
|
+
*/
|
|
3258
3912
|
declare function classifyMemberSystemWrite(intent: MemberSystemWriteIntent): MemberSystemWriteDisposition;
|
|
3259
3913
|
/** Result of validating an authority matrix. */
|
|
3260
3914
|
interface MemberAuthorityValidation {
|
|
@@ -3279,10 +3933,12 @@ type JourneyEnding = typeof JOURNEY_ENDINGS[number];
|
|
|
3279
3933
|
declare const REQUIRED_NOTICE_KINDS: readonly ["payment_receipt", "refund_confirmation", "security_alert", "legal_notice", "membership_status", "renewal_notice", "cancellation_confirmation"];
|
|
3280
3934
|
/** A typed required notice allowed despite discretionary contact suppression. */
|
|
3281
3935
|
type RequiredNoticeKind = typeof REQUIRED_NOTICE_KINDS[number];
|
|
3282
|
-
/** Availability inputs
|
|
3936
|
+
/** Availability inputs distinguish BNF's browser UI, authority backend and odla. */
|
|
3283
3937
|
interface MemberSystemAvailabilityInput {
|
|
3284
3938
|
odlaReachable: boolean;
|
|
3285
3939
|
bnfFrontendReachable: boolean;
|
|
3940
|
+
/** Explicit backend health is required; unknown is not evidence of readiness. */
|
|
3941
|
+
bnfBackendReachable: boolean;
|
|
3286
3942
|
}
|
|
3287
3943
|
/** Capabilities allowed at the current BNF and odla availability state. */
|
|
3288
3944
|
interface MemberSystemAvailability {
|
|
@@ -3292,9 +3948,9 @@ interface MemberSystemAvailability {
|
|
|
3292
3948
|
newApplication: boolean;
|
|
3293
3949
|
newCheckout: boolean;
|
|
3294
3950
|
providerRenewalsMayContinue: true;
|
|
3295
|
-
reason?: "odla_unavailable" | "bnf_frontend_unavailable";
|
|
3951
|
+
reason?: "odla_unavailable" | "bnf_backend_unavailable" | "bnf_frontend_unavailable";
|
|
3296
3952
|
}
|
|
3297
|
-
/** BNF is optional for chapter execution
|
|
3953
|
+
/** Only BNF's frontend is optional for dependent chapter execution. */
|
|
3298
3954
|
declare function memberSystemAvailability(input: MemberSystemAvailabilityInput): MemberSystemAvailability;
|
|
3299
3955
|
/** Partition metadata supplied by a verified Stripe event. */
|
|
3300
3956
|
interface MemberStripeIdentity {
|
|
@@ -3406,4 +4062,33 @@ declare const SILVER_SALT_P0_FIXTURE: {
|
|
|
3406
4062
|
};
|
|
3407
4063
|
};
|
|
3408
4064
|
|
|
3409
|
-
export { ADMISSION_GRANTS_PATH, ADMISSION_GRANTS_SCHEMA_VERSION, type AccountModel, type AdminNotificationTrigger, type AdmissionDecision, type AdmissionGrantDocument, type AdmissionGrantEnvelope, type AdmissionGrantInput, type AdmissionGrantReceipt, type AdmissionGrantRejection, type AdmissionGrantRevisionRow, type AdmissionGrantRow, type AdmissionGrantValidation, type Applicant, type ApplicationBookingPatch, type ApplicationRecord, type ApplicationSummary, type Attr, type AttrType, BUILDER_LIBRARY_ADMIN_PATH, BUILDER_LIBRARY_CONTROL_PATH, BUILDER_LIBRARY_MANIFEST_PATH, BUILDER_LIBRARY_PROMOTE_PATH, BUILDER_LIBRARY_SCHEMA_VERSION, type BuilderLibraryBrandAssetRef, type BuilderLibraryDocument, type BuilderLibraryEnvelope, type BuilderLibraryManifest, type BuilderLibraryPromotionProvenance, type BuilderLibraryReceipt, type BuilderLibraryResource, type BuilderLibraryResourceKind, type BuilderLibraryResourceProvenance, type BuilderLibraryResourceStatus, type BuilderLibraryScope, type BuilderLibrarySource, type BuilderLibrarySourceType, type BuilderLibraryTarget, type BuilderLibraryValidationOptions, type BuilderLibraryValidationResult, type BuilderLibraryViewer, type BuyerGiftClaim, CHAPTER_FLOW_FIELDS_SCHEMA_VERSION, CHAPTER_PROMOTION_ADAPTER, type Chapter, type ChapterApplication, type ChapterAuth, type ChapterBrand, type ChapterBuilderLibrary, type ChapterCommercialParityRecord, type ChapterCommercialParitySnapshot, type ChapterConfig, type ChapterCopy, type ChapterCopyInput, type ChapterDb, type ChapterEmailIdentity, type ChapterEmails, type ChapterFieldFlow, type ChapterFlowField, type ChapterFlowFieldContract, type ChapterIntegrationDescriptor, type ChapterIntegrationOptions, type ChapterMemberContent, type ChapterMode, type ChapterNetwork, type ChapterNetworkReader, type ChapterNetworkTarget, type ChapterOperations, type ChapterPipeline, type ChapterPolicy, type ChapterPrices, type ChapterPromotionInput, type ChapterRunbookHints, type ChapterScheduling, type ChapterSends, type ChapterSignupControl, type ChapterTier, type ChapterTierConfig, type ClerkInviteInput, type ClerkMetadataInput, type ClerkResult, type ClerkUserInput, type ClerkUserRecord, type CommercialIdentity, type CommercialObjectKind, type CommercialParityException, type CommercialParityExceptionKind, type CommercialParityPartition, type CommercialParityResult, type CompiledChapterBrandTokens, DEFAULT_CHAPTER_COPY, DEFAULT_SHARE_FIELDS, type DashboardMetricData, type DashboardMetricSeries, type DbOp, type DbRules, type DbSchema, type DeliveryDecision, type EffectiveMemberContent, type EffectiveMemberContentPage, type EmailGroup, type EmailTemplate, type EmailTemplateRow, type Entity, type ExistingMeeting, GIFT_OFFER_CATALOG_VERSION, type GiftOffer, type GiftOfferCatalog, type GiftOfferTarget, type GiftOfferValidation, type GuardResult, type IntegrationDescriptor, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type IntegrationSync, JOURNEY_ENDINGS, JOURNEY_STAGES, type JoinConfigGroup, type JoinConfigTier, type JoinContinuation, type JourneyEnding, type JourneyStage, type LeaderCrmOptions, type LeaderFormationConfig, type LiveEvent, MAX_GIFT_OFFERS, MEMBERSHIP_PAGE_RENDERER, MEMBER_CONTENT_CONTROL_PATH, MEMBER_CONTENT_PATH, MEMBER_CONTENT_SCHEMA_VERSION, MEMBER_SELF_EDITABLE_FIELDS, MEMBER_SELF_READABLE_FIELDS, MEMBER_SYSTEM_AUTHORITY_MATRIX, MEMBER_SYSTEM_CONTRACT_VERSION, MEMBER_SYSTEM_RECOVERY_OBJECTIVES, type MailSender, type MeetingForReconcile, type MeetingRecord, type MeetingReschedulePatch, type MemberApplication, type MemberAuthorityValidation, type MemberContentDocument, type MemberContentEnvelope, type MemberContentPage, type MemberContentPageProjection, type MemberContentProjection, type MemberContentReceipt, type MemberContentRejection, type MemberContentSource, type MemberContentSourceType, type MemberContentTarget, type MemberContentTierAuthority, type MemberContentValidationOptions, type MemberContentValidationResult, type MemberContentViewer, type MemberFieldAuthority, type MemberFieldSelfAccess, type MemberFieldSensitivity, type MemberPageAudience, type MemberPageNavigation, type MemberPageUpsell, type MemberPageUpsellOffer, type MemberPageUpsellOverride, type MemberSession, type MemberStripeDisposition, type MemberStripeIdentity, type MemberStripeTarget, type MemberSystemAvailability, type MemberSystemAvailabilityInput, type MemberSystemEventReceiptInput, type MemberSystemEventReplayPlan, type MemberSystemMigrationPlan, type MemberSystemMigrationRow, type MemberSystemProjection, type MemberSystemRecoveryObjectives, type MemberSystemRollbackPlan, type MemberSystemScope, type MemberSystemWriteDisposition, type MemberSystemWriteIntent, type MemberSystemWriter, type MembershipPageDocument, type MembershipPageValidationOptions, type MembershipPageValidationResult, type MembershipTierAuthority, type MembershipTierCallout, type MembershipTierCapacity, type MembershipTierMarkdownResult, type MembershipTierPresentation, type MembershipTierVariant, type NetworkCommercialException, type NetworkCommercialFact, type NetworkCommercialProjectedRow, type NetworkCommercialProjection, type NetworkEditableField, type NetworkRecord, type NetworkRecordEdit, type NetworkRecordMutation, type NetworkRecordMutationResult, type NetworkRecordNote, type NetworkRecordPage, type NetworkRecordSort, type NetworkRollup, type NetworkRollupTarget, type NetworkSharedNote, type NetworkSnapshot, type NetworkStageTransition, type NetworkTargetTransportStatus, type NewMeetingRow, type NotifyDeps, type NotifyInput, type NotifyResult, type PaymentsGroup, type ProjectionDeps, type PublicGiftOffer, REQUIRED_NOTICE_KINDS, type ReconcileDecision, type RequiredNoticeKind, type ResolvedApplication, type ResolvedAuth, type ResolvedBuilderLibrary, type ResolvedLeaderFormation, type ResolvedMemberContent, type ResolvedMemberPageUpsell, type ResolvedNetwork, type ResolvedNetworkReader, type ResolvedNetworkTarget, type ResolvedOperations, type ResolvedPipeline, type ResolvedScheduling, type ResolvedSends, type ResolvedSignupControl, type RoleChangeContext, type Rule, SCHEDULING_DEFAULTS, SIGNUP_CONTROL_PATH, SIGNUP_CONTROL_SCHEMA_VERSION, SIGNUP_CONTROL_THEME_MARKER, SIGNUP_CONTROL_THEME_STYLE_ID, SILVER_SALT_P0_FIXTURE, type SchedulingErrors, type SecretMode, type SecretStore, type SessionUser, type SharedBusiness, type SharedPerson, type SharedRecord, type SharedRecordV1, type SharedRecordV2, type SignupControlApplication, type SignupControlDocument, type SignupControlEnvelope, type SignupControlPolicy, type SignupControlReceipt, type SignupControlRejection, type SignupControlTheme, type SignupControlThemeHead, type SignupControlThemeMetadata, type SignupControlThemeOptions, type SignupControlThemeRevision, type SignupControlThemeStyleTarget, type SignupControlTier, type SignupControlValidation, type StripeEvent, type StripeResult, type SubmitResult, type TierGroup, type TierGroupRow, type WebhookEvent, applicantProfile, applicationBookingUpdate, applicationFlowFields, applicationSummary, applyMembershipTierMarkdown, backfillCrm, bookingDecision, brandTokens, bucketSeries, buildBuilderLibraryManifest, buildChapterCommercialParitySnapshot, buildGroupSeed, buildTierSeeds, builderLibraryDigest, canApprove, canBook, canChangeRole, canTransition, canViewBuilderLibraryResource, canceledPatch, canonicalBuilderLibrary, canonicalMemberContent, canonicalSignupControl, chapterBrandFromTokens, chapterDb, chapterFlowFieldContract, clampArray, classifyMemberStripeEvent, classifyMemberSystemWrite, clerkGetUser, clerkGetUserByEmail, clerkIntegration, clerkInviteRequest, clerkListUsers, clerkSetRole, clerkUserRequest, commercialParityDigest, composeMemberContent, createAdmissionGrantEnvelope, createBuilderLibraryEnvelope, createChapterIntegration, createClerkInvitation, createClerkUser, createMemberContentEnvelope, createSignupControlEnvelope, dashboardMetricData, defaultCrm, defineChapter, emailGroupFrom, endForSlot, exportChapterPromotion, findAdmissionGrant, findApplicationRef, findGiftOffer, findTier, firstPaymentPatch, formatChapterCopy, formationFields, formationFlowFields, getVaultSecret, giftOfferActive, hasDisclaimerAck, hydrateSignupControlTheme, injectSignupControlThemeHead, introIdempotencyKey, isAdminRole, isAlreadySent, isReconcilable, isSlotAvailable, isValidEmail, joinConfig, joinConfigTiers, leaderCrmConfig, listStripeObjects, loadLatestAdmissionRevision, loadOfferableTiers, loadTiers, materializeAdmissionGrants, meetingCreateRow, meetingRescheduleUpdate, memberApplication, memberContentDigest, memberContentDocument, memberSession, memberSystemAvailability, memberSystemRollbackPlan, membershipPageDocument, membershipTierPresentationFromMarkdown, networkCommercialSourceKey, networkSourceTag, normalizeAdmissionEmail, normalizeChapterEmail, normalizeNetworkCommercialStripeEvent, normalizeSharedRecord, normalizeWebhookEvent, offerableTiers, paymentsReady, personInputFromApp, planDelivery, planMemberSystemEventReplay, planMemberSystemMigration, projectApplicant, projectBuilderLibraryDelivery, projectMemberContent, projectMemberSelf, projectNetworkCommercialEvents, projectSharedRecord, promoteBuilderLibraryResource, publicGiftOffers, reconcileCommercialParitySnapshot, reconcileMeetings, reconcileStripeSnapshot, refundedPatch, render, renderSignupControlThemeHead, renderSummary, renderTemplateBody, renewalPatch, resolveApplication, resolveAuth, resolveBuilderLibrary, resolveChapterCopy, resolveJoinContinuation, resolveLeaderFormation, resolveMemberContent, resolveNetworkCommercialReadModel, resolveNetworkPersonRegistry, resolvePipeline, resolveScheduling, resolveSignupControl, resolveTiers, roleFromClaim, sendTemplated, sharedPersonInput, sharedRecordFromCrm, signupControlDigest, slotWindow, stageIndex, stripeCall, subAnnualCents, submitApplication, subscriptionIdempotencyKey, syncApplicationToCrm, tierIsFree, tierPayable, updateClerkUserMetadata, updateClerkUserMetadataByEmail, validateAdmissionGrantDocument, validateBuilderLibraryDocument, validateGiftOfferCatalog, validateMemberContentDocument, validateMemberSystemAuthority, validateMembershipPageDocument, validateScheduling, validateSignupControlDocument, webhookMutationId };
|
|
4065
|
+
/** Separate authoritative collections inside the network owner's EXISTING database.
|
|
4066
|
+
* Legacy networkMembership/networkEntitlement/networkSeat remain shadow/rollback
|
|
4067
|
+
* data. This mapping never migrates, copies, or promotes their contents.
|
|
4068
|
+
*/
|
|
4069
|
+
declare const MEMBERSHIP_AUTHORITY_COLLECTIONS: {
|
|
4070
|
+
readonly networkMembership: "membershipRecord";
|
|
4071
|
+
readonly networkEntitlement: "membershipEntitlement";
|
|
4072
|
+
readonly networkSeat: "membershipSeat";
|
|
4073
|
+
};
|
|
4074
|
+
/** Additive, deny-all descriptor. Compose once in BNF alongside its existing
|
|
4075
|
+
* policy and commercial integrations, never in each chapter. No activation seeds:
|
|
4076
|
+
* a reviewed authority-state command must explicitly enable a chapter afterward.
|
|
4077
|
+
*/
|
|
4078
|
+
declare function createMembershipAuthorityIntegration(): {
|
|
4079
|
+
id: string;
|
|
4080
|
+
title: string;
|
|
4081
|
+
npm: string;
|
|
4082
|
+
schema: {
|
|
4083
|
+
entities: {
|
|
4084
|
+
[k: string]: Entity;
|
|
4085
|
+
};
|
|
4086
|
+
links: {};
|
|
4087
|
+
};
|
|
4088
|
+
rules: {
|
|
4089
|
+
[k: string]: Rule;
|
|
4090
|
+
};
|
|
4091
|
+
seeds: never[];
|
|
4092
|
+
};
|
|
4093
|
+
|
|
4094
|
+
export { ADMISSION_GRANTS_PATH, ADMISSION_GRANTS_SCHEMA_VERSION, type AccountModel, type AdminNotificationTrigger, type AdmissionDecision, type AdmissionGrantDocument, type AdmissionGrantEnvelope, type AdmissionGrantInput, type AdmissionGrantReceipt, type AdmissionGrantRejection, type AdmissionGrantRevisionRow, type AdmissionGrantRow, type AdmissionGrantValidation, type Applicant, type ApplicationBookingPatch, type ApplicationRecord, type ApplicationSummary, type Attr, type AttrType, BUILDER_LIBRARY_ADMIN_PATH, BUILDER_LIBRARY_CONTROL_PATH, BUILDER_LIBRARY_MANIFEST_PATH, BUILDER_LIBRARY_PROMOTE_PATH, BUILDER_LIBRARY_SCHEMA_VERSION, type BuilderLibraryBrandAssetRef, type BuilderLibraryDocument, type BuilderLibraryEnvelope, type BuilderLibraryManifest, type BuilderLibraryPromotionProvenance, type BuilderLibraryReceipt, type BuilderLibraryResource, type BuilderLibraryResourceKind, type BuilderLibraryResourceProvenance, type BuilderLibraryResourceStatus, type BuilderLibraryScope, type BuilderLibrarySource, type BuilderLibrarySourceType, type BuilderLibraryTarget, type BuilderLibraryValidationOptions, type BuilderLibraryValidationResult, type BuilderLibraryViewer, type BuyerGiftClaim, CHAPTER_FLOW_FIELDS_SCHEMA_VERSION, CHAPTER_PROMOTION_ADAPTER, type Chapter, type ChapterApplication, type ChapterAuth, type ChapterBrand, type ChapterBuilderLibrary, type ChapterCommercialParityRecord, type ChapterCommercialParitySnapshot, type ChapterConfig, type ChapterCopy, type ChapterCopyInput, type ChapterDb, type ChapterEmailIdentity, type ChapterEmails, type ChapterFieldFlow, type ChapterFlowField, type ChapterFlowFieldContract, type ChapterIntegrationDescriptor, type ChapterIntegrationOptions, type ChapterMemberContent, type ChapterMode, type ChapterNetwork, type ChapterNetworkReader, type ChapterNetworkTarget, type ChapterOperations, type ChapterPipeline, type ChapterPolicy, type ChapterPrices, type ChapterPromotionInput, type ChapterRunbookHints, type ChapterScheduling, type ChapterSends, type ChapterSignupControl, type ChapterTier, type ChapterTierConfig, type ClerkInviteInput, type ClerkMetadataInput, type ClerkResult, type ClerkRoleMetadata, type ClerkUserInput, type ClerkUserRecord, type CommercialIdentity, type CommercialObjectKind, type CommercialParityException, type CommercialParityExceptionKind, type CommercialParityPartition, type CommercialParityResult, type CompiledChapterBrandTokens, type ConfirmMembershipPaymentInput, DEFAULT_CHAPTER_COPY, DEFAULT_SHARE_FIELDS, type DashboardMetricData, type DashboardMetricSeries, type DbOp, type DbRules, type DbSchema, type DeliveryDecision, type EffectiveMemberContent, type EffectiveMemberContentPage, type EmailGroup, type EmailTemplate, type EmailTemplateRow, type Entity, type ExistingMeeting, GIFT_OFFER_CATALOG_VERSION, type GiftOffer, type GiftOfferCatalog, type GiftOfferTarget, type GiftOfferValidation, type GuardResult, type IntegrationDescriptor, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type IntegrationSync, type IssuedMembershipOffer, JOURNEY_ENDINGS, JOURNEY_STAGES, type JoinConfigGroup, type JoinConfigTier, type JoinContinuation, type JourneyEnding, type JourneyStage, type LeaderCrmOptions, type LeaderFormationConfig, type LifecycleDeliveryResolution, type LiveEvent, MAX_GIFT_OFFERS, MEMBERSHIP_AUTHORITY_COLLECTIONS, MEMBERSHIP_AUTHORITY_PATH, MEMBERSHIP_PAGE_RENDERER, MEMBER_CONTENT_CONTROL_PATH, MEMBER_CONTENT_PATH, MEMBER_CONTENT_SCHEMA_VERSION, MEMBER_SELF_EDITABLE_FIELDS, MEMBER_SELF_READABLE_FIELDS, MEMBER_SYSTEM_AUTHORITY_MATRIX, MEMBER_SYSTEM_CONTRACT_VERSION, MEMBER_SYSTEM_RECORD_OWNERS, MEMBER_SYSTEM_RECOVERY_OBJECTIVES, type MailSender, type MeetingForReconcile, type MeetingRecord, type MeetingReschedulePatch, type MemberApplication, type MemberAuthorityValidation, type MemberContentDocument, type MemberContentEnvelope, type MemberContentPage, type MemberContentPageProjection, type MemberContentProjection, type MemberContentReceipt, type MemberContentRejection, type MemberContentSource, type MemberContentSourceType, type MemberContentTarget, type MemberContentTierAuthority, type MemberContentValidationOptions, type MemberContentValidationResult, type MemberContentViewer, type MemberFieldAuthority, type MemberFieldSelfAccess, type MemberFieldSensitivity, type MemberPageAudience, type MemberPageNavigation, type MemberPageUpsell, type MemberPageUpsellOffer, type MemberPageUpsellOverride, type MemberSession, type MemberStripeDisposition, type MemberStripeIdentity, type MemberStripeTarget, type MemberSystemAvailability, type MemberSystemAvailabilityInput, type MemberSystemEventReceiptInput, type MemberSystemEventReplayPlan, type MemberSystemMigrationPlan, type MemberSystemMigrationRow, type MemberSystemProjection, type MemberSystemRecoveryObjectives, type MemberSystemRollbackPlan, type MemberSystemScope, type MemberSystemWriteDisposition, type MemberSystemWriteIntent, type MemberSystemWriter, type MembershipAccessReceipt, type MembershipAuthorityHandlerOptions, type MembershipAuthorityPeer, type MembershipChapterEffect, type MembershipChapterEffectData, type MembershipCheckoutBinding, type MembershipCheckoutBindingInput, type MembershipCommercialOffer, type MembershipDiscountPolicyVersion, type MembershipEffectScope, type MembershipOfferIssuer, type MembershipOfferRequest, type MembershipOfferingVersion, type MembershipPageDocument, type MembershipPageValidationOptions, type MembershipPageValidationResult, type MembershipPaymentReceipt, type MembershipQuoteTarget, type MembershipRefundReceipt, type MembershipRenewalReceipt, type MembershipTierAuthority, type MembershipTierCallout, type MembershipTierCapacity, type MembershipTierMarkdownResult, type MembershipTierPresentation, type MembershipTierVariant, type NamedSeatCheckoutReceipt, type NamedSeatCheckoutRequest, type NamedSeatEvidenceRequest, type NamedSeatInvitation, type NamedSeatInvitationRequest, type NamedSeatOffer, type NamedSeatRecipientReceipt, type NamedSeatRefundReceipt, type NetworkCommercialException, type NetworkCommercialFact, type NetworkCommercialProjectedRow, type NetworkCommercialProjection, type NetworkEditableField, type NetworkRecord, type NetworkRecordEdit, type NetworkRecordMutation, type NetworkRecordMutationResult, type NetworkRecordNote, type NetworkRecordPage, type NetworkRecordSort, type NetworkRollup, type NetworkRollupTarget, type NetworkSharedNote, type NetworkSnapshot, type NetworkStageTransition, type NetworkTargetTransportStatus, type NewMeetingRow, type NotifyDeps, type NotifyInput, type NotifyResult, type PaymentsGroup, type PrivateRoleMigrationInput, type PrivateRoleRuntimeProof, type ProjectionDeps, type PublicGiftOffer, REQUIRED_NOTICE_KINDS, type ReconcileDecision, type RequestMembershipOfferOptions, type RequiredNoticeKind, type ResolvedApplication, type ResolvedAuth, type ResolvedBuilderLibrary, type ResolvedLeaderFormation, type ResolvedMemberContent, type ResolvedMemberPageUpsell, type ResolvedNetwork, type ResolvedNetworkReader, type ResolvedNetworkTarget, type ResolvedOperations, type ResolvedPipeline, type ResolvedScheduling, type ResolvedSends, type ResolvedSignupControl, type RoleChangeContext, type Rule, SCHEDULING_DEFAULTS, SIGNUP_CONTROL_PATH, SIGNUP_CONTROL_SCHEMA_VERSION, SIGNUP_CONTROL_THEME_MARKER, SIGNUP_CONTROL_THEME_STYLE_ID, SILVER_SALT_P0_FIXTURE, type SchedulingErrors, type SecretMode, type SecretStore, type SessionUser, type SharedBusiness, type SharedPerson, type SharedRecord, type SharedRecordV1, type SharedRecordV2, type SignupControlApplication, type SignupControlDocument, type SignupControlEnvelope, type SignupControlPolicy, type SignupControlReceipt, type SignupControlRejection, type SignupControlRuntimeTarget, type SignupControlTheme, type SignupControlThemeHead, type SignupControlThemeMetadata, type SignupControlThemeOptions, type SignupControlThemeRevision, type SignupControlThemeStyleTarget, type SignupControlTier, type SignupControlValidation, type StripeEvent, type StripeResult, type SubmitResult, type TierGroup, type TierGroupRow, type WebhookEvent, addMembershipCalendarMonths, applicantProfile, applicationBookingUpdate, applicationFlowFields, applicationSummary, applyMembershipTierMarkdown, approveNetworkMembership, backfillCrm, bindMembershipCheckout, bookingDecision, brandTokens, bucketSeries, buildBuilderLibraryManifest, buildChapterCommercialParitySnapshot, buildGroupSeed, buildTierSeeds, builderLibraryDigest, canApprove, canBook, canChangeRole, canTransition, canViewBuilderLibraryResource, canceledPatch, canonicalBuilderLibrary, canonicalMemberContent, canonicalSignupControl, chapterBrandFromTokens, chapterDb, chapterFlowFieldContract, clampArray, classifyMemberStripeEvent, classifyMemberSystemWrite, clerkGetUser, clerkGetUserByEmail, clerkIntegration, clerkInviteRequest, clerkListUsers, clerkRoleMetadata, clerkSetRole, clerkUserRequest, commercialParityDigest, composeMemberContent, confirmMembershipPayment, createAdmissionGrantEnvelope, createBuilderLibraryEnvelope, createChapterIntegration, createClerkInvitation, createClerkUser, createMemberContentEnvelope, createMembershipAuthorityHandler, createMembershipAuthorityIntegration, createMembershipCommercialOffer, createSignupControlEnvelope, dashboardMetricData, defaultCrm, defineChapter, drainMembershipEffects, emailGroupFrom, endForSlot, exportChapterPromotion, findAdmissionGrant, findApplicationRef, findGiftOffer, findTier, firstPaymentPatch, formatChapterCopy, formationFields, formationFlowFields, getVaultSecret, giftOfferActive, hasDisclaimerAck, hydrateSignupControlTheme, injectSignupControlThemeHead, introIdempotencyKey, isAdminRole, isAlreadySent, isReconcilable, isSlotAvailable, isValidEmail, issueMembershipCommercialOffer, joinConfig, joinConfigTiers, leaderCrmConfig, listStripeObjects, loadLatestAdmissionRevision, loadOfferableTiers, loadTiers, materializeAdmissionGrants, meetingCreateRow, meetingRescheduleUpdate, memberApplication, memberContentDigest, memberContentDocument, memberSession, memberSystemAvailability, memberSystemRollbackPlan, membershipAuthorityEntities, membershipAuthorityRules, membershipCheckoutBindingId, membershipDiscountPolicyVersion, membershipOfferEntities, membershipOfferIdForRequest, membershipOfferRules, membershipOfferingVersion, membershipPageDocument, membershipTierPresentationFromMarkdown, namedSeatOfferDigest, networkCommercialSourceKey, networkMembershipId, networkSourceTag, normalizeAdmissionEmail, normalizeChapterEmail, normalizeNetworkCommercialStripeEvent, normalizeSharedRecord, normalizeWebhookEvent, offerableTiers, paymentsReady, personInputFromApp, planDelivery, planMemberSystemEventReplay, planMemberSystemMigration, planPrivateRoleMigration, projectApplicant, projectBuilderLibraryDelivery, projectMemberContent, projectMemberSelf, projectNetworkCommercialEvents, projectSharedRecord, promoteBuilderLibraryResource, publicGiftOffers, readMembershipAccess, readMembershipChapterEffect, readNamedSeatAccess, readNamedSeatInvitation, readNamedSeatOffer, reconcileCommercialParitySnapshot, reconcileLifecycleDelivery, reconcileMeetings, reconcileMembershipBilling, reconcileMembershipRenewal, reconcileStripeSnapshot, refundNetworkMembership, refundedPatch, render, renderSignupControlThemeHead, renderSummary, renderTemplateBody, renewalPatch, requestMembershipAccess, requestMembershipApproval, requestMembershipChapterEffect, requestMembershipCheckoutBinding, requestMembershipCommercialOffer, requestMembershipPayment, requestMembershipRefund, requestMembershipRenewal, requestNamedSeatAcceptance, requestNamedSeatAccess, requestNamedSeatApproval, requestNamedSeatCheckout, requestNamedSeatDecline, requestNamedSeatInvitation, requestNamedSeatOffer, requestNamedSeatPayment, requestNamedSeatRefund, requestNamedSeatReservation, resolveApplication, resolveAuth, resolveBuilderLibrary, resolveChapterCopy, resolveJoinContinuation, resolveLeaderFormation, resolveMemberContent, resolveNetworkCommercialReadModel, resolveNetworkPersonRegistry, resolvePipeline, resolveScheduling, resolveSignupControl, resolveTiers, roleFromClaim, sendTemplated, sharedPersonInput, sharedRecordFromCrm, signupControlDigest, slotWindow, stageIndex, stripeCall, subAnnualCents, submitApplication, subscriptionIdempotencyKey, syncApplicationToCrm, tierIsFree, tierPayable, updateClerkUserMetadata, updateClerkUserMetadataByEmail, validateAdmissionGrantDocument, validateBuilderLibraryDocument, validateGiftOfferCatalog, validateMemberContentDocument, validateMemberSystemAuthority, validateMembershipPageDocument, validateScheduling, validateSignupControlDocument, verifyIssuedMembershipOffer, verifyMembershipAccessReceipt, verifyMembershipCheckoutBinding, verifyMembershipPaymentReceipt, webhookMutationId };
|