@atscript/db 0.1.149 → 0.1.150

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 (35) hide show
  1. package/dist/agg.d.cts +1 -1
  2. package/dist/agg.d.mts +1 -1
  3. package/dist/{buckets-DJiYlMXc.d.cts → buckets-24Ac4sIS.d.cts} +80 -5
  4. package/dist/{buckets-CNdTOnei.d.mts → buckets-XOz0Bw5x.d.mts} +80 -5
  5. package/dist/{column-diff-CUU4GvYg.cjs → column-diff-CKKBVDvx.cjs} +646 -341
  6. package/dist/{column-diff-Cp6ZoyRE.mjs → column-diff-CKLDWBbo.mjs} +522 -253
  7. package/dist/{fk-diff-BQ4krij8.d.cts → fk-diff-CCLiJ9sJ.d.cts} +2 -1
  8. package/dist/{fk-diff-DsaIijVX.d.mts → fk-diff-R8eU7gq-.d.mts} +2 -1
  9. package/dist/index.cjs +10 -3
  10. package/dist/index.d.cts +66 -4
  11. package/dist/index.d.mts +66 -4
  12. package/dist/index.mjs +3 -3
  13. package/dist/plugin.cjs +143 -36
  14. package/dist/plugin.mjs +138 -31
  15. package/dist/rel.d.cts +2 -2
  16. package/dist/rel.d.mts +2 -2
  17. package/dist/{relation-helpers-kX7jjgME.d.cts → relation-helpers-DjVJN2ng.d.cts} +1 -1
  18. package/dist/{relation-helpers-Ba0v49sn.d.mts → relation-helpers-H7UEVkHs.d.mts} +1 -1
  19. package/dist/search-fields-DBIZKwyb.mjs +117 -0
  20. package/dist/search-fields-DwrsJUC1.cjs +158 -0
  21. package/dist/shared.cjs +3 -1
  22. package/dist/shared.d.cts +19 -1
  23. package/dist/shared.d.mts +19 -1
  24. package/dist/shared.mjs +2 -2
  25. package/dist/sync.cjs +1 -1
  26. package/dist/sync.d.cts +2 -2
  27. package/dist/sync.d.mts +2 -2
  28. package/dist/sync.mjs +1 -1
  29. package/dist/{validation-utils-Dq0uZ7ef.mjs → validation-utils-DqZAH6aT.mjs} +44 -2
  30. package/dist/{validation-utils-Da2GjobR.cjs → validation-utils-debIYpq0.cjs} +56 -2
  31. package/package.json +6 -6
  32. package/dist/derived-rules-0sKn4f5C.mjs +0 -44
  33. package/dist/derived-rules-YstgIxG-.cjs +0 -67
  34. package/dist/numeric-operand-B1jKH7x5.mjs +0 -21
  35. package/dist/numeric-operand-DKfiRLYp.cjs +0 -26
@@ -1,67 +0,0 @@
1
- //#region src/shared/derived-rules.ts
2
- /**
3
- * The rules the compiler plugin and the runtime share about entities and
4
- * `@db.column.derived` fields — one dependency-free list each, so a
5
- * compile-time diagnostic and its runtime mirror can never disagree.
6
- * @since 0.1.141
7
- */
8
- /** The annotations that make a declaration a DB entity: a table, or a managed / external view. */
9
- const DB_ENTITY_ANNOTATIONS = [
10
- "db.table",
11
- "db.view",
12
- "db.view.for"
13
- ];
14
- /** Primitive leaf types a JSON-stored path may end at (view JSON leaves, derived columns). */
15
- const JSON_LEAF_TYPES = new Set([
16
- "string",
17
- "number",
18
- "boolean"
19
- ]);
20
- /** Whether `type` (a resolved design type) is one of {@link JSON_LEAF_TYPES}. */
21
- function isJsonLeafType(type) {
22
- return JSON_LEAF_TYPES.has(type);
23
- }
24
- /** Annotations a `@db.column.derived` field cannot carry (D8), with the reason. */
25
- const DERIVED_INCOMPATIBLE = [
26
- ["meta.id", "a computed column cannot identify the row"],
27
- ["db.rel.FK", "a foreign key needs a stored, writable column"],
28
- ["db.default", "the value is computed, never defaulted"],
29
- ["db.default.increment", "the value is computed, never defaulted"],
30
- ["db.default.uuid", "the value is computed, never defaulted"],
31
- ["db.default.now", "the value is computed, never defaulted"],
32
- ["db.column.version", "the version column is adapter-managed"],
33
- ["db.encrypted", "the value is a cleartext extraction of its source"],
34
- ["db.json", "a derived column is a primitive leaf, not a JSON value"],
35
- ["db.ignore", "an ignored field has no column to derive"],
36
- ["db.writeOnly", "a derived column is never written"],
37
- ["db.index.fulltext", "fulltext indexes need a stored text column"],
38
- ["db.index.geo", "a geo index needs a db.geoPoint column"],
39
- ["db.search.vector", "a vector index needs a stored embedding column"],
40
- ["db.mongo.search.text", "Atlas Search indexes the stored document, which holds no derived field"],
41
- ["db.mongo.search.autocomplete", "Atlas Search indexes the stored document, which holds no derived field"]
42
- ];
43
- //#endregion
44
- Object.defineProperty(exports, "DB_ENTITY_ANNOTATIONS", {
45
- enumerable: true,
46
- get: function() {
47
- return DB_ENTITY_ANNOTATIONS;
48
- }
49
- });
50
- Object.defineProperty(exports, "DERIVED_INCOMPATIBLE", {
51
- enumerable: true,
52
- get: function() {
53
- return DERIVED_INCOMPATIBLE;
54
- }
55
- });
56
- Object.defineProperty(exports, "JSON_LEAF_TYPES", {
57
- enumerable: true,
58
- get: function() {
59
- return JSON_LEAF_TYPES;
60
- }
61
- });
62
- Object.defineProperty(exports, "isJsonLeafType", {
63
- enumerable: true,
64
- get: function() {
65
- return isJsonLeafType;
66
- }
67
- });
@@ -1,21 +0,0 @@
1
- //#region src/shared/numeric-operand.ts
2
- /** Primitive tags of timestamps (MySQL may store them as native `TIMESTAMP`). */
3
- const TIMESTAMP_TAGS = [
4
- "timestamp",
5
- "created",
6
- "updated"
7
- ];
8
- /**
9
- * Why a field cannot be an arithmetic operand, or `undefined` when it can: it
10
- * must be a `number` — not a decimal (exact; an expression is IEEE double) and
11
- * not a timestamp-tagged number. The one rule behind `@db.compute` (declared,
12
- * from the `.as` source) and query-time arithmetic (from the runtime
13
- * descriptor), so the two cannot diverge. Storage rules (`@db.ignore`,
14
- * encrypted, JSON) stay with the callers.
15
- */
16
- function numericTypeProblem({ base, tags }) {
17
- if (base !== "number" && base !== "integer") return base === "decimal" ? "is a decimal" : `is a ${base}`;
18
- if (tags && TIMESTAMP_TAGS.some((t) => tags.has(t))) return "is a timestamp";
19
- }
20
- //#endregion
21
- export { numericTypeProblem as t };
@@ -1,26 +0,0 @@
1
- //#region src/shared/numeric-operand.ts
2
- /** Primitive tags of timestamps (MySQL may store them as native `TIMESTAMP`). */
3
- const TIMESTAMP_TAGS = [
4
- "timestamp",
5
- "created",
6
- "updated"
7
- ];
8
- /**
9
- * Why a field cannot be an arithmetic operand, or `undefined` when it can: it
10
- * must be a `number` — not a decimal (exact; an expression is IEEE double) and
11
- * not a timestamp-tagged number. The one rule behind `@db.compute` (declared,
12
- * from the `.as` source) and query-time arithmetic (from the runtime
13
- * descriptor), so the two cannot diverge. Storage rules (`@db.ignore`,
14
- * encrypted, JSON) stay with the callers.
15
- */
16
- function numericTypeProblem({ base, tags }) {
17
- if (base !== "number" && base !== "integer") return base === "decimal" ? "is a decimal" : `is a ${base}`;
18
- if (tags && TIMESTAMP_TAGS.some((t) => tags.has(t))) return "is a timestamp";
19
- }
20
- //#endregion
21
- Object.defineProperty(exports, "numericTypeProblem", {
22
- enumerable: true,
23
- get: function() {
24
- return numericTypeProblem;
25
- }
26
- });