clivly 0.9.1 → 0.9.3

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 (86) hide show
  1. package/README.md +79 -13
  2. package/core-drizzle.d.cts +1 -1
  3. package/core-drizzle.d.mts +1 -1
  4. package/core-entity-config.cjs +2 -1
  5. package/core-entity-config.d.cts +2 -2
  6. package/core-entity-config.d.mts +2 -2
  7. package/core-entity-config.mjs +2 -2
  8. package/core-entity-heuristics.d.cts +1 -1
  9. package/core-entity-heuristics.d.mts +1 -1
  10. package/core-mapping-form.d.cts +1 -1
  11. package/core-mapping-form.d.mts +1 -1
  12. package/core-mappings-config.cjs +2 -1
  13. package/core-mappings-config.d.cts +2 -2
  14. package/core-mappings-config.d.mts +2 -2
  15. package/core-mappings-config.mjs +2 -2
  16. package/core-sync-engine.d.cts +1 -1
  17. package/core-sync-engine.d.mts +1 -1
  18. package/core-view-compiler.d.cts +1 -1
  19. package/core-view-compiler.d.mts +1 -1
  20. package/core.cjs +3 -3
  21. package/core.d.cts +8 -7
  22. package/core.d.mts +8 -7
  23. package/core.mjs +3 -3
  24. package/{drizzle-DooDUGqO.d.mts → drizzle-CiK8MMEZ.d.mts} +1 -1
  25. package/{drizzle-jz0lrAgl.d.cts → drizzle-DEtRrqtc.d.cts} +1 -1
  26. package/drizzle.d.cts +2 -2
  27. package/drizzle.d.mts +2 -2
  28. package/{entity-config-fKQhimtD.d.mts → entity-config-B2RA53nw.d.cts} +25 -1
  29. package/{entity-config-fKQhimtD.d.cts → entity-config-B2RA53nw.d.mts} +25 -1
  30. package/{entity-config-nuXge6rY.cjs → entity-config-DtBsl2MQ.cjs} +36 -12
  31. package/{entity-config-D08zAeFY.mjs → entity-config-kUHri9yA.mjs} +31 -13
  32. package/index.cjs +452 -38
  33. package/index.d.cts +3 -1
  34. package/index.d.mts +3 -1
  35. package/index.mjs +452 -39
  36. package/integration-state-BK-riZnm.d.cts +130 -0
  37. package/integration-state-BK-riZnm.d.mts +130 -0
  38. package/{internal-C-YBW2DB.d.cts → internal-CDY8g9Ic.d.mts} +1 -1
  39. package/{internal-D4HDi2GC.cjs → internal-CwnEG6Wl.cjs} +1 -1
  40. package/{internal-BLCK81kB.d.mts → internal-Da_dlcQ_.d.cts} +1 -1
  41. package/{internal-BGVUG312.mjs → internal-Df-PtOH_.mjs} +1 -1
  42. package/internal-drizzle.d.cts +1 -1
  43. package/internal-drizzle.d.mts +1 -1
  44. package/internal-entity-config.cjs +2 -1
  45. package/internal-entity-config.d.cts +2 -2
  46. package/internal-entity-config.d.mts +2 -2
  47. package/internal-entity-config.mjs +2 -2
  48. package/internal-entity-heuristics.cjs +1 -1
  49. package/internal-entity-heuristics.d.cts +1 -1
  50. package/internal-entity-heuristics.d.mts +1 -1
  51. package/internal-entity-heuristics.mjs +1 -1
  52. package/internal-mapping-form.d.cts +1 -1
  53. package/internal-mapping-form.d.mts +1 -1
  54. package/internal-mappings-config.cjs +2 -1
  55. package/internal-mappings-config.d.cts +2 -2
  56. package/internal-mappings-config.d.mts +2 -2
  57. package/internal-mappings-config.mjs +2 -2
  58. package/internal-sync-engine.d.cts +1 -1
  59. package/internal-sync-engine.d.mts +1 -1
  60. package/internal-view-compiler.d.cts +1 -1
  61. package/internal-view-compiler.d.mts +1 -1
  62. package/internal.cjs +3 -3
  63. package/internal.d.cts +8 -7
  64. package/internal.d.mts +8 -7
  65. package/internal.mjs +3 -3
  66. package/{mapping-form-Du36VZr1.d.mts → mapping-form-DH77BXLv.d.mts} +1 -1
  67. package/{mapping-form-DhY0iFmN.d.cts → mapping-form-J0aU6O7l.d.cts} +1 -1
  68. package/{mappings-config-C8ynKmDK.cjs → mappings-config-B0RqFLxu.cjs} +30 -1
  69. package/{mappings-config-DNaYGyKN.mjs → mappings-config-B1b1HVBg.mjs} +25 -2
  70. package/{mappings-config-B1qNM8VL.d.cts → mappings-config-D9dsonoi.d.mts} +40 -2
  71. package/{mappings-config-BChZsany.d.mts → mappings-config-RQLGx8ub.d.cts} +40 -2
  72. package/{namespace-probe-BkUs8raG.d.mts → namespace-probe-BmdGnYMn.d.mts} +72 -3
  73. package/{namespace-probe-aRFmpU85.d.cts → namespace-probe-EYyxWZnf.d.cts} +72 -3
  74. package/package.json +1 -1
  75. package/{sdk-Bj-ZDf4u.cjs → sdk-COLUHhJq.cjs} +755 -44
  76. package/{sdk-BvRD2jAp.mjs → sdk-CZNXBsgA.mjs} +755 -44
  77. package/sdk.cjs +4 -2
  78. package/sdk.d.cts +3 -3
  79. package/sdk.d.mts +3 -3
  80. package/sdk.mjs +3 -3
  81. package/{sync-engine-DHQ7rXZe.d.mts → sync-engine-BG2O1an2.d.cts} +2 -2
  82. package/{sync-engine-DiPjH53O.d.cts → sync-engine-DgQbrJON.d.mts} +2 -2
  83. package/{view-compiler-CcUwzZut.d.mts → view-compiler-Bo7pqXW3.d.mts} +1 -1
  84. package/{view-compiler-DqAdVxLq.d.cts → view-compiler-CmEdAMwj.d.cts} +1 -1
  85. package/vite.d.cts +1 -1
  86. package/vite.d.mts +1 -1
@@ -0,0 +1,130 @@
1
+ //#region ../core/src/integration-state.d.ts
2
+ declare const INTEGRATION_STEPS: readonly ["credential", "application", "schema", "mapping", "trigger", "sync", "widget"];
3
+ type StepId = (typeof INTEGRATION_STEPS)[number];
4
+ /** `blocked` means "prerequisite unmet", never "broken" — see C-19. */
5
+ type StepState = "done" | "active" | "blocked" | "failed" | "skipped";
6
+ type IntegrationStatus = "not_configured" | "sdk_installed" | "awaiting_connection" | "connected" | "schema_discovered" | "mapping_required" | "trigger_required" | "ready_to_sync" | "syncing" | "healthy" | "warning" | "error" |
7
+ /**
8
+ * @deprecated No longer derived. Liveness is its own dimension — read
9
+ * `ConnectionHealth` from `deriveLiveness`. Setup progress does not move
10
+ * backwards just because an app stopped running.
11
+ */
12
+ "disconnected";
13
+ interface RunFact {
14
+ at: number;
15
+ message?: string;
16
+ ok: boolean;
17
+ }
18
+ /**
19
+ * Where the reporting app is running, as the app itself understands it.
20
+ *
21
+ * `unknown` is a real value, not an absence: `detectHostEnvironment` refuses to
22
+ * guess when nothing places the app, and a bare `node server.js` with no
23
+ * NODE_ENV must still be able to connect and be shown as itself. Defaulting
24
+ * such a host to `local_dev` would file a production box's faults under local
25
+ * development, where nobody would look for them.
26
+ */
27
+ type HostEnvironment = "local_dev" | "preview" | "production" | "unknown";
28
+ interface IntegrationFacts {
29
+ discoveredTableCount: number;
30
+ /** The environment the app reported on its last heartbeat. */
31
+ environment?: HostEnvironment | null;
32
+ /**
33
+ * Has this app ever checked in? Distinguishes "never installed" from "was
34
+ * working, now silent" — the same absent heartbeat means different things,
35
+ * and only one of them is diagnosed rather than set up.
36
+ */
37
+ everConnected: boolean;
38
+ hasCredential: boolean;
39
+ /**
40
+ * The cadence the app said it heartbeats at. Liveness windows are multiples
41
+ * of this rather than a fixed constant, so an app that deliberately reports
42
+ * slowly is not called dead for obeying its own configuration.
43
+ */
44
+ heartbeatIntervalMs?: number | null;
45
+ lastHeartbeatAt: number | null;
46
+ lastRun: RunFact | null;
47
+ mappedEntityCount: number;
48
+ now: number;
49
+ /**
50
+ * Deployment presence, when this deployment has one. Absent or `http`
51
+ * transport keeps the cadence-derived behaviour every SDK in the field uses.
52
+ */
53
+ presence?: DeploymentPresence | null;
54
+ /**
55
+ * Faults the running app diagnosed about itself on its last heartbeat — an
56
+ * unreadable database, a secret missing from the process environment. These
57
+ * are what make a reachable app `live_with_issues`; unfinished setup is not.
58
+ */
59
+ reportedIssues?: StepProblem[];
60
+ syncInFlight: boolean;
61
+ /** A trigger URL and secret both exist, so Clivly can ask the app to sync. */
62
+ triggerConfigured: boolean;
63
+ warnings: string[];
64
+ widgetInstalled: boolean;
65
+ }
66
+ interface StepProblem {
67
+ code: string;
68
+ fix: string;
69
+ message: string;
70
+ }
71
+ interface IntegrationStep {
72
+ blockedBy: StepId | null;
73
+ evidence: string | null;
74
+ id: StepId;
75
+ label: string;
76
+ problem: StepProblem | null;
77
+ state: StepState;
78
+ }
79
+ type ConnectionHealth = "live" | "live_with_issues" | "stale" | "offline";
80
+ /** Which algorithm decides whether this deployment is up. */
81
+ type PresenceTransport = "websocket" | "http";
82
+ type PresenceConnectionState = "connected" | "reconnecting" | "disconnected";
83
+ /**
84
+ * A deployment's connection state as its `PresenceRoom` last persisted it.
85
+ *
86
+ * This exists because a socket has an explicit state and a timestamp does not.
87
+ * Deriving WebSocket liveness from heartbeat age would leave a disconnected app
88
+ * shown as live for 150 seconds and offline only after ten minutes, which is
89
+ * the whole reason this transport exists.
90
+ */
91
+ interface DeploymentPresence {
92
+ /** Sockets currently accepted in the room. */
93
+ activeInstanceCount: number;
94
+ connectionState: PresenceConnectionState;
95
+ transport: PresenceTransport;
96
+ }
97
+ interface ConnectionLiveness {
98
+ /** `"8s ago"`, or `"No heartbeat yet"` when the app has never reported. */
99
+ ageLabel: string;
100
+ ageMs: number | null;
101
+ environment: HostEnvironment | null;
102
+ health: ConnectionHealth;
103
+ /**
104
+ * Faults on a reachable app. Empty unless `health` is `live_with_issues`.
105
+ */
106
+ issues: StepProblem[];
107
+ /** Present when a deployment-presence record supplied this liveness result. */
108
+ presence?: Pick<DeploymentPresence, "connectionState" | "transport">;
109
+ /** Is a heartbeat recent enough to speak for the app as it is right now? */
110
+ reachable: boolean;
111
+ }
112
+ interface NextAction {
113
+ command: string | null;
114
+ envFile: string | null;
115
+ label: string;
116
+ }
117
+ interface IntegrationState {
118
+ /**
119
+ * Is the app running right now. Deliberately alongside `status` rather than
120
+ * folded into it: a surface must be able to say "setup reached mapping" and
121
+ * "the app is offline" in the same breath without either overwriting the
122
+ * other.
123
+ */
124
+ liveness: ConnectionLiveness;
125
+ next: NextAction | null;
126
+ status: IntegrationStatus;
127
+ steps: IntegrationStep[];
128
+ }
129
+ //#endregion
130
+ export { IntegrationStep as a, StepProblem as c, IntegrationStatus as i, StepState as l, IntegrationFacts as n, NextAction as o, IntegrationState as r, StepId as s, ConnectionLiveness as t };
@@ -0,0 +1,130 @@
1
+ //#region ../core/src/integration-state.d.ts
2
+ declare const INTEGRATION_STEPS: readonly ["credential", "application", "schema", "mapping", "trigger", "sync", "widget"];
3
+ type StepId = (typeof INTEGRATION_STEPS)[number];
4
+ /** `blocked` means "prerequisite unmet", never "broken" — see C-19. */
5
+ type StepState = "done" | "active" | "blocked" | "failed" | "skipped";
6
+ type IntegrationStatus = "not_configured" | "sdk_installed" | "awaiting_connection" | "connected" | "schema_discovered" | "mapping_required" | "trigger_required" | "ready_to_sync" | "syncing" | "healthy" | "warning" | "error" |
7
+ /**
8
+ * @deprecated No longer derived. Liveness is its own dimension — read
9
+ * `ConnectionHealth` from `deriveLiveness`. Setup progress does not move
10
+ * backwards just because an app stopped running.
11
+ */
12
+ "disconnected";
13
+ interface RunFact {
14
+ at: number;
15
+ message?: string;
16
+ ok: boolean;
17
+ }
18
+ /**
19
+ * Where the reporting app is running, as the app itself understands it.
20
+ *
21
+ * `unknown` is a real value, not an absence: `detectHostEnvironment` refuses to
22
+ * guess when nothing places the app, and a bare `node server.js` with no
23
+ * NODE_ENV must still be able to connect and be shown as itself. Defaulting
24
+ * such a host to `local_dev` would file a production box's faults under local
25
+ * development, where nobody would look for them.
26
+ */
27
+ type HostEnvironment = "local_dev" | "preview" | "production" | "unknown";
28
+ interface IntegrationFacts {
29
+ discoveredTableCount: number;
30
+ /** The environment the app reported on its last heartbeat. */
31
+ environment?: HostEnvironment | null;
32
+ /**
33
+ * Has this app ever checked in? Distinguishes "never installed" from "was
34
+ * working, now silent" — the same absent heartbeat means different things,
35
+ * and only one of them is diagnosed rather than set up.
36
+ */
37
+ everConnected: boolean;
38
+ hasCredential: boolean;
39
+ /**
40
+ * The cadence the app said it heartbeats at. Liveness windows are multiples
41
+ * of this rather than a fixed constant, so an app that deliberately reports
42
+ * slowly is not called dead for obeying its own configuration.
43
+ */
44
+ heartbeatIntervalMs?: number | null;
45
+ lastHeartbeatAt: number | null;
46
+ lastRun: RunFact | null;
47
+ mappedEntityCount: number;
48
+ now: number;
49
+ /**
50
+ * Deployment presence, when this deployment has one. Absent or `http`
51
+ * transport keeps the cadence-derived behaviour every SDK in the field uses.
52
+ */
53
+ presence?: DeploymentPresence | null;
54
+ /**
55
+ * Faults the running app diagnosed about itself on its last heartbeat — an
56
+ * unreadable database, a secret missing from the process environment. These
57
+ * are what make a reachable app `live_with_issues`; unfinished setup is not.
58
+ */
59
+ reportedIssues?: StepProblem[];
60
+ syncInFlight: boolean;
61
+ /** A trigger URL and secret both exist, so Clivly can ask the app to sync. */
62
+ triggerConfigured: boolean;
63
+ warnings: string[];
64
+ widgetInstalled: boolean;
65
+ }
66
+ interface StepProblem {
67
+ code: string;
68
+ fix: string;
69
+ message: string;
70
+ }
71
+ interface IntegrationStep {
72
+ blockedBy: StepId | null;
73
+ evidence: string | null;
74
+ id: StepId;
75
+ label: string;
76
+ problem: StepProblem | null;
77
+ state: StepState;
78
+ }
79
+ type ConnectionHealth = "live" | "live_with_issues" | "stale" | "offline";
80
+ /** Which algorithm decides whether this deployment is up. */
81
+ type PresenceTransport = "websocket" | "http";
82
+ type PresenceConnectionState = "connected" | "reconnecting" | "disconnected";
83
+ /**
84
+ * A deployment's connection state as its `PresenceRoom` last persisted it.
85
+ *
86
+ * This exists because a socket has an explicit state and a timestamp does not.
87
+ * Deriving WebSocket liveness from heartbeat age would leave a disconnected app
88
+ * shown as live for 150 seconds and offline only after ten minutes, which is
89
+ * the whole reason this transport exists.
90
+ */
91
+ interface DeploymentPresence {
92
+ /** Sockets currently accepted in the room. */
93
+ activeInstanceCount: number;
94
+ connectionState: PresenceConnectionState;
95
+ transport: PresenceTransport;
96
+ }
97
+ interface ConnectionLiveness {
98
+ /** `"8s ago"`, or `"No heartbeat yet"` when the app has never reported. */
99
+ ageLabel: string;
100
+ ageMs: number | null;
101
+ environment: HostEnvironment | null;
102
+ health: ConnectionHealth;
103
+ /**
104
+ * Faults on a reachable app. Empty unless `health` is `live_with_issues`.
105
+ */
106
+ issues: StepProblem[];
107
+ /** Present when a deployment-presence record supplied this liveness result. */
108
+ presence?: Pick<DeploymentPresence, "connectionState" | "transport">;
109
+ /** Is a heartbeat recent enough to speak for the app as it is right now? */
110
+ reachable: boolean;
111
+ }
112
+ interface NextAction {
113
+ command: string | null;
114
+ envFile: string | null;
115
+ label: string;
116
+ }
117
+ interface IntegrationState {
118
+ /**
119
+ * Is the app running right now. Deliberately alongside `status` rather than
120
+ * folded into it: a surface must be able to say "setup reached mapping" and
121
+ * "the app is offline" in the same breath without either overwriting the
122
+ * other.
123
+ */
124
+ liveness: ConnectionLiveness;
125
+ next: NextAction | null;
126
+ status: IntegrationStatus;
127
+ steps: IntegrationStep[];
128
+ }
129
+ //#endregion
130
+ export { IntegrationStep as a, StepProblem as c, IntegrationStatus as i, StepState as l, IntegrationFacts as n, NextAction as o, IntegrationState as r, StepId as s, ConnectionLiveness as t };
@@ -1,4 +1,4 @@
1
- import { A as ProjectionIdentity, M as ProjectionMapping, f as DiscoveredColumnMeta, j as ProjectionJoin, k as ProjectionFieldBinding, l as ConfigValidationError, p as DiscoveredSchemaTable } from "./entity-config-fKQhimtD.cjs";
1
+ import { M as ProjectionIdentity, N as ProjectionJoin, P as ProjectionMapping, j as ProjectionFieldBinding, l as ConfigValidationError, m as DiscoveredSchemaTable, p as DiscoveredColumnMeta } from "./entity-config-B2RA53nw.mjs";
2
2
  //#region ../core/src/projection-cardinality.d.ts
3
3
  declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
4
4
  /** Every join in the projection that can multiply rows. */
@@ -1,5 +1,5 @@
1
1
  const require_projection = require("./projection-C5244vGa.cjs");
2
- const require_entity_config = require("./entity-config-nuXge6rY.cjs");
2
+ const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
3
3
  //#region ../core/src/projection-draft.ts
4
4
  function emptyProjectionDraft(baseTable) {
5
5
  return {
@@ -1,4 +1,4 @@
1
- import { A as ProjectionIdentity, M as ProjectionMapping, f as DiscoveredColumnMeta, j as ProjectionJoin, k as ProjectionFieldBinding, l as ConfigValidationError, p as DiscoveredSchemaTable } from "./entity-config-fKQhimtD.mjs";
1
+ import { M as ProjectionIdentity, N as ProjectionJoin, P as ProjectionMapping, j as ProjectionFieldBinding, l as ConfigValidationError, m as DiscoveredSchemaTable, p as DiscoveredColumnMeta } from "./entity-config-B2RA53nw.cjs";
2
2
  //#region ../core/src/projection-cardinality.d.ts
3
3
  declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
4
4
  /** Every join in the projection that can multiply rows. */
@@ -1,5 +1,5 @@
1
1
  import { n as PROJECTION_KEY_PATTERN, t as BASE_REF } from "./projection-D7xmQP4S.mjs";
2
- import { m as fanOutJoins, p as validateProjection } from "./entity-config-D08zAeFY.mjs";
2
+ import { h as fanOutJoins, m as validateProjection } from "./entity-config-kUHri9yA.mjs";
3
3
  //#region ../core/src/projection-draft.ts
4
4
  function emptyProjectionDraft(baseTable) {
5
5
  return {
@@ -1,2 +1,2 @@
1
- import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-jz0lrAgl.cjs";
1
+ import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-DEtRrqtc.cjs";
2
2
  export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
@@ -1,2 +1,2 @@
1
- import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-DooDUGqO.mjs";
1
+ import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-CiK8MMEZ.mjs";
2
2
  export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
@@ -1,10 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_entity_config = require("./entity-config-nuXge6rY.cjs");
2
+ const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
3
3
  exports.CANONICAL_FIELDS = require_entity_config.CANONICAL_FIELDS;
4
4
  exports.CRM_CONCEPTS = require_entity_config.CRM_CONCEPTS;
5
5
  exports.CUSTOM_CONCEPT = require_entity_config.CUSTOM_CONCEPT;
6
6
  exports.ClivlyConfigError = require_entity_config.ClivlyConfigError;
7
7
  exports.MATERIALIZING_CONCEPTS = require_entity_config.MATERIALIZING_CONCEPTS;
8
+ exports.customObjectDeclarations = require_entity_config.customObjectDeclarations;
8
9
  exports.defineClivlyConfig = require_entity_config.defineClivlyConfig;
9
10
  exports.entitiesConfigSchema = require_entity_config.entitiesConfigSchema;
10
11
  exports.filterSchema = require_entity_config.filterSchema;
@@ -1,2 +1,2 @@
1
- import { C as filterSchema, D as validateEntitiesConfig, E as relationshipsSchema, S as entitiesConfigSchema, T as relationshipSchema, _ as MaterializingConcept, a as ClivlyEntitiesConfig, b as RelationshipsMap, c as ClivlyEntityConfigInput, d as CrmConcept, f as DiscoveredColumnMeta, g as MATERIALIZING_CONCEPTS, h as FilterValue, i as ClivlyConfigError, l as ConfigValidationError, m as FilterExpr, n as CRM_CONCEPTS, o as ClivlyEntitiesConfigInput, p as DiscoveredSchemaTable, r as CUSTOM_CONCEPT, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as RelationshipSpec, w as projectionFields, x as defineClivlyConfig, y as RelationshipVia } from "./entity-config-fKQhimtD.cjs";
2
- export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, ClivlyEntitiesConfig, ClivlyEntitiesConfigInput, ClivlyEntityConfig, ClivlyEntityConfigInput, ConfigValidationError, ConfigValidationResult, CrmConcept, DiscoveredColumnMeta, DiscoveredSchemaTable, FilterExpr, FilterValue, MATERIALIZING_CONCEPTS, MaterializingConcept, RelationshipSpec, RelationshipVia, RelationshipsMap, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
1
+ import { C as defineClivlyConfig, D as relationshipSchema, E as projectionFields, O as relationshipsSchema, S as customObjectDeclarations, T as filterSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipVia, c as ClivlyEntityConfigInput, d as CrmConcept, f as CustomObjectDeclaration, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, o as ClivlyEntitiesConfigInput, p as DiscoveredColumnMeta, r as CUSTOM_CONCEPT, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as entitiesConfigSchema, x as RelationshipsMap, y as RelationshipSpec } from "./entity-config-B2RA53nw.cjs";
2
+ export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, ClivlyEntitiesConfig, ClivlyEntitiesConfigInput, ClivlyEntityConfig, ClivlyEntityConfigInput, ConfigValidationError, ConfigValidationResult, CrmConcept, CustomObjectDeclaration, DiscoveredColumnMeta, DiscoveredSchemaTable, FilterExpr, FilterValue, MATERIALIZING_CONCEPTS, MaterializingConcept, RelationshipSpec, RelationshipVia, RelationshipsMap, customObjectDeclarations, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
@@ -1,2 +1,2 @@
1
- import { C as filterSchema, D as validateEntitiesConfig, E as relationshipsSchema, S as entitiesConfigSchema, T as relationshipSchema, _ as MaterializingConcept, a as ClivlyEntitiesConfig, b as RelationshipsMap, c as ClivlyEntityConfigInput, d as CrmConcept, f as DiscoveredColumnMeta, g as MATERIALIZING_CONCEPTS, h as FilterValue, i as ClivlyConfigError, l as ConfigValidationError, m as FilterExpr, n as CRM_CONCEPTS, o as ClivlyEntitiesConfigInput, p as DiscoveredSchemaTable, r as CUSTOM_CONCEPT, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as RelationshipSpec, w as projectionFields, x as defineClivlyConfig, y as RelationshipVia } from "./entity-config-fKQhimtD.mjs";
2
- export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, ClivlyEntitiesConfig, ClivlyEntitiesConfigInput, ClivlyEntityConfig, ClivlyEntityConfigInput, ConfigValidationError, ConfigValidationResult, CrmConcept, DiscoveredColumnMeta, DiscoveredSchemaTable, FilterExpr, FilterValue, MATERIALIZING_CONCEPTS, MaterializingConcept, RelationshipSpec, RelationshipVia, RelationshipsMap, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
1
+ import { C as defineClivlyConfig, D as relationshipSchema, E as projectionFields, O as relationshipsSchema, S as customObjectDeclarations, T as filterSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipVia, c as ClivlyEntityConfigInput, d as CrmConcept, f as CustomObjectDeclaration, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, o as ClivlyEntitiesConfigInput, p as DiscoveredColumnMeta, r as CUSTOM_CONCEPT, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as entitiesConfigSchema, x as RelationshipsMap, y as RelationshipSpec } from "./entity-config-B2RA53nw.mjs";
2
+ export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, ClivlyEntitiesConfig, ClivlyEntitiesConfigInput, ClivlyEntityConfig, ClivlyEntityConfigInput, ConfigValidationError, ConfigValidationResult, CrmConcept, CustomObjectDeclaration, DiscoveredColumnMeta, DiscoveredSchemaTable, FilterExpr, FilterValue, MATERIALIZING_CONCEPTS, MaterializingConcept, RelationshipSpec, RelationshipVia, RelationshipsMap, customObjectDeclarations, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
@@ -1,2 +1,2 @@
1
- import { a as MATERIALIZING_CONCEPTS, c as filterSchema, d as relationshipsSchema, f as validateEntitiesConfig, i as ClivlyConfigError, l as projectionFields, n as CRM_CONCEPTS, o as defineClivlyConfig, r as CUSTOM_CONCEPT, s as entitiesConfigSchema, t as CANONICAL_FIELDS, u as relationshipSchema } from "./entity-config-D08zAeFY.mjs";
2
- export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, MATERIALIZING_CONCEPTS, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
1
+ import { a as MATERIALIZING_CONCEPTS, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, i as ClivlyConfigError, l as filterSchema, n as CRM_CONCEPTS, o as customObjectDeclarations, p as validateEntitiesConfig, r as CUSTOM_CONCEPT, s as defineClivlyConfig, t as CANONICAL_FIELDS, u as projectionFields } from "./entity-config-kUHri9yA.mjs";
2
+ export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, MATERIALIZING_CONCEPTS, customObjectDeclarations, defineClivlyConfig, entitiesConfigSchema, filterSchema, projectionFields, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_entity_config = require("./entity-config-nuXge6rY.cjs");
2
+ const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
3
3
  const require_mapping_score = require("./mapping-score-CaB3F4Uu.cjs");
4
4
  //#region ../core/src/entity-heuristics.ts
5
5
  const TARGET_CONCEPTS = [
@@ -1,4 +1,4 @@
1
- import { f as DiscoveredColumnMeta } from "./entity-config-fKQhimtD.cjs";
1
+ import { p as DiscoveredColumnMeta } from "./entity-config-B2RA53nw.cjs";
2
2
  import { a as Scored } from "./mapping-score-D7Gzg7Ii.cjs";
3
3
  //#region ../core/src/entity-heuristics.d.ts
4
4
  declare const TARGET_CONCEPTS: readonly ["contact", "company", "deal", "activity", "conversation", "note"];
@@ -1,4 +1,4 @@
1
- import { f as DiscoveredColumnMeta } from "./entity-config-fKQhimtD.mjs";
1
+ import { p as DiscoveredColumnMeta } from "./entity-config-B2RA53nw.mjs";
2
2
  import { a as Scored } from "./mapping-score-D7Gzg7Ii.mjs";
3
3
  //#region ../core/src/entity-heuristics.d.ts
4
4
  declare const TARGET_CONCEPTS: readonly ["contact", "company", "deal", "activity", "conversation", "note"];
@@ -1,4 +1,4 @@
1
- import { a as MATERIALIZING_CONCEPTS } from "./entity-config-D08zAeFY.mjs";
1
+ import { a as MATERIALIZING_CONCEPTS } from "./entity-config-kUHri9yA.mjs";
2
2
  import { a as W, c as isTextLike, i as RELATIONSHIP_TIERS, l as isTimestampLike, n as CONCEPT_TIERS, o as isAmbiguous, r as FIELD_TIERS, s as isNumericLike, u as tierFor } from "./mapping-score-C68uAqGB.mjs";
3
3
  //#region ../core/src/entity-heuristics.ts
4
4
  const TARGET_CONCEPTS = [
@@ -1,2 +1,2 @@
1
- import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-DhY0iFmN.cjs";
1
+ import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-J0aU6O7l.cjs";
2
2
  export { RelationshipCandidate, buildFilterFromDiscriminator, buildRelationships, relationshipViaSignature };
@@ -1,2 +1,2 @@
1
- import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Du36VZr1.mjs";
1
+ import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-DH77BXLv.mjs";
2
2
  export { RelationshipCandidate, buildFilterFromDiscriminator, buildRelationships, relationshipViaSignature };
@@ -1,3 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mappings_config = require("./mappings-config-C8ynKmDK.cjs");
2
+ const require_mappings_config = require("./mappings-config-B0RqFLxu.cjs");
3
+ exports.entitiesToMappings = require_mappings_config.entitiesToMappings;
3
4
  exports.mappingsToEntitiesConfig = require_mappings_config.mappingsToEntitiesConfig;
@@ -1,2 +1,2 @@
1
- import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-B1qNM8VL.cjs";
2
- export { EntityMappingRow, mappingsToEntitiesConfig };
1
+ import { i as mappingsToEntitiesConfig, n as MappingFromConfig, r as entitiesToMappings, t as EntityMappingRow } from "./mappings-config-RQLGx8ub.cjs";
2
+ export { EntityMappingRow, MappingFromConfig, entitiesToMappings, mappingsToEntitiesConfig };
@@ -1,2 +1,2 @@
1
- import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-BChZsany.mjs";
2
- export { EntityMappingRow, mappingsToEntitiesConfig };
1
+ import { i as mappingsToEntitiesConfig, n as MappingFromConfig, r as entitiesToMappings, t as EntityMappingRow } from "./mappings-config-D9dsonoi.mjs";
2
+ export { EntityMappingRow, MappingFromConfig, entitiesToMappings, mappingsToEntitiesConfig };
@@ -1,2 +1,2 @@
1
- import { t as mappingsToEntitiesConfig } from "./mappings-config-DNaYGyKN.mjs";
2
- export { mappingsToEntitiesConfig };
1
+ import { n as mappingsToEntitiesConfig, t as entitiesToMappings } from "./mappings-config-B1b1HVBg.mjs";
2
+ export { entitiesToMappings, mappingsToEntitiesConfig };
@@ -1,2 +1,2 @@
1
- import { a as PreviewWarning, c as SyncResult, d as previewSync, f as reconcile, i as PreviewResult, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult, u as computeSampleWarnings } from "./sync-engine-DiPjH53O.cjs";
1
+ import { a as PreviewWarning, c as SyncResult, d as previewSync, f as reconcile, i as PreviewResult, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult, u as computeSampleWarnings } from "./sync-engine-BG2O1an2.cjs";
2
2
  export { EntitySyncResult, MirrorRecord, PersistAction, PreviewResult, PreviewWarning, SourceRow, SyncAction, SyncResult, SyncStore, computeSampleWarnings, previewSync, reconcile, runSync };
@@ -1,2 +1,2 @@
1
- import { a as PreviewWarning, c as SyncResult, d as previewSync, f as reconcile, i as PreviewResult, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult, u as computeSampleWarnings } from "./sync-engine-DHQ7rXZe.mjs";
1
+ import { a as PreviewWarning, c as SyncResult, d as previewSync, f as reconcile, i as PreviewResult, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult, u as computeSampleWarnings } from "./sync-engine-DgQbrJON.mjs";
2
2
  export { EntitySyncResult, MirrorRecord, PersistAction, PreviewResult, PreviewWarning, SourceRow, SyncAction, SyncResult, SyncStore, computeSampleWarnings, previewSync, reconcile, runSync };
@@ -1,2 +1,2 @@
1
- import { a as compileEntityView, c as explainViewExecutionError, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-DqAdVxLq.cjs";
1
+ import { a as compileEntityView, c as explainViewExecutionError, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CmEdAMwj.cjs";
2
2
  export { CompileOptions, CompiledView, DEFAULT_VIEW_PREFIX, ExplainResult, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
@@ -1,2 +1,2 @@
1
- import { a as compileEntityView, c as explainViewExecutionError, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CcUwzZut.mjs";
1
+ import { a as compileEntityView, c as explainViewExecutionError, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-Bo7pqXW3.mjs";
2
2
  export { CompileOptions, CompiledView, DEFAULT_VIEW_PREFIX, ExplainResult, compileEntityView, compileEntityViews, explainEntitiesConfig, explainViewExecutionError };
package/internal.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_projection = require("./projection-C5244vGa.cjs");
3
- const require_entity_config = require("./entity-config-nuXge6rY.cjs");
3
+ const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
4
+ const require_mappings_config = require("./mappings-config-B0RqFLxu.cjs");
4
5
  const require_auth_adapter = require("./auth-adapter-CiEXcweZ.cjs");
5
6
  const require_mapping_form = require("./mapping-form-BpfON_ME.cjs");
6
- const require_mappings_config = require("./mappings-config-C8ynKmDK.cjs");
7
- const require_internal = require("./internal-D4HDi2GC.cjs");
7
+ const require_internal = require("./internal-CwnEG6Wl.cjs");
8
8
  const require_view_compiler = require("./view-compiler-Blu4OXJ7.cjs");
9
9
  const require_sync_engine = require("./sync-engine-abE94g6X.cjs");
10
10
  exports.BASE_REF = require_projection.BASE_REF;
package/internal.d.cts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { C as UpdateDealInput, S as UpdateContactInput, _ as Task, a as ContactFilters, b as TaskPriority, c as CreateCompanyInput, d as CreateTaskInput, f as CrmRole, g as RecordSource, h as Note, i as Contact, l as CreateContactInput, m as DealStage, n as ActivityType, o as ContactStatus, p as Deal, r as Company, s as CreateActivityInput, t as Activity, u as CreateDealInput, v as TaskEntityType, w as UpdateTaskInput, x as TaskStatus, y as TaskFilters } from "./types-B1oRXdNP.cjs";
2
2
  import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-DWzgl5Yq.cjs";
3
3
  import { t as CRMAdapter } from "./adapter-C2eRbBfo.cjs";
4
- import { A as ProjectionIdentity, C as filterSchema, D as validateEntitiesConfig, E as relationshipsSchema, F as projectionSchema, M as ProjectionMapping, N as ProjectionRef, O as BASE_REF, P as identityRefs, S as entitiesConfigSchema, T as relationshipSchema, _ as MaterializingConcept, a as ClivlyEntitiesConfig, b as RelationshipsMap, d as CrmConcept, f as DiscoveredColumnMeta, g as MATERIALIZING_CONCEPTS, h as FilterValue, i as ClivlyConfigError, j as ProjectionJoin, k as ProjectionFieldBinding, l as ConfigValidationError, m as FilterExpr, n as CRM_CONCEPTS, p as DiscoveredSchemaTable, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as RelationshipSpec, x as defineClivlyConfig, y as RelationshipVia } from "./entity-config-fKQhimtD.cjs";
5
- import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-DhY0iFmN.cjs";
6
- import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-B1qNM8VL.cjs";
7
- import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-DqAdVxLq.cjs";
8
- import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-DiPjH53O.cjs";
9
- import { a as validateProjection, c as draftErrors, d as suggestJoinConditions, f as fanOutJoins, i as primaryKeyColumns, l as draftToProjection, n as coversUniqueKey, o as ProjectionDraft, p as joinFansOut, r as hasRichMeta, s as describeCardinality, t as columnMetaFor, u as emptyProjectionDraft } from "./internal-C-YBW2DB.cjs";
10
- export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
4
+ import { A as BASE_REF, C as defineClivlyConfig, D as relationshipSchema, F as ProjectionRef, I as identityRefs, L as projectionSchema, M as ProjectionIdentity, N as ProjectionJoin, O as relationshipsSchema, P as ProjectionMapping, T as filterSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipVia, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as ProjectionFieldBinding, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, p as DiscoveredColumnMeta, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as entitiesConfigSchema, x as RelationshipsMap, y as RelationshipSpec } from "./entity-config-B2RA53nw.cjs";
5
+ import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-J0aU6O7l.cjs";
6
+ import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-RQLGx8ub.cjs";
7
+ import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CmEdAMwj.cjs";
8
+ import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-BG2O1an2.cjs";
9
+ import { a as IntegrationStep, c as StepProblem, i as IntegrationStatus, l as StepState, n as IntegrationFacts, o as NextAction, r as IntegrationState, s as StepId, t as ConnectionLiveness } from "./integration-state-BK-riZnm.cjs";
10
+ import { a as validateProjection, c as draftErrors, d as suggestJoinConditions, f as fanOutJoins, i as primaryKeyColumns, l as draftToProjection, n as coversUniqueKey, o as ProjectionDraft, p as joinFansOut, r as hasRichMeta, s as describeCardinality, t as columnMetaFor, u as emptyProjectionDraft } from "./internal-Da_dlcQ_.cjs";
11
+ export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
package/internal.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { C as UpdateDealInput, S as UpdateContactInput, _ as Task, a as ContactFilters, b as TaskPriority, c as CreateCompanyInput, d as CreateTaskInput, f as CrmRole, g as RecordSource, h as Note, i as Contact, l as CreateContactInput, m as DealStage, n as ActivityType, o as ContactStatus, p as Deal, r as Company, s as CreateActivityInput, t as Activity, u as CreateDealInput, v as TaskEntityType, w as UpdateTaskInput, x as TaskStatus, y as TaskFilters } from "./types-B1oRXdNP.mjs";
2
2
  import { a as authCustom, i as MembershipResolver, n as ClivlyUser, r as CrmMembership, t as ClivlyAuthAdapter } from "./auth-adapter-Bjgo8LhN.mjs";
3
3
  import { t as CRMAdapter } from "./adapter-D5LRa-NA.mjs";
4
- import { A as ProjectionIdentity, C as filterSchema, D as validateEntitiesConfig, E as relationshipsSchema, F as projectionSchema, M as ProjectionMapping, N as ProjectionRef, O as BASE_REF, P as identityRefs, S as entitiesConfigSchema, T as relationshipSchema, _ as MaterializingConcept, a as ClivlyEntitiesConfig, b as RelationshipsMap, d as CrmConcept, f as DiscoveredColumnMeta, g as MATERIALIZING_CONCEPTS, h as FilterValue, i as ClivlyConfigError, j as ProjectionJoin, k as ProjectionFieldBinding, l as ConfigValidationError, m as FilterExpr, n as CRM_CONCEPTS, p as DiscoveredSchemaTable, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as RelationshipSpec, x as defineClivlyConfig, y as RelationshipVia } from "./entity-config-fKQhimtD.mjs";
5
- import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Du36VZr1.mjs";
6
- import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-BChZsany.mjs";
7
- import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-CcUwzZut.mjs";
8
- import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-DHQ7rXZe.mjs";
9
- import { a as validateProjection, c as draftErrors, d as suggestJoinConditions, f as fanOutJoins, i as primaryKeyColumns, l as draftToProjection, n as coversUniqueKey, o as ProjectionDraft, p as joinFansOut, r as hasRichMeta, s as describeCardinality, t as columnMetaFor, u as emptyProjectionDraft } from "./internal-BLCK81kB.mjs";
10
- export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
4
+ import { A as BASE_REF, C as defineClivlyConfig, D as relationshipSchema, F as ProjectionRef, I as identityRefs, L as projectionSchema, M as ProjectionIdentity, N as ProjectionJoin, O as relationshipsSchema, P as ProjectionMapping, T as filterSchema, _ as MATERIALIZING_CONCEPTS, a as ClivlyEntitiesConfig, b as RelationshipVia, d as CrmConcept, g as FilterValue, h as FilterExpr, i as ClivlyConfigError, j as ProjectionFieldBinding, k as validateEntitiesConfig, l as ConfigValidationError, m as DiscoveredSchemaTable, n as CRM_CONCEPTS, p as DiscoveredColumnMeta, s as ClivlyEntityConfig, t as CANONICAL_FIELDS, u as ConfigValidationResult, v as MaterializingConcept, w as entitiesConfigSchema, x as RelationshipsMap, y as RelationshipSpec } from "./entity-config-B2RA53nw.mjs";
5
+ import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-DH77BXLv.mjs";
6
+ import { i as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-D9dsonoi.mjs";
7
+ import { a as compileEntityView, i as ExplainResult, n as CompiledView, o as compileEntityViews, r as DEFAULT_VIEW_PREFIX, s as explainEntitiesConfig, t as CompileOptions } from "./view-compiler-Bo7pqXW3.mjs";
8
+ import { c as SyncResult, f as reconcile, l as SyncStore, n as MirrorRecord, o as SourceRow, p as runSync, r as PersistAction, s as SyncAction, t as EntitySyncResult } from "./sync-engine-DgQbrJON.mjs";
9
+ import { a as IntegrationStep, c as StepProblem, i as IntegrationStatus, l as StepState, n as IntegrationFacts, o as NextAction, r as IntegrationState, s as StepId, t as ConnectionLiveness } from "./integration-state-BK-riZnm.mjs";
10
+ import { a as validateProjection, c as draftErrors, d as suggestJoinConditions, f as fanOutJoins, i as primaryKeyColumns, l as draftToProjection, n as coversUniqueKey, o as ProjectionDraft, p as joinFansOut, r as hasRichMeta, s as describeCardinality, t as columnMetaFor, u as emptyProjectionDraft } from "./internal-CDY8g9Ic.mjs";
11
+ export { type Activity, type ActivityType, BASE_REF, CANONICAL_FIELDS, type CRMAdapter, CRM_CONCEPTS, type ClivlyAuthAdapter, ClivlyConfigError, type ClivlyEntitiesConfig, type ClivlyEntityConfig, type ClivlyUser, type Company, type CompileOptions, type CompiledView, type ConfigValidationError, type ConfigValidationResult, type ConnectionLiveness, type Contact, type ContactFilters, type ContactStatus, type CreateActivityInput, type CreateCompanyInput, type CreateContactInput, type CreateDealInput, type CreateTaskInput, type CrmConcept, type CrmMembership, type CrmRole, DEFAULT_VIEW_PREFIX, type Deal, type DealStage, type DiscoveredColumnMeta, type DiscoveredSchemaTable, type EntityMappingRow, type EntitySyncResult, type ExplainResult, type FilterExpr, type FilterValue, type IntegrationFacts, type IntegrationState, type IntegrationStatus, type IntegrationStep, MATERIALIZING_CONCEPTS, type MaterializingConcept, type MembershipResolver, type MirrorRecord, type NextAction, type Note, type PersistAction, type ProjectionDraft, type ProjectionFieldBinding, type ProjectionIdentity, type ProjectionJoin, type ProjectionMapping, type ProjectionRef, type RecordSource, type RelationshipCandidate, type RelationshipSpec, type RelationshipVia, type RelationshipsMap, type SourceRow, type StepId, type StepProblem, type StepState, type SyncAction, type SyncResult, type SyncStore, type Task, type TaskEntityType, type TaskFilters, type TaskPriority, type TaskStatus, type UpdateContactInput, type UpdateDealInput, type UpdateTaskInput, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
package/internal.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { i as projectionSchema, r as identityRefs, t as BASE_REF } from "./projection-D7xmQP4S.mjs";
2
- import { _ as coversUniqueKey, a as MATERIALIZING_CONCEPTS, c as filterSchema, d as relationshipsSchema, f as validateEntitiesConfig, g as columnMetaFor, h as joinFansOut, i as ClivlyConfigError, m as fanOutJoins, n as CRM_CONCEPTS, o as defineClivlyConfig, p as validateProjection, s as entitiesConfigSchema, t as CANONICAL_FIELDS, u as relationshipSchema, v as hasRichMeta, y as primaryKeyColumns } from "./entity-config-D08zAeFY.mjs";
2
+ import { _ as columnMetaFor, a as MATERIALIZING_CONCEPTS, b as primaryKeyColumns, c as entitiesConfigSchema, d as relationshipSchema, f as relationshipsSchema, g as joinFansOut, h as fanOutJoins, i as ClivlyConfigError, l as filterSchema, m as validateProjection, n as CRM_CONCEPTS, p as validateEntitiesConfig, s as defineClivlyConfig, t as CANONICAL_FIELDS, v as coversUniqueKey, y as hasRichMeta } from "./entity-config-kUHri9yA.mjs";
3
+ import { n as mappingsToEntitiesConfig } from "./mappings-config-B1b1HVBg.mjs";
3
4
  import { t as authCustom } from "./auth-adapter-gfVDxf3d.mjs";
4
5
  import { n as buildRelationships, r as relationshipViaSignature, t as buildFilterFromDiscriminator } from "./mapping-form-DigkuvFc.mjs";
5
- import { t as mappingsToEntitiesConfig } from "./mappings-config-DNaYGyKN.mjs";
6
- import { a as suggestJoinConditions, i as emptyProjectionDraft, n as draftErrors, r as draftToProjection, t as describeCardinality } from "./internal-BGVUG312.mjs";
6
+ import { a as suggestJoinConditions, i as emptyProjectionDraft, n as draftErrors, r as draftToProjection, t as describeCardinality } from "./internal-Df-PtOH_.mjs";
7
7
  import { i as explainEntitiesConfig, n as compileEntityView, r as compileEntityViews, t as DEFAULT_VIEW_PREFIX } from "./view-compiler-CQx8TRrW.mjs";
8
8
  import { i as runSync, r as reconcile } from "./sync-engine-SuxSzbZ4.mjs";
9
9
  export { BASE_REF, CANONICAL_FIELDS, CRM_CONCEPTS, ClivlyConfigError, DEFAULT_VIEW_PREFIX, MATERIALIZING_CONCEPTS, authCustom, buildFilterFromDiscriminator, buildRelationships, columnMetaFor, compileEntityView, compileEntityViews, coversUniqueKey, defineClivlyConfig, describeCardinality, draftErrors, draftToProjection, emptyProjectionDraft, entitiesConfigSchema, explainEntitiesConfig, fanOutJoins, filterSchema, hasRichMeta, identityRefs, joinFansOut, mappingsToEntitiesConfig, primaryKeyColumns, projectionSchema, reconcile, relationshipSchema, relationshipViaSignature, relationshipsSchema, runSync, suggestJoinConditions, validateEntitiesConfig, validateProjection };
@@ -1,4 +1,4 @@
1
- import { b as RelationshipsMap, m as FilterExpr, y as RelationshipVia } from "./entity-config-fKQhimtD.mjs";
1
+ import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-B2RA53nw.mjs";
2
2
  //#region ../core/src/mapping-form.d.ts
3
3
  /**
4
4
  * A relationship the mapping UI can offer or has configured, in the shape the
@@ -1,4 +1,4 @@
1
- import { b as RelationshipsMap, m as FilterExpr, y as RelationshipVia } from "./entity-config-fKQhimtD.cjs";
1
+ import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-B2RA53nw.cjs";
2
2
  //#region ../core/src/mapping-form.d.ts
3
3
  /**
4
4
  * A relationship the mapping UI can offer or has configured, in the shape the
@@ -1,4 +1,4 @@
1
- const require_entity_config = require("./entity-config-nuXge6rY.cjs");
1
+ const require_entity_config = require("./entity-config-DtBsl2MQ.cjs");
2
2
  //#region ../core/src/mappings-config.ts
3
3
  const RESERVED_FIELD = "id";
4
4
  /**
@@ -121,7 +121,36 @@ function mappingsToEntitiesConfig(rows) {
121
121
  for (const { row, key } of assigned) entities[key] = buildEntity(row, refIndex);
122
122
  return { entities };
123
123
  }
124
+ const CUSTOM_CONCEPT = "custom";
125
+ function entitiesToMappings(config) {
126
+ const rows = [];
127
+ for (const [entityKey, entity] of Object.entries(config.entities)) {
128
+ const row = {
129
+ entityKey,
130
+ sourceTable: entity.projection?.baseTable ?? entity.source,
131
+ targetConcept: entity.concept,
132
+ role: entity.role ?? DEFAULT_ROLE,
133
+ fieldMap: entity.projection ? {} : entity.fields
134
+ };
135
+ if (entity.filter) row.filter = entity.filter;
136
+ if (entity.relationships) row.relationships = entity.relationships;
137
+ if (entity.projection) row.projection = entity.projection;
138
+ if (entity.concept === CUSTOM_CONCEPT) {
139
+ row.objectTypeSlug = entityKey;
140
+ if (entity.objectType) row.objectType = entity.objectType;
141
+ }
142
+ if (entity.targetObjectTypeId) row.targetObjectTypeId = entity.targetObjectTypeId;
143
+ rows.push(row);
144
+ }
145
+ return rows;
146
+ }
124
147
  //#endregion
148
+ Object.defineProperty(exports, "entitiesToMappings", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return entitiesToMappings;
152
+ }
153
+ });
125
154
  Object.defineProperty(exports, "mappingsToEntitiesConfig", {
126
155
  enumerable: true,
127
156
  get: function() {