@atscript/db 0.1.142 → 0.1.144

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.
Files changed (39) hide show
  1. package/dist/agg.d.cts +1 -1
  2. package/dist/agg.d.mts +1 -1
  3. package/dist/{buckets-Bv4pah66.d.cts → buckets-Ba5lP_o9.d.cts} +358 -17
  4. package/dist/{buckets-CjL7F-hp.d.mts → buckets-BlJ4cdlr.d.mts} +358 -17
  5. package/dist/{column-diff-DiBbXyLA.d.cts → column-diff-BlGxPobU.d.cts} +1 -1
  6. package/dist/{column-diff-CfPNcP6e.cjs → column-diff-D_Kyuh0S.cjs} +906 -209
  7. package/dist/{column-diff-n-k5KY0u.d.mts → column-diff-PqA_edXA.d.mts} +1 -1
  8. package/dist/{column-diff-CmFNXV8C.mjs → column-diff-e2oHc71_.mjs} +850 -177
  9. package/dist/index.cjs +16 -10
  10. package/dist/index.d.cts +30 -5
  11. package/dist/index.d.mts +30 -5
  12. package/dist/index.mjs +6 -5
  13. package/dist/nested-writer-CnOOAehr.mjs +880 -0
  14. package/dist/nested-writer-xfQwxplL.cjs +1029 -0
  15. package/dist/{object-DSN0h9lB.d.cts → object-CtPYTIvy.d.cts} +3 -1
  16. package/dist/{object-DSN0h9lB.d.mts → object-CtPYTIvy.d.mts} +3 -1
  17. package/dist/object-Djg28csK.cjs +101 -0
  18. package/dist/object-TkiJQ-Dp.mjs +66 -0
  19. package/dist/rel.cjs +5 -2
  20. package/dist/rel.d.cts +76 -10
  21. package/dist/rel.d.mts +76 -10
  22. package/dist/rel.mjs +3 -3
  23. package/dist/{relation-helpers-B59to_dG.d.mts → relation-helpers-JTEyZzVd.d.cts} +1 -1
  24. package/dist/{relation-helpers-DQ_nRsV9.d.cts → relation-helpers-MTwzaSGA.d.mts} +1 -1
  25. package/dist/{relation-loader-CgJ8bK6X.cjs → relation-loader-CBPY6kM7.cjs} +1 -1
  26. package/dist/{relation-loader-CuhEBzFU.mjs → relation-loader-D9XuXaMv.mjs} +1 -1
  27. package/dist/sync.cjs +1 -1
  28. package/dist/sync.d.cts +2 -2
  29. package/dist/sync.d.mts +2 -2
  30. package/dist/sync.mjs +1 -1
  31. package/dist/{validator-DASnXf1j.cjs → validator-CVS-onRg.cjs} +0 -101
  32. package/dist/{validator-D8bPsXPN.mjs → validator-Clu2q_7z.mjs} +1 -66
  33. package/dist/validator.cjs +4 -3
  34. package/dist/validator.d.cts +1 -1
  35. package/dist/validator.d.mts +1 -1
  36. package/dist/validator.mjs +2 -1
  37. package/package.json +6 -6
  38. package/dist/nested-writer-BO3vhbkP.mjs +0 -661
  39. 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, getPath as d, isEmptyObject as f, dbPlugin as i, deletePath as l, selfOrAncestor as m, buildPatchPartial as n, isNavRelation as o, isPlainObject as p, buildValidationContext as r, createDbValidatorPlugin as s, buildDbValidator as t, findAncestorInSet as u };
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 };
@@ -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 require_validator = require("./validator-DASnXf1j.cjs");
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 = require_validator.isEmptyObject;
24
+ exports.isEmptyObject = require_object.isEmptyObject;
24
25
  exports.isNavRelation = require_validator.isNavRelation;
25
- exports.isPlainObject = require_validator.isPlainObject;
26
+ exports.isPlainObject = require_object.isPlainObject;
26
27
  exports.reconcileCas = require_ops.reconcileCas;
27
28
  exports.separateCas = require_ops.separateCas;
@@ -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-DSN0h9lB.cjs";
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 };
@@ -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-DSN0h9lB.mjs";
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 };
@@ -1,4 +1,5 @@
1
1
  import { r as DbError } from "./db-error-D5uilS_A.mjs";
2
- import { a as forceNavNonOptional, c as getKeyProps, f as isEmptyObject, i as dbPlugin, n as buildPatchPartial, o as isNavRelation, p as isPlainObject, r as buildValidationContext, s as createDbValidatorPlugin, t as buildDbValidator } from "./validator-D8bPsXPN.mjs";
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db",
3
- "version": "0.1.142",
3
+ "version": "0.1.144",
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.95",
75
- "@atscript/typescript": "^0.1.95",
74
+ "@atscript/core": "^0.1.96",
75
+ "@atscript/typescript": "^0.1.96",
76
76
  "@uniqu/core": "^0.1.11",
77
- "unplugin-atscript": "^0.1.95"
77
+ "unplugin-atscript": "^0.1.96"
78
78
  },
79
79
  "peerDependencies": {
80
- "@atscript/core": "^0.1.95",
81
- "@atscript/typescript": "^0.1.95",
80
+ "@atscript/core": "^0.1.96",
81
+ "@atscript/typescript": "^0.1.96",
82
82
  "@uniqu/core": "^0.1.11"
83
83
  },
84
84
  "scripts": {