clivly 0.8.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.
- package/README.md +330 -134
- package/core-drizzle.cjs +3 -1
- package/core-drizzle.d.cts +3 -2
- package/core-drizzle.d.mts +3 -2
- package/core-drizzle.mjs +2 -2
- package/core-entity-config.cjs +2 -1
- package/core-entity-config.d.cts +2 -2
- package/core-entity-config.d.mts +2 -2
- package/core-entity-config.mjs +2 -2
- package/core-entity-heuristics.d.cts +3 -2
- package/core-entity-heuristics.d.mts +3 -2
- package/core-mapping-form.d.cts +1 -1
- package/core-mapping-form.d.mts +1 -1
- package/core-mappings-config.cjs +1 -1
- package/core-mappings-config.d.cts +1 -1
- package/core-mappings-config.d.mts +1 -1
- package/core-mappings-config.mjs +1 -1
- package/core-sync-engine.cjs +1 -1
- package/core-sync-engine.d.cts +1 -1
- package/core-sync-engine.d.mts +1 -1
- package/core-sync-engine.mjs +1 -1
- package/core-view-compiler.cjs +2 -1
- package/core-view-compiler.d.cts +2 -2
- package/core-view-compiler.d.mts +2 -2
- package/core-view-compiler.mjs +2 -2
- package/core.cjs +21 -5
- package/core.d.cts +7 -6
- package/core.d.mts +7 -6
- package/core.mjs +7 -6
- package/drizzle-3kvhkwO7.mjs +110 -0
- package/drizzle-DooDUGqO.d.mts +41 -0
- package/drizzle-bfjVzYR6.cjs +127 -0
- package/drizzle-jz0lrAgl.d.cts +41 -0
- package/drizzle.cjs +12 -40
- package/drizzle.d.cts +3 -11
- package/drizzle.d.mts +3 -11
- package/drizzle.mjs +12 -41
- package/entity-config-D08zAeFY.mjs +657 -0
- package/{entity-config-DoUCXtq5.d.cts → entity-config-fKQhimtD.d.cts} +263 -2
- package/{entity-config-DoUCXtq5.d.mts → entity-config-fKQhimtD.d.mts} +263 -2
- package/entity-config-nuXge6rY.cjs +778 -0
- package/index.cjs +768 -122
- package/index.d.cts +12 -0
- package/index.d.mts +12 -0
- package/index.mjs +769 -123
- package/internal-BGVUG312.mjs +68 -0
- package/internal-BLCK81kB.d.mts +72 -0
- package/internal-C-YBW2DB.d.cts +72 -0
- package/internal-D4HDi2GC.cjs +97 -0
- package/internal-drizzle.cjs +3 -1
- package/internal-drizzle.d.cts +2 -2
- package/internal-drizzle.d.mts +2 -2
- package/internal-drizzle.mjs +2 -2
- package/internal-entity-config.cjs +2 -1
- package/internal-entity-config.d.cts +2 -2
- package/internal-entity-config.d.mts +2 -2
- package/internal-entity-config.mjs +2 -2
- package/internal-entity-heuristics.cjs +28 -8
- package/internal-entity-heuristics.d.cts +2 -12
- package/internal-entity-heuristics.d.mts +2 -12
- package/internal-entity-heuristics.mjs +28 -8
- package/internal-mapping-form.d.cts +1 -1
- package/internal-mapping-form.d.mts +1 -1
- package/internal-mappings-config.cjs +1 -1
- package/internal-mappings-config.d.cts +1 -1
- package/internal-mappings-config.d.mts +1 -1
- package/internal-mappings-config.mjs +1 -1
- package/internal-sync-engine.cjs +1 -1
- package/internal-sync-engine.d.cts +1 -1
- package/internal-sync-engine.d.mts +1 -1
- package/internal-sync-engine.mjs +1 -1
- package/internal-view-compiler.cjs +2 -1
- package/internal-view-compiler.d.cts +2 -2
- package/internal-view-compiler.d.mts +2 -2
- package/internal-view-compiler.mjs +2 -2
- package/internal.cjs +21 -4
- package/internal.d.cts +7 -6
- package/internal.d.mts +7 -6
- package/internal.mjs +7 -5
- package/{mapping-form-D93lhHEc.d.mts → mapping-form-DhY0iFmN.d.cts} +1 -1
- package/{mapping-form-lfyEE7EJ.d.cts → mapping-form-Du36VZr1.d.mts} +1 -1
- package/{mappings-config-DsUa7-1w.d.mts → mappings-config-B1qNM8VL.d.cts} +7 -1
- package/{mappings-config-XmzB4dag.d.cts → mappings-config-BChZsany.d.mts} +7 -1
- package/{mappings-config-BsRADNRv.cjs → mappings-config-C8ynKmDK.cjs} +32 -6
- package/{mappings-config-Dbgxx3Nv.mjs → mappings-config-DNaYGyKN.mjs} +32 -6
- package/namespace-probe-BkUs8raG.d.mts +381 -0
- package/namespace-probe-aRFmpU85.d.cts +381 -0
- package/package.json +1 -1
- package/{entity-config-va2bkH5o.mjs → projection-C5244vGa.cjs} +130 -309
- package/{entity-config-D87rV-tE.cjs → projection-D7xmQP4S.mjs} +60 -381
- package/{sdk-iqOXeWIp.cjs → sdk-Bj-ZDf4u.cjs} +126 -28
- package/{sdk-C6WANW8M.mjs → sdk-BvRD2jAp.mjs} +126 -28
- package/sdk.cjs +2 -2
- package/sdk.d.cts +36 -1
- package/sdk.d.mts +36 -1
- package/sdk.mjs +2 -2
- package/{sync-engine-DGk_AeHJ.d.mts → sync-engine-DHQ7rXZe.d.mts} +2 -2
- package/{sync-engine-B7QIbXro.d.cts → sync-engine-DiPjH53O.d.cts} +2 -2
- package/{sync-engine-Do5ru3WF.mjs → sync-engine-SuxSzbZ4.mjs} +9 -2
- package/{sync-engine-CzEbpQGv.cjs → sync-engine-abE94g6X.cjs} +9 -2
- package/{view-compiler-BIwvm-o2.cjs → view-compiler-Blu4OXJ7.cjs} +103 -12
- package/{view-compiler-ChWr_Lml.mjs → view-compiler-CQx8TRrW.mjs} +98 -13
- package/{view-compiler-BWz0sGdm.d.cts → view-compiler-CcUwzZut.d.mts} +12 -2
- package/{view-compiler-Bn_EJJMO.d.mts → view-compiler-DqAdVxLq.d.cts} +12 -2
- package/vite.d.cts +1 -1
- package/vite.d.mts +1 -1
- package/drizzle-B89tLo4T.mjs +0 -31
- package/drizzle-CFOr9dU9.d.mts +0 -20
- package/drizzle-DiReZf6d.cjs +0 -36
- package/drizzle-DmeKSqeF.d.cts +0 -20
- package/types-CsL0rFYh.d.cts +0 -155
- package/types-CsL0rFYh.d.mts +0 -155
|
@@ -0,0 +1,68 @@
|
|
|
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";
|
|
3
|
+
//#region ../core/src/projection-draft.ts
|
|
4
|
+
function emptyProjectionDraft(baseTable) {
|
|
5
|
+
return {
|
|
6
|
+
baseTable,
|
|
7
|
+
entityKey: "",
|
|
8
|
+
fieldBindings: {},
|
|
9
|
+
identity: { kind: "base_pk" },
|
|
10
|
+
joins: []
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The ON conditions implied by a foreign key between the two tables, so the
|
|
15
|
+
* builder can pre-fill a join instead of making the user hand-pick columns.
|
|
16
|
+
* Returns [] when no FK relates them — the user then picks manually.
|
|
17
|
+
*/
|
|
18
|
+
function suggestJoinConditions(baseTable, joinTable, schema, joinKey) {
|
|
19
|
+
const join = schema.find((t) => t.name === joinTable);
|
|
20
|
+
const conditions = [];
|
|
21
|
+
for (const column of join?.columnsMeta ?? []) if (column.references?.table === baseTable) conditions.push({
|
|
22
|
+
left: {
|
|
23
|
+
table: joinKey,
|
|
24
|
+
column: column.name
|
|
25
|
+
},
|
|
26
|
+
op: "eq",
|
|
27
|
+
right: {
|
|
28
|
+
table: BASE_REF,
|
|
29
|
+
column: column.references.column
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return conditions;
|
|
33
|
+
}
|
|
34
|
+
/** A draft becomes a projection once it has a valid key and ≥1 binding. */
|
|
35
|
+
function draftToProjection(draft) {
|
|
36
|
+
if (!PROJECTION_KEY_PATTERN.test(draft.entityKey)) return null;
|
|
37
|
+
if (Object.keys(draft.fieldBindings).length === 0) return null;
|
|
38
|
+
return {
|
|
39
|
+
version: 1,
|
|
40
|
+
kind: "projection",
|
|
41
|
+
entityKey: draft.entityKey,
|
|
42
|
+
baseTable: draft.baseTable,
|
|
43
|
+
joins: draft.joins,
|
|
44
|
+
fieldBindings: draft.fieldBindings,
|
|
45
|
+
identity: draft.identity
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function draftErrors(draft, schema) {
|
|
49
|
+
const projection = draftToProjection(draft);
|
|
50
|
+
if (!projection) return [{
|
|
51
|
+
path: "projection",
|
|
52
|
+
message: "Name the object and map a field."
|
|
53
|
+
}];
|
|
54
|
+
return validateProjection(projection, schema, "projection");
|
|
55
|
+
}
|
|
56
|
+
/** Per-join fan-out, for the builder's inline cardinality hints. */
|
|
57
|
+
function describeCardinality(draft, schema) {
|
|
58
|
+
const projection = draftToProjection(draft);
|
|
59
|
+
if (!projection) return [];
|
|
60
|
+
const tablesByName = new Map(schema.map((t) => [t.name, t]));
|
|
61
|
+
const fanning = new Set(fanOutJoins(projection, tablesByName).map((j) => j.key));
|
|
62
|
+
return projection.joins.map((join) => ({
|
|
63
|
+
joinKey: join.key,
|
|
64
|
+
fansOut: fanning.has(join.key)
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { suggestJoinConditions as a, emptyProjectionDraft as i, draftErrors as n, draftToProjection as r, describeCardinality as t };
|
|
@@ -0,0 +1,72 @@
|
|
|
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";
|
|
2
|
+
//#region ../core/src/projection-cardinality.d.ts
|
|
3
|
+
declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
|
|
4
|
+
/** Every join in the projection that can multiply rows. */
|
|
5
|
+
declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../core/src/projection-draft.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The builder's in-progress shape.
|
|
10
|
+
*
|
|
11
|
+
* A draft is deliberately looser than a `ProjectionMapping`: it exists while
|
|
12
|
+
* the user is still choosing things, so every field can be empty. All of the
|
|
13
|
+
* builder's rules live here as pure functions, which keeps the React components
|
|
14
|
+
* presentational and lets the rules be tested without a DOM.
|
|
15
|
+
*/
|
|
16
|
+
interface ProjectionDraft {
|
|
17
|
+
baseTable: string;
|
|
18
|
+
entityKey: string;
|
|
19
|
+
fieldBindings: Record<string, ProjectionFieldBinding>;
|
|
20
|
+
identity: ProjectionIdentity;
|
|
21
|
+
joins: ProjectionJoin[];
|
|
22
|
+
}
|
|
23
|
+
declare function emptyProjectionDraft(baseTable: string): ProjectionDraft;
|
|
24
|
+
/**
|
|
25
|
+
* The ON conditions implied by a foreign key between the two tables, so the
|
|
26
|
+
* builder can pre-fill a join instead of making the user hand-pick columns.
|
|
27
|
+
* Returns [] when no FK relates them — the user then picks manually.
|
|
28
|
+
*/
|
|
29
|
+
declare function suggestJoinConditions(baseTable: string, joinTable: string, schema: DiscoveredSchemaTable[], joinKey: string): ProjectionJoin["on"];
|
|
30
|
+
/** A draft becomes a projection once it has a valid key and ≥1 binding. */
|
|
31
|
+
declare function draftToProjection(draft: ProjectionDraft): ProjectionMapping | null;
|
|
32
|
+
declare function draftErrors(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): ConfigValidationError[];
|
|
33
|
+
/** Per-join fan-out, for the builder's inline cardinality hints. */
|
|
34
|
+
declare function describeCardinality(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): Array<{
|
|
35
|
+
fansOut: boolean;
|
|
36
|
+
joinKey: string;
|
|
37
|
+
}>;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region ../core/src/projection-validate.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Validate a projection against the discovered schema. Returns every error
|
|
42
|
+
* found (not just the first) so a builder UI can show them all at once.
|
|
43
|
+
*/
|
|
44
|
+
declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../core/src/schema-meta.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* Accessors over a discovered table's schema-v2 metadata.
|
|
49
|
+
*
|
|
50
|
+
* Every helper treats *absent* metadata as **unknown**, never as a negative
|
|
51
|
+
* fact. `coversUniqueKey` returning false on a v1 payload is what makes
|
|
52
|
+
* projection validation fail closed: we cannot prove a join is many-to-one, so
|
|
53
|
+
* we refuse to compile it rather than guess.
|
|
54
|
+
*/
|
|
55
|
+
declare function columnMetaFor(table: DiscoveredSchemaTable, column: string): DiscoveredColumnMeta | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Every primary-key column. More than one entry means a composite PK, which is
|
|
58
|
+
* why `base_pk` identity is rejected for such tables.
|
|
59
|
+
*/
|
|
60
|
+
declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Do `columns` contain every column of at least one unique key on `table`?
|
|
63
|
+
*
|
|
64
|
+
* This is the fan-out test. A join whose ON columns cover a unique key of the
|
|
65
|
+
* joined table matches at most one row per base row; one that does not can
|
|
66
|
+
* match many.
|
|
67
|
+
*/
|
|
68
|
+
declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]): boolean;
|
|
69
|
+
/** Is this table's payload rich enough to validate a projection against? */
|
|
70
|
+
declare function hasRichMeta(table: DiscoveredSchemaTable): boolean;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { validateProjection as a, draftErrors as c, suggestJoinConditions as d, fanOutJoins as f, primaryKeyColumns as i, draftToProjection as l, coversUniqueKey as n, ProjectionDraft as o, joinFansOut as p, hasRichMeta as r, describeCardinality as s, columnMetaFor as t, emptyProjectionDraft as u };
|
|
@@ -0,0 +1,72 @@
|
|
|
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";
|
|
2
|
+
//#region ../core/src/projection-cardinality.d.ts
|
|
3
|
+
declare function joinFansOut(join: ProjectionJoin, joinTable: DiscoveredSchemaTable): boolean;
|
|
4
|
+
/** Every join in the projection that can multiply rows. */
|
|
5
|
+
declare function fanOutJoins(projection: ProjectionMapping, tablesByName: Map<string, DiscoveredSchemaTable>): ProjectionJoin[];
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../core/src/projection-draft.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* The builder's in-progress shape.
|
|
10
|
+
*
|
|
11
|
+
* A draft is deliberately looser than a `ProjectionMapping`: it exists while
|
|
12
|
+
* the user is still choosing things, so every field can be empty. All of the
|
|
13
|
+
* builder's rules live here as pure functions, which keeps the React components
|
|
14
|
+
* presentational and lets the rules be tested without a DOM.
|
|
15
|
+
*/
|
|
16
|
+
interface ProjectionDraft {
|
|
17
|
+
baseTable: string;
|
|
18
|
+
entityKey: string;
|
|
19
|
+
fieldBindings: Record<string, ProjectionFieldBinding>;
|
|
20
|
+
identity: ProjectionIdentity;
|
|
21
|
+
joins: ProjectionJoin[];
|
|
22
|
+
}
|
|
23
|
+
declare function emptyProjectionDraft(baseTable: string): ProjectionDraft;
|
|
24
|
+
/**
|
|
25
|
+
* The ON conditions implied by a foreign key between the two tables, so the
|
|
26
|
+
* builder can pre-fill a join instead of making the user hand-pick columns.
|
|
27
|
+
* Returns [] when no FK relates them — the user then picks manually.
|
|
28
|
+
*/
|
|
29
|
+
declare function suggestJoinConditions(baseTable: string, joinTable: string, schema: DiscoveredSchemaTable[], joinKey: string): ProjectionJoin["on"];
|
|
30
|
+
/** A draft becomes a projection once it has a valid key and ≥1 binding. */
|
|
31
|
+
declare function draftToProjection(draft: ProjectionDraft): ProjectionMapping | null;
|
|
32
|
+
declare function draftErrors(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): ConfigValidationError[];
|
|
33
|
+
/** Per-join fan-out, for the builder's inline cardinality hints. */
|
|
34
|
+
declare function describeCardinality(draft: ProjectionDraft, schema: DiscoveredSchemaTable[]): Array<{
|
|
35
|
+
fansOut: boolean;
|
|
36
|
+
joinKey: string;
|
|
37
|
+
}>;
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region ../core/src/projection-validate.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Validate a projection against the discovered schema. Returns every error
|
|
42
|
+
* found (not just the first) so a builder UI can show them all at once.
|
|
43
|
+
*/
|
|
44
|
+
declare function validateProjection(projection: ProjectionMapping, schema: DiscoveredSchemaTable[], base: string): ConfigValidationError[];
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../core/src/schema-meta.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* Accessors over a discovered table's schema-v2 metadata.
|
|
49
|
+
*
|
|
50
|
+
* Every helper treats *absent* metadata as **unknown**, never as a negative
|
|
51
|
+
* fact. `coversUniqueKey` returning false on a v1 payload is what makes
|
|
52
|
+
* projection validation fail closed: we cannot prove a join is many-to-one, so
|
|
53
|
+
* we refuse to compile it rather than guess.
|
|
54
|
+
*/
|
|
55
|
+
declare function columnMetaFor(table: DiscoveredSchemaTable, column: string): DiscoveredColumnMeta | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Every primary-key column. More than one entry means a composite PK, which is
|
|
58
|
+
* why `base_pk` identity is rejected for such tables.
|
|
59
|
+
*/
|
|
60
|
+
declare function primaryKeyColumns(table: DiscoveredSchemaTable): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Do `columns` contain every column of at least one unique key on `table`?
|
|
63
|
+
*
|
|
64
|
+
* This is the fan-out test. A join whose ON columns cover a unique key of the
|
|
65
|
+
* joined table matches at most one row per base row; one that does not can
|
|
66
|
+
* match many.
|
|
67
|
+
*/
|
|
68
|
+
declare function coversUniqueKey(table: DiscoveredSchemaTable, columns: string[]): boolean;
|
|
69
|
+
/** Is this table's payload rich enough to validate a projection against? */
|
|
70
|
+
declare function hasRichMeta(table: DiscoveredSchemaTable): boolean;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { validateProjection as a, draftErrors as c, suggestJoinConditions as d, fanOutJoins as f, primaryKeyColumns as i, draftToProjection as l, coversUniqueKey as n, ProjectionDraft as o, joinFansOut as p, hasRichMeta as r, describeCardinality as s, columnMetaFor as t, emptyProjectionDraft as u };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const require_projection = require("./projection-C5244vGa.cjs");
|
|
2
|
+
const require_entity_config = require("./entity-config-nuXge6rY.cjs");
|
|
3
|
+
//#region ../core/src/projection-draft.ts
|
|
4
|
+
function emptyProjectionDraft(baseTable) {
|
|
5
|
+
return {
|
|
6
|
+
baseTable,
|
|
7
|
+
entityKey: "",
|
|
8
|
+
fieldBindings: {},
|
|
9
|
+
identity: { kind: "base_pk" },
|
|
10
|
+
joins: []
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The ON conditions implied by a foreign key between the two tables, so the
|
|
15
|
+
* builder can pre-fill a join instead of making the user hand-pick columns.
|
|
16
|
+
* Returns [] when no FK relates them — the user then picks manually.
|
|
17
|
+
*/
|
|
18
|
+
function suggestJoinConditions(baseTable, joinTable, schema, joinKey) {
|
|
19
|
+
const join = schema.find((t) => t.name === joinTable);
|
|
20
|
+
const conditions = [];
|
|
21
|
+
for (const column of join?.columnsMeta ?? []) if (column.references?.table === baseTable) conditions.push({
|
|
22
|
+
left: {
|
|
23
|
+
table: joinKey,
|
|
24
|
+
column: column.name
|
|
25
|
+
},
|
|
26
|
+
op: "eq",
|
|
27
|
+
right: {
|
|
28
|
+
table: require_projection.BASE_REF,
|
|
29
|
+
column: column.references.column
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return conditions;
|
|
33
|
+
}
|
|
34
|
+
/** A draft becomes a projection once it has a valid key and ≥1 binding. */
|
|
35
|
+
function draftToProjection(draft) {
|
|
36
|
+
if (!require_projection.PROJECTION_KEY_PATTERN.test(draft.entityKey)) return null;
|
|
37
|
+
if (Object.keys(draft.fieldBindings).length === 0) return null;
|
|
38
|
+
return {
|
|
39
|
+
version: 1,
|
|
40
|
+
kind: "projection",
|
|
41
|
+
entityKey: draft.entityKey,
|
|
42
|
+
baseTable: draft.baseTable,
|
|
43
|
+
joins: draft.joins,
|
|
44
|
+
fieldBindings: draft.fieldBindings,
|
|
45
|
+
identity: draft.identity
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function draftErrors(draft, schema) {
|
|
49
|
+
const projection = draftToProjection(draft);
|
|
50
|
+
if (!projection) return [{
|
|
51
|
+
path: "projection",
|
|
52
|
+
message: "Name the object and map a field."
|
|
53
|
+
}];
|
|
54
|
+
return require_entity_config.validateProjection(projection, schema, "projection");
|
|
55
|
+
}
|
|
56
|
+
/** Per-join fan-out, for the builder's inline cardinality hints. */
|
|
57
|
+
function describeCardinality(draft, schema) {
|
|
58
|
+
const projection = draftToProjection(draft);
|
|
59
|
+
if (!projection) return [];
|
|
60
|
+
const tablesByName = new Map(schema.map((t) => [t.name, t]));
|
|
61
|
+
const fanning = new Set(require_entity_config.fanOutJoins(projection, tablesByName).map((j) => j.key));
|
|
62
|
+
return projection.joins.map((join) => ({
|
|
63
|
+
joinKey: join.key,
|
|
64
|
+
fansOut: fanning.has(join.key)
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
Object.defineProperty(exports, "describeCardinality", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function() {
|
|
71
|
+
return describeCardinality;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "draftErrors", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function() {
|
|
77
|
+
return draftErrors;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "draftToProjection", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function() {
|
|
83
|
+
return draftToProjection;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "emptyProjectionDraft", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function() {
|
|
89
|
+
return emptyProjectionDraft;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "suggestJoinConditions", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function() {
|
|
95
|
+
return suggestJoinConditions;
|
|
96
|
+
}
|
|
97
|
+
});
|
package/internal-drizzle.cjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_drizzle = require("./drizzle-
|
|
2
|
+
const require_drizzle = require("./drizzle-bfjVzYR6.cjs");
|
|
3
|
+
exports.buildColumnsMeta = require_drizzle.buildColumnsMeta;
|
|
4
|
+
exports.buildUniqueConstraints = require_drizzle.buildUniqueConstraints;
|
|
3
5
|
exports.discoverFromDrizzle = require_drizzle.discoverFromDrizzle;
|
package/internal-drizzle.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { discoverFromDrizzle };
|
|
1
|
+
import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-jz0lrAgl.cjs";
|
|
2
|
+
export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
|
package/internal-drizzle.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { discoverFromDrizzle };
|
|
1
|
+
import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-DooDUGqO.mjs";
|
|
2
|
+
export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
|
package/internal-drizzle.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { discoverFromDrizzle };
|
|
1
|
+
import { n as buildUniqueConstraints, r as discoverFromDrizzle, t as buildColumnsMeta } from "./drizzle-3kvhkwO7.mjs";
|
|
2
|
+
export { buildColumnsMeta, buildUniqueConstraints, discoverFromDrizzle };
|
|
@@ -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-nuXge6rY.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;
|
|
@@ -8,6 +8,7 @@ exports.MATERIALIZING_CONCEPTS = require_entity_config.MATERIALIZING_CONCEPTS;
|
|
|
8
8
|
exports.defineClivlyConfig = require_entity_config.defineClivlyConfig;
|
|
9
9
|
exports.entitiesConfigSchema = require_entity_config.entitiesConfigSchema;
|
|
10
10
|
exports.filterSchema = require_entity_config.filterSchema;
|
|
11
|
+
exports.projectionFields = require_entity_config.projectionFields;
|
|
11
12
|
exports.relationshipSchema = require_entity_config.relationshipSchema;
|
|
12
13
|
exports.relationshipsSchema = require_entity_config.relationshipsSchema;
|
|
13
14
|
exports.validateEntitiesConfig = require_entity_config.validateEntitiesConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as validateEntitiesConfig,
|
|
2
|
-
export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, ClivlyEntitiesConfig, ClivlyEntityConfig, ConfigValidationError, ConfigValidationResult, CrmConcept, DiscoveredSchemaTable, FilterExpr, FilterValue, MATERIALIZING_CONCEPTS, MaterializingConcept, RelationshipSpec, RelationshipVia, RelationshipsMap, defineClivlyConfig, entitiesConfigSchema, filterSchema, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
|
|
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,2 +1,2 @@
|
|
|
1
|
-
import { C as validateEntitiesConfig,
|
|
2
|
-
export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, ClivlyEntitiesConfig, ClivlyEntityConfig, ConfigValidationError, ConfigValidationResult, CrmConcept, DiscoveredSchemaTable, FilterExpr, FilterValue, MATERIALIZING_CONCEPTS, MaterializingConcept, RelationshipSpec, RelationshipVia, RelationshipsMap, defineClivlyConfig, entitiesConfigSchema, filterSchema, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
|
|
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,2 +1,2 @@
|
|
|
1
|
-
import { a as MATERIALIZING_CONCEPTS, c as filterSchema, d as validateEntitiesConfig, i as ClivlyConfigError, l as
|
|
2
|
-
export { CANONICAL_FIELDS, CRM_CONCEPTS, CUSTOM_CONCEPT, ClivlyConfigError, MATERIALIZING_CONCEPTS, defineClivlyConfig, entitiesConfigSchema, filterSchema, relationshipSchema, relationshipsSchema, validateEntitiesConfig };
|
|
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,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-nuXge6rY.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 = [
|
|
@@ -101,7 +101,10 @@ const CONCEPT_FIELDS = {
|
|
|
101
101
|
"name",
|
|
102
102
|
"full_name",
|
|
103
103
|
"fullname",
|
|
104
|
-
"display_name"
|
|
104
|
+
"display_name",
|
|
105
|
+
"first_name",
|
|
106
|
+
"firstname",
|
|
107
|
+
"given_name"
|
|
105
108
|
],
|
|
106
109
|
required: false
|
|
107
110
|
}, {
|
|
@@ -224,12 +227,28 @@ function suggestCursorField(columnKeys) {
|
|
|
224
227
|
return null;
|
|
225
228
|
}
|
|
226
229
|
const MATERIALIZING = new Set(require_entity_config.MATERIALIZING_CONCEPTS);
|
|
230
|
+
const ENDS_IN_CONSONANT_Y = /[^aeiou]y$/;
|
|
231
|
+
const NEEDS_ES = /(s|x|z|ch|sh)$/;
|
|
232
|
+
const IRREGULAR_PLURALS = {
|
|
233
|
+
person: "people",
|
|
234
|
+
child: "children",
|
|
235
|
+
man: "men",
|
|
236
|
+
woman: "women"
|
|
237
|
+
};
|
|
238
|
+
function pluralize(name) {
|
|
239
|
+
const irregular = IRREGULAR_PLURALS[name];
|
|
240
|
+
if (irregular) return irregular;
|
|
241
|
+
if (ENDS_IN_CONSONANT_Y.test(name)) return `${name.slice(0, -1)}ies`;
|
|
242
|
+
if (NEEDS_ES.test(name)) return `${name}es`;
|
|
243
|
+
return `${name}s`;
|
|
244
|
+
}
|
|
227
245
|
function matchesConcept(tableName, concept) {
|
|
228
246
|
const normalized = tableName.toLowerCase();
|
|
229
247
|
const entry = TABLE_PATTERNS.find((p) => p.concept === concept);
|
|
230
248
|
if (!entry) return null;
|
|
231
|
-
|
|
232
|
-
if (
|
|
249
|
+
const candidates = [normalized, pluralize(normalized)];
|
|
250
|
+
if (candidates.some((candidate) => entry.names.includes(candidate))) return { exact: true };
|
|
251
|
+
if (entry.names.some((name) => candidates.some((candidate) => candidate.includes(name)))) return { exact: false };
|
|
233
252
|
return null;
|
|
234
253
|
}
|
|
235
254
|
function metaFor(table, column) {
|
|
@@ -245,17 +264,18 @@ function scoreConcepts(table) {
|
|
|
245
264
|
for (const concept of TARGET_CONCEPTS) {
|
|
246
265
|
if (!MATERIALIZING.has(concept)) continue;
|
|
247
266
|
const nameMatch = matchesConcept(table.name, concept);
|
|
248
|
-
|
|
267
|
+
const definingColumns = hasDefiningColumn(concept, table.columns);
|
|
268
|
+
if (!(nameMatch || definingColumns)) continue;
|
|
249
269
|
let score = 0;
|
|
250
270
|
const reasons = [];
|
|
251
|
-
if (nameMatch
|
|
271
|
+
if (nameMatch?.exact) {
|
|
252
272
|
score += require_mapping_score.W.nameExact;
|
|
253
273
|
reasons.push(`name matches "${table.name}"`);
|
|
254
|
-
} else {
|
|
274
|
+
} else if (nameMatch) {
|
|
255
275
|
score += require_mapping_score.W.nameSubstring;
|
|
256
276
|
reasons.push(`name looks like ${concept}`);
|
|
257
277
|
}
|
|
258
|
-
if (
|
|
278
|
+
if (definingColumns) {
|
|
259
279
|
score += require_mapping_score.W.definingColumn;
|
|
260
280
|
reasons.push(`has the columns a ${concept} needs`);
|
|
261
281
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { f as DiscoveredColumnMeta } from "./entity-config-fKQhimtD.cjs";
|
|
1
2
|
import { a as Scored } from "./mapping-score-D7Gzg7Ii.cjs";
|
|
2
3
|
//#region ../core/src/entity-heuristics.d.ts
|
|
3
4
|
declare const TARGET_CONCEPTS: readonly ["contact", "company", "deal", "activity", "conversation", "note"];
|
|
@@ -6,17 +7,6 @@ declare function suggestCursorField(columnKeys: string[]): string | null;
|
|
|
6
7
|
declare function matchesConcept(tableName: string, concept: TargetConcept): {
|
|
7
8
|
exact: boolean;
|
|
8
9
|
} | null;
|
|
9
|
-
interface DiscoveredColumnMeta {
|
|
10
|
-
isForeignKey?: boolean;
|
|
11
|
-
isPrimaryKey?: boolean;
|
|
12
|
-
name: string;
|
|
13
|
-
nullable?: boolean;
|
|
14
|
-
references?: {
|
|
15
|
-
table: string;
|
|
16
|
-
column: string;
|
|
17
|
-
};
|
|
18
|
-
type?: string;
|
|
19
|
-
}
|
|
20
10
|
interface ScoredTable {
|
|
21
11
|
columns: string[];
|
|
22
12
|
columnsMeta?: DiscoveredColumnMeta[];
|
|
@@ -64,4 +54,4 @@ interface FieldSuggestion {
|
|
|
64
54
|
declare function scoreFieldMap(concept: TargetConcept, table: ScoredTable): Scored<FieldSuggestion>[];
|
|
65
55
|
declare function toFieldMap(scored: Scored<FieldSuggestion>[]): Record<string, string>;
|
|
66
56
|
//#endregion
|
|
67
|
-
export { DiscoveredColumnMeta, FieldSuggestion, RelationshipSuggestion, ScoredTable, SuggestedVia, TARGET_CONCEPTS, TargetConcept, matchesConcept, requiredFieldsFor, scoreConcepts, scoreFieldMap, scoreRelationships, suggestCursorField, suggestDiscriminatorColumns, toFieldMap, topConcept, validateMapping };
|
|
57
|
+
export { type DiscoveredColumnMeta, FieldSuggestion, RelationshipSuggestion, ScoredTable, SuggestedVia, TARGET_CONCEPTS, TargetConcept, matchesConcept, requiredFieldsFor, scoreConcepts, scoreFieldMap, scoreRelationships, suggestCursorField, suggestDiscriminatorColumns, toFieldMap, topConcept, validateMapping };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { f as DiscoveredColumnMeta } from "./entity-config-fKQhimtD.mjs";
|
|
1
2
|
import { a as Scored } from "./mapping-score-D7Gzg7Ii.mjs";
|
|
2
3
|
//#region ../core/src/entity-heuristics.d.ts
|
|
3
4
|
declare const TARGET_CONCEPTS: readonly ["contact", "company", "deal", "activity", "conversation", "note"];
|
|
@@ -6,17 +7,6 @@ declare function suggestCursorField(columnKeys: string[]): string | null;
|
|
|
6
7
|
declare function matchesConcept(tableName: string, concept: TargetConcept): {
|
|
7
8
|
exact: boolean;
|
|
8
9
|
} | null;
|
|
9
|
-
interface DiscoveredColumnMeta {
|
|
10
|
-
isForeignKey?: boolean;
|
|
11
|
-
isPrimaryKey?: boolean;
|
|
12
|
-
name: string;
|
|
13
|
-
nullable?: boolean;
|
|
14
|
-
references?: {
|
|
15
|
-
table: string;
|
|
16
|
-
column: string;
|
|
17
|
-
};
|
|
18
|
-
type?: string;
|
|
19
|
-
}
|
|
20
10
|
interface ScoredTable {
|
|
21
11
|
columns: string[];
|
|
22
12
|
columnsMeta?: DiscoveredColumnMeta[];
|
|
@@ -64,4 +54,4 @@ interface FieldSuggestion {
|
|
|
64
54
|
declare function scoreFieldMap(concept: TargetConcept, table: ScoredTable): Scored<FieldSuggestion>[];
|
|
65
55
|
declare function toFieldMap(scored: Scored<FieldSuggestion>[]): Record<string, string>;
|
|
66
56
|
//#endregion
|
|
67
|
-
export { DiscoveredColumnMeta, FieldSuggestion, RelationshipSuggestion, ScoredTable, SuggestedVia, TARGET_CONCEPTS, TargetConcept, matchesConcept, requiredFieldsFor, scoreConcepts, scoreFieldMap, scoreRelationships, suggestCursorField, suggestDiscriminatorColumns, toFieldMap, topConcept, validateMapping };
|
|
57
|
+
export { type DiscoveredColumnMeta, FieldSuggestion, RelationshipSuggestion, ScoredTable, SuggestedVia, TARGET_CONCEPTS, TargetConcept, matchesConcept, requiredFieldsFor, scoreConcepts, scoreFieldMap, scoreRelationships, suggestCursorField, suggestDiscriminatorColumns, toFieldMap, topConcept, validateMapping };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MATERIALIZING_CONCEPTS } from "./entity-config-
|
|
1
|
+
import { a as MATERIALIZING_CONCEPTS } from "./entity-config-D08zAeFY.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 = [
|
|
@@ -100,7 +100,10 @@ const CONCEPT_FIELDS = {
|
|
|
100
100
|
"name",
|
|
101
101
|
"full_name",
|
|
102
102
|
"fullname",
|
|
103
|
-
"display_name"
|
|
103
|
+
"display_name",
|
|
104
|
+
"first_name",
|
|
105
|
+
"firstname",
|
|
106
|
+
"given_name"
|
|
104
107
|
],
|
|
105
108
|
required: false
|
|
106
109
|
}, {
|
|
@@ -223,12 +226,28 @@ function suggestCursorField(columnKeys) {
|
|
|
223
226
|
return null;
|
|
224
227
|
}
|
|
225
228
|
const MATERIALIZING = new Set(MATERIALIZING_CONCEPTS);
|
|
229
|
+
const ENDS_IN_CONSONANT_Y = /[^aeiou]y$/;
|
|
230
|
+
const NEEDS_ES = /(s|x|z|ch|sh)$/;
|
|
231
|
+
const IRREGULAR_PLURALS = {
|
|
232
|
+
person: "people",
|
|
233
|
+
child: "children",
|
|
234
|
+
man: "men",
|
|
235
|
+
woman: "women"
|
|
236
|
+
};
|
|
237
|
+
function pluralize(name) {
|
|
238
|
+
const irregular = IRREGULAR_PLURALS[name];
|
|
239
|
+
if (irregular) return irregular;
|
|
240
|
+
if (ENDS_IN_CONSONANT_Y.test(name)) return `${name.slice(0, -1)}ies`;
|
|
241
|
+
if (NEEDS_ES.test(name)) return `${name}es`;
|
|
242
|
+
return `${name}s`;
|
|
243
|
+
}
|
|
226
244
|
function matchesConcept(tableName, concept) {
|
|
227
245
|
const normalized = tableName.toLowerCase();
|
|
228
246
|
const entry = TABLE_PATTERNS.find((p) => p.concept === concept);
|
|
229
247
|
if (!entry) return null;
|
|
230
|
-
|
|
231
|
-
if (
|
|
248
|
+
const candidates = [normalized, pluralize(normalized)];
|
|
249
|
+
if (candidates.some((candidate) => entry.names.includes(candidate))) return { exact: true };
|
|
250
|
+
if (entry.names.some((name) => candidates.some((candidate) => candidate.includes(name)))) return { exact: false };
|
|
232
251
|
return null;
|
|
233
252
|
}
|
|
234
253
|
function metaFor(table, column) {
|
|
@@ -244,17 +263,18 @@ function scoreConcepts(table) {
|
|
|
244
263
|
for (const concept of TARGET_CONCEPTS) {
|
|
245
264
|
if (!MATERIALIZING.has(concept)) continue;
|
|
246
265
|
const nameMatch = matchesConcept(table.name, concept);
|
|
247
|
-
|
|
266
|
+
const definingColumns = hasDefiningColumn(concept, table.columns);
|
|
267
|
+
if (!(nameMatch || definingColumns)) continue;
|
|
248
268
|
let score = 0;
|
|
249
269
|
const reasons = [];
|
|
250
|
-
if (nameMatch
|
|
270
|
+
if (nameMatch?.exact) {
|
|
251
271
|
score += W.nameExact;
|
|
252
272
|
reasons.push(`name matches "${table.name}"`);
|
|
253
|
-
} else {
|
|
273
|
+
} else if (nameMatch) {
|
|
254
274
|
score += W.nameSubstring;
|
|
255
275
|
reasons.push(`name looks like ${concept}`);
|
|
256
276
|
}
|
|
257
|
-
if (
|
|
277
|
+
if (definingColumns) {
|
|
258
278
|
score += W.definingColumn;
|
|
259
279
|
reasons.push(`has the columns a ${concept} needs`);
|
|
260
280
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-
|
|
1
|
+
import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-DhY0iFmN.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-
|
|
1
|
+
import { i as relationshipViaSignature, n as buildFilterFromDiscriminator, r as buildRelationships, t as RelationshipCandidate } from "./mapping-form-Du36VZr1.mjs";
|
|
2
2
|
export { RelationshipCandidate, buildFilterFromDiscriminator, buildRelationships, relationshipViaSignature };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_mappings_config = require("./mappings-config-
|
|
2
|
+
const require_mappings_config = require("./mappings-config-C8ynKmDK.cjs");
|
|
3
3
|
exports.mappingsToEntitiesConfig = require_mappings_config.mappingsToEntitiesConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-
|
|
1
|
+
import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-B1qNM8VL.cjs";
|
|
2
2
|
export { EntityMappingRow, mappingsToEntitiesConfig };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-
|
|
1
|
+
import { n as mappingsToEntitiesConfig, t as EntityMappingRow } from "./mappings-config-BChZsany.mjs";
|
|
2
2
|
export { EntityMappingRow, mappingsToEntitiesConfig };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mappingsToEntitiesConfig } from "./mappings-config-
|
|
1
|
+
import { t as mappingsToEntitiesConfig } from "./mappings-config-DNaYGyKN.mjs";
|
|
2
2
|
export { mappingsToEntitiesConfig };
|
package/internal-sync-engine.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_sync_engine = require("./sync-engine-
|
|
2
|
+
const require_sync_engine = require("./sync-engine-abE94g6X.cjs");
|
|
3
3
|
exports.computeSampleWarnings = require_sync_engine.computeSampleWarnings;
|
|
4
4
|
exports.previewSync = require_sync_engine.previewSync;
|
|
5
5
|
exports.reconcile = require_sync_engine.reconcile;
|
|
@@ -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-
|
|
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";
|
|
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-
|
|
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";
|
|
2
2
|
export { EntitySyncResult, MirrorRecord, PersistAction, PreviewResult, PreviewWarning, SourceRow, SyncAction, SyncResult, SyncStore, computeSampleWarnings, previewSync, reconcile, runSync };
|
package/internal-sync-engine.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as runSync, n as previewSync, r as reconcile, t as computeSampleWarnings } from "./sync-engine-
|
|
1
|
+
import { i as runSync, n as previewSync, r as reconcile, t as computeSampleWarnings } from "./sync-engine-SuxSzbZ4.mjs";
|
|
2
2
|
export { computeSampleWarnings, previewSync, reconcile, runSync };
|