@atscript/db 0.1.142 → 0.1.143
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/agg.d.cts +1 -1
- package/dist/agg.d.mts +1 -1
- package/dist/{buckets-Bv4pah66.d.cts → buckets-Ba5lP_o9.d.cts} +358 -17
- package/dist/{buckets-CjL7F-hp.d.mts → buckets-BlJ4cdlr.d.mts} +358 -17
- package/dist/{column-diff-DiBbXyLA.d.cts → column-diff-BlGxPobU.d.cts} +1 -1
- package/dist/{column-diff-CfPNcP6e.cjs → column-diff-D_Kyuh0S.cjs} +906 -209
- package/dist/{column-diff-n-k5KY0u.d.mts → column-diff-PqA_edXA.d.mts} +1 -1
- package/dist/{column-diff-CmFNXV8C.mjs → column-diff-e2oHc71_.mjs} +850 -177
- package/dist/index.cjs +16 -10
- package/dist/index.d.cts +30 -5
- package/dist/index.d.mts +30 -5
- package/dist/index.mjs +6 -5
- package/dist/nested-writer-CnOOAehr.mjs +880 -0
- package/dist/nested-writer-xfQwxplL.cjs +1029 -0
- package/dist/{object-DSN0h9lB.d.cts → object-CtPYTIvy.d.cts} +3 -1
- package/dist/{object-DSN0h9lB.d.mts → object-CtPYTIvy.d.mts} +3 -1
- package/dist/object-Djg28csK.cjs +101 -0
- package/dist/object-TkiJQ-Dp.mjs +66 -0
- package/dist/rel.cjs +5 -2
- package/dist/rel.d.cts +76 -10
- package/dist/rel.d.mts +76 -10
- package/dist/rel.mjs +3 -3
- package/dist/{relation-helpers-B59to_dG.d.mts → relation-helpers-JTEyZzVd.d.cts} +1 -1
- package/dist/{relation-helpers-DQ_nRsV9.d.cts → relation-helpers-MTwzaSGA.d.mts} +1 -1
- package/dist/{relation-loader-CgJ8bK6X.cjs → relation-loader-CBPY6kM7.cjs} +1 -1
- package/dist/{relation-loader-CuhEBzFU.mjs → relation-loader-D9XuXaMv.mjs} +1 -1
- package/dist/sync.cjs +1 -1
- package/dist/sync.d.cts +2 -2
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +1 -1
- package/dist/{validator-DASnXf1j.cjs → validator-CVS-onRg.cjs} +0 -101
- package/dist/{validator-D8bPsXPN.mjs → validator-Clu2q_7z.mjs} +1 -66
- package/dist/validator.cjs +4 -3
- package/dist/validator.d.cts +1 -1
- package/dist/validator.d.mts +1 -1
- package/dist/validator.mjs +2 -1
- package/package.json +1 -1
- package/dist/nested-writer-BO3vhbkP.mjs +0 -661
- package/dist/nested-writer-DYsRxZ5f.cjs +0 -768
|
@@ -1,71 +1,6 @@
|
|
|
1
1
|
const require_db_error = require("./db-error-DTkkeu5b.cjs");
|
|
2
2
|
const require_ops = require("./ops.cjs");
|
|
3
3
|
let _atscript_typescript_utils = require("@atscript/typescript/utils");
|
|
4
|
-
//#region src/shared/object.ts
|
|
5
|
-
/**
|
|
6
|
-
* Plain object: prototype is `Object.prototype` or `null` — never a class
|
|
7
|
-
* instance (`Date`, `Uint8Array`, `ObjectId`, …) and never an array.
|
|
8
|
-
* Browser-safe; shared by the write paths, the HTTP shape gate and the client.
|
|
9
|
-
*/
|
|
10
|
-
function isPlainObject(value) {
|
|
11
|
-
if (typeof value !== "object" || value === null) return false;
|
|
12
|
-
const proto = Object.getPrototypeOf(value);
|
|
13
|
-
return proto === Object.prototype || proto === null;
|
|
14
|
-
}
|
|
15
|
-
/** Zero-allocation emptiness check for a plain object (`{}` → `true`). */
|
|
16
|
-
function isEmptyObject(obj) {
|
|
17
|
-
for (const _ in obj) return false;
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Finds the nearest ancestor of `path` that belongs to `set`.
|
|
22
|
-
* Used by both the build pipeline (in `_classifyFields`) and
|
|
23
|
-
* runtime reconstruction on the Readable.
|
|
24
|
-
*/
|
|
25
|
-
function findAncestorInSet(path, set) {
|
|
26
|
-
let pos = path.length;
|
|
27
|
-
while ((pos = path.lastIndexOf(".", pos - 1)) !== -1) {
|
|
28
|
-
const ancestor = path.slice(0, pos);
|
|
29
|
-
if (set.has(ancestor)) return ancestor;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/** `path` itself if it is in `set`, else its nearest ancestor in `set` ({@link findAncestorInSet}). */
|
|
33
|
-
function selfOrAncestor(path, set) {
|
|
34
|
-
return set.has(path) ? path : findAncestorInSet(path, set);
|
|
35
|
-
}
|
|
36
|
-
/** Splits a dot-path once; an already split path is used as-is. */
|
|
37
|
-
function segmentsOf(path) {
|
|
38
|
-
return typeof path === "string" ? path.split(".") : path;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Reads a dot-path (or its segments) off a nested plain object: `undefined`
|
|
42
|
-
* past a missing step, or a step that is not a plain object (arrays are not
|
|
43
|
-
* descended into — no positional indexing).
|
|
44
|
-
* @since 0.1.141
|
|
45
|
-
*/
|
|
46
|
-
function getPath(row, path) {
|
|
47
|
-
let current = row;
|
|
48
|
-
for (const seg of segmentsOf(path)) {
|
|
49
|
-
if (current === null || typeof current !== "object" || Array.isArray(current)) return;
|
|
50
|
-
current = current[seg];
|
|
51
|
-
}
|
|
52
|
-
return current;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Deletes a dot-path (or its segments) from a nested plain object; a no-op
|
|
56
|
-
* when an intermediate step is missing or not a plain object.
|
|
57
|
-
* @since 0.1.141
|
|
58
|
-
*/
|
|
59
|
-
function deletePath(target, path) {
|
|
60
|
-
const segments = segmentsOf(path);
|
|
61
|
-
let current = target;
|
|
62
|
-
for (let i = 0; i < segments.length - 1; i++) {
|
|
63
|
-
if (current === null || typeof current !== "object" || Array.isArray(current)) return;
|
|
64
|
-
current = current[segments[i]];
|
|
65
|
-
}
|
|
66
|
-
if (current !== null && typeof current === "object" && !Array.isArray(current)) delete current[segments[segments.length - 1]];
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
4
|
//#region src/patch/patch-types.ts
|
|
70
5
|
/**
|
|
71
6
|
* Extracts `@expect.array.key` properties from an array-of-objects type.
|
|
@@ -482,18 +417,6 @@ Object.defineProperty(exports, "dbPlugin", {
|
|
|
482
417
|
return dbPlugin;
|
|
483
418
|
}
|
|
484
419
|
});
|
|
485
|
-
Object.defineProperty(exports, "deletePath", {
|
|
486
|
-
enumerable: true,
|
|
487
|
-
get: function() {
|
|
488
|
-
return deletePath;
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
Object.defineProperty(exports, "findAncestorInSet", {
|
|
492
|
-
enumerable: true,
|
|
493
|
-
get: function() {
|
|
494
|
-
return findAncestorInSet;
|
|
495
|
-
}
|
|
496
|
-
});
|
|
497
420
|
Object.defineProperty(exports, "forceNavNonOptional", {
|
|
498
421
|
enumerable: true,
|
|
499
422
|
get: function() {
|
|
@@ -506,33 +429,9 @@ Object.defineProperty(exports, "getKeyProps", {
|
|
|
506
429
|
return getKeyProps;
|
|
507
430
|
}
|
|
508
431
|
});
|
|
509
|
-
Object.defineProperty(exports, "getPath", {
|
|
510
|
-
enumerable: true,
|
|
511
|
-
get: function() {
|
|
512
|
-
return getPath;
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
Object.defineProperty(exports, "isEmptyObject", {
|
|
516
|
-
enumerable: true,
|
|
517
|
-
get: function() {
|
|
518
|
-
return isEmptyObject;
|
|
519
|
-
}
|
|
520
|
-
});
|
|
521
432
|
Object.defineProperty(exports, "isNavRelation", {
|
|
522
433
|
enumerable: true,
|
|
523
434
|
get: function() {
|
|
524
435
|
return isNavRelation;
|
|
525
436
|
}
|
|
526
437
|
});
|
|
527
|
-
Object.defineProperty(exports, "isPlainObject", {
|
|
528
|
-
enumerable: true,
|
|
529
|
-
get: function() {
|
|
530
|
-
return isPlainObject;
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
Object.defineProperty(exports, "selfOrAncestor", {
|
|
534
|
-
enumerable: true,
|
|
535
|
-
get: function() {
|
|
536
|
-
return selfOrAncestor;
|
|
537
|
-
}
|
|
538
|
-
});
|
|
@@ -1,71 +1,6 @@
|
|
|
1
1
|
import { i as DepthLimitExceededError } from "./db-error-D5uilS_A.mjs";
|
|
2
2
|
import { isDbFieldOp } from "./ops.mjs";
|
|
3
3
|
import { flattenAnnotatedType } from "@atscript/typescript/utils";
|
|
4
|
-
//#region src/shared/object.ts
|
|
5
|
-
/**
|
|
6
|
-
* Plain object: prototype is `Object.prototype` or `null` — never a class
|
|
7
|
-
* instance (`Date`, `Uint8Array`, `ObjectId`, …) and never an array.
|
|
8
|
-
* Browser-safe; shared by the write paths, the HTTP shape gate and the client.
|
|
9
|
-
*/
|
|
10
|
-
function isPlainObject(value) {
|
|
11
|
-
if (typeof value !== "object" || value === null) return false;
|
|
12
|
-
const proto = Object.getPrototypeOf(value);
|
|
13
|
-
return proto === Object.prototype || proto === null;
|
|
14
|
-
}
|
|
15
|
-
/** Zero-allocation emptiness check for a plain object (`{}` → `true`). */
|
|
16
|
-
function isEmptyObject(obj) {
|
|
17
|
-
for (const _ in obj) return false;
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Finds the nearest ancestor of `path` that belongs to `set`.
|
|
22
|
-
* Used by both the build pipeline (in `_classifyFields`) and
|
|
23
|
-
* runtime reconstruction on the Readable.
|
|
24
|
-
*/
|
|
25
|
-
function findAncestorInSet(path, set) {
|
|
26
|
-
let pos = path.length;
|
|
27
|
-
while ((pos = path.lastIndexOf(".", pos - 1)) !== -1) {
|
|
28
|
-
const ancestor = path.slice(0, pos);
|
|
29
|
-
if (set.has(ancestor)) return ancestor;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/** `path` itself if it is in `set`, else its nearest ancestor in `set` ({@link findAncestorInSet}). */
|
|
33
|
-
function selfOrAncestor(path, set) {
|
|
34
|
-
return set.has(path) ? path : findAncestorInSet(path, set);
|
|
35
|
-
}
|
|
36
|
-
/** Splits a dot-path once; an already split path is used as-is. */
|
|
37
|
-
function segmentsOf(path) {
|
|
38
|
-
return typeof path === "string" ? path.split(".") : path;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Reads a dot-path (or its segments) off a nested plain object: `undefined`
|
|
42
|
-
* past a missing step, or a step that is not a plain object (arrays are not
|
|
43
|
-
* descended into — no positional indexing).
|
|
44
|
-
* @since 0.1.141
|
|
45
|
-
*/
|
|
46
|
-
function getPath(row, path) {
|
|
47
|
-
let current = row;
|
|
48
|
-
for (const seg of segmentsOf(path)) {
|
|
49
|
-
if (current === null || typeof current !== "object" || Array.isArray(current)) return;
|
|
50
|
-
current = current[seg];
|
|
51
|
-
}
|
|
52
|
-
return current;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Deletes a dot-path (or its segments) from a nested plain object; a no-op
|
|
56
|
-
* when an intermediate step is missing or not a plain object.
|
|
57
|
-
* @since 0.1.141
|
|
58
|
-
*/
|
|
59
|
-
function deletePath(target, path) {
|
|
60
|
-
const segments = segmentsOf(path);
|
|
61
|
-
let current = target;
|
|
62
|
-
for (let i = 0; i < segments.length - 1; i++) {
|
|
63
|
-
if (current === null || typeof current !== "object" || Array.isArray(current)) return;
|
|
64
|
-
current = current[segments[i]];
|
|
65
|
-
}
|
|
66
|
-
if (current !== null && typeof current === "object" && !Array.isArray(current)) delete current[segments[segments.length - 1]];
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
4
|
//#region src/patch/patch-types.ts
|
|
70
5
|
/**
|
|
71
6
|
* Extracts `@expect.array.key` properties from an array-of-objects type.
|
|
@@ -452,4 +387,4 @@ function buildValidationContext(type) {
|
|
|
452
387
|
};
|
|
453
388
|
}
|
|
454
389
|
//#endregion
|
|
455
|
-
export { forceNavNonOptional as a, getKeyProps as c,
|
|
390
|
+
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 };
|
package/dist/validator.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_db_error = require("./db-error-DTkkeu5b.cjs");
|
|
3
|
-
const
|
|
3
|
+
const require_object = require("./object-Djg28csK.cjs");
|
|
4
4
|
const require_ops = require("./ops.cjs");
|
|
5
|
+
const require_validator = require("./validator-CVS-onRg.cjs");
|
|
5
6
|
exports.$cas = require_ops.$cas;
|
|
6
7
|
exports.$dec = require_ops.$dec;
|
|
7
8
|
exports.$inc = require_ops.$inc;
|
|
@@ -20,8 +21,8 @@ exports.dbPlugin = require_validator.dbPlugin;
|
|
|
20
21
|
exports.forceNavNonOptional = require_validator.forceNavNonOptional;
|
|
21
22
|
exports.getKeyProps = require_validator.getKeyProps;
|
|
22
23
|
exports.isDbFieldOp = require_ops.isDbFieldOp;
|
|
23
|
-
exports.isEmptyObject =
|
|
24
|
+
exports.isEmptyObject = require_object.isEmptyObject;
|
|
24
25
|
exports.isNavRelation = require_validator.isNavRelation;
|
|
25
|
-
exports.isPlainObject =
|
|
26
|
+
exports.isPlainObject = require_object.isPlainObject;
|
|
26
27
|
exports.reconcileCas = require_ops.reconcileCas;
|
|
27
28
|
exports.separateCas = require_ops.separateCas;
|
package/dist/validator.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as $mul, c as $update, d as TDbFieldOp, g as separateCas, h as reconcileCas, 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-AqhV7s9o.cjs";
|
|
2
|
-
import { a as isPlainObject, i as isEmptyObject } from "./object-
|
|
2
|
+
import { a as isPlainObject, i as isEmptyObject } from "./object-CtPYTIvy.cjs";
|
|
3
3
|
import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, i as buildPatchPartial, l as TArrayPatch, m as DbError, n as ValidatorMode, o as dbPlugin, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-Bw6ks9Hy.cjs";
|
|
4
4
|
import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.cjs";
|
|
5
5
|
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, DbError, type DbValidationContext, type TArrayPatch, type TDbCas, type TDbFieldOp, type TDbPatch, ValidationContext, ValidatorMode, buildDbValidator, buildPatchPartial, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isEmptyObject, isNavRelation, isPlainObject, reconcileCas, separateCas };
|
package/dist/validator.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as $mul, c as $update, d as TDbFieldOp, g as separateCas, h as reconcileCas, 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-AqhV7s9o.mjs";
|
|
2
|
-
import { a as isPlainObject, i as isEmptyObject } from "./object-
|
|
2
|
+
import { a as isPlainObject, i as isEmptyObject } from "./object-CtPYTIvy.mjs";
|
|
3
3
|
import { a as buildValidationContext, c as isNavRelation, d as getKeyProps, i as buildPatchPartial, l as TArrayPatch, m as DbError, n as ValidatorMode, o as dbPlugin, r as buildDbValidator, s as forceNavNonOptional, t as ValidationContext, u as TDbPatch } from "./validator-Bw6ks9Hy.mjs";
|
|
4
4
|
import { n as createDbValidatorPlugin, t as DbValidationContext } from "./db-validator-plugin-BWy60OvG.mjs";
|
|
5
5
|
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, DbError, type DbValidationContext, type TArrayPatch, type TDbCas, type TDbFieldOp, type TDbPatch, ValidationContext, ValidatorMode, buildDbValidator, buildPatchPartial, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isEmptyObject, isNavRelation, isPlainObject, reconcileCas, separateCas };
|
package/dist/validator.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { r as DbError } from "./db-error-D5uilS_A.mjs";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as isPlainObject, i as isEmptyObject } from "./object-TkiJQ-Dp.mjs";
|
|
3
3
|
import { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, isDbFieldOp, reconcileCas, separateCas } from "./ops.mjs";
|
|
4
|
+
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-Clu2q_7z.mjs";
|
|
4
5
|
export { $cas, $dec, $inc, $insert, $mul, $remove, $replace, $update, $upsert, DbError, buildDbValidator, buildPatchPartial, buildValidationContext, createDbValidatorPlugin, dbPlugin, forceNavNonOptional, getKeyProps, isDbFieldOp, isEmptyObject, isNavRelation, isPlainObject, reconcileCas, separateCas };
|