@odla-ai/chapter 0.14.0 → 0.15.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/README.md +14 -7
- package/dist/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 ?? "
|
|
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(
|