clivly 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1 -1
- package/core-entity-config.d.cts +2 -2
- package/core-entity-config.d.mts +2 -2
- package/core-entity-config.mjs +1 -1
- 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 +1 -1
- package/core-view-compiler.d.cts +1 -1
- package/core-view-compiler.d.mts +1 -1
- package/core-view-compiler.mjs +1 -1
- 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-BhN5M9zt.d.cts +41 -0
- package/drizzle-bfjVzYR6.cjs +127 -0
- package/drizzle-kBULBAOa.d.mts +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-DoUCXtq5.d.cts → entity-config-C4Yf_fPj.d.cts} +120 -1
- package/{entity-config-DoUCXtq5.d.mts → entity-config-C4Yf_fPj.d.mts} +120 -1
- package/entity-config-CsLl-ftC.cjs +727 -0
- package/entity-config-D3LmzgLb.mjs +612 -0
- package/index.cjs +764 -120
- package/index.d.cts +12 -0
- package/index.d.mts +12 -0
- package/index.mjs +765 -121
- package/internal-B8ydhsKd.d.cts +73 -0
- package/internal-BARjyN4n.cjs +97 -0
- package/internal-DMySVbM0.mjs +68 -0
- package/internal-MBkNo3bw.d.mts +73 -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 +1 -1
- package/internal-entity-config.d.cts +2 -2
- package/internal-entity-config.d.mts +2 -2
- package/internal-entity-config.mjs +1 -1
- 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 +1 -1
- package/internal-view-compiler.d.cts +1 -1
- package/internal-view-compiler.d.mts +1 -1
- package/internal-view-compiler.mjs +1 -1
- 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-43bwOTat.d.cts} +1 -1
- package/{mapping-form-lfyEE7EJ.d.cts → mapping-form-DUvWUYCo.d.mts} +1 -1
- package/{mappings-config-BsRADNRv.cjs → mappings-config-BSSwdHiq.cjs} +32 -6
- package/mappings-config-BpcR8bBo.d.mts +167 -0
- package/{mappings-config-Dbgxx3Nv.mjs → mappings-config-bJQT_gSa.mjs} +32 -6
- package/mappings-config-xsLMn3I-.d.cts +167 -0
- package/namespace-probe-BSH_p9TK.d.cts +381 -0
- package/namespace-probe-Dsp5uNkS.d.mts +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-Do5ru3WF.mjs → sync-engine-Bg6-SznL.mjs} +9 -2
- package/{sync-engine-CzEbpQGv.cjs → sync-engine-DEJvKw6E.cjs} +9 -2
- package/{sync-engine-DGk_AeHJ.d.mts → sync-engine-GNqRB8eS.d.cts} +2 -2
- package/{sync-engine-B7QIbXro.d.cts → sync-engine-ZsusW-q_.d.mts} +2 -2
- package/{view-compiler-BWz0sGdm.d.cts → view-compiler-Cin0neDO.d.mts} +1 -1
- package/{view-compiler-ChWr_Lml.mjs → view-compiler-DlTpOfZi.mjs} +81 -12
- package/{view-compiler-BIwvm-o2.cjs → view-compiler-DplczSjF.cjs} +81 -12
- package/{view-compiler-Bn_EJJMO.d.mts → view-compiler-Ll9cbIJz.d.cts} +1 -1
- 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/mappings-config-DsUa7-1w.d.mts +0 -41
- package/mappings-config-XmzB4dag.d.cts +0 -41
- package/types-CsL0rFYh.d.cts +0 -155
- package/types-CsL0rFYh.d.mts +0 -155
|
@@ -4203,333 +4203,154 @@ function superRefine(fn, params) {
|
|
|
4203
4203
|
return /* @__PURE__ */ _superRefine(fn, params);
|
|
4204
4204
|
}
|
|
4205
4205
|
//#endregion
|
|
4206
|
-
//#region ../core/src/
|
|
4206
|
+
//#region ../core/src/projection.ts
|
|
4207
4207
|
/**
|
|
4208
|
-
*
|
|
4209
|
-
*
|
|
4208
|
+
* Projection-backed custom mappings — one custom object derived from a base
|
|
4209
|
+
* table plus explicit joins.
|
|
4210
4210
|
*
|
|
4211
|
-
* A
|
|
4212
|
-
*
|
|
4213
|
-
*
|
|
4214
|
-
*
|
|
4215
|
-
*
|
|
4211
|
+
* A projection is deliberately narrow: equality joins only, direct column
|
|
4212
|
+
* bindings only, no expressions and no aggregation. Everything a user can
|
|
4213
|
+
* express here compiles to a single read-only view whose `id` column is
|
|
4214
|
+
* provably unique per row, which is what lets the sync engine consume it
|
|
4215
|
+
* unchanged.
|
|
4216
4216
|
*
|
|
4217
|
-
*
|
|
4218
|
-
*
|
|
4219
|
-
*
|
|
4220
|
-
* the view compiler (Phase 2) and sync engine (Phase 3) consume this contract.
|
|
4217
|
+
* Refs address tables symbolically: `"base"` for the base table, or a join's
|
|
4218
|
+
* `key`. Raw table names are never accepted in a ref, so a projection can
|
|
4219
|
+
* never reach a table it did not declare.
|
|
4221
4220
|
*/
|
|
4222
|
-
/**
|
|
4223
|
-
const
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
const
|
|
4244
|
-
contact: [
|
|
4245
|
-
"name",
|
|
4246
|
-
"email",
|
|
4247
|
-
"title",
|
|
4248
|
-
"status"
|
|
4249
|
-
],
|
|
4250
|
-
company: [
|
|
4251
|
-
"name",
|
|
4252
|
-
"domain",
|
|
4253
|
-
"industry",
|
|
4254
|
-
"size"
|
|
4255
|
-
],
|
|
4256
|
-
deal: [
|
|
4257
|
-
"name",
|
|
4258
|
-
"value",
|
|
4259
|
-
"stage"
|
|
4260
|
-
]
|
|
4261
|
-
};
|
|
4262
|
-
/**
|
|
4263
|
-
* The concepts the mapping→sync pipeline can actually materialize into `crm_*`
|
|
4264
|
-
* tables. These are exactly the CANONICAL_FIELDS keys — the Drizzle sync store's
|
|
4265
|
-
* `persist()` throws for any other concept, so offering one (in the mapping
|
|
4266
|
-
* editor, in suggestions, or via the upsert API) is a broken affordance.
|
|
4267
|
-
*
|
|
4268
|
-
* The broader CRM_CONCEPTS set still validates structurally, so previously
|
|
4269
|
-
* stored rows for not-yet-materialized concepts keep rendering. When a concept
|
|
4270
|
-
* gains a sync-store path, add its canonical fields above and it joins this set
|
|
4271
|
-
* automatically (guarded by the MATERIALIZING_CONCEPTS drift test).
|
|
4272
|
-
*/
|
|
4273
|
-
const MATERIALIZING_CONCEPTS = [
|
|
4274
|
-
"contact",
|
|
4275
|
-
"company",
|
|
4276
|
-
"deal"
|
|
4277
|
-
];
|
|
4278
|
-
/**
|
|
4279
|
-
* The org-defined custom-object target. Deliberately NOT a member of
|
|
4280
|
-
* CRM_CONCEPTS / CANONICAL_FIELDS / MATERIALIZING_CONCEPTS — a custom object has
|
|
4281
|
-
* no fixed canonical columns; its mapping's fieldMap keys ARE its properties.
|
|
4282
|
-
* Handled as an explicit branch wherever concepts are switched on, so the
|
|
4283
|
-
* canonical-concept invariants (and their drift test) stay intact.
|
|
4284
|
-
*/
|
|
4285
|
-
const CUSTOM_CONCEPT = "custom";
|
|
4286
|
-
/**
|
|
4287
|
-
* Operator forms for a single column predicate. All predicates on an entity are
|
|
4288
|
-
* AND-ed together. `$raw` (see FilterExpr) is the escape hatch for anything the
|
|
4289
|
-
* operators can't express.
|
|
4290
|
-
*/
|
|
4291
|
-
const filterOperatorsSchema = union([
|
|
4292
|
-
strictObject({ eq: union([
|
|
4293
|
-
string(),
|
|
4294
|
-
number(),
|
|
4295
|
-
boolean()
|
|
4296
|
-
]) }),
|
|
4297
|
-
strictObject({ ne: union([
|
|
4298
|
-
string(),
|
|
4299
|
-
number(),
|
|
4300
|
-
boolean()
|
|
4301
|
-
]) }),
|
|
4302
|
-
strictObject({ in: array(union([
|
|
4303
|
-
string(),
|
|
4304
|
-
number(),
|
|
4305
|
-
boolean()
|
|
4306
|
-
])).min(1) }),
|
|
4307
|
-
strictObject({ notIn: array(union([
|
|
4308
|
-
string(),
|
|
4309
|
-
number(),
|
|
4310
|
-
boolean()
|
|
4311
|
-
])).min(1) }),
|
|
4312
|
-
strictObject({ isNull: literal(true) }),
|
|
4313
|
-
strictObject({ isNotNull: literal(true) })
|
|
4314
|
-
]);
|
|
4315
|
-
const filterValueSchema = union([
|
|
4316
|
-
string(),
|
|
4317
|
-
number(),
|
|
4318
|
-
boolean(),
|
|
4319
|
-
filterOperatorsSchema
|
|
4320
|
-
]);
|
|
4321
|
-
/** `$raw` is a reserved key; a column literally named `$raw` is not addressable. */
|
|
4322
|
-
const filterSchema = union([strictObject({ $raw: string().min(1) }), record(string(), filterValueSchema)]);
|
|
4323
|
-
/**
|
|
4324
|
-
* How the link between two entities is expressed in the host schema:
|
|
4325
|
-
* - `fkOn: "company"` — FK lives on the company table (e.g. organizations.owner_id)
|
|
4326
|
-
* - `fkOn: "contact"` — FK lives on the contact table (e.g. users.organization_id)
|
|
4327
|
-
* - `through` — a join table sits between them (many-to-many, role often here)
|
|
4328
|
-
* - `$raw` — opaque SQL join fragment (escape hatch; not schema-validated)
|
|
4329
|
-
*
|
|
4330
|
-
* `column` and the join-table keys are `table.column` or bare `column` strings.
|
|
4331
|
-
*/
|
|
4332
|
-
const relationshipViaSchema = union([
|
|
4221
|
+
/** The reserved ref name for the projection's base table. */
|
|
4222
|
+
const BASE_REF = "base";
|
|
4223
|
+
/** Entity keys become view names (`crm_src_<entityKey>`), so keep them slugs. */
|
|
4224
|
+
const PROJECTION_KEY_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
4225
|
+
const projectionRefSchema = strictObject({
|
|
4226
|
+
table: string().min(1),
|
|
4227
|
+
column: string().min(1)
|
|
4228
|
+
});
|
|
4229
|
+
const projectionJoinConditionSchema = strictObject({
|
|
4230
|
+
left: projectionRefSchema,
|
|
4231
|
+
op: literal("eq"),
|
|
4232
|
+
right: projectionRefSchema
|
|
4233
|
+
});
|
|
4234
|
+
const projectionJoinSchema = strictObject({
|
|
4235
|
+
/** SQL alias and ref target. Unique within the projection. */
|
|
4236
|
+
key: string().regex(PROJECTION_KEY_PATTERN),
|
|
4237
|
+
table: string().min(1),
|
|
4238
|
+
type: _enum(["inner", "left"]),
|
|
4239
|
+
on: array(projectionJoinConditionSchema).min(1)
|
|
4240
|
+
});
|
|
4241
|
+
const projectionFieldBindingSchema = strictObject({ from: projectionRefSchema });
|
|
4242
|
+
const projectionIdentitySchema = union([
|
|
4333
4243
|
strictObject({
|
|
4334
|
-
|
|
4335
|
-
column
|
|
4244
|
+
kind: literal("base_pk"),
|
|
4245
|
+
/** Defaults to the discovered single-column PK of the base table. */
|
|
4246
|
+
column: string().min(1).optional()
|
|
4336
4247
|
}),
|
|
4337
4248
|
strictObject({
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
foreignKey: string().min(1)
|
|
4249
|
+
kind: literal("column"),
|
|
4250
|
+
from: projectionRefSchema
|
|
4341
4251
|
}),
|
|
4342
|
-
strictObject({
|
|
4252
|
+
strictObject({
|
|
4253
|
+
kind: literal("composite"),
|
|
4254
|
+
parts: array(projectionRefSchema).min(2)
|
|
4255
|
+
})
|
|
4343
4256
|
]);
|
|
4344
|
-
const
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
concept: union([_enum(CRM_CONCEPTS), literal(CUSTOM_CONCEPT)]),
|
|
4354
|
-
/** Host table (or view) this entity is derived from. */
|
|
4355
|
-
source: string().min(1),
|
|
4356
|
-
/**
|
|
4357
|
-
* Distinguishes multiple entities backed by the same table (e.g. "primary"
|
|
4358
|
-
* for owners, "secondary" for members). Free text; defaults to "primary".
|
|
4359
|
-
*/
|
|
4360
|
-
role: string().min(1).optional(),
|
|
4361
|
-
/** Predicate that narrows `source` into this entity's rows. Omit = whole table. */
|
|
4362
|
-
filter: filterSchema.optional(),
|
|
4363
|
-
/** clivlyField → sourceColumn. At least one field is required. */
|
|
4364
|
-
fields: record(string(), string()).refine((f) => Object.keys(f).length > 0, { message: "at least one field must be mapped" }),
|
|
4365
|
-
/**
|
|
4366
|
-
* Host-owned identity fields. Sync overwrites them; the CRM UI cannot edit
|
|
4367
|
-
* them. Must be a subset of `fields` keys.
|
|
4368
|
-
*/
|
|
4369
|
-
readOnly: array(string()).optional(),
|
|
4370
|
-
/** Named relationships to other entities in this config. */
|
|
4371
|
-
relationships: record(string(), relationshipSchema).optional(),
|
|
4372
|
-
/**
|
|
4373
|
-
* For a "custom" entity, the crm_object_types row this materializes into.
|
|
4374
|
-
* Required for custom (enforced at the API layer), unused for standard concepts.
|
|
4375
|
-
*/
|
|
4376
|
-
targetObjectTypeId: string().min(1).optional()
|
|
4377
|
-
});
|
|
4378
|
-
const entitiesConfigSchema = strictObject({ entities: record(string(), entitySchema).refine((e) => Object.keys(e).length > 0, { message: "at least one entity must be defined" }) });
|
|
4379
|
-
/** Thrown by `defineClivlyConfig({ strict: true })` on non-canonical field keys. */
|
|
4380
|
-
var ClivlyConfigError = class extends Error {
|
|
4381
|
-
issues;
|
|
4382
|
-
constructor(issues) {
|
|
4383
|
-
super(`Clivly config has ${issues.length} non-canonical field mapping(s) that would write empty values at sync time:\n${issues.map((issue) => ` - ${issue.path}: ${issue.message}`).join("\n")}`);
|
|
4384
|
-
this.name = "ClivlyConfigError";
|
|
4385
|
-
this.issues = issues;
|
|
4386
|
-
}
|
|
4387
|
-
};
|
|
4388
|
-
function nonCanonicalFieldKeys(entity) {
|
|
4389
|
-
const canonical = CANONICAL_FIELDS[entity.concept];
|
|
4390
|
-
if (!canonical) return [];
|
|
4391
|
-
return Object.keys(entity.fields).filter((key) => !canonical.includes(key));
|
|
4392
|
-
}
|
|
4393
|
-
function nonCanonicalMessage(entity, field) {
|
|
4394
|
-
const canonical = CANONICAL_FIELDS[entity.concept] ?? [];
|
|
4395
|
-
return `"${field}" is not a canonical ${entity.concept} field (expected one of: ${canonical.join(", ")})`;
|
|
4396
|
-
}
|
|
4397
|
-
function canonicalFieldIssues(config) {
|
|
4398
|
-
const issues = [];
|
|
4399
|
-
for (const [key, entity] of Object.entries(config.entities)) for (const field of nonCanonicalFieldKeys(entity)) issues.push({
|
|
4400
|
-
path: `entities.${key}.fields.${field}`,
|
|
4401
|
-
message: nonCanonicalMessage(entity, field)
|
|
4402
|
-
});
|
|
4403
|
-
return issues;
|
|
4404
|
-
}
|
|
4405
|
-
function defaultWarn(message) {
|
|
4406
|
-
console.warn(message);
|
|
4407
|
-
}
|
|
4257
|
+
const projectionSchema = strictObject({
|
|
4258
|
+
version: literal(1),
|
|
4259
|
+
kind: literal("projection"),
|
|
4260
|
+
entityKey: string().regex(PROJECTION_KEY_PATTERN),
|
|
4261
|
+
baseTable: string().min(1),
|
|
4262
|
+
joins: array(projectionJoinSchema),
|
|
4263
|
+
fieldBindings: record(string(), projectionFieldBindingSchema).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be bound" }),
|
|
4264
|
+
identity: projectionIdentitySchema
|
|
4265
|
+
});
|
|
4408
4266
|
/**
|
|
4409
|
-
*
|
|
4410
|
-
*
|
|
4411
|
-
* load rather than at sync time.
|
|
4412
|
-
*
|
|
4413
|
-
* It also catches the silent-data-loss footgun: a non-canonical field key for a
|
|
4414
|
-
* materialised concept (e.g. `fullName` instead of `name` on a `contact`) has no
|
|
4415
|
-
* destination column, so the store would write an empty value. By default these
|
|
4416
|
-
* are reported via `onWarn` (a `console.warn`); pass `{ strict: true }` to throw
|
|
4417
|
-
* a `ClivlyConfigError` instead. Does NOT validate against the host schema — that
|
|
4418
|
-
* needs the discovered schema; see `validateEntitiesConfig`.
|
|
4267
|
+
* Every column ref an identity depends on. `basePkColumn` is the base table's
|
|
4268
|
+
* discovered PK, used only when a `base_pk` identity omits an explicit column.
|
|
4419
4269
|
*/
|
|
4420
|
-
function
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
}
|
|
4428
|
-
return parsed;
|
|
4429
|
-
}
|
|
4430
|
-
/** Split a `table.column` / bare `column` ref into its parts. */
|
|
4431
|
-
function parseColumnRef(ref) {
|
|
4432
|
-
const dot = ref.indexOf(".");
|
|
4433
|
-
if (dot === -1) return { column: ref };
|
|
4434
|
-
return {
|
|
4435
|
-
table: ref.slice(0, dot),
|
|
4436
|
-
column: ref.slice(dot + 1)
|
|
4437
|
-
};
|
|
4270
|
+
function identityRefs(identity, basePkColumn) {
|
|
4271
|
+
if (identity.kind === "base_pk") return [{
|
|
4272
|
+
table: BASE_REF,
|
|
4273
|
+
column: identity.column ?? basePkColumn
|
|
4274
|
+
}];
|
|
4275
|
+
if (identity.kind === "column") return [identity.from];
|
|
4276
|
+
return identity.parts;
|
|
4438
4277
|
}
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
for (const table of schema) this.columnsByTable.set(table.name, new Set(table.columns));
|
|
4278
|
+
//#endregion
|
|
4279
|
+
Object.defineProperty(exports, "BASE_REF", {
|
|
4280
|
+
enumerable: true,
|
|
4281
|
+
get: function() {
|
|
4282
|
+
return BASE_REF;
|
|
4445
4283
|
}
|
|
4446
|
-
|
|
4447
|
-
|
|
4284
|
+
});
|
|
4285
|
+
Object.defineProperty(exports, "PROJECTION_KEY_PATTERN", {
|
|
4286
|
+
enumerable: true,
|
|
4287
|
+
get: function() {
|
|
4288
|
+
return PROJECTION_KEY_PATTERN;
|
|
4448
4289
|
}
|
|
4449
|
-
|
|
4450
|
-
|
|
4290
|
+
});
|
|
4291
|
+
Object.defineProperty(exports, "_enum", {
|
|
4292
|
+
enumerable: true,
|
|
4293
|
+
get: function() {
|
|
4294
|
+
return _enum;
|
|
4451
4295
|
}
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4296
|
+
});
|
|
4297
|
+
Object.defineProperty(exports, "array", {
|
|
4298
|
+
enumerable: true,
|
|
4299
|
+
get: function() {
|
|
4300
|
+
return array;
|
|
4457
4301
|
}
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
return
|
|
4302
|
+
});
|
|
4303
|
+
Object.defineProperty(exports, "boolean", {
|
|
4304
|
+
enumerable: true,
|
|
4305
|
+
get: function() {
|
|
4306
|
+
return boolean;
|
|
4463
4307
|
}
|
|
4464
|
-
};
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
function validateReadOnly(v, base, entity) {
|
|
4470
|
-
for (const field of entity.readOnly ?? []) if (!(field in entity.fields)) v.report(`${base}.readOnly`, `"${field}" is not one of this entity's fields`);
|
|
4471
|
-
}
|
|
4472
|
-
function validateFilter(v, base, entity) {
|
|
4473
|
-
if (!entity.filter || "$raw" in entity.filter) return;
|
|
4474
|
-
for (const column of Object.keys(entity.filter)) v.requireColumn(`${base}.filter.${column}`, entity.source, column);
|
|
4475
|
-
}
|
|
4476
|
-
function validateFkVia(v, relBase, via, entity, related) {
|
|
4477
|
-
const { table, column } = parseColumnRef(via.column);
|
|
4478
|
-
const fkTable = table ?? (via.fkOn === "contact" ? entity.source : related?.source);
|
|
4479
|
-
const path = `${relBase}.via.column`;
|
|
4480
|
-
if (!fkTable) {
|
|
4481
|
-
v.report(path, `cannot resolve table for FK column "${via.column}"`);
|
|
4482
|
-
return;
|
|
4308
|
+
});
|
|
4309
|
+
Object.defineProperty(exports, "identityRefs", {
|
|
4310
|
+
enumerable: true,
|
|
4311
|
+
get: function() {
|
|
4312
|
+
return identityRefs;
|
|
4483
4313
|
}
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4314
|
+
});
|
|
4315
|
+
Object.defineProperty(exports, "literal", {
|
|
4316
|
+
enumerable: true,
|
|
4317
|
+
get: function() {
|
|
4318
|
+
return literal;
|
|
4487
4319
|
}
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
return;
|
|
4320
|
+
});
|
|
4321
|
+
Object.defineProperty(exports, "number", {
|
|
4322
|
+
enumerable: true,
|
|
4323
|
+
get: function() {
|
|
4324
|
+
return number;
|
|
4494
4325
|
}
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
function
|
|
4499
|
-
|
|
4500
|
-
const related = config.entities[rel.entity];
|
|
4501
|
-
if (!related) v.report(`${relBase}.entity`, `"${rel.entity}" is not a defined entity`);
|
|
4502
|
-
const { via } = rel;
|
|
4503
|
-
if ("fkOn" in via) validateFkVia(v, relBase, via, entity, related);
|
|
4504
|
-
else if ("through" in via) validateThroughVia(v, relBase, via);
|
|
4505
|
-
}
|
|
4506
|
-
function validateEntity(v, config, key, entity) {
|
|
4507
|
-
const base = `entities.${key}`;
|
|
4508
|
-
if (!v.tableExists(entity.source)) {
|
|
4509
|
-
v.report(`${base}.source`, `table "${entity.source}" is not in the discovered schema`);
|
|
4510
|
-
return;
|
|
4326
|
+
});
|
|
4327
|
+
Object.defineProperty(exports, "projectionSchema", {
|
|
4328
|
+
enumerable: true,
|
|
4329
|
+
get: function() {
|
|
4330
|
+
return projectionSchema;
|
|
4511
4331
|
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4332
|
+
});
|
|
4333
|
+
Object.defineProperty(exports, "record", {
|
|
4334
|
+
enumerable: true,
|
|
4335
|
+
get: function() {
|
|
4336
|
+
return record;
|
|
4337
|
+
}
|
|
4338
|
+
});
|
|
4339
|
+
Object.defineProperty(exports, "strictObject", {
|
|
4340
|
+
enumerable: true,
|
|
4341
|
+
get: function() {
|
|
4342
|
+
return strictObject;
|
|
4343
|
+
}
|
|
4344
|
+
});
|
|
4345
|
+
Object.defineProperty(exports, "string", {
|
|
4346
|
+
enumerable: true,
|
|
4347
|
+
get: function() {
|
|
4348
|
+
return string;
|
|
4349
|
+
}
|
|
4350
|
+
});
|
|
4351
|
+
Object.defineProperty(exports, "union", {
|
|
4352
|
+
enumerable: true,
|
|
4353
|
+
get: function() {
|
|
4354
|
+
return union;
|
|
4355
|
+
}
|
|
4356
|
+
});
|