@forestfuture/active-record 0.9.1 → 0.10.0

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/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as pluralize, D as underscore } from "./identifiers-BP6aRwew.mjs";
2
- import { a as migrationSql, c as migrationPlan, i as withDigits, n as namesInList, o as quotedName, r as withGeneratedEnum, s as indexName, t as generatedSchema } from "./for-adapters-DSVRZL3n.mjs";
3
- import { f as byName, i as attributeName, l as configFileName, n as castDefault, o as exportName, p as byVersion, r as isCastDefaultType, s as listed, t as storageOverride, u as parseJsonc } from "./storage-override-B7WTiA_U.mjs";
1
+ import { L as pluralize, V as underscore } from "./identifiers-DRLEguFD.mjs";
2
+ import { a as migrationSql, c as migrationPlan, i as withDigits, n as namesInList, o as quotedName, r as withGeneratedEnum, s as indexName, t as generatedSchema } from "./for-adapters-DvtC7L8N.mjs";
3
+ import { f as byName, i as attributeName, l as configFileName, n as castDefault, o as exportName, p as byVersion, r as isCastDefaultType, s as listed, t as storageOverride, u as parseJsonc } from "./storage-override-BDgUIPQu.mjs";
4
4
  export { attributeName, byName, byVersion, castDefault, configFileName, exportName, generatedSchema, indexName, isCastDefaultType, listed, migrationPlan, migrationSql, namesInList, parseJsonc, pluralize, quotedName, storageOverride, underscore, withDigits, withGeneratedEnum };
package/dist/command.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { _ as importPath, a as classify, c as moduleName, d as projectDatabases, g as migrationsOf, h as leadingNumber, m as hasNestedMigrations, n as castDefault, p as byVersion, s as listed, t as storageOverride, u as parseJsonc, v as shown$1, y as slashed } from "./storage-override-B7WTiA_U.mjs";
3
- import { At as tableize, Mt as staticBelow, c as methodsOffFixes, d as enumNameProblem, f as enumScopeNames, i as isBase, jt as ancestors } from "./generated-model-CKIciUat.mjs";
4
- import { C as pluralize, D as underscore, T as camelize, h as digitsProblem, t as isIdentifier, w as singularize } from "./identifiers-BP6aRwew.mjs";
2
+ import { _ as importPath, a as classify, c as moduleName, d as projectDatabases, g as migrationsOf, h as leadingNumber, m as hasNestedMigrations, n as castDefault, p as byVersion, s as listed, t as storageOverride, u as parseJsonc, v as shown$1, y as slashed } from "./storage-override-BDgUIPQu.mjs";
3
+ import { At as tableize, Mt as staticBelow, c as methodsOffFixes, d as enumNameProblem, f as enumScopeNames, i as isBase, jt as ancestors } from "./generated-model-DiQb9_3C.mjs";
4
+ import { L as pluralize, R as singularize, V as underscore, k as digitsProblem, t as isIdentifier, z as camelize } from "./identifiers-DRLEguFD.mjs";
5
5
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
6
6
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
7
7
  import { inspect, parseArgs, types } from "node:util";
@@ -68,11 +68,11 @@ function helpFor(subcommands) {
68
68
  const adapters = {
69
69
  d1: {
70
70
  entry: "@forestfuture/active-record/d1",
71
- plugin: async () => (await import("./plugin-A93qwqAh.mjs")).cli
71
+ plugin: async () => (await import("./plugin-Bc2YeU6a.mjs")).cli
72
72
  },
73
73
  postgresql: {
74
74
  entry: "@forestfuture/active-record/postgresql",
75
- plugin: async () => (await import("./plugin-CsOOLZkx.mjs")).cli
75
+ plugin: async () => (await import("./plugin-C36nVWER.mjs")).cli
76
76
  }
77
77
  };
78
78
  /** The adapters' names, in the registry's order. */
@@ -254,7 +254,8 @@ function oneLine(sql) {
254
254
  /**
255
255
  * One line for a statement, as `onQuery` saw it (filtered values are already `[FILTERED]`):
256
256
  * ` User 1.2ms SELECT … WHERE "id" = ? [ 1 ]`, or `failed` and the reason in place of the time
257
- * and values. Dim on a terminal, so it reads as background to the results.
257
+ * and values, or `cached` in place of the time for an answer from the request cache. Dim on a
258
+ * terminal, so it reads as background to the results.
258
259
  */
259
260
  function statementLine(event, dim) {
260
261
  const { model, params, durationMs, error } = event;
@@ -262,7 +263,7 @@ function statementLine(event, dim) {
262
263
  let line = ` ${model} `;
263
264
  if (error !== void 0) line += `failed ${sql} ${error instanceof Error ? error.message : inspect(error)}`;
264
265
  else {
265
- line += `${durationMs.toFixed(1)}ms ${sql}`;
266
+ line += `${event.cached ? "cached" : `${durationMs.toFixed(1)}ms`} ${sql}`;
266
267
  if (params.length > 0) line += ` ${inspect(params, { breakLength: Number.POSITIVE_INFINITY })}`;
267
268
  }
268
269
  return dim ? `\u001b[2m${line}\u001b[22m` : line;
package/dist/d1.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as QueryEvent$1, D as SchemaAdapter, O as AnyDatabase, w as QueryListener$1 } from "./validations-C2-HKi1V.mjs";
2
- import { c as ActiveRecordError } from "./index-DkWlkGy2.mjs";
1
+ import { O as SchemaAdapter, S as CacheOptions, T as QueryListener$1, k as AnyDatabase, w as QueryEvent$1 } from "./validations-BUn_5T-8.mjs";
2
+ import { c as ActiveRecordError } from "./index-DkGTK5OS.mjs";
3
3
  /** The D1 database a generated schema's Models query: `adapter: d1({ binding: "DB" })`. */
4
4
  export declare function d1({ binding }: {
5
5
  binding: string;
@@ -11,6 +11,11 @@ type QueryListener = QueryListener$1<D1Meta>;
11
11
  interface ConnectOptions {
12
12
  /** Called once for every statement sent to D1, with D1's `meta`. */
13
13
  onQuery?: QueryListener;
14
+ /**
15
+ * Inside a `withDatabase` call, a read identical to one already sent there is answered from
16
+ * memory, until a write; `cache: { request: false }` turns that off.
17
+ */
18
+ cache?: CacheOptions;
14
19
  /**
15
20
  * Sends every query through one D1 Session, so the request reads its own writes even when
16
21
  * reads are served by replicas: `"first-primary"`, `"first-unconstrained"`, or a bookmark
package/dist/d1.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { a as databaseExecutor, i as AnyDatabase, l as workersEnv, r as withDatabase, u as DatabaseExecutor } from "./batch-DpMoy3-7.mjs";
2
- import { t as onlyRequested } from "./for-adapters-unqbZQM7.mjs";
3
- import { V as NoDatabase, i as hexOf, k as ActiveRecordError } from "./identifiers-BP6aRwew.mjs";
4
- import { w as boundValue } from "./generated-model-CKIciUat.mjs";
1
+ import { a as databaseExecutor, i as AnyDatabase, l as workersEnv, r as withDatabase, u as DatabaseExecutor } from "./batch-vRCbt-jV.mjs";
2
+ import { t as onlyRequested } from "./for-adapters-CIUvPeas.mjs";
3
+ import { U as ActiveRecordError, i as hexOf, tt as NoDatabase } from "./identifiers-DRLEguFD.mjs";
4
+ import { w as boundValue } from "./generated-model-DiQb9_3C.mjs";
5
5
  // src/adapters/d1/errors.ts
6
6
  /** D1's error for a Session's bookmark it can't use, and the bookmark it repeats (#237). */
7
7
  const rejectedBookmark = /invalid commitToken bookmark provided: (.*)$/s;
@@ -246,9 +246,9 @@ var Database = class extends AnyDatabase {
246
246
  #binding;
247
247
  #driver;
248
248
  constructor(binding, options = {}) {
249
- const { session, onQuery } = options;
249
+ const { session, onQuery, cache } = options;
250
250
  const driver = new D1Driver(session === void 0 ? binding : binding.withSession(session));
251
- super(new DatabaseExecutor(d1Adapter, driver, onQuery));
251
+ super(new DatabaseExecutor(d1Adapter, driver, onQuery, cache));
252
252
  this.#binding = binding;
253
253
  this.#driver = driver;
254
254
  }
@@ -1,4 +1,4 @@
1
- import { V as NoDatabase } from "./identifiers-BP6aRwew.mjs";
1
+ import { tt as NoDatabase } from "./identifiers-DRLEguFD.mjs";
2
2
  // src/request-database.ts
3
3
  /**
4
4
  * The request's database for a query on `binding` outside a Worker, or a `NoDatabase` saying what
@@ -1,4 +1,4 @@
1
- import { O as AnyDatabase } from "./validations-C2-HKi1V.mjs";
1
+ import { k as AnyDatabase } from "./validations-BUn_5T-8.mjs";
2
2
  /**
3
3
  * Bytes as hex text, two digits each, for SQL that reads bytes from JSON (`unhex`, `\\x…`). The
4
4
  * digits' character codes are written into one array and decoded once: mapping each byte to a
@@ -1,5 +1,5 @@
1
- import { C as pluralize, D as underscore, h as digitsProblem } from "./identifiers-BP6aRwew.mjs";
2
- import { f as byName, o as exportName } from "./storage-override-B7WTiA_U.mjs";
1
+ import { L as pluralize, V as underscore, k as digitsProblem } from "./identifiers-DRLEguFD.mjs";
2
+ import { f as byName, o as exportName } from "./storage-override-BDgUIPQu.mjs";
3
3
  // cli/generate/migration-plan.ts
4
4
  /** What to do, read from a migration's name: `create_products`, `add_sku_to_products`, …; else empty. */
5
5
  function migrationPlan(name) {
@@ -1,4 +1,4 @@
1
- import { B as MissingAttribute, C as pluralize, D as underscore, E as capitalized, K as RecordDestroyed, L as InvalidModel, S as listedNames, V as NoDatabase, W as ReadonlyAttribute, _ as enumEntries, a as isSameCell, c as castValue, d as uncastable, h as digitsProblem, l as isInvalidDate, n as reservedWords, nt as UnknownAttribute, o as castCondition, p as writeValue, r as epochStorages, s as castKey, t as isIdentifier, u as readValue, v as enumProblem, x as isEnumValues } from "./identifiers-BP6aRwew.mjs";
1
+ import { B as capitalized, E as refuseAssignedReference, F as isEnumValues, I as listedNames, L as pluralize, M as enumProblem, V as underscore, Z as InvalidModel, a as isSameCell, c as castValue, d as uncastable, et as MissingAttribute, g as jsonText, gt as UnknownAttribute, h as NestedReferenceFound, it as ReadonlyAttribute, j as enumEntries, k as digitsProblem, l as isInvalidDate, n as reservedWords, o as castCondition, ot as RecordDestroyed, p as writeValue, r as epochStorages, s as castKey, t as isIdentifier, tt as NoDatabase, u as readValue } from "./identifiers-DRLEguFD.mjs";
2
2
  // src/ancestors.ts
3
3
  /** A class and every class (and object) it extends, nearest first. */
4
4
  function ancestors(model) {
@@ -2195,7 +2195,9 @@ var Attribute = class {
2195
2195
  */
2196
2196
  cast(value) {
2197
2197
  requireDefined(this.#model, this.name, value);
2198
+ refuseAssignedReference(this.#model.name, this.name, value);
2198
2199
  const cast = this.#convertOrRefuse(value, () => castValue(this.#definition, value));
2200
+ this.#refuseNestedInCustomJson(cast);
2199
2201
  if (cast === uncastable && this.#isValidatedEnum()) return value;
2200
2202
  return this.#orRefuse(cast, value);
2201
2203
  }
@@ -2279,6 +2281,7 @@ var Attribute = class {
2279
2281
  try {
2280
2282
  stored = writeValue(this.#definition, value);
2281
2283
  } catch (error) {
2284
+ this.#refuseNested(error);
2282
2285
  if (this.#definition.customType !== void 0) throw this.#refusal(value, void 0, error);
2283
2286
  if (this.#definition.type !== "json") throw error;
2284
2287
  throw this.#refusal(value);
@@ -2353,10 +2356,31 @@ var Attribute = class {
2353
2356
  try {
2354
2357
  return convert();
2355
2358
  } catch (error) {
2359
+ this.#refuseNested(error);
2356
2360
  if (this.#definition.customType === void 0) throw error;
2357
2361
  throw this.#refusal(value, void 0, error);
2358
2362
  }
2359
2363
  }
2364
+ /**
2365
+ * Throws the refusal naming the Model and the path for a fragment's reference found inside a
2366
+ * json value (#547), assigned or changed in place.
2367
+ */
2368
+ #refuseNested(error) {
2369
+ if (!(error instanceof NestedReferenceFound)) return;
2370
+ refuseAssignedReference(this.#model.name, error.pathUnder(this.name), error.reference);
2371
+ }
2372
+ /**
2373
+ * A custom type stored as json casts its values itself, not through the json type's cast,
2374
+ * so its cast value is checked here for a nested reference (#547).
2375
+ */
2376
+ #refuseNestedInCustomJson(cast) {
2377
+ if (this.#definition.customType === void 0 || !this.isJson) return;
2378
+ try {
2379
+ jsonText(cast);
2380
+ } catch (error) {
2381
+ this.#refuseNested(error);
2382
+ }
2383
+ }
2360
2384
  /** Whether the attribute's values are hidden from listeners and errors (#83). */
2361
2385
  #isHidden() {
2362
2386
  return isFiltered(this.#model, this.name);
@@ -620,6 +620,151 @@ function incremented(digits) {
620
620
  while (index >= 0 && digits[index] === "9") index--;
621
621
  return (index < 0 ? "1" : digits.slice(0, index) + String(Number(digits[index]) + 1)) + "0".repeat(digits.length - 1 - index);
622
622
  }
623
+ // src/sql.ts
624
+ /**
625
+ * A SQL fragment built with the `sql` tagged template (ADR-0006). The template
626
+ * text is written by the developer; every interpolated value is bound as a
627
+ * parameter and never becomes SQL text.
628
+ */
629
+ var SafeSql = class {
630
+ strings;
631
+ values;
632
+ /** @internal Use the `sql` tag instead. */
633
+ constructor(strings, values) {
634
+ this.strings = strings;
635
+ this.values = values;
636
+ }
637
+ };
638
+ function sql(strings, ...values) {
639
+ return new SafeSql([...strings], values);
640
+ }
641
+ /** A reference to an attribute's column, resolved against the query's Model when compiled. */
642
+ var ColumnReference = class {
643
+ attribute;
644
+ /** @internal Use `column()` instead. */
645
+ constructor(attribute) {
646
+ this.attribute = attribute;
647
+ }
648
+ /**
649
+ * A value of this attribute for a fragment, converted as the attribute stores it: a `Date`
650
+ * as the integer of an attribute kept as a Unix time, a boolean as 0 or 1, and so on. It's
651
+ * still a bound parameter. Without it, a value has no attribute to say how it's stored (#142).
652
+ */
653
+ value(value) {
654
+ return new ColumnValue(this.attribute, value);
655
+ }
656
+ };
657
+ /** A value of an attribute, from `column(attribute).value(value)`, converted when compiled. */
658
+ var ColumnValue = class {
659
+ attribute;
660
+ /** What was given, before it's cast as an assigned value of the attribute. */
661
+ assigned;
662
+ /** @internal Use `column(attribute).value(value)` instead. */
663
+ constructor(attribute, assigned) {
664
+ this.attribute = attribute;
665
+ this.assigned = assigned;
666
+ }
667
+ };
668
+ /**
669
+ * The value a row an upsert writes has for an attribute, in its `onDuplicate` (#531): what the
670
+ * row that clashed would have been given.
671
+ */
672
+ var IncomingReference = class {
673
+ attribute;
674
+ /** @internal Use `incoming()` instead. */
675
+ constructor(attribute) {
676
+ this.attribute = attribute;
677
+ }
678
+ };
679
+ /**
680
+ * Whether a fragment's interpolated value names an attribute: a column, a typed value, or an
681
+ * incoming value.
682
+ */
683
+ function isAttributeReference(value) {
684
+ return value instanceof ColumnReference || value instanceof ColumnValue || value instanceof IncomingReference;
685
+ }
686
+ /** What a fragment's reference given as a plain value is, for its refusal, or undefined. */
687
+ function referenceKind(value) {
688
+ if (value instanceof ColumnValue) return "a typed value";
689
+ if (isAttributeReference(value)) return "a column() or incoming() reference";
690
+ }
691
+ /**
692
+ * Throws `TypeError` for a fragment's reference given as a value where a fragment could be
693
+ * (an upsert's `onDuplicate`, #531; conditions and `updateAll`, #539): a typed value, which is
694
+ * given as the value itself, or a column or incoming value, which only a fragment reads. Where
695
+ * no fragment can be (`find`'s ids, #546), `takesFragment: false` says to give the value itself.
696
+ */
697
+ function refuseReferenceValue(value, gives, { takesFragment = true } = {}) {
698
+ const kind = referenceKind(value);
699
+ if (kind === void 0) return;
700
+ const remedy = value instanceof ColumnValue || !takesFragment ? "give the value itself" : "write it in an sql`…` fragment";
701
+ throw new TypeError(`${gives} ${kind}; ${remedy}`);
702
+ }
703
+ /**
704
+ * Throws `TypeError` for a fragment's reference assigned to a record or a written row's
705
+ * attribute, where no fragment can be (#539): only the value itself can be written there.
706
+ */
707
+ function refuseAssignedReference(owner, attribute, value) {
708
+ const kind = referenceKind(value);
709
+ if (kind === void 0) return;
710
+ throw new TypeError(`${owner} "${attribute}" was given ${kind}; give the value itself`);
711
+ }
712
+ /** Names the column of `attribute` inside an `sql` fragment, quoted and mapped (ADR-0004). */
713
+ function column(attribute) {
714
+ return new ColumnReference(attribute);
715
+ }
716
+ /** What `incoming(attribute)` anywhere but an upsert's `onDuplicate` throws (#531). */
717
+ function incomingRefusal(attribute) {
718
+ return /* @__PURE__ */ new TypeError(`incoming("${attribute}") names the value of a row an upsert writes, so only an upsert's onDuplicate can use it`);
719
+ }
720
+ /**
721
+ * Names, inside an upsert's `onDuplicate` fragment, the value the row being written has for
722
+ * `attribute`, where `column(attribute)` names the clashing row's (#531).
723
+ */
724
+ function incoming(attribute) {
725
+ return new IncomingReference(attribute);
726
+ }
727
+ // src/json-values.ts
728
+ /** Thrown by `jsonText` for a fragment's reference found inside a json value, at `path` from its top. */
729
+ var NestedReferenceFound = class extends Error {
730
+ path;
731
+ reference;
732
+ constructor(path, reference) {
733
+ super(`a reference at ${path}`);
734
+ this.path = path;
735
+ this.reference = reference;
736
+ }
737
+ /** The reference's path under the attribute `name`: `settings.a.0`. */
738
+ pathUnder(name) {
739
+ return this.path === "" ? name : `${name}.${this.path}`;
740
+ }
741
+ };
742
+ /**
743
+ * A json value's JSON text, or undefined where JSON gives none. A `column()`, typed value or
744
+ * `incoming()` anywhere in it throws `NestedReferenceFound`, rather than being written as its
745
+ * fields. The check is part of the `stringify` that writes the value, so it costs no walk of its own.
746
+ */
747
+ function jsonText(value) {
748
+ const paths = /* @__PURE__ */ new WeakMap();
749
+ return JSON.stringify(value, function(key, inner) {
750
+ const parent = paths.get(this);
751
+ const path = parent === void 0 ? "" : parent === "" ? key : `${parent}.${key}`;
752
+ if (isAttributeReference(inner)) throw new NestedReferenceFound(path, inner);
753
+ if (typeof inner === "object" && inner !== null) paths.set(inner, path);
754
+ return inner;
755
+ });
756
+ }
757
+ /**
758
+ * Throws `TypeError` for a fragment's reference nested in a condition's json value, as
759
+ * `refuseReferenceValue` does for one given as the value itself.
760
+ */
761
+ function refuseNestedReference(value, gives) {
762
+ try {
763
+ jsonText(value);
764
+ } catch (error) {
765
+ if (error instanceof NestedReferenceFound) refuseReferenceValue(error.reference, error.pathUnder(gives));
766
+ }
767
+ }
623
768
  // src/conversion.ts
624
769
  /** A value that can't be read as the attribute's type. */
625
770
  const uncastable = Symbol("uncastable");
@@ -664,7 +809,7 @@ const converters = {
664
809
  json: {
665
810
  cast: castJson,
666
811
  read: readJson,
667
- write: (value) => JSON.stringify(value)
812
+ write: jsonText
668
813
  },
669
814
  binary: {
670
815
  cast: castBinary,
@@ -870,14 +1015,15 @@ function castBoolean(value) {
870
1015
  /**
871
1016
  * Any value JSON can write, as it is. What `stringify` writes lossily (a `Map` as `{}`, `NaN` as
872
1017
  * `null`) is kept; what it throws on (a BigInt, a cycle) or gives nothing for (a function, a
873
- * symbol) is refused (#146). It's checked here, and written again at save, so a value is
1018
+ * symbol) is refused (#146), and a fragment's reference inside it throws `NestedReferenceFound` (#547). It's checked here, and written again at save, so a value is
874
1019
  * refused where it's assigned rather than where it's stored, and the cost is one more
875
1020
  * `stringify` per assignment.
876
1021
  */
877
1022
  function castJson(value) {
878
1023
  try {
879
- return JSON.stringify(value) === void 0 ? uncastable : value;
880
- } catch {
1024
+ return jsonText(value) === void 0 ? uncastable : value;
1025
+ } catch (error) {
1026
+ if (error instanceof NestedReferenceFound) throw error;
881
1027
  return uncastable;
882
1028
  }
883
1029
  }
@@ -1048,4 +1194,4 @@ function isIdentifier(name) {
1048
1194
  }
1049
1195
  /** Words JavaScript doesn't allow as a declaration's name in a module (strict mode). */
1050
1196
  const reservedWords = new Set("break case catch class const continue debugger default delete do else enum export extends false finally for function if import in instanceof new null return super switch this throw true try typeof var void while with yield let static implements interface package private protected public await arguments eval".split(" "));
1051
- export { StaleRecord as $, AssociationNotLoaded as A, MissingAttribute as B, pluralize as C, underscore as D, capitalized as E, IncompatibleRelation as F, ReadonlyRecord as G, NotNullViolation as H, InvalidForeignKey as I, RecordNotDestroyed as J, RecordDestroyed as K, InvalidModel as L, CheckViolation as M, ConstraintViolation as N, AbortAfterPersistence as O, DeleteRestriction as P, SoleRecordExceeded as Q, InvalidToken as R, listedNames as S, camelize as T, ReadonlyAssociation as U, NoDatabase as V, ReadonlyAttribute as W, RecordNotSaved as X, RecordNotFound as Y, RecordNotUnique as Z, enumEntries as _, isSameCell as a, enumValuesOf as b, castValue as c, uncastable as d, StrictValidationFailed as et, writeUntypedValue as f, orderDecimal as g, digitsProblem as h, hexOf as i, abort as it, CallbackAbort as j, ActiveRecordError as k, isInvalidDate as l, zonelessDateTime as m, reservedWords as n, UnknownAttribute as nt, castCondition as o, writeValue as p, RecordInvalid as q, epochStorages as r, UnknownModelName as rt, castKey as s, isIdentifier as t, UnknownAssociation as tt, readValue as u, enumProblem as v, singularize as w, isEnumValues as x, enumValidations as y, IrreversibleOrder as z };
1197
+ export { IrreversibleOrder as $, orderDecimal as A, capitalized as B, incoming as C, refuseReferenceValue as D, refuseAssignedReference as E, isEnumValues as F, CallbackAbort as G, AbortAfterPersistence as H, listedNames as I, DeleteRestriction as J, CheckViolation as K, pluralize as L, enumProblem as M, enumValidations as N, sql as O, enumValuesOf as P, InvalidToken as Q, singularize as R, column as S, isAttributeReference as T, ActiveRecordError as U, underscore as V, AssociationNotLoaded as W, InvalidForeignKey as X, IncompatibleRelation as Y, InvalidModel as Z, refuseNestedReference as _, UnknownModelName as _t, isSameCell as a, ReadonlyRecord as at, IncomingReference as b, castValue as c, RecordNotDestroyed as ct, uncastable as d, RecordNotUnique as dt, MissingAttribute as et, writeUntypedValue as f, SoleRecordExceeded as ft, jsonText as g, UnknownAttribute as gt, NestedReferenceFound as h, UnknownAssociation as ht, hexOf as i, ReadonlyAttribute as it, enumEntries as j, digitsProblem as k, isInvalidDate as l, RecordNotFound as lt, zonelessDateTime as m, StrictValidationFailed as mt, reservedWords as n, NotNullViolation as nt, castCondition as o, RecordDestroyed as ot, writeValue as p, StaleRecord as pt, ConstraintViolation as q, epochStorages as r, ReadonlyAssociation as rt, castKey as s, RecordInvalid as st, isIdentifier as t, NoDatabase as tt, readValue as u, RecordNotSaved as ut, ColumnReference as v, abort as vt, incomingRefusal as w, SafeSql as x, ColumnValue as y, camelize as z };
@@ -1,4 +1,4 @@
1
- import { I as DatetimeAttributeKey, L as NumberAttributeKey, O as AnyDatabase, _t as ThroughDependent, ct as BelongsTo, dt as HasManyDependent, f as Model, ft as HasManyThrough, g as DatabaseSchema, gt as PolymorphicBelongsTo, ht as HasOneThrough, lt as HasMany, mt as HasOneDependent, p as ModelClass, pt as HasOne, st as AssociationOptions, vt as ThroughOptions } from "./validations-C2-HKi1V.mjs";
1
+ import { L as DatetimeAttributeKey, R as NumberAttributeKey, _t as PolymorphicBelongsTo, ct as AssociationOptions, f as Model, ft as HasManyDependent, g as DatabaseSchema, gt as HasOneThrough, ht as HasOneDependent, k as AnyDatabase, lt as BelongsTo, mt as HasOne, p as ModelClass, pt as HasManyThrough, ut as HasMany, vt as ThroughDependent, yt as ThroughOptions } from "./validations-BUn_5T-8.mjs";
2
2
  /** Base class for every error the library throws on purpose. */
3
3
  declare class ActiveRecordError extends Error {
4
4
  name: string;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { A as defineType, C as SecurePasswordOptions, D as Duration, E as PasswordAlgorithm, _ as SecureTokenOptions, a as AttributeType, i as AttributeSpecs, k as CustomType, r as AttributeSpec, u as EpochStorage, v as generateSecureToken } from "./metadata-nKZ_6DzA.mjs";
2
- import { $ as TouchOptions, At as QueryPart, B as SaveOptions, Bt as ColumnValue, C as QueryEvent, Ct as UpsertOptions, Dt as gte, Et as gt, F as RecordStatement, Ft as QuerySql, G as Relation, Gt as ComparisonBound, H as ValidationContext, Ht as column, J as Scoped, K as Scope, Kt as ComparisonOptions, M as BatchResults, Mt as SignedIdOptions, N as batch, Nt as InOrderOfOptions, Ot as lt, P as Batch, Q as PageOptions, R as SigningEnv, St as Returning, Tt as between, U as ValidationContexts, Ut as sql, V as ValidationCallbackOptions, Vt as SafeSql, W as TokenForOptions, Wt as Comparable, X as CountlessPage, Y as IterationOptions, Z as Page, _ as TableSchema, _t as ThroughDependent, a as ValidationOptions, bt as InsertOptions, c as AttributeErrorMessages, ct as BelongsTo, d as RestrictMessages, dt as HasManyDependent, et as GroupedRelation, f as Model, ft as HasManyThrough, g as DatabaseSchema, gt as PolymorphicBelongsTo, h as TableAttributes, ht as HasOneThrough, i as UniquenessOptions, it as WriteResult, j as BatchEntry, jt as FindSignedOptions, k as RelationsFor, kt as lte, l as ErrorMessage, lt as HasMany, m as ScopeStatic, mt as HasOneDependent, n as LengthOptions, nt as ReturnedRow, o as Errors, pt as HasOne, q as ScopeMethods, r as NumericalityOptions, rt as Statement, s as ValidationError, st as AssociationOptions, t as AssociatedValidationOptions, tt as Init, u as ErrorMessages, ut as HasManyCollection, v as TableSchemas, vt as ThroughOptions, w as QueryListener, wt as Comparison, x as AttributeConversions, xt as OrderSpec, y as FilterAttribute, yt as Conditions, z as SigningSecrets, zt as ColumnReference } from "./validations-C2-HKi1V.mjs";
3
- import { A as RecordNotSaved, C as ReadonlyAssociation, D as RecordInvalid, E as RecordDestroyed, F as StrictValidationFailed, I as UnknownAssociation, L as UnknownAttribute, M as SoleRecordExceeded, N as StaleAction, O as RecordNotDestroyed, P as StaleRecord, R as UnknownModelName, S as ReadonlyAction, T as ReadonlyRecord, _ as InvalidToken, a as hasMany, b as NoDatabase, c as ActiveRecordError, d as CheckViolation, f as ConstraintViolation, g as InvalidModel, h as InvalidForeignKey, i as belongsTo, j as RecordNotUnique, k as RecordNotFound, l as AssociationNotLoaded, m as IncompatibleRelation, n as withDatabase, o as hasOne, p as DeleteRestriction, r as PolymorphicBelongsToOptions, s as AbortAfterPersistence, t as defineSchema, u as CallbackAbort, v as IrreversibleOrder, w as ReadonlyAttribute, x as NotNullViolation, y as MissingAttribute, z as abort } from "./index-DkWlkGy2.mjs";
4
- export { AbortAfterPersistence, ActiveRecordError, type AssociatedValidationOptions, AssociationNotLoaded, type AssociationOptions, type AttributeConversions, type AttributeErrorMessages, type AttributeSpec, type AttributeSpecs, type AttributeType, type Batch, type BatchEntry, type BatchResults, type BelongsTo, CallbackAbort, CheckViolation, type ColumnReference, type ColumnValue, type Comparable, type Comparison, type ComparisonBound, type ComparisonOptions, type Conditions, ConstraintViolation, type CountlessPage, type CustomType, type DatabaseSchema, DeleteRestriction, type Duration, type EpochStorage, type ErrorMessage, type ErrorMessages, Errors, type FilterAttribute, type FindSignedOptions, type GroupedRelation, type HasMany, type HasManyCollection, type HasManyDependent, type HasManyThrough, type HasOne, type HasOneDependent, type HasOneThrough, type InOrderOfOptions, IncompatibleRelation, type Init, type InsertOptions, InvalidForeignKey, InvalidModel, InvalidToken, IrreversibleOrder, type IterationOptions, type LengthOptions, MissingAttribute, Model, NoDatabase, NotNullViolation, type NumericalityOptions, type OrderSpec, type Page, type PageOptions, type PasswordAlgorithm, type PolymorphicBelongsTo, type PolymorphicBelongsToOptions, type QueryEvent, type QueryListener, type QueryPart, type QuerySql, type ReadonlyAction, ReadonlyAssociation, ReadonlyAttribute, ReadonlyRecord, RecordDestroyed, RecordInvalid, RecordNotDestroyed, RecordNotFound, RecordNotSaved, RecordNotUnique, type RecordStatement, Relation, type RelationsFor, type RestrictMessages, type ReturnedRow, type Returning, type SafeSql, type SaveOptions, type Scope, type ScopeMethods, type ScopeStatic, type Scoped, type SecurePasswordOptions, type SecureTokenOptions, type SignedIdOptions, type SigningEnv, type SigningSecrets, SoleRecordExceeded, type StaleAction, StaleRecord, type Statement, StrictValidationFailed, type TableAttributes, type TableSchema, type TableSchemas, type ThroughDependent, type ThroughOptions, type TokenForOptions, type TouchOptions, type UniquenessOptions, UnknownAssociation, UnknownAttribute, UnknownModelName, type UpsertOptions, type ValidationCallbackOptions, type ValidationContext, type ValidationContexts, type ValidationError, type ValidationOptions, type WriteResult, abort, batch, belongsTo, between, column, defineSchema, defineType, generateSecureToken, gt, gte, hasMany, hasOne, lt, lte, sql, withDatabase };
2
+ import { $ as PageOptions, A as RelationsFor, At as lt, B as SigningSecrets, Bt as ColumnReference, Ct as OrderSpec, Dt as between, Et as Comparison, F as Batch, Ft as InOrderOfOptions, G as TokenForOptions, Gt as incoming, H as ValidationCallbackOptions, Ht as IncomingReference, I as RecordStatement, J as ScopeMethods, Jt as Comparable, K as Relation, Kt as sql, Lt as QuerySql, M as BatchEntry, Mt as QueryPart, N as BatchResults, Nt as FindSignedOptions, Ot as gt, P as batch, Pt as SignedIdOptions, Q as Page, S as CacheOptions, St as OnDuplicate, T as QueryListener, Tt as UpsertOptions, U as ValidationContext, Ut as SafeSql, V as SaveOptions, Vt as ColumnValue, W as ValidationContexts, Wt as column, X as IterationOptions, Xt as ComparisonOptions, Y as Scoped, Yt as ComparisonBound, Z as CountlessPage, _ as TableSchema, _t as PolymorphicBelongsTo, a as ValidationOptions, at as WriteResult, bt as Conditions, c as AttributeErrorMessages, ct as AssociationOptions, d as RestrictMessages, dt as HasManyCollection, et as TouchOptions, f as Model, ft as HasManyDependent, g as DatabaseSchema, gt as HasOneThrough, h as TableAttributes, ht as HasOneDependent, i as UniquenessOptions, it as Statement, jt as lte, kt as gte, l as ErrorMessage, lt as BelongsTo, m as ScopeStatic, mt as HasOne, n as LengthOptions, nt as Init, o as Errors, pt as HasManyThrough, q as Scope, r as NumericalityOptions, rt as ReturnedRow, s as ValidationError, t as AssociatedValidationOptions, tt as GroupedRelation, u as ErrorMessages, ut as HasMany, v as TableSchemas, vt as ThroughDependent, w as QueryEvent, wt as Returning, x as AttributeConversions, xt as InsertOptions, y as FilterAttribute, yt as ThroughOptions, z as SigningEnv } from "./validations-BUn_5T-8.mjs";
3
+ import { A as RecordNotSaved, C as ReadonlyAssociation, D as RecordInvalid, E as RecordDestroyed, F as StrictValidationFailed, I as UnknownAssociation, L as UnknownAttribute, M as SoleRecordExceeded, N as StaleAction, O as RecordNotDestroyed, P as StaleRecord, R as UnknownModelName, S as ReadonlyAction, T as ReadonlyRecord, _ as InvalidToken, a as hasMany, b as NoDatabase, c as ActiveRecordError, d as CheckViolation, f as ConstraintViolation, g as InvalidModel, h as InvalidForeignKey, i as belongsTo, j as RecordNotUnique, k as RecordNotFound, l as AssociationNotLoaded, m as IncompatibleRelation, n as withDatabase, o as hasOne, p as DeleteRestriction, r as PolymorphicBelongsToOptions, s as AbortAfterPersistence, t as defineSchema, u as CallbackAbort, v as IrreversibleOrder, w as ReadonlyAttribute, x as NotNullViolation, y as MissingAttribute, z as abort } from "./index-DkGTK5OS.mjs";
4
+ export { AbortAfterPersistence, ActiveRecordError, type AssociatedValidationOptions, AssociationNotLoaded, type AssociationOptions, type AttributeConversions, type AttributeErrorMessages, type AttributeSpec, type AttributeSpecs, type AttributeType, type Batch, type BatchEntry, type BatchResults, type BelongsTo, type CacheOptions, CallbackAbort, CheckViolation, type ColumnReference, type ColumnValue, type Comparable, type Comparison, type ComparisonBound, type ComparisonOptions, type Conditions, ConstraintViolation, type CountlessPage, type CustomType, type DatabaseSchema, DeleteRestriction, type Duration, type EpochStorage, type ErrorMessage, type ErrorMessages, Errors, type FilterAttribute, type FindSignedOptions, type GroupedRelation, type HasMany, type HasManyCollection, type HasManyDependent, type HasManyThrough, type HasOne, type HasOneDependent, type HasOneThrough, type InOrderOfOptions, type IncomingReference, IncompatibleRelation, type Init, type InsertOptions, InvalidForeignKey, InvalidModel, InvalidToken, IrreversibleOrder, type IterationOptions, type LengthOptions, MissingAttribute, Model, NoDatabase, NotNullViolation, type NumericalityOptions, type OnDuplicate, type OrderSpec, type Page, type PageOptions, type PasswordAlgorithm, type PolymorphicBelongsTo, type PolymorphicBelongsToOptions, type QueryEvent, type QueryListener, type QueryPart, type QuerySql, type ReadonlyAction, ReadonlyAssociation, ReadonlyAttribute, ReadonlyRecord, RecordDestroyed, RecordInvalid, RecordNotDestroyed, RecordNotFound, RecordNotSaved, RecordNotUnique, type RecordStatement, Relation, type RelationsFor, type RestrictMessages, type ReturnedRow, type Returning, type SafeSql, type SaveOptions, type Scope, type ScopeMethods, type ScopeStatic, type Scoped, type SecurePasswordOptions, type SecureTokenOptions, type SignedIdOptions, type SigningEnv, type SigningSecrets, SoleRecordExceeded, type StaleAction, StaleRecord, type Statement, StrictValidationFailed, type TableAttributes, type TableSchema, type TableSchemas, type ThroughDependent, type ThroughOptions, type TokenForOptions, type TouchOptions, type UniquenessOptions, UnknownAssociation, UnknownAttribute, UnknownModelName, type UpsertOptions, type ValidationCallbackOptions, type ValidationContext, type ValidationContexts, type ValidationError, type ValidationOptions, type WriteResult, abort, batch, belongsTo, between, column, defineSchema, defineType, generateSecureToken, gt, gte, hasMany, hasOne, incoming, lt, lte, sql, withDatabase };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as StaleRecord, A as AssociationNotLoaded, B as MissingAttribute, F as IncompatibleRelation, G as ReadonlyRecord, H as NotNullViolation, I as InvalidForeignKey, J as RecordNotDestroyed, K as RecordDestroyed, L as InvalidModel, M as CheckViolation, N as ConstraintViolation, O as AbortAfterPersistence, P as DeleteRestriction, Q as SoleRecordExceeded, R as InvalidToken, U as ReadonlyAssociation, V as NoDatabase, W as ReadonlyAttribute, X as RecordNotSaved, Y as RecordNotFound, Z as RecordNotUnique, et as StrictValidationFailed, it as abort, j as CallbackAbort, k as ActiveRecordError, nt as UnknownAttribute, q as RecordInvalid, rt as UnknownModelName, tt as UnknownAssociation, z as IrreversibleOrder } from "./identifiers-BP6aRwew.mjs";
2
- import { _ as lt, b as hasMany, c as Relation, d as column, f as sql, g as gte, h as gt, m as between, n as Model, r as withDatabase, t as batch, v as lte, x as hasOne, y as belongsTo } from "./batch-DpMoy3-7.mjs";
3
- import { Y as Errors, dt as defineType, st as generateSecureToken } from "./generated-model-CKIciUat.mjs";
4
- import { t as defineSchema } from "./src-CB2AUq70.mjs";
5
- export { AbortAfterPersistence, ActiveRecordError, AssociationNotLoaded, CallbackAbort, CheckViolation, ConstraintViolation, DeleteRestriction, Errors, IncompatibleRelation, InvalidForeignKey, InvalidModel, InvalidToken, IrreversibleOrder, MissingAttribute, Model, NoDatabase, NotNullViolation, ReadonlyAssociation, ReadonlyAttribute, ReadonlyRecord, RecordDestroyed, RecordInvalid, RecordNotDestroyed, RecordNotFound, RecordNotSaved, RecordNotUnique, Relation, SoleRecordExceeded, StaleRecord, StrictValidationFailed, UnknownAssociation, UnknownAttribute, UnknownModelName, abort, batch, belongsTo, between, column, defineSchema, defineType, generateSecureToken, gt, gte, hasMany, hasOne, lt, lte, sql, withDatabase };
1
+ import { $ as IrreversibleOrder, C as incoming, G as CallbackAbort, H as AbortAfterPersistence, J as DeleteRestriction, K as CheckViolation, O as sql, Q as InvalidToken, S as column, U as ActiveRecordError, W as AssociationNotLoaded, X as InvalidForeignKey, Y as IncompatibleRelation, Z as InvalidModel, _t as UnknownModelName, at as ReadonlyRecord, ct as RecordNotDestroyed, dt as RecordNotUnique, et as MissingAttribute, ft as SoleRecordExceeded, gt as UnknownAttribute, ht as UnknownAssociation, it as ReadonlyAttribute, lt as RecordNotFound, mt as StrictValidationFailed, nt as NotNullViolation, ot as RecordDestroyed, pt as StaleRecord, q as ConstraintViolation, rt as ReadonlyAssociation, st as RecordInvalid, tt as NoDatabase, ut as RecordNotSaved, vt as abort } from "./identifiers-DRLEguFD.mjs";
2
+ import { _ as belongsTo, c as Relation, f as between, g as lte, h as lt, m as gte, n as Model, p as gt, r as withDatabase, t as batch, v as hasMany, y as hasOne } from "./batch-vRCbt-jV.mjs";
3
+ import { Y as Errors, dt as defineType, st as generateSecureToken } from "./generated-model-DiQb9_3C.mjs";
4
+ import { t as defineSchema } from "./src-BhzdBCqv.mjs";
5
+ export { AbortAfterPersistence, ActiveRecordError, AssociationNotLoaded, CallbackAbort, CheckViolation, ConstraintViolation, DeleteRestriction, Errors, IncompatibleRelation, InvalidForeignKey, InvalidModel, InvalidToken, IrreversibleOrder, MissingAttribute, Model, NoDatabase, NotNullViolation, ReadonlyAssociation, ReadonlyAttribute, ReadonlyRecord, RecordDestroyed, RecordInvalid, RecordNotDestroyed, RecordNotFound, RecordNotSaved, RecordNotUnique, Relation, SoleRecordExceeded, StaleRecord, StrictValidationFailed, UnknownAssociation, UnknownAttribute, UnknownModelName, abort, batch, belongsTo, between, column, defineSchema, defineType, generateSecureToken, gt, gte, hasMany, hasOne, incoming, lt, lte, sql, withDatabase };
@@ -1,6 +1,6 @@
1
- import { i as attributeName, n as castDefault, s as listed, t as storageOverride, u as parseJsonc } from "./storage-override-B7WTiA_U.mjs";
2
- import { a as migrationSql, i as withDigits, n as namesInList, o as quotedName, r as withGeneratedEnum, s as indexName, t as generatedSchema } from "./for-adapters-DSVRZL3n.mjs";
3
- import { D as underscore } from "./identifiers-BP6aRwew.mjs";
1
+ import { i as attributeName, n as castDefault, s as listed, t as storageOverride, u as parseJsonc } from "./storage-override-BDgUIPQu.mjs";
2
+ import { a as migrationSql, i as withDigits, n as namesInList, o as quotedName, r as withGeneratedEnum, s as indexName, t as generatedSchema } from "./for-adapters-DvtC7L8N.mjs";
3
+ import { V as underscore } from "./identifiers-DRLEguFD.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
6
6
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
@@ -1,6 +1,6 @@
1
- import { i as attributeName, n as castDefault, p as byVersion, r as isCastDefaultType, u as parseJsonc } from "./storage-override-B7WTiA_U.mjs";
2
- import { a as migrationSql, i as withDigits, n as namesInList, o as quotedName, r as withGeneratedEnum, t as generatedSchema } from "./for-adapters-DSVRZL3n.mjs";
3
- import { D as underscore } from "./identifiers-BP6aRwew.mjs";
1
+ import { i as attributeName, n as castDefault, p as byVersion, r as isCastDefaultType, u as parseJsonc } from "./storage-override-BDgUIPQu.mjs";
2
+ import { a as migrationSql, i as withDigits, n as namesInList, o as quotedName, r as withGeneratedEnum, t as generatedSchema } from "./for-adapters-DvtC7L8N.mjs";
3
+ import { V as underscore } from "./identifiers-DRLEguFD.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { existsSync, readFileSync, readdirSync } from "node:fs";
6
6
  import { basename, dirname, join } from "node:path";
@@ -1,4 +1,4 @@
1
- import { C as QueryEvent$1, D as SchemaAdapter, O as AnyDatabase, w as QueryListener$1 } from "./validations-C2-HKi1V.mjs";
1
+ import { O as SchemaAdapter, S as CacheOptions, T as QueryListener$1, k as AnyDatabase, w as QueryEvent$1 } from "./validations-BUn_5T-8.mjs";
2
2
  import pg from "pg";
3
3
  /** The Postgres database a generated schema's Models query: `adapter: postgresql({ binding: "HYPERDRIVE" })`. */
4
4
  export declare function postgresql({ binding }: {
@@ -49,6 +49,11 @@ type QueryListener = QueryListener$1<PostgreSQLMeta>;
49
49
  interface ConnectOptions {
50
50
  /** Called once for every statement sent to Postgres, with Postgres's `meta`. */
51
51
  onQuery?: QueryListener;
52
+ /**
53
+ * Inside a `withDatabase` call, a read identical to one already sent there is answered from
54
+ * memory, until a write; `cache: { request: false }` turns that off.
55
+ */
56
+ cache?: CacheOptions;
52
57
  }
53
58
  /** Where a Database's Postgres is: a Hyperdrive binding (`env.HYPERDRIVE`), a connection string, or a `pg` Pool. */
54
59
  type PostgreSQLSource = Hyperdrive | string | Pool;
@@ -1,7 +1,7 @@
1
- import { a as databaseExecutor, i as AnyDatabase, l as workersEnv, u as DatabaseExecutor } from "./batch-DpMoy3-7.mjs";
2
- import { t as onlyRequested } from "./for-adapters-unqbZQM7.mjs";
3
- import { V as NoDatabase } from "./identifiers-BP6aRwew.mjs";
4
- import { w as boundValue } from "./generated-model-CKIciUat.mjs";
1
+ import { a as databaseExecutor, i as AnyDatabase, l as workersEnv, u as DatabaseExecutor } from "./batch-vRCbt-jV.mjs";
2
+ import { t as onlyRequested } from "./for-adapters-CIUvPeas.mjs";
3
+ import { tt as NoDatabase } from "./identifiers-DRLEguFD.mjs";
4
+ import { w as boundValue } from "./generated-model-DiQb9_3C.mjs";
5
5
  import pg from "pg";
6
6
  // src/adapters/postgresql/connect-timeout.ts
7
7
  /** The limit when the connection string sets none, in milliseconds. */
@@ -558,6 +558,11 @@ const pgAdapter = {
558
558
  model: write.model
559
559
  }];
560
560
  },
561
+ /** `json` has no equality operator, so a json attribute's values are compared as text. */
562
+ sameValue(left, right, { isJson }) {
563
+ if (isJson) return `CAST(${left} AS TEXT) IS NOT DISTINCT FROM CAST(${right} AS TEXT)`;
564
+ return `${left} IS NOT DISTINCT FROM ${right}`;
565
+ },
561
566
  /**
562
567
  * The removal returns a row for each row it removed, which the counters' UPDATEs count, and the
563
568
  * statement selects how many as `removed`: a COUNT sent before it could miss a row another
@@ -611,7 +616,8 @@ function clientsFor(source) {
611
616
  var Database = class extends AnyDatabase {
612
617
  #connectionString;
613
618
  constructor(source, options = {}) {
614
- super(new DatabaseExecutor(pgAdapter, new PgDriver(clientsFor(source)), options.onQuery));
619
+ const { onQuery, cache } = options;
620
+ super(new DatabaseExecutor(pgAdapter, new PgDriver(clientsFor(source)), onQuery, cache));
615
621
  this.#connectionString = connectionStringOf(source) ?? source.options?.connectionString;
616
622
  }
617
623
  /**
@@ -1,5 +1,5 @@
1
- import { n as Model, o as readyModel, s as isReservedScopeName } from "./batch-DpMoy3-7.mjs";
2
- import { Mt as staticBelow, Tt as ownValueSetter, jt as ancestors, wt as modelNameOf } from "./generated-model-CKIciUat.mjs";
1
+ import { n as Model, o as readyModel, s as isReservedScopeName } from "./batch-vRCbt-jV.mjs";
2
+ import { Mt as staticBelow, Tt as ownValueSetter, jt as ancestors, wt as modelNameOf } from "./generated-model-DiQb9_3C.mjs";
3
3
  // src/define-schema.ts
4
4
  const listed = /* @__PURE__ */ new Set();
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { D as underscore, T as camelize, c as castValue, d as uncastable, n as reservedWords, r as epochStorages } from "./identifiers-BP6aRwew.mjs";
1
+ import { V as underscore, c as castValue, d as uncastable, n as reservedWords, r as epochStorages, z as camelize } from "./identifiers-DRLEguFD.mjs";
2
2
  import { existsSync, readFileSync, readdirSync } from "node:fs";
3
3
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
4
4
  // cli/project/paths.ts