@odla-ai/chapter 0.27.1 → 0.28.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 CHANGED
@@ -330,6 +330,28 @@ export const chapter = defineChapter({
330
330
  });
331
331
  ```
332
332
 
333
+ The leader may make `chapter` its own durable aggregate while retaining the
334
+ preset's required identity and relations. `chapter.fields` and
335
+ `chapter.facets` merge with the defaults; `chapter.pipeline` replaces the
336
+ generic proposed/forming/active lifecycle. The final configuration is still
337
+ validated by `defineCrm()`:
338
+
339
+ ```ts
340
+ crm: leaderCrmConfig({
341
+ base: existingCrmConfig,
342
+ chapter: {
343
+ fields: {
344
+ marketKey: { type: "string", label: "Market key", slot: "s3" },
345
+ signalScore: { type: "number", label: "Signal score", slot: "n1" },
346
+ },
347
+ pipeline: {
348
+ stages: [{ id: "investigation" }, { id: "growth" }],
349
+ transitions: { investigation: ["growth"] },
350
+ },
351
+ },
352
+ }),
353
+ ```
354
+
333
355
  The preset adds `chapter`, `chapter_application`, and `deal` record types in
334
356
  the `portfolio` workspace, with formation, operating, and deal-flow pipelines.
335
357
  It also composes relations to base `person` and `company` types when present.
package/dist/index.cjs CHANGED
@@ -1246,39 +1246,61 @@ function defineChapter(config) {
1246
1246
  var import_crm2 = require("@odla-ai/crm");
1247
1247
  function leaderCrmConfig(options = {}) {
1248
1248
  const base = options.base ?? defaultCrm("hub");
1249
+ const defaultChapter = {
1250
+ label: "Chapter",
1251
+ labelPlural: "Chapters",
1252
+ workspace: "portfolio",
1253
+ nameField: "name",
1254
+ fields: {
1255
+ name: { type: "string", label: "Name", required: true },
1256
+ slug: { type: "string", label: "Slug", slot: "s1" },
1257
+ region: { type: "string", label: "Region", slot: "s2" },
1258
+ url: { type: "url", label: "Website" },
1259
+ thesis: { type: "string", label: "Investment thesis" },
1260
+ launchedAt: { type: "date", label: "Launch date", slot: "d1" },
1261
+ notes: { type: "string", label: "Notes" }
1262
+ },
1263
+ pipeline: {
1264
+ stages: [
1265
+ { id: "proposed", label: "Proposed" },
1266
+ { id: "forming", label: "Forming" },
1267
+ { id: "active", label: "Active" },
1268
+ { id: "paused", label: "Paused" },
1269
+ { id: "closed", label: "Closed", terminal: true }
1270
+ ],
1271
+ transitions: {
1272
+ proposed: ["forming", "closed"],
1273
+ forming: ["active", "paused", "closed"],
1274
+ active: ["paused", "closed"],
1275
+ paused: ["forming", "active", "closed"]
1276
+ }
1277
+ },
1278
+ facets: { rank: "manual" }
1279
+ };
1280
+ const chapterOverride = options.chapter ?? {};
1281
+ const chapterType = {
1282
+ ...defaultChapter,
1283
+ ...chapterOverride,
1284
+ fields: {
1285
+ ...defaultChapter.fields,
1286
+ ...chapterOverride.fields ?? {},
1287
+ // The preset's natural identity is not optional even when the host adds
1288
+ // its own fields or relabels the name input.
1289
+ name: {
1290
+ ...defaultChapter.fields.name,
1291
+ ...chapterOverride.fields?.name ?? {},
1292
+ type: "string",
1293
+ required: true
1294
+ }
1295
+ },
1296
+ facets: {
1297
+ ...defaultChapter.facets,
1298
+ ...chapterOverride.facets ?? {}
1299
+ }
1300
+ };
1249
1301
  const portfolio = {
1250
1302
  types: {
1251
- chapter: {
1252
- label: "Chapter",
1253
- labelPlural: "Chapters",
1254
- workspace: "portfolio",
1255
- nameField: "name",
1256
- fields: {
1257
- name: { type: "string", label: "Name", required: true },
1258
- slug: { type: "string", label: "Slug", slot: "s1" },
1259
- region: { type: "string", label: "Region", slot: "s2" },
1260
- url: { type: "url", label: "Website" },
1261
- thesis: { type: "string", label: "Investment thesis" },
1262
- launchedAt: { type: "date", label: "Launch date", slot: "d1" },
1263
- notes: { type: "string", label: "Notes" }
1264
- },
1265
- pipeline: {
1266
- stages: [
1267
- { id: "proposed", label: "Proposed" },
1268
- { id: "forming", label: "Forming" },
1269
- { id: "active", label: "Active" },
1270
- { id: "paused", label: "Paused" },
1271
- { id: "closed", label: "Closed", terminal: true }
1272
- ],
1273
- transitions: {
1274
- proposed: ["forming", "closed"],
1275
- forming: ["active", "paused", "closed"],
1276
- active: ["paused", "closed"],
1277
- paused: ["forming", "active", "closed"]
1278
- }
1279
- },
1280
- facets: { rank: "manual" }
1281
- },
1303
+ chapter: chapterType,
1282
1304
  chapter_application: {
1283
1305
  label: "Chapter application",
1284
1306
  labelPlural: "Formation applications",