@forestfuture/active-record 0.9.0 → 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/adapter.d.mts +3 -3
- package/dist/adapter.mjs +4 -4
- package/dist/{batch-Ca1JtVcK.mjs → batch-vRCbt-jV.mjs} +1382 -963
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/command.mjs +8 -7
- package/dist/d1.d.mts +7 -2
- package/dist/d1.mjs +6 -6
- package/dist/{for-adapters-Bl6BCiR1.mjs → for-adapters-CIUvPeas.mjs} +1 -1
- package/dist/{for-adapters-DoyXc8Dq.d.mts → for-adapters-DKw2F6kp.d.mts} +1 -1
- package/dist/{for-adapters-D35a5x3t.mjs → for-adapters-DvtC7L8N.mjs} +2 -2
- package/dist/{generated-model-L4WAqgOZ.mjs → generated-model-DiQb9_3C.mjs} +61 -3
- package/dist/{identifiers-CzqYL_nC.mjs → identifiers-DRLEguFD.mjs} +188 -5
- package/dist/{index-Fq4gT3c8.d.mts → index-DkGTK5OS.d.mts} +26 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +5 -5
- package/dist/{metadata-BIUbGJlS.d.mts → metadata-nKZ_6DzA.d.mts} +17 -2
- package/dist/{plugin-BHUP4ssD.mjs → plugin-Bc2YeU6a.mjs} +3 -3
- package/dist/{plugin-BMAJKgj6.mjs → plugin-C36nVWER.mjs} +3 -3
- package/dist/postgresql.d.mts +6 -1
- package/dist/postgresql.mjs +11 -5
- package/dist/{src-fYq-nVHE.mjs → src-BhzdBCqv.mjs} +2 -2
- package/dist/{storage-override-yF2NT5ST.mjs → storage-override-BDgUIPQu.mjs} +1 -1
- package/dist/{validations-CKPJoSj4.d.mts → validations-BUn_5T-8.d.mts} +172 -99
- package/llms-full.txt +335 -30
- package/package.json +2 -2
- package/skills/active-record/SKILL.md +4 -2
package/dist/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AttributeType } from "./metadata-
|
|
1
|
+
import { a as AttributeType } from "./metadata-nKZ_6DzA.mjs";
|
|
2
2
|
type ColumnType = "string" | "integer" | "real" | "decimal" | "boolean" | "datetime" | "date" | "time" | "json" | "binary" | "references";
|
|
3
3
|
/** One column as the generators' syntax gives it: `email:string!:unique`, `user:references`. */
|
|
4
4
|
interface ColumnArg {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
4
|
-
import {
|
|
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-
|
|
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-
|
|
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
|
|
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 {
|
|
2
|
-
import { c as ActiveRecordError } from "./index-
|
|
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-
|
|
2
|
-
import { t as onlyRequested } from "./for-adapters-
|
|
3
|
-
import {
|
|
4
|
-
import { w as boundValue } from "./generated-model-
|
|
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 {
|
|
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 {
|
|
2
|
-
import { f as byName, o as exportName } from "./storage-override-
|
|
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
|
|
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) {
|
|
@@ -629,7 +629,17 @@ const rules = {
|
|
|
629
629
|
requires: "virtual",
|
|
630
630
|
conflictsWith: ["default"]
|
|
631
631
|
},
|
|
632
|
-
secureToken: secureTokenRule()
|
|
632
|
+
secureToken: secureTokenRule(),
|
|
633
|
+
readonly: {
|
|
634
|
+
isWellFormed: (value) => typeof value === "boolean",
|
|
635
|
+
describedAs: "readonly",
|
|
636
|
+
isGiven: isGivenUnless(false),
|
|
637
|
+
conflictsWith: [
|
|
638
|
+
"virtual",
|
|
639
|
+
"securePassword",
|
|
640
|
+
"secureToken"
|
|
641
|
+
]
|
|
642
|
+
}
|
|
633
643
|
};
|
|
634
644
|
/** The rule for `secureToken`: a string's random token, generated for a new record (#355). */
|
|
635
645
|
function secureTokenRule() {
|
|
@@ -1339,6 +1349,8 @@ var RecordState = class {
|
|
|
1339
1349
|
isMarkedForDestruction = false;
|
|
1340
1350
|
/** Whether the save being prepared sends a locked UPDATE, which sets the row's version (#357). */
|
|
1341
1351
|
isSavingVersion = false;
|
|
1352
|
+
/** Marked read-only (#358): by `markReadonly()`, or loaded through a `readonly()` Relation. */
|
|
1353
|
+
isReadonly = false;
|
|
1342
1354
|
/** Whether its last save created it (#351). */
|
|
1343
1355
|
isPreviouslyNew = false;
|
|
1344
1356
|
/** The contexts it's being validated in, while it is (#51). */
|
|
@@ -1421,6 +1433,7 @@ var RecordState = class {
|
|
|
1421
1433
|
this.#requireNotDestroyed("be changed");
|
|
1422
1434
|
const name = attributeName(this.#model, given);
|
|
1423
1435
|
const assigned = this.#attribute(name).assigned(value);
|
|
1436
|
+
this.#requireSameIfReadonly(name, assigned);
|
|
1424
1437
|
const digest = digestOf(this.#model.attributeDefinitions, name);
|
|
1425
1438
|
if (digest !== void 0 && assigned === "") return;
|
|
1426
1439
|
if (digest !== void 0 && assigned === null) {
|
|
@@ -1435,7 +1448,18 @@ var RecordState = class {
|
|
|
1435
1448
|
*/
|
|
1436
1449
|
writeKey(name, value, association) {
|
|
1437
1450
|
this.#requireNotDestroyed("be changed");
|
|
1438
|
-
|
|
1451
|
+
const key = this.#attribute(name).key(value, association);
|
|
1452
|
+
this.#requireSameIfReadonly(name, key);
|
|
1453
|
+
this.#store(name, key);
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Takes a value the database already holds, as stored, such as a count a counter cache changed
|
|
1457
|
+
* (#61): no read-only check (#358), and nothing to save.
|
|
1458
|
+
*/
|
|
1459
|
+
takeStored(given, value) {
|
|
1460
|
+
const name = attributeName(this.#model, given);
|
|
1461
|
+
this.#store(name, this.#attribute(name).assigned(value));
|
|
1462
|
+
this.commitColumns([name]);
|
|
1439
1463
|
}
|
|
1440
1464
|
/** Stores an attribute's already-cast value, as assigned. */
|
|
1441
1465
|
#store(name, value) {
|
|
@@ -1662,6 +1686,16 @@ var RecordState = class {
|
|
|
1662
1686
|
#requireNotDestroyed(action) {
|
|
1663
1687
|
if (this.#lifecycle === "destroyed") throw new RecordDestroyed(`${this.#model.name} record was destroyed; it can't ${action}`);
|
|
1664
1688
|
}
|
|
1689
|
+
/**
|
|
1690
|
+
* A persisted record's read-only attribute takes only the value it holds, cast and normalized
|
|
1691
|
+
* (#358), so a form can post it back unchanged.
|
|
1692
|
+
*/
|
|
1693
|
+
#requireSameIfReadonly(name, assigned) {
|
|
1694
|
+
if (this.#definition(name).readonly !== true || this.#lifecycle !== "persisted") return;
|
|
1695
|
+
const before = this.#isInSnapshot(name) ? this.#snapshotValue(name) : void 0;
|
|
1696
|
+
if (before !== void 0 && this.#attribute(name).isSame(before, assigned)) return;
|
|
1697
|
+
throw new ReadonlyAttribute(this.#model.name, name);
|
|
1698
|
+
}
|
|
1665
1699
|
/** An unknown name is UnknownAttribute, even one every object inherits (`constructor`, #84). */
|
|
1666
1700
|
#requireAttribute(name) {
|
|
1667
1701
|
this.#definition(name);
|
|
@@ -2161,7 +2195,9 @@ var Attribute = class {
|
|
|
2161
2195
|
*/
|
|
2162
2196
|
cast(value) {
|
|
2163
2197
|
requireDefined(this.#model, this.name, value);
|
|
2198
|
+
refuseAssignedReference(this.#model.name, this.name, value);
|
|
2164
2199
|
const cast = this.#convertOrRefuse(value, () => castValue(this.#definition, value));
|
|
2200
|
+
this.#refuseNestedInCustomJson(cast);
|
|
2165
2201
|
if (cast === uncastable && this.#isValidatedEnum()) return value;
|
|
2166
2202
|
return this.#orRefuse(cast, value);
|
|
2167
2203
|
}
|
|
@@ -2245,6 +2281,7 @@ var Attribute = class {
|
|
|
2245
2281
|
try {
|
|
2246
2282
|
stored = writeValue(this.#definition, value);
|
|
2247
2283
|
} catch (error) {
|
|
2284
|
+
this.#refuseNested(error);
|
|
2248
2285
|
if (this.#definition.customType !== void 0) throw this.#refusal(value, void 0, error);
|
|
2249
2286
|
if (this.#definition.type !== "json") throw error;
|
|
2250
2287
|
throw this.#refusal(value);
|
|
@@ -2319,10 +2356,31 @@ var Attribute = class {
|
|
|
2319
2356
|
try {
|
|
2320
2357
|
return convert();
|
|
2321
2358
|
} catch (error) {
|
|
2359
|
+
this.#refuseNested(error);
|
|
2322
2360
|
if (this.#definition.customType === void 0) throw error;
|
|
2323
2361
|
throw this.#refusal(value, void 0, error);
|
|
2324
2362
|
}
|
|
2325
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
|
+
}
|
|
2326
2384
|
/** Whether the attribute's values are hidden from listeners and errors (#83). */
|
|
2327
2385
|
#isHidden() {
|
|
2328
2386
|
return isFiltered(this.#model, this.name);
|
|
@@ -137,6 +137,43 @@ var StaleRecord = class extends ActiveRecordError {
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
/**
|
|
140
|
+
* Assigning a persisted record's read-only attribute a value other than the one it holds (#358):
|
|
141
|
+
* it's written when the record is created, and never changed by it after.
|
|
142
|
+
*/
|
|
143
|
+
var ReadonlyAttribute = class extends ActiveRecordError {
|
|
144
|
+
name = "ReadonlyAttribute";
|
|
145
|
+
attribute;
|
|
146
|
+
constructor(model, attribute) {
|
|
147
|
+
super(`${model}'s "${attribute}" is read-only once it's created; it can't be changed`);
|
|
148
|
+
this.attribute = attribute;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* A write of a read-only record (#358): one marked by `markReadonly()`, or loaded through a
|
|
153
|
+
* `readonly()` Relation. Nothing ran and nothing was sent.
|
|
154
|
+
*/
|
|
155
|
+
var ReadonlyRecord = class extends ActiveRecordError {
|
|
156
|
+
name = "ReadonlyRecord";
|
|
157
|
+
record;
|
|
158
|
+
action;
|
|
159
|
+
constructor(record, action) {
|
|
160
|
+
super(`${record.constructor.name} record is read-only; it can't ${verbs[action]}`);
|
|
161
|
+
this.record = record;
|
|
162
|
+
this.action = action;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
/** How a refused action reads after "it can't". */
|
|
166
|
+
const verbs = {
|
|
167
|
+
save: "be saved",
|
|
168
|
+
destroy: "be destroyed",
|
|
169
|
+
touch: "be touched",
|
|
170
|
+
updateColumns: "be written by updateColumns",
|
|
171
|
+
updateColumn: "be written by updateColumn",
|
|
172
|
+
incrementColumn: "be written by incrementColumn",
|
|
173
|
+
decrementColumn: "be written by decrementColumn",
|
|
174
|
+
toggleColumn: "be written by toggleColumn"
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
140
177
|
* `abort()` was thrown from an after-write callback (`afterSave`, `afterCreate`, `afterUpdate`,
|
|
141
178
|
* `afterDestroy`, `afterTouch`), or from an around callback once its `next()` resolved. That's a
|
|
142
179
|
* mistake: the write already succeeded and nothing rolls back.
|
|
@@ -583,6 +620,151 @@ function incremented(digits) {
|
|
|
583
620
|
while (index >= 0 && digits[index] === "9") index--;
|
|
584
621
|
return (index < 0 ? "1" : digits.slice(0, index) + String(Number(digits[index]) + 1)) + "0".repeat(digits.length - 1 - index);
|
|
585
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
|
+
}
|
|
586
768
|
// src/conversion.ts
|
|
587
769
|
/** A value that can't be read as the attribute's type. */
|
|
588
770
|
const uncastable = Symbol("uncastable");
|
|
@@ -627,7 +809,7 @@ const converters = {
|
|
|
627
809
|
json: {
|
|
628
810
|
cast: castJson,
|
|
629
811
|
read: readJson,
|
|
630
|
-
write:
|
|
812
|
+
write: jsonText
|
|
631
813
|
},
|
|
632
814
|
binary: {
|
|
633
815
|
cast: castBinary,
|
|
@@ -833,14 +1015,15 @@ function castBoolean(value) {
|
|
|
833
1015
|
/**
|
|
834
1016
|
* Any value JSON can write, as it is. What `stringify` writes lossily (a `Map` as `{}`, `NaN` as
|
|
835
1017
|
* `null`) is kept; what it throws on (a BigInt, a cycle) or gives nothing for (a function, a
|
|
836
|
-
* 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
|
|
837
1019
|
* refused where it's assigned rather than where it's stored, and the cost is one more
|
|
838
1020
|
* `stringify` per assignment.
|
|
839
1021
|
*/
|
|
840
1022
|
function castJson(value) {
|
|
841
1023
|
try {
|
|
842
|
-
return
|
|
843
|
-
} catch {
|
|
1024
|
+
return jsonText(value) === void 0 ? uncastable : value;
|
|
1025
|
+
} catch (error) {
|
|
1026
|
+
if (error instanceof NestedReferenceFound) throw error;
|
|
844
1027
|
return uncastable;
|
|
845
1028
|
}
|
|
846
1029
|
}
|
|
@@ -1011,4 +1194,4 @@ function isIdentifier(name) {
|
|
|
1011
1194
|
}
|
|
1012
1195
|
/** Words JavaScript doesn't allow as a declaration's name in a module (strict mode). */
|
|
1013
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(" "));
|
|
1014
|
-
export {
|
|
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 {
|
|
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;
|
|
@@ -126,6 +126,30 @@ declare class StaleRecord extends ActiveRecordError {
|
|
|
126
126
|
readonly action: StaleAction;
|
|
127
127
|
constructor(record: Model, action: StaleAction, options?: ErrorOptions);
|
|
128
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Assigning a persisted record's read-only attribute a value other than the one it holds (#358):
|
|
131
|
+
* it's written when the record is created, and never changed by it after.
|
|
132
|
+
*/
|
|
133
|
+
declare class ReadonlyAttribute extends ActiveRecordError {
|
|
134
|
+
name: string;
|
|
135
|
+
readonly attribute: string;
|
|
136
|
+
constructor(model: string, attribute: string);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* What a read-only record was refused (#358): a save, a destroy, a `touch()`, or a write straight
|
|
140
|
+
* to its row, named by its method.
|
|
141
|
+
*/
|
|
142
|
+
type ReadonlyAction = "save" | "destroy" | "touch" | "updateColumns" | "updateColumn" | "incrementColumn" | "decrementColumn" | "toggleColumn";
|
|
143
|
+
/**
|
|
144
|
+
* A write of a read-only record (#358): one marked by `markReadonly()`, or loaded through a
|
|
145
|
+
* `readonly()` Relation. Nothing ran and nothing was sent.
|
|
146
|
+
*/
|
|
147
|
+
declare class ReadonlyRecord extends ActiveRecordError {
|
|
148
|
+
name: string;
|
|
149
|
+
readonly record: Model;
|
|
150
|
+
readonly action: ReadonlyAction;
|
|
151
|
+
constructor(record: Model, action: ReadonlyAction);
|
|
152
|
+
}
|
|
129
153
|
/**
|
|
130
154
|
* `abort()` was thrown from an after-write callback (`afterSave`, `afterCreate`, `afterUpdate`,
|
|
131
155
|
* `afterDestroy`, `afterTouch`), or from an around callback once its `next()` resolved. That's a
|
|
@@ -279,4 +303,4 @@ declare function withDatabase<R>(databases: AnyDatabase | readonly AnyDatabase[]
|
|
|
279
303
|
* which defines the scope on it; on any other, it's `undefined`.
|
|
280
304
|
*/
|
|
281
305
|
declare function defineSchema<const S extends DatabaseSchema>(schema: S): S;
|
|
282
|
-
export {
|
|
306
|
+
export { RecordNotSaved as A, ReadonlyAssociation as C, RecordInvalid as D, RecordDestroyed as E, StrictValidationFailed as F, UnknownAssociation as I, UnknownAttribute as L, SoleRecordExceeded as M, StaleAction as N, RecordNotDestroyed as O, StaleRecord as P, UnknownModelName as R, ReadonlyAction as S, ReadonlyRecord as T, InvalidToken as _, hasMany as a, NoDatabase as b, ActiveRecordError as c, CheckViolation as d, ConstraintViolation as f, InvalidModel as g, InvalidForeignKey as h, belongsTo as i, RecordNotUnique as j, RecordNotFound as k, AssociationNotLoaded as l, IncompatibleRelation as m, withDatabase as n, hasOne as o, DeleteRestriction as p, PolymorphicBelongsToOptions as r, AbortAfterPersistence as s, defineSchema as t, CallbackAbort as u, IrreversibleOrder as v, ReadonlyAttribute as w, NotNullViolation as x, MissingAttribute as y, abort as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { A as
|
|
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, ReadonlyAssociation, 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 };
|
|
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 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
|
|
2
|
-
import { _ as
|
|
3
|
-
import { Y as Errors, dt as defineType, st as generateSecureToken } from "./generated-model-
|
|
4
|
-
import { t as defineSchema } from "./src-
|
|
5
|
-
export { AbortAfterPersistence, ActiveRecordError, AssociationNotLoaded, CallbackAbort, CheckViolation, ConstraintViolation, DeleteRestriction, Errors, IncompatibleRelation, InvalidForeignKey, InvalidModel, InvalidToken, IrreversibleOrder, MissingAttribute, Model, NoDatabase, NotNullViolation, ReadonlyAssociation, 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 };
|