@vibeorm/sql 5.8.0 → 5.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.
Files changed (51) hide show
  1. package/README.md +1 -0
  2. package/dist/ast.d.ts +293 -9
  3. package/dist/codecs.d.ts +106 -12
  4. package/dist/composable.d.ts +44 -4
  5. package/dist/dialect.d.ts +30 -2
  6. package/dist/dialects/diagnostics.d.ts +1 -1
  7. package/dist/dialects/migration-inventory.d.ts +0 -11
  8. package/dist/dialects/migration-shadow-marker.d.ts +65 -0
  9. package/dist/dialects/mysql-generated-columns.d.ts +1 -5
  10. package/dist/dialects/mysql-index-expressions.d.ts +1 -19
  11. package/dist/dialects/mysql-row-rules.d.ts +1 -7
  12. package/dist/dialects/postgres-generated-columns.d.ts +0 -5
  13. package/dist/dialects/postgres-index-expressions.d.ts +1 -9
  14. package/dist/dialects/postgres-rls-readiness.d.ts +0 -2
  15. package/dist/dialects/postgres-rls.d.ts +7 -1
  16. package/dist/dialects/postgres-row-rules.d.ts +1 -24
  17. package/dist/dialects/sqlite-fts.d.ts +2 -2
  18. package/dist/dialects/sqlite-generated-columns.d.ts +1 -12
  19. package/dist/dialects/sqlite-index-expressions.d.ts +1 -22
  20. package/dist/dialects/sqlite-json-equality.d.ts +1 -14
  21. package/dist/dialects/sqlite-row-rules.d.ts +1 -7
  22. package/dist/dialects/sqlite-table-definition.d.ts +0 -19
  23. package/dist/dialects/test-databases.d.ts +96 -0
  24. package/dist/expr-fragment.d.ts +13 -0
  25. package/dist/identifiers.d.ts +1 -4
  26. package/dist/index-expressions.d.ts +8 -2
  27. package/dist/index.d.ts +16 -7
  28. package/dist/index.js +4148 -2762
  29. package/dist/index.js.map +49 -42
  30. package/dist/json-patch.d.ts +82 -0
  31. package/dist/json-path.d.ts +2 -0
  32. package/dist/key-list.d.ts +0 -21
  33. package/dist/native-types.d.ts +72 -0
  34. package/dist/params.d.ts +0 -2
  35. package/dist/query/expressions.d.ts +1 -33
  36. package/dist/query/index.js.map +7 -7
  37. package/dist/query/mutations.d.ts +1 -14
  38. package/dist/query/reusable.d.ts +1 -16
  39. package/dist/query/select.d.ts +1 -10
  40. package/dist/query/sources.d.ts +1 -36
  41. package/dist/query/state.d.ts +1 -77
  42. package/dist/query-plan.d.ts +2 -2
  43. package/dist/render.d.ts +9 -0
  44. package/dist/result-decoder.d.ts +21 -1
  45. package/dist/row-rules.d.ts +1 -19
  46. package/dist/sql-bindings.d.ts +7 -43
  47. package/dist/sql-handles.d.ts +1 -3
  48. package/dist/sql-input.d.ts +8 -24
  49. package/dist/timestamp-identity.d.ts +6 -12
  50. package/dist/timestamp-text.d.ts +36 -0
  51. package/package.json +2 -2
@@ -1,15 +1,2 @@
1
- import type { Expression, MutationBuilder, Table, WriteValues } from "./types.ts";
2
- /** Explicit physical SQL DEFAULT, not an application-side default callback. */
3
- export declare const sqlDefault: Expression<never>;
4
- export declare function insert<Row, Input>(params: {
5
- into: Table<Row, Input>;
6
- values: WriteValues<NoInfer<Input>> | readonly WriteValues<NoInfer<Input>>[];
7
- }): MutationBuilder<Row>;
8
- export declare function update<Row, Input>(params: {
9
- table: Table<Row, Input>;
10
- set: Partial<WriteValues<NoInfer<Input>>>;
11
- }): MutationBuilder<Row>;
12
- export declare function deleteRows<Row, Input>(params: {
13
- table: Table<Row, Input>;
14
- }): MutationBuilder<Row>;
1
+ export {};
15
2
  //# sourceMappingURL=mutations.d.ts.map
@@ -1,17 +1,2 @@
1
- import type { ReusableSqlCommand, ReusableSqlQuery, SqlCommand, SqlInput, SqlInputMap, SqlInputTokens, SqlInputValues, SqlQuery } from "@vibeorm/sql";
2
- import type { Expression, Table } from "./types.ts";
3
- /** Capture a physical column's write input without borrowing its read output type. */
4
- export declare function input<Row, Input, K extends keyof Row & keyof Input & string>(params: {
5
- readonly table: Table<Row, Input>;
6
- readonly column: K;
7
- }): SqlInput<Exclude<Input[K], undefined | Expression<never>>>;
8
- /** Run one synchronous builder callback with private, write-only input tokens. */
9
- export declare function reusable<const D extends SqlInputMap, Row>(params: {
10
- readonly params: D;
11
- readonly build: (params: SqlInputTokens<D>) => SqlQuery<Row>;
12
- }): ReusableSqlQuery<SqlInputValues<D>, Row>;
13
- export declare function reusable<const D extends SqlInputMap>(params: {
14
- readonly params: D;
15
- readonly build: (params: SqlInputTokens<D>) => SqlCommand;
16
- }): ReusableSqlCommand<SqlInputValues<D>>;
1
+ export {};
17
2
  //# sourceMappingURL=reusable.d.ts.map
@@ -1,11 +1,2 @@
1
- import type { SqlQuery } from "@vibeorm/sql";
2
- import type { SelectBuilder, Source } from "./types.ts";
3
- export declare function from<Row, A extends string>(params: {
4
- source: Source<Row>;
5
- as: A;
6
- }): SelectBuilder<Record<A, Row>>;
7
- export declare function union<Row>(params: {
8
- queries: readonly SqlQuery<Row>[];
9
- all?: boolean;
10
- }): SqlQuery<Row>;
1
+ export {};
11
2
  //# sourceMappingURL=select.d.ts.map
@@ -1,37 +1,2 @@
1
- import type { ResultReadDecoder, SqlQuery } from "@vibeorm/sql";
2
- import type { ColumnDefinitions, Columns, Expression, Projection, ProjectionRow, Scope, Source, Table } from "./types.ts";
3
- import type { Binding, ColumnKey, ProjectionEntry, RenderContext } from "./state.ts";
4
- export declare function makeTable<Row, Input = Partial<Row>>(params: {
5
- name: string;
6
- namespace?: string;
7
- columns: ColumnDefinitions<Row>;
8
- required?: readonly string[];
9
- readOnly?: boolean;
10
- }): Table<Row, Input>;
11
- export declare function makeDerived<Row>(params: {
12
- query: SqlQuery<Row>;
13
- name?: string;
14
- }): Source<Row>;
15
- export declare function makeBinding(params: {
16
- source: Source<unknown>;
17
- alias: string;
18
- nullable?: boolean;
19
- }): Binding;
20
- export declare function bindingColumns<Row>(binding: Binding, qualified?: boolean): Columns<Row>;
21
- export declare function scope<S>(bindings: readonly Binding[]): Scope<S>;
22
- export declare function renderSource(params: {
23
- context: RenderContext;
24
- binding: Binding;
25
- }): string;
26
- export declare function projectionEntries(params: {
27
- projection: Projection;
28
- bindings: readonly Binding[];
29
- aggregates?: boolean;
30
- }): readonly ProjectionEntry[];
31
- export declare function renderEntries(params: {
32
- entries: readonly ProjectionEntry[];
33
- context: RenderContext;
34
- }): string;
35
- export declare function projectionDecoder<P extends Projection>(entries: readonly ProjectionEntry[]): ResultReadDecoder<ProjectionRow<P>>;
36
- export declare function groupKeys(expressions: readonly Expression<unknown>[]): ReadonlySet<ColumnKey>;
1
+ export {};
37
2
  //# sourceMappingURL=sources.d.ts.map
@@ -1,78 +1,2 @@
1
- import type { ParamCollector, ResultDecoder, ResultReadDecoder, SqlDialect, SqlQuery } from "@vibeorm/sql";
2
- import type { ColumnDefinition, Expression, Source } from "./types.ts";
3
- export type RenderContext = {
4
- readonly dialect: SqlDialect;
5
- readonly collector: ParamCollector;
6
- readonly transport?: boolean;
7
- };
8
- export type ColumnKey = {
9
- readonly binding: object;
10
- readonly name: string;
11
- };
12
- export type ExpressionState = {
13
- readonly decoder: ResultReadDecoder<unknown>;
14
- readonly render: (context: RenderContext) => string;
15
- readonly projection?: (context: RenderContext) => string;
16
- readonly references: ReadonlySet<object>;
17
- readonly ungrouped: ReadonlySet<ColumnKey>;
18
- readonly aggregate: boolean;
19
- readonly contract: object | string;
20
- readonly definition?: ColumnDefinition<unknown>;
21
- readonly column?: ColumnKey;
22
- readonly parameter?: {
23
- readonly value: unknown;
24
- readonly decoder: ResultDecoder<unknown>;
25
- };
26
- readonly default?: boolean;
27
- };
28
- export type ProjectionEntry = {
29
- readonly alias: string;
30
- readonly expression: Expression<unknown>;
31
- };
32
- export type ReadState = {
33
- readonly entries: readonly ProjectionEntry[];
34
- readonly render: (context: RenderContext) => string;
35
- readonly physicalNames: readonly string[];
36
- readonly ctes: readonly Source<unknown>[];
37
- };
38
- export type SourceState = {
39
- readonly name?: string;
40
- readonly namespace?: string;
41
- readonly columns: Readonly<Record<string, ColumnDefinition<unknown>>>;
42
- readonly required: readonly string[];
43
- readonly readOnly?: boolean;
44
- readonly query?: ReadState;
45
- readonly cte?: string;
46
- };
47
- export type Binding = {
48
- readonly source: Source<unknown>;
49
- readonly alias: string;
50
- readonly token: object;
51
- readonly nullable: boolean;
52
- readonly keys: Readonly<Record<string, ColumnKey>>;
53
- };
54
- export declare const expressionStates: WeakMap<object, ExpressionState>;
55
- export declare const sourceStates: WeakMap<object, SourceState>;
56
- export declare const readStates: WeakMap<object, ReadState>;
57
- export declare const builderTerminals: WeakSet<object>;
58
- export declare function columnContract(definition: ColumnDefinition<unknown>): string;
59
- /** Reject database-owned assignments before reading values or deriving input encoders. */
60
- export declare function assertWritableColumn({ table, column }: {
61
- readonly table: SourceState;
62
- readonly column: string;
63
- }): void;
64
- export declare function invalid(message: string): never;
65
- export declare function invalidData(message: string): never;
66
- export declare function unsupported(message: string): never;
67
- export declare function identifier(name: string): void;
68
- export declare function expressionState(expression: Expression<unknown>): ExpressionState;
69
- export declare function sourceState(source: Source<unknown>): SourceState;
70
- export declare function readState(query: SqlQuery<unknown>): ReadState;
71
- export declare function makeExpression<T>(state: ExpressionState): Expression<T>;
72
- export declare function checkScope(params: {
73
- expression: Expression<unknown>;
74
- bindings: readonly Binding[];
75
- aggregates?: boolean;
76
- nullableContracts?: boolean;
77
- }): void;
1
+ export {};
78
2
  //# sourceMappingURL=state.d.ts.map
@@ -58,12 +58,12 @@ export declare function isSqlCommand(value: unknown): value is SqlCommand;
58
58
  export declare function isReusableSqlQuery(value: unknown): value is ReusableSqlQuery<object, unknown>;
59
59
  /** Authentic reusable commands never masquerade as row queries. */
60
60
  export declare function isReusableSqlCommand(value: unknown): value is ReusableSqlCommand<object>;
61
- /** @internal Query-bundle provenance is checked by qb.reusable before this bridge. */
61
+ /** Query-bundle provenance is checked by qb.reusable before this bridge. */
62
62
  export declare function createReusableSqlQuery<P extends object, Row>(params: {
63
63
  query: SqlQuery<Row>;
64
64
  scope: SqlInputScope;
65
65
  }): ReusableSqlQuery<P, Row>;
66
- /** @internal Wrap an admitted builder command without capturing an execution owner. */
66
+ /** Wrap an admitted builder command without capturing an execution owner. */
67
67
  export declare function createReusableSqlCommand<P extends object>(params: {
68
68
  query: SqlCommand;
69
69
  scope: SqlInputScope;
package/dist/render.d.ts CHANGED
@@ -26,6 +26,15 @@ export declare function renderProjection(params: {
26
26
  dialect: SqlDialect;
27
27
  columns: readonly ColRef[];
28
28
  }): string;
29
+ /**
30
+ * Are `sets` (indexes into `count` grouping keys) exactly the rollup chain
31
+ * `[0..n-1], [0..n-2], …, []`, in any order and with members in any order?
32
+ * The one shape a `rollup` dialect can group by (`GROUP BY … WITH ROLLUP`).
33
+ */
34
+ export declare function isRollupChain(params: {
35
+ count: number;
36
+ sets: readonly (readonly number[])[];
37
+ }): boolean;
29
38
  /**
30
39
  * Render one boolean expression into SQL text, collecting parameters into the
31
40
  * shared collector. Public so extension delegates can AND user `where` trees
@@ -40,6 +40,25 @@ type Fields = Readonly<Record<string, ResultDecoder<unknown>>>;
40
40
  type Shape<F extends Fields> = {
41
41
  [K in keyof F]: Decoded<F[K]>;
42
42
  };
43
+ /**
44
+ * Decode one named column of a result row. A decoder's `VIBE_DATA_INVALID` comes back naming the column in the
45
+ * message and in `meta` (with the row index and the shape token when the caller has them), never the value; the
46
+ * decoder's own error is the `cause`. Any other error passes through unchanged.
47
+ */
48
+ export declare function decodeResultColumn<T>(params: {
49
+ readonly decoder: ResultReadDecoder<T>;
50
+ readonly read: {
51
+ value: unknown;
52
+ dialect: Dialect;
53
+ wire?: WireFidelity;
54
+ };
55
+ readonly column: string;
56
+ readonly reason: string;
57
+ readonly prefix?: string;
58
+ readonly meta?: Readonly<Record<string, unknown>>;
59
+ readonly row?: number;
60
+ readonly token?: string;
61
+ }): T;
43
62
  /** Write-only composition; elements are encoded once and SQL owns the final array transport. */
44
63
  export declare const encode: {
45
64
  readonly array: (params: {
@@ -76,7 +95,8 @@ export declare const decode: {
76
95
  decoder: ResultReadDecoder<T>;
77
96
  }): ResultReadDecoder<T[]>;
78
97
  };
79
- readonly enum: <T extends string>(params: {
98
+ /** Membership in `values`; the members stay literal types where the decoder is written inline (`decode.object({ fields: { kind: decode.enum({ values: ["a", "b"] }) } })` reads `"a" | "b"`). */
99
+ readonly enum: <const T extends string>(params: {
80
100
  values: readonly T[];
81
101
  }) => ResultDecoder<T>;
82
102
  readonly object: <F extends Fields>(params: {
@@ -1,23 +1,5 @@
1
- import type { FieldIR, ModelIR, QualifiedSqlName, RowRuleEvent, RowRuleIR, SchemaIR, SqlObjectIdentity } from "@vibeorm/schema";
1
+ import type { ModelIR, RowRuleIR, SchemaIR, SqlObjectIdentity } from "@vibeorm/schema";
2
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
3
  /**
22
4
  * MySQL `FOLLOWS`/`PRECEDES` position for one rule trigger, keyed by its event
23
5
  * trigger name. Disposable references use it to re-create a trigger where it was,
@@ -1,8 +1,8 @@
1
1
  import type { QualifiedSqlName } from "@vibeorm/schema";
2
2
  import type { SqlDialect } from "./dialect.ts";
3
3
  import type { ParamCollector } from "./params.ts";
4
- import type { SqlInputContract, SqlInputScope, SqlParam } from "./sql-input.ts";
5
- /** @internal Declared SQL transport is separate from execution-time values. */
4
+ import type { SqlInputContract, SqlParam } from "./sql-input.ts";
5
+ /** Declared SQL transport is separate from execution-time values. */
6
6
  export type SqlParameterTransport = {
7
7
  readonly kind: "plain";
8
8
  } | {
@@ -13,7 +13,7 @@ export type SqlParameterTransport = {
13
13
  readonly storage: "json" | "jsonb";
14
14
  readonly whole: boolean;
15
15
  };
16
- /** @internal A binding reads a captured literal or one named input. */
16
+ /** A binding reads a captured literal or one named input. */
17
17
  export type SqlBindingSource = {
18
18
  readonly kind: "literal";
19
19
  readonly value: unknown;
@@ -21,41 +21,16 @@ export type SqlBindingSource = {
21
21
  readonly kind: "input";
22
22
  readonly param: SqlParam<unknown>;
23
23
  };
24
- /** @internal Value work reused by ordinary and structural parameter emission. */
24
+ /** Value work reused by ordinary and structural parameter emission. */
25
25
  export type SqlBindingEncoder = (params: {
26
26
  readonly value: unknown;
27
27
  readonly dialect: SqlDialect;
28
28
  }) => unknown;
29
- declare const programBrand: unique symbol;
30
- /** @internal Binding programs are authentic and never expose their captured values. */
31
- export type SqlBindingProgram = {
32
- readonly [programBrand]: true;
33
- };
34
- /** @internal Inspect already captured data only; never invoke an encoder. */
35
- export declare function sqlParameterTransport(params: {
36
- value: unknown;
37
- }): SqlParameterTransport;
38
- /** @internal Shared ordinary/reusable placeholder suffixes. */
39
- export declare function renderSqlParameterTransport(params: {
40
- dialect: SqlDialect;
41
- placeholder: string;
42
- transport: SqlParameterTransport;
43
- }): string;
44
- /** @internal Shared marker unwrapping; ordinary admission remains unchanged. */
45
- export declare function sqlParameterWireValue(params: {
46
- value: unknown;
47
- }): unknown;
48
- /** @internal Detect structural recording without changing normal collector callers. */
29
+ /** Detect structural recording without changing normal collector callers. */
49
30
  export declare function isSqlBindingCollector(params: {
50
31
  collector: ParamCollector;
51
32
  }): boolean;
52
- /** @internal Start one compiler pass with no execution values. */
53
- export declare function startSqlBindingCollection(params: {
54
- collector: ParamCollector;
55
- dialect: SqlDialect;
56
- scope: SqlInputScope;
57
- }): void;
58
- /** @internal Register an encoded slot without executing its encoder. */
33
+ /** Register an encoded slot without executing its encoder. */
59
34
  export declare function recordSqlBinding(params: {
60
35
  collector: ParamCollector;
61
36
  source: SqlBindingSource;
@@ -65,20 +40,9 @@ export declare function recordSqlBinding(params: {
65
40
  rejectNull?: boolean;
66
41
  validate?: (value: unknown) => void;
67
42
  }): string;
68
- /** @internal Retain per-call validation when a fixed NULL frame emits no slot. */
43
+ /** Retain per-call validation when a fixed NULL frame emits no slot. */
69
44
  export declare function recordSqlBindingCheck(params: {
70
45
  collector: ParamCollector;
71
46
  check: () => void;
72
47
  }): void;
73
- /** @internal Seal the rendered program after checking actual emitted input usage. */
74
- export declare function finishSqlBindingCollection(params: {
75
- collector: ParamCollector;
76
- }): SqlBindingProgram;
77
- /** @internal Snapshot and bind synchronously; no cache entry retains this call's values. */
78
- export declare function bindSqlBindingProgram(params: {
79
- program: SqlBindingProgram;
80
- params?: unknown;
81
- isHandle: (value: object) => boolean;
82
- }): unknown[];
83
- export {};
84
48
  //# sourceMappingURL=sql-bindings.d.ts.map
@@ -1,7 +1,5 @@
1
- /** @internal Register a bundle's existing SQL-handle identity check, not object shapes. */
1
+ /** Register a bundle's existing SQL-handle identity check, not object shapes. */
2
2
  export declare function registerSqlHandleCheck(params: {
3
3
  check: (value: object) => boolean;
4
4
  }): void;
5
- /** @internal Authentic SQL code cannot become parameter data, including nested values. */
6
- export declare function isSqlHandle(value: object): boolean;
7
5
  //# sourceMappingURL=sql-handles.d.ts.map
@@ -29,11 +29,11 @@ export type SqlExecutionParams<P extends object> = keyof P extends never ? {
29
29
  } : {
30
30
  readonly params: NoInfer<P>;
31
31
  };
32
- /** @internal Opaque lifetime and ownership of a single build callback. */
32
+ /** Opaque lifetime and ownership of a single build callback. */
33
33
  export type SqlInputScope = {
34
34
  readonly [scopeBrand]: true;
35
35
  };
36
- /** @internal Encoding and physical identity, with no read decoder or client authority. */
36
+ /** Encoding and physical identity, with no read decoder or client authority. */
37
37
  export type SqlInputContract = {
38
38
  readonly encoder: ResultParameterEncoder;
39
39
  readonly scalar: ScalarType | "Enum" | "Unknown";
@@ -47,18 +47,16 @@ export type SqlInputContract = {
47
47
  };
48
48
  /** Authentic tokens remain recognizable after their build callback closes. */
49
49
  export declare function isSqlParam(value: unknown): value is SqlParam<unknown>;
50
- /** Authentic `qb.input` descriptors are declarations, never execution values. */
51
- export declare function isSqlInput(value: unknown): value is SqlInput<unknown>;
52
- /** @internal Snapshot descriptor metadata, never encode a sample value. */
50
+ /** Snapshot descriptor metadata, never encode a sample value. */
53
51
  export declare function createSqlInput<T>(params: {
54
52
  contract: SqlInputContract;
55
53
  }): SqlInput<T>;
56
- /** @internal Read a descriptor or normalize an explicitly supplied decoder. */
54
+ /** Read a descriptor or normalize an explicitly supplied decoder. */
57
55
  export declare function sqlInputContract(params: {
58
56
  input: SqlInput<unknown> | ResultDecoder<unknown>;
59
57
  }): SqlInputContract;
60
58
  /**
61
- * @internal Create one isolated environment of authentic named tokens. `isHandle` is the
59
+ * Create one isolated environment of authentic named tokens. `isHandle` is the
62
60
  * calling builder bundle's own expression/source authenticity check, applied to execution values.
63
61
  */
64
62
  export declare function createSqlInputScope<D extends SqlInputMap>(params: {
@@ -68,31 +66,17 @@ export declare function createSqlInputScope<D extends SqlInputMap>(params: {
68
66
  readonly scope: SqlInputScope;
69
67
  readonly params: SqlInputTokens<D>;
70
68
  };
71
- /** @internal Close admission even when a build callback throws. */
69
+ /** Close admission even when a build callback throws. */
72
70
  export declare function sealSqlInputScope(params: {
73
71
  scope: SqlInputScope;
74
72
  }): void;
75
- /** @internal Tokens cannot enter new expressions after their build has returned. */
73
+ /** Tokens cannot enter new expressions after their build has returned. */
76
74
  export declare function assertSqlParamBuilding(params: {
77
75
  param: SqlParam<unknown>;
78
76
  }): void;
79
- /** @internal Read the token's write contract without exposing mutable state. */
77
+ /** Read the token's write contract without exposing mutable state. */
80
78
  export declare function sqlParamContract(params: {
81
79
  param: SqlParam<unknown>;
82
80
  }): SqlInputContract;
83
- /** @internal Validate ownership when an admitted expression is structurally rendered. */
84
- export declare function sqlParamKey(params: {
85
- param: SqlParam<unknown>;
86
- scope: SqlInputScope;
87
- }): string;
88
- /** @internal Ask the bundle that created this scope whether a value is one of its handles. */
89
- export declare function sqlInputScopeHandle(params: {
90
- scope: SqlInputScope;
91
- value: object;
92
- }): boolean;
93
- /** @internal Frozen declaration keys; an open scope cannot be compiled. */
94
- export declare function sqlInputScopeKeys(params: {
95
- scope: SqlInputScope;
96
- }): readonly string[];
97
81
  export {};
98
82
  //# sourceMappingURL=sql-input.d.ts.map
@@ -11,15 +11,13 @@ type TimestampIdentity = {
11
11
  */
12
12
  key: string | undefined;
13
13
  readonly kind: "timestamp" | "time" | "timetz" | "sqlite";
14
+ /**
15
+ * A parameter the MySQL DateTime codec handed on for the adapter to write in
16
+ * its zone with every fraction digit ({@link boundTimestampParameter}); a
17
+ * Date a caller passes is never one.
18
+ */
19
+ readonly bound?: true;
14
20
  };
15
- /** Retain transport text while the ordinary Date still represents the decoded value. */
16
- export declare function rememberTimestampIdentity(params: {
17
- date: Date;
18
- text: string;
19
- numeric?: number;
20
- key?: string;
21
- kind?: TimestampIdentity["kind"];
22
- }): Date;
23
21
  /** Exact equality key when available; caller-created/mutated Dates keep millisecond semantics. */
24
22
  export declare function timestampIdentityKey(params: {
25
23
  date: Date;
@@ -29,10 +27,6 @@ export declare function timestampIdentityText(params: {
29
27
  date: Date;
30
28
  kind?: TimestampIdentity["kind"];
31
29
  }): string | undefined;
32
- /** SQLite legacy integer epochs remain integers rather than being rewritten to ISO text. */
33
- export declare function sqliteTimestampIdentityValue(params: {
34
- date: Date;
35
- }): string | number | undefined;
36
30
  /** Compare retained native identities; SQLite text ordering remains the database's collation. */
37
31
  export declare function compareTimestampDates(params: {
38
32
  left: Date;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Char-code decoding of the fixed timestamp text PostgreSQL, MySQL and SQLite
3
+ * print: `YYYY-MM-DD HH:MM:SS[.f]`, with or without an offset.
4
+ *
5
+ * Parsing it by regular expression and `new Date(text)` costs a few hundred
6
+ * nanoseconds per value; the layout is fixed, so one pass over the character
7
+ * codes yields the same instant several times cheaper (node-postgres cells,
8
+ * the `::text` key columns of a keyset page, the join strategy's JSON).
9
+ *
10
+ * This function only ACCEPTS or DECLINES: it returns `undefined` for every
11
+ * text outside the plain form, and the caller then runs its general parser.
12
+ * An accepted text decodes to exactly the instant that parser returns
13
+ * (differential tests in adapter-pg `tests/timestamp-text.test.ts` and
14
+ * `tests/datetime-text-fast-path.test.ts` here).
15
+ */
16
+ /**
17
+ * Decode `YYYY-MM-DD HH:MM:SS[.f{1,6}]` as a `Date`: zone-less text is read as
18
+ * UTC wall-clock time, zoned text at its offset. Fraction digits beyond the
19
+ * third are truncated.
20
+ *
21
+ * `zoned`: `true` requires `±HH` or `±HH:MM` after the time (PostgreSQL's
22
+ * `timestamptz` text), `false` requires nothing after it (`timestamp`, MySQL
23
+ * `DATETIME`); `"either"` also takes a `T` between date and time and a `Z`
24
+ * offset (ISO 8601: the join strategy's JSON, SQLite's stored text).
25
+ *
26
+ * Returns `undefined` — "use the general parser" — for anything else: years
27
+ * before 1000 (`Date.UTC` maps 0–99 to 1900–1999), BC dates, `infinity`,
28
+ * offsets with seconds (historic local mean time), date-only text, 7+
29
+ * fraction digits, and out-of-range fields (month 13, February 30, hour 24,
30
+ * second 60).
31
+ */
32
+ export declare function parsePlainTimestampText(params: {
33
+ readonly text: string;
34
+ readonly zoned: boolean | "either";
35
+ }): Date | undefined;
36
+ //# sourceMappingURL=timestamp-text.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibeorm/sql",
3
- "version": "5.8.0",
3
+ "version": "5.10.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": "^5.8.0"
53
+ "@vibeorm/schema": "^5.10.0"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"