@odla-ai/chapter 0.14.0 → 0.15.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/dist/index.d.cts CHANGED
@@ -242,10 +242,13 @@ interface ChapterConfig {
242
242
  auth?: ChapterAuth;
243
243
  /** odla services (db implied). Default `["db","calendar","o11y"]`. */
244
244
  services?: readonly string[];
245
- /** Apply-time account provisioning: `"invite"` (default) mints a Clerk
246
- * invitation, `"create"` makes the account server-side (so join can say the
247
- * account is ready), `"none"` skips it. Any of these needs a `clerk_secret_key`
248
- * vault secret to act. */
245
+ /** Apply-time account provisioning. **Default `"none"`** it provisions
246
+ * nothing, because the alternatives have an outbound side effect and a site
247
+ * that never made the choice must not be mailing people. `"create"` makes the
248
+ * Clerk account server-side (so join can say the account is ready);
249
+ * `"invite"` **emails the applicant a Clerk invitation**. Both non-default
250
+ * models need a `clerk_secret_key` vault secret to act. Opt in explicitly —
251
+ * leaving this unset provisions no accounts. */
249
252
  account?: AccountModel;
250
253
  /** WHEN lifecycle email fires. Addressing and content live on the group row
251
254
  * (owner-editable at runtime); this is the trigger, which is a build-time
@@ -284,7 +287,7 @@ interface Chapter {
284
287
  schema: DbSchema;
285
288
  rules: DbRules;
286
289
  services: readonly string[];
287
- /** Resolved apply-time account provisioning model (default `"invite"`). */
290
+ /** Resolved apply-time account provisioning model (default `"none"`). */
288
291
  account: AccountModel;
289
292
  /** Resolved send policy — when each lifecycle email fires. */
290
293
  sends: ResolvedSends;
package/dist/index.d.ts CHANGED
@@ -242,10 +242,13 @@ interface ChapterConfig {
242
242
  auth?: ChapterAuth;
243
243
  /** odla services (db implied). Default `["db","calendar","o11y"]`. */
244
244
  services?: readonly string[];
245
- /** Apply-time account provisioning: `"invite"` (default) mints a Clerk
246
- * invitation, `"create"` makes the account server-side (so join can say the
247
- * account is ready), `"none"` skips it. Any of these needs a `clerk_secret_key`
248
- * vault secret to act. */
245
+ /** Apply-time account provisioning. **Default `"none"`** it provisions
246
+ * nothing, because the alternatives have an outbound side effect and a site
247
+ * that never made the choice must not be mailing people. `"create"` makes the
248
+ * Clerk account server-side (so join can say the account is ready);
249
+ * `"invite"` **emails the applicant a Clerk invitation**. Both non-default
250
+ * models need a `clerk_secret_key` vault secret to act. Opt in explicitly —
251
+ * leaving this unset provisions no accounts. */
249
252
  account?: AccountModel;
250
253
  /** WHEN lifecycle email fires. Addressing and content live on the group row
251
254
  * (owner-editable at runtime); this is the trigger, which is a build-time
@@ -284,7 +287,7 @@ interface Chapter {
284
287
  schema: DbSchema;
285
288
  rules: DbRules;
286
289
  services: readonly string[];
287
- /** Resolved apply-time account provisioning model (default `"invite"`). */
290
+ /** Resolved apply-time account provisioning model (default `"none"`). */
288
291
  account: AccountModel;
289
292
  /** Resolved send policy — when each lifecycle email fires. */
290
293
  sends: ResolvedSends;
package/dist/index.js CHANGED
@@ -513,10 +513,23 @@ function defineChapter(config) {
513
513
  const application = resolveApplication(config.application);
514
514
  const { schema, rules } = chapterDb(mode, auth);
515
515
  const services = config.services ?? ["db", "calendar", "o11y"];
516
- const account = config.account ?? "invite";
516
+ const account = config.account ?? "none";
517
517
  if (account !== "invite" && account !== "create" && account !== "none") {
518
518
  throw new Error(`defineChapter.account: must be "invite", "create", or "none" \u2014 got "${String(account)}"`);
519
519
  }
520
+ if (application.crmFields.length > 0) {
521
+ let personFields = null;
522
+ try {
523
+ personFields = Object.keys(crm.type("person").fields ?? {});
524
+ } catch {
525
+ }
526
+ const unknown = personFields ? application.crmFields.filter((f) => !personFields.includes(f)) : [];
527
+ if (unknown.length > 0) {
528
+ throw new Error(
529
+ `defineChapter.application.crmFields: ${unknown.map((f) => `"${f}"`).join(", ")} not declared on the CRM "person" type (declared: ${personFields?.join(", ")}). An undeclared field is silently dropped from the CRM projection \u2014 add it to your crm config's person fields, or remove it from crmFields.`
530
+ );
531
+ }
532
+ }
520
533
  const adminNotification = config.sends?.adminNotification ?? "submit";
521
534
  if (adminNotification !== "submit" && adminNotification !== "payment" && adminNotification !== "never") {
522
535
  throw new Error(