@elevasis/core 0.28.0 → 0.29.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.ts CHANGED
@@ -2238,9 +2238,9 @@ declare const OmTopologyNodeKindSchema: z.ZodEnum<{
2238
2238
  externalResource: "externalResource";
2239
2239
  }>;
2240
2240
  declare const OmTopologyRelationshipKindSchema: z.ZodEnum<{
2241
- approval: "approval";
2242
2241
  triggers: "triggers";
2243
2242
  uses: "uses";
2243
+ approval: "approval";
2244
2244
  }>;
2245
2245
  declare const OmTopologyNodeRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2246
2246
  kind: z.ZodLiteral<"system">;
@@ -2295,9 +2295,9 @@ declare const OmTopologyRelationshipSchema: z.ZodObject<{
2295
2295
  id: z.ZodString;
2296
2296
  }, z.core.$strip>], "kind">;
2297
2297
  kind: z.ZodEnum<{
2298
- approval: "approval";
2299
2298
  triggers: "triggers";
2300
2299
  uses: "uses";
2300
+ approval: "approval";
2301
2301
  }>;
2302
2302
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
2303
2303
  kind: z.ZodLiteral<"system">;
@@ -2357,9 +2357,9 @@ declare const OmTopologyDomainSchema: z.ZodDefault<z.ZodObject<{
2357
2357
  id: z.ZodString;
2358
2358
  }, z.core.$strip>], "kind">;
2359
2359
  kind: z.ZodEnum<{
2360
- approval: "approval";
2361
2360
  triggers: "triggers";
2362
2361
  uses: "uses";
2362
+ approval: "approval";
2363
2363
  }>;
2364
2364
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
2365
2365
  kind: z.ZodLiteral<"system">;
@@ -2634,7 +2634,7 @@ declare const topologyRelationship: {
2634
2634
  kind: "externalResource";
2635
2635
  id: string;
2636
2636
  };
2637
- kind: "approval" | "triggers" | "uses";
2637
+ kind: "triggers" | "uses" | "approval";
2638
2638
  to: {
2639
2639
  kind: "system";
2640
2640
  id: string;
@@ -2690,7 +2690,7 @@ declare const topologyRelationship: {
2690
2690
  kind: "externalResource";
2691
2691
  id: string;
2692
2692
  };
2693
- kind: "approval" | "triggers" | "uses";
2693
+ kind: "triggers" | "uses" | "approval";
2694
2694
  to: {
2695
2695
  kind: "system";
2696
2696
  id: string;
@@ -2746,7 +2746,7 @@ declare const topologyRelationship: {
2746
2746
  kind: "externalResource";
2747
2747
  id: string;
2748
2748
  };
2749
- kind: "approval" | "triggers" | "uses";
2749
+ kind: "triggers" | "uses" | "approval";
2750
2750
  to: {
2751
2751
  kind: "system";
2752
2752
  id: string;
@@ -2802,7 +2802,7 @@ declare const topologyRelationship: {
2802
2802
  kind: "externalResource";
2803
2803
  id: string;
2804
2804
  };
2805
- kind: "approval" | "triggers" | "uses";
2805
+ kind: "triggers" | "uses" | "approval";
2806
2806
  to: {
2807
2807
  kind: "system";
2808
2808
  id: string;
@@ -2858,7 +2858,7 @@ declare const topologyRelationship: {
2858
2858
  kind: "externalResource";
2859
2859
  id: string;
2860
2860
  };
2861
- kind: "approval" | "triggers" | "uses";
2861
+ kind: "triggers" | "uses" | "approval";
2862
2862
  to: {
2863
2863
  kind: "system";
2864
2864
  id: string;
@@ -2914,7 +2914,7 @@ declare const topologyRelationship: {
2914
2914
  kind: "externalResource";
2915
2915
  id: string;
2916
2916
  };
2917
- kind: "approval" | "triggers" | "uses";
2917
+ kind: "triggers" | "uses" | "approval";
2918
2918
  to: {
2919
2919
  kind: "system";
2920
2920
  id: string;
@@ -3672,7 +3672,6 @@ declare function scaffoldOrganizationModel(model: OrganizationModel, spec: OmSca
3672
3672
  declare const LinkSchema: z.ZodObject<{
3673
3673
  nodeId: z.ZodString;
3674
3674
  kind: z.ZodEnum<{
3675
- approval: "approval";
3676
3675
  affects: "affects";
3677
3676
  actions: "actions";
3678
3677
  effects: "effects";
@@ -3682,6 +3681,7 @@ declare const LinkSchema: z.ZodObject<{
3682
3681
  emits: "emits";
3683
3682
  triggers: "triggers";
3684
3683
  uses: "uses";
3684
+ approval: "approval";
3685
3685
  contains: "contains";
3686
3686
  references: "references";
3687
3687
  maps_to: "maps_to";
@@ -4528,9 +4528,9 @@ declare const OrganizationModelSchema: z.ZodObject<{
4528
4528
  id: z.ZodString;
4529
4529
  }, z.core.$strip>], "kind">;
4530
4530
  kind: z.ZodEnum<{
4531
- approval: "approval";
4532
4531
  triggers: "triggers";
4533
4532
  uses: "uses";
4533
+ approval: "approval";
4534
4534
  }>;
4535
4535
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
4536
4536
  kind: z.ZodLiteral<"system">;
@@ -997,9 +997,9 @@ declare const OrganizationModelSchema: z.ZodObject<{
997
997
  id: z.ZodString;
998
998
  }, z.core.$strip>], "kind">;
999
999
  kind: z.ZodEnum<{
1000
- approval: "approval";
1001
1000
  triggers: "triggers";
1002
1001
  uses: "uses";
1002
+ approval: "approval";
1003
1003
  }>;
1004
1004
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
1005
1005
  kind: z.ZodLiteral<"system">;
@@ -2238,9 +2238,9 @@ declare const OmTopologyNodeKindSchema: z.ZodEnum<{
2238
2238
  externalResource: "externalResource";
2239
2239
  }>;
2240
2240
  declare const OmTopologyRelationshipKindSchema: z.ZodEnum<{
2241
- approval: "approval";
2242
2241
  triggers: "triggers";
2243
2242
  uses: "uses";
2243
+ approval: "approval";
2244
2244
  }>;
2245
2245
  declare const OmTopologyNodeRefSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2246
2246
  kind: z.ZodLiteral<"system">;
@@ -2295,9 +2295,9 @@ declare const OmTopologyRelationshipSchema: z.ZodObject<{
2295
2295
  id: z.ZodString;
2296
2296
  }, z.core.$strip>], "kind">;
2297
2297
  kind: z.ZodEnum<{
2298
- approval: "approval";
2299
2298
  triggers: "triggers";
2300
2299
  uses: "uses";
2300
+ approval: "approval";
2301
2301
  }>;
2302
2302
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
2303
2303
  kind: z.ZodLiteral<"system">;
@@ -2357,9 +2357,9 @@ declare const OmTopologyDomainSchema: z.ZodDefault<z.ZodObject<{
2357
2357
  id: z.ZodString;
2358
2358
  }, z.core.$strip>], "kind">;
2359
2359
  kind: z.ZodEnum<{
2360
- approval: "approval";
2361
2360
  triggers: "triggers";
2362
2361
  uses: "uses";
2362
+ approval: "approval";
2363
2363
  }>;
2364
2364
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
2365
2365
  kind: z.ZodLiteral<"system">;
@@ -2634,7 +2634,7 @@ declare const topologyRelationship: {
2634
2634
  kind: "externalResource";
2635
2635
  id: string;
2636
2636
  };
2637
- kind: "approval" | "triggers" | "uses";
2637
+ kind: "triggers" | "uses" | "approval";
2638
2638
  to: {
2639
2639
  kind: "system";
2640
2640
  id: string;
@@ -2690,7 +2690,7 @@ declare const topologyRelationship: {
2690
2690
  kind: "externalResource";
2691
2691
  id: string;
2692
2692
  };
2693
- kind: "approval" | "triggers" | "uses";
2693
+ kind: "triggers" | "uses" | "approval";
2694
2694
  to: {
2695
2695
  kind: "system";
2696
2696
  id: string;
@@ -2746,7 +2746,7 @@ declare const topologyRelationship: {
2746
2746
  kind: "externalResource";
2747
2747
  id: string;
2748
2748
  };
2749
- kind: "approval" | "triggers" | "uses";
2749
+ kind: "triggers" | "uses" | "approval";
2750
2750
  to: {
2751
2751
  kind: "system";
2752
2752
  id: string;
@@ -2802,7 +2802,7 @@ declare const topologyRelationship: {
2802
2802
  kind: "externalResource";
2803
2803
  id: string;
2804
2804
  };
2805
- kind: "approval" | "triggers" | "uses";
2805
+ kind: "triggers" | "uses" | "approval";
2806
2806
  to: {
2807
2807
  kind: "system";
2808
2808
  id: string;
@@ -2858,7 +2858,7 @@ declare const topologyRelationship: {
2858
2858
  kind: "externalResource";
2859
2859
  id: string;
2860
2860
  };
2861
- kind: "approval" | "triggers" | "uses";
2861
+ kind: "triggers" | "uses" | "approval";
2862
2862
  to: {
2863
2863
  kind: "system";
2864
2864
  id: string;
@@ -2914,7 +2914,7 @@ declare const topologyRelationship: {
2914
2914
  kind: "externalResource";
2915
2915
  id: string;
2916
2916
  };
2917
- kind: "approval" | "triggers" | "uses";
2917
+ kind: "triggers" | "uses" | "approval";
2918
2918
  to: {
2919
2919
  kind: "system";
2920
2920
  id: string;
@@ -3672,7 +3672,6 @@ declare function scaffoldOrganizationModel(model: OrganizationModel, spec: OmSca
3672
3672
  declare const LinkSchema: z.ZodObject<{
3673
3673
  nodeId: z.ZodString;
3674
3674
  kind: z.ZodEnum<{
3675
- approval: "approval";
3676
3675
  affects: "affects";
3677
3676
  actions: "actions";
3678
3677
  effects: "effects";
@@ -3682,6 +3681,7 @@ declare const LinkSchema: z.ZodObject<{
3682
3681
  emits: "emits";
3683
3682
  triggers: "triggers";
3684
3683
  uses: "uses";
3684
+ approval: "approval";
3685
3685
  contains: "contains";
3686
3686
  references: "references";
3687
3687
  maps_to: "maps_to";
@@ -4528,9 +4528,9 @@ declare const OrganizationModelSchema: z.ZodObject<{
4528
4528
  id: z.ZodString;
4529
4529
  }, z.core.$strip>], "kind">;
4530
4530
  kind: z.ZodEnum<{
4531
- approval: "approval";
4532
4531
  triggers: "triggers";
4533
4532
  uses: "uses";
4533
+ approval: "approval";
4534
4534
  }>;
4535
4535
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
4536
4536
  kind: z.ZodLiteral<"system">;
@@ -2786,6 +2786,7 @@ type Database = {
2786
2786
  title: string | null;
2787
2787
  updated_at: string;
2788
2788
  user_id: string;
2789
+ visibility: string;
2789
2790
  };
2790
2791
  Insert: {
2791
2792
  content: string;
@@ -2800,6 +2801,7 @@ type Database = {
2800
2801
  title?: string | null;
2801
2802
  updated_at?: string;
2802
2803
  user_id: string;
2804
+ visibility?: string;
2803
2805
  };
2804
2806
  Update: {
2805
2807
  content?: string;
@@ -2814,6 +2816,7 @@ type Database = {
2814
2816
  title?: string | null;
2815
2817
  updated_at?: string;
2816
2818
  user_id?: string;
2819
+ visibility?: string;
2817
2820
  };
2818
2821
  Relationships: [
2819
2822
  {
@@ -4398,9 +4401,9 @@ declare const OrganizationModelSchema: z.ZodObject<{
4398
4401
  id: z.ZodString;
4399
4402
  }, z.core.$strip>], "kind">;
4400
4403
  kind: z.ZodEnum<{
4401
- approval: "approval";
4402
4404
  triggers: "triggers";
4403
4405
  uses: "uses";
4406
+ approval: "approval";
4404
4407
  }>;
4405
4408
  to: z.ZodDiscriminatedUnion<[z.ZodObject<{
4406
4409
  kind: z.ZodLiteral<"system">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/core",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "license": "MIT",
5
5
  "description": "Minimal shared constants across Elevasis monorepo",
6
6
  "sideEffects": false,
@@ -41,8 +41,8 @@
41
41
  "rollup-plugin-dts": "^6.3.0",
42
42
  "tsup": "^8.0.0",
43
43
  "typescript": "5.9.2",
44
- "@repo/typescript-config": "0.0.0",
45
- "@repo/eslint-config": "0.0.0"
44
+ "@repo/eslint-config": "0.0.0",
45
+ "@repo/typescript-config": "0.0.0"
46
46
  },
47
47
  "dependencies": {
48
48
  "@anthropic-ai/sdk": "^0.62.0",
@@ -44,6 +44,7 @@ import {
44
44
  ListReadQuerySchema,
45
45
  ListRecordsQuerySchema,
46
46
  ListStatusSchema,
47
+ PipelineConfigSchema,
47
48
  PipelineStageSchema,
48
49
  ScrapingConfigSchema,
49
50
  TransitionDealStateRequestSchema,
@@ -54,7 +55,7 @@ import {
54
55
  UpdateListRequestSchema,
55
56
  UpdateListStatusRequestSchema
56
57
  } from './api-schemas'
57
- import { createBuildPlanSnapshotFromTemplateId } from './build-templates'
58
+ import { createBuildPlanSnapshotFromTemplate } from './build-templates'
58
59
  import {
59
60
  compileBusinessOntologyValidationIndex,
60
61
  CRM_PIPELINE_CATALOG_ONTOLOGY_ID,
@@ -1168,17 +1169,32 @@ describe('PipelineStageSchema', () => {
1168
1169
  // ---------------------------------------------------------------------------
1169
1170
 
1170
1171
  describe('BuildPlanSnapshotSchema', () => {
1171
- const validSnapshot = createBuildPlanSnapshotFromTemplateId('dtc-subscription-apollo-clickup')
1172
+ const validSnapshot = createBuildPlanSnapshotFromTemplate({
1173
+ id: 'tenant-template',
1174
+ label: 'Tenant Template',
1175
+ steps: [
1176
+ {
1177
+ id: 'source-companies',
1178
+ label: 'Companies found',
1179
+ primaryEntity: 'company',
1180
+ outputs: ['company'],
1181
+ stageKey: 'populated',
1182
+ dependencyMode: 'per-record-eligibility',
1183
+ actionKey: 'lead-gen.company.source',
1184
+ defaultBatchSize: 100,
1185
+ maxBatchSize: 250
1186
+ }
1187
+ ]
1188
+ })
1172
1189
 
1173
1190
  it('accepts a snapshot generated from a prospecting build template', () => {
1174
- expect(validSnapshot).not.toBeNull()
1175
1191
  expect(BuildPlanSnapshotSchema.safeParse(validSnapshot).success).toBe(true)
1176
1192
  })
1177
1193
 
1178
1194
  it('accepts custom non-empty step stage keys at the transport boundary', () => {
1179
1195
  const result = BuildPlanSnapshotSchema.safeParse({
1180
1196
  ...validSnapshot,
1181
- steps: [{ ...validSnapshot!.steps[0], stageKey: 'made-up-stage' }]
1197
+ steps: [{ ...validSnapshot.steps[0], stageKey: 'made-up-stage' }]
1182
1198
  })
1183
1199
 
1184
1200
  expect(result.success).toBe(true)
@@ -1187,7 +1203,7 @@ describe('BuildPlanSnapshotSchema', () => {
1187
1203
  it('accepts custom non-empty action keys at the transport boundary', () => {
1188
1204
  const result = BuildPlanSnapshotSchema.safeParse({
1189
1205
  ...validSnapshot,
1190
- steps: [{ ...validSnapshot!.steps[0], actionKey: 'lead-gen.missing.action' }]
1206
+ steps: [{ ...validSnapshot.steps[0], actionKey: 'lead-gen.missing.action' }]
1191
1207
  })
1192
1208
 
1193
1209
  expect(result.success).toBe(true)
@@ -1293,8 +1309,8 @@ describe('CreateListRequestSchema', () => {
1293
1309
  expect(result.success).toBe(true)
1294
1310
  })
1295
1311
 
1296
- it('rejects an unknown prospecting build template id', () => {
1297
- expect(CreateListRequestSchema.safeParse({ name: 'X', buildTemplateId: 'not-a-template' }).success).toBe(false)
1312
+ it('accepts tenant-owned build template ids for API-layer membership validation', () => {
1313
+ expect(CreateListRequestSchema.safeParse({ name: 'X', buildTemplateId: 'not-a-template' }).success).toBe(true)
1298
1314
  })
1299
1315
 
1300
1316
  it('rejects an invalid status', () => {
@@ -1311,10 +1327,20 @@ describe('CreateListRequestSchema', () => {
1311
1327
  name: 'SaaS List',
1312
1328
  scrapingConfig: { vertical: 'SaaS' },
1313
1329
  icp: { minReviewCount: 5 },
1314
- pipelineConfig: { stages: [] }
1330
+ pipelineConfig: { stages: [], dataMode: 'mock' }
1315
1331
  }).success
1316
1332
  ).toBe(true)
1317
1333
  })
1334
+
1335
+ it('accepts create-time list-wide pipeline dataMode', () => {
1336
+ const result = CreateListRequestSchema.safeParse({
1337
+ name: 'DTC Demo',
1338
+ pipelineConfig: { dataMode: 'mock' }
1339
+ })
1340
+
1341
+ expect(result.success).toBe(true)
1342
+ if (result.success) expect(result.data.pipelineConfig?.dataMode).toBe('mock')
1343
+ })
1318
1344
  })
1319
1345
 
1320
1346
  // ---------------------------------------------------------------------------
@@ -1404,11 +1430,36 @@ describe('UpdateListConfigRequestSchema', () => {
1404
1430
  expect(UpdateListConfigRequestSchema.safeParse({ pipelineConfig: { stages: [] } }).success).toBe(true)
1405
1431
  })
1406
1432
 
1433
+ it('accepts a data-mode-only pipelineConfig patch', () => {
1434
+ const result = UpdateListConfigRequestSchema.safeParse({ pipelineConfig: { dataMode: 'live' } })
1435
+
1436
+ expect(result.success).toBe(true)
1437
+ if (result.success) expect(result.data.pipelineConfig?.dataMode).toBe('live')
1438
+ })
1439
+
1440
+ it('rejects invalid pipelineConfig dataMode values', () => {
1441
+ expect(UpdateListConfigRequestSchema.safeParse({ pipelineConfig: { dataMode: 'demo' } }).success).toBe(false)
1442
+ })
1443
+
1407
1444
  it('rejects unknown fields (strict mode)', () => {
1408
1445
  expect(UpdateListConfigRequestSchema.safeParse({ scrapingConfig: {}, bogus: true }).success).toBe(false)
1409
1446
  })
1410
1447
  })
1411
1448
 
1449
+ // ---------------------------------------------------------------------------
1450
+ // PipelineConfigSchema
1451
+ // ---------------------------------------------------------------------------
1452
+
1453
+ describe('PipelineConfigSchema', () => {
1454
+ it.each(['mock', 'live'])('accepts list-wide dataMode "%s"', (dataMode) => {
1455
+ expect(PipelineConfigSchema.safeParse({ dataMode }).success).toBe(true)
1456
+ })
1457
+
1458
+ it('keeps dataMode optional for legacy stored configs', () => {
1459
+ expect(PipelineConfigSchema.safeParse({ stages: [{ key: 'populated' }] }).success).toBe(true)
1460
+ })
1461
+ })
1462
+
1412
1463
  // ---------------------------------------------------------------------------
1413
1464
  // AddCompaniesToListRequestSchema / AddContactsToListRequestSchema
1414
1465
  // ---------------------------------------------------------------------------
@@ -1,7 +1,6 @@
1
1
  import { z } from 'zod'
2
2
  import { UuidSchema, NonEmptyStringSchema } from '../../platform/utils/validation'
3
3
  import { CredentialRequirementSchema, RecordColumnConfigSchema } from '../../organization-model/domains/prospecting'
4
- import { isProspectingBuildTemplateId } from './build-templates'
5
4
  export { CrmPriorityBucketKeySchema, CrmPriorityBucketOverrideSchema, CrmPriorityOverrideSchema } from './crm-priority'
6
5
  export type { CrmPriorityBucketOverride, CrmPriorityOverride, ResolvedCrmPriorityRuleConfig } from './crm-priority'
7
6
 
@@ -508,12 +507,15 @@ export const PipelineStageSchema = z.object({
508
507
  order: z.number().int().optional()
509
508
  })
510
509
 
510
+ export const DataModeSchema = z.enum(['mock', 'live'])
511
+
511
512
  /**
512
513
  * Pipeline presentation contract stored in `acq_lists.pipeline_config` jsonb.
513
514
  * `stages[].key` validates against the catalog; the rest is presentation only.
514
515
  */
515
516
  export const PipelineConfigSchema = z.object({
516
- stages: z.array(PipelineStageSchema).optional()
517
+ stages: z.array(PipelineStageSchema).optional(),
518
+ dataMode: DataModeSchema.optional()
517
519
  })
518
520
 
519
521
  export const BuildPlanSnapshotStepSchema = z
@@ -584,9 +586,10 @@ export const AcqListMetadataSchema = z
584
586
  })
585
587
  .catchall(z.unknown())
586
588
 
587
- export const ProspectingBuildTemplateIdSchema = z.string().trim().min(1).max(100).refine(isProspectingBuildTemplateId, {
588
- message: 'buildTemplateId must match a known prospecting build template'
589
- })
589
+ // Build-template IDs are tenant-owned OM catalog entries. Published core only
590
+ // validates the transport shape; API/services validate membership against the
591
+ // tenant's resolved Organization Model before creating or changing snapshots.
592
+ export const ProspectingBuildTemplateIdSchema = z.string().trim().min(1).max(100)
590
593
 
591
594
  // ---------------------------------------------------------------------------
592
595
  // List telemetry / progress schemas
@@ -1360,6 +1363,7 @@ export const AcqListSchemas = {
1360
1363
  ScrapingConfig: ScrapingConfigSchema,
1361
1364
  IcpRubric: IcpRubricSchema,
1362
1365
  PipelineConfig: PipelineConfigSchema,
1366
+ DataMode: DataModeSchema,
1363
1367
  PipelineStage: PipelineStageSchema,
1364
1368
  BuildPlanSnapshot: BuildPlanSnapshotSchema,
1365
1369
  BuildPlanSnapshotStep: BuildPlanSnapshotStepSchema,
@@ -1459,6 +1463,7 @@ export type ListStatus = z.infer<typeof ListStatusSchema>
1459
1463
  export type ScrapingConfig = z.infer<typeof ScrapingConfigSchema>
1460
1464
  export type IcpRubric = z.infer<typeof IcpRubricSchema>
1461
1465
  export type PipelineStage = z.infer<typeof PipelineStageSchema>
1466
+ export type DataMode = z.infer<typeof DataModeSchema>
1462
1467
  export type PipelineConfig = z.infer<typeof PipelineConfigSchema>
1463
1468
  export type BuildPlanSnapshotStep = z.infer<typeof BuildPlanSnapshotStepSchema>
1464
1469
  export type BuildPlanSnapshot = z.infer<typeof BuildPlanSnapshotSchema>