@clivly/core 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.
- package/README.md +13 -3
- package/dist/drizzle.d.cts +1 -1
- package/dist/drizzle.d.mts +1 -1
- package/dist/{entity-config-Dh8aEcgj.cjs → entity-config-Bfq3OkCU.cjs} +36 -12
- package/dist/{entity-config-8Fgr6IOH.mjs → entity-config-DFJ8L9jm.mjs} +31 -13
- package/dist/{entity-config-CLxI8dVb.d.cts → entity-config-buOIVtMM.d.cts} +25 -1
- package/dist/{entity-config-CLxI8dVb.d.mts → entity-config-buOIVtMM.d.mts} +25 -1
- package/dist/entity-config.cjs +2 -1
- package/dist/entity-config.d.cts +2 -2
- package/dist/entity-config.d.mts +2 -2
- package/dist/entity-config.mjs +2 -2
- package/dist/entity-heuristics.cjs +1 -1
- package/dist/entity-heuristics.d.cts +1 -1
- package/dist/entity-heuristics.d.mts +1 -1
- package/dist/entity-heuristics.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/integration-state.cjs +98 -26
- package/dist/integration-state.d.cts +94 -7
- package/dist/integration-state.d.mts +94 -7
- package/dist/integration-state.mjs +96 -27
- package/dist/mapping-form.d.cts +1 -1
- package/dist/mapping-form.d.mts +1 -1
- package/dist/mappings-config.cjs +25 -1
- package/dist/mappings-config.d.cts +40 -2
- package/dist/mappings-config.d.mts +40 -2
- package/dist/mappings-config.mjs +25 -2
- package/dist/sync-engine.d.cts +1 -1
- package/dist/sync-engine.d.mts +1 -1
- package/dist/view-compiler.d.cts +1 -1
- package/dist/view-compiler.d.mts +1 -1
- package/package.json +1 -1
package/dist/mapping-form.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as
|
|
1
|
+
import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-buOIVtMM.cjs";
|
|
2
2
|
//#region src/mapping-form.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A relationship the mapping UI can offer or has configured, in the shape the
|
package/dist/mapping-form.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as
|
|
1
|
+
import { b as RelationshipVia, h as FilterExpr, x as RelationshipsMap } from "./entity-config-buOIVtMM.mjs";
|
|
2
2
|
//#region src/mapping-form.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A relationship the mapping UI can offer or has configured, in the shape the
|
package/dist/mappings-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_entity_config = require("./entity-config-
|
|
2
|
+
const require_entity_config = require("./entity-config-Bfq3OkCU.cjs");
|
|
3
3
|
//#region src/mappings-config.ts
|
|
4
4
|
const RESERVED_FIELD = "id";
|
|
5
5
|
/**
|
|
@@ -122,5 +122,29 @@ function mappingsToEntitiesConfig(rows) {
|
|
|
122
122
|
for (const { row, key } of assigned) entities[key] = buildEntity(row, refIndex);
|
|
123
123
|
return { entities };
|
|
124
124
|
}
|
|
125
|
+
const CUSTOM_CONCEPT = "custom";
|
|
126
|
+
function entitiesToMappings(config) {
|
|
127
|
+
const rows = [];
|
|
128
|
+
for (const [entityKey, entity] of Object.entries(config.entities)) {
|
|
129
|
+
const row = {
|
|
130
|
+
entityKey,
|
|
131
|
+
sourceTable: entity.projection?.baseTable ?? entity.source,
|
|
132
|
+
targetConcept: entity.concept,
|
|
133
|
+
role: entity.role ?? DEFAULT_ROLE,
|
|
134
|
+
fieldMap: entity.projection ? {} : entity.fields
|
|
135
|
+
};
|
|
136
|
+
if (entity.filter) row.filter = entity.filter;
|
|
137
|
+
if (entity.relationships) row.relationships = entity.relationships;
|
|
138
|
+
if (entity.projection) row.projection = entity.projection;
|
|
139
|
+
if (entity.concept === CUSTOM_CONCEPT) {
|
|
140
|
+
row.objectTypeSlug = entityKey;
|
|
141
|
+
if (entity.objectType) row.objectType = entity.objectType;
|
|
142
|
+
}
|
|
143
|
+
if (entity.targetObjectTypeId) row.targetObjectTypeId = entity.targetObjectTypeId;
|
|
144
|
+
rows.push(row);
|
|
145
|
+
}
|
|
146
|
+
return rows;
|
|
147
|
+
}
|
|
125
148
|
//#endregion
|
|
149
|
+
exports.entitiesToMappings = entitiesToMappings;
|
|
126
150
|
exports.mappingsToEntitiesConfig = mappingsToEntitiesConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as ProjectionMapping, a as ClivlyEntitiesConfig, h as FilterExpr, x as RelationshipsMap } from "./entity-config-buOIVtMM.cjs";
|
|
2
2
|
//#region src/mappings-config.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Mappings → Entity Config bridge.
|
|
@@ -43,5 +43,43 @@ interface EntityMappingRow {
|
|
|
43
43
|
* eligible — a no-op the view compiler and sync engine both tolerate.
|
|
44
44
|
*/
|
|
45
45
|
declare function mappingsToEntitiesConfig(rows: EntityMappingRow[]): ClivlyEntitiesConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Entity Config → Mappings, the inverse of `mappingsToEntitiesConfig`.
|
|
48
|
+
*
|
|
49
|
+
* `objectType` in config creates the custom object but nothing creates the
|
|
50
|
+
* MAPPING, so config-as-code ended at a created object and a sync that stored
|
|
51
|
+
* nothing. This produces the rows that close that gap.
|
|
52
|
+
*
|
|
53
|
+
* The two shapes align column for column, with one asymmetry that cannot be
|
|
54
|
+
* resolved by naming: the row model has no entity-key column — a row is keyed by
|
|
55
|
+
* `(sourceTable, targetConcept, role)` — while a CUSTOM entity's key *is* its
|
|
56
|
+
* object type slug, and is routinely different from its source table
|
|
57
|
+
* ("client-accounts" derived from "accounts"). So the key travels explicitly on
|
|
58
|
+
* every row rather than being left for the reverse derivation to guess.
|
|
59
|
+
*/
|
|
60
|
+
interface MappingFromConfig {
|
|
61
|
+
/**
|
|
62
|
+
* The config entity key this row came from. Not a row column — the caller
|
|
63
|
+
* needs it to resolve a custom object type and to report what it wrote.
|
|
64
|
+
*/
|
|
65
|
+
entityKey: string;
|
|
66
|
+
fieldMap: Record<string, string>;
|
|
67
|
+
filter?: FilterExpr;
|
|
68
|
+
/** Declared custom object, when the config declares one rather than pinning an id. */
|
|
69
|
+
objectType?: {
|
|
70
|
+
iconKey?: string;
|
|
71
|
+
name: string;
|
|
72
|
+
pluralName?: string;
|
|
73
|
+
};
|
|
74
|
+
/** The custom object type's slug — the entity key. Custom entities only. */
|
|
75
|
+
objectTypeSlug?: string;
|
|
76
|
+
projection?: ProjectionMapping;
|
|
77
|
+
relationships?: RelationshipsMap;
|
|
78
|
+
role: string;
|
|
79
|
+
sourceTable: string;
|
|
80
|
+
targetConcept: string;
|
|
81
|
+
targetObjectTypeId?: string;
|
|
82
|
+
}
|
|
83
|
+
declare function entitiesToMappings(config: ClivlyEntitiesConfig): MappingFromConfig[];
|
|
46
84
|
//#endregion
|
|
47
|
-
export { EntityMappingRow, mappingsToEntitiesConfig };
|
|
85
|
+
export { EntityMappingRow, MappingFromConfig, entitiesToMappings, mappingsToEntitiesConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P as ProjectionMapping, a as ClivlyEntitiesConfig, h as FilterExpr, x as RelationshipsMap } from "./entity-config-buOIVtMM.mjs";
|
|
2
2
|
//#region src/mappings-config.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Mappings → Entity Config bridge.
|
|
@@ -43,5 +43,43 @@ interface EntityMappingRow {
|
|
|
43
43
|
* eligible — a no-op the view compiler and sync engine both tolerate.
|
|
44
44
|
*/
|
|
45
45
|
declare function mappingsToEntitiesConfig(rows: EntityMappingRow[]): ClivlyEntitiesConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Entity Config → Mappings, the inverse of `mappingsToEntitiesConfig`.
|
|
48
|
+
*
|
|
49
|
+
* `objectType` in config creates the custom object but nothing creates the
|
|
50
|
+
* MAPPING, so config-as-code ended at a created object and a sync that stored
|
|
51
|
+
* nothing. This produces the rows that close that gap.
|
|
52
|
+
*
|
|
53
|
+
* The two shapes align column for column, with one asymmetry that cannot be
|
|
54
|
+
* resolved by naming: the row model has no entity-key column — a row is keyed by
|
|
55
|
+
* `(sourceTable, targetConcept, role)` — while a CUSTOM entity's key *is* its
|
|
56
|
+
* object type slug, and is routinely different from its source table
|
|
57
|
+
* ("client-accounts" derived from "accounts"). So the key travels explicitly on
|
|
58
|
+
* every row rather than being left for the reverse derivation to guess.
|
|
59
|
+
*/
|
|
60
|
+
interface MappingFromConfig {
|
|
61
|
+
/**
|
|
62
|
+
* The config entity key this row came from. Not a row column — the caller
|
|
63
|
+
* needs it to resolve a custom object type and to report what it wrote.
|
|
64
|
+
*/
|
|
65
|
+
entityKey: string;
|
|
66
|
+
fieldMap: Record<string, string>;
|
|
67
|
+
filter?: FilterExpr;
|
|
68
|
+
/** Declared custom object, when the config declares one rather than pinning an id. */
|
|
69
|
+
objectType?: {
|
|
70
|
+
iconKey?: string;
|
|
71
|
+
name: string;
|
|
72
|
+
pluralName?: string;
|
|
73
|
+
};
|
|
74
|
+
/** The custom object type's slug — the entity key. Custom entities only. */
|
|
75
|
+
objectTypeSlug?: string;
|
|
76
|
+
projection?: ProjectionMapping;
|
|
77
|
+
relationships?: RelationshipsMap;
|
|
78
|
+
role: string;
|
|
79
|
+
sourceTable: string;
|
|
80
|
+
targetConcept: string;
|
|
81
|
+
targetObjectTypeId?: string;
|
|
82
|
+
}
|
|
83
|
+
declare function entitiesToMappings(config: ClivlyEntitiesConfig): MappingFromConfig[];
|
|
46
84
|
//#endregion
|
|
47
|
-
export { EntityMappingRow, mappingsToEntitiesConfig };
|
|
85
|
+
export { EntityMappingRow, MappingFromConfig, entitiesToMappings, mappingsToEntitiesConfig };
|
package/dist/mappings-config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CANONICAL_FIELDS } from "./entity-config-
|
|
1
|
+
import { t as CANONICAL_FIELDS } from "./entity-config-DFJ8L9jm.mjs";
|
|
2
2
|
//#region src/mappings-config.ts
|
|
3
3
|
const RESERVED_FIELD = "id";
|
|
4
4
|
/**
|
|
@@ -121,5 +121,28 @@ 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
|
|
125
|
-
export { mappingsToEntitiesConfig };
|
|
148
|
+
export { entitiesToMappings, mappingsToEntitiesConfig };
|
package/dist/sync-engine.d.cts
CHANGED
package/dist/sync-engine.d.mts
CHANGED
package/dist/view-compiler.d.cts
CHANGED
package/dist/view-compiler.d.mts
CHANGED