@odla-ai/chapter 0.27.1 → 0.28.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
@@ -1,4 +1,4 @@
1
- import { CrmConfig, Crm, FieldDef, TypeSummary, CrmRecord } from '@odla-ai/crm';
1
+ import { CrmConfig, Crm, TypeDef, FieldDef, TypeSummary, CrmRecord } from '@odla-ai/crm';
2
2
 
3
3
  type TextFields$1<Key extends string> = {
4
4
  [Field in Key]: string;
@@ -565,6 +565,11 @@ interface LeaderCrmOptions {
565
565
  /** Existing host CRM config to preserve. Defaults to Chapter's people +
566
566
  * businesses graph for hub mode. */
567
567
  base?: CrmConfig;
568
+ /** Host-owned additions or replacements for the durable chapter record.
569
+ * Fields and facets merge with the preset; a supplied pipeline replaces the
570
+ * generic proposed/forming/active lifecycle. The final composed CRM still
571
+ * goes through defineCrm's normal validation. */
572
+ chapter?: Partial<TypeDef>;
568
573
  }
569
574
  /**
570
575
  * Add generic chapter-formation, portfolio, and deal-flow records to an
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CrmConfig, Crm, FieldDef, TypeSummary, CrmRecord } from '@odla-ai/crm';
1
+ import { CrmConfig, Crm, TypeDef, FieldDef, TypeSummary, CrmRecord } from '@odla-ai/crm';
2
2
 
3
3
  type TextFields$1<Key extends string> = {
4
4
  [Field in Key]: string;
@@ -565,6 +565,11 @@ interface LeaderCrmOptions {
565
565
  /** Existing host CRM config to preserve. Defaults to Chapter's people +
566
566
  * businesses graph for hub mode. */
567
567
  base?: CrmConfig;
568
+ /** Host-owned additions or replacements for the durable chapter record.
569
+ * Fields and facets merge with the preset; a supplied pipeline replaces the
570
+ * generic proposed/forming/active lifecycle. The final composed CRM still
571
+ * goes through defineCrm's normal validation. */
572
+ chapter?: Partial<TypeDef>;
568
573
  }
569
574
  /**
570
575
  * Add generic chapter-formation, portfolio, and deal-flow records to an
package/dist/index.js CHANGED
@@ -1132,39 +1132,61 @@ function defineChapter(config) {
1132
1132
  import { composeCrmConfigs } from "@odla-ai/crm";
1133
1133
  function leaderCrmConfig(options = {}) {
1134
1134
  const base = options.base ?? defaultCrm("hub");
1135
+ const defaultChapter = {
1136
+ label: "Chapter",
1137
+ labelPlural: "Chapters",
1138
+ workspace: "portfolio",
1139
+ nameField: "name",
1140
+ fields: {
1141
+ name: { type: "string", label: "Name", required: true },
1142
+ slug: { type: "string", label: "Slug", slot: "s1" },
1143
+ region: { type: "string", label: "Region", slot: "s2" },
1144
+ url: { type: "url", label: "Website" },
1145
+ thesis: { type: "string", label: "Investment thesis" },
1146
+ launchedAt: { type: "date", label: "Launch date", slot: "d1" },
1147
+ notes: { type: "string", label: "Notes" }
1148
+ },
1149
+ pipeline: {
1150
+ stages: [
1151
+ { id: "proposed", label: "Proposed" },
1152
+ { id: "forming", label: "Forming" },
1153
+ { id: "active", label: "Active" },
1154
+ { id: "paused", label: "Paused" },
1155
+ { id: "closed", label: "Closed", terminal: true }
1156
+ ],
1157
+ transitions: {
1158
+ proposed: ["forming", "closed"],
1159
+ forming: ["active", "paused", "closed"],
1160
+ active: ["paused", "closed"],
1161
+ paused: ["forming", "active", "closed"]
1162
+ }
1163
+ },
1164
+ facets: { rank: "manual" }
1165
+ };
1166
+ const chapterOverride = options.chapter ?? {};
1167
+ const chapterType = {
1168
+ ...defaultChapter,
1169
+ ...chapterOverride,
1170
+ fields: {
1171
+ ...defaultChapter.fields,
1172
+ ...chapterOverride.fields ?? {},
1173
+ // The preset's natural identity is not optional even when the host adds
1174
+ // its own fields or relabels the name input.
1175
+ name: {
1176
+ ...defaultChapter.fields.name,
1177
+ ...chapterOverride.fields?.name ?? {},
1178
+ type: "string",
1179
+ required: true
1180
+ }
1181
+ },
1182
+ facets: {
1183
+ ...defaultChapter.facets,
1184
+ ...chapterOverride.facets ?? {}
1185
+ }
1186
+ };
1135
1187
  const portfolio = {
1136
1188
  types: {
1137
- chapter: {
1138
- label: "Chapter",
1139
- labelPlural: "Chapters",
1140
- workspace: "portfolio",
1141
- nameField: "name",
1142
- fields: {
1143
- name: { type: "string", label: "Name", required: true },
1144
- slug: { type: "string", label: "Slug", slot: "s1" },
1145
- region: { type: "string", label: "Region", slot: "s2" },
1146
- url: { type: "url", label: "Website" },
1147
- thesis: { type: "string", label: "Investment thesis" },
1148
- launchedAt: { type: "date", label: "Launch date", slot: "d1" },
1149
- notes: { type: "string", label: "Notes" }
1150
- },
1151
- pipeline: {
1152
- stages: [
1153
- { id: "proposed", label: "Proposed" },
1154
- { id: "forming", label: "Forming" },
1155
- { id: "active", label: "Active" },
1156
- { id: "paused", label: "Paused" },
1157
- { id: "closed", label: "Closed", terminal: true }
1158
- ],
1159
- transitions: {
1160
- proposed: ["forming", "closed"],
1161
- forming: ["active", "paused", "closed"],
1162
- active: ["paused", "closed"],
1163
- paused: ["forming", "active", "closed"]
1164
- }
1165
- },
1166
- facets: { rank: "manual" }
1167
- },
1189
+ chapter: chapterType,
1168
1190
  chapter_application: {
1169
1191
  label: "Chapter application",
1170
1192
  labelPlural: "Formation applications",