@vibeorm/sql 4.1.0 → 4.3.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/ast.d.ts +221 -1
- package/dist/codecs.d.ts +2 -0
- package/dist/dialect.d.ts +118 -1
- package/dist/dialects/mysql-check-probe.d.ts +1 -0
- package/dist/dialects/mysql-generated-columns.d.ts +43 -0
- package/dist/dialects/mysql-index-expressions.d.ts +20 -0
- package/dist/dialects/mysql-row-rules.d.ts +8 -0
- package/dist/dialects/postgres-generated-columns.d.ts +30 -0
- package/dist/dialects/postgres-index-expressions.d.ts +10 -0
- package/dist/dialects/postgres-index-keys.d.ts +15 -0
- package/dist/dialects/postgres-row-rules.d.ts +25 -0
- package/dist/dialects/sqlite-generated-columns.d.ts +18 -0
- package/dist/dialects/sqlite-index-expressions.d.ts +23 -0
- package/dist/dialects/sqlite-row-rules.d.ts +8 -0
- package/dist/dialects/sqlite-table-definition.d.ts +25 -5
- package/dist/generated-columns.d.ts +18 -0
- package/dist/index-expressions.d.ts +61 -0
- package/dist/index.d.ts +19 -6
- package/dist/index.js +2358 -1079
- package/dist/index.js.map +32 -18
- package/dist/key-list.d.ts +83 -0
- package/dist/like.d.ts +17 -0
- package/dist/local-date.d.ts +9 -0
- package/dist/pg-array.d.ts +6 -0
- package/dist/predicate.d.ts +21 -7
- package/dist/query/index.js +59 -19
- package/dist/query/index.js.map +7 -7
- package/dist/query/state.d.ts +5 -0
- package/dist/query/types.d.ts +2 -0
- package/dist/row-rules.d.ts +57 -0
- package/dist/timestamp-identity.d.ts +8 -2
- package/package.json +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { FieldIR, ModelIR, QualifiedSqlName, RowRuleEvent, RowRuleIR, SchemaIR, SqlObjectIdentity } from "@vibeorm/schema";
|
|
2
|
+
import type { SqlDialect } from "./dialect.ts";
|
|
3
|
+
/** Finalized row-only inputs for the two per-event trigger renderers; not a SQL root export. */
|
|
4
|
+
export type EventRowRuleContext = {
|
|
5
|
+
readonly model: string;
|
|
6
|
+
readonly table: QualifiedSqlName;
|
|
7
|
+
readonly rule: RowRuleIR;
|
|
8
|
+
readonly triggers: readonly {
|
|
9
|
+
readonly event: RowRuleEvent;
|
|
10
|
+
readonly identity: {
|
|
11
|
+
readonly kind: "trigger";
|
|
12
|
+
readonly table: QualifiedSqlName;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
};
|
|
15
|
+
}[];
|
|
16
|
+
readonly protectedFields: readonly FieldIR[];
|
|
17
|
+
readonly gateField?: FieldIR;
|
|
18
|
+
/** MySQL only: keep a re-created trigger at its earlier action-order position. */
|
|
19
|
+
readonly placement?: Readonly<Record<string, RowRuleTriggerPlacement>>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* MySQL `FOLLOWS`/`PRECEDES` position for one rule trigger, keyed by its event
|
|
23
|
+
* trigger name. Disposable references use it to re-create a trigger where it was,
|
|
24
|
+
* so a verification replay never changes the action order it then compares.
|
|
25
|
+
*/
|
|
26
|
+
export type RowRuleTriggerPlacement = {
|
|
27
|
+
readonly follows: string;
|
|
28
|
+
} | {
|
|
29
|
+
readonly precedes: string;
|
|
30
|
+
};
|
|
31
|
+
/** Parameter-free rule DDL; each function body remains one complete statement. */
|
|
32
|
+
export type RowRuleStatement = {
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly values: readonly unknown[];
|
|
35
|
+
};
|
|
36
|
+
/** Dialect-neutral physical output; later dialects may emit several triggers and no function. */
|
|
37
|
+
export type RenderedRowRule = {
|
|
38
|
+
readonly identities: readonly SqlObjectIdentity[];
|
|
39
|
+
/** Create objects after the final table shape exists, in dependency order. */
|
|
40
|
+
readonly create: readonly RowRuleStatement[];
|
|
41
|
+
/** Drop objects before invalidating table changes, in reverse dependency order. */
|
|
42
|
+
readonly drop: readonly RowRuleStatement[];
|
|
43
|
+
/** Logical fields, not observed catalog dependencies; generated fields are excluded. */
|
|
44
|
+
readonly protectedFields: readonly string[];
|
|
45
|
+
/** OLD's non-NULL activation field; it is also protected against later changes. */
|
|
46
|
+
readonly gateField?: string;
|
|
47
|
+
};
|
|
48
|
+
/** Render a canonical declaration against the complete finalized model and authored generated-column evidence. */
|
|
49
|
+
export declare function renderRowRule({ schema, model, rule, dialect, placement }: {
|
|
50
|
+
readonly schema: SchemaIR;
|
|
51
|
+
readonly model: ModelIR;
|
|
52
|
+
readonly rule: RowRuleIR;
|
|
53
|
+
readonly dialect: SqlDialect;
|
|
54
|
+
/** MySQL only; other engines have no trigger-order clause. */
|
|
55
|
+
readonly placement?: Readonly<Record<string, RowRuleTriggerPlacement>>;
|
|
56
|
+
}): RenderedRowRule;
|
|
57
|
+
//# sourceMappingURL=row-rules.d.ts.map
|
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
type TimestampIdentity = {
|
|
3
3
|
readonly milliseconds: number;
|
|
4
4
|
readonly text: string;
|
|
5
|
-
readonly numeric
|
|
6
|
-
|
|
5
|
+
readonly numeric: number | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The exact equality key: given by the decoder, or computed on first use
|
|
8
|
+
* ({@link identityKey}) — a pure function of `milliseconds` and `text`, so
|
|
9
|
+
* computing it later yields the same string (A-02: most decoded Dates never
|
|
10
|
+
* need it, and building it cost more than the parse itself).
|
|
11
|
+
*/
|
|
12
|
+
key: string | undefined;
|
|
7
13
|
readonly kind: "timestamp" | "time" | "timetz" | "sqlite";
|
|
8
14
|
};
|
|
9
15
|
/** Retain transport text while the ordinary Date still represents the decoded value. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeorm/sql",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Dialect-aware SQL layer for VibeORM v2 — SQL AST, renderers and capability tables for postgres, sqlite and mysql",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"bun": ">=1.2.0"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@vibeorm/schema": "4.
|
|
53
|
+
"@vibeorm/schema": "4.3.0"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|