@voltro/database 0.62.3 → 0.64.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/CHANGELOG.md +104 -0
- package/dist/{frameworkLiveTables-CewCJ809.js → frameworkLiveTables-BURogL9N.js} +223 -188
- package/dist/index.d.ts +225 -35
- package/dist/index.js +840 -817
- package/dist/sql.d.ts +37 -11
- package/dist/sql.js +973 -953
- package/dist/wire-B28cPjEp.js +32 -0
- package/dist/wire.d.ts +21 -0
- package/dist/wire.js +2 -5
- package/package.json +2 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
//#region src/optimisticVersion.ts
|
|
3
|
+
var t = class extends e.TaggedError()("VersionConflict", {
|
|
4
|
+
table: e.String,
|
|
5
|
+
id: e.String,
|
|
6
|
+
expected: e.Number,
|
|
7
|
+
actual: e.NullOr(e.Number)
|
|
8
|
+
}) {}, n = (e) => {
|
|
9
|
+
for (let [t, n] of Object.entries(e)) if (n?.definition?.versionColumn === !0) return t;
|
|
10
|
+
}, r = (e) => {
|
|
11
|
+
let { versionColumn: t, patch: n } = e;
|
|
12
|
+
if (t === void 0) return {
|
|
13
|
+
nextVersion: void 0,
|
|
14
|
+
expected: void 0,
|
|
15
|
+
patch: { ...n }
|
|
16
|
+
};
|
|
17
|
+
let r = n[t], i = typeof r == "number" && Number.isFinite(r) ? r : void 0, a = { ...n };
|
|
18
|
+
return delete a[t], {
|
|
19
|
+
nextVersion: i === void 0 ? void 0 : i + 1,
|
|
20
|
+
expected: i,
|
|
21
|
+
patch: a
|
|
22
|
+
};
|
|
23
|
+
}, i = (e) => {
|
|
24
|
+
if (e.expected !== void 0 && (e.current === null || e.current !== e.expected)) return new t({
|
|
25
|
+
table: e.table,
|
|
26
|
+
id: e.id,
|
|
27
|
+
expected: e.expected,
|
|
28
|
+
actual: e.current
|
|
29
|
+
});
|
|
30
|
+
}, a = 1, o = e.DateFromNumber, s = e.NullOr(o);
|
|
31
|
+
//#endregion
|
|
32
|
+
export { r as a, t as i, s as n, i as o, a as r, n as s, o as t };
|
package/dist/wire.d.ts
CHANGED
|
@@ -41,4 +41,25 @@ export declare const timestampMs: Schema.Schema<Date, number>;
|
|
|
41
41
|
*/
|
|
42
42
|
export declare const timestampMsOrNull: Schema.Schema<Date | null, number | null>;
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* A write lost the race.
|
|
46
|
+
*
|
|
47
|
+
* Carries both numbers because "someone else changed it" is not actionable and
|
|
48
|
+
* "you had 3, it is now 7" is: four intervening writes is a different situation
|
|
49
|
+
* from one, and a UI can say so.
|
|
50
|
+
*/
|
|
51
|
+
export declare class VersionConflict extends VersionConflict_base {
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare const VersionConflict_base: Schema.TaggedErrorClass<VersionConflict, "VersionConflict", {
|
|
55
|
+
readonly _tag: Schema.tag<"VersionConflict">;
|
|
56
|
+
} & {
|
|
57
|
+
table: typeof Schema.String;
|
|
58
|
+
id: typeof Schema.String;
|
|
59
|
+
/** What the caller believed the row was at. */
|
|
60
|
+
expected: typeof Schema.Number;
|
|
61
|
+
/** What it is actually at. `null` when the row is gone entirely. */
|
|
62
|
+
actual: Schema.NullOr<typeof Schema.Number>;
|
|
63
|
+
}>;
|
|
64
|
+
|
|
44
65
|
export { }
|
package/dist/wire.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
var t = e.DateFromNumber, n = e.NullOr(t);
|
|
4
|
-
//#endregion
|
|
5
|
-
export { t as timestampMs, n as timestampMsOrNull };
|
|
1
|
+
import { i as e, n as t, t as n } from "./wire-B28cPjEp.js";
|
|
2
|
+
export { e as VersionConflict, n as timestampMs, t as timestampMsOrNull };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/database",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "Browser-safe schema DSL, query builder, and cross-dialect migration planner for Voltro — one schema, every SQL backend.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@effect/sql": "^0.52.0",
|
|
47
|
-
"@voltro/logger": "0.
|
|
47
|
+
"@voltro/logger": "0.64.0",
|
|
48
48
|
"typeid-js": "^1.2.0",
|
|
49
49
|
"ulidx": "^2.4.1"
|
|
50
50
|
},
|