@atscript/db 0.1.123 → 0.1.125
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/dist/{db-view-CHAu4N3N.cjs → db-view-BP0Qbeux.cjs} +3 -9
- package/dist/{db-view-3yWBRiCf.mjs → db-view-C8rZM5_N.mjs} +3 -9
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/sync.cjs +1 -1
- package/dist/sync.mjs +1 -1
- package/dist/{validator-76GCYs80.mjs → validator-0vRXN51D.mjs} +31 -2
- package/dist/{validator-DbV4wTIJ.d.cts → validator-BcBtg8yW.d.cts} +15 -1
- package/dist/{validator-DbV4wTIJ.d.mts → validator-BcBtg8yW.d.mts} +15 -1
- package/dist/{validator-Cf9V8vP9.cjs → validator-CSGug4vg.cjs} +36 -1
- package/dist/validator.cjs +2 -1
- package/dist/validator.d.cts +2 -2
- package/dist/validator.d.mts +2 -2
- package/dist/validator.mjs +2 -2
- package/package.json +6 -6
|
@@ -2,7 +2,7 @@ const require_db_error = require("./db-error-DXwEzmYJ.cjs");
|
|
|
2
2
|
const require_agg = require("./agg.cjs");
|
|
3
3
|
const require_nested_writer = require("./nested-writer-DoDhl3X3.cjs");
|
|
4
4
|
const require_ops = require("./ops.cjs");
|
|
5
|
-
const require_validator = require("./validator-
|
|
5
|
+
const require_validator = require("./validator-CSGug4vg.cjs");
|
|
6
6
|
let _atscript_typescript_utils = require("@atscript/typescript/utils");
|
|
7
7
|
let node_async_hooks = require("node:async_hooks");
|
|
8
8
|
//#region src/logger.ts
|
|
@@ -3540,7 +3540,7 @@ var AtscriptDbTable = class extends AtscriptDbReadable {
|
|
|
3540
3540
|
const plugins = adapterPlugins.length ? [...adapterPlugins, require_validator.dbPlugin] : [require_validator.dbPlugin];
|
|
3541
3541
|
return this.createValidator({
|
|
3542
3542
|
plugins,
|
|
3543
|
-
partial: mode === "patch",
|
|
3543
|
+
partial: mode === "patch" ? require_validator.buildPatchPartial(this._meta.navFields) : false,
|
|
3544
3544
|
replace: (def, path) => {
|
|
3545
3545
|
const transformed = require_validator.forceNavNonOptional(def);
|
|
3546
3546
|
if (path === versionField && !transformed.optional) return {
|
|
@@ -3555,15 +3555,9 @@ var AtscriptDbTable = class extends AtscriptDbReadable {
|
|
|
3555
3555
|
}
|
|
3556
3556
|
if (purpose === "bulkUpdate") {
|
|
3557
3557
|
const plugins = adapterPlugins.length ? [...adapterPlugins, require_validator.dbPlugin] : [require_validator.dbPlugin];
|
|
3558
|
-
const navFields = this._meta.navFields;
|
|
3559
3558
|
return this.createValidator({
|
|
3560
3559
|
plugins,
|
|
3561
|
-
partial: (
|
|
3562
|
-
if (path === "") return true;
|
|
3563
|
-
const root = path.split(".")[0];
|
|
3564
|
-
if (navFields.has(root)) return true;
|
|
3565
|
-
return _def.metadata.get("db.patch.strategy") === "merge";
|
|
3566
|
-
},
|
|
3560
|
+
partial: require_validator.buildPatchPartial(this._meta.navFields),
|
|
3567
3561
|
replace: require_validator.forceNavNonOptional
|
|
3568
3562
|
});
|
|
3569
3563
|
}
|
|
@@ -2,7 +2,7 @@ import { n as DbError } from "./db-error-BHPXOKzc.mjs";
|
|
|
2
2
|
import { resolveAlias } from "./agg.mjs";
|
|
3
3
|
import { a as batchPatchNestedTo, c as batchReplaceNestedTo, d as preValidateNestedFrom, f as validateBatch, g as findRemoteFK, h as findFKForRelation, i as batchPatchNestedFrom, l as batchReplaceNestedVia, m as remapDeleteFkViolation, n as batchInsertNestedTo, o as batchPatchNestedVia, p as enrichFkViolation, r as batchInsertNestedVia, s as batchReplaceNestedFrom, t as batchInsertNestedFrom, u as checkDepthOverflow } from "./nested-writer-DI-HeTky.mjs";
|
|
4
4
|
import { separateCas, separateFieldOps } from "./ops.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { a as forceNavNonOptional, c as getKeyProps, i as dbPlugin, n as buildPatchPartial, t as buildDbValidator } from "./validator-0vRXN51D.mjs";
|
|
6
6
|
import { flattenAnnotatedType, isAnnotatedType } from "@atscript/typescript/utils";
|
|
7
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
8
|
//#region src/logger.ts
|
|
@@ -3540,7 +3540,7 @@ var AtscriptDbTable = class extends AtscriptDbReadable {
|
|
|
3540
3540
|
const plugins = adapterPlugins.length ? [...adapterPlugins, dbPlugin] : [dbPlugin];
|
|
3541
3541
|
return this.createValidator({
|
|
3542
3542
|
plugins,
|
|
3543
|
-
partial: mode === "patch",
|
|
3543
|
+
partial: mode === "patch" ? buildPatchPartial(this._meta.navFields) : false,
|
|
3544
3544
|
replace: (def, path) => {
|
|
3545
3545
|
const transformed = forceNavNonOptional(def);
|
|
3546
3546
|
if (path === versionField && !transformed.optional) return {
|
|
@@ -3555,15 +3555,9 @@ var AtscriptDbTable = class extends AtscriptDbReadable {
|
|
|
3555
3555
|
}
|
|
3556
3556
|
if (purpose === "bulkUpdate") {
|
|
3557
3557
|
const plugins = adapterPlugins.length ? [...adapterPlugins, dbPlugin] : [dbPlugin];
|
|
3558
|
-
const navFields = this._meta.navFields;
|
|
3559
3558
|
return this.createValidator({
|
|
3560
3559
|
plugins,
|
|
3561
|
-
partial: (
|
|
3562
|
-
if (path === "") return true;
|
|
3563
|
-
const root = path.split(".")[0];
|
|
3564
|
-
if (navFields.has(root)) return true;
|
|
3565
|
-
return _def.metadata.get("db.patch.strategy") === "merge";
|
|
3566
|
-
},
|
|
3560
|
+
partial: buildPatchPartial(this._meta.navFields),
|
|
3567
3561
|
replace: forceNavNonOptional
|
|
3568
3562
|
});
|
|
3569
3563
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_db_error = require("./db-error-DXwEzmYJ.cjs");
|
|
3
|
-
const require_db_view = require("./db-view-
|
|
3
|
+
const require_db_view = require("./db-view-BP0Qbeux.cjs");
|
|
4
4
|
const require_consts = require("./consts-BzRfCcH2.cjs");
|
|
5
5
|
const require_ops = require("./ops.cjs");
|
|
6
|
-
const require_validator = require("./validator-
|
|
6
|
+
const require_validator = require("./validator-CSGug4vg.cjs");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let _uniqu_core = require("@uniqu/core");
|
|
9
9
|
//#region src/encryption.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { $ as TIdentification, A as TDbActionLevel, B as TDbIndexType, C as TCas
|
|
|
2
2
|
import { a as $mul, c as $update, d as TDbFieldOp, f as TFieldOps, g as separateFieldOps, h as separateCas, i as $insert, l as $upsert, m as isDbFieldOp, n as $dec, o as $remove, p as getDbFieldOp, r as $inc, s as $replace, t as $cas, u as TDbCas } from "./ops-DJRnNTVo.cjs";
|
|
3
3
|
import { a as TViewColumnMapping, c as AtscriptQueryNode, d as TViewPlan, f as translateQueryTree, h as NativeIntegrity, i as AtscriptDbView, l as AtscriptRef, m as IntegrityStrategy, n as TAdapterFactory, o as AtscriptQueryComparison, p as AtscriptDbTable, r as TDbSpaceOptions, s as AtscriptQueryFieldRef, t as DbSpace, u as TViewJoin } from "./db-space-CSntT6yS.cjs";
|
|
4
4
|
import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
|
|
5
|
-
import {
|
|
5
|
+
import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, l as TArrayPatch, n as ValidatorMode, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-BcBtg8yW.cjs";
|
|
6
6
|
import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
|
|
7
7
|
|
|
8
8
|
//#region src/shared/consts.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { $ as TIdentification, A as TDbActionLevel, B as TDbIndexType, C as TCas
|
|
|
2
2
|
import { a as $mul, c as $update, d as TDbFieldOp, f as TFieldOps, g as separateFieldOps, h as separateCas, i as $insert, l as $upsert, m as isDbFieldOp, n as $dec, o as $remove, p as getDbFieldOp, r as $inc, s as $replace, t as $cas, u as TDbCas } from "./ops-DJRnNTVo.mjs";
|
|
3
3
|
import { a as TViewColumnMapping, c as AtscriptQueryNode, d as TViewPlan, f as translateQueryTree, h as NativeIntegrity, i as AtscriptDbView, l as AtscriptRef, m as IntegrityStrategy, n as TAdapterFactory, o as AtscriptQueryComparison, p as AtscriptDbTable, r as TDbSpaceOptions, s as AtscriptQueryFieldRef, t as DbSpace, u as TViewJoin } from "./db-space-B_ASuDaR.mjs";
|
|
4
4
|
import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, l as TArrayPatch, n as ValidatorMode, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-BcBtg8yW.mjs";
|
|
6
6
|
import { AggregateQuery as AggregateQuery$1, FilterExpr as FilterExpr$1, FilterVisitor, Uniquery as Uniquery$1, computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
|
|
7
7
|
|
|
8
8
|
//#region src/shared/consts.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as DbError, t as CasExhaustedError } from "./db-error-BHPXOKzc.mjs";
|
|
2
|
-
import { C as NoopLogger, S as isGeoPointType, _ as DocumentFieldMapper, a as ApplicationIntegrity, b as TableMetadata, c as IntegrityStrategy, d as resolveDesignType, f as assertGeoPoint, g as RelationalFieldMapper, h as guardQuery, i as decomposePatch, l as NativeIntegrity, m as guardFilter, n as AtscriptDbTable, o as BaseDbAdapter, p as guardAggregate, r as assertNoVersionWrites, s as createFailureCollector, t as AtscriptDbView, u as AtscriptDbReadable, v as FieldMappingStrategy, x as isGeoIndexableType, y as UniquSelect } from "./db-view-
|
|
2
|
+
import { C as NoopLogger, S as isGeoPointType, _ as DocumentFieldMapper, a as ApplicationIntegrity, b as TableMetadata, c as IntegrityStrategy, d as resolveDesignType, f as assertGeoPoint, g as RelationalFieldMapper, h as guardQuery, i as decomposePatch, l as NativeIntegrity, m as guardFilter, n as AtscriptDbTable, o as BaseDbAdapter, p as guardAggregate, r as assertNoVersionWrites, s as createFailureCollector, t as AtscriptDbView, u as AtscriptDbReadable, v as FieldMappingStrategy, x as isGeoIndexableType, y as UniquSelect } from "./db-view-C8rZM5_N.mjs";
|
|
3
3
|
import { t as DEFAULT_DB_SPACE } from "./consts-C_-5_pFq.mjs";
|
|
4
4
|
import { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, getDbFieldOp, isDbFieldOp, separateCas, separateFieldOps } from "./ops.mjs";
|
|
5
|
-
import { a as
|
|
5
|
+
import { a as forceNavNonOptional, c as getKeyProps, o as isNavRelation, r as buildValidationContext, s as createDbValidatorPlugin, t as buildDbValidator } from "./validator-0vRXN51D.mjs";
|
|
6
6
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
7
7
|
import { computeInsights, isPrimitive, walkFilter } from "@uniqu/core";
|
|
8
8
|
//#region src/encryption.ts
|
package/dist/sync.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_db_view = require("./db-view-
|
|
2
|
+
const require_db_view = require("./db-view-BP0Qbeux.cjs");
|
|
3
3
|
//#region src/schema/schema-hash.ts
|
|
4
4
|
/** Extracts sorted field snapshots from a readable's field descriptors. */
|
|
5
5
|
function extractFieldSnapshots(fields, typeMapper) {
|
package/dist/sync.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as NoopLogger } from "./db-view-
|
|
1
|
+
import { C as NoopLogger } from "./db-view-C8rZM5_N.mjs";
|
|
2
2
|
//#region src/schema/schema-hash.ts
|
|
3
3
|
/** Extracts sorted field snapshots from a readable's field descriptors. */
|
|
4
4
|
function extractFieldSnapshots(fields, typeMapper) {
|
|
@@ -311,11 +311,40 @@ function buildDbValidator(type, mode, extraPlugins, opts) {
|
|
|
311
311
|
const plugins = extraPlugins ? [...extraPlugins, dbPlugin] : [dbPlugin];
|
|
312
312
|
return type.validator({
|
|
313
313
|
plugins,
|
|
314
|
-
partial: mode === "patch",
|
|
314
|
+
partial: mode === "patch" ? buildPatchPartial(collectNavRoots(type)) : false,
|
|
315
315
|
replace: forceNavNonOptional,
|
|
316
316
|
...opts?.unknownProps ? { unknownProps: opts.unknownProps } : {}
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Path-aware `partial` callback for patch/update validation — the single
|
|
321
|
+
* implementation shared by the server's `bulkUpdate` validator and the
|
|
322
|
+
* client's patch preflight:
|
|
323
|
+
*
|
|
324
|
+
* - the root object is partial (a patch names only the fields it touches)
|
|
325
|
+
* - nav-relation subtrees are partial (nested data is validated by its own table)
|
|
326
|
+
* - `@db.patch.strategy "merge"` blocks are partial (the decomposer merges
|
|
327
|
+
* per leaf, so absent keys survive server-side by design)
|
|
328
|
+
*
|
|
329
|
+
* Every other nested object stays strict: non-merge blocks are `$set` as a
|
|
330
|
+
* whole (replace semantics), so their required fields really are required.
|
|
331
|
+
*/
|
|
332
|
+
function buildPatchPartial(navPaths) {
|
|
333
|
+
return (def, path) => {
|
|
334
|
+
if (path === "") return true;
|
|
335
|
+
const root = path.split(".")[0];
|
|
336
|
+
if (navPaths.has(root)) return true;
|
|
337
|
+
return def.metadata.get("db.patch.strategy") === "merge";
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/** Collects top-level nav-relation (TO/FROM/VIA) prop names from an object type. */
|
|
341
|
+
function collectNavRoots(type) {
|
|
342
|
+
const roots = /* @__PURE__ */ new Set();
|
|
343
|
+
if (type.type.kind === "object") {
|
|
344
|
+
for (const [key, prop] of type.type.props) if (isNavRelation(prop)) roots.add(key);
|
|
345
|
+
}
|
|
346
|
+
return roots;
|
|
347
|
+
}
|
|
319
348
|
/** Returns true if the annotated type is a navigation relation (TO/FROM/VIA). */
|
|
320
349
|
function isNavRelation(type) {
|
|
321
350
|
return !!type.metadata && (type.metadata.has("db.rel.to") || type.metadata.has("db.rel.from") || type.metadata.has("db.rel.via"));
|
|
@@ -354,4 +383,4 @@ function buildValidationContext(type) {
|
|
|
354
383
|
};
|
|
355
384
|
}
|
|
356
385
|
//#endregion
|
|
357
|
-
export {
|
|
386
|
+
export { forceNavNonOptional as a, getKeyProps as c, dbPlugin as i, buildPatchPartial as n, isNavRelation as o, buildValidationContext as r, createDbValidatorPlugin as s, buildDbValidator as t };
|
|
@@ -46,6 +46,20 @@ declare const dbPlugin: TValidatorPlugin;
|
|
|
46
46
|
declare function buildDbValidator(type: TAtscriptAnnotatedType, mode: ValidatorMode, extraPlugins?: TValidatorPlugin[], opts?: {
|
|
47
47
|
unknownProps?: "strip" | "ignore" | "error";
|
|
48
48
|
}): Validator<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Path-aware `partial` callback for patch/update validation — the single
|
|
51
|
+
* implementation shared by the server's `bulkUpdate` validator and the
|
|
52
|
+
* client's patch preflight:
|
|
53
|
+
*
|
|
54
|
+
* - the root object is partial (a patch names only the fields it touches)
|
|
55
|
+
* - nav-relation subtrees are partial (nested data is validated by its own table)
|
|
56
|
+
* - `@db.patch.strategy "merge"` blocks are partial (the decomposer merges
|
|
57
|
+
* per leaf, so absent keys survive server-side by design)
|
|
58
|
+
*
|
|
59
|
+
* Every other nested object stays strict: non-merge blocks are `$set` as a
|
|
60
|
+
* whole (replace semantics), so their required fields really are required.
|
|
61
|
+
*/
|
|
62
|
+
declare function buildPatchPartial(navPaths: ReadonlySet<string>): (def: TAtscriptAnnotatedType<TAtscriptTypeObject>, path: string) => boolean;
|
|
49
63
|
/** Returns true if the annotated type is a navigation relation (TO/FROM/VIA). */
|
|
50
64
|
declare function isNavRelation(type: TAtscriptAnnotatedType): boolean;
|
|
51
65
|
/**
|
|
@@ -71,4 +85,4 @@ interface ValidationContext {
|
|
|
71
85
|
*/
|
|
72
86
|
declare function buildValidationContext(type: TAtscriptAnnotatedType<TAtscriptTypeObject>): ValidationContext;
|
|
73
87
|
//#endregion
|
|
74
|
-
export {
|
|
88
|
+
export { buildValidationContext as a, isNavRelation as c, getKeyProps as d, buildPatchPartial as i, TArrayPatch as l, ValidatorMode as n, dbPlugin as o, buildDbValidator as r, forceNavNonOptional as s, ValidationContext as t, TDbPatch as u };
|
|
@@ -46,6 +46,20 @@ declare const dbPlugin: TValidatorPlugin;
|
|
|
46
46
|
declare function buildDbValidator(type: TAtscriptAnnotatedType, mode: ValidatorMode, extraPlugins?: TValidatorPlugin[], opts?: {
|
|
47
47
|
unknownProps?: "strip" | "ignore" | "error";
|
|
48
48
|
}): Validator<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Path-aware `partial` callback for patch/update validation — the single
|
|
51
|
+
* implementation shared by the server's `bulkUpdate` validator and the
|
|
52
|
+
* client's patch preflight:
|
|
53
|
+
*
|
|
54
|
+
* - the root object is partial (a patch names only the fields it touches)
|
|
55
|
+
* - nav-relation subtrees are partial (nested data is validated by its own table)
|
|
56
|
+
* - `@db.patch.strategy "merge"` blocks are partial (the decomposer merges
|
|
57
|
+
* per leaf, so absent keys survive server-side by design)
|
|
58
|
+
*
|
|
59
|
+
* Every other nested object stays strict: non-merge blocks are `$set` as a
|
|
60
|
+
* whole (replace semantics), so their required fields really are required.
|
|
61
|
+
*/
|
|
62
|
+
declare function buildPatchPartial(navPaths: ReadonlySet<string>): (def: TAtscriptAnnotatedType<TAtscriptTypeObject>, path: string) => boolean;
|
|
49
63
|
/** Returns true if the annotated type is a navigation relation (TO/FROM/VIA). */
|
|
50
64
|
declare function isNavRelation(type: TAtscriptAnnotatedType): boolean;
|
|
51
65
|
/**
|
|
@@ -71,4 +85,4 @@ interface ValidationContext {
|
|
|
71
85
|
*/
|
|
72
86
|
declare function buildValidationContext(type: TAtscriptAnnotatedType<TAtscriptTypeObject>): ValidationContext;
|
|
73
87
|
//#endregion
|
|
74
|
-
export {
|
|
88
|
+
export { buildValidationContext as a, isNavRelation as c, getKeyProps as d, buildPatchPartial as i, TArrayPatch as l, ValidatorMode as n, dbPlugin as o, buildDbValidator as r, forceNavNonOptional as s, ValidationContext as t, TDbPatch as u };
|
|
@@ -311,11 +311,40 @@ function buildDbValidator(type, mode, extraPlugins, opts) {
|
|
|
311
311
|
const plugins = extraPlugins ? [...extraPlugins, dbPlugin] : [dbPlugin];
|
|
312
312
|
return type.validator({
|
|
313
313
|
plugins,
|
|
314
|
-
partial: mode === "patch",
|
|
314
|
+
partial: mode === "patch" ? buildPatchPartial(collectNavRoots(type)) : false,
|
|
315
315
|
replace: forceNavNonOptional,
|
|
316
316
|
...opts?.unknownProps ? { unknownProps: opts.unknownProps } : {}
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Path-aware `partial` callback for patch/update validation — the single
|
|
321
|
+
* implementation shared by the server's `bulkUpdate` validator and the
|
|
322
|
+
* client's patch preflight:
|
|
323
|
+
*
|
|
324
|
+
* - the root object is partial (a patch names only the fields it touches)
|
|
325
|
+
* - nav-relation subtrees are partial (nested data is validated by its own table)
|
|
326
|
+
* - `@db.patch.strategy "merge"` blocks are partial (the decomposer merges
|
|
327
|
+
* per leaf, so absent keys survive server-side by design)
|
|
328
|
+
*
|
|
329
|
+
* Every other nested object stays strict: non-merge blocks are `$set` as a
|
|
330
|
+
* whole (replace semantics), so their required fields really are required.
|
|
331
|
+
*/
|
|
332
|
+
function buildPatchPartial(navPaths) {
|
|
333
|
+
return (def, path) => {
|
|
334
|
+
if (path === "") return true;
|
|
335
|
+
const root = path.split(".")[0];
|
|
336
|
+
if (navPaths.has(root)) return true;
|
|
337
|
+
return def.metadata.get("db.patch.strategy") === "merge";
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/** Collects top-level nav-relation (TO/FROM/VIA) prop names from an object type. */
|
|
341
|
+
function collectNavRoots(type) {
|
|
342
|
+
const roots = /* @__PURE__ */ new Set();
|
|
343
|
+
if (type.type.kind === "object") {
|
|
344
|
+
for (const [key, prop] of type.type.props) if (isNavRelation(prop)) roots.add(key);
|
|
345
|
+
}
|
|
346
|
+
return roots;
|
|
347
|
+
}
|
|
319
348
|
/** Returns true if the annotated type is a navigation relation (TO/FROM/VIA). */
|
|
320
349
|
function isNavRelation(type) {
|
|
321
350
|
return !!type.metadata && (type.metadata.has("db.rel.to") || type.metadata.has("db.rel.from") || type.metadata.has("db.rel.via"));
|
|
@@ -360,6 +389,12 @@ Object.defineProperty(exports, "buildDbValidator", {
|
|
|
360
389
|
return buildDbValidator;
|
|
361
390
|
}
|
|
362
391
|
});
|
|
392
|
+
Object.defineProperty(exports, "buildPatchPartial", {
|
|
393
|
+
enumerable: true,
|
|
394
|
+
get: function() {
|
|
395
|
+
return buildPatchPartial;
|
|
396
|
+
}
|
|
397
|
+
});
|
|
363
398
|
Object.defineProperty(exports, "buildValidationContext", {
|
|
364
399
|
enumerable: true,
|
|
365
400
|
get: function() {
|
package/dist/validator.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_ops = require("./ops.cjs");
|
|
3
|
-
const require_validator = require("./validator-
|
|
3
|
+
const require_validator = require("./validator-CSGug4vg.cjs");
|
|
4
4
|
exports.$cas = require_ops.$cas;
|
|
5
5
|
exports.$dec = require_ops.$dec;
|
|
6
6
|
exports.$inc = require_ops.$inc;
|
|
@@ -11,6 +11,7 @@ exports.$replace = require_ops.$replace;
|
|
|
11
11
|
exports.$update = require_ops.$update;
|
|
12
12
|
exports.$upsert = require_ops.$upsert;
|
|
13
13
|
exports.buildDbValidator = require_validator.buildDbValidator;
|
|
14
|
+
exports.buildPatchPartial = require_validator.buildPatchPartial;
|
|
14
15
|
exports.buildValidationContext = require_validator.buildValidationContext;
|
|
15
16
|
exports.createDbValidatorPlugin = require_validator.createDbValidatorPlugin;
|
|
16
17
|
exports.dbPlugin = require_validator.dbPlugin;
|
package/dist/validator.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as $mul, c as $update, d as TDbFieldOp, i as $insert, l as $upsert, m as isDbFieldOp, n as $dec, o as $remove, r as $inc, s as $replace, t as $cas, u as TDbCas } from "./ops-DJRnNTVo.cjs";
|
|
2
2
|
import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
|
|
3
|
-
import { a as
|
|
4
|
-
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, type DbValidationContext, type TArrayPatch, type TDbCas, type TDbFieldOp, type TDbPatch, ValidationContext, ValidatorMode, buildDbValidator, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isNavRelation };
|
|
3
|
+
import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, i as buildPatchPartial, l as TArrayPatch, n as ValidatorMode, o as dbPlugin, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-BcBtg8yW.cjs";
|
|
4
|
+
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, type DbValidationContext, type TArrayPatch, type TDbCas, type TDbFieldOp, type TDbPatch, ValidationContext, ValidatorMode, buildDbValidator, buildPatchPartial, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isNavRelation };
|
package/dist/validator.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as $mul, c as $update, d as TDbFieldOp, i as $insert, l as $upsert, m as isDbFieldOp, n as $dec, o as $remove, r as $inc, s as $replace, t as $cas, u as TDbCas } from "./ops-DJRnNTVo.mjs";
|
|
2
2
|
import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
|
|
3
|
-
import { a as
|
|
4
|
-
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, type DbValidationContext, type TArrayPatch, type TDbCas, type TDbFieldOp, type TDbPatch, ValidationContext, ValidatorMode, buildDbValidator, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isNavRelation };
|
|
3
|
+
import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, i as buildPatchPartial, l as TArrayPatch, n as ValidatorMode, o as dbPlugin, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-BcBtg8yW.mjs";
|
|
4
|
+
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, type DbValidationContext, type TArrayPatch, type TDbCas, type TDbFieldOp, type TDbPatch, ValidationContext, ValidatorMode, buildDbValidator, buildPatchPartial, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isNavRelation };
|
package/dist/validator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, isDbFieldOp } from "./ops.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, buildDbValidator, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isNavRelation };
|
|
2
|
+
import { a as forceNavNonOptional, c as getKeyProps, i as dbPlugin, n as buildPatchPartial, o as isNavRelation, r as buildValidationContext, s as createDbValidatorPlugin, t as buildDbValidator } from "./validator-0vRXN51D.mjs";
|
|
3
|
+
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, buildDbValidator, buildPatchPartial, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isNavRelation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.125",
|
|
4
4
|
"description": "Database adapter utilities for atscript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atscript",
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@atscript/core": "^0.1.
|
|
75
|
-
"@atscript/typescript": "^0.1.
|
|
74
|
+
"@atscript/core": "^0.1.86",
|
|
75
|
+
"@atscript/typescript": "^0.1.86",
|
|
76
76
|
"@uniqu/core": "^0.1.7",
|
|
77
|
-
"unplugin-atscript": "^0.1.
|
|
77
|
+
"unplugin-atscript": "^0.1.86"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@atscript/core": "^0.1.
|
|
81
|
-
"@atscript/typescript": "^0.1.
|
|
80
|
+
"@atscript/core": "^0.1.86",
|
|
81
|
+
"@atscript/typescript": "^0.1.86",
|
|
82
82
|
"@uniqu/core": "^0.1.7"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|