@atscript/db 0.1.39 → 0.1.40

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 (64) hide show
  1. package/README.md +18 -18
  2. package/dist/agg.cjs +8 -3
  3. package/dist/agg.d.cts +7 -0
  4. package/dist/agg.d.mts +7 -0
  5. package/dist/agg.mjs +7 -3
  6. package/dist/control-DRgryKeg.cjs +14 -0
  7. package/dist/{control_as-bjmwe24C.mjs → control-IANbnfjG.mjs} +6 -18
  8. package/dist/db-readable-BQQzfguJ.d.cts +1249 -0
  9. package/dist/db-readable-Bbr4CjMb.d.mts +1249 -0
  10. package/dist/db-space-BUrQ5BFm.d.mts +309 -0
  11. package/dist/db-space-Vxpcnyt5.d.cts +309 -0
  12. package/dist/db-validator-plugin-07kDiis2.d.cts +22 -0
  13. package/dist/db-validator-plugin-CiqsHTI_.d.mts +22 -0
  14. package/dist/db-view-BntnAmXO.cjs +3071 -0
  15. package/dist/db-view-ZsoN91-q.mjs +2970 -0
  16. package/dist/index.cjs +95 -2801
  17. package/dist/index.d.cts +137 -0
  18. package/dist/index.d.mts +137 -0
  19. package/dist/index.mjs +55 -2761
  20. package/dist/{nested-writer-BkqL7cp3.cjs → nested-writer-BDXsDMPP.cjs} +196 -150
  21. package/dist/{nested-writer-NEN51mnR.mjs → nested-writer-Dmm1gbZV.mjs} +118 -70
  22. package/dist/ops-BdRAFLKY.d.mts +67 -0
  23. package/dist/ops-DXJ4Zw0P.d.cts +67 -0
  24. package/dist/ops.cjs +123 -0
  25. package/dist/ops.d.cts +2 -0
  26. package/dist/ops.d.mts +2 -0
  27. package/dist/ops.mjs +112 -0
  28. package/dist/plugin.cjs +90 -109
  29. package/dist/plugin.d.cts +6 -0
  30. package/dist/plugin.d.mts +6 -0
  31. package/dist/plugin.mjs +29 -49
  32. package/dist/rel.cjs +20 -20
  33. package/dist/rel.d.cts +119 -0
  34. package/dist/rel.d.mts +119 -0
  35. package/dist/rel.mjs +4 -5
  36. package/dist/{relation-helpers-guFL_oRf.cjs → relation-helpers-BYvsE1tR.cjs} +26 -22
  37. package/dist/{relation-helpers-DyBIlQnB.mjs → relation-helpers-CLasawQq.mjs} +11 -6
  38. package/dist/{relation-loader-Dv7qXYq7.mjs → relation-loader-BEOTXNcq.mjs} +63 -43
  39. package/dist/{relation-loader-CpnDRf9k.cjs → relation-loader-CRC5LcqM.cjs} +74 -49
  40. package/dist/shared.cjs +13 -13
  41. package/dist/{shared.d.ts → shared.d.cts} +14 -13
  42. package/dist/shared.d.mts +71 -0
  43. package/dist/shared.mjs +2 -3
  44. package/dist/sync.cjs +300 -252
  45. package/dist/sync.d.cts +369 -0
  46. package/dist/sync.d.mts +369 -0
  47. package/dist/sync.mjs +284 -233
  48. package/dist/{validation-utils-DEoCMmEb.cjs → validation-utils-DVJDijnB.cjs} +141 -109
  49. package/dist/{validation-utils-DhR_mtKa.mjs → validation-utils-DhjIjP1-.mjs} +71 -37
  50. package/package.json +30 -29
  51. package/LICENSE +0 -21
  52. package/dist/agg-BJFJ3dFQ.mjs +0 -8
  53. package/dist/agg-DnUWAOK8.cjs +0 -14
  54. package/dist/agg.d.ts +0 -13
  55. package/dist/chunk-CrpGerW8.cjs +0 -31
  56. package/dist/control_as-BFPERAF_.cjs +0 -28
  57. package/dist/index.d.ts +0 -1706
  58. package/dist/logger-B7oxCfLQ.mjs +0 -12
  59. package/dist/logger-Dt2v_-wb.cjs +0 -18
  60. package/dist/plugin.d.ts +0 -5
  61. package/dist/rel.d.ts +0 -1305
  62. package/dist/relation-loader-D4mTw6yH.cjs +0 -4
  63. package/dist/relation-loader-Ggy1ujwR.mjs +0 -4
  64. package/dist/sync.d.ts +0 -1878
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://atscript.moost.org/logo.svg" alt="Atscript" width="120" />
2
+ <img src="https://atscript.dev/logo.svg" alt="Atscript" width="120" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">@atscript/db</h1>
@@ -9,7 +9,7 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://atscript.moost.org">Documentation</a> · <a href="https://atscript.moost.org/db/guide/">Database Guide</a>
12
+ <a href="https://db.atscript.dev">Documentation</a> · <a href="https://db.atscript.dev/guide/">Database Guide</a>
13
13
  </p>
14
14
 
15
15
  ---
@@ -39,25 +39,25 @@ interface User {
39
39
  ```
40
40
 
41
41
  ```typescript
42
- import { DbSpace } from '@atscript/db'
43
- import { createAdapter } from '@atscript/db-sqlite'
42
+ import { DbSpace } from "@atscript/db";
43
+ import { createAdapter } from "@atscript/db-sqlite";
44
44
 
45
- const db = createAdapter('./myapp.db')
46
- const users = db.getTable(User)
45
+ const db = createAdapter("./myapp.db");
46
+ const users = db.getTable(User);
47
47
 
48
- await users.insertOne({ name: 'John', email: 'john@example.com' })
49
- const all = await users.findMany({ filter: { name: { $eq: 'John' } } })
48
+ await users.insertOne({ name: "John", email: "john@example.com" });
49
+ const all = await users.findMany({ filter: { name: { $eq: "John" } } });
50
50
  ```
51
51
 
52
52
  ## Sub-entries
53
53
 
54
- | Entry | Purpose |
55
- |---|---|
56
- | `@atscript/db/plugin` | `dbPlugin()` — registers all `@db.*` annotations |
57
- | `@atscript/db/rel` | Relation loading and nested writes |
58
- | `@atscript/db/agg` | Aggregation query validation |
59
- | `@atscript/db/sync` | Schema sync with drift detection and distributed locking |
60
- | `@atscript/db/shared` | Annotation helpers for adapter plugins |
54
+ | Entry | Purpose |
55
+ | --------------------- | -------------------------------------------------------- |
56
+ | `@atscript/db/plugin` | `dbPlugin()` — registers all `@db.*` annotations |
57
+ | `@atscript/db/rel` | Relation loading and nested writes |
58
+ | `@atscript/db/agg` | Aggregation query validation |
59
+ | `@atscript/db/sync` | Schema sync with drift detection and distributed locking |
60
+ | `@atscript/db/shared` | Annotation helpers for adapter plugins |
61
61
 
62
62
  ## Features
63
63
 
@@ -73,9 +73,9 @@ const all = await users.findMany({ filter: { name: { $eq: 'John' } } })
73
73
 
74
74
  ## Documentation
75
75
 
76
- - [Database Guide](https://atscript.moost.org/db/guide/)
77
- - [API & Annotations](https://atscript.moost.org/db/api/tables)
78
- - [Full Documentation](https://atscript.moost.org)
76
+ - [Database Guide](https://db.atscript.dev/guide/)
77
+ - [API & Annotations](https://db.atscript.dev/api/tables)
78
+ - [Full Documentation](https://db.atscript.dev)
79
79
 
80
80
  ## License
81
81
 
package/dist/agg.cjs CHANGED
@@ -1,3 +1,8 @@
1
- const require_agg = require('./agg-DnUWAOK8.cjs');
2
-
3
- exports.resolveAlias = require_agg.resolveAlias
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/agg.ts
3
+ /** Resolves output alias: $as if provided, otherwise `{fn}_{field}`. */
4
+ function resolveAlias(expr) {
5
+ return expr.$as ?? `${expr.$fn}_${expr.$field}`;
6
+ }
7
+ //#endregion
8
+ exports.resolveAlias = resolveAlias;
package/dist/agg.d.cts ADDED
@@ -0,0 +1,7 @@
1
+ import { AggregateControls, AggregateExpr, AggregateExpr as AggregateExpr$1, AggregateFn, AggregateQuery, AggregateResult } from "@uniqu/core";
2
+
3
+ //#region src/agg.d.ts
4
+ /** Resolves output alias: $as if provided, otherwise `{fn}_{field}`. */
5
+ declare function resolveAlias(expr: AggregateExpr$1): string;
6
+ //#endregion
7
+ export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, resolveAlias };
package/dist/agg.d.mts ADDED
@@ -0,0 +1,7 @@
1
+ import { AggregateControls, AggregateExpr, AggregateExpr as AggregateExpr$1, AggregateFn, AggregateQuery, AggregateResult } from "@uniqu/core";
2
+
3
+ //#region src/agg.d.ts
4
+ /** Resolves output alias: $as if provided, otherwise `{fn}_{field}`. */
5
+ declare function resolveAlias(expr: AggregateExpr$1): string;
6
+ //#endregion
7
+ export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, resolveAlias };
package/dist/agg.mjs CHANGED
@@ -1,3 +1,7 @@
1
- import { resolveAlias } from "./agg-BJFJ3dFQ.mjs";
2
-
3
- export { resolveAlias };
1
+ //#region src/agg.ts
2
+ /** Resolves output alias: $as if provided, otherwise `{fn}_{field}`. */
3
+ function resolveAlias(expr) {
4
+ return expr.$as ?? `${expr.$fn}_${expr.$field}`;
5
+ }
6
+ //#endregion
7
+ export { resolveAlias };
@@ -0,0 +1,14 @@
1
+ let _atscript_typescript_utils = require("@atscript/typescript/utils");
2
+ //#region src/schema/control.as
3
+ var AtscriptControl = class {
4
+ static __is_atscript_annotated_type = true;
5
+ static type = {};
6
+ static metadata = /* @__PURE__ */ new Map();
7
+ static id = "AtscriptControl";
8
+ static toJsonSchema() {
9
+ (0, _atscript_typescript_utils.throwFeatureDisabled)("JSON Schema", "jsonSchema", "emit.jsonSchema");
10
+ }
11
+ };
12
+ (0, _atscript_typescript_utils.defineAnnotatedType)("object", AtscriptControl).prop("_id", (0, _atscript_typescript_utils.defineAnnotatedType)().designType("string").tags("string").annotate("meta.id", true).$type).prop("value", (0, _atscript_typescript_utils.defineAnnotatedType)().designType("string").tags("string").optional().$type).prop("lockedBy", (0, _atscript_typescript_utils.defineAnnotatedType)().designType("string").tags("string").optional().$type).prop("lockedAt", (0, _atscript_typescript_utils.defineAnnotatedType)().designType("number").tags("number").optional().$type).prop("expiresAt", (0, _atscript_typescript_utils.defineAnnotatedType)().designType("number").tags("number").optional().$type).annotate("db.table", "__atscript_control");
13
+ //#endregion
14
+ exports.AtscriptControl = AtscriptControl;
@@ -1,26 +1,14 @@
1
1
  import { defineAnnotatedType, throwFeatureDisabled } from "@atscript/typescript/utils";
2
-
3
- //#region packages/db/src/schema/control.as.js
4
- function _define_property(obj, key, value) {
5
- if (key in obj) Object.defineProperty(obj, key, {
6
- value,
7
- enumerable: true,
8
- configurable: true,
9
- writable: true
10
- });
11
- else obj[key] = value;
12
- return obj;
13
- }
2
+ //#region src/schema/control.as
14
3
  var AtscriptControl = class {
4
+ static __is_atscript_annotated_type = true;
5
+ static type = {};
6
+ static metadata = /* @__PURE__ */ new Map();
7
+ static id = "AtscriptControl";
15
8
  static toJsonSchema() {
16
9
  throwFeatureDisabled("JSON Schema", "jsonSchema", "emit.jsonSchema");
17
10
  }
18
11
  };
19
- _define_property(AtscriptControl, "__is_atscript_annotated_type", true);
20
- _define_property(AtscriptControl, "type", {});
21
- _define_property(AtscriptControl, "metadata", new Map());
22
- _define_property(AtscriptControl, "id", "AtscriptControl");
23
12
  defineAnnotatedType("object", AtscriptControl).prop("_id", defineAnnotatedType().designType("string").tags("string").annotate("meta.id", true).$type).prop("value", defineAnnotatedType().designType("string").tags("string").optional().$type).prop("lockedBy", defineAnnotatedType().designType("string").tags("string").optional().$type).prop("lockedAt", defineAnnotatedType().designType("number").tags("number").optional().$type).prop("expiresAt", defineAnnotatedType().designType("number").tags("number").optional().$type).annotate("db.table", "__atscript_control");
24
-
25
13
  //#endregion
26
- export { AtscriptControl };
14
+ export { AtscriptControl };