qubu 0.6.1 → 0.6.2
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/{complete-DP7pliuY.mjs → canonical-B5_ouh-c.mjs} +466 -241
- package/dist/codegen.d.mts +2 -2
- package/dist/codegen.mjs +180 -90
- package/dist/column-Cyc2CMnG.mjs +116 -0
- package/dist/column-DDRvD7SF.mjs +721 -0
- package/dist/{constraints-DM_tarXc.mjs → constraints-CAmi18Uk.mjs} +8 -3
- package/dist/core.d.mts +3 -3
- package/dist/core.mjs +4 -4
- package/dist/diff.d.mts +9 -9
- package/dist/diff.mjs +152 -102
- package/dist/{explain-CkIK13L_.mjs → explain-BIqEmZha.mjs} +1 -1
- package/dist/{expressions-BCjc08zw.mjs → expressions-_6JF_J77.mjs} +2 -1
- package/dist/index-CaxrMD1A.d.mts +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +368 -74
- package/dist/introspection/mysql.d.mts +1 -1
- package/dist/introspection/mysql.mjs +156 -23
- package/dist/introspection/postgres.d.mts +6 -3
- package/dist/introspection/postgres.mjs +388 -53
- package/dist/introspection/sqlite.d.mts +1 -1
- package/dist/introspection/sqlite.mjs +198 -12
- package/dist/introspection.d.mts +26 -12
- package/dist/introspection.mjs +2 -672
- package/dist/mysql.d.mts +3 -3
- package/dist/mysql.mjs +6 -5
- package/dist/{errors-Dxv73YJu.mjs → omit-VEr9Ydux.mjs} +5 -1
- package/dist/{on-conflict-CnaY5qso.mjs → on-conflict-B2rFyHGF.mjs} +6 -8
- package/dist/on-duplicate-key-update-Czsw1Yq-.mjs +95 -0
- package/dist/{postgres-Dey7QXPL.mjs → postgres-hFhd0I9n.mjs} +4 -5
- package/dist/postgres.d.mts +2 -2
- package/dist/postgres.mjs +2 -2
- package/dist/{registry-oWDiqD7i.mjs → registry-BXE_4M9P.mjs} +1 -1
- package/dist/{relational-DSAJ-l58.mjs → relational-CoPBETjI.mjs} +3 -2
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +8 -8
- package/dist/{serialize-CE-gw5_s.mjs → serialize-CyobNEx-.mjs} +174 -30
- package/dist/serialize-Du2UPZMt.d.mts +92 -0
- package/dist/snapshot/mysql.d.mts +5 -5
- package/dist/snapshot/mysql.mjs +8 -8
- package/dist/snapshot/postgres.d.mts +3 -3
- package/dist/snapshot/postgres.mjs +9 -9
- package/dist/snapshot/sqlite.d.mts +3 -3
- package/dist/snapshot/sqlite.mjs +7 -7
- package/dist/snapshot-mIb-Zzb5.mjs +1489 -0
- package/dist/snapshot.d.mts +4 -5
- package/dist/snapshot.mjs +3 -4
- package/dist/{source-BDuUXmAk.mjs → source-DYSUqzvb.mjs} +2 -2
- package/dist/sqlite.d.mts +2 -2
- package/dist/sqlite.mjs +6 -6
- package/dist/{table-C1QGNe4P.mjs → table-B8zEq0az.mjs} +4 -4
- package/dist/{types-BLNRatG_.mjs → types-CYHpSPwj.mjs} +10 -5
- package/dist/{types-BEn0N_al.d.mts → types-CiMvKi5V.d.mts} +14 -4
- package/dist/{types-DUe6eeI0.d.mts → types-Dqr4o2I1.d.mts} +590 -168
- package/dist/value-CpaUFtjw.mjs +45 -0
- package/dist/vite/ambient.d.ts +2 -0
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -0
- package/docs/dialects-and-execution.md +61 -11
- package/docs/getting-started.md +1 -1
- package/docs/guides/extensions/typed-expressions.md +5 -3
- package/docs/guides/json.md +95 -2
- package/docs/guides/mutations.md +36 -0
- package/docs/index.md +1 -1
- package/docs/migrations/adapters.md +58 -21
- package/docs/migrations/recovery.md +7 -1
- package/docs/query-model/fragments.md +21 -1
- package/docs/reference/introspection-support.md +16 -18
- package/docs/reference/supported-surface.md +8 -7
- package/docs/schema/catalog-model.md +20 -7
- package/docs/schema/code-generation.md +1 -1
- package/docs/schema/diff.md +2 -2
- package/docs/schema/introspection.md +21 -14
- package/docs/schema/snapshots.md +18 -8
- package/docs/schema/storage-and-schema-sql.md +7 -2
- package/package.json +2 -1
- package/dist/canonical-DMvR9yBe.mjs +0 -972
- package/dist/column-BzN8KFJa.mjs +0 -364
- package/dist/column-CFvSbil0.mjs +0 -309
- package/dist/complete-types-CNMWBWap.d.mts +0 -371
- package/dist/index-CGui70hi.d.mts +0 -32
- package/dist/json-Db7XRD91.mjs +0 -169
- package/dist/omit-OxV58AwX.mjs +0 -5
- package/dist/serialize-OvXCLzjm.d.mts +0 -66
- package/dist/snapshot-DgsOhf_8.mjs +0 -354
|
@@ -50,6 +50,8 @@ type SqlBigInt = SqlSemanticType<"bigint"> & SqlNumericLike & SqlOrderable<"nume
|
|
|
50
50
|
type SqlBinary = SqlSemanticType<"binary"> & SqlEqualityComparable<"binary">;
|
|
51
51
|
/** Any declared SQL semantic type, including user and dialect extensions. */
|
|
52
52
|
type AnySqlType = SqlSemanticType<string>;
|
|
53
|
+
/** Runtime name for a SQL semantic domain, including user and dialect extensions. */
|
|
54
|
+
type SqlTypeName = AnySqlType["sqlType"];
|
|
53
55
|
type IsUnresolvedSqlType<T> = T extends SqlUnknown ? true : T extends AnySqlType ? string extends T["sqlType"] ? true : false : false;
|
|
54
56
|
/** Whether a declared SQL domain satisfies a semantic capability constraint. */
|
|
55
57
|
type SqlTypeSatisfies<TActual, TConstraint> = true extends IsUnresolvedSqlType<TActual> ? true : TActual extends TConstraint ? true : false;
|
|
@@ -123,7 +125,7 @@ type CardinalityMeta<TCardinality extends QueryCardinality = QueryCardinality> =
|
|
|
123
125
|
readonly cardinality: TCardinality;
|
|
124
126
|
};
|
|
125
127
|
/** A fragment whose syntax must be rendered by a dialect with this capability. */
|
|
126
|
-
type RequiresCapabilityMeta<TCapability extends
|
|
128
|
+
type RequiresCapabilityMeta<TCapability extends string = DialectCapability> = {
|
|
127
129
|
readonly kind: "requires-capability";
|
|
128
130
|
readonly capability: TCapability;
|
|
129
131
|
};
|
|
@@ -133,7 +135,8 @@ interface RenderContext {
|
|
|
133
135
|
/** Whether selected fields name an application result or a SQL relation. */
|
|
134
136
|
readonly projectionMode: "result" | "relation";
|
|
135
137
|
append(text: string): void;
|
|
136
|
-
parameter
|
|
138
|
+
/** Add one ordered parameter, optionally declaring its runtime SQL domain. */
|
|
139
|
+
parameter(value: unknown, sqlType?: SqlTypeName): void;
|
|
137
140
|
render(part: Fragment<any>): void;
|
|
138
141
|
/** Render an embedded query with SQL-facing projection names. */
|
|
139
142
|
renderRelation(part: Fragment<any>): void;
|
|
@@ -208,7 +211,7 @@ type Cardinality<TMetadata> = TMetadata extends {
|
|
|
208
211
|
} ? TCardinality : never;
|
|
209
212
|
type RequiredCapabilities<TMetadata> = TMetadata extends {
|
|
210
213
|
readonly kind: "requires-capability";
|
|
211
|
-
readonly capability: infer TCapability extends
|
|
214
|
+
readonly capability: infer TCapability extends string;
|
|
212
215
|
} ? TCapability : never;
|
|
213
216
|
type InheritedMetadataOf<TMetadata> = WithoutResult<TMetadata>;
|
|
214
217
|
type InheritedMetadata<T> = InheritedMetadataOf<MetadataOf<T>>;
|
|
@@ -248,7 +251,7 @@ declare function isFragment(value: unknown): value is AnyFragment;
|
|
|
248
251
|
//#endregion
|
|
249
252
|
//#region src/result.d.ts
|
|
250
253
|
/** Portable result domains that can require driver-specific normalization. */
|
|
251
|
-
type DecodableResultType = "boolean" | "date" | "timestamp" | "json";
|
|
254
|
+
type DecodableResultType = "boolean" | "date" | "timestamp" | "json" | "bigint";
|
|
252
255
|
/** Context supplied while decoding one projected field. */
|
|
253
256
|
interface ResultDecodeContext {
|
|
254
257
|
readonly dialect: Dialect;
|
|
@@ -264,6 +267,8 @@ interface ResultField {
|
|
|
264
267
|
readonly name: string;
|
|
265
268
|
readonly type?: DecodableResultType;
|
|
266
269
|
readonly decoder?: ResultDecoder;
|
|
270
|
+
/** SQL semantic domain supplied to the adapter before it executes the request. */
|
|
271
|
+
readonly sqlType?: SqlTypeName;
|
|
267
272
|
}
|
|
268
273
|
/** Runtime description of a query's named result row. */
|
|
269
274
|
interface ResultShape {
|
|
@@ -272,11 +277,14 @@ interface ResultShape {
|
|
|
272
277
|
interface ResultValueMetadata {
|
|
273
278
|
readonly type?: DecodableResultType;
|
|
274
279
|
readonly decoder?: ResultDecoder;
|
|
280
|
+
/** SQL semantic domain retained for adapter-specific result handling. */
|
|
281
|
+
readonly sqlType?: SqlTypeName;
|
|
275
282
|
}
|
|
276
283
|
declare const resultValueMetadata: unique symbol;
|
|
277
284
|
type ResultValueCarrier = {
|
|
278
285
|
readonly [resultValueMetadata]?: ResultValueMetadata;
|
|
279
286
|
};
|
|
287
|
+
declare function resultValue(type?: DecodableResultType, decoder?: ResultDecoder, sqlType?: SqlTypeName): ResultValueMetadata | undefined;
|
|
280
288
|
/** Decode SQLite/MySQL-style boolean values while accepting native booleans. */
|
|
281
289
|
declare const booleanResultDecoder: ResultDecoder<boolean>;
|
|
282
290
|
/** Decode a SQL DATE string as a JavaScript Date at UTC midnight. */
|
|
@@ -285,6 +293,8 @@ declare const dateResultDecoder: ResultDecoder<Date>;
|
|
|
285
293
|
declare const timestampResultDecoder: ResultDecoder<Date>;
|
|
286
294
|
/** Decode a serialized JSON result. Use only when the adapter returns JSON text. */
|
|
287
295
|
declare const jsonTextResultDecoder: ResultDecoder;
|
|
296
|
+
/** Decode an exact integer result without ever accepting an unsafe JavaScript number. */
|
|
297
|
+
declare const bigintResultDecoder: ResultDecoder<bigint>;
|
|
288
298
|
/** Error raised when a projected driver value cannot be decoded. */
|
|
289
299
|
declare class ResultDecodingError extends TypeError {
|
|
290
300
|
readonly name = "ResultDecodingError";
|
|
@@ -319,7 +329,7 @@ type ExpressionNullability<T> = NullabilityOf<T>;
|
|
|
319
329
|
/** Extract the SQL semantic domain produced by an expression. */
|
|
320
330
|
type ExpressionSqlType<T> = SqlTypeOf<T>;
|
|
321
331
|
/** Add a concrete dialect requirement without dropping expression metadata. */
|
|
322
|
-
declare function withDialectCapability<const TCapability extends
|
|
332
|
+
declare function withDialectCapability<const TCapability extends string, TExpression extends AnyExpression>(expression: TExpression, capability: TCapability): TExpression extends SchemaExpression<any, any> ? SchemaExpression<MetadataOf<TExpression> | RequiresCapabilityMeta<TCapability>, TExpression["expressionKind"]> : Expression<MetadataOf<TExpression> | RequiresCapabilityMeta<TCapability>, TExpression["expressionKind"]>;
|
|
323
333
|
/** An expression whose result is known to be assignable to `TOutput`. */
|
|
324
334
|
type ExpressionWithOutput<TOutput, TKind extends ExpressionKind = ExpressionKind> = Expression<ResultMeta<TOutput, unknown, AnySqlType> | RequiresSourceMeta<unknown> | NullableSourceMeta<unknown> | ExpressionMeta<unknown> | AggregateMeta<unknown> | RequiresCapabilityMeta | WindowMeta | SubqueryMeta, TKind>;
|
|
325
335
|
/** Sparse type-level configuration for a result-producing expression. */
|
|
@@ -401,15 +411,17 @@ type DefaultDialectCapability = "json";
|
|
|
401
411
|
interface RenderedQuery {
|
|
402
412
|
readonly text: string;
|
|
403
413
|
readonly parameters: readonly unknown[];
|
|
414
|
+
/** Runtime SQL domains aligned with `parameters`; omitted when all domains are unknown. */
|
|
415
|
+
readonly parameterSqlTypes?: readonly (SqlTypeName | undefined)[];
|
|
404
416
|
}
|
|
405
|
-
interface RenderOptions<TCapabilities extends
|
|
417
|
+
interface RenderOptions<TCapabilities extends string = string> {
|
|
406
418
|
readonly dialect?: Dialect<TCapabilities>;
|
|
407
419
|
}
|
|
408
420
|
type IsAny$1<T> = 0 extends 1 & T ? true : false;
|
|
409
|
-
type MissingCapabilities<TQuery, TCapabilities extends
|
|
410
|
-
type RenderCapabilityValidation<TQuery, TCapabilities extends
|
|
421
|
+
type MissingCapabilities<TQuery, TCapabilities extends string> = IsAny$1<CapabilitiesOf<TQuery>> extends true ? never : Exclude<CapabilitiesOf<TQuery>, TCapabilities>;
|
|
422
|
+
type RenderCapabilityValidation<TQuery, TCapabilities extends string> = [MissingCapabilities<TQuery, TCapabilities>] extends [never] ? unknown : QueryTypeValidation<"missing-dialect-capability", "render.dialect", "Provide a dialect that supports every capability required by the query.", MissingCapabilities<TQuery, TCapabilities>>;
|
|
411
423
|
declare function render<TQuery extends AnyFragment>(query: TQuery & RenderCapabilityValidation<TQuery, DefaultDialectCapability>): RenderedQuery;
|
|
412
|
-
declare function render<TQuery extends AnyFragment, TCapabilities extends
|
|
424
|
+
declare function render<TQuery extends AnyFragment, TCapabilities extends string>(query: TQuery & RenderCapabilityValidation<TQuery, TCapabilities>, options: RenderOptions<TCapabilities> | Dialect<TCapabilities>): RenderedQuery;
|
|
413
425
|
//#endregion
|
|
414
426
|
//#region src/execution.d.ts
|
|
415
427
|
type StreamableQuery<TRow extends object = Record<string, unknown>> = QueryWithRow<TRow> & {
|
|
@@ -506,9 +518,9 @@ interface QubuHooks {
|
|
|
506
518
|
interface QubuOptions {
|
|
507
519
|
readonly hooks?: QubuHooks;
|
|
508
520
|
}
|
|
509
|
-
/** One rendered statement and
|
|
521
|
+
/** One rendered statement, runtime parameter domains, and controls passed to an application adapter. */
|
|
510
522
|
interface ExecutionRequest {
|
|
511
|
-
/** SQL text
|
|
523
|
+
/** SQL text, raw application parameters, and optional domain sidecar produced by Qubu's renderer. */
|
|
512
524
|
readonly statement: RenderedQuery;
|
|
513
525
|
/** The source query kind, available without parsing rendered SQL. */
|
|
514
526
|
readonly queryKind: QueryKind;
|
|
@@ -550,9 +562,10 @@ interface ExplainResult<TPlanRow extends object = Record<string, unknown>> {
|
|
|
550
562
|
}
|
|
551
563
|
/**
|
|
552
564
|
* The driver-facing boundary. `request.statement.parameters` contains raw application values in
|
|
553
|
-
* placeholder order
|
|
554
|
-
*
|
|
555
|
-
*
|
|
565
|
+
* placeholder order, and `request.statement.parameterSqlTypes` optionally contains their aligned
|
|
566
|
+
* SQL domains. The adapter binds and encodes them for its driver. Connection pooling, transactions,
|
|
567
|
+
* retries, and proprietary driver-row normalization remain adapter concerns. Qubu applies the
|
|
568
|
+
* adapter's registered logical result decoders afterward.
|
|
556
569
|
*/
|
|
557
570
|
interface QueryAdapter {
|
|
558
571
|
/** Default rendering policy for queries sent through this adapter. */
|
|
@@ -594,6 +607,8 @@ type QueryExecutor = QueryAdapter;
|
|
|
594
607
|
interface TransactionalQueryAdapter<TTransactionAdapter extends QueryAdapter = QueryAdapter> extends QueryAdapter {
|
|
595
608
|
transaction<T>(callback: (adapter: TTransactionAdapter) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
596
609
|
}
|
|
610
|
+
/** Opt-in recursive transaction scopes; adapters own savepoints and scope lifetime. */
|
|
611
|
+
interface NestedTransactionalQueryAdapter<TBase extends QueryAdapter = QueryAdapter> extends TransactionalQueryAdapter<TBase & NestedTransactionalQueryAdapter<TBase>> {}
|
|
597
612
|
type TransactionAdapterOf<TAdapter extends TransactionalQueryAdapter> = TAdapter extends TransactionalQueryAdapter<infer TTransactionAdapter> ? TTransactionAdapter : never;
|
|
598
613
|
/** A transaction-capable streaming adapter whose scoped client can stream. */
|
|
599
614
|
type StreamingTransactionalQueryAdapter = StreamingQueryAdapter & TransactionalQueryAdapter<StreamingQueryAdapter>;
|
|
@@ -618,7 +633,8 @@ interface QubuStreamingClient<TAdapter extends StreamingQueryAdapter = Streaming
|
|
|
618
633
|
}
|
|
619
634
|
/** A bound client that supports both streaming and typed EXPLAIN plans. */
|
|
620
635
|
interface QubuStreamingExplainableClient<TAdapter extends StreamingQueryAdapter & ExplainableQueryAdapter = StreamingQueryAdapter & ExplainableQueryAdapter> extends QubuStreamingClient<TAdapter>, QubuExplainableClient<TAdapter> {}
|
|
621
|
-
type
|
|
636
|
+
type QubuBaseClientFor<TAdapter extends QueryAdapter> = TAdapter extends StreamingQueryAdapter ? TAdapter extends ExplainableQueryAdapter ? QubuStreamingExplainableClient<TAdapter> : QubuStreamingClient<TAdapter> : TAdapter extends ExplainableQueryAdapter ? QubuExplainableClient<TAdapter> : QubuClient<TAdapter>;
|
|
637
|
+
type QubuClientFor<TAdapter extends QueryAdapter> = QubuBaseClientFor<TAdapter> & (TAdapter extends TransactionalQueryAdapter ? QubuTransactionalClient<TAdapter, TransactionAdapterOf<TAdapter>> : {});
|
|
622
638
|
/** The client available inside a transaction callback. */
|
|
623
639
|
type QubuTransaction = QubuClient<QueryAdapter>;
|
|
624
640
|
/** The streaming client available inside a streaming transaction callback. */
|
|
@@ -638,6 +654,7 @@ interface QubuStreamingTransactionalClient<TAdapter extends StreamingTransaction
|
|
|
638
654
|
transaction<T>(callback: (transaction: QubuStreamingTransaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
639
655
|
}
|
|
640
656
|
/** Bind an application-owned adapter once for repeated query execution. */
|
|
657
|
+
declare function qubu<TAdapter extends NestedTransactionalQueryAdapter>(adapter: TAdapter, options?: QubuOptions): QubuClientFor<TAdapter>;
|
|
641
658
|
declare function qubu<TAdapter extends ExplainableQueryAdapter & StreamingTransactionalQueryAdapter>(adapter: TAdapter, options?: QubuOptions): QubuExplainableStreamingTransactionalClient<TAdapter>;
|
|
642
659
|
declare function qubu<TAdapter extends ExplainableQueryAdapter & TransactionalQueryAdapter & StreamingQueryAdapter>(adapter: TAdapter, options?: QubuOptions): QubuExplainableTransactionalClient<TAdapter> & QubuStreamingExplainableClient<TAdapter>;
|
|
643
660
|
declare function qubu<TAdapter extends ExplainableQueryAdapter & TransactionalQueryAdapter>(adapter: TAdapter, options?: QubuOptions): QubuExplainableTransactionalClient<TAdapter, TransactionAdapterOf<TAdapter>>;
|
|
@@ -649,8 +666,11 @@ declare function qubu<TAdapter extends TransactionalQueryAdapter>(adapter: TAdap
|
|
|
649
666
|
declare function qubu<TAdapter extends StreamingQueryAdapter>(adapter: TAdapter, options?: QubuOptions): QubuStreamingClient<TAdapter>;
|
|
650
667
|
declare function qubu<TAdapter extends QueryAdapter>(adapter: TAdapter, options?: QubuOptions): QubuClient<TAdapter>;
|
|
651
668
|
interface DriverValueEncoder<TDriverValue = unknown> {
|
|
652
|
-
/**
|
|
653
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Convert one Qubu parameter into the driver's bindable representation and receive its SQL
|
|
671
|
+
* domain.
|
|
672
|
+
*/
|
|
673
|
+
encode(value: unknown, sqlType?: SqlTypeName): TDriverValue;
|
|
654
674
|
}
|
|
655
675
|
/**
|
|
656
676
|
* Render a typed query, pass it to an application adapter, and return the adapter's structured
|
|
@@ -798,6 +818,10 @@ type GeneratedColumnDescriptor = ExpressionGeneratedColumnDescriptor | ExternalG
|
|
|
798
818
|
type GeneratedDescriptor = GeneratedColumnDescriptor;
|
|
799
819
|
/** Identity generation policy. Identity is not an ordinary SQL expression. */
|
|
800
820
|
type IdentityGeneration = "always" | "by-default";
|
|
821
|
+
/** Literal or deterministic schema-expression identity option value. */
|
|
822
|
+
type IdentityOptionValue = SchemaLiteralValue | AnySchemaExpression;
|
|
823
|
+
/** Dialect-neutral identity options retained in Snapshot v1. */
|
|
824
|
+
type IdentityOptions = Readonly<Record<string, IdentityOptionValue>>;
|
|
801
825
|
/** SQLite's opt-in AUTOINCREMENT behavior for an INTEGER rowid alias. */
|
|
802
826
|
interface SqliteIdentityExtension extends SchemaDialectExtension<"sqlite"> {
|
|
803
827
|
/** Preserve deleted rowids instead of allowing SQLite to reuse them. */
|
|
@@ -814,6 +838,7 @@ type IdentityDialectExtension = SqliteIdentityExtension | MysqlIdentityExtension
|
|
|
814
838
|
interface IdentityDescriptor {
|
|
815
839
|
readonly kind: "identity";
|
|
816
840
|
readonly generation: IdentityGeneration;
|
|
841
|
+
readonly options?: IdentityOptions;
|
|
817
842
|
/** Optional dialect-owned identity semantics such as SQLite AUTOINCREMENT. */
|
|
818
843
|
readonly dialect?: IdentityDialectExtension;
|
|
819
844
|
}
|
|
@@ -838,6 +863,7 @@ declare function externalGeneratedColumn(): ExternalGeneratedColumnDescriptor;
|
|
|
838
863
|
/** Describe a database identity column without inventing a generated SQL expression. */
|
|
839
864
|
declare function identityColumn(generation?: IdentityGeneration, options?: {
|
|
840
865
|
readonly dialect?: IdentityDialectExtension;
|
|
866
|
+
readonly options?: IdentityOptions;
|
|
841
867
|
}): IdentityDescriptor;
|
|
842
868
|
/** The normalized behavior fields attached to a column definition. */
|
|
843
869
|
interface ResolvedColumnBehavior {
|
|
@@ -951,8 +977,12 @@ interface ColumnOptions<TOutput = unknown, TInsert = TOutput> {
|
|
|
951
977
|
readonly onUpdate?: AnySchemaExpression;
|
|
952
978
|
/** Override the snake_case SQL identifier derived from the field name. */
|
|
953
979
|
readonly sqlName?: string;
|
|
980
|
+
/** Runtime SQL semantic domain name for adapter binding and result metadata. */
|
|
981
|
+
readonly sqlType?: SqlTypeName;
|
|
954
982
|
/** Physical storage metadata for a custom column definition. */
|
|
955
983
|
readonly storage?: ColumnStorage;
|
|
984
|
+
/** Dialect-owned column metadata retained by schema snapshots. */
|
|
985
|
+
readonly dialect?: SchemaDialectExtension;
|
|
956
986
|
/** Override adapter decoding for values selected from this column. */
|
|
957
987
|
readonly decode?: ResultDecoder;
|
|
958
988
|
/** Convert values at the live application-to-driver boundary without affecting schema metadata. */
|
|
@@ -963,8 +993,9 @@ interface ColumnOptions<TOutput = unknown, TInsert = TOutput> {
|
|
|
963
993
|
*/
|
|
964
994
|
readonly castType?: string;
|
|
965
995
|
}
|
|
966
|
-
type BuiltInColumnOptions<TOutput> = Omit<ColumnOptions<TOutput, TOutput>, "castType" | "storage"> & {
|
|
996
|
+
type BuiltInColumnOptions<TOutput> = Omit<ColumnOptions<TOutput, TOutput>, "castType" | "sqlType" | "storage"> & {
|
|
967
997
|
readonly castType?: never;
|
|
998
|
+
readonly sqlType?: never;
|
|
968
999
|
readonly storage?: never;
|
|
969
1000
|
};
|
|
970
1001
|
/** Sparse type-level configuration carried by a column definition. */
|
|
@@ -1033,8 +1064,12 @@ interface ColumnDefinition<TConfig extends ColumnDefinitionConfig = {}> {
|
|
|
1033
1064
|
/** MySQL's optional parameter-free `ON UPDATE` expression. */
|
|
1034
1065
|
readonly onUpdate?: ColumnConfigOnUpdate<TConfig>;
|
|
1035
1066
|
readonly sqlName?: string;
|
|
1067
|
+
/** Runtime SQL semantic domain name for adapter binding and result metadata. */
|
|
1068
|
+
readonly sqlType?: SqlTypeName;
|
|
1036
1069
|
/** Physical storage metadata, separate from the application and SQL types. */
|
|
1037
1070
|
readonly storage?: ColumnConfigStorage<TConfig>;
|
|
1071
|
+
/** Dialect-owned metadata retained by schema snapshots. */
|
|
1072
|
+
readonly dialect?: SchemaDialectExtension;
|
|
1038
1073
|
/** Runtime decoder used when this definition is projected. */
|
|
1039
1074
|
readonly resultDecoder?: ResultDecoder;
|
|
1040
1075
|
/** Runtime default used when an application insert omits this definition. */
|
|
@@ -1266,9 +1301,13 @@ declare function column<TOutput = unknown, TInsert = TOutput, TUpdate = TInsert,
|
|
|
1266
1301
|
declare function column<TOutput = unknown, TInsert = TOutput, TUpdate = TInsert, const TOptions extends ColumnOptions<TOutput, TInsert> = {}, TSqlType extends AnySqlType = SqlUnknown>(options?: TOptions): ColumnFromOptions<TOutput, TInsert, TUpdate, TOptions, TSqlType>;
|
|
1267
1302
|
/** Resolve the runtime result metadata carried by a column definition. */
|
|
1268
1303
|
declare function columnResultValue(definition: {
|
|
1269
|
-
readonly
|
|
1304
|
+
readonly sqlType?: SqlTypeName;
|
|
1270
1305
|
readonly resultDecoder?: ResultDecoder;
|
|
1271
1306
|
}): ResultValueMetadata | undefined;
|
|
1307
|
+
/** Resolve a column's explicit runtime semantic SQL domain for driver-facing metadata. */
|
|
1308
|
+
declare function columnSqlType(definition: {
|
|
1309
|
+
readonly sqlType?: SqlTypeName;
|
|
1310
|
+
}): SqlTypeName | undefined;
|
|
1272
1311
|
/** Apply a live column codec while preserving SQL NULL unchanged. */
|
|
1273
1312
|
declare function encodeColumnParameter(definition: {
|
|
1274
1313
|
readonly parameterEncoder?: (value: any) => unknown;
|
|
@@ -1352,10 +1391,16 @@ declare function mapResult<TOutput, TExpression extends AnyExpression>(expressio
|
|
|
1352
1391
|
interface ValueExpression<T = unknown, TSqlType extends AnySqlType = SqlUnknown> extends SchemaExpression<ResultMeta<T, never, TSqlType> | ExpressionMeta<never>, "value"> {
|
|
1353
1392
|
readonly value: T;
|
|
1354
1393
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1394
|
+
/** Build a parameterized value expression with an optional runtime SQL domain for the adapter. */
|
|
1395
|
+
declare function value<T>(input: T, sqlType?: SqlTypeName): ValueExpression<T>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Bind a value while declaring its compile-time and runtime SQL semantic domain.
|
|
1398
|
+
*
|
|
1399
|
+
* @remarks
|
|
1400
|
+
* The domain is a binding hint; it does not select a JavaScript result decoder.
|
|
1401
|
+
*/
|
|
1402
|
+
declare function typedValue<TSqlType extends AnySqlType, T>(input: T, sqlType: TSqlType["sqlType"]): ValueExpression<T, TSqlType>;
|
|
1403
|
+
declare function asValue<TInput>(input: TInput, sqlType?: SqlTypeName): TInput extends AnyExpression ? TInput : ValueExpression<TInput>;
|
|
1359
1404
|
//#endregion
|
|
1360
1405
|
//#region src/expressions/operators/shared.d.ts
|
|
1361
1406
|
type Operand<T> = T | ExpressionWithOutput<T>;
|
|
@@ -1690,7 +1735,7 @@ declare function typedCall<TSqlType extends AnySqlType, TOutput = unknown>(): <c
|
|
|
1690
1735
|
type TextOperandValidation<TInput> = SqlCapabilityValidation<OperandSqlType<TInput, SqlText>, SqlTextLike>;
|
|
1691
1736
|
type TextArgumentsValidation<TArguments extends readonly unknown[]> = TArguments extends readonly [infer THead, ...infer TTail] ? SqlCapabilityValidation<OperandSqlType<THead, SqlText>, SqlTextLike> & TextArgumentsValidation<TTail> : unknown;
|
|
1692
1737
|
type CoalesceValidation<TFirst, TRest extends readonly unknown[]> = TRest extends readonly [infer THead, ...infer TTail] ? SqlEqualityValidation<ExpressionSqlType<TFirst>, OperandSqlType<THead, ExpressionSqlType<TFirst>>> & CoalesceValidation<TFirst, TTail> : unknown;
|
|
1693
|
-
declare function lower<const TInput extends Operand<string>>(input: TInput & TextOperandValidation<TInput>):
|
|
1738
|
+
declare function lower<const TInput extends Operand<string>>(input: TInput & TextOperandValidation<TInput>): Expression<ResultMeta<string, (MetadataOf<TInput> extends (infer T) ? T extends MetadataOf<TInput> ? T extends {
|
|
1694
1739
|
readonly kind: "result";
|
|
1695
1740
|
} ? T : never : never : never) extends (infer T_1) ? T_1 extends (MetadataOf<TInput> extends (infer T_2) ? T_2 extends MetadataOf<TInput> ? T_2 extends {
|
|
1696
1741
|
readonly kind: "result";
|
|
@@ -1701,8 +1746,8 @@ declare function lower<const TInput extends Operand<string>>(input: TInput & Tex
|
|
|
1701
1746
|
readonly dependencies: infer TDependencies;
|
|
1702
1747
|
} ? TDependencies : never : never : never> | (MetadataOf<TInput> extends (infer T_4) ? T_4 extends MetadataOf<TInput> ? T_4 extends {
|
|
1703
1748
|
readonly kind: "result" | "cardinality";
|
|
1704
|
-
} ? never : T_4 : never : never), "function"
|
|
1705
|
-
declare function upper<const TInput extends Operand<string>>(input: TInput & TextOperandValidation<TInput>):
|
|
1749
|
+
} ? never : T_4 : never : never), "function"> & SchemaExpressionBrand & ResultValueCarrier;
|
|
1750
|
+
declare function upper<const TInput extends Operand<string>>(input: TInput & TextOperandValidation<TInput>): Expression<ResultMeta<string, (MetadataOf<TInput> extends (infer T) ? T extends MetadataOf<TInput> ? T extends {
|
|
1706
1751
|
readonly kind: "result";
|
|
1707
1752
|
} ? T : never : never : never) extends (infer T_1) ? T_1 extends (MetadataOf<TInput> extends (infer T_2) ? T_2 extends MetadataOf<TInput> ? T_2 extends {
|
|
1708
1753
|
readonly kind: "result";
|
|
@@ -1713,14 +1758,14 @@ declare function upper<const TInput extends Operand<string>>(input: TInput & Tex
|
|
|
1713
1758
|
readonly dependencies: infer TDependencies;
|
|
1714
1759
|
} ? TDependencies : never : never : never> | (MetadataOf<TInput> extends (infer T_4) ? T_4 extends MetadataOf<TInput> ? T_4 extends {
|
|
1715
1760
|
readonly kind: "result" | "cardinality";
|
|
1716
|
-
} ? never : T_4 : never : never), "function"
|
|
1717
|
-
declare function coalesce<T, TFirst extends ExpressionWithOutput<T>, const TRest extends readonly Operand<NoInfer<T>>[]>(first: TFirst, ...rest: TRest & CoalesceValidation<TFirst, TRest>):
|
|
1761
|
+
} ? never : T_4 : never : never), "function"> & SchemaExpressionBrand & ResultValueCarrier;
|
|
1762
|
+
declare function coalesce<T, TFirst extends ExpressionWithOutput<T>, const TRest extends readonly Operand<NoInfer<T>>[]>(first: TFirst, ...rest: TRest & CoalesceValidation<TFirst, TRest>): Expression<ResultMeta<T, never, ExpressionSqlType<TFirst>> | ExpressionMeta<MetadataOf<[TFirst, ...TRest][number]> extends (infer T_1) ? T_1 extends MetadataOf<[TFirst, ...TRest][number]> ? T_1 extends {
|
|
1718
1763
|
readonly kind: "expression";
|
|
1719
1764
|
readonly dependencies: infer TDependencies;
|
|
1720
1765
|
} ? TDependencies : never : never : never> | (MetadataOf<[TFirst, ...TRest][number]> extends (infer T_2) ? T_2 extends MetadataOf<[TFirst, ...TRest][number]> ? T_2 extends {
|
|
1721
1766
|
readonly kind: "result" | "cardinality";
|
|
1722
|
-
} ? never : T_2 : never : never), "function"
|
|
1723
|
-
declare function concat<const TArguments extends readonly Operand<string>[]>(...argumentsToConcat: TArguments & TextArgumentsValidation<TArguments>):
|
|
1767
|
+
} ? never : T_2 : never : never), "function"> & SchemaExpressionBrand & ResultValueCarrier;
|
|
1768
|
+
declare function concat<const TArguments extends readonly Operand<string>[]>(...argumentsToConcat: TArguments & TextArgumentsValidation<TArguments>): Expression<ResultMeta<string, (MetadataOf<TArguments[number]> extends (infer T) ? T extends MetadataOf<TArguments[number]> ? T extends {
|
|
1724
1769
|
readonly kind: "result";
|
|
1725
1770
|
} ? T : never : never : never) extends (infer T_1) ? T_1 extends (MetadataOf<TArguments[number]> extends (infer T_2) ? T_2 extends MetadataOf<TArguments[number]> ? T_2 extends {
|
|
1726
1771
|
readonly kind: "result";
|
|
@@ -1731,7 +1776,7 @@ declare function concat<const TArguments extends readonly Operand<string>[]>(...
|
|
|
1731
1776
|
readonly dependencies: infer TDependencies;
|
|
1732
1777
|
} ? TDependencies : never : never : never> | (MetadataOf<TArguments[number]> extends (infer T_4) ? T_4 extends MetadataOf<TArguments[number]> ? T_4 extends {
|
|
1733
1778
|
readonly kind: "result" | "cardinality";
|
|
1734
|
-
} ? never : T_4 : never : never), "function"
|
|
1779
|
+
} ? never : T_4 : never : never), "function"> & SchemaExpressionBrand & ResultValueCarrier;
|
|
1735
1780
|
//#endregion
|
|
1736
1781
|
//#region src/expressions/functions/window.d.ts
|
|
1737
1782
|
type WindowOrder = AnyExpression | OrderTerm<any>;
|
|
@@ -2671,6 +2716,11 @@ type DeclaredColumnNullabilityOf<TColumn> = TColumn extends DeclaredColumnNullab
|
|
|
2671
2716
|
//#endregion
|
|
2672
2717
|
//#region src/schema/indexes.d.ts
|
|
2673
2718
|
type IndexTerm = AnyExpression | OrderTerm<any>;
|
|
2719
|
+
/** Additional physical facts attached to one index term. */
|
|
2720
|
+
interface IndexTermOptions {
|
|
2721
|
+
readonly prefixLength?: SchemaLiteralValue | AnySchemaExpression;
|
|
2722
|
+
readonly operatorClass?: string;
|
|
2723
|
+
}
|
|
2674
2724
|
/** PostgreSQL-specific index method and storage metadata. */
|
|
2675
2725
|
interface PostgresIndexExtension extends SchemaDialectExtension<"postgresql"> {
|
|
2676
2726
|
readonly method?: "btree" | "hash" | "gist" | "spgist" | "gin" | "brin";
|
|
@@ -2699,6 +2749,12 @@ interface IndexOptions<TPredicate extends AnyExpression | undefined = AnyExpress
|
|
|
2699
2749
|
readonly include?: readonly ColumnReference<string, any>[];
|
|
2700
2750
|
/** Typed engine-specific index options. */
|
|
2701
2751
|
readonly dialect?: TExtension;
|
|
2752
|
+
/** Exact engine index method, when it is not dialect-extension data. */
|
|
2753
|
+
readonly method?: string;
|
|
2754
|
+
/** Physical backing constraint name, when the engine exposes one. */
|
|
2755
|
+
readonly backingConstraint?: string;
|
|
2756
|
+
/** Prefix lengths and operator classes aligned with the terms array. */
|
|
2757
|
+
readonly termOptions?: readonly (IndexTermOptions | undefined)[];
|
|
2702
2758
|
}
|
|
2703
2759
|
type IndexTermExpression$2<TTerm> = TTerm extends OrderTerm<any> ? TTerm["expression"] : TTerm;
|
|
2704
2760
|
type IsNullableIndexColumn<TColumn> = [DeclaredColumnNullabilityOf<TColumn>] extends [never] ? null extends OutputOf<TColumn> ? true : false : true extends DeclaredColumnNullabilityOf<TColumn> ? true : false;
|
|
@@ -2711,7 +2767,8 @@ type DialectOption<TOptions> = TOptions extends {
|
|
|
2711
2767
|
readonly dialect?: infer TDialect;
|
|
2712
2768
|
} ? unknown extends TDialect ? IndexDialectExtension | undefined : TDialect : undefined;
|
|
2713
2769
|
type PredicatePresence<TOptions> = [Exclude<PredicateOption<TOptions>, undefined>] extends [never] ? false : undefined extends PredicateOption<TOptions> ? boolean : true;
|
|
2714
|
-
type
|
|
2770
|
+
type HasTermOptions<TOptions> = "termOptions" extends keyof TOptions ? true : false;
|
|
2771
|
+
type IsCandidateKey<TTerms extends readonly IndexTerm[], TOptions extends IndexOptions<any>> = HasTermOptions<TOptions> extends true ? false : UniqueOption<TOptions> extends false ? false : PredicatePresence<TOptions> extends true ? false : AllEligibleColumns<TTerms> extends false ? false : UniqueOption<TOptions> extends true ? PredicatePresence<TOptions> extends false ? AllEligibleColumns<TTerms> extends true ? true : boolean : boolean : boolean;
|
|
2715
2772
|
/** Portable index metadata retained by a table and its aliases. */
|
|
2716
2773
|
interface TableIndex<TTerms extends readonly IndexTerm[] = any, TOptions extends IndexOptions<any> = any> extends SchemaObjectIdentity {
|
|
2717
2774
|
readonly kind: "index";
|
|
@@ -2722,6 +2779,9 @@ interface TableIndex<TTerms extends readonly IndexTerm[] = any, TOptions extends
|
|
|
2722
2779
|
readonly include: infer TIncluded;
|
|
2723
2780
|
} ? TIncluded : undefined;
|
|
2724
2781
|
readonly dialect?: DialectOption<TOptions>;
|
|
2782
|
+
readonly method?: "method" extends keyof TOptions ? TOptions["method"] : undefined;
|
|
2783
|
+
readonly backingConstraint?: "backingConstraint" extends keyof TOptions ? TOptions["backingConstraint"] : undefined;
|
|
2784
|
+
readonly termOptions?: "termOptions" extends keyof TOptions ? TOptions["termOptions"] : undefined;
|
|
2725
2785
|
readonly candidateKey: IsCandidateKey<TTerms, TOptions>;
|
|
2726
2786
|
}
|
|
2727
2787
|
/** The widened index shape accepted by source metadata records. */
|
|
@@ -2732,6 +2792,9 @@ interface SourceIndex {
|
|
|
2732
2792
|
readonly predicate: AnyExpression | undefined;
|
|
2733
2793
|
readonly includedColumns?: readonly ColumnReference<string, any>[];
|
|
2734
2794
|
readonly dialect?: IndexDialectExtension;
|
|
2795
|
+
readonly method?: string;
|
|
2796
|
+
readonly backingConstraint?: string;
|
|
2797
|
+
readonly termOptions?: readonly (IndexTermOptions | undefined)[];
|
|
2735
2798
|
readonly candidateKey: boolean;
|
|
2736
2799
|
}
|
|
2737
2800
|
type SourceIndexesRecord = Readonly<Record<string, SourceIndex>>;
|
|
@@ -2879,11 +2942,15 @@ interface MysqlConstraintExtension extends SchemaDialectExtension<"mysql"> {
|
|
|
2879
2942
|
type ConstraintDialectExtension = PostgresConstraintExtension | SqliteConstraintExtension | MysqlConstraintExtension | (SchemaDialectExtension<string> & Readonly<Record<string, unknown>>);
|
|
2880
2943
|
/** Shared physical-name and dialect-extension options for constraints. */
|
|
2881
2944
|
interface ConstraintOptions<TExtension extends ConstraintDialectExtension | undefined = ConstraintDialectExtension | undefined> extends SchemaObjectNameOptions {
|
|
2945
|
+
/** Whether the database constraint has been validated. */
|
|
2946
|
+
readonly validated?: boolean;
|
|
2882
2947
|
/** Engine-specific metadata owned by a future schema adapter. */
|
|
2883
2948
|
readonly dialect?: TExtension;
|
|
2884
2949
|
}
|
|
2885
2950
|
/** Options for primary-key and candidate-key declarations. */
|
|
2886
2951
|
interface KeyConstraintOptions<TExtension extends ConstraintDialectExtension | undefined = ConstraintDialectExtension | undefined> extends ConstraintOptions<TExtension> {
|
|
2952
|
+
/** Physical backing index name, when exposed by the database. */
|
|
2953
|
+
readonly backingIndex?: string;
|
|
2887
2954
|
/** Whether the key can be deferred by a supporting dialect. */
|
|
2888
2955
|
readonly deferrable?: boolean;
|
|
2889
2956
|
/** Initial enforcement timing for a deferrable key. */
|
|
@@ -2891,6 +2958,8 @@ interface KeyConstraintOptions<TExtension extends ConstraintDialectExtension | u
|
|
|
2891
2958
|
}
|
|
2892
2959
|
/** Options for a database unique constraint, including nullable columns. */
|
|
2893
2960
|
interface UniqueConstraintOptions<TExtension extends ConstraintDialectExtension | undefined = ConstraintDialectExtension | undefined> extends ConstraintOptions<TExtension> {
|
|
2961
|
+
/** Physical backing index name, when exposed by the database. */
|
|
2962
|
+
readonly backingIndex?: string;
|
|
2894
2963
|
/**
|
|
2895
2964
|
* SQL NULL comparison semantics. `distinct` is the common default in which multiple NULL values
|
|
2896
2965
|
* do not conflict; `not-distinct` permits at most one.
|
|
@@ -2931,6 +3000,8 @@ interface KeyConstraint<TKind extends "primary-key" | "unique" = "primary-key" |
|
|
|
2931
3000
|
readonly columns: TColumns;
|
|
2932
3001
|
readonly physicalName?: string;
|
|
2933
3002
|
readonly dialect?: ConstraintDialectExtension;
|
|
3003
|
+
readonly validated?: boolean;
|
|
3004
|
+
readonly backingIndex?: string;
|
|
2934
3005
|
readonly deferrable?: boolean;
|
|
2935
3006
|
readonly initially?: ConstraintTiming;
|
|
2936
3007
|
}
|
|
@@ -2947,6 +3018,7 @@ interface ForeignKeyConstraint<TColumns extends readonly AnyKeyColumn[] = readon
|
|
|
2947
3018
|
readonly target: TTarget;
|
|
2948
3019
|
readonly physicalName?: string;
|
|
2949
3020
|
readonly dialect?: ConstraintDialectExtension;
|
|
3021
|
+
readonly validated?: boolean;
|
|
2950
3022
|
readonly onUpdate?: ReferentialAction;
|
|
2951
3023
|
readonly onDelete?: ReferentialAction;
|
|
2952
3024
|
readonly match?: ForeignKeyMatch;
|
|
@@ -2960,6 +3032,8 @@ interface UniqueConstraint<TColumns extends readonly AnyKeyColumn[] = readonly A
|
|
|
2960
3032
|
readonly nulls: TNulls;
|
|
2961
3033
|
readonly physicalName?: string;
|
|
2962
3034
|
readonly dialect?: ConstraintDialectExtension;
|
|
3035
|
+
readonly validated?: boolean;
|
|
3036
|
+
readonly backingIndex?: string;
|
|
2963
3037
|
readonly deferrable?: boolean;
|
|
2964
3038
|
readonly initially?: ConstraintTiming;
|
|
2965
3039
|
}
|
|
@@ -2969,6 +3043,7 @@ interface CheckConstraint<TExpression extends AnyExpression = AnyExpression> ext
|
|
|
2969
3043
|
readonly expression: TExpression;
|
|
2970
3044
|
readonly physicalName?: string;
|
|
2971
3045
|
readonly dialect?: ConstraintDialectExtension;
|
|
3046
|
+
readonly validated?: boolean;
|
|
2972
3047
|
readonly deferrable?: boolean;
|
|
2973
3048
|
readonly initially?: ConstraintTiming;
|
|
2974
3049
|
}
|
|
@@ -3238,14 +3313,14 @@ interface SchemaDialectHooks {
|
|
|
3238
3313
|
* A schema dialect must be created with {@link createSchemaDialect}; that helper preserves the exact
|
|
3239
3314
|
* query rendering object and adds only schema behavior and snapshot metadata.
|
|
3240
3315
|
*/
|
|
3241
|
-
interface SchemaDialect<TCapabilities extends
|
|
3316
|
+
interface SchemaDialect<TCapabilities extends string = DialectCapability> extends Dialect<TCapabilities> {
|
|
3242
3317
|
readonly schema: SchemaDialectHooks;
|
|
3243
3318
|
}
|
|
3244
3319
|
/**
|
|
3245
3320
|
* Add schema behavior to an existing query dialect without rebuilding any of its identifier,
|
|
3246
3321
|
* literal, placeholder, JSON, cast, or capability policies.
|
|
3247
3322
|
*/
|
|
3248
|
-
declare function createSchemaDialect<const TCapabilities extends
|
|
3323
|
+
declare function createSchemaDialect<const TCapabilities extends string = DialectCapability>(queryDialect: Dialect<TCapabilities>, schema: SchemaDialectHooks): SchemaDialect<TCapabilities>;
|
|
3249
3324
|
//#endregion
|
|
3250
3325
|
//#region src/query/selection.d.ts
|
|
3251
3326
|
/**
|
|
@@ -3544,6 +3619,33 @@ declare function update<const TTable extends AnyTable, const TAssignments extend
|
|
|
3544
3619
|
readonly sqlTypes: MutationSqlTypes<TClauses>;
|
|
3545
3620
|
}>;
|
|
3546
3621
|
//#endregion
|
|
3622
|
+
//#region src/query/mutation/on-duplicate-key-update.d.ts
|
|
3623
|
+
/** Identity of the proposed row for one MySQL INSERT target. */
|
|
3624
|
+
type IncomingIdentity<TIdentity> = {
|
|
3625
|
+
readonly sourceKind: "mysql-incoming";
|
|
3626
|
+
readonly table: TIdentity;
|
|
3627
|
+
};
|
|
3628
|
+
/** Typed proposed-row columns usable only in duplicate-key assignments. */
|
|
3629
|
+
type IncomingColumns<TTable extends AnyTable> = SourceColumns<SourceRow<TTable>, IncomingIdentity<SourceIdentity<TTable>>, SourceSqlTypeMap<TTable>>;
|
|
3630
|
+
/**
|
|
3631
|
+
* Reference the incoming row in MySQL duplicate-key assignments. INSERT SELECT exposes only its
|
|
3632
|
+
* explicit target columns; other references fail during rendering. These references cannot be used
|
|
3633
|
+
* as a FROM source.
|
|
3634
|
+
*/
|
|
3635
|
+
declare function incoming<const TTable extends AnyTable>(table: TTable): IncomingColumns<TTable>;
|
|
3636
|
+
type AssignmentValidation<TTable extends AnyTable, TAssignments extends object> = TAssignments extends UpdateAssignments<TTable> ? Exclude<keyof TAssignments, keyof UpdateAssignments<TTable>> extends never ? Exclude<RequiresOf<TAssignments[keyof TAssignments]> | RequiresOuterOf<TAssignments[keyof TAssignments]>, SourceIdentity<TTable> | IncomingIdentity<SourceIdentity<TTable>>> extends never ? unknown : QueryTypeValidation<"missing-source", "upsert.duplicate-key.assignments", "Use only the target table and its incoming row."> : QueryTypeValidation<"invalid-update", "upsert.duplicate-key.assignments", "Use only writable target columns."> : QueryTypeValidation<"invalid-update", "upsert.duplicate-key.assignments", "Provide target-compatible assignment values.">;
|
|
3637
|
+
/** MySQL INSERT clause; conflicts are determined by the database's keys. */
|
|
3638
|
+
interface OnDuplicateKeyUpdateClause<TTable extends AnyTable = AnyTable, TAssignments extends object = object> extends Fragment<RequiresCapabilityMeta<"on-duplicate-key-update"> | RequiresSourceMeta<SourceIdentity<TTable>> | CapabilityMetadataOf<TAssignments[keyof TAssignments]>> {
|
|
3639
|
+
readonly clauseKind: "on-duplicate-key-update";
|
|
3640
|
+
readonly table: TTable;
|
|
3641
|
+
}
|
|
3642
|
+
/**
|
|
3643
|
+
* Update writable columns when a MySQL INSERT row conflicts with a key. Raw values use target
|
|
3644
|
+
* column encoders. Expressions may reference the target table or incoming(table). At least one
|
|
3645
|
+
* non-omitted assignment is required.
|
|
3646
|
+
*/
|
|
3647
|
+
declare function onDuplicateKeyUpdate<const TTable extends AnyTable, const TAssignments extends object>(table: TTable, assignments: TAssignments & AssignmentValidation<TTable, TAssignments>): OnDuplicateKeyUpdateClause<TTable, TAssignments>;
|
|
3648
|
+
//#endregion
|
|
3547
3649
|
//#region src/query/mutation/on-conflict.d.ts
|
|
3548
3650
|
type ExcludedIdentity<TTableIdentity> = {
|
|
3549
3651
|
readonly sourceKind: "excluded";
|
|
@@ -3592,7 +3694,7 @@ interface OnConflictClause<TAction extends ConflictAction = ConflictAction> exte
|
|
|
3592
3694
|
readonly target: KeyConstraint | SourceIndex | undefined;
|
|
3593
3695
|
readonly action: TAction;
|
|
3594
3696
|
}
|
|
3595
|
-
type InsertClause = MutationReturningClause | OnConflictClause | MutationWithClause
|
|
3697
|
+
type InsertClause = MutationReturningClause | OnConflictClause | MutationWithClause | OnDuplicateKeyUpdateClause<any, any>;
|
|
3596
3698
|
declare function onConflict(action: DoNothingAction): OnConflictClause<DoNothingAction>;
|
|
3597
3699
|
declare function onConflict<const TTable extends AnyTable, const TTarget extends ConflictTarget<TTable>, const TAction extends ConflictAction>(table: TTable, target: TTarget, action: TAction & ConflictActionValidation<TTable, TAction>): OnConflictClause<TAction>;
|
|
3598
3700
|
//#endregion
|
|
@@ -3630,7 +3732,11 @@ type ValidInsertSource<TTable extends AnyTable, TSource extends InsertSource> =
|
|
|
3630
3732
|
} | {
|
|
3631
3733
|
hasRuntimeDefault: true;
|
|
3632
3734
|
} ? K : never; }[keyof TTable["definitions"]]>> : TSource extends InsertSelectSource<any, infer TColumns> ? Exclude<TColumns[number], keyof TTable["definitions"]> extends never ? Exclude<{ [K in keyof TTable["definitions"]]-?: ColumnIsGenerated<TTable["definitions"][K]> extends true ? never : ColumnHasDefault<TTable["definitions"][K]> extends true ? never : K; }[keyof TTable["definitions"]], TColumns[number]> extends never ? unknown : QueryTypeValidation<"invalid-insert", "insert.select.columns", "Include every required insert column in the target list.", Exclude<{ [K in keyof TTable["definitions"]]-?: ColumnIsGenerated<TTable["definitions"][K]> extends true ? never : ColumnHasDefault<TTable["definitions"][K]> extends true ? never : K; }[keyof TTable["definitions"]], TColumns[number]>> : QueryTypeValidation<"invalid-insert", "insert.select.columns", "Use only columns declared by the insert table.", Exclude<TColumns[number], keyof TTable["definitions"]>> : never;
|
|
3633
|
-
declare function insertInto<const TTable extends AnyTable, const TSource extends InsertSource, const TClauses extends readonly InsertClause[]>(table: TTable, source: TSource & ValidInsertSource<TTable, TSource> & InsertValuesScopeValidation<TSource>, ...clauses: TClauses & MutationScopeValidation<TTable, TClauses>
|
|
3735
|
+
declare function insertInto<const TTable extends AnyTable, const TSource extends InsertSource, const TClauses extends readonly InsertClause[]>(table: TTable, source: TSource & ValidInsertSource<TTable, TSource> & InsertValuesScopeValidation<TSource>, ...clauses: TClauses & MutationScopeValidation<TTable, TClauses> & (Extract<TClauses[number], {
|
|
3736
|
+
clauseKind: "on-duplicate-key-update";
|
|
3737
|
+
}> extends never ? unknown : Extract<TClauses[number], {
|
|
3738
|
+
clauseKind: "returning";
|
|
3739
|
+
}> extends never ? unknown : QueryTypeValidation<"invalid-mutation", "insert.duplicate-key", "MySQL duplicate-key updates do not support RETURNING.">)): MutationQuery<{
|
|
3634
3740
|
readonly row: MutationRow<TClauses>;
|
|
3635
3741
|
readonly kind: "insert";
|
|
3636
3742
|
readonly metadata: MutationMetadata<TClauses[number]> | InsertSourceMetadata<TSource>;
|
|
@@ -3645,6 +3751,37 @@ declare function deleteFrom<const TTable extends AnyTable, const TClauses extend
|
|
|
3645
3751
|
readonly sqlTypes: MutationSqlTypes<TClauses>;
|
|
3646
3752
|
}>;
|
|
3647
3753
|
//#endregion
|
|
3754
|
+
//#region src/expressions/nested-json.d.ts
|
|
3755
|
+
type JsonSourceQuery = AnyQuery & {
|
|
3756
|
+
readonly queryKind: "select" | "set";
|
|
3757
|
+
};
|
|
3758
|
+
type JsonQueryExpression<TQuery, TOutput> = Expression<ResultMeta<TOutput, never, SqlJson<TOutput>> | InheritedMetadata<TQuery> | SubqueryMeta, "subquery">;
|
|
3759
|
+
type ObjectQueryValidation<TQuery> = 0 extends 1 & CardinalityOf<TQuery> ? QueryTypeValidation<"invalid-subquery", "jsonObjectFrom.query", "Prove at most one row with fetchFirst(1)."> : [CardinalityOf<TQuery>] extends ["exactly-one" | "zero-or-one"] ? unknown : QueryTypeValidation<"invalid-subquery", "jsonObjectFrom.query", "Prove at most one row with fetchFirst(1).">;
|
|
3760
|
+
/**
|
|
3761
|
+
* Turn a SELECT or set query into an inferred array expression; empty queries return [].
|
|
3762
|
+
*
|
|
3763
|
+
* Preserves correlation, explicit ordering and pagination on PostgreSQL, MySQL 8.0.21+, and SQLite
|
|
3764
|
+
* 3.45+. Without ORDER BY, element order is unspecified. DISTINCT ordering must use expressions
|
|
3765
|
+
* present in the projection.
|
|
3766
|
+
*
|
|
3767
|
+
* Nested fields require supported runtime SQL domains. Bigints, binary values and serialized JSON
|
|
3768
|
+
* use exact text transport; dates and booleans are normalized without adapter-specific decoders.
|
|
3769
|
+
* Unsupported domains or lossy numeric representations throw. Custom result decoders receive the
|
|
3770
|
+
* transport value (including strings for bigint, decimal, binary hex and JSON), consistent with
|
|
3771
|
+
* their unknown-input contract.
|
|
3772
|
+
*/
|
|
3773
|
+
declare function jsonArrayFrom<TQuery extends JsonSourceQuery>(query: TQuery): JsonQueryExpression<TQuery, QueryRow<TQuery>[]>;
|
|
3774
|
+
/**
|
|
3775
|
+
* Turn a query proven to return at most one row into an inferred object.
|
|
3776
|
+
*
|
|
3777
|
+
* Empty queries return null; exactly-one queries retain a non-null result type. Use an
|
|
3778
|
+
* unconditional fetchFirst(1) to prove the row bound for a table query. Shares dialect, projection
|
|
3779
|
+
* and exact-decoding rules with {@link jsonArrayFrom}.
|
|
3780
|
+
*
|
|
3781
|
+
* @throws {TypeError} When the query lacks a runtime at-most-one-row proof.
|
|
3782
|
+
*/
|
|
3783
|
+
declare function jsonObjectFrom<TQuery extends JsonSourceQuery>(query: TQuery & ObjectQueryValidation<TQuery>): JsonQueryExpression<TQuery, QueryRow<TQuery> | ([CardinalityOf<TQuery>] extends ["exactly-one"] ? never : null)>;
|
|
3784
|
+
//#endregion
|
|
3648
3785
|
//#region src/query/clauses/order-by.d.ts
|
|
3649
3786
|
type OrderDirection = "ASC" | "DESC";
|
|
3650
3787
|
type NullsOrder = "FIRST" | "LAST";
|
|
@@ -3686,6 +3823,7 @@ type AnyTable = Source<any> & {
|
|
|
3686
3823
|
readonly definitions: TableDefinitions;
|
|
3687
3824
|
/** Application field keys mapped to physical SQL column names. */
|
|
3688
3825
|
readonly sqlNames: Readonly<Record<string, string>>;
|
|
3826
|
+
readonly dialect?: SchemaDialectExtension;
|
|
3689
3827
|
};
|
|
3690
3828
|
type TableRow<TDefinitions extends TableDefinitions> = { -readonly [K in keyof TDefinitions]: ColumnOutput<TDefinitions[K]>; };
|
|
3691
3829
|
/** SQL semantic domains derived from a table's column definitions. */
|
|
@@ -3712,11 +3850,13 @@ type Table<TName extends string = string, TDefinitions extends TableDefinitions
|
|
|
3712
3850
|
readonly columns: TableColumns<TDefinitions, TableIdentity<TName>>;
|
|
3713
3851
|
readonly constraints: TConstraints;
|
|
3714
3852
|
readonly indexes: TIndexes;
|
|
3853
|
+
readonly dialect?: SchemaDialectExtension;
|
|
3715
3854
|
} & TableColumns<TDefinitions, TableIdentity<TName>>;
|
|
3716
3855
|
/** Schema metadata that applies to a table as a relation. */
|
|
3717
3856
|
interface TableOptions<TConstraints extends SourceConstraintsRecord = SourceConstraintsRecord, TIndexes extends SourceIndexesRecord = SourceIndexesRecord> {
|
|
3718
3857
|
readonly constraints: TConstraints;
|
|
3719
3858
|
readonly indexes: TIndexes;
|
|
3859
|
+
readonly dialect?: SchemaDialectExtension;
|
|
3720
3860
|
}
|
|
3721
3861
|
type ConstraintColumns<TConstraint> = TConstraint extends KeyConstraint<any, infer TColumns> | UniqueConstraint<infer TColumns> | ForeignKeyConstraint<infer TColumns, any> ? TColumns[number] : never;
|
|
3722
3862
|
type InvalidConstraintDependencies<TName extends string, TConstraints extends SourceConstraintsRecord> = Exclude<DependenciesOf<ConstraintColumns<TConstraints[keyof TConstraints]>>, ColumnDependency<TableIdentity<TName>, string>>;
|
|
@@ -3827,9 +3967,10 @@ interface CustomSourceOptions<TIdentity, TDefinitions extends TableDefinitions>
|
|
|
3827
3967
|
readonly columns: TDefinitions;
|
|
3828
3968
|
readonly sourceKind?: SourceKind;
|
|
3829
3969
|
}
|
|
3830
|
-
type CustomSource<TIdentity, TDefinitions extends TableDefinitions> = Source<{
|
|
3970
|
+
type CustomSource<TIdentity, TDefinitions extends TableDefinitions, TMetadata = never> = Source<{
|
|
3831
3971
|
readonly identity: TIdentity;
|
|
3832
3972
|
readonly row: TableRow<TDefinitions>;
|
|
3973
|
+
readonly metadata: TMetadata;
|
|
3833
3974
|
readonly sqlTypes: TableSqlTypes<TDefinitions>;
|
|
3834
3975
|
}> & {
|
|
3835
3976
|
readonly identity: TIdentity;
|
|
@@ -3848,7 +3989,7 @@ declare function createSource<TIdentity, TRow extends object, TMetadata = never,
|
|
|
3848
3989
|
* function. The renderer owns the relation syntax and may bind values through context.parameter();
|
|
3849
3990
|
* the source identity and output columns remain available to the normal FROM/JOIN scope checks.
|
|
3850
3991
|
*/
|
|
3851
|
-
declare function customSource<const TIdentity, const TDefinitions extends TableDefinitions>(options: CustomSourceOptions<TIdentity, TDefinitions>): CustomSource<TIdentity, TDefinitions>;
|
|
3992
|
+
declare function customSource<const TIdentity, const TDefinitions extends TableDefinitions, const TMetadata = never>(options: CustomSourceOptions<TIdentity, TDefinitions>): CustomSource<TIdentity, TDefinitions, TMetadata>;
|
|
3852
3993
|
/**
|
|
3853
3994
|
* Add convenient direct column properties without allowing a column name to overwrite the source's
|
|
3854
3995
|
* rendering or metadata primitives.
|
|
@@ -3874,9 +4015,13 @@ interface Query<TConfig extends QueryConfig = {}> extends Fragment<ResultMeta<re
|
|
|
3874
4015
|
/** @internal Type-level configuration retained for inference. */
|
|
3875
4016
|
readonly __queryConfig?: TConfig;
|
|
3876
4017
|
readonly queryKind: QueryKind;
|
|
4018
|
+
/** @internal Runtime row-bound proof retained by built-in query constructors. */
|
|
4019
|
+
readonly cardinality?: QueryCardinality;
|
|
3877
4020
|
readonly row: QueryConfigRow<TConfig>;
|
|
3878
4021
|
/** Runtime metadata used to decode named result fields. */
|
|
3879
4022
|
readonly resultShape: ResultShape;
|
|
4023
|
+
/** @internal Render a SELECT with an ordering ordinal for nested JSON aggregation. */
|
|
4024
|
+
readonly renderJsonRows?: (context: RenderContext, ordinal: string) => void;
|
|
3880
4025
|
/** Type-only SQL domains of the named query projection. */
|
|
3881
4026
|
readonly sqlTypes?: QueryConfigSqlTypes<TConfig>;
|
|
3882
4027
|
}
|
|
@@ -3898,7 +4043,7 @@ type QuerySqlTypeMap<T> = T extends {
|
|
|
3898
4043
|
//#endregion
|
|
3899
4044
|
//#region src/core/dialect.d.ts
|
|
3900
4045
|
/** Capabilities whose syntax must be explicitly supported by a dialect. */
|
|
3901
|
-
type DialectCapability = "ilike" | "json" | "on-conflict" | "row-locking" | "update-from";
|
|
4046
|
+
type DialectCapability = "ilike" | "json" | "on-conflict" | "on-duplicate-key-update" | "row-locking" | "update-from";
|
|
3902
4047
|
/**
|
|
3903
4048
|
* Optional dialect hook used by schema expressions when a JavaScript value must become SQL text
|
|
3904
4049
|
* instead of a query parameter.
|
|
@@ -3961,7 +4106,7 @@ interface ExplainRenderOptions {
|
|
|
3961
4106
|
interface DialectExplain {
|
|
3962
4107
|
readonly render: (statement: string, queryKind: QueryKind, options: ExplainRenderOptions) => string;
|
|
3963
4108
|
}
|
|
3964
|
-
interface Dialect<TCapabilities extends
|
|
4109
|
+
interface Dialect<TCapabilities extends string = string> {
|
|
3965
4110
|
readonly name: string;
|
|
3966
4111
|
quoteIdentifier(identifier: string): string;
|
|
3967
4112
|
placeholder(position: number): string;
|
|
@@ -3979,7 +4124,7 @@ interface Dialect<TCapabilities extends DialectCapability = DialectCapability> {
|
|
|
3979
4124
|
/** Capabilities advertised by this dialect at the rendering boundary. */
|
|
3980
4125
|
readonly capabilities?: readonly TCapabilities[];
|
|
3981
4126
|
}
|
|
3982
|
-
interface DialectOptions<TCapabilities extends
|
|
4127
|
+
interface DialectOptions<TCapabilities extends string = never, TJson extends DialectJson | undefined = DialectJson | undefined> {
|
|
3983
4128
|
readonly name: string;
|
|
3984
4129
|
readonly quoteIdentifier?: (identifier: string) => string;
|
|
3985
4130
|
readonly placeholder: (position: number) => string;
|
|
@@ -4001,20 +4146,401 @@ declare function resolveCastTarget(dialect: Dialect, target: CastTarget): string
|
|
|
4001
4146
|
* Create a dialect from the few rendering decisions that SQL builders need to leave open. More
|
|
4002
4147
|
* involved syntax can be supplied as a custom fragment.
|
|
4003
4148
|
*/
|
|
4004
|
-
declare function createDialect<const TCapabilities extends
|
|
4149
|
+
declare function createDialect<const TCapabilities extends string = never>(options: DialectOptions<TCapabilities, DialectJson> & {
|
|
4005
4150
|
readonly json: DialectJson;
|
|
4006
4151
|
}): Dialect<TCapabilities | "json">;
|
|
4007
|
-
declare function createDialect<const TCapabilities extends
|
|
4152
|
+
declare function createDialect<const TCapabilities extends string = never>(options: DialectOptions<TCapabilities, undefined>): Dialect<TCapabilities>;
|
|
4008
4153
|
/**
|
|
4009
4154
|
* Check a capability at runtime for callers that intentionally bypass the typed render boundary or
|
|
4010
4155
|
* use a dialect supplied by an older integration.
|
|
4011
4156
|
*/
|
|
4012
|
-
declare function assertDialectCapability(dialect: Dialect
|
|
4157
|
+
declare function assertDialectCapability(dialect: Dialect<string>, capability: string): void;
|
|
4158
|
+
/** Extend a dialect with capabilities owned by an addon without changing its SQL policies. */
|
|
4159
|
+
declare function extendDialect<const TCapabilities extends string, const TAdditionalCapabilities extends string>(dialect: Dialect<TCapabilities>, additionalCapabilities: readonly TAdditionalCapabilities[]): Dialect<TCapabilities | TAdditionalCapabilities>;
|
|
4160
|
+
//#endregion
|
|
4161
|
+
//#region src/snapshot/complete-types.d.ts
|
|
4162
|
+
/** The canonical schema snapshot envelope tag. */
|
|
4163
|
+
declare const completeSchemaSnapshotFormat: "qubu-schema";
|
|
4164
|
+
/** The current strict format version for the complete catalog/object model. */
|
|
4165
|
+
declare const completeSchemaSnapshotVersion: 1;
|
|
4166
|
+
/** Descriptive alias for consumers that select a numbered snapshot version. */
|
|
4167
|
+
declare const schemaSnapshotV1Version: 1;
|
|
4168
|
+
/** Explicit format-version aliases for generated tooling and fixtures. */
|
|
4169
|
+
declare const schemaSnapshotCompleteVersion: 1;
|
|
4170
|
+
declare const schemaSnapshotVersion1: 1;
|
|
4171
|
+
/** Object families that may appear in a complete canonical snapshot. */
|
|
4172
|
+
type CompleteSnapshotObjectKind = "namespace" | "table" | "column" | "constraint" | "index" | "view" | "materialized-view" | "sequence" | "enum" | "domain" | "collation" | "trigger" | "routine" | "partition" | "policy" | "extension" | "comment" | "ownership" | "deferred-object" | "opaque-object";
|
|
4173
|
+
/** Object families that can own nested complete snapshot objects. */
|
|
4174
|
+
type CompleteSnapshotObjectOwnerKind = "table" | "view" | "materialized-view" | "domain";
|
|
4175
|
+
/** A non-recursive owner scope for a nested complete snapshot object. */
|
|
4176
|
+
interface CompleteSnapshotObjectOwner {
|
|
4177
|
+
readonly kind: CompleteSnapshotObjectOwnerKind;
|
|
4178
|
+
readonly id: string;
|
|
4179
|
+
}
|
|
4180
|
+
/** A stable logical object reference used by complete snapshot relations. */
|
|
4181
|
+
interface CompleteSnapshotObjectReference {
|
|
4182
|
+
readonly kind: Exclude<CompleteSnapshotObjectKind, "namespace">;
|
|
4183
|
+
readonly id: string;
|
|
4184
|
+
/** Required when the target is a nested column, constraint, or index. */
|
|
4185
|
+
readonly owner?: CompleteSnapshotObjectOwner;
|
|
4186
|
+
}
|
|
4187
|
+
/** Source evidence retained without persisting a database catalog key. */
|
|
4188
|
+
interface CompleteSnapshotProvenance {
|
|
4189
|
+
readonly kind: "catalog" | "decompiler" | "create-sql";
|
|
4190
|
+
readonly dialect: string;
|
|
4191
|
+
readonly path?: readonly (string | number)[];
|
|
4192
|
+
}
|
|
4193
|
+
/** Physical-name evidence retained without ephemeral catalog identity keys. */
|
|
4194
|
+
interface CompleteSnapshotPhysicalReference {
|
|
4195
|
+
readonly kind: CompleteSnapshotObjectKind;
|
|
4196
|
+
readonly namespace?: string;
|
|
4197
|
+
readonly table?: string;
|
|
4198
|
+
readonly name: string;
|
|
4199
|
+
}
|
|
4200
|
+
/** Namespace identity and selected physical boundary for a snapshot. */
|
|
4201
|
+
interface CompleteSnapshotNamespace extends CompleteSnapshotObjectMetadata {
|
|
4202
|
+
readonly kind: "generic" | "postgres-schema" | "sqlite-database" | "mysql-database";
|
|
4203
|
+
readonly name: string;
|
|
4204
|
+
}
|
|
4205
|
+
/** Capability facts reported by the adapter that produced the snapshot. */
|
|
4206
|
+
interface CompleteSnapshotCapabilities {
|
|
4207
|
+
readonly generatedColumns: boolean;
|
|
4208
|
+
readonly identityMetadata: boolean;
|
|
4209
|
+
readonly checkConstraints: boolean;
|
|
4210
|
+
readonly checkConstraintEnforcement: "enforced" | "metadata-only" | "unknown";
|
|
4211
|
+
readonly expressionDecompilation: boolean;
|
|
4212
|
+
readonly indexExpressions: boolean;
|
|
4213
|
+
readonly indexPredicates: boolean;
|
|
4214
|
+
readonly indexIncludedColumns: boolean;
|
|
4215
|
+
readonly namespaces: boolean;
|
|
4216
|
+
readonly visibility: "complete" | "limited" | "unknown";
|
|
4217
|
+
readonly [capability: string]: boolean | string;
|
|
4218
|
+
}
|
|
4219
|
+
/** Metadata common to every complete snapshot object. */
|
|
4220
|
+
interface CompleteSnapshotObjectMetadata {
|
|
4221
|
+
readonly provenance?: CompleteSnapshotProvenance;
|
|
4222
|
+
readonly physicalReference?: CompleteSnapshotPhysicalReference;
|
|
4223
|
+
readonly dialect?: SnapshotDialectExtension;
|
|
4224
|
+
}
|
|
4225
|
+
/** A complete snapshot column, including physical ordinal evidence. */
|
|
4226
|
+
interface CompleteSnapshotColumn extends CompleteSnapshotObjectMetadata {
|
|
4227
|
+
readonly kind: "column";
|
|
4228
|
+
readonly id: string;
|
|
4229
|
+
readonly physicalName: string;
|
|
4230
|
+
readonly ordinalPosition: number;
|
|
4231
|
+
readonly nullable: boolean;
|
|
4232
|
+
readonly hasDefault: boolean;
|
|
4233
|
+
readonly generated: boolean;
|
|
4234
|
+
readonly storage?: SnapshotStorage;
|
|
4235
|
+
readonly default?: SnapshotDefault;
|
|
4236
|
+
readonly generatedColumn?: SnapshotGeneratedColumn;
|
|
4237
|
+
readonly identity?: CompleteSnapshotIdentity;
|
|
4238
|
+
readonly onUpdate?: SnapshotExpression;
|
|
4239
|
+
}
|
|
4240
|
+
/** A richer identity declaration retained beside a column or sequence. */
|
|
4241
|
+
interface CompleteSnapshotIdentity extends CompleteSnapshotObjectMetadata {
|
|
4242
|
+
readonly kind: "identity";
|
|
4243
|
+
readonly generation: "always" | "by-default";
|
|
4244
|
+
readonly options: Readonly<Record<string, CompleteSnapshotValueFact>>;
|
|
4245
|
+
}
|
|
4246
|
+
/** A literal or opaque expression value in complete object metadata. */
|
|
4247
|
+
type CompleteSnapshotValueFact = {
|
|
4248
|
+
readonly kind: "literal";
|
|
4249
|
+
readonly value: SnapshotLiteral;
|
|
4250
|
+
} | {
|
|
4251
|
+
readonly kind: "expression";
|
|
4252
|
+
readonly expression: SnapshotExpression;
|
|
4253
|
+
};
|
|
4254
|
+
/** An ordered column or expression term in a complete index. */
|
|
4255
|
+
type CompleteSnapshotIndexTerm = {
|
|
4256
|
+
readonly kind: "column";
|
|
4257
|
+
readonly column: string;
|
|
4258
|
+
readonly position: number;
|
|
4259
|
+
readonly direction?: "ASC" | "DESC";
|
|
4260
|
+
readonly nulls?: "FIRST" | "LAST";
|
|
4261
|
+
readonly prefixLength?: CompleteSnapshotValueFact;
|
|
4262
|
+
readonly operatorClass?: string;
|
|
4263
|
+
} | {
|
|
4264
|
+
readonly kind: "expression";
|
|
4265
|
+
readonly expression: SnapshotExpression;
|
|
4266
|
+
readonly position: number;
|
|
4267
|
+
readonly direction?: "ASC" | "DESC";
|
|
4268
|
+
readonly nulls?: "FIRST" | "LAST";
|
|
4269
|
+
readonly operatorClass?: string;
|
|
4270
|
+
};
|
|
4271
|
+
/** A complete index with engine-specific method and included-column facts. */
|
|
4272
|
+
interface CompleteSnapshotIndex extends CompleteSnapshotObjectMetadata {
|
|
4273
|
+
readonly kind: "index";
|
|
4274
|
+
readonly id: string;
|
|
4275
|
+
readonly physicalName: string;
|
|
4276
|
+
readonly terms: readonly CompleteSnapshotIndexTerm[];
|
|
4277
|
+
readonly unique: boolean;
|
|
4278
|
+
readonly candidateKey: boolean;
|
|
4279
|
+
readonly predicate?: SnapshotExpression;
|
|
4280
|
+
readonly includedColumns?: readonly string[];
|
|
4281
|
+
readonly backingConstraint?: CompleteSnapshotObjectReference;
|
|
4282
|
+
readonly method?: string;
|
|
4283
|
+
}
|
|
4284
|
+
/** A key or uniqueness constraint in a complete table. */
|
|
4285
|
+
interface CompleteSnapshotKeyConstraint extends CompleteSnapshotObjectMetadata {
|
|
4286
|
+
readonly kind: "primary-key" | "unique" | "unique-constraint";
|
|
4287
|
+
readonly id: string;
|
|
4288
|
+
readonly physicalName: string;
|
|
4289
|
+
readonly columns: readonly string[];
|
|
4290
|
+
readonly nulls?: "distinct" | "not-distinct";
|
|
4291
|
+
readonly backingIndex?: CompleteSnapshotObjectReference;
|
|
4292
|
+
readonly deferrable?: boolean;
|
|
4293
|
+
readonly initially?: "immediate" | "deferred";
|
|
4294
|
+
readonly validated?: boolean;
|
|
4295
|
+
}
|
|
4296
|
+
/** A foreign key with explicit target object identity and actions. */
|
|
4297
|
+
interface CompleteSnapshotForeignKey extends CompleteSnapshotObjectMetadata {
|
|
4298
|
+
readonly kind: "foreign-key";
|
|
4299
|
+
readonly id: string;
|
|
4300
|
+
readonly physicalName: string;
|
|
4301
|
+
readonly columns: readonly string[];
|
|
4302
|
+
readonly target: {
|
|
4303
|
+
readonly table: CompleteSnapshotObjectReference;
|
|
4304
|
+
readonly columns: readonly string[];
|
|
4305
|
+
};
|
|
4306
|
+
readonly onUpdate?: "no-action" | "restrict" | "cascade" | "set-null" | "set-default";
|
|
4307
|
+
readonly onDelete?: "no-action" | "restrict" | "cascade" | "set-null" | "set-default";
|
|
4308
|
+
readonly match?: "simple" | "full" | "partial";
|
|
4309
|
+
readonly deferrable?: boolean;
|
|
4310
|
+
readonly initially?: "immediate" | "deferred";
|
|
4311
|
+
readonly validated?: boolean;
|
|
4312
|
+
}
|
|
4313
|
+
/** A check constraint whose expression remains tagged data. */
|
|
4314
|
+
interface CompleteSnapshotCheckConstraint extends CompleteSnapshotObjectMetadata {
|
|
4315
|
+
readonly kind: "check";
|
|
4316
|
+
readonly id: string;
|
|
4317
|
+
readonly physicalName: string;
|
|
4318
|
+
readonly expression: SnapshotExpression;
|
|
4319
|
+
readonly deferrable?: boolean;
|
|
4320
|
+
readonly initially?: "immediate" | "deferred";
|
|
4321
|
+
readonly validated?: boolean;
|
|
4322
|
+
}
|
|
4323
|
+
/** Every constraint represented by the complete neutral snapshot model. */
|
|
4324
|
+
type CompleteSnapshotConstraint = CompleteSnapshotKeyConstraint | CompleteSnapshotForeignKey | CompleteSnapshotCheckConstraint;
|
|
4325
|
+
/** A complete table record keyed by stable logical identity. */
|
|
4326
|
+
interface CompleteSnapshotTable extends CompleteSnapshotObjectMetadata {
|
|
4327
|
+
readonly kind: "table";
|
|
4328
|
+
readonly id: string;
|
|
4329
|
+
readonly physicalName: string;
|
|
4330
|
+
readonly columns: readonly CompleteSnapshotColumn[];
|
|
4331
|
+
readonly constraints: readonly CompleteSnapshotConstraint[];
|
|
4332
|
+
readonly indexes: readonly CompleteSnapshotIndex[];
|
|
4333
|
+
}
|
|
4334
|
+
/** A view or materialized-view declaration and its output columns. */
|
|
4335
|
+
interface CompleteSnapshotView extends CompleteSnapshotObjectMetadata {
|
|
4336
|
+
readonly kind: "view" | "materialized-view";
|
|
4337
|
+
readonly id: string;
|
|
4338
|
+
readonly physicalName: string;
|
|
4339
|
+
readonly columns: readonly CompleteSnapshotColumn[];
|
|
4340
|
+
readonly definition: SnapshotExpression;
|
|
4341
|
+
readonly dependencies?: readonly CompleteSnapshotObjectReference[];
|
|
4342
|
+
readonly checkOption?: "none" | "local" | "cascaded";
|
|
4343
|
+
readonly securityBarrier?: boolean;
|
|
4344
|
+
readonly securityInvoker?: boolean;
|
|
4345
|
+
}
|
|
4346
|
+
/** A sequence and its exact option facts. */
|
|
4347
|
+
interface CompleteSnapshotSequence extends CompleteSnapshotObjectMetadata {
|
|
4348
|
+
readonly kind: "sequence";
|
|
4349
|
+
readonly id: string;
|
|
4350
|
+
readonly physicalName: string;
|
|
4351
|
+
readonly storage?: SnapshotStorage;
|
|
4352
|
+
readonly start?: CompleteSnapshotValueFact;
|
|
4353
|
+
readonly increment?: CompleteSnapshotValueFact;
|
|
4354
|
+
readonly minimum?: CompleteSnapshotValueFact;
|
|
4355
|
+
readonly maximum?: CompleteSnapshotValueFact;
|
|
4356
|
+
readonly cache?: CompleteSnapshotValueFact;
|
|
4357
|
+
readonly cycle?: boolean;
|
|
4358
|
+
readonly ownedBy?: CompleteSnapshotObjectReference;
|
|
4359
|
+
readonly identity?: CompleteSnapshotIdentity;
|
|
4360
|
+
}
|
|
4361
|
+
/** An ordered enum declaration. */
|
|
4362
|
+
interface CompleteSnapshotEnum extends CompleteSnapshotObjectMetadata {
|
|
4363
|
+
readonly kind: "enum";
|
|
4364
|
+
readonly id: string;
|
|
4365
|
+
readonly physicalName: string;
|
|
4366
|
+
readonly values: readonly {
|
|
4367
|
+
readonly value: string;
|
|
4368
|
+
readonly ordinalPosition: number;
|
|
4369
|
+
readonly provenance?: CompleteSnapshotProvenance;
|
|
4370
|
+
}[];
|
|
4371
|
+
}
|
|
4372
|
+
/** A domain declaration and its base type constraints. */
|
|
4373
|
+
interface CompleteSnapshotDomain extends CompleteSnapshotObjectMetadata {
|
|
4374
|
+
readonly kind: "domain";
|
|
4375
|
+
readonly id: string;
|
|
4376
|
+
readonly physicalName: string;
|
|
4377
|
+
readonly storage: SnapshotStorage;
|
|
4378
|
+
readonly nullable?: boolean;
|
|
4379
|
+
readonly default?: CompleteSnapshotValueFact;
|
|
4380
|
+
readonly constraints?: readonly CompleteSnapshotCheckConstraint[];
|
|
4381
|
+
}
|
|
4382
|
+
/** Collation behavior that can affect deterministic schema comparison. */
|
|
4383
|
+
interface CompleteSnapshotCollation extends CompleteSnapshotObjectMetadata {
|
|
4384
|
+
readonly kind: "collation";
|
|
4385
|
+
readonly id: string;
|
|
4386
|
+
readonly physicalName: string;
|
|
4387
|
+
readonly provider?: string;
|
|
4388
|
+
readonly locale?: string;
|
|
4389
|
+
readonly deterministic?: boolean;
|
|
4390
|
+
readonly version?: string;
|
|
4391
|
+
}
|
|
4392
|
+
/** Trigger declaration attached to a table or view. */
|
|
4393
|
+
interface CompleteSnapshotTrigger extends CompleteSnapshotObjectMetadata {
|
|
4394
|
+
readonly kind: "trigger";
|
|
4395
|
+
readonly id: string;
|
|
4396
|
+
readonly physicalName: string;
|
|
4397
|
+
readonly table: CompleteSnapshotObjectReference;
|
|
4398
|
+
readonly timing: "before" | "after" | "instead-of" | "unknown";
|
|
4399
|
+
readonly events: readonly ("insert" | "update" | "delete" | "truncate")[];
|
|
4400
|
+
readonly orientation?: "row" | "statement";
|
|
4401
|
+
readonly condition?: SnapshotExpression;
|
|
4402
|
+
readonly body: SnapshotExpression;
|
|
4403
|
+
readonly enabled?: boolean;
|
|
4404
|
+
}
|
|
4405
|
+
/** Routine argument declaration. */
|
|
4406
|
+
interface CompleteSnapshotRoutineParameter {
|
|
4407
|
+
readonly name?: string;
|
|
4408
|
+
readonly mode?: "in" | "out" | "inout" | "variadic" | "table";
|
|
4409
|
+
readonly storage: SnapshotStorage;
|
|
4410
|
+
readonly default?: CompleteSnapshotValueFact;
|
|
4411
|
+
readonly ordinalPosition: number;
|
|
4412
|
+
readonly provenance?: CompleteSnapshotProvenance;
|
|
4413
|
+
}
|
|
4414
|
+
/** Function, procedure, aggregate, or window routine declaration. */
|
|
4415
|
+
interface CompleteSnapshotRoutine extends CompleteSnapshotObjectMetadata {
|
|
4416
|
+
readonly kind: "routine";
|
|
4417
|
+
readonly id: string;
|
|
4418
|
+
readonly physicalName: string;
|
|
4419
|
+
readonly routineKind: "function" | "procedure" | "aggregate" | "window" | "unknown";
|
|
4420
|
+
readonly parameters: readonly CompleteSnapshotRoutineParameter[];
|
|
4421
|
+
readonly returnType?: SnapshotStorage;
|
|
4422
|
+
readonly language?: string;
|
|
4423
|
+
readonly body?: SnapshotExpression;
|
|
4424
|
+
readonly volatility?: "immutable" | "stable" | "volatile" | "unknown";
|
|
4425
|
+
readonly parallel?: "safe" | "restricted" | "unsafe" | "unknown";
|
|
4426
|
+
readonly security?: "invoker" | "definer" | "unknown";
|
|
4427
|
+
readonly dependencies?: readonly CompleteSnapshotObjectReference[];
|
|
4428
|
+
}
|
|
4429
|
+
/** A partition child, its parent, and normalized bound expression. */
|
|
4430
|
+
interface CompleteSnapshotPartition extends CompleteSnapshotObjectMetadata {
|
|
4431
|
+
readonly kind: "partition";
|
|
4432
|
+
readonly id: string;
|
|
4433
|
+
readonly physicalName: string;
|
|
4434
|
+
readonly parent: CompleteSnapshotObjectReference;
|
|
4435
|
+
readonly strategy: "range" | "list" | "hash" | "reference" | "unknown";
|
|
4436
|
+
readonly keyColumns?: readonly string[];
|
|
4437
|
+
readonly bound?: SnapshotExpression;
|
|
4438
|
+
readonly default?: boolean;
|
|
4439
|
+
}
|
|
4440
|
+
/** A row-level security policy attached to a table. */
|
|
4441
|
+
interface CompleteSnapshotPolicy extends CompleteSnapshotObjectMetadata {
|
|
4442
|
+
readonly kind: "policy";
|
|
4443
|
+
readonly id: string;
|
|
4444
|
+
readonly physicalName: string;
|
|
4445
|
+
readonly table: CompleteSnapshotObjectReference;
|
|
4446
|
+
readonly command: "all" | "select" | "insert" | "update" | "delete" | "unknown";
|
|
4447
|
+
readonly roles?: readonly string[];
|
|
4448
|
+
readonly permissive?: boolean;
|
|
4449
|
+
readonly using?: SnapshotExpression;
|
|
4450
|
+
readonly check?: SnapshotExpression;
|
|
4451
|
+
}
|
|
4452
|
+
/** An extension object with a typed, versioned payload. */
|
|
4453
|
+
interface CompleteSnapshotExtension extends CompleteSnapshotObjectMetadata {
|
|
4454
|
+
readonly kind: "extension";
|
|
4455
|
+
readonly id: string;
|
|
4456
|
+
readonly physicalName: string;
|
|
4457
|
+
readonly extensionName: string;
|
|
4458
|
+
readonly extensionVersion?: string;
|
|
4459
|
+
readonly schema?: string;
|
|
4460
|
+
readonly data: SnapshotJsonValue;
|
|
4461
|
+
readonly configuration?: SnapshotJsonValue;
|
|
4462
|
+
}
|
|
4463
|
+
/** A deferred object retained as a reviewable, non-lossy boundary record. */
|
|
4464
|
+
interface CompleteSnapshotDeferredObject extends CompleteSnapshotObjectMetadata {
|
|
4465
|
+
readonly kind: "deferred-object";
|
|
4466
|
+
readonly id: string;
|
|
4467
|
+
readonly objectKind: string;
|
|
4468
|
+
readonly physicalName: string;
|
|
4469
|
+
readonly reason?: string;
|
|
4470
|
+
readonly data?: SnapshotJsonValue;
|
|
4471
|
+
}
|
|
4472
|
+
/** An opaque object observed by an adapter but not yet structurally modeled. */
|
|
4473
|
+
interface CompleteSnapshotOpaqueObject extends CompleteSnapshotObjectMetadata {
|
|
4474
|
+
readonly kind: "opaque-object";
|
|
4475
|
+
readonly id: string;
|
|
4476
|
+
readonly objectKind: string;
|
|
4477
|
+
readonly physicalName: string;
|
|
4478
|
+
readonly data: SnapshotJsonValue;
|
|
4479
|
+
readonly sql?: SnapshotExpression;
|
|
4480
|
+
}
|
|
4481
|
+
/** A comment attached to a stable logical object. */
|
|
4482
|
+
interface CompleteSnapshotComment extends CompleteSnapshotObjectMetadata {
|
|
4483
|
+
readonly kind: "comment";
|
|
4484
|
+
readonly id: string;
|
|
4485
|
+
readonly physicalName: string;
|
|
4486
|
+
readonly object: CompleteSnapshotObjectReference;
|
|
4487
|
+
readonly text: string;
|
|
4488
|
+
}
|
|
4489
|
+
/** Ownership metadata attached to a stable logical object. */
|
|
4490
|
+
interface CompleteSnapshotOwnership extends CompleteSnapshotObjectMetadata {
|
|
4491
|
+
readonly kind: "ownership";
|
|
4492
|
+
readonly id: string;
|
|
4493
|
+
readonly physicalName: string;
|
|
4494
|
+
readonly object: CompleteSnapshotObjectReference;
|
|
4495
|
+
readonly owner: string;
|
|
4496
|
+
}
|
|
4497
|
+
/** Every complete snapshot object family, including retained boundaries. */
|
|
4498
|
+
type CompleteSnapshotObject = CompleteSnapshotTable | CompleteSnapshotView | CompleteSnapshotSequence | CompleteSnapshotEnum | CompleteSnapshotDomain | CompleteSnapshotCollation | CompleteSnapshotTrigger | CompleteSnapshotRoutine | CompleteSnapshotPartition | CompleteSnapshotPolicy | CompleteSnapshotExtension | CompleteSnapshotDeferredObject | CompleteSnapshotOpaqueObject | CompleteSnapshotComment | CompleteSnapshotOwnership;
|
|
4499
|
+
/** The immutable strict Snapshot v1 envelope. */
|
|
4500
|
+
interface CompleteSchemaSnapshot {
|
|
4501
|
+
readonly format: typeof completeSchemaSnapshotFormat;
|
|
4502
|
+
readonly version: typeof completeSchemaSnapshotVersion;
|
|
4503
|
+
readonly dialect: SnapshotDialect;
|
|
4504
|
+
readonly namingPolicy: SnapshotNamingPolicy;
|
|
4505
|
+
readonly namespace: CompleteSnapshotNamespace;
|
|
4506
|
+
readonly capabilities: CompleteSnapshotCapabilities;
|
|
4507
|
+
readonly tables: readonly CompleteSnapshotTable[];
|
|
4508
|
+
readonly views: readonly CompleteSnapshotView[];
|
|
4509
|
+
readonly sequences: readonly CompleteSnapshotSequence[];
|
|
4510
|
+
readonly enums: readonly CompleteSnapshotEnum[];
|
|
4511
|
+
readonly domains: readonly CompleteSnapshotDomain[];
|
|
4512
|
+
readonly collations: readonly CompleteSnapshotCollation[];
|
|
4513
|
+
readonly triggers: readonly CompleteSnapshotTrigger[];
|
|
4514
|
+
readonly routines: readonly CompleteSnapshotRoutine[];
|
|
4515
|
+
readonly partitions: readonly CompleteSnapshotPartition[];
|
|
4516
|
+
readonly policies: readonly CompleteSnapshotPolicy[];
|
|
4517
|
+
readonly extensions: readonly CompleteSnapshotExtension[];
|
|
4518
|
+
readonly deferredObjects: readonly CompleteSnapshotDeferredObject[];
|
|
4519
|
+
readonly opaqueObjects: readonly CompleteSnapshotOpaqueObject[];
|
|
4520
|
+
readonly comments: readonly CompleteSnapshotComment[];
|
|
4521
|
+
readonly ownership: readonly CompleteSnapshotOwnership[];
|
|
4522
|
+
}
|
|
4523
|
+
/** Input accepted by the strict complete snapshot encoder. */
|
|
4524
|
+
type CompleteSchemaSnapshotInput = CompleteSchemaSnapshot | Readonly<Record<string, unknown>>;
|
|
4525
|
+
/** A complete snapshot decoder result with immutable successful output. */
|
|
4526
|
+
type CompleteSnapshotDecodeResult = {
|
|
4527
|
+
readonly ok: true;
|
|
4528
|
+
readonly value: CompleteSchemaSnapshot;
|
|
4529
|
+
} | {
|
|
4530
|
+
readonly ok: false;
|
|
4531
|
+
readonly diagnostics: readonly SnapshotDiagnostic[];
|
|
4532
|
+
};
|
|
4533
|
+
/** A complete snapshot creation result with immutable successful output. */
|
|
4534
|
+
type CompleteSnapshotCreateResult = CompleteSnapshotDecodeResult;
|
|
4535
|
+
/** V1 aliases kept explicit for consumers that prefer numbered APIs. */
|
|
4536
|
+
type SchemaSnapshotV1 = CompleteSchemaSnapshot;
|
|
4537
|
+
type SchemaSnapshotV1Input = CompleteSchemaSnapshotInput;
|
|
4538
|
+
type SchemaSnapshotV1DecodeResult = CompleteSnapshotDecodeResult;
|
|
4013
4539
|
//#endregion
|
|
4014
4540
|
//#region src/snapshot/types.d.ts
|
|
4015
4541
|
/** The JSON object tag used by Qubu schema snapshots. */
|
|
4016
4542
|
declare const schemaSnapshotFormat: "qubu-schema";
|
|
4017
|
-
/** The
|
|
4543
|
+
/** The current canonical schema snapshot format version. */
|
|
4018
4544
|
declare const schemaSnapshotVersion: 1;
|
|
4019
4545
|
/** The first version of the dialect-extension envelope. */
|
|
4020
4546
|
declare const schemaSnapshotDialectVersion: 1;
|
|
@@ -4104,27 +4630,11 @@ type SnapshotGeneratedColumn = {
|
|
|
4104
4630
|
} | {
|
|
4105
4631
|
readonly kind: "external";
|
|
4106
4632
|
};
|
|
4107
|
-
/**
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
}
|
|
4113
|
-
/** A canonical column record keyed by its stable logical field ID. */
|
|
4114
|
-
interface SnapshotColumn {
|
|
4115
|
-
readonly id: string;
|
|
4116
|
-
readonly physicalName: string;
|
|
4117
|
-
readonly nullable: boolean;
|
|
4118
|
-
readonly hasDefault: boolean;
|
|
4119
|
-
readonly generated: boolean;
|
|
4120
|
-
readonly storage?: SnapshotStorage;
|
|
4121
|
-
readonly default?: SnapshotDefault;
|
|
4122
|
-
readonly generatedColumn?: SnapshotGeneratedColumn;
|
|
4123
|
-
readonly identity?: SnapshotIdentity;
|
|
4124
|
-
/** MySQL's parameter-free column update expression, when supported. */
|
|
4125
|
-
readonly onUpdate?: SnapshotExpression;
|
|
4126
|
-
}
|
|
4127
|
-
/** An expression or bare column used by an index. */
|
|
4633
|
+
/** V1 object aliases kept in the short snapshot vocabulary used by consumers. */
|
|
4634
|
+
type SnapshotIdentity = CompleteSnapshotIdentity;
|
|
4635
|
+
type SnapshotColumn = CompleteSnapshotColumn;
|
|
4636
|
+
type SnapshotIndexTerm = CompleteSnapshotIndexTerm;
|
|
4637
|
+
/** The expression portion of an index term, without ordering metadata. */
|
|
4128
4638
|
type SnapshotIndexTermExpression = {
|
|
4129
4639
|
readonly kind: "column";
|
|
4130
4640
|
readonly column: string;
|
|
@@ -4132,92 +4642,16 @@ type SnapshotIndexTermExpression = {
|
|
|
4132
4642
|
readonly kind: "expression";
|
|
4133
4643
|
readonly expression: SnapshotExpression;
|
|
4134
4644
|
};
|
|
4135
|
-
|
|
4136
|
-
type
|
|
4137
|
-
readonly kind: "order";
|
|
4138
|
-
readonly expression: SnapshotIndexTermExpression;
|
|
4139
|
-
readonly direction?: "ASC" | "DESC";
|
|
4140
|
-
readonly nulls?: "FIRST" | "LAST";
|
|
4141
|
-
};
|
|
4142
|
-
/** Common key metadata shared by primary and strict unique constraints. */
|
|
4143
|
-
interface SnapshotKeyConstraint {
|
|
4144
|
-
readonly id: string;
|
|
4145
|
-
readonly kind: "primary-key" | "unique";
|
|
4146
|
-
readonly physicalName: string;
|
|
4147
|
-
readonly columns: readonly string[];
|
|
4148
|
-
readonly deferrable?: boolean;
|
|
4149
|
-
readonly initially?: "immediate" | "deferred";
|
|
4150
|
-
readonly dialect?: SnapshotDialectExtension;
|
|
4151
|
-
}
|
|
4152
|
-
/** Nullable database uniqueness, intentionally not a candidate-key proof. */
|
|
4153
|
-
interface SnapshotUniqueConstraint {
|
|
4154
|
-
readonly id: string;
|
|
4645
|
+
type SnapshotKeyConstraint = CompleteSnapshotKeyConstraint;
|
|
4646
|
+
type SnapshotUniqueConstraint = CompleteSnapshotKeyConstraint & {
|
|
4155
4647
|
readonly kind: "unique-constraint";
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
/** A foreign key whose target is represented only by logical IDs. */
|
|
4164
|
-
interface SnapshotForeignKey {
|
|
4165
|
-
readonly id: string;
|
|
4166
|
-
readonly kind: "foreign-key";
|
|
4167
|
-
readonly physicalName: string;
|
|
4168
|
-
readonly columns: readonly string[];
|
|
4169
|
-
readonly target: {
|
|
4170
|
-
readonly table: string;
|
|
4171
|
-
readonly columns: readonly string[];
|
|
4172
|
-
};
|
|
4173
|
-
readonly onUpdate?: "no-action" | "restrict" | "cascade" | "set-null" | "set-default";
|
|
4174
|
-
readonly onDelete?: "no-action" | "restrict" | "cascade" | "set-null" | "set-default";
|
|
4175
|
-
readonly match?: "simple" | "full" | "partial";
|
|
4176
|
-
readonly deferrable?: boolean;
|
|
4177
|
-
readonly initially?: "immediate" | "deferred";
|
|
4178
|
-
readonly dialect?: SnapshotDialectExtension;
|
|
4179
|
-
}
|
|
4180
|
-
/** A table check constraint with a detached expression value. */
|
|
4181
|
-
interface SnapshotCheckConstraint {
|
|
4182
|
-
readonly id: string;
|
|
4183
|
-
readonly kind: "check";
|
|
4184
|
-
readonly physicalName: string;
|
|
4185
|
-
readonly expression: SnapshotExpression;
|
|
4186
|
-
readonly deferrable?: boolean;
|
|
4187
|
-
readonly initially?: "immediate" | "deferred";
|
|
4188
|
-
readonly dialect?: SnapshotDialectExtension;
|
|
4189
|
-
}
|
|
4190
|
-
/** Every constraint represented by the v1 neutral model. */
|
|
4191
|
-
type SnapshotConstraint = SnapshotKeyConstraint | SnapshotUniqueConstraint | SnapshotForeignKey | SnapshotCheckConstraint;
|
|
4192
|
-
/** A canonical index record keyed by its stable logical ID. */
|
|
4193
|
-
interface SnapshotIndex {
|
|
4194
|
-
readonly id: string;
|
|
4195
|
-
readonly kind: "index";
|
|
4196
|
-
readonly physicalName: string;
|
|
4197
|
-
readonly terms: readonly SnapshotIndexTerm[];
|
|
4198
|
-
readonly unique: boolean;
|
|
4199
|
-
readonly candidateKey: boolean;
|
|
4200
|
-
readonly predicate?: SnapshotExpression;
|
|
4201
|
-
readonly includedColumns?: readonly string[];
|
|
4202
|
-
readonly dialect?: SnapshotDialectExtension;
|
|
4203
|
-
}
|
|
4204
|
-
/** A table record keyed by its stable logical registry ID. */
|
|
4205
|
-
interface SnapshotTable {
|
|
4206
|
-
readonly id: string;
|
|
4207
|
-
readonly physicalName: string;
|
|
4208
|
-
readonly columns: readonly SnapshotColumn[];
|
|
4209
|
-
readonly constraints: readonly SnapshotConstraint[];
|
|
4210
|
-
readonly indexes: readonly SnapshotIndex[];
|
|
4211
|
-
}
|
|
4212
|
-
/** The immutable canonical schema snapshot envelope. */
|
|
4213
|
-
interface SchemaSnapshot {
|
|
4214
|
-
readonly format: typeof schemaSnapshotFormat;
|
|
4215
|
-
readonly version: typeof schemaSnapshotVersion;
|
|
4216
|
-
readonly dialect: SnapshotDialect;
|
|
4217
|
-
readonly namingPolicy: SnapshotNamingPolicy;
|
|
4218
|
-
readonly namespace?: string;
|
|
4219
|
-
readonly tables: readonly SnapshotTable[];
|
|
4220
|
-
}
|
|
4648
|
+
};
|
|
4649
|
+
type SnapshotForeignKey = CompleteSnapshotForeignKey;
|
|
4650
|
+
type SnapshotCheckConstraint = CompleteSnapshotCheckConstraint;
|
|
4651
|
+
type SnapshotConstraint = CompleteSnapshotConstraint;
|
|
4652
|
+
type SnapshotIndex = CompleteSnapshotIndex;
|
|
4653
|
+
type SnapshotTable = CompleteSnapshotTable;
|
|
4654
|
+
type SchemaSnapshot = CompleteSchemaSnapshot;
|
|
4221
4655
|
/** Schema-expression context supplied to a dialect adapter. */
|
|
4222
4656
|
interface SnapshotExpressionContext {
|
|
4223
4657
|
readonly mode: "default" | "generated" | "check" | "index";
|
|
@@ -4244,7 +4678,7 @@ interface SnapshotValidationContext {
|
|
|
4244
4678
|
* only selects that schema dialect, so PostgreSQL, SQLite, and MySQL can share the query rendering
|
|
4245
4679
|
* policy without taking ownership of canonical ordering or cross-reference validation.
|
|
4246
4680
|
*/
|
|
4247
|
-
interface SchemaSnapshotAdapter<TCapabilities extends
|
|
4681
|
+
interface SchemaSnapshotAdapter<TCapabilities extends string = DialectCapability> {
|
|
4248
4682
|
/** The query dialect plus its schema hooks and metadata. */
|
|
4249
4683
|
readonly dialect: SchemaDialect<TCapabilities>;
|
|
4250
4684
|
}
|
|
@@ -4258,24 +4692,12 @@ interface SnapshotDiagnostic {
|
|
|
4258
4692
|
readonly relatedPaths?: readonly (readonly (string | number)[])[];
|
|
4259
4693
|
}
|
|
4260
4694
|
/** Result returned by the strict snapshot decoder. */
|
|
4261
|
-
type SnapshotDecodeResult =
|
|
4262
|
-
readonly ok: true;
|
|
4263
|
-
readonly value: SchemaSnapshot;
|
|
4264
|
-
} | {
|
|
4265
|
-
readonly ok: false;
|
|
4266
|
-
readonly diagnostics: readonly SnapshotDiagnostic[];
|
|
4267
|
-
};
|
|
4695
|
+
type SnapshotDecodeResult = CompleteSnapshotDecodeResult;
|
|
4268
4696
|
/** Result returned by a non-throwing schema traversal helper. */
|
|
4269
|
-
type SnapshotCreateResult =
|
|
4270
|
-
readonly ok: true;
|
|
4271
|
-
readonly value: SchemaSnapshot;
|
|
4272
|
-
} | {
|
|
4273
|
-
readonly ok: false;
|
|
4274
|
-
readonly diagnostics: readonly SnapshotDiagnostic[];
|
|
4275
|
-
};
|
|
4697
|
+
type SnapshotCreateResult = CompleteSnapshotCreateResult;
|
|
4276
4698
|
/** A schema snapshot input accepted by the canonical encoder. */
|
|
4277
|
-
type SchemaSnapshotInput =
|
|
4699
|
+
type SchemaSnapshotInput = CompleteSchemaSnapshotInput;
|
|
4278
4700
|
/** Expose the schema generic in tooling declarations without widening APIs. */
|
|
4279
4701
|
type AnySchema = Schema<any>;
|
|
4280
4702
|
//#endregion
|
|
4281
|
-
export { PaginationKind as $, countDistinct as $a, QubuExplainableTransactionalClient as $c, IndexOptions as $i, booleanResultDecoder as $l, ScopeValidation as $n, ColumnOutput as $o, SchemaTableNames as $r, IdentityDescriptor as $s, nullsLast as $t, SqlDecimal as $u, SnapshotStorage as A, divide as Aa, ExecutionResult as Ac, SqliteConstraintExtension as Ai, expressionFragment as Al, MutationClause as An, OperandNullability as Ao, SchemaDialect as Ar, integer as As, SourceSqlTypeMap as At, QueryCardinality as Au, CastTarget as B, denseRank as Ba, HookMetadata as Bc, references as Bi, SchemaExpression as Bl, ReturningClause as Bn, ColumnDefaultOf as Bo, UnsafeSchemaSqlExpression as Br, CanonicalLiteral as Bs, TableDefinitions as Bt, SqlTypeOf as Bu, SnapshotIndexTerm as C, offset as Ca, isValidSchemaObjectName as Cc, KeyConstraintOptions as Ci, render as Cl, UpdateAssignmentValue as Cn, between as Co, FromSource as Cr, bigint as Cs, SourceColumns as Ct, NullabilityOf as Cu, SnapshotLiteral as D, ClausePlacement as Da, DriverValueEncoder as Dc, SourceConstraint as Di, QueryValidationIssue as Dl, UpdateFromScope as Dn, isNull as Do, SelectionOutput as Dr, columnResultValue as Ds, SourceKind as Dt, ProvidesOuterOf as Du, SnapshotKeyConstraint as E, AnySelectClause as Ea, AdapterExecutionResult as Ec, ReferentialAction as Ei, QueryValidationErrorCode as El, UpdateFromClause as En, isNotNull as Eo, SelectionObject as Er, column as Es, SourceIdentity as Et, OutputOf as Eu, neutralSnapshotDialect as F, jsonBoolean as Fa, ExplainReadOptions as Fc, catalogCheck as Fi, ExpressionNullability as Fl, MutationReturningClause as Fn, value as Fo, SchemaExpressionErrorCode as Fr, numeric as Fs, exposeColumns as Ft, RequiresOuterMetadataOf as Fu, DialectJson as G, concat as Ga, HookQueryOperation as Gc, AliasedSource as Gi, withDialectCapability as Gl, select as Gn, ColumnHasDefault as Go, renderSchemaSql as Gr, DefaultDescriptor as Gs, TableRow as Gt, isFragment as Gu, DialectCapability as H, rank as Ha, HookOperation as Hc, uniqueConstraint as Hi, isExpression as Hl, ReturningSqlTypes as Hn, ColumnDefinitionConfig as Ho, isUnsafeSchemaSql as Hr, ColumnBehaviorErrorCode as Hs, TableInsertInput as Ht, VisibleDependenciesOf as Hu, schemaSnapshotDialectVersion as I, jsonExists as Ia, ExplainRequest as Ic, catalogForeignKey as Ii, ExpressionOutput as Il, MutationRow as In, mapResult as Io, SchemaExpressionInput as Ir, portableStorage as Is, sourceIdentity as It, RequiresOuterOf as Iu, DialectRowLocking as J, call as Ja, HookTransactionOperation as Jc, QueryAliasIdentity as Ji, ResultDecoder as Jl, ClauseScope as Jn, ColumnInsertInput as Jo, Schema as Jr, ExternalDefaultDescriptor as Js, table as Jt, AnySqlType as Ju, DialectOptions as K, lower as Ka, HookStreamEnd as Kc, LateralIdentity as Ki, DecodableResultType as Kl, AvailableOuterScope as Kn, ColumnHasRuntimeDefault as Ko, schemaExpression as Kr, ExpressionDefaultDescriptor as Ks, TableSqlTypes as Kt, parenthesize as Ku, schemaSnapshotFormat as L, jsonNumber as La, ExplainResult as Lc, check as Li, ExpressionRequires as Ll, MutationScopeValidation as Ln, cast as Lo, SchemaExpressionMode as Lr, text as Ls, AnyTable as Lt, RequiresOuterSourceMeta as Lu, SnapshotTable as M, multiply as Ma, ExplainOptions as Mc, UniqueConstraint as Mi, AnySchemaExpression as Ml, MutationQuery as Mn, SqlCapabilityValidation as Mo, createSchemaDialect as Mr, nativeColumn as Ms, UnknownSourceSqlTypes as Mt, RenderFunction as Mu, SnapshotUniqueConstraint as N, subtract as Na, ExplainOptionsFor as Nc, UniqueConstraintOptions as Ni, Expression as Nl, MutationQueryConfig as Nn, asValue as No, RenderedSchemaExpression as Nr, nativeStorage as Ns, createSource as Nt, RequiresCapabilityMeta as Nu, SnapshotNamingPolicy as O, SelectClause as Oa, ExecutionOptions as Oc, SourceConstraintsRecord as Oi, ColumnDependency as Ol, updateFrom as On, isTrue as Oo, SelectionSqlTypes as Or, date as Os, SourceProvision as Ot, ProvidesOuterSourceMeta as Ou, SnapshotValidationContext as P, JsonPath as Pa, ExplainPlanRow as Pc, UniqueNullSemantics as Pi, ExpressionKind as Pl, MutationReturning as Pn, typedValue as Po, SchemaExpressionError as Pr, nullable as Ps, customSource as Pt, RequiresOf as Pu, NamedCastTarget as Q, count as Qa, QubuExplainableStreamingTransactionalClient as Qc, IndexDialectExtension as Qi, ResultShape as Ql, RequiredScope as Qn, ColumnOptions as Qo, SchemaTableEntry as Qr, GeneratedDescriptor as Qs, nullsFirst as Qt, SqlDate as Qu, schemaSnapshotNamingPolicyVersion as R, jsonPath as Ra, ExplainableQueryAdapter as Rc, foreignKey as Ri, ExpressionSqlType as Rl, MutationSqlTypes as Rn, typedCast as Ro, SchemaRenderContext as Rr, timestamp as Rs, Table as Rt, RequiresSourceMeta as Ru, SnapshotIndex as S, fetchNext as Sa, generatedSchemaObjectName as Sc, KeyConstraint as Si, RenderedQuery as Sl, onConflict as Sn, notLike as So, FromScope as Sr, StorageTypeOf as Ss, Source as St, MetadataOf as Su, SnapshotJsonValue as T, distinct as Ta, materializeSchemaObjectRecord as Tc, PostgresConstraintExtension as Ti, QueryValidationError as Tl, update as Tn, notIn as To, Selection as Tr, boolean as Ts, SourceConstraints as Tt, NullableSourcesOf as Tu, DialectCastTypes as U, rowNumber as Ua, HookOperationKind as Uc, validateConstraintDialect as Ui, makeExpression as Ul, returning as Un, ColumnFromOptions as Uo, normalizeSchemaSql as Ur, ColumnDefault as Us, TableMetadataCallback as Ut, WindowMeta as Uu, Dialect as V, over as Va, HookMetadataValue as Vc, unique as Vi, SchemaExpressionBrand as Vl, ReturningRow as Vn, ColumnDefinition as Vo, defineSchemaExpression as Vr, ColumnBehaviorError as Vs, TableIdentity as Vt, SubqueryMeta as Vu, DialectExplain as W, coalesce as Wa, HookOutcome as Wc, AliasIdentity as Wi, markExpressionCategory as Wl, correlate as Wn, ColumnGeneratedOf as Wo, renderSchemaExpression as Wr, ColumnDefaultInput as Ws, TableOptions as Wt, fragment as Wu, ExplainRenderOptions as X, typedCall as Xa, QubuClient as Xc, alias as Xi, ResultDecodingError as Xl, MissingScope as Xn, ColumnIsNullable as Xo, SchemaNamingPolicy as Xr, GeneratedColumnDescriptor as Xs, asc as Xt, SqlBinary as Xu, ExplainFormat as Y, schemaCall as Ya, OperationEndHook as Yc, QuerySource as Yi, ResultDecoders as Yl, GroupingValidation as Yn, ColumnIsGenerated as Yo, SchemaDiagnostic as Yr, ExternalGeneratedColumnDescriptor as Ys, OrderTerm as Yt, SqlBigInt as Yu, JsonScalarKind as Z, avg as Za, QubuExplainableClient as Zc, lateral as Zi, ResultField as Zl, RequiredOuterScope as Zn, ColumnOnUpdateOf as Zo, SchemaOptions as Zr, GeneratedColumnMode as Zs, desc as Zt, SqlBoolean as Zu, SnapshotExpressionContext as _, where as _a, SchemaObjectIdentity as _c, ForeignKeyConstraint as _i, explain as _l, ExcludedSource as _n, isNotDistinctFrom as _o, leftJoin as _r, PortableStorageType as _s, AnySource as _t, HasAggregate as _u, SnapshotBigInt as a, SqliteIndexExtension as aa, SchemaLiteralValue as ac, SqlOrderCompatible as ad, schema as ai, QubuStreamingTransactionalClient as al, InsertSource as an, TypedSqlTag as ao, cte as ar, ColumnStorageKindOf as as, SchemaLiteralRenderer as at, AnyFragment as au, SnapshotGeneratedColumn as b, rowLock as ba, dialectMismatchDiagnostic as bc, ForeignKeyTarget as bi, RenderCapabilityValidation as bl, doUpdate as bn, lte as bo, groupBy as br, StorageDialectOf as bs, ProvidedSourceIdentity as bt, InheritedMetadata as bu, SnapshotConstraint as c, validateIndexDialect as ca, externalDefault as cc, SqlText as cd, CatalogCheckExpression as ci, QueryAdapter as cl, ValuesSource as cn, exists as co, SetOperator as cr, ColumnStorageTypeOf as cs, resolveCastTarget as ct, CardinalityMeta as cu, SnapshotDefault as d, not as da, identityColumn as dc, SqlTypeSatisfies as dd, CheckConstraintOptions as di, StreamingQueryAdapter as dl, insertSelect as dn, scalar as do, intersect as dr, NativeColumnStorage as ds, QueryConfig as dt, ExpressionMeta as du, IndexTerm as ea, IdentityDialectExtension as ec, SqlEqualityComparable as ed, SchemaTableRecord as ei, QubuHooks as el, order as en, max as eo, SelectCardinality as er, ColumnSqlType as es, PaginationPart as et, dateResultDecoder as eu, SnapshotDiagnostic as f, or as fa, resolveColumnBehavior as fc, SqlUnknown as fd, ConstraintDialectExtension as fi, StreamingTransactionalQueryAdapter as fl, values as fn, ComparisonValidation as fo, union as fr, NativeStorage as fs, QueryKind as ft, Fragment as fu, SnapshotExpression as g, omit as ga, SchemaMetadataValidationError as gc, FieldLikeOptions as gi, executeRows as gl, DoUpdateAction as gn, isDistinctFrom as go, innerJoin as gr, PortableStorageDescriptor as gs, Row as gt, GroupingMeta as gu, SnapshotDialectExtension as h, SelectPart as ha, SchemaMetadataDiagnostic as hc, FieldLike as hi, execute as hl, DoNothingAction as hn, gte as ho, fullJoin as hr, PortableStorage as hs, QueryWithRow as ht, GroupingKeysOf as hu, SchemaSnapshotInput as i, SourceIndexesRecord as ia, ResolvedColumnBehavior as ic, SqlNumericLike as id, generatedTableName as ii, QubuStreamingTransaction as il, InsertSelectSource as in, SqlTag as io, WithClause as ir, ColumnStorageDialectOf as is, RowLockWaitPolicy as it, AggregateMeta as iu, SnapshotStorageContext as j, modulo as ja, ExplainMutationOptions as jc, TableLike as ji, AnyExpression as jl, MutationKind as jn, OperandSqlType as jo, SchemaDialectHooks as jr, json as js, SourceSqlTypes as jt, RenderContext as ju, SnapshotSpecialNumber as k, add as ka, ExecutionRequest as kc, SourceLike as ki, ColumnReference as kl, AllowAllClause as kn, Operand as ko, all as kr, encodeColumnParameter as ks, SourceRow as kt, ProvidesSourceMeta as ku, SnapshotCreateResult as l, DeclaredColumnNullability as la, externalGeneratedColumn as lc, SqlTextLike as ld, CatalogCheckSql as li, QueryExecutor as ll, defaultValues as ln, inQuery as lo, SetQuery as lr, ColumnUpdateInput as ls, AnyQuery as lt, CardinalityOf as lu, SnapshotDialect as m, OmittableSelectClause as ma, SchemaDialectName as mc, ConstraintTiming as mi, TransactionalQueryAdapter as ml, ConflictTarget as mn, gt as mo, crossJoin as mr, PortableColumnStorage as ms, QuerySqlTypeMap as mt, GroupingDependenciesOf as mu, SchemaSnapshot as n, PostgresIndexExtension as na, LiteralDefaultDescriptor as nc, SqlInteger as nd, SchemaValidationError as ni, QubuStreamingClient as nl, deleteFrom as nn, sum as no, CteSource as nr, ColumnStorageDeclarationOf as ns, PortableCastType as nt, timestampResultDecoder as nu, SnapshotCheckConstraint as o, TableIndex as oa, SqliteIdentityExtension as oc, SqlOrderable as od, schemaNamingPolicyVersion as oi, QubuTransaction as ol, InsertValue as on, sql as oo, recursiveCte as or, ColumnStorageOf as os, assertDialectCapability as ot, CapabilitiesOf as ou, SnapshotDiagnosticCode as p, Omit$1 as pa, SchemaDialectExtension as pc, SqlUuid as pd, ConstraintOptions as pi, TransactionOptions as pl, ConflictAction as pn, eq as po, unionAll as pr, NativeStorageDescriptor as ps, QueryRow as pt, FragmentMeta as pu, DialectPagination as q, upper as qa, HookSuccessOutcome as qc, LateralSource as qi, ResultDecodeContext as ql, AvailableScope as qn, ColumnIdentityOf as qo, unsafeSchemaSql as qr, ExpressionGeneratedColumnDescriptor as qs, TableUpdateInput as qt, sequence as qu, SchemaSnapshotAdapter as r, SourceIndex as ra, MysqlIdentityExtension as rc, SqlJson as rd, defaultSchemaNamingPolicy as ri, QubuStreamingExplainableClient as rl, DefaultValuesSource as rn, SqlFragment as ro, RecursiveCteSource as rr, ColumnStorageDescriptor as rs, RowLockMode as rt, AggregateDependenciesOf as ru, SnapshotColumn as s, index as sa, canonicalLiteral as sc, SqlSemanticType as sd, AnyKeyColumn as si, QubuTransactionalClient as sl, InsertValuesRow as sn, caseWhen as so, withCte as sr, ColumnStorageType as ss, createDialect as st, CapabilityMetadataOf as su, AnySchema as t, MysqlIndexExtension as ta, IdentityGeneration as tc, SqlEqualityCompatible as td, SchemaTableRegistry as ti, QubuOptions as tl, orderBy as tn, min as to, SelectQuery as tr, ColumnStorage as ts, PortableCastTarget as tt, jsonTextResultDecoder as tu, SnapshotDecodeResult as u, and as ua, generatedColumn as uc, SqlTimestamp as ud, CheckConstraint as ui, StreamableQuery as ul, insertInto as un, notExists as uo, except as ur, DialectNativeStorage as us, Query as ut, DependenciesOf as uu, SnapshotExtensionContext as v, RowLockClause as va, SchemaObjectNameOptions as vc, ForeignKeyMatch as vi, qubu as vl, OnConflictClause as vn, like as vo, naturalJoin as vr, StorageDeclarationOf as vs, CustomSource as vt, HasSubquery as vu, SnapshotIndexTermExpression as w, having as wa, materializeSchemaObjectIdentity as wc, MysqlConstraintExtension as wi, QueryTypeValidation as wl, UpdateAssignments as wn, inList as wo, from as wr, binary as ws, SourceConfig as wt, NullableSourceMeta as wu, SnapshotIdentity as x, fetchFirst as xa, freezeSchemaMetadata as xc, ForeignKeyTargetInput as xi, RenderOptions as xl, excluded as xn, ne as xo, FromClause as xr, StorageOf as xs, ProvidedSourceRow as xt, InheritedMetadataOf as xu, SnapshotForeignKey as y, RowLockOptions as ya, assertSchemaDialectSupport as yc, ForeignKeyOptions as yi, stream as yl, doNothing as yn, lt as yo, rightJoin as yr, StorageDescriptor as ys, CustomSourceOptions as yt, HasWindow as yu, schemaSnapshotVersion as z, jsonText as za, HookErrorOutcome as zc, primaryKey as zi, ExpressionWithOutput as zl, allowAll as zn, ColumnCodec as zo, SchemaRenderOptions as zr, uuid as zs, TableColumns as zt, ResultMeta as zu };
|
|
4703
|
+
export { CompleteSnapshotExtension as $, IndexDialectExtension as $a, GeneratedColumnDescriptor as $c, isFragment as $d, SchemaTableEntry as $i, HookTransactionOperation as $l, DefaultValuesSource as $n, avg as $o, RequiredScope as $r, ColumnOnUpdateOf as $s, assertDialectCapability as $t, ResultDecodeContext as $u, SnapshotStorage as A, SourceLike as Aa, columnSqlType as Ac, MetadataOf as Ad, all as Ai, materializeSchemaObjectRecord as Al, sourceIdentity as An, SelectClause as Ao, AllowAllClause as Ar, isTrue as As, schemaSnapshotCompleteVersion as At, QueryTypeValidation as Au, CompleteSchemaSnapshot as B, primaryKey as Ba, text as Bc, RenderFunction as Bd, SchemaRenderOptions as Bi, ExplainReadOptions as Bl, TableSqlTypes as Bn, jsonPath as Bo, allowAll as Br, typedCast as Bs, DialectPagination as Bt, ExpressionKind as Bu, SnapshotIndexTerm as C, KeyConstraint as Ca, StorageOf as Cc, GroupingKeysOf as Cd, FromScope as Ci, SchemaObjectNameOptions as Cl, SourceRow as Cn, fetchFirst as Co, onDuplicateKeyUpdate as Cr, ne as Cs, CompleteSnapshotValueFact as Ct, explain as Cu, SnapshotLiteral as D, ReferentialAction as Da, boolean as Dc, HasWindow as Dd, SelectionObject as Di, generatedSchemaObjectName as Dl, createSource as Dn, distinct as Do, UpdateFromClause as Dr, notIn as Ds, SchemaSnapshotV1Input as Dt, RenderOptions as Du, SnapshotKeyConstraint as E, PostgresConstraintExtension as Ea, binary as Ec, HasSubquery as Ed, Selection as Ei, freezeSchemaMetadata as El, UnknownSourceSqlTypes as En, having as Eo, update as Er, inList as Es, SchemaSnapshotV1DecodeResult as Et, RenderCapabilityValidation as Eu, neutralSnapshotDialect as F, UniqueNullSemantics as Fa, nativeColumn as Fc, ProvidesOuterOf as Fd, SchemaExpressionError as Fi, ExecutionResult as Fl, TableIdentity as Fn, subtract as Fo, MutationReturning as Fr, asValue as Fs, DialectCapability as Ft, ColumnReference as Fu, CompleteSnapshotColumn as G, AliasIdentity as Ga, ColumnBehaviorErrorCode as Gc, RequiresOuterSourceMeta as Gd, renderSchemaExpression as Gi, HookMetadata as Gl, desc as Gn, rowNumber as Go, correlate as Gr, ColumnFromOptions as Gs, NamedCastTarget as Gt, ExpressionWithOutput as Gu, CompleteSnapshotCapabilities as H, unique as Ha, uuid as Hc, RequiresOf as Hd, defineSchemaExpression as Hi, ExplainResult as Hl, table as Hn, denseRank as Ho, ReturningRow as Hr, ColumnDefaultOf as Hs, ExplainFormat as Ht, ExpressionOutput as Hu, schemaSnapshotDialectVersion as I, catalogCheck as Ia, nativeStorage as Ic, ProvidesOuterSourceMeta as Id, SchemaExpressionErrorCode as Ii, ExplainMutationOptions as Il, TableInsertInput as In, JsonPath as Io, MutationReturningClause as Ir, typedValue as Is, DialectCastTypes as It, expressionFragment as Iu, CompleteSnapshotCreateResult as J, LateralSource as Ja, DefaultDescriptor as Jc, SqlTypeOf as Jd, unsafeSchemaSql as Ji, HookOperationKind as Jl, order as Jn, lower as Jo, AvailableScope as Jr, ColumnHasRuntimeDefault as Js, PortableCastTarget as Jt, isExpression as Ju, CompleteSnapshotComment as K, AliasedSource as Ka, ColumnDefault as Kc, RequiresSourceMeta as Kd, renderSchemaSql as Ki, HookMetadataValue as Kl, nullsFirst as Kn, coalesce as Ko, select as Kr, ColumnGeneratedOf as Ks, PaginationKind as Kt, SchemaExpression as Ku, schemaSnapshotFormat as L, catalogForeignKey as La, nullable as Lc, ProvidesSourceMeta as Ld, SchemaExpressionInput as Li, ExplainOptions as Ll, TableMetadataCallback as Ln, jsonBoolean as Lo, MutationRow as Lr, value as Ls, DialectExplain as Lt, AnyExpression as Lu, SnapshotTable as M, TableLike as Ma, encodeColumnParameter as Mc, NullableSourceMeta as Md, SchemaDialectHooks as Mi, DriverValueEncoder as Ml, Table as Mn, divide as Mo, MutationKind as Mr, OperandNullability as Ms, schemaSnapshotVersion1 as Mt, QueryValidationErrorCode as Mu, SnapshotUniqueConstraint as N, UniqueConstraint as Na, integer as Nc, NullableSourcesOf as Nd, createSchemaDialect as Ni, ExecutionOptions as Nl, TableColumns as Nn, modulo as No, MutationQuery as Nr, OperandSqlType as Ns, CastTarget as Nt, QueryValidationIssue as Nu, SnapshotNamingPolicy as O, SourceConstraint as Oa, column as Oc, InheritedMetadata as Od, SelectionOutput as Oi, isValidSchemaObjectName as Ol, customSource as On, AnySelectClause as Oo, UpdateFromScope as Or, isNotNull as Os, completeSchemaSnapshotFormat as Ot, RenderedQuery as Ou, SnapshotValidationContext as P, UniqueConstraintOptions as Pa, json as Pc, OutputOf as Pd, RenderedSchemaExpression as Pi, ExecutionRequest as Pl, TableDefinitions as Pn, multiply as Po, MutationQueryConfig as Pr, SqlCapabilityValidation as Ps, Dialect as Pt, ColumnDependency as Pu, CompleteSnapshotEnum as Q, lateral as Qa, ExternalGeneratedColumnDescriptor as Qc, fragment as Qd, SchemaOptions as Qi, HookSuccessOutcome as Ql, deleteFrom as Qn, typedCall as Qo, RequiredOuterScope as Qr, ColumnIsNullable as Qs, SchemaLiteralRenderer as Qt, DecodableResultType as Qu, schemaSnapshotNamingPolicyVersion as R, check as Ra, numeric as Rc, QueryCardinality as Rd, SchemaExpressionMode as Ri, ExplainOptionsFor as Rl, TableOptions as Rn, jsonExists as Ro, MutationScopeValidation as Rr, mapResult as Rs, DialectJson as Rt, AnySchemaExpression as Ru, SnapshotIndex as S, ForeignKeyTargetInput as Sa, StorageDialectOf as Sc, GroupingDependenciesOf as Sd, SqlUuid as Sf, FromClause as Si, SchemaObjectIdentity as Sl, SourceProvision as Sn, rowLock as So, incoming as Sr, lte as Ss, CompleteSnapshotTrigger as St, executeRows as Su, SnapshotJsonValue as T, MysqlConstraintExtension as Ta, bigint as Tc, HasAggregate as Td, from as Ti, dialectMismatchDiagnostic as Tl, SourceSqlTypes as Tn, offset as To, UpdateAssignments as Tr, between as Ts, SchemaSnapshotV1 as Tt, stream as Tu, CompleteSnapshotCheckConstraint as U, uniqueConstraint as Ua, CanonicalLiteral as Uc, RequiresOuterMetadataOf as Ud, isUnsafeSchemaSql as Ui, ExplainableQueryAdapter as Ul, OrderTerm as Un, over as Uo, ReturningSqlTypes as Ur, ColumnDefinition as Us, ExplainRenderOptions as Ut, ExpressionRequires as Uu, CompleteSchemaSnapshotInput as V, references as Va, timestamp as Vc, RequiresCapabilityMeta as Vd, UnsafeSchemaSqlExpression as Vi, ExplainRequest as Vl, TableUpdateInput as Vn, jsonText as Vo, ReturningClause as Vr, ColumnCodec as Vs, DialectRowLocking as Vt, ExpressionNullability as Vu, CompleteSnapshotCollation as W, validateConstraintDialect as Wa, ColumnBehaviorError as Wc, RequiresOuterOf as Wd, normalizeSchemaSql as Wi, HookErrorOutcome as Wl, asc as Wn, rank as Wo, returning as Wr, ColumnDefinitionConfig as Ws, JsonScalarKind as Wt, ExpressionSqlType as Wu, CompleteSnapshotDeferredObject as X, QuerySource as Xa, ExpressionGeneratedColumnDescriptor as Xc, VisibleDependenciesOf as Xd, SchemaDiagnostic as Xi, HookQueryOperation as Xl, jsonArrayFrom as Xn, call as Xo, GroupingValidation as Xr, ColumnInsertInput as Xs, RowLockMode as Xt, markExpressionCategory as Xu, CompleteSnapshotDecodeResult as Y, QueryAliasIdentity as Ya, ExpressionDefaultDescriptor as Yc, SubqueryMeta as Yd, Schema as Yi, HookOutcome as Yl, orderBy as Yn, upper as Yo, ClauseScope as Yr, ColumnIdentityOf as Ys, PortableCastType as Yt, makeExpression as Yu, CompleteSnapshotDomain as Z, alias as Za, ExternalDefaultDescriptor as Zc, WindowMeta as Zd, SchemaNamingPolicy as Zi, HookStreamEnd as Zl, jsonObjectFrom as Zn, schemaCall as Zo, MissingScope as Zr, ColumnIsGenerated as Zs, RowLockWaitPolicy as Zt, withDialectCapability as Zu, SnapshotExpressionContext as _, FieldLikeOptions as _a, PortableStorage as _c, CardinalityOf as _d, SqlTextLike as _f, innerJoin as _i, resolveColumnBehavior as _l, SourceColumns as _n, SelectPart as _o, excluded as _r, gte as _s, CompleteSnapshotProvenance as _t, StreamingQueryAdapter as _u, SnapshotBigInt as a, generatedTableName as aa, ColumnStorageDescriptor as ac, bigintResultDecoder as ad, SqlBoolean as af, WithClause as ai, IdentityOptionValue as al, QueryConfig as an, SourceIndex as ao, defaultValues as ar, SqlFragment as as, CompleteSnapshotNamespace as at, QubuExplainableTransactionalClient as au, SnapshotGeneratedColumn as b, ForeignKeyOptions as ba, StorageDeclarationOf as bc, Fragment as bd, SqlTypeSatisfies as bf, rightJoin as bi, SchemaMetadataDiagnostic as bl, SourceIdentity as bn, RowLockClause as bo, IncomingIdentity as br, like as bs, CompleteSnapshotSequence as bt, TransactionalQueryAdapter as bu, SnapshotConstraint as c, AnyKeyColumn as ca, ColumnStorageOf as cc, jsonTextResultDecoder as cd, SqlEqualityComparable as cf, withCte as ci, MysqlIdentityExtension as cl, QuerySqlTypeMap as cn, TableIndex as co, values as cr, sql as cs, CompleteSnapshotObjectMetadata as ct, QubuStreamingClient as cu, SnapshotDefault as d, CheckConstraint as da, ColumnUpdateInput as dc, AggregateDependenciesOf as dd, SqlJson as df, except as di, SqliteIdentityExtension as dl, AnySource as dn, DeclaredColumnNullability as do, DoNothingAction as dr, inQuery as ds, CompleteSnapshotObjectReference as dt, QubuStreamingTransactionalClient as du, SchemaTableNames as ea, ColumnOptions as ec, ResultDecoder as ed, parenthesize as ef, ScopeValidation as ei, GeneratedColumnMode as el, createDialect as en, IndexOptions as eo, InsertSelectSource as er, count as es, CompleteSnapshotForeignKey as et, NestedTransactionalQueryAdapter as eu, SnapshotDiagnostic as f, CheckConstraintOptions as fa, DialectNativeStorage as fc, AggregateMeta as fd, SqlNumericLike as ff, intersect as fi, canonicalLiteral as fl, CustomSource as fn, and as fo, DoUpdateAction as fr, notExists as fs, CompleteSnapshotOpaqueObject as ft, QubuTransaction as fu, SnapshotExpression as g, FieldLike as ga, PortableColumnStorage as gc, CardinalityMeta as gd, SqlText as gf, fullJoin as gi, identityColumn as gl, Source as gn, OmittableSelectClause as go, doUpdate as gr, gt as gs, CompleteSnapshotPolicy as gt, StreamableQuery as gu, SnapshotDialectExtension as h, ConstraintTiming as ha, NativeStorageDescriptor as hc, CapabilityMetadataOf as hd, SqlSemanticType as hf, crossJoin as hi, generatedColumn as hl, ProvidedSourceRow as hn, Omit$1 as ho, doNothing as hr, eq as hs, CompleteSnapshotPhysicalReference as ht, QueryExecutor as hu, SchemaSnapshotInput as i, defaultSchemaNamingPolicy as ia, ColumnStorageDeclarationOf as ic, ResultShape as id, SqlBinary as if, RecursiveCteSource as ii, IdentityGeneration as il, Query as in, PostgresIndexExtension as io, ValuesSource as ir, sum as is, CompleteSnapshotKeyConstraint as it, QubuExplainableStreamingTransactionalClient as iu, SnapshotStorageContext as j, SqliteConstraintExtension as ja, date as jc, NullabilityOf as jd, SchemaDialect as ji, AdapterExecutionResult as jl, AnyTable as jn, add as jo, MutationClause as jr, Operand as js, schemaSnapshotV1Version as jt, QueryValidationError as ju, SnapshotSpecialNumber as k, SourceConstraintsRecord as ka, columnResultValue as kc, InheritedMetadataOf as kd, SelectionSqlTypes as ki, materializeSchemaObjectIdentity as kl, exposeColumns as kn, ClausePlacement as ko, updateFrom as kr, isNull as ks, completeSchemaSnapshotVersion as kt, render as ku, SnapshotCreateResult as l, CatalogCheckExpression as la, ColumnStorageType as lc, resultValue as ld, SqlEqualityCompatible as lf, SetOperator as li, ResolvedColumnBehavior as ll, QueryWithRow as ln, index as lo, ConflictAction as lr, caseWhen as ls, CompleteSnapshotObjectOwner as lt, QubuStreamingExplainableClient as lu, SnapshotDialect as m, ConstraintOptions as ma, NativeStorage as mc, CapabilitiesOf as md, SqlOrderable as mf, unionAll as mi, externalGeneratedColumn as ml, ProvidedSourceIdentity as mn, or as mo, OnConflictClause as mr, ComparisonValidation as ms, CompleteSnapshotPartition as mt, QueryAdapter as mu, SchemaSnapshot as n, SchemaTableRegistry as na, ColumnSqlType as nc, ResultDecodingError as nd, AnySqlType as nf, SelectQuery as ni, IdentityDescriptor as nl, resolveCastTarget as nn, IndexTermOptions as no, InsertValue as nr, max as ns, CompleteSnapshotIndex as nt, QubuClient as nu, SnapshotCheckConstraint as o, schema as oa, ColumnStorageDialectOf as oc, booleanResultDecoder as od, SqlDate as of, cte as oi, IdentityOptions as ol, QueryKind as on, SourceIndexesRecord as oo, insertInto as or, SqlTag as os, CompleteSnapshotObject as ot, QubuHooks as ou, SnapshotDiagnosticCode as p, ConstraintDialectExtension as pa, NativeColumnStorage as pc, AnyFragment as pd, SqlOrderCompatible as pf, union as pi, externalDefault as pl, CustomSourceOptions as pn, not as po, ExcludedSource as pr, scalar as ps, CompleteSnapshotOwnership as pt, QubuTransactionalClient as pu, CompleteSnapshotConstraint as q, LateralIdentity as qa, ColumnDefaultInput as qc, ResultMeta as qd, schemaExpression as qi, HookOperation as ql, nullsLast as qn, concat as qo, AvailableOuterScope as qr, ColumnHasDefault as qs, PaginationPart as qt, SchemaExpressionBrand as qu, SchemaSnapshotAdapter as r, SchemaValidationError as ra, ColumnStorage as rc, ResultField as rd, SqlBigInt as rf, CteSource as ri, IdentityDialectExtension as rl, AnyQuery as rn, MysqlIndexExtension as ro, InsertValuesRow as rr, min as rs, CompleteSnapshotIndexTerm as rt, QubuExplainableClient as ru, SnapshotColumn as s, schemaNamingPolicyVersion as sa, ColumnStorageKindOf as sc, dateResultDecoder as sd, SqlDecimal as sf, recursiveCte as si, LiteralDefaultDescriptor as sl, QueryRow as sn, SqliteIndexExtension as so, insertSelect as sr, TypedSqlTag as ss, CompleteSnapshotObjectKind as st, QubuOptions as su, AnySchema as t, SchemaTableRecord as ta, ColumnOutput as tc, ResultDecoders as td, sequence as tf, SelectCardinality as ti, GeneratedDescriptor as tl, extendDialect as tn, IndexTerm as to, InsertSource as tr, countDistinct as ts, CompleteSnapshotIdentity as tt, OperationEndHook as tu, SnapshotDecodeResult as u, CatalogCheckSql as ua, ColumnStorageTypeOf as uc, timestampResultDecoder as ud, SqlInteger as uf, SetQuery as ui, SchemaLiteralValue as ul, Row as un, validateIndexDialect as uo, ConflictTarget as ur, exists as us, CompleteSnapshotObjectOwnerKind as ut, QubuStreamingTransaction as uu, SnapshotExtensionContext as v, ForeignKeyConstraint as va, PortableStorageDescriptor as vc, DependenciesOf as vd, SqlTimestamp as vf, leftJoin as vi, SchemaDialectExtension as vl, SourceConfig as vn, omit as vo, onConflict as vr, isDistinctFrom as vs, CompleteSnapshotRoutine as vt, StreamingTransactionalQueryAdapter as vu, SnapshotIndexTermExpression as w, KeyConstraintOptions as wa, StorageTypeOf as wc, GroupingMeta as wd, FromSource as wi, assertSchemaDialectSupport as wl, SourceSqlTypeMap as wn, fetchNext as wo, UpdateAssignmentValue as wr, notLike as ws, CompleteSnapshotView as wt, qubu as wu, SnapshotIdentity as x, ForeignKeyTarget as xa, StorageDescriptor as xc, FragmentMeta as xd, SqlUnknown as xf, groupBy as xi, SchemaMetadataValidationError as xl, SourceKind as xn, RowLockOptions as xo, OnDuplicateKeyUpdateClause as xr, lt as xs, CompleteSnapshotTable as xt, execute as xu, SnapshotForeignKey as y, ForeignKeyMatch as ya, PortableStorageType as yc, ExpressionMeta as yd, SqlTypeName as yf, naturalJoin as yi, SchemaDialectName as yl, SourceConstraints as yn, where as yo, IncomingColumns as yr, isNotDistinctFrom as ys, CompleteSnapshotRoutineParameter as yt, TransactionOptions as yu, schemaSnapshotVersion as z, foreignKey as za, portableStorage as zc, RenderContext as zd, SchemaRenderContext as zi, ExplainPlanRow as zl, TableRow as zn, jsonNumber as zo, MutationSqlTypes as zr, cast as zs, DialectOptions as zt, Expression as zu };
|