@clivly/core 0.9.7 → 0.10.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.
Files changed (48) hide show
  1. package/README.md +17 -10
  2. package/dist/builder.cjs +599 -0
  3. package/dist/builder.d.cts +336 -0
  4. package/dist/builder.d.mts +336 -0
  5. package/dist/builder.mjs +589 -0
  6. package/dist/drizzle.d.cts +1 -1
  7. package/dist/drizzle.d.mts +1 -1
  8. package/dist/{entity-config-25v_udeY.cjs → entity-config-C5jBmG2C.cjs} +83 -68
  9. package/dist/{entity-config-buOIVtMM.d.cts → entity-config-DCa785OE.d.cts} +27 -1
  10. package/dist/{entity-config-buOIVtMM.d.mts → entity-config-DCa785OE.d.mts} +27 -1
  11. package/dist/{entity-config-DwGXbUo_.mjs → entity-config-DpHPMFIS.mjs} +71 -38
  12. package/dist/entity-config.cjs +1 -1
  13. package/dist/entity-config.d.cts +1 -1
  14. package/dist/entity-config.d.mts +1 -1
  15. package/dist/entity-config.mjs +1 -1
  16. package/dist/entity-heuristics.cjs +34 -1
  17. package/dist/entity-heuristics.d.cts +8 -2
  18. package/dist/entity-heuristics.d.mts +8 -2
  19. package/dist/entity-heuristics.mjs +34 -2
  20. package/dist/index.cjs +136 -199
  21. package/dist/index.d.cts +135 -89
  22. package/dist/index.d.mts +135 -89
  23. package/dist/index.mjs +124 -188
  24. package/dist/mapping-form.d.cts +1 -1
  25. package/dist/mapping-form.d.mts +1 -1
  26. package/dist/mappings-config.cjs +2 -16
  27. package/dist/mappings-config.d.cts +1 -1
  28. package/dist/mappings-config.d.mts +1 -1
  29. package/dist/mappings-config.mjs +1 -15
  30. package/dist/{projection-OJYCYmS_.cjs → projection-DFgCoyZl.cjs} +0 -6
  31. package/dist/{projection-BXw_iiw5.mjs → projection-SCNrLJMV.mjs} +1 -1
  32. package/dist/schema-meta-Ac7938mT.mjs +46 -0
  33. package/dist/schema-meta-Cgi0MnHh.cjs +69 -0
  34. package/dist/sync-engine.cjs +1 -1
  35. package/dist/sync-engine.d.cts +1 -1
  36. package/dist/sync-engine.d.mts +1 -1
  37. package/dist/sync-engine.mjs +1 -1
  38. package/dist/types.cjs +11 -0
  39. package/dist/types.d.cts +28 -2
  40. package/dist/types.d.mts +28 -2
  41. package/dist/types.mjs +9 -1
  42. package/dist/{view-compiler-u3GGRgnv.mjs → view-compiler-CLvZ0wJW.mjs} +1 -1
  43. package/dist/{view-compiler-D30HNRnA.cjs → view-compiler-DP4Fbj7-.cjs} +1 -1
  44. package/dist/view-compiler.cjs +1 -1
  45. package/dist/view-compiler.d.cts +1 -1
  46. package/dist/view-compiler.d.mts +1 -1
  47. package/dist/view-compiler.mjs +1 -1
  48. package/package.json +11 -1
package/dist/types.d.cts CHANGED
@@ -1,6 +1,31 @@
1
1
  //#region src/types.d.ts
2
2
  type ContactStatus = "lead" | "active" | "customer" | "churned";
3
- type DealStage = "lead" | "qualified" | "proposal" | "negotiation" | "won" | "lost";
3
+ type DealStage = string;
4
+ type StageType = "open" | "won" | "lost";
5
+ type PipelineKind = "standard" | "recurring";
6
+ type ValueInterval = "one_time" | "monthly" | "annual";
7
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
8
+ declare const OPEN_STAGE_TYPE: "open";
9
+ /** A closed deal is a historical fact: automation never reopens one. */
10
+ declare function isClosedStageType(type: StageType): boolean;
11
+ interface PipelineStageConfig {
12
+ color: string | null;
13
+ id: string;
14
+ key: DealStage;
15
+ label: string;
16
+ position: number;
17
+ type: StageType;
18
+ valueFixed: number | null;
19
+ }
20
+ interface PipelineConfig {
21
+ id: string;
22
+ isDefault: boolean;
23
+ kind: PipelineKind;
24
+ name: string;
25
+ slug: string;
26
+ sourceMappingId: string | null;
27
+ stages: PipelineStageConfig[];
28
+ }
4
29
  type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
5
30
  type TaskPriority = "low" | "medium" | "high";
6
31
  type TaskEntityType = "contact" | "company" | "deal";
@@ -103,6 +128,7 @@ interface CreateDealInput {
103
128
  contactId?: string;
104
129
  name: string;
105
130
  owner?: string;
131
+ pipelineId?: string;
106
132
  stage?: DealStage;
107
133
  value?: number;
108
134
  }
@@ -156,4 +182,4 @@ interface TaskFilters {
156
182
  status?: TaskStatus;
157
183
  }
158
184
  //#endregion
159
- export { Activity, ActivityType, Company, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, RecordSource, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateContactInput, UpdateDealInput, UpdateTaskInput };
185
+ export { Activity, ActivityType, Company, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, OPEN_STAGE_TYPE, PipelineConfig, PipelineKind, PipelineStageConfig, RecordSource, StageType, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType };
package/dist/types.d.mts CHANGED
@@ -1,6 +1,31 @@
1
1
  //#region src/types.d.ts
2
2
  type ContactStatus = "lead" | "active" | "customer" | "churned";
3
- type DealStage = "lead" | "qualified" | "proposal" | "negotiation" | "won" | "lost";
3
+ type DealStage = string;
4
+ type StageType = "open" | "won" | "lost";
5
+ type PipelineKind = "standard" | "recurring";
6
+ type ValueInterval = "one_time" | "monthly" | "annual";
7
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
8
+ declare const OPEN_STAGE_TYPE: "open";
9
+ /** A closed deal is a historical fact: automation never reopens one. */
10
+ declare function isClosedStageType(type: StageType): boolean;
11
+ interface PipelineStageConfig {
12
+ color: string | null;
13
+ id: string;
14
+ key: DealStage;
15
+ label: string;
16
+ position: number;
17
+ type: StageType;
18
+ valueFixed: number | null;
19
+ }
20
+ interface PipelineConfig {
21
+ id: string;
22
+ isDefault: boolean;
23
+ kind: PipelineKind;
24
+ name: string;
25
+ slug: string;
26
+ sourceMappingId: string | null;
27
+ stages: PipelineStageConfig[];
28
+ }
4
29
  type TaskStatus = "todo" | "in_progress" | "done" | "cancelled";
5
30
  type TaskPriority = "low" | "medium" | "high";
6
31
  type TaskEntityType = "contact" | "company" | "deal";
@@ -103,6 +128,7 @@ interface CreateDealInput {
103
128
  contactId?: string;
104
129
  name: string;
105
130
  owner?: string;
131
+ pipelineId?: string;
106
132
  stage?: DealStage;
107
133
  value?: number;
108
134
  }
@@ -156,4 +182,4 @@ interface TaskFilters {
156
182
  status?: TaskStatus;
157
183
  }
158
184
  //#endregion
159
- export { Activity, ActivityType, Company, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, RecordSource, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateContactInput, UpdateDealInput, UpdateTaskInput };
185
+ export { Activity, ActivityType, Company, Contact, ContactFilters, ContactStatus, CreateActivityInput, CreateCompanyInput, CreateContactInput, CreateDealInput, CreateTaskInput, CrmRole, Deal, DealStage, Note, OPEN_STAGE_TYPE, PipelineConfig, PipelineKind, PipelineStageConfig, RecordSource, StageType, Task, TaskEntityType, TaskFilters, TaskPriority, TaskStatus, UpdateContactInput, UpdateDealInput, UpdateTaskInput, ValueInterval, isClosedStageType };
package/dist/types.mjs CHANGED
@@ -1 +1,9 @@
1
- export {};
1
+ //#region src/types.ts
2
+ /** Named once so SQL predicates and UI fallbacks cannot drift apart. */
3
+ const OPEN_STAGE_TYPE = "open";
4
+ /** A closed deal is a historical fact: automation never reopens one. */
5
+ function isClosedStageType(type) {
6
+ return type === "won" || type === "lost";
7
+ }
8
+ //#endregion
9
+ export { OPEN_STAGE_TYPE, isClosedStageType };
@@ -1,4 +1,4 @@
1
- import { i as identityRefs, t as BASE_REF } from "./projection-BXw_iiw5.mjs";
1
+ import { r as identityRefs, t as BASE_REF } from "./projection-SCNrLJMV.mjs";
2
2
  //#region src/projection-sql.ts
3
3
  /**
4
4
  * SQL generation for projection-backed entities.
@@ -1,4 +1,4 @@
1
- const require_projection = require("./projection-OJYCYmS_.cjs");
1
+ const require_projection = require("./projection-DFgCoyZl.cjs");
2
2
  //#region src/projection-sql.ts
3
3
  /**
4
4
  * SQL generation for projection-backed entities.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_view_compiler = require("./view-compiler-D30HNRnA.cjs");
2
+ const require_view_compiler = require("./view-compiler-DP4Fbj7-.cjs");
3
3
  exports.DEFAULT_VIEW_PREFIX = require_view_compiler.DEFAULT_VIEW_PREFIX;
4
4
  exports.compileEntityView = require_view_compiler.compileEntityView;
5
5
  exports.compileEntityViews = require_view_compiler.compileEntityViews;
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-buOIVtMM.cjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-DCa785OE.cjs";
2
2
  //#region src/view-compiler.d.ts
3
3
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
4
  interface CompileOptions {
@@ -1,4 +1,4 @@
1
- import { a as ClivlyEntitiesConfig } from "./entity-config-buOIVtMM.mjs";
1
+ import { a as ClivlyEntitiesConfig } from "./entity-config-DCa785OE.mjs";
2
2
  //#region src/view-compiler.d.ts
3
3
  declare const DEFAULT_VIEW_PREFIX = "crm_src_";
4
4
  interface CompileOptions {
@@ -1,2 +1,2 @@
1
- import { a as explainViewExecutionError, i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-u3GGRgnv.mjs";
1
+ import { a as explainViewExecutionError, i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CLvZ0wJW.mjs";
2
2
  export { DEFAULT_VIEW_PREFIX, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/core",
3
- "version": "0.9.7",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "ORM/auth-agnostic CRM adapter contracts and shared domain types for Clivly.",
@@ -27,6 +27,16 @@
27
27
  "default": "./dist/adapter.cjs"
28
28
  }
29
29
  },
30
+ "./builder": {
31
+ "import": {
32
+ "types": "./dist/builder.d.mts",
33
+ "default": "./dist/builder.mjs"
34
+ },
35
+ "require": {
36
+ "types": "./dist/builder.d.cts",
37
+ "default": "./dist/builder.cjs"
38
+ }
39
+ },
30
40
  "./entity-heuristics": {
31
41
  "import": {
32
42
  "types": "./dist/entity-heuristics.d.mts",