@odla-ai/chapter 0.33.1 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { CrmConfig, Crm, FieldConditions, TypeDef, FieldDef, TypeSummary, CrmRecord } from '@odla-ai/crm';
2
2
  import { StripeRequestResult } from '@odla-ai/stripe';
3
3
  export { stripeForm, verifyStripeSignature } from '@odla-ai/stripe';
4
+ import { PromotionAdapterResult } from '@odla-ai/promotion';
4
5
 
5
6
  /** One membership tier a chapter offers. `priceCents: 0` means free. */
6
7
  interface ChapterTier {
@@ -300,12 +301,26 @@ interface ChapterPolicy {
300
301
  type ChapterMode = "chapter" | "hub";
301
302
  /** One odla-db transaction op — the wire shape both the real admin client and a
302
303
  * test double (`FakeDb`) accept. Built as a plain object, never via a `tx` proxy. */
303
- interface DbOp {
304
- t: "update" | "merge" | "retract" | "delete";
304
+ type DbOp<Id extends string | {
305
305
  ns: string;
306
- id: string;
307
- attrs?: Record<string, unknown>;
308
- }
306
+ attr: string;
307
+ value: string | number | boolean;
308
+ } = string> = {
309
+ t: "update" | "merge";
310
+ ns: string;
311
+ id: Id;
312
+ attrs: Record<string, unknown>;
313
+ } | {
314
+ t: "retract";
315
+ ns: string;
316
+ id: Id;
317
+ attrs: string[];
318
+ } | {
319
+ t: "delete";
320
+ ns: string;
321
+ id: Id;
322
+ attrs?: undefined;
323
+ };
309
324
  /** The structural view of the odla-db admin client the worker builds and the
310
325
  * member routes consume — so route logic is testable against an in-memory fake. */
311
326
  interface ChapterDb {
@@ -320,7 +335,11 @@ interface ChapterDb {
320
335
  }): Promise<{
321
336
  count?: number;
322
337
  }>;
323
- transact(ops: DbOp[], opts?: {
338
+ transact(ops: DbOp<string | {
339
+ ns: string;
340
+ attr: string;
341
+ value: string | number | boolean;
342
+ }>[], opts?: {
324
343
  mutationId?: string;
325
344
  }): Promise<{
326
345
  txId: number;
@@ -2026,7 +2045,7 @@ interface SignupControlReceipt {
2026
2045
  acknowledgedAt: number;
2027
2046
  }
2028
2047
  /** Stable reason codes returned when a follower refuses desired state. */
2029
- type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision";
2048
+ type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision" | "materialization_failed";
2030
2049
  /** Normalized document result returned by the package validator. */
2031
2050
  type SignupControlValidation = {
2032
2051
  ok: true;
@@ -2072,4 +2091,14 @@ declare function applyMembershipTierMarkdown(presentation: MembershipTierPresent
2072
2091
  /** Apply constrained membership Markdown or fail closed with actionable errors. */
2073
2092
  declare function membershipTierPresentationFromMarkdown(presentation: MembershipTierPresentation, source: string): MembershipTierPresentation;
2074
2093
 
2075
- export { type AccountModel, type AdminNotificationTrigger, type Applicant, type ApplicationBookingPatch, type ApplicationRecord, type ApplicationSummary, type Attr, type AttrType, type Chapter, type ChapterApplication, type ChapterAuth, type ChapterBrand, type ChapterConfig, type ChapterCopy, type ChapterCopyInput, type ChapterDb, type ChapterEmails, type ChapterIntegrationDescriptor, type ChapterIntegrationOptions, type ChapterMode, type ChapterNetwork, type ChapterNetworkReader, type ChapterNetworkTarget, type ChapterOperations, type ChapterPipeline, type ChapterPolicy, type ChapterPrices, type ChapterRunbookHints, type ChapterScheduling, type ChapterSends, type ChapterSignupControl, type ChapterTier, type ChapterTierConfig, type ClerkInviteInput, type ClerkMetadataInput, type ClerkResult, type ClerkUserInput, type ClerkUserRecord, type CompiledChapterBrandTokens, DEFAULT_CHAPTER_COPY, DEFAULT_SHARE_FIELDS, type DashboardMetricData, type DashboardMetricSeries, type DbOp, type DbRules, type DbSchema, type DeliveryDecision, type EmailGroup, type EmailTemplate, type EmailTemplateRow, type Entity, type ExistingMeeting, type GuardResult, type IntegrationDescriptor, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type IntegrationSync, type JoinConfigGroup, type JoinConfigTier, type LeaderCrmOptions, type LeaderFormationConfig, type LiveEvent, MEMBERSHIP_PAGE_RENDERER, type MailSender, type MeetingForReconcile, type MeetingRecord, type MeetingReschedulePatch, type MemberApplication, type MemberSession, type MembershipPageDocument, type MembershipPageValidationOptions, type MembershipPageValidationResult, type MembershipTierAuthority, type MembershipTierCallout, type MembershipTierCapacity, type MembershipTierMarkdownResult, type MembershipTierPresentation, type MembershipTierVariant, type NetworkRecord, type NetworkRecordNote, type NetworkRecordPage, type NetworkRollup, type NetworkRollupTarget, type NetworkSharedNote, type NetworkSnapshot, type NewMeetingRow, type NotifyDeps, type NotifyInput, type NotifyResult, type PaymentsGroup, type ProjectionDeps, type ReconcileDecision, type ResolvedApplication, type ResolvedAuth, type ResolvedLeaderFormation, 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, 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 SignupControlTier, type SignupControlValidation, type StripeEvent, type StripeResult, type SubmitResult, type TierGroup, type TierGroupRow, type WebhookEvent, applicantProfile, applicationBookingUpdate, applicationSummary, applyMembershipTierMarkdown, backfillCrm, bookingDecision, brandTokens, bucketSeries, buildGroupSeed, buildTierSeeds, canApprove, canBook, canChangeRole, canTransition, canceledPatch, canonicalSignupControl, chapterBrandFromTokens, chapterDb, clampArray, clerkGetUser, clerkGetUserByEmail, clerkIntegration, clerkInviteRequest, clerkListUsers, clerkSetRole, clerkUserRequest, createChapterIntegration, createClerkInvitation, createClerkUser, createSignupControlEnvelope, dashboardMetricData, defaultCrm, defineChapter, emailGroupFrom, endForSlot, findApplicationRef, findTier, firstPaymentPatch, formatChapterCopy, formationFields, getVaultSecret, hasDisclaimerAck, introIdempotencyKey, isAdminRole, isAlreadySent, isReconcilable, isSlotAvailable, isValidEmail, joinConfig, joinConfigTiers, leaderCrmConfig, loadOfferableTiers, loadTiers, meetingCreateRow, meetingRescheduleUpdate, memberApplication, memberSession, membershipPageDocument, membershipTierPresentationFromMarkdown, networkSourceTag, normalizeSharedRecord, normalizeWebhookEvent, offerableTiers, paymentsReady, personInputFromApp, planDelivery, projectApplicant, projectSharedRecord, reconcileMeetings, refundedPatch, render, renderSummary, renderTemplateBody, renewalPatch, resolveApplication, resolveAuth, resolveChapterCopy, resolveLeaderFormation, resolvePipeline, resolveScheduling, resolveSignupControl, resolveTiers, roleFromClaim, sendTemplated, sharedPersonInput, sharedRecordFromCrm, signupControlDigest, slotWindow, stageIndex, stripeCall, subAnnualCents, submitApplication, subscriptionIdempotencyKey, syncApplicationToCrm, tierIsFree, tierPayable, updateClerkUserMetadata, updateClerkUserMetadataByEmail, validateMembershipPageDocument, validateScheduling, validateSignupControlDocument, webhookMutationId };
2094
+ /** Stable adapter identity bound into Chapter artifact provenance. */
2095
+ declare const CHAPTER_PROMOTION_ADAPTER = "@odla-ai/chapter/v1";
2096
+ /** One exact, digest-verified signup-control revision to export. */
2097
+ interface ChapterPromotionInput {
2098
+ document: SignupControlDocument;
2099
+ digest: string;
2100
+ }
2101
+ /** Export the provider-independent pieces of one exact active signup revision. */
2102
+ declare function exportChapterPromotion(input: ChapterPromotionInput): Promise<PromotionAdapterResult>;
2103
+
2104
+ export { type AccountModel, type AdminNotificationTrigger, type Applicant, type ApplicationBookingPatch, type ApplicationRecord, type ApplicationSummary, type Attr, type AttrType, CHAPTER_PROMOTION_ADAPTER, type Chapter, type ChapterApplication, type ChapterAuth, type ChapterBrand, type ChapterConfig, type ChapterCopy, type ChapterCopyInput, type ChapterDb, type ChapterEmails, type ChapterIntegrationDescriptor, type ChapterIntegrationOptions, 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 CompiledChapterBrandTokens, DEFAULT_CHAPTER_COPY, DEFAULT_SHARE_FIELDS, type DashboardMetricData, type DashboardMetricSeries, type DbOp, type DbRules, type DbSchema, type DeliveryDecision, type EmailGroup, type EmailTemplate, type EmailTemplateRow, type Entity, type ExistingMeeting, type GuardResult, type IntegrationDescriptor, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type IntegrationSync, type JoinConfigGroup, type JoinConfigTier, type LeaderCrmOptions, type LeaderFormationConfig, type LiveEvent, MEMBERSHIP_PAGE_RENDERER, type MailSender, type MeetingForReconcile, type MeetingRecord, type MeetingReschedulePatch, type MemberApplication, type MemberSession, type MembershipPageDocument, type MembershipPageValidationOptions, type MembershipPageValidationResult, type MembershipTierAuthority, type MembershipTierCallout, type MembershipTierCapacity, type MembershipTierMarkdownResult, type MembershipTierPresentation, type MembershipTierVariant, type NetworkRecord, type NetworkRecordNote, type NetworkRecordPage, type NetworkRollup, type NetworkRollupTarget, type NetworkSharedNote, type NetworkSnapshot, type NewMeetingRow, type NotifyDeps, type NotifyInput, type NotifyResult, type PaymentsGroup, type ProjectionDeps, type ReconcileDecision, type ResolvedApplication, type ResolvedAuth, type ResolvedLeaderFormation, 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, 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 SignupControlTier, type SignupControlValidation, type StripeEvent, type StripeResult, type SubmitResult, type TierGroup, type TierGroupRow, type WebhookEvent, applicantProfile, applicationBookingUpdate, applicationSummary, applyMembershipTierMarkdown, backfillCrm, bookingDecision, brandTokens, bucketSeries, buildGroupSeed, buildTierSeeds, canApprove, canBook, canChangeRole, canTransition, canceledPatch, canonicalSignupControl, chapterBrandFromTokens, chapterDb, clampArray, clerkGetUser, clerkGetUserByEmail, clerkIntegration, clerkInviteRequest, clerkListUsers, clerkSetRole, clerkUserRequest, createChapterIntegration, createClerkInvitation, createClerkUser, createSignupControlEnvelope, dashboardMetricData, defaultCrm, defineChapter, emailGroupFrom, endForSlot, exportChapterPromotion, findApplicationRef, findTier, firstPaymentPatch, formatChapterCopy, formationFields, getVaultSecret, hasDisclaimerAck, introIdempotencyKey, isAdminRole, isAlreadySent, isReconcilable, isSlotAvailable, isValidEmail, joinConfig, joinConfigTiers, leaderCrmConfig, loadOfferableTiers, loadTiers, meetingCreateRow, meetingRescheduleUpdate, memberApplication, memberSession, membershipPageDocument, membershipTierPresentationFromMarkdown, networkSourceTag, normalizeSharedRecord, normalizeWebhookEvent, offerableTiers, paymentsReady, personInputFromApp, planDelivery, projectApplicant, projectSharedRecord, reconcileMeetings, refundedPatch, render, renderSummary, renderTemplateBody, renewalPatch, resolveApplication, resolveAuth, resolveChapterCopy, resolveLeaderFormation, resolvePipeline, resolveScheduling, resolveSignupControl, resolveTiers, roleFromClaim, sendTemplated, sharedPersonInput, sharedRecordFromCrm, signupControlDigest, slotWindow, stageIndex, stripeCall, subAnnualCents, submitApplication, subscriptionIdempotencyKey, syncApplicationToCrm, tierIsFree, tierPayable, updateClerkUserMetadata, updateClerkUserMetadataByEmail, validateMembershipPageDocument, validateScheduling, validateSignupControlDocument, webhookMutationId };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { CrmConfig, Crm, FieldConditions, TypeDef, FieldDef, TypeSummary, CrmRecord } from '@odla-ai/crm';
2
2
  import { StripeRequestResult } from '@odla-ai/stripe';
3
3
  export { stripeForm, verifyStripeSignature } from '@odla-ai/stripe';
4
+ import { PromotionAdapterResult } from '@odla-ai/promotion';
4
5
 
5
6
  /** One membership tier a chapter offers. `priceCents: 0` means free. */
6
7
  interface ChapterTier {
@@ -300,12 +301,26 @@ interface ChapterPolicy {
300
301
  type ChapterMode = "chapter" | "hub";
301
302
  /** One odla-db transaction op — the wire shape both the real admin client and a
302
303
  * test double (`FakeDb`) accept. Built as a plain object, never via a `tx` proxy. */
303
- interface DbOp {
304
- t: "update" | "merge" | "retract" | "delete";
304
+ type DbOp<Id extends string | {
305
305
  ns: string;
306
- id: string;
307
- attrs?: Record<string, unknown>;
308
- }
306
+ attr: string;
307
+ value: string | number | boolean;
308
+ } = string> = {
309
+ t: "update" | "merge";
310
+ ns: string;
311
+ id: Id;
312
+ attrs: Record<string, unknown>;
313
+ } | {
314
+ t: "retract";
315
+ ns: string;
316
+ id: Id;
317
+ attrs: string[];
318
+ } | {
319
+ t: "delete";
320
+ ns: string;
321
+ id: Id;
322
+ attrs?: undefined;
323
+ };
309
324
  /** The structural view of the odla-db admin client the worker builds and the
310
325
  * member routes consume — so route logic is testable against an in-memory fake. */
311
326
  interface ChapterDb {
@@ -320,7 +335,11 @@ interface ChapterDb {
320
335
  }): Promise<{
321
336
  count?: number;
322
337
  }>;
323
- transact(ops: DbOp[], opts?: {
338
+ transact(ops: DbOp<string | {
339
+ ns: string;
340
+ attr: string;
341
+ value: string | number | boolean;
342
+ }>[], opts?: {
324
343
  mutationId?: string;
325
344
  }): Promise<{
326
345
  txId: number;
@@ -2026,7 +2045,7 @@ interface SignupControlReceipt {
2026
2045
  acknowledgedAt: number;
2027
2046
  }
2028
2047
  /** Stable reason codes returned when a follower refuses desired state. */
2029
- type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision";
2048
+ type SignupControlRejection = "invalid_document" | "invalid_digest" | "wrong_source" | "wrong_target" | "wrong_environment" | "wrong_stripe_mode" | "stale_revision" | "conflicting_revision" | "materialization_failed";
2030
2049
  /** Normalized document result returned by the package validator. */
2031
2050
  type SignupControlValidation = {
2032
2051
  ok: true;
@@ -2072,4 +2091,14 @@ declare function applyMembershipTierMarkdown(presentation: MembershipTierPresent
2072
2091
  /** Apply constrained membership Markdown or fail closed with actionable errors. */
2073
2092
  declare function membershipTierPresentationFromMarkdown(presentation: MembershipTierPresentation, source: string): MembershipTierPresentation;
2074
2093
 
2075
- export { type AccountModel, type AdminNotificationTrigger, type Applicant, type ApplicationBookingPatch, type ApplicationRecord, type ApplicationSummary, type Attr, type AttrType, type Chapter, type ChapterApplication, type ChapterAuth, type ChapterBrand, type ChapterConfig, type ChapterCopy, type ChapterCopyInput, type ChapterDb, type ChapterEmails, type ChapterIntegrationDescriptor, type ChapterIntegrationOptions, type ChapterMode, type ChapterNetwork, type ChapterNetworkReader, type ChapterNetworkTarget, type ChapterOperations, type ChapterPipeline, type ChapterPolicy, type ChapterPrices, type ChapterRunbookHints, type ChapterScheduling, type ChapterSends, type ChapterSignupControl, type ChapterTier, type ChapterTierConfig, type ClerkInviteInput, type ClerkMetadataInput, type ClerkResult, type ClerkUserInput, type ClerkUserRecord, type CompiledChapterBrandTokens, DEFAULT_CHAPTER_COPY, DEFAULT_SHARE_FIELDS, type DashboardMetricData, type DashboardMetricSeries, type DbOp, type DbRules, type DbSchema, type DeliveryDecision, type EmailGroup, type EmailTemplate, type EmailTemplateRow, type Entity, type ExistingMeeting, type GuardResult, type IntegrationDescriptor, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type IntegrationSync, type JoinConfigGroup, type JoinConfigTier, type LeaderCrmOptions, type LeaderFormationConfig, type LiveEvent, MEMBERSHIP_PAGE_RENDERER, type MailSender, type MeetingForReconcile, type MeetingRecord, type MeetingReschedulePatch, type MemberApplication, type MemberSession, type MembershipPageDocument, type MembershipPageValidationOptions, type MembershipPageValidationResult, type MembershipTierAuthority, type MembershipTierCallout, type MembershipTierCapacity, type MembershipTierMarkdownResult, type MembershipTierPresentation, type MembershipTierVariant, type NetworkRecord, type NetworkRecordNote, type NetworkRecordPage, type NetworkRollup, type NetworkRollupTarget, type NetworkSharedNote, type NetworkSnapshot, type NewMeetingRow, type NotifyDeps, type NotifyInput, type NotifyResult, type PaymentsGroup, type ProjectionDeps, type ReconcileDecision, type ResolvedApplication, type ResolvedAuth, type ResolvedLeaderFormation, 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, 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 SignupControlTier, type SignupControlValidation, type StripeEvent, type StripeResult, type SubmitResult, type TierGroup, type TierGroupRow, type WebhookEvent, applicantProfile, applicationBookingUpdate, applicationSummary, applyMembershipTierMarkdown, backfillCrm, bookingDecision, brandTokens, bucketSeries, buildGroupSeed, buildTierSeeds, canApprove, canBook, canChangeRole, canTransition, canceledPatch, canonicalSignupControl, chapterBrandFromTokens, chapterDb, clampArray, clerkGetUser, clerkGetUserByEmail, clerkIntegration, clerkInviteRequest, clerkListUsers, clerkSetRole, clerkUserRequest, createChapterIntegration, createClerkInvitation, createClerkUser, createSignupControlEnvelope, dashboardMetricData, defaultCrm, defineChapter, emailGroupFrom, endForSlot, findApplicationRef, findTier, firstPaymentPatch, formatChapterCopy, formationFields, getVaultSecret, hasDisclaimerAck, introIdempotencyKey, isAdminRole, isAlreadySent, isReconcilable, isSlotAvailable, isValidEmail, joinConfig, joinConfigTiers, leaderCrmConfig, loadOfferableTiers, loadTiers, meetingCreateRow, meetingRescheduleUpdate, memberApplication, memberSession, membershipPageDocument, membershipTierPresentationFromMarkdown, networkSourceTag, normalizeSharedRecord, normalizeWebhookEvent, offerableTiers, paymentsReady, personInputFromApp, planDelivery, projectApplicant, projectSharedRecord, reconcileMeetings, refundedPatch, render, renderSummary, renderTemplateBody, renewalPatch, resolveApplication, resolveAuth, resolveChapterCopy, resolveLeaderFormation, resolvePipeline, resolveScheduling, resolveSignupControl, resolveTiers, roleFromClaim, sendTemplated, sharedPersonInput, sharedRecordFromCrm, signupControlDigest, slotWindow, stageIndex, stripeCall, subAnnualCents, submitApplication, subscriptionIdempotencyKey, syncApplicationToCrm, tierIsFree, tierPayable, updateClerkUserMetadata, updateClerkUserMetadataByEmail, validateMembershipPageDocument, validateScheduling, validateSignupControlDocument, webhookMutationId };
2094
+ /** Stable adapter identity bound into Chapter artifact provenance. */
2095
+ declare const CHAPTER_PROMOTION_ADAPTER = "@odla-ai/chapter/v1";
2096
+ /** One exact, digest-verified signup-control revision to export. */
2097
+ interface ChapterPromotionInput {
2098
+ document: SignupControlDocument;
2099
+ digest: string;
2100
+ }
2101
+ /** Export the provider-independent pieces of one exact active signup revision. */
2102
+ declare function exportChapterPromotion(input: ChapterPromotionInput): Promise<PromotionAdapterResult>;
2103
+
2104
+ export { type AccountModel, type AdminNotificationTrigger, type Applicant, type ApplicationBookingPatch, type ApplicationRecord, type ApplicationSummary, type Attr, type AttrType, CHAPTER_PROMOTION_ADAPTER, type Chapter, type ChapterApplication, type ChapterAuth, type ChapterBrand, type ChapterConfig, type ChapterCopy, type ChapterCopyInput, type ChapterDb, type ChapterEmails, type ChapterIntegrationDescriptor, type ChapterIntegrationOptions, 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 CompiledChapterBrandTokens, DEFAULT_CHAPTER_COPY, DEFAULT_SHARE_FIELDS, type DashboardMetricData, type DashboardMetricSeries, type DbOp, type DbRules, type DbSchema, type DeliveryDecision, type EmailGroup, type EmailTemplate, type EmailTemplateRow, type Entity, type ExistingMeeting, type GuardResult, type IntegrationDescriptor, type IntegrationProvision, type IntegrationSecret, type IntegrationSetting, type IntegrationSync, type JoinConfigGroup, type JoinConfigTier, type LeaderCrmOptions, type LeaderFormationConfig, type LiveEvent, MEMBERSHIP_PAGE_RENDERER, type MailSender, type MeetingForReconcile, type MeetingRecord, type MeetingReschedulePatch, type MemberApplication, type MemberSession, type MembershipPageDocument, type MembershipPageValidationOptions, type MembershipPageValidationResult, type MembershipTierAuthority, type MembershipTierCallout, type MembershipTierCapacity, type MembershipTierMarkdownResult, type MembershipTierPresentation, type MembershipTierVariant, type NetworkRecord, type NetworkRecordNote, type NetworkRecordPage, type NetworkRollup, type NetworkRollupTarget, type NetworkSharedNote, type NetworkSnapshot, type NewMeetingRow, type NotifyDeps, type NotifyInput, type NotifyResult, type PaymentsGroup, type ProjectionDeps, type ReconcileDecision, type ResolvedApplication, type ResolvedAuth, type ResolvedLeaderFormation, 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, 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 SignupControlTier, type SignupControlValidation, type StripeEvent, type StripeResult, type SubmitResult, type TierGroup, type TierGroupRow, type WebhookEvent, applicantProfile, applicationBookingUpdate, applicationSummary, applyMembershipTierMarkdown, backfillCrm, bookingDecision, brandTokens, bucketSeries, buildGroupSeed, buildTierSeeds, canApprove, canBook, canChangeRole, canTransition, canceledPatch, canonicalSignupControl, chapterBrandFromTokens, chapterDb, clampArray, clerkGetUser, clerkGetUserByEmail, clerkIntegration, clerkInviteRequest, clerkListUsers, clerkSetRole, clerkUserRequest, createChapterIntegration, createClerkInvitation, createClerkUser, createSignupControlEnvelope, dashboardMetricData, defaultCrm, defineChapter, emailGroupFrom, endForSlot, exportChapterPromotion, findApplicationRef, findTier, firstPaymentPatch, formatChapterCopy, formationFields, getVaultSecret, hasDisclaimerAck, introIdempotencyKey, isAdminRole, isAlreadySent, isReconcilable, isSlotAvailable, isValidEmail, joinConfig, joinConfigTiers, leaderCrmConfig, loadOfferableTiers, loadTiers, meetingCreateRow, meetingRescheduleUpdate, memberApplication, memberSession, membershipPageDocument, membershipTierPresentationFromMarkdown, networkSourceTag, normalizeSharedRecord, normalizeWebhookEvent, offerableTiers, paymentsReady, personInputFromApp, planDelivery, projectApplicant, projectSharedRecord, reconcileMeetings, refundedPatch, render, renderSummary, renderTemplateBody, renewalPatch, resolveApplication, resolveAuth, resolveChapterCopy, resolveLeaderFormation, resolvePipeline, resolveScheduling, resolveSignupControl, resolveTiers, roleFromClaim, sendTemplated, sharedPersonInput, sharedRecordFromCrm, signupControlDigest, slotWindow, stageIndex, stripeCall, subAnnualCents, submitApplication, subscriptionIdempotencyKey, syncApplicationToCrm, tierIsFree, tierPayable, updateClerkUserMetadata, updateClerkUserMetadataByEmail, validateMembershipPageDocument, validateScheduling, validateSignupControlDocument, webhookMutationId };
package/dist/index.js CHANGED
@@ -3070,7 +3070,101 @@ function membershipTierPresentationFromMarkdown(presentation, source) {
3070
3070
  if (!result.ok) throw new TypeError(`Invalid membership Markdown: ${result.errors.join("; ")}`);
3071
3071
  return result.value;
3072
3072
  }
3073
+
3074
+ // src/promotion.ts
3075
+ import {
3076
+ canonicalPromotionValue
3077
+ } from "@odla-ai/promotion";
3078
+ var CHAPTER_PROMOTION_ADAPTER = "@odla-ai/chapter/v1";
3079
+ var exclusions = (chapterId, paidTierIds) => [
3080
+ {
3081
+ kind: "chapter.providers",
3082
+ id: chapterId,
3083
+ reason: "provider_identity",
3084
+ paths: [
3085
+ ...paidTierIds.map((id2) => `tiers[${id2}].stripePriceId`),
3086
+ "groups.stripePublishableKey",
3087
+ "applications.stripeCustomerId",
3088
+ "applications.stripeSubscriptionId",
3089
+ "meetings.googleEventId"
3090
+ ],
3091
+ detail: "Stripe, Clerk, and Google identities are resolved independently in each target environment."
3092
+ },
3093
+ {
3094
+ kind: "chapter.runtime",
3095
+ id: chapterId,
3096
+ reason: "runtime_state",
3097
+ paths: ["applications.*", "meetings.*", "emailLog.*", "crm_*.*"],
3098
+ detail: "Applicants, meetings, messages, and CRM rows are operational state, not managed signup content."
3099
+ },
3100
+ {
3101
+ kind: "chapter.access",
3102
+ id: chapterId,
3103
+ reason: "personal_data",
3104
+ paths: ["admins.*", "superAdmins.*", "networkNotes.*"],
3105
+ detail: "People, access lists, and private network notes remain local to the target environment."
3106
+ },
3107
+ {
3108
+ kind: "chapter.history",
3109
+ id: chapterId,
3110
+ reason: "authority_history",
3111
+ paths: ["signupControls[active=false]", "signupControls.*At", "signupControls.environment"],
3112
+ detail: "The source retains immutable delivery history; only selected published content is exported."
3113
+ }
3114
+ ];
3115
+ async function exportChapterPromotion(input) {
3116
+ if (!/^sha256:[0-9a-f]{64}$/.test(input.digest)) throw new TypeError("chapter promotion digest is invalid");
3117
+ const checked = validateSignupControlDocument(input.document);
3118
+ if (!checked.ok) throw new TypeError(checked.errors.join("; "));
3119
+ const document = checked.value;
3120
+ if (await signupControlDigest(document) !== input.digest) throw new TypeError("chapter promotion digest does not match its document");
3121
+ const revision = `chapter:${document.target.chapterId}:${document.revision}`;
3122
+ const promotionProvenance = {
3123
+ adapter: CHAPTER_PROMOTION_ADAPTER,
3124
+ sourceIds: [`signup-control:${document.revision}`, document.source.appId, document.target.chapterId].sort(),
3125
+ receiptDigests: [input.digest]
3126
+ };
3127
+ const artifact = (kind, id2, content) => ({
3128
+ kind,
3129
+ id: id2,
3130
+ sourceRevision: revision,
3131
+ provenance: promotionProvenance,
3132
+ content: canonicalPromotionValue(content)
3133
+ });
3134
+ const chapterId = document.target.chapterId;
3135
+ const artifacts = [
3136
+ artifact("chapter.catalog", chapterId, {
3137
+ chapterId,
3138
+ tiers: document.tiers.map(({ stripePriceId: _providerId, ...tier }) => tier)
3139
+ }),
3140
+ artifact("chapter.membership-page", chapterId, document.membershipPage),
3141
+ ...document.application ? [artifact("chapter.application", chapterId, document.application)] : [],
3142
+ ...document.policy ? [artifact("chapter.policy", chapterId, document.policy)] : [],
3143
+ ...document.scheduling ? [artifact("chapter.scheduling", chapterId, document.scheduling)] : [],
3144
+ ...document.theme ? [artifact("chapter.theme", chapterId, document.theme)] : []
3145
+ ];
3146
+ return {
3147
+ adapter: CHAPTER_PROMOTION_ADAPTER,
3148
+ artifacts,
3149
+ exclusions: exclusions(chapterId, document.tiers.filter((tier) => tier.stripePriceId).map((tier) => tier.id)),
3150
+ preconditions: [
3151
+ {
3152
+ code: "chapter.signup-control.schema",
3153
+ path: "services.chapter.signupControl.schemaVersion",
3154
+ expected: document.schemaVersion,
3155
+ detail: "The target must support this Chapter signup-control document version."
3156
+ },
3157
+ {
3158
+ code: "chapter.identity",
3159
+ path: "app.appId",
3160
+ expected: chapterId,
3161
+ detail: "Chapter content can only target the chapter named by the signed source revision."
3162
+ }
3163
+ ]
3164
+ };
3165
+ }
3073
3166
  export {
3167
+ CHAPTER_PROMOTION_ADAPTER,
3074
3168
  DEFAULT_CHAPTER_COPY,
3075
3169
  DEFAULT_SHARE_FIELDS,
3076
3170
  MEMBERSHIP_PAGE_RENDERER,
@@ -3112,6 +3206,7 @@ export {
3112
3206
  defineChapter,
3113
3207
  emailGroupFrom,
3114
3208
  endForSlot,
3209
+ exportChapterPromotion,
3115
3210
  findApplicationRef,
3116
3211
  findTier,
3117
3212
  firstPaymentPatch,