clivly 0.9.0 → 0.9.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.
Files changed (93) hide show
  1. package/core-drizzle.d.cts +1 -1
  2. package/core-drizzle.d.mts +1 -1
  3. package/core-entity-config.cjs +2 -1
  4. package/core-entity-config.d.cts +2 -2
  5. package/core-entity-config.d.mts +2 -2
  6. package/core-entity-config.mjs +2 -2
  7. package/core-entity-heuristics.d.cts +1 -1
  8. package/core-entity-heuristics.d.mts +1 -1
  9. package/core-mapping-form.d.cts +1 -1
  10. package/core-mapping-form.d.mts +1 -1
  11. package/core-mappings-config.cjs +1 -1
  12. package/core-mappings-config.d.cts +1 -1
  13. package/core-mappings-config.d.mts +1 -1
  14. package/core-mappings-config.mjs +1 -1
  15. package/core-sync-engine.cjs +1 -1
  16. package/core-sync-engine.d.cts +1 -1
  17. package/core-sync-engine.d.mts +1 -1
  18. package/core-sync-engine.mjs +1 -1
  19. package/core-view-compiler.cjs +2 -1
  20. package/core-view-compiler.d.cts +2 -2
  21. package/core-view-compiler.d.mts +2 -2
  22. package/core-view-compiler.mjs +2 -2
  23. package/core.cjs +5 -5
  24. package/core.d.cts +6 -6
  25. package/core.d.mts +6 -6
  26. package/core.mjs +5 -5
  27. package/{drizzle-BhN5M9zt.d.cts → drizzle-DooDUGqO.d.mts} +1 -1
  28. package/{drizzle-kBULBAOa.d.mts → drizzle-jz0lrAgl.d.cts} +1 -1
  29. package/drizzle.d.cts +2 -2
  30. package/drizzle.d.mts +2 -2
  31. package/{entity-config-D3LmzgLb.mjs → entity-config-D08zAeFY.mjs} +47 -2
  32. package/{entity-config-C4Yf_fPj.d.cts → entity-config-fKQhimtD.d.cts} +144 -2
  33. package/{entity-config-C4Yf_fPj.d.mts → entity-config-fKQhimtD.d.mts} +144 -2
  34. package/{entity-config-CsLl-ftC.cjs → entity-config-nuXge6rY.cjs} +52 -1
  35. package/index.cjs +5 -3
  36. package/index.mjs +5 -3
  37. package/{internal-DMySVbM0.mjs → internal-BGVUG312.mjs} +1 -1
  38. package/{internal-MBkNo3bw.d.mts → internal-BLCK81kB.d.mts} +1 -2
  39. package/{internal-B8ydhsKd.d.cts → internal-C-YBW2DB.d.cts} +1 -2
  40. package/{internal-BARjyN4n.cjs → internal-D4HDi2GC.cjs} +1 -1
  41. package/internal-drizzle.d.cts +1 -1
  42. package/internal-drizzle.d.mts +1 -1
  43. package/internal-entity-config.cjs +2 -1
  44. package/internal-entity-config.d.cts +2 -2
  45. package/internal-entity-config.d.mts +2 -2
  46. package/internal-entity-config.mjs +2 -2
  47. package/internal-entity-heuristics.cjs +1 -1
  48. package/internal-entity-heuristics.d.cts +1 -1
  49. package/internal-entity-heuristics.d.mts +1 -1
  50. package/internal-entity-heuristics.mjs +1 -1
  51. package/internal-mapping-form.d.cts +1 -1
  52. package/internal-mapping-form.d.mts +1 -1
  53. package/internal-mappings-config.cjs +1 -1
  54. package/internal-mappings-config.d.cts +1 -1
  55. package/internal-mappings-config.d.mts +1 -1
  56. package/internal-mappings-config.mjs +1 -1
  57. package/internal-sync-engine.cjs +1 -1
  58. package/internal-sync-engine.d.cts +1 -1
  59. package/internal-sync-engine.d.mts +1 -1
  60. package/internal-sync-engine.mjs +1 -1
  61. package/internal-view-compiler.cjs +2 -1
  62. package/internal-view-compiler.d.cts +2 -2
  63. package/internal-view-compiler.d.mts +2 -2
  64. package/internal-view-compiler.mjs +2 -2
  65. package/internal.cjs +5 -5
  66. package/internal.d.cts +6 -6
  67. package/internal.d.mts +6 -6
  68. package/internal.mjs +5 -5
  69. package/{mapping-form-43bwOTat.d.cts → mapping-form-DhY0iFmN.d.cts} +1 -1
  70. package/{mapping-form-DUvWUYCo.d.mts → mapping-form-Du36VZr1.d.mts} +1 -1
  71. package/mappings-config-B1qNM8VL.d.cts +47 -0
  72. package/mappings-config-BChZsany.d.mts +47 -0
  73. package/{mappings-config-BSSwdHiq.cjs → mappings-config-C8ynKmDK.cjs} +1 -1
  74. package/{mappings-config-bJQT_gSa.mjs → mappings-config-DNaYGyKN.mjs} +1 -1
  75. package/{namespace-probe-BSH_p9TK.d.cts → namespace-probe-BkUs8raG.d.mts} +1 -1
  76. package/{namespace-probe-Dsp5uNkS.d.mts → namespace-probe-aRFmpU85.d.cts} +1 -1
  77. package/package.json +1 -1
  78. package/sdk.cjs +1 -1
  79. package/sdk.d.cts +2 -2
  80. package/sdk.d.mts +2 -2
  81. package/sdk.mjs +1 -1
  82. package/{sync-engine-GNqRB8eS.d.cts → sync-engine-DHQ7rXZe.d.mts} +2 -2
  83. package/{sync-engine-ZsusW-q_.d.mts → sync-engine-DiPjH53O.d.cts} +2 -2
  84. package/{sync-engine-Bg6-SznL.mjs → sync-engine-SuxSzbZ4.mjs} +1 -1
  85. package/{sync-engine-DEJvKw6E.cjs → sync-engine-abE94g6X.cjs} +1 -1
  86. package/{view-compiler-DplczSjF.cjs → view-compiler-Blu4OXJ7.cjs} +22 -0
  87. package/{view-compiler-DlTpOfZi.mjs → view-compiler-CQx8TRrW.mjs} +17 -1
  88. package/{view-compiler-Cin0neDO.d.mts → view-compiler-CcUwzZut.d.mts} +12 -2
  89. package/{view-compiler-Ll9cbIJz.d.cts → view-compiler-DqAdVxLq.d.cts} +12 -2
  90. package/vite.d.cts +1 -1
  91. package/vite.d.mts +1 -1
  92. package/mappings-config-BpcR8bBo.d.mts +0 -167
  93. package/mappings-config-xsLMn3I-.d.cts +0 -167
@@ -1,167 +0,0 @@
1
- import { A as ZodRecord, D as ZodLiteral, E as ZodEnum, M as ZodUnion, N as output, O as ZodObject, P as $strict, T as ZodArray, a as ClivlyEntitiesConfig, j as ZodString, k as ZodOptional } from "./entity-config-C4Yf_fPj.cjs";
2
- //#region ../core/src/projection.d.ts
3
- /**
4
- * Projection-backed custom mappings — one custom object derived from a base
5
- * table plus explicit joins.
6
- *
7
- * A projection is deliberately narrow: equality joins only, direct column
8
- * bindings only, no expressions and no aggregation. Everything a user can
9
- * express here compiles to a single read-only view whose `id` column is
10
- * provably unique per row, which is what lets the sync engine consume it
11
- * unchanged.
12
- *
13
- * Refs address tables symbolically: `"base"` for the base table, or a join's
14
- * `key`. Raw table names are never accepted in a ref, so a projection can
15
- * never reach a table it did not declare.
16
- */
17
- /** The reserved ref name for the projection's base table. */
18
- declare const BASE_REF = "base";
19
- declare const projectionRefSchema: ZodObject<{
20
- table: ZodString;
21
- column: ZodString;
22
- }, $strict>;
23
- type ProjectionRef = output<typeof projectionRefSchema>;
24
- declare const projectionJoinSchema: ZodObject<{
25
- key: ZodString;
26
- table: ZodString;
27
- type: ZodEnum<{
28
- inner: "inner";
29
- left: "left";
30
- }>;
31
- on: ZodArray<ZodObject<{
32
- left: ZodObject<{
33
- table: ZodString;
34
- column: ZodString;
35
- }, $strict>;
36
- op: ZodLiteral<"eq">;
37
- right: ZodObject<{
38
- table: ZodString;
39
- column: ZodString;
40
- }, $strict>;
41
- }, $strict>>;
42
- }, $strict>;
43
- type ProjectionJoin = output<typeof projectionJoinSchema>;
44
- declare const projectionFieldBindingSchema: ZodObject<{
45
- from: ZodObject<{
46
- table: ZodString;
47
- column: ZodString;
48
- }, $strict>;
49
- }, $strict>;
50
- type ProjectionFieldBinding = output<typeof projectionFieldBindingSchema>;
51
- declare const projectionIdentitySchema: ZodUnion<readonly [ZodObject<{
52
- kind: ZodLiteral<"base_pk">;
53
- column: ZodOptional<ZodString>;
54
- }, $strict>, ZodObject<{
55
- kind: ZodLiteral<"column">;
56
- from: ZodObject<{
57
- table: ZodString;
58
- column: ZodString;
59
- }, $strict>;
60
- }, $strict>, ZodObject<{
61
- kind: ZodLiteral<"composite">;
62
- parts: ZodArray<ZodObject<{
63
- table: ZodString;
64
- column: ZodString;
65
- }, $strict>>;
66
- }, $strict>]>;
67
- type ProjectionIdentity = output<typeof projectionIdentitySchema>;
68
- declare const projectionSchema: ZodObject<{
69
- version: ZodLiteral<1>;
70
- kind: ZodLiteral<"projection">;
71
- entityKey: ZodString;
72
- baseTable: ZodString;
73
- joins: ZodArray<ZodObject<{
74
- key: ZodString;
75
- table: ZodString;
76
- type: ZodEnum<{
77
- inner: "inner";
78
- left: "left";
79
- }>;
80
- on: ZodArray<ZodObject<{
81
- left: ZodObject<{
82
- table: ZodString;
83
- column: ZodString;
84
- }, $strict>;
85
- op: ZodLiteral<"eq">;
86
- right: ZodObject<{
87
- table: ZodString;
88
- column: ZodString;
89
- }, $strict>;
90
- }, $strict>>;
91
- }, $strict>>;
92
- fieldBindings: ZodRecord<ZodString, ZodObject<{
93
- from: ZodObject<{
94
- table: ZodString;
95
- column: ZodString;
96
- }, $strict>;
97
- }, $strict>>;
98
- identity: ZodUnion<readonly [ZodObject<{
99
- kind: ZodLiteral<"base_pk">;
100
- column: ZodOptional<ZodString>;
101
- }, $strict>, ZodObject<{
102
- kind: ZodLiteral<"column">;
103
- from: ZodObject<{
104
- table: ZodString;
105
- column: ZodString;
106
- }, $strict>;
107
- }, $strict>, ZodObject<{
108
- kind: ZodLiteral<"composite">;
109
- parts: ZodArray<ZodObject<{
110
- table: ZodString;
111
- column: ZodString;
112
- }, $strict>>;
113
- }, $strict>]>;
114
- }, $strict>;
115
- type ProjectionMapping = output<typeof projectionSchema>;
116
- /**
117
- * Every column ref an identity depends on. `basePkColumn` is the base table's
118
- * discovered PK, used only when a `base_pk` identity omits an explicit column.
119
- */
120
- declare function identityRefs(identity: ProjectionIdentity, basePkColumn: string): ProjectionRef[];
121
- //#endregion
122
- //#region ../core/src/mappings-config.d.ts
123
- /**
124
- * Mappings → Entity Config bridge.
125
- *
126
- * `crm_entity_mappings` rows are the single source of truth for how a host
127
- * schema maps onto Clivly's CRM concepts. This module compiles those rows into
128
- * a `ClivlyEntitiesConfig` — the contract the view compiler and sync engine
129
- * consume — so the persisted mapping and the runtime pipeline never diverge.
130
- *
131
- * The row model has no explicit entity-key column (it's keyed by
132
- * `sourceTable + targetConcept + role`), but the config's `relationships`
133
- * reference other entities *by key*. This builder therefore derives a stable
134
- * key per row and resolves each relationship's `entity` reference through the
135
- * same derivation — so a relationship stored as `entity: "<relatedTable>"`
136
- * (the shape `mappings.suggest` produces) resolves to the right entity.
137
- */
138
- /**
139
- * A persisted `crm_entity_mappings` row, narrowed to the columns the builder
140
- * reads. Structurally compatible with the Drizzle row (jsonb columns typed
141
- * loosely) so the API layer can pass `db.select()` results straight in.
142
- */
143
- interface EntityMappingRow {
144
- fieldMap: Record<string, string>;
145
- filter?: Record<string, unknown> | null;
146
- /**
147
- * Advanced mapping: a base table plus explicit joins. When set, this — not
148
- * `fieldMap` — is the authored source of truth, and `sourceTable` merely
149
- * mirrors `projection.baseTable`.
150
- */
151
- projection?: ProjectionMapping | null;
152
- relationships?: Record<string, unknown> | null;
153
- role?: string | null;
154
- sourceTable: string;
155
- status?: string | null;
156
- targetConcept: string;
157
- targetObjectTypeId?: string | null;
158
- }
159
- /**
160
- * Compile persisted mapping rows into a `ClivlyEntitiesConfig`. Only `active`
161
- * rows with at least one mapped field are included; disabled/suggested rows and
162
- * unmapped rows are skipped. Returns `{ entities: {} }` when nothing is
163
- * eligible — a no-op the view compiler and sync engine both tolerate.
164
- */
165
- declare function mappingsToEntitiesConfig(rows: EntityMappingRow[]): ClivlyEntitiesConfig;
166
- //#endregion
167
- export { ProjectionIdentity as a, ProjectionRef as c, ProjectionFieldBinding as i, identityRefs as l, mappingsToEntitiesConfig as n, ProjectionJoin as o, BASE_REF as r, ProjectionMapping as s, EntityMappingRow as t, projectionSchema as u };