qubu 0.5.1 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +112 -0
  2. package/dist/codegen.d.mts +1 -1
  3. package/dist/codegen.mjs +1 -1
  4. package/dist/column-BzN8KFJa.mjs +364 -0
  5. package/dist/column-CFvSbil0.mjs +309 -0
  6. package/dist/{complete-types-CY0KbzNw.d.mts → complete-types-CNMWBWap.d.mts} +1 -1
  7. package/dist/constraints-DM_tarXc.mjs +208 -0
  8. package/dist/core.d.mts +1 -1
  9. package/dist/core.mjs +2 -3
  10. package/dist/diagnostics-I9vVtXkc.mjs +40 -0
  11. package/dist/diff.d.mts +2 -2
  12. package/dist/expressions-BCjc08zw.mjs +129 -0
  13. package/dist/index-CGui70hi.d.mts +32 -0
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +58 -13
  16. package/dist/introspection/mysql.d.mts +26 -0
  17. package/dist/introspection/mysql.mjs +1145 -0
  18. package/dist/introspection/postgres.d.mts +40 -0
  19. package/dist/introspection/postgres.mjs +1554 -0
  20. package/dist/introspection/sqlite.d.mts +15 -0
  21. package/dist/introspection/sqlite.mjs +986 -0
  22. package/dist/introspection.d.mts +3 -78
  23. package/dist/introspection.mjs +5 -3683
  24. package/dist/mysql.d.mts +1 -1
  25. package/dist/mysql.mjs +2 -2
  26. package/dist/{on-conflict-jPsl9l0K.mjs → on-conflict-CnaY5qso.mjs} +76 -3
  27. package/dist/postgres-Dey7QXPL.mjs +69 -0
  28. package/dist/postgres.d.mts +3 -3
  29. package/dist/postgres.mjs +3 -52
  30. package/dist/registry-oWDiqD7i.mjs +127 -0
  31. package/dist/{relational-x3BDVX9e.mjs → relational-DSAJ-l58.mjs} +1 -2
  32. package/dist/schema.d.mts +1 -1
  33. package/dist/schema.mjs +7 -4
  34. package/dist/{sqlite-CsIUtZ2Q.mjs → serialize-CE-gw5_s.mjs} +4 -318
  35. package/dist/serialize-OvXCLzjm.d.mts +66 -0
  36. package/dist/snapshot/mysql.d.mts +17 -0
  37. package/dist/snapshot/mysql.mjs +356 -0
  38. package/dist/snapshot/postgres.d.mts +17 -0
  39. package/dist/snapshot/postgres.mjs +237 -0
  40. package/dist/snapshot/sqlite.d.mts +25 -0
  41. package/dist/snapshot/sqlite.mjs +321 -0
  42. package/dist/{snapshot-BSraiLtH.mjs → snapshot-DgsOhf_8.mjs} +4 -42
  43. package/dist/snapshot.d.mts +5 -4
  44. package/dist/snapshot.mjs +2 -583
  45. package/dist/{source-C4Vmu5bb.mjs → source-BDuUXmAk.mjs} +2 -1
  46. package/dist/sqlite.d.mts +1 -1
  47. package/dist/sqlite.mjs +6 -6
  48. package/dist/{table-DLQ7YWth.mjs → table-C1QGNe4P.mjs} +3 -2
  49. package/dist/{types-CTCqtFlS.d.mts → types-BEn0N_al.d.mts} +1 -1
  50. package/dist/{types-CTENnDh9.mjs → types-BLNRatG_.mjs} +2 -3
  51. package/dist/{types-C0VkiwpR.d.mts → types-DUe6eeI0.d.mts} +57 -28
  52. package/docs/guides/compose-queries.md +22 -0
  53. package/docs/guides/drizzle.md +11 -11
  54. package/docs/guides/mutations.md +89 -0
  55. package/docs/guides/valtio-sync.md +113 -0
  56. package/docs/migrations/index.md +57 -19
  57. package/docs/migrations/operations.md +20 -6
  58. package/docs/reference/mysql-snapshot.md +5 -5
  59. package/docs/reference/postgres-snapshot.md +7 -7
  60. package/docs/reference/sqlite-snapshot.md +5 -5
  61. package/docs/reference/supported-surface.md +20 -6
  62. package/docs/schema/code-generation.md +5 -4
  63. package/docs/schema/ddl-emission.md +1 -1
  64. package/docs/schema/introspection.md +3 -2
  65. package/docs/schema/snapshots.md +12 -0
  66. package/docs/sql-semantic-types.md +8 -0
  67. package/package.json +25 -1
  68. package/dist/column-DmazTL67.mjs +0 -633
  69. package/dist/index-C-480HmV.d.mts +0 -146
  70. package/dist/registry-BGqa05et.mjs +0 -461
  71. package/dist/standard-DfcZEVOj.mjs +0 -12
  72. package/dist/value-BEEj_Ayd.mjs +0 -29
@@ -0,0 +1,129 @@
1
+ import { E as markSchemaExpression, H as standardDialect, S as isSchemaExpression, r as isColumnReference, s as isValueExpression, w as makeSchemaExpression } from "./column-BzN8KFJa.mjs";
2
+ //#region src/schema/expressions.ts
3
+ /** Error raised before a schema expression can become persisted SQL. */
4
+ var SchemaExpressionError = class extends TypeError {
5
+ code;
6
+ mode;
7
+ constructor(code, message, mode) {
8
+ super(message);
9
+ this.name = "SchemaExpressionError";
10
+ this.code = code;
11
+ this.mode = mode;
12
+ }
13
+ };
14
+ /**
15
+ * Normalize only line endings. Whitespace, quoting, and every other byte of a raw schema expression
16
+ * remain under the extension author's control.
17
+ */
18
+ function normalizeSchemaSql(sql) {
19
+ return sql.replace(/\r\n?/g, "\n");
20
+ }
21
+ function schemaExpression(expression) {
22
+ return markSchemaExpression(expression);
23
+ }
24
+ /**
25
+ * Define an extension with the restricted schema context. This is the typed alternative to
26
+ * {@link unsafeSchemaSql} for deterministic custom syntax.
27
+ */
28
+ function defineSchemaExpression(kind, render) {
29
+ return makeSchemaExpression(kind, (context) => render(context));
30
+ }
31
+ function unsafeSchemaSql(dialectOrOptions, sql) {
32
+ const dialect = typeof dialectOrOptions === "string" ? dialectOrOptions : dialectOrOptions.dialect;
33
+ const source = typeof dialectOrOptions === "string" ? sql : dialectOrOptions.sql;
34
+ if (!dialect) throw new TypeError("unsafeSchemaSql() requires a dialect tag");
35
+ if (source === void 0) throw new TypeError("unsafeSchemaSql() requires SQL text");
36
+ const normalized = normalizeSchemaSql(source);
37
+ const expression = makeSchemaExpression("unsafe", (context) => context.append(normalized));
38
+ return Object.freeze({
39
+ ...expression,
40
+ schemaSqlDialect: dialect,
41
+ schemaSql: normalized
42
+ });
43
+ }
44
+ /** Identify a dialect-tagged raw schema expression. */
45
+ function isUnsafeSchemaSql(value) {
46
+ return isSchemaExpression(value) && value.expressionKind === "unsafe" && typeof value.schemaSqlDialect === "string" && typeof value.schemaSql === "string";
47
+ }
48
+ function renderSchemaExpression(expression, optionsOrMode, dialectOption) {
49
+ const options = typeof optionsOrMode === "string" ? {
50
+ mode: optionsOrMode,
51
+ dialect: dialectOption
52
+ } : optionsOrMode;
53
+ const dialect = options.dialect ?? standardDialect();
54
+ if (!isSchemaExpression(expression)) throw new SchemaExpressionError("not-deterministic", "Only branded deterministic expressions can be rendered as schema SQL", options.mode);
55
+ assertSupportedExpression(expression, options.mode);
56
+ let text = "";
57
+ const context = {
58
+ dialect,
59
+ projectionMode: "result",
60
+ schemaMode: options.mode,
61
+ append(value) {
62
+ text += value;
63
+ },
64
+ parameter() {
65
+ throw new SchemaExpressionError("parameter", "Schema expressions cannot render query parameters", options.mode);
66
+ },
67
+ literal(value) {
68
+ text += renderSchemaLiteral(dialect, value, options.mode);
69
+ },
70
+ renderColumnReference(columnName) {
71
+ if (options.mode === "default") throw new SchemaExpressionError("column-not-allowed", "Default expressions cannot reference table columns", options.mode);
72
+ text += dialect.quoteIdentifier(columnName);
73
+ },
74
+ render(part) {
75
+ renderSchemaPart(context, part, options.mode);
76
+ },
77
+ renderRelation() {
78
+ throw new SchemaExpressionError("unsupported-expression", "Schema expressions cannot contain subqueries", options.mode);
79
+ }
80
+ };
81
+ renderSchemaPart(context, expression, options.mode);
82
+ return Object.freeze({
83
+ text,
84
+ parameters: Object.freeze([])
85
+ });
86
+ }
87
+ /** Convenience form for callers that only need the SQL text. */
88
+ function renderSchemaSql(expression, options) {
89
+ return renderSchemaExpression(expression, options).text;
90
+ }
91
+ function renderSchemaPart(context, part, mode) {
92
+ if (isValueExpression(part)) {
93
+ context.literal(part.value);
94
+ return;
95
+ }
96
+ if (isColumnReference(part)) {
97
+ context.renderColumnReference(part.columnName);
98
+ return;
99
+ }
100
+ if (isUnsafeSchemaSql(part)) {
101
+ if (part.schemaSqlDialect !== context.dialect.name) throw new SchemaExpressionError("dialect-mismatch", `Schema SQL is tagged for "${part.schemaSqlDialect}" but rendered for "${context.dialect.name}"`, mode);
102
+ context.append(part.schemaSql);
103
+ return;
104
+ }
105
+ if (!isSchemaExpression(part)) throw new SchemaExpressionError("not-deterministic", "Schema expressions may only compose branded expressions, columns, and literals", mode);
106
+ assertSupportedExpression(part, mode);
107
+ part.render(context);
108
+ }
109
+ function assertSupportedExpression(expression, mode) {
110
+ if (expression.expressionKind === "subquery" || expression.expressionCategory) throw new SchemaExpressionError("unsupported-expression", "Aggregates, windows, and subqueries are not valid schema expressions", mode);
111
+ }
112
+ function renderSchemaLiteral(dialect, value, mode) {
113
+ if (dialect.renderSchemaLiteral) {
114
+ const rendered = dialect.renderSchemaLiteral(value);
115
+ if (typeof rendered !== "string" || rendered.includes("?")) throw new SchemaExpressionError("invalid-literal", "A schema literal renderer must return parameter-free SQL text", mode);
116
+ return rendered;
117
+ }
118
+ if (value === null) return "NULL";
119
+ if (typeof value === "boolean") return value ? "TRUE" : "FALSE";
120
+ if (typeof value === "string") return `'${value.replaceAll("'", "''")}'`;
121
+ if (typeof value === "bigint") return String(value);
122
+ if (typeof value === "number") {
123
+ if (!Number.isFinite(value)) throw new SchemaExpressionError("unsupported-value", "Schema literals require finite numbers", mode);
124
+ return Object.is(value, -0) ? "0" : String(value);
125
+ }
126
+ throw new SchemaExpressionError("unsupported-value", `Unsupported schema literal type: ${value === void 0 ? "undefined" : typeof value}`, mode);
127
+ }
128
+ //#endregion
129
+ export { renderSchemaExpression as a, unsafeSchemaSql as c, normalizeSchemaSql as i, defineSchemaExpression as n, renderSchemaSql as o, isUnsafeSchemaSql as r, schemaExpression as s, SchemaExpressionError as t };
@@ -0,0 +1,32 @@
1
+ import { f as SnapshotDiagnostic } from "./types-DUe6eeI0.mjs";
2
+ import { n as CompleteSchemaSnapshotInput, t as CompleteSchemaSnapshot, u as CompleteSnapshotDecodeResult } from "./complete-types-CNMWBWap.mjs";
3
+ //#region src/snapshot/complete.d.ts
4
+ /** Error raised by throwing APIs after collecting strict v2 diagnostics. */
5
+ declare class CompleteSnapshotValidationError extends TypeError {
6
+ readonly name = "CompleteSnapshotValidationError";
7
+ readonly diagnostics: readonly SnapshotDiagnostic[];
8
+ readonly issues: readonly SnapshotDiagnostic[];
9
+ constructor(diagnostics: readonly SnapshotDiagnostic[]);
10
+ }
11
+ /** Decode and strictly validate a complete Snapshot v2 JSON value. */
12
+ declare function decodeCompleteSchemaSnapshot(input: string | unknown): CompleteSnapshotDecodeResult;
13
+ /** Validate a complete snapshot and throw one structured error on failure. */
14
+ declare function assertCompleteSchemaSnapshot(input: CompleteSchemaSnapshotInput | string): CompleteSchemaSnapshot;
15
+ /** Return a fixed-order, deeply immutable complete snapshot. */
16
+ declare function canonicalizeCompleteSchemaSnapshot(input: CompleteSchemaSnapshotInput): CompleteSchemaSnapshot;
17
+ /** Encode a complete snapshot with deterministic property and array order. */
18
+ declare function encodeCompleteSchemaSnapshot(snapshot: CompleteSchemaSnapshot): string;
19
+ /** Compute the deterministic content fingerprint for a complete Snapshot v2. */
20
+ declare function completeSchemaSnapshotFingerprint(snapshot: CompleteSchemaSnapshotInput | string): string;
21
+ /** Numbered aliases for tooling that keeps v1 and v2 side by side. */
22
+ declare const decodeSchemaSnapshotV2: typeof decodeCompleteSchemaSnapshot;
23
+ declare const assertSchemaSnapshotV2: typeof assertCompleteSchemaSnapshot;
24
+ declare const encodeSchemaSnapshotV2: typeof encodeCompleteSchemaSnapshot;
25
+ declare const canonicalizeSchemaSnapshotV2: typeof canonicalizeCompleteSchemaSnapshot;
26
+ declare const schemaSnapshotV2Fingerprint: typeof completeSchemaSnapshotFingerprint;
27
+ declare const decodeCompleteSnapshot: typeof decodeCompleteSchemaSnapshot;
28
+ declare const assertCompleteSnapshot: typeof assertCompleteSchemaSnapshot;
29
+ declare const encodeCompleteSnapshot: typeof encodeCompleteSchemaSnapshot;
30
+ declare const fingerprintCompleteSchemaSnapshot: typeof completeSchemaSnapshotFingerprint;
31
+ //#endregion
32
+ export { canonicalizeCompleteSchemaSnapshot as a, decodeCompleteSchemaSnapshot as c, encodeCompleteSchemaSnapshot as d, encodeCompleteSnapshot as f, schemaSnapshotV2Fingerprint as h, assertSchemaSnapshotV2 as i, decodeCompleteSnapshot as l, fingerprintCompleteSchemaSnapshot as m, assertCompleteSchemaSnapshot as n, canonicalizeSchemaSnapshotV2 as o, encodeSchemaSnapshotV2 as p, assertCompleteSnapshot as r, completeSchemaSnapshotFingerprint as s, CompleteSnapshotValidationError as t, decodeSchemaSnapshotV2 as u };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as PaginationKind, $a as SqlTag, $c as QubuStreamingTransaction, $i as SourceIndexesRecord, $l as AggregateMeta, $n as WithClause, $o as ColumnStorageDialectOf, $s as ResolvedColumnBehavior, $t as nullsLast, $u as SqlNumericLike, Aa as jsonBoolean, Ac as ExplainReadOptions, Ai as catalogCheck, Al as ExpressionNullability, An as MutationReturningClause, Ao as value, Ar as SchemaExpressionErrorCode, As as numeric, At as SourceSqlTypeMap, Au as RequiresOuterMetadataOf, B as CastTarget, Ba as concat, Bc as HookQueryOperation, Bi as AliasedSource, Bn as select, Bo as ColumnHasDefault, Bs as DefaultDescriptor, Bt as TableDefinitions, Ca as SelectClause, Cc as ExecutionOptions, Ci as SourceConstraintsRecord, Cl as ColumnDependency, Cn as update, Co as isTrue, Cr as SelectionSqlTypes, Cs as date, Ct as SourceColumns, Cu as ProvidesOuterSourceMeta, Da as multiply, Dc as ExplainOptions, Di as UniqueConstraint, Dl as AnySchemaExpression, Dn as MutationQuery, Ds as nativeColumn, Dt as SourceKind, Du as RenderFunction, Ea as modulo, Ec as ExplainMutationOptions, Ei as TableLike, El as AnyExpression, En as MutationKind, Er as SchemaDialectHooks, Es as json, Et as SourceIdentity, Eu as RenderContext, Fa as denseRank, Fc as HookMetadata, Fi as references, Fl as SchemaExpression, Fn as ReturningClause, Fo as ColumnDefaultOf, Fr as UnsafeSchemaSqlExpression, Fs as CanonicalLiteral, Fu as SqlTypeOf, G as DialectJson, Gc as QubuClient, Gi as alias, Gl as ResultDecodingError, Gn as MissingScope, Gr as SchemaNamingPolicy, Gs as GeneratedColumnDescriptor, Gt as TableRow, Gu as SqlBinary, H as DialectCapability, Ha as upper, Hc as HookSuccessOutcome, Hi as LateralSource, Hl as ResultDecodeContext, Hn as AvailableScope, Ho as ColumnIdentityOf, Hr as unsafeSchemaSql, Hs as ExpressionGeneratedColumnDescriptor, Ht as TableInsertInput, Ia as over, Ic as HookMetadataValue, Ii as unique, Il as SchemaExpressionBrand, In as ReturningRow, Io as ColumnDefinition, Is as ColumnBehaviorError, Iu as SubqueryMeta, J as DialectRowLocking, Ja as countDistinct, Jc as QubuExplainableTransactionalClient, Ji as IndexOptions, Jl as booleanResultDecoder, Jn as ScopeValidation, Jo as ColumnOutput, Jr as SchemaTableNames, Js as IdentityDescriptor, Jt as table, Ju as SqlDecimal, K as DialectOptions, Ka as avg, Kc as QubuExplainableClient, Ki as lateral, Kl as ResultField, Kn as RequiredOuterScope, Ko as ColumnOnUpdateOf, Kr as SchemaOptions, Ks as GeneratedColumnMode, Kt as TableSqlTypes, Ku as SqlBoolean, La as rank, Lc as HookOperation, Li as uniqueConstraint, Ln as ReturningSqlTypes, Lo as ColumnDefinitionConfig, Ls as ColumnBehaviorErrorCode, Lt as AnyTable, Lu as VisibleDependenciesOf, Ma as jsonNumber, Mc as ExplainResult, Mi as check, Ml as ExpressionRequires, Mn as MutationScopeValidation, Mo as cast, Mr as SchemaExpressionMode, Ms as text, Mu as RequiresOuterSourceMeta, Na as jsonPath, Nc as ExplainableQueryAdapter, Ni as foreignKey, Nl as ExpressionSqlType, Nn as MutationSqlTypes, Nr as SchemaRenderContext, Ns as timestamp, Nu as RequiresSourceMeta, Oa as subtract, Oc as ExplainOptionsFor, Oi as UniqueConstraintOptions, Ol as Expression, On as MutationQueryConfig, Oo as asValue, Or as RenderedSchemaExpression, Os as nativeStorage, Ot as SourceProvision, Ou as RequiresCapabilityMeta, Pa as jsonText, Pc as HookErrorOutcome, Pi as primaryKey, Pl as ExpressionWithOutput, Pn as allowAll, Po as ColumnCodec, Pr as SchemaRenderOptions, Ps as uuid, Pu as ResultMeta, Q as NamedCastTarget, Qa as SqlFragment, Qc as QubuStreamingExplainableClient, Qi as SourceIndex, Ql as AggregateDependenciesOf, Qn as RecursiveCteSource, Qs as MysqlIdentityExtension, Qt as nullsFirst, Qu as SqlJson, Ra as rowNumber, Rc as HookOperationKind, Rn as returning, Rs as ColumnDefault, Rt as Table, Ru as WindowMeta, Sa as ClausePlacement, Sc as DriverValueEncoder, Si as SourceConstraint, Sl as QueryValidationIssue, Sn as UpdateAssignments, So as isNull, Sr as SelectionOutput, St as Source, Su as ProvidesOuterOf, Ta as divide, Tc as ExecutionResult, Ti as SqliteConstraintExtension, Tn as MutationClause, Tr as SchemaDialect, Ts as integer, Tt as SourceConstraints, Tu as QueryCardinality, U as DialectCastTypes, Ua as call, Uc as HookTransactionOperation, Ui as QueryAliasIdentity, Ul as ResultDecoder, Un as ClauseScope, Uo as ColumnInsertInput, Ur as Schema, Us as ExternalDefaultDescriptor, Uu as AnySqlType, V as Dialect, Va as lower, Vc as HookStreamEnd, Vi as LateralIdentity, Vl as DecodableResultType, Vn as AvailableOuterScope, Vo as ColumnHasRuntimeDefault, Vs as ExpressionDefaultDescriptor, Vt as TableIdentity, W as DialectExplain, Wa as schemaCall, Wc as OperationEndHook, Wi as QuerySource, Wl as ResultDecoders, Wn as GroupingValidation, Wo as ColumnIsGenerated, Wr as SchemaDiagnostic, Ws as ExternalGeneratedColumnDescriptor, Wu as SqlBigInt, X as ExplainRenderOptions, Xa as min, Xc as QubuOptions, Xi as MysqlIndexExtension, Xl as jsonTextResultDecoder, Xn as SelectQuery, Xo as ColumnStorage, Xr as SchemaTableRegistry, Xs as IdentityGeneration, Xt as asc, Xu as SqlEqualityCompatible, Y as ExplainFormat, Ya as max, Yc as QubuHooks, Yi as IndexTerm, Yl as dateResultDecoder, Yn as SelectCardinality, Yo as ColumnSqlType, Yr as SchemaTableRecord, Ys as IdentityDialectExtension, Yt as OrderTerm, Yu as SqlEqualityComparable, Z as JsonScalarKind, Za as sum, Zc as QubuStreamingClient, Zi as PostgresIndexExtension, Zl as timestampResultDecoder, Zn as CteSource, Zo as ColumnStorageDeclarationOf, Zs as LiteralDefaultDescriptor, Zt as desc, Zu as SqlInteger, _a as fetchNext, _i as KeyConstraint, _l as RenderedQuery, _o as notLike, _r as FromScope, _t as AnySource, _u as MetadataOf, aa as and, ac as generatedColumn, ad as SqlTimestamp, ai as CheckConstraint, al as StreamableQuery, an as InsertSource, ao as notExists, ar as except, at as SchemaLiteralRenderer, au as DependenciesOf, ba as distinct, bi as PostgresConstraintExtension, bl as QueryValidationError, bo as notIn, br as Selection, bs as boolean, bt as ProvidedSourceIdentity, bu as NullableSourcesOf, ca as Omit, cc as SchemaDialectExtension, cd as SqlUuid, ci as ConstraintOptions, cl as TransactionOptions, cn as insertInto, co as eq, cr as unionAll, cu as FragmentMeta, da as omit, di as FieldLikeOptions, dl as executeRows, do as isDistinctFrom, dr as innerJoin, dt as QueryConfig, du as GroupingMeta, ea as SqliteIndexExtension, ec as SchemaLiteralValue, ed as SqlOrderCompatible, ei as schema, el as QubuStreamingTransactionalClient, en as order, eo as TypedSqlTag, er as cte, es as ColumnStorageKindOf, et as PaginationPart, eu as AnyFragment, fa as where, fc as SchemaObjectIdentity, fi as ForeignKeyConstraint, fl as explain, fo as isNotDistinctFrom, fr as leftJoin, ft as QueryKind, fu as HasAggregate, ga as fetchFirst, gi as ForeignKeyTargetInput, gl as RenderOptions, go as ne, gr as FromClause, gt as Row, gu as InheritedMetadataOf, ha as rowLock, hi as ForeignKeyTarget, ho as lte, hr as groupBy, ht as QueryWithRow, hu as InheritedMetadata, ia as DeclaredColumnNullability, ic as externalGeneratedColumn, id as SqlTextLike, ii as CatalogCheckSql, il as QueryExecutor, in as InsertSelectSource, io as inQuery, ir as SetQuery, is as ColumnUpdateInput, it as RowLockWaitPolicy, iu as CardinalityOf, ja as jsonExists, jc as ExplainRequest, ji as catalogForeignKey, jl as ExpressionOutput, jn as MutationRow, jo as mapResult, jr as SchemaExpressionInput, js as portableStorage, ju as RequiresOuterOf, ka as JsonPath, kc as ExplainPlanRow, ki as UniqueNullSemantics, kl as ExpressionKind, kn as MutationReturning, ks as nullable, kt as SourceRow, ku as RequiresOf, la as OmittableSelectClause, lc as SchemaDialectName, li as ConstraintTiming, ll as TransactionalQueryAdapter, ln as insertSelect, lo as gt, lr as crossJoin, ls as PortableColumnStorage, lt as AnyQuery, lu as GroupingDependenciesOf, ma as RowLockOptions, mi as ForeignKeyOptions, ml as stream, mo as lt, mr as rightJoin, mt as QuerySqlTypeMap, mu as HasWindow, na as index, nd as SqlSemanticType, ni as AnyKeyColumn, nl as QubuTransactionalClient, nn as deleteFrom, no as caseWhen, nr as withCte, nt as PortableCastType, nu as CapabilityMetadataOf, oa as not, oc as identityColumn, od as SqlTypeSatisfies, oi as CheckConstraintOptions, ol as StreamingQueryAdapter, on as ValuesSource, oo as scalar, or as intersect, os as NativeColumnStorage, ou as ExpressionMeta, pa as RowLockClause, pc as SchemaObjectNameOptions, pi as ForeignKeyMatch, pl as qubu, po as like, pr as naturalJoin, pt as QueryRow, pu as HasSubquery, q as DialectPagination, qa as count, qc as QubuExplainableStreamingTransactionalClient, qi as IndexDialectExtension, ql as ResultShape, qn as RequiredScope, qo as ColumnOptions, qr as SchemaTableEntry, qs as GeneratedDescriptor, qt as TableUpdateInput, qu as SqlDate, rc as externalDefault, rd as SqlText, ri as CatalogCheckExpression, rl as QueryAdapter, rn as DefaultValuesSource, ro as exists, rr as SetOperator, rs as ColumnStorageTypeOf, rt as RowLockMode, ru as CardinalityMeta, sa as or, sd as SqlUnknown, si as ConstraintDialectExtension, sl as StreamingTransactionalQueryAdapter, sn as defaultValues, sr as union, su as Fragment, ta as TableIndex, tc as SqliteIdentityExtension, td as SqlOrderable, tl as QubuTransaction, tn as orderBy, to as sql, tr as recursiveCte, ts as ColumnStorageOf, tt as PortableCastTarget, tu as CapabilitiesOf, ua as SelectPart, uc as SchemaMetadataDiagnostic, ui as FieldLike, ul as execute, un as values, uo as gte, ur as fullJoin, ut as Query, uu as GroupingKeysOf, va as offset, vi as KeyConstraintOptions, vl as render, vo as between, vr as FromSource, vs as bigint, vu as NullabilityOf, wa as add, wc as ExecutionRequest, wi as SourceLike, wl as ColumnReference, wn as AllowAllClause, wr as all, wt as SourceConfig, wu as ProvidesSourceMeta, xa as AnySelectClause, xc as AdapterExecutionResult, xi as ReferentialAction, xl as QueryValidationErrorCode, xn as UpdateAssignmentValue, xo as isNotNull, xr as SelectionObject, xs as column, xt as ProvidedSourceRow, xu as OutputOf, ya as having, yi as MysqlConstraintExtension, yl as QueryTypeValidation, yo as inList, yr as from, ys as binary, yu as NullableSourceMeta, za as coalesce, zc as HookOutcome, zi as AliasIdentity, zn as correlate, zo as ColumnGeneratedOf, zs as ColumnDefaultInput, zt as TableColumns } from "./types-C0VkiwpR.mjs";
2
- export { type AdapterExecutionResult, type AggregateDependenciesOf, type AggregateMeta, type AliasIdentity, type AliasedSource, type AllowAllClause, type AnyExpression, type AnyFragment, type AnyKeyColumn, type AnyQuery, type AnySchemaExpression, type AnySelectClause, type AnySource, type AnySqlType, type AnyTable, type AvailableOuterScope, type AvailableScope, type CanonicalLiteral, type CapabilitiesOf, type CapabilityMetadataOf, type CardinalityMeta, type CardinalityOf, type CastTarget, type CatalogCheckExpression, type CatalogCheckSql, type CheckConstraint, type CheckConstraintOptions, type ClausePlacement, type ClauseScope, type ColumnBehaviorError, type ColumnBehaviorErrorCode, type ColumnCodec, type ColumnDefault, type ColumnDefaultInput, type ColumnDefaultOf, type ColumnDefinition, type ColumnDefinitionConfig, type ColumnDependency, type ColumnGeneratedOf, type ColumnHasDefault, type ColumnHasRuntimeDefault, type ColumnIdentityOf, type ColumnInsertInput, type ColumnIsGenerated, type ColumnOnUpdateOf, type ColumnOptions, type ColumnOutput, type ColumnReference, type ColumnSqlType, type ColumnStorage, type ColumnStorageDeclarationOf, type ColumnStorageDialectOf, type ColumnStorageKindOf, type ColumnStorageOf, type ColumnStorageTypeOf, type ColumnUpdateInput, type ConstraintDialectExtension, type ConstraintOptions, type ConstraintTiming, type CteSource, type DeclaredColumnNullability, type DecodableResultType, type DefaultDescriptor, type DefaultValuesSource, type DependenciesOf, type Dialect, type DialectCapability, type DialectCastTypes, type DialectExplain, type DialectJson, type DialectOptions, type DialectPagination, type DialectRowLocking, type DriverValueEncoder, type ExecutionOptions, type ExecutionRequest, type ExecutionResult, type ExplainFormat, type ExplainMutationOptions, type ExplainOptions, type ExplainOptionsFor, type ExplainPlanRow, type ExplainReadOptions, type ExplainRenderOptions, type ExplainRequest, type ExplainResult, type ExplainableQueryAdapter, type Expression, type ExpressionDefaultDescriptor, type ExpressionGeneratedColumnDescriptor, type ExpressionKind, type ExpressionMeta, type ExpressionNullability, type ExpressionOutput, type ExpressionRequires, type ExpressionSqlType, type ExpressionWithOutput, type ExternalDefaultDescriptor, type ExternalGeneratedColumnDescriptor, type FieldLike, type FieldLikeOptions, type ForeignKeyConstraint, type ForeignKeyMatch, type ForeignKeyOptions, type ForeignKeyTarget, type ForeignKeyTargetInput, type Fragment, type FragmentMeta, type FromClause, type FromScope, type FromSource, type GeneratedColumnDescriptor, type GeneratedColumnMode, type GeneratedDescriptor, type GroupingDependenciesOf, type GroupingKeysOf, type GroupingMeta, type GroupingValidation, type HasAggregate, type HasSubquery, type HasWindow, type HookErrorOutcome, type HookMetadata, type HookMetadataValue, type HookOperation, type HookOperationKind, type HookOutcome, type HookQueryOperation, type HookStreamEnd, type HookSuccessOutcome, type HookTransactionOperation, type IdentityDescriptor, type IdentityDialectExtension, type IdentityGeneration, type IndexDialectExtension, type IndexOptions, type IndexTerm, type InheritedMetadata, type InheritedMetadataOf, type InsertSelectSource, type InsertSource, type JsonPath, type JsonScalarKind, type KeyConstraint, type KeyConstraintOptions, type LateralIdentity, type LateralSource, type LiteralDefaultDescriptor, type MetadataOf, type MissingScope, type MutationClause, type MutationKind, type MutationQuery, type MutationQueryConfig, type MutationReturning, type MutationReturningClause, type MutationRow, type MutationScopeValidation, type MutationSqlTypes, type MysqlConstraintExtension, type MysqlIdentityExtension, type MysqlIndexExtension, type NamedCastTarget, type NativeColumnStorage, type NullabilityOf, type NullableSourceMeta, type NullableSourcesOf, type Omit, type OmittableSelectClause, type OperationEndHook, type OrderTerm, type OutputOf, type PaginationKind, type PaginationPart, type PortableCastTarget, type PortableCastType, type PortableColumnStorage, type PostgresConstraintExtension, type PostgresIndexExtension, type ProvidedSourceIdentity, type ProvidedSourceRow, type ProvidesOuterOf, type ProvidesOuterSourceMeta, type ProvidesSourceMeta, type QubuClient, type QubuExplainableClient, type QubuExplainableStreamingTransactionalClient, type QubuExplainableTransactionalClient, type QubuHooks, type QubuOptions, type QubuStreamingClient, type QubuStreamingExplainableClient, type QubuStreamingTransaction, type QubuStreamingTransactionalClient, type QubuTransaction, type QubuTransactionalClient, type Query, type QueryAdapter, type QueryAliasIdentity, type QueryCardinality, type QueryConfig, type QueryExecutor, type QueryKind, type QueryRow, type QuerySource, type QuerySqlTypeMap, type QueryTypeValidation, QueryValidationError, type QueryValidationErrorCode, type QueryValidationIssue, type QueryWithRow, type RecursiveCteSource, type ReferentialAction, type RenderContext, type RenderFunction, type RenderOptions, type RenderedQuery, type RenderedSchemaExpression, type RequiredOuterScope, type RequiredScope, type RequiresCapabilityMeta, type RequiresOf, type RequiresOuterMetadataOf, type RequiresOuterOf, type RequiresOuterSourceMeta, type RequiresSourceMeta, type ResolvedColumnBehavior, type ResultDecodeContext, type ResultDecoder, type ResultDecoders, ResultDecodingError, type ResultField, type ResultMeta, type ResultShape, type ReturningClause, type ReturningRow, type ReturningSqlTypes, type Row, type RowLockClause, type RowLockMode, type RowLockOptions, type RowLockWaitPolicy, type Schema, type SchemaDiagnostic, type SchemaDialect, type SchemaDialectExtension, type SchemaDialectHooks, type SchemaDialectName, type SchemaExpression, type SchemaExpressionBrand, type SchemaExpressionErrorCode, type SchemaExpressionInput, type SchemaExpressionMode, type SchemaLiteralRenderer, type SchemaLiteralValue, type SchemaMetadataDiagnostic, type SchemaNamingPolicy, type SchemaObjectIdentity, type SchemaObjectNameOptions, type SchemaOptions, type SchemaRenderContext, type SchemaRenderOptions, type SchemaTableEntry, type SchemaTableNames, type SchemaTableRecord, type SchemaTableRegistry, type ScopeValidation, type SelectCardinality, type SelectClause, type SelectPart, type SelectQuery, type Selection, type SelectionObject, type SelectionOutput, type SelectionSqlTypes, type SetOperator, type SetQuery, type Source, type SourceColumns, type SourceConfig, type SourceConstraint, type SourceConstraints, type SourceConstraintsRecord, type SourceIdentity, type SourceIndex, type SourceIndexesRecord, type SourceKind, type SourceLike, type SourceProvision, type SourceRow, type SourceSqlTypeMap, type SqlBigInt, type SqlBinary, type SqlBoolean, type SqlDate, type SqlDecimal, type SqlEqualityComparable, type SqlEqualityCompatible, type SqlFragment, type SqlInteger, type SqlJson, type SqlNumericLike, type SqlOrderCompatible, type SqlOrderable, type SqlSemanticType, type SqlTag, type SqlText, type SqlTextLike, type SqlTimestamp, type SqlTypeOf, type SqlTypeSatisfies, type SqlUnknown, type SqlUuid, type SqliteConstraintExtension, type SqliteIdentityExtension, type SqliteIndexExtension, type StreamableQuery, type StreamingQueryAdapter, type StreamingTransactionalQueryAdapter, type SubqueryMeta, type Table, type TableColumns, type TableDefinitions, type TableIdentity, type TableIndex, type TableInsertInput, type TableLike, type TableRow, type TableSqlTypes, type TableUpdateInput, type TransactionOptions, type TransactionalQueryAdapter, type TypedSqlTag, type UniqueConstraint, type UniqueConstraintOptions, type UniqueNullSemantics, type UnsafeSchemaSqlExpression, type UpdateAssignmentValue, type UpdateAssignments, type ValuesSource, type VisibleDependenciesOf, type WindowMeta, type WithClause, add, alias, all, allowAll, and, asValue, asc, avg, between, bigint, binary, boolean, booleanResultDecoder, call, caseWhen, cast, catalogCheck, catalogForeignKey, check, coalesce, column, concat, correlate, count, countDistinct, crossJoin, cte, date, dateResultDecoder, defaultValues, deleteFrom, denseRank, desc, distinct, divide, eq, except, execute, executeRows, exists, explain, externalDefault, externalGeneratedColumn, fetchFirst, fetchNext, foreignKey, from, fullJoin, generatedColumn, groupBy, gt, gte, having, identityColumn, inList, inQuery, index, innerJoin, insertInto, insertSelect, integer, intersect, isDistinctFrom, isNotDistinctFrom, isNotNull, isNull, isTrue, json, jsonBoolean, jsonExists, jsonNumber, jsonPath, jsonText, jsonTextResultDecoder, lateral, leftJoin, like, lower, lt, lte, mapResult, max, min, modulo, multiply, nativeColumn, nativeStorage, naturalJoin, ne, not, notExists, notIn, notLike, nullable, nullsFirst, nullsLast, numeric, offset, omit, or, order, orderBy, over, portableStorage, primaryKey, qubu, rank, recursiveCte, references, render, returning, rightJoin, rowLock, rowNumber, scalar, schema, schemaCall, select, sql, stream, subtract, sum, table, text, timestamp, timestampResultDecoder, union, unionAll, unique, uniqueConstraint, unsafeSchemaSql, update, upper, uuid, value, values, where, withCte };
1
+ import { $ as PaginationKind, $a as countDistinct, $c as QubuExplainableTransactionalClient, $i as IndexOptions, $l as booleanResultDecoder, $n as ScopeValidation, $o as ColumnOutput, $r as SchemaTableNames, $s as IdentityDescriptor, $t as nullsLast, $u as SqlDecimal, Aa as divide, Ac as ExecutionResult, Ai as SqliteConstraintExtension, An as MutationClause, Ar as SchemaDialect, As as integer, At as SourceSqlTypeMap, Au as QueryCardinality, B as CastTarget, Ba as denseRank, Bc as HookMetadata, Bi as references, Bl as SchemaExpression, Bn as ReturningClause, Bo as ColumnDefaultOf, Br as UnsafeSchemaSqlExpression, Bs as CanonicalLiteral, Bt as TableDefinitions, Bu as SqlTypeOf, Ca as offset, Ci as KeyConstraintOptions, Cl as render, Cn as UpdateAssignmentValue, Co as between, Cr as FromSource, Cs as bigint, Ct as SourceColumns, Cu as NullabilityOf, Da as ClausePlacement, Dc as DriverValueEncoder, Di as SourceConstraint, Dl as QueryValidationIssue, Do as isNull, Dr as SelectionOutput, Dt as SourceKind, Du as ProvidesOuterOf, Ea as AnySelectClause, Ec as AdapterExecutionResult, Ei as ReferentialAction, El as QueryValidationErrorCode, Eo as isNotNull, Er as SelectionObject, Es as column, Et as SourceIdentity, Eu as OutputOf, Fa as jsonBoolean, Fc as ExplainReadOptions, Fi as catalogCheck, Fl as ExpressionNullability, Fn as MutationReturningClause, Fo as value, Fr as SchemaExpressionErrorCode, Fs as numeric, Fu as RequiresOuterMetadataOf, G as DialectJson, Ga as concat, Gc as HookQueryOperation, Gi as AliasedSource, Gn as select, Go as ColumnHasDefault, Gs as DefaultDescriptor, Gt as TableRow, H as DialectCapability, Ha as rank, Hc as HookOperation, Hi as uniqueConstraint, Hn as ReturningSqlTypes, Ho as ColumnDefinitionConfig, Hs as ColumnBehaviorErrorCode, Ht as TableInsertInput, Hu as VisibleDependenciesOf, Ia as jsonExists, Ic as ExplainRequest, Ii as catalogForeignKey, Il as ExpressionOutput, In as MutationRow, Io as mapResult, Ir as SchemaExpressionInput, Is as portableStorage, Iu as RequiresOuterOf, J as DialectRowLocking, Ja as call, Jc as HookTransactionOperation, Ji as QueryAliasIdentity, Jl as ResultDecoder, Jn as ClauseScope, Jo as ColumnInsertInput, Jr as Schema, Js as ExternalDefaultDescriptor, Jt as table, Ju as AnySqlType, K as DialectOptions, Ka as lower, Kc as HookStreamEnd, Ki as LateralIdentity, Kl as DecodableResultType, Kn as AvailableOuterScope, Ko as ColumnHasRuntimeDefault, Ks as ExpressionDefaultDescriptor, Kt as TableSqlTypes, La as jsonNumber, Lc as ExplainResult, Li as check, Ll as ExpressionRequires, Ln as MutationScopeValidation, Lo as cast, Lr as SchemaExpressionMode, Ls as text, Lt as AnyTable, Lu as RequiresOuterSourceMeta, Ma as multiply, Mc as ExplainOptions, Mi as UniqueConstraint, Ml as AnySchemaExpression, Mn as MutationQuery, Ms as nativeColumn, Mu as RenderFunction, Na as subtract, Nc as ExplainOptionsFor, Ni as UniqueConstraintOptions, Nl as Expression, Nn as MutationQueryConfig, No as asValue, Nr as RenderedSchemaExpression, Ns as nativeStorage, Nu as RequiresCapabilityMeta, Oa as SelectClause, Oc as ExecutionOptions, Oi as SourceConstraintsRecord, Ol as ColumnDependency, Oo as isTrue, Or as SelectionSqlTypes, Os as date, Ot as SourceProvision, Ou as ProvidesOuterSourceMeta, Pa as JsonPath, Pc as ExplainPlanRow, Pi as UniqueNullSemantics, Pl as ExpressionKind, Pn as MutationReturning, Ps as nullable, Pu as RequiresOf, Q as NamedCastTarget, Qa as count, Qc as QubuExplainableStreamingTransactionalClient, Qi as IndexDialectExtension, Ql as ResultShape, Qn as RequiredScope, Qo as ColumnOptions, Qr as SchemaTableEntry, Qs as GeneratedDescriptor, Qt as nullsFirst, Qu as SqlDate, Ra as jsonPath, Rc as ExplainableQueryAdapter, Ri as foreignKey, Rl as ExpressionSqlType, Rn as MutationSqlTypes, Rr as SchemaRenderContext, Rs as timestamp, Rt as Table, Ru as RequiresSourceMeta, Sa as fetchNext, Si as KeyConstraint, Sl as RenderedQuery, So as notLike, Sr as FromScope, St as Source, Su as MetadataOf, Ta as distinct, Ti as PostgresConstraintExtension, Tl as QueryValidationError, Tn as update, To as notIn, Tr as Selection, Ts as boolean, Tt as SourceConstraints, Tu as NullableSourcesOf, U as DialectCastTypes, Ua as rowNumber, Uc as HookOperationKind, Un as returning, Us as ColumnDefault, Uu as WindowMeta, V as Dialect, Va as over, Vc as HookMetadataValue, Vi as unique, Vl as SchemaExpressionBrand, Vn as ReturningRow, Vo as ColumnDefinition, Vs as ColumnBehaviorError, Vt as TableIdentity, Vu as SubqueryMeta, W as DialectExplain, Wa as coalesce, Wc as HookOutcome, Wi as AliasIdentity, Wn as correlate, Wo as ColumnGeneratedOf, Ws as ColumnDefaultInput, X as ExplainRenderOptions, Xc as QubuClient, Xi as alias, Xl as ResultDecodingError, Xn as MissingScope, Xr as SchemaNamingPolicy, Xs as GeneratedColumnDescriptor, Xt as asc, Xu as SqlBinary, Y as ExplainFormat, Ya as schemaCall, Yc as OperationEndHook, Yi as QuerySource, Yl as ResultDecoders, Yn as GroupingValidation, Yo as ColumnIsGenerated, Yr as SchemaDiagnostic, Ys as ExternalGeneratedColumnDescriptor, Yt as OrderTerm, Yu as SqlBigInt, Z as JsonScalarKind, Za as avg, Zc as QubuExplainableClient, Zi as lateral, Zl as ResultField, Zn as RequiredOuterScope, Zo as ColumnOnUpdateOf, Zr as SchemaOptions, Zs as GeneratedColumnMode, Zt as desc, Zu as SqlBoolean, _a as where, _c as SchemaObjectIdentity, _i as ForeignKeyConstraint, _l as explain, _o as isNotDistinctFrom, _r as leftJoin, _t as AnySource, _u as HasAggregate, aa as SqliteIndexExtension, ac as SchemaLiteralValue, ad as SqlOrderCompatible, ai as schema, al as QubuStreamingTransactionalClient, an as InsertSource, ao as TypedSqlTag, ar as cte, as as ColumnStorageKindOf, at as SchemaLiteralRenderer, au as AnyFragment, ba as rowLock, bi as ForeignKeyTarget, bo as lte, br as groupBy, bt as ProvidedSourceIdentity, bu as InheritedMetadata, cc as externalDefault, cd as SqlText, ci as CatalogCheckExpression, cl as QueryAdapter, cn as ValuesSource, co as exists, cr as SetOperator, cs as ColumnStorageTypeOf, cu as CardinalityMeta, da as not, dc as identityColumn, dd as SqlTypeSatisfies, di as CheckConstraintOptions, dl as StreamingQueryAdapter, dn as insertSelect, do as scalar, dr as intersect, ds as NativeColumnStorage, dt as QueryConfig, du as ExpressionMeta, ea as IndexTerm, ec as IdentityDialectExtension, ed as SqlEqualityComparable, ei as SchemaTableRecord, el as QubuHooks, en as order, eo as max, er as SelectCardinality, es as ColumnSqlType, et as PaginationPart, eu as dateResultDecoder, fa as or, fd as SqlUnknown, fi as ConstraintDialectExtension, fl as StreamingTransactionalQueryAdapter, fn as values, fr as union, ft as QueryKind, fu as Fragment, ga as omit, gi as FieldLikeOptions, gl as executeRows, go as isDistinctFrom, gr as innerJoin, gt as Row, gu as GroupingMeta, ha as SelectPart, hc as SchemaMetadataDiagnostic, hi as FieldLike, hl as execute, ho as gte, hr as fullJoin, ht as QueryWithRow, hu as GroupingKeysOf, ia as SourceIndexesRecord, ic as ResolvedColumnBehavior, id as SqlNumericLike, il as QubuStreamingTransaction, in as InsertSelectSource, io as SqlTag, ir as WithClause, is as ColumnStorageDialectOf, it as RowLockWaitPolicy, iu as AggregateMeta, ja as modulo, jc as ExplainMutationOptions, ji as TableLike, jl as AnyExpression, jn as MutationKind, jr as SchemaDialectHooks, js as json, ju as RenderContext, ka as add, kc as ExecutionRequest, ki as SourceLike, kl as ColumnReference, kn as AllowAllClause, kr as all, kt as SourceRow, ku as ProvidesSourceMeta, la as DeclaredColumnNullability, lc as externalGeneratedColumn, ld as SqlTextLike, li as CatalogCheckSql, ll as QueryExecutor, ln as defaultValues, lo as inQuery, lr as SetQuery, ls as ColumnUpdateInput, lt as AnyQuery, lu as CardinalityOf, ma as OmittableSelectClause, mc as SchemaDialectName, mi as ConstraintTiming, ml as TransactionalQueryAdapter, mo as gt, mr as crossJoin, ms as PortableColumnStorage, mt as QuerySqlTypeMap, mu as GroupingDependenciesOf, na as PostgresIndexExtension, nc as LiteralDefaultDescriptor, nd as SqlInteger, nl as QubuStreamingClient, nn as deleteFrom, no as sum, nr as CteSource, ns as ColumnStorageDeclarationOf, nt as PortableCastType, nu as timestampResultDecoder, oa as TableIndex, oc as SqliteIdentityExtension, od as SqlOrderable, ol as QubuTransaction, on as InsertValue, oo as sql, or as recursiveCte, os as ColumnStorageOf, ou as CapabilitiesOf, pa as Omit, pc as SchemaDialectExtension, pd as SqlUuid, pi as ConstraintOptions, pl as TransactionOptions, po as eq, pr as unionAll, pt as QueryRow, pu as FragmentMeta, q as DialectPagination, qa as upper, qc as HookSuccessOutcome, qi as LateralSource, ql as ResultDecodeContext, qn as AvailableScope, qo as ColumnIdentityOf, qr as unsafeSchemaSql, qs as ExpressionGeneratedColumnDescriptor, qt as TableUpdateInput, ra as SourceIndex, rc as MysqlIdentityExtension, rd as SqlJson, rl as QubuStreamingExplainableClient, rn as DefaultValuesSource, ro as SqlFragment, rr as RecursiveCteSource, rt as RowLockMode, ru as AggregateDependenciesOf, sa as index, sd as SqlSemanticType, si as AnyKeyColumn, sl as QubuTransactionalClient, sn as InsertValuesRow, so as caseWhen, sr as withCte, su as CapabilityMetadataOf, ta as MysqlIndexExtension, tc as IdentityGeneration, td as SqlEqualityCompatible, ti as SchemaTableRegistry, tl as QubuOptions, tn as orderBy, to as min, tr as SelectQuery, ts as ColumnStorage, tt as PortableCastTarget, tu as jsonTextResultDecoder, ua as and, uc as generatedColumn, ud as SqlTimestamp, ui as CheckConstraint, ul as StreamableQuery, un as insertInto, uo as notExists, ur as except, ut as Query, uu as DependenciesOf, va as RowLockClause, vc as SchemaObjectNameOptions, vi as ForeignKeyMatch, vl as qubu, vo as like, vr as naturalJoin, vu as HasSubquery, wa as having, wi as MysqlConstraintExtension, wl as QueryTypeValidation, wn as UpdateAssignments, wo as inList, wr as from, ws as binary, wt as SourceConfig, wu as NullableSourceMeta, xa as fetchFirst, xi as ForeignKeyTargetInput, xl as RenderOptions, xo as ne, xr as FromClause, xt as ProvidedSourceRow, xu as InheritedMetadataOf, ya as RowLockOptions, yi as ForeignKeyOptions, yl as stream, yo as lt, yr as rightJoin, yu as HasWindow, za as jsonText, zc as HookErrorOutcome, zi as primaryKey, zl as ExpressionWithOutput, zn as allowAll, zo as ColumnCodec, zr as SchemaRenderOptions, zs as uuid, zt as TableColumns, zu as ResultMeta } from "./types-DUe6eeI0.mjs";
2
+ export { type AdapterExecutionResult, type AggregateDependenciesOf, type AggregateMeta, type AliasIdentity, type AliasedSource, type AllowAllClause, type AnyExpression, type AnyFragment, type AnyKeyColumn, type AnyQuery, type AnySchemaExpression, type AnySelectClause, type AnySource, type AnySqlType, type AnyTable, type AvailableOuterScope, type AvailableScope, type CanonicalLiteral, type CapabilitiesOf, type CapabilityMetadataOf, type CardinalityMeta, type CardinalityOf, type CastTarget, type CatalogCheckExpression, type CatalogCheckSql, type CheckConstraint, type CheckConstraintOptions, type ClausePlacement, type ClauseScope, type ColumnBehaviorError, type ColumnBehaviorErrorCode, type ColumnCodec, type ColumnDefault, type ColumnDefaultInput, type ColumnDefaultOf, type ColumnDefinition, type ColumnDefinitionConfig, type ColumnDependency, type ColumnGeneratedOf, type ColumnHasDefault, type ColumnHasRuntimeDefault, type ColumnIdentityOf, type ColumnInsertInput, type ColumnIsGenerated, type ColumnOnUpdateOf, type ColumnOptions, type ColumnOutput, type ColumnReference, type ColumnSqlType, type ColumnStorage, type ColumnStorageDeclarationOf, type ColumnStorageDialectOf, type ColumnStorageKindOf, type ColumnStorageOf, type ColumnStorageTypeOf, type ColumnUpdateInput, type ConstraintDialectExtension, type ConstraintOptions, type ConstraintTiming, type CteSource, type DeclaredColumnNullability, type DecodableResultType, type DefaultDescriptor, type DefaultValuesSource, type DependenciesOf, type Dialect, type DialectCapability, type DialectCastTypes, type DialectExplain, type DialectJson, type DialectOptions, type DialectPagination, type DialectRowLocking, type DriverValueEncoder, type ExecutionOptions, type ExecutionRequest, type ExecutionResult, type ExplainFormat, type ExplainMutationOptions, type ExplainOptions, type ExplainOptionsFor, type ExplainPlanRow, type ExplainReadOptions, type ExplainRenderOptions, type ExplainRequest, type ExplainResult, type ExplainableQueryAdapter, type Expression, type ExpressionDefaultDescriptor, type ExpressionGeneratedColumnDescriptor, type ExpressionKind, type ExpressionMeta, type ExpressionNullability, type ExpressionOutput, type ExpressionRequires, type ExpressionSqlType, type ExpressionWithOutput, type ExternalDefaultDescriptor, type ExternalGeneratedColumnDescriptor, type FieldLike, type FieldLikeOptions, type ForeignKeyConstraint, type ForeignKeyMatch, type ForeignKeyOptions, type ForeignKeyTarget, type ForeignKeyTargetInput, type Fragment, type FragmentMeta, type FromClause, type FromScope, type FromSource, type GeneratedColumnDescriptor, type GeneratedColumnMode, type GeneratedDescriptor, type GroupingDependenciesOf, type GroupingKeysOf, type GroupingMeta, type GroupingValidation, type HasAggregate, type HasSubquery, type HasWindow, type HookErrorOutcome, type HookMetadata, type HookMetadataValue, type HookOperation, type HookOperationKind, type HookOutcome, type HookQueryOperation, type HookStreamEnd, type HookSuccessOutcome, type HookTransactionOperation, type IdentityDescriptor, type IdentityDialectExtension, type IdentityGeneration, type IndexDialectExtension, type IndexOptions, type IndexTerm, type InheritedMetadata, type InheritedMetadataOf, type InsertSelectSource, type InsertSource, type InsertValue, type InsertValuesRow, type JsonPath, type JsonScalarKind, type KeyConstraint, type KeyConstraintOptions, type LateralIdentity, type LateralSource, type LiteralDefaultDescriptor, type MetadataOf, type MissingScope, type MutationClause, type MutationKind, type MutationQuery, type MutationQueryConfig, type MutationReturning, type MutationReturningClause, type MutationRow, type MutationScopeValidation, type MutationSqlTypes, type MysqlConstraintExtension, type MysqlIdentityExtension, type MysqlIndexExtension, type NamedCastTarget, type NativeColumnStorage, type NullabilityOf, type NullableSourceMeta, type NullableSourcesOf, type Omit, type OmittableSelectClause, type OperationEndHook, type OrderTerm, type OutputOf, type PaginationKind, type PaginationPart, type PortableCastTarget, type PortableCastType, type PortableColumnStorage, type PostgresConstraintExtension, type PostgresIndexExtension, type ProvidedSourceIdentity, type ProvidedSourceRow, type ProvidesOuterOf, type ProvidesOuterSourceMeta, type ProvidesSourceMeta, type QubuClient, type QubuExplainableClient, type QubuExplainableStreamingTransactionalClient, type QubuExplainableTransactionalClient, type QubuHooks, type QubuOptions, type QubuStreamingClient, type QubuStreamingExplainableClient, type QubuStreamingTransaction, type QubuStreamingTransactionalClient, type QubuTransaction, type QubuTransactionalClient, type Query, type QueryAdapter, type QueryAliasIdentity, type QueryCardinality, type QueryConfig, type QueryExecutor, type QueryKind, type QueryRow, type QuerySource, type QuerySqlTypeMap, type QueryTypeValidation, QueryValidationError, type QueryValidationErrorCode, type QueryValidationIssue, type QueryWithRow, type RecursiveCteSource, type ReferentialAction, type RenderContext, type RenderFunction, type RenderOptions, type RenderedQuery, type RenderedSchemaExpression, type RequiredOuterScope, type RequiredScope, type RequiresCapabilityMeta, type RequiresOf, type RequiresOuterMetadataOf, type RequiresOuterOf, type RequiresOuterSourceMeta, type RequiresSourceMeta, type ResolvedColumnBehavior, type ResultDecodeContext, type ResultDecoder, type ResultDecoders, ResultDecodingError, type ResultField, type ResultMeta, type ResultShape, type ReturningClause, type ReturningRow, type ReturningSqlTypes, type Row, type RowLockClause, type RowLockMode, type RowLockOptions, type RowLockWaitPolicy, type Schema, type SchemaDiagnostic, type SchemaDialect, type SchemaDialectExtension, type SchemaDialectHooks, type SchemaDialectName, type SchemaExpression, type SchemaExpressionBrand, type SchemaExpressionErrorCode, type SchemaExpressionInput, type SchemaExpressionMode, type SchemaLiteralRenderer, type SchemaLiteralValue, type SchemaMetadataDiagnostic, type SchemaNamingPolicy, type SchemaObjectIdentity, type SchemaObjectNameOptions, type SchemaOptions, type SchemaRenderContext, type SchemaRenderOptions, type SchemaTableEntry, type SchemaTableNames, type SchemaTableRecord, type SchemaTableRegistry, type ScopeValidation, type SelectCardinality, type SelectClause, type SelectPart, type SelectQuery, type Selection, type SelectionObject, type SelectionOutput, type SelectionSqlTypes, type SetOperator, type SetQuery, type Source, type SourceColumns, type SourceConfig, type SourceConstraint, type SourceConstraints, type SourceConstraintsRecord, type SourceIdentity, type SourceIndex, type SourceIndexesRecord, type SourceKind, type SourceLike, type SourceProvision, type SourceRow, type SourceSqlTypeMap, type SqlBigInt, type SqlBinary, type SqlBoolean, type SqlDate, type SqlDecimal, type SqlEqualityComparable, type SqlEqualityCompatible, type SqlFragment, type SqlInteger, type SqlJson, type SqlNumericLike, type SqlOrderCompatible, type SqlOrderable, type SqlSemanticType, type SqlTag, type SqlText, type SqlTextLike, type SqlTimestamp, type SqlTypeOf, type SqlTypeSatisfies, type SqlUnknown, type SqlUuid, type SqliteConstraintExtension, type SqliteIdentityExtension, type SqliteIndexExtension, type StreamableQuery, type StreamingQueryAdapter, type StreamingTransactionalQueryAdapter, type SubqueryMeta, type Table, type TableColumns, type TableDefinitions, type TableIdentity, type TableIndex, type TableInsertInput, type TableLike, type TableRow, type TableSqlTypes, type TableUpdateInput, type TransactionOptions, type TransactionalQueryAdapter, type TypedSqlTag, type UniqueConstraint, type UniqueConstraintOptions, type UniqueNullSemantics, type UnsafeSchemaSqlExpression, type UpdateAssignmentValue, type UpdateAssignments, type ValuesSource, type VisibleDependenciesOf, type WindowMeta, type WithClause, add, alias, all, allowAll, and, asValue, asc, avg, between, bigint, binary, boolean, booleanResultDecoder, call, caseWhen, cast, catalogCheck, catalogForeignKey, check, coalesce, column, concat, correlate, count, countDistinct, crossJoin, cte, date, dateResultDecoder, defaultValues, deleteFrom, denseRank, desc, distinct, divide, eq, except, execute, executeRows, exists, explain, externalDefault, externalGeneratedColumn, fetchFirst, fetchNext, foreignKey, from, fullJoin, generatedColumn, groupBy, gt, gte, having, identityColumn, inList, inQuery, index, innerJoin, insertInto, insertSelect, integer, intersect, isDistinctFrom, isNotDistinctFrom, isNotNull, isNull, isTrue, json, jsonBoolean, jsonExists, jsonNumber, jsonPath, jsonText, jsonTextResultDecoder, lateral, leftJoin, like, lower, lt, lte, mapResult, max, min, modulo, multiply, nativeColumn, nativeStorage, naturalJoin, ne, not, notExists, notIn, notLike, nullable, nullsFirst, nullsLast, numeric, offset, omit, or, order, orderBy, over, portableStorage, primaryKey, qubu, rank, recursiveCte, references, render, returning, rightJoin, rowLock, rowNumber, scalar, schema, schemaCall, select, sql, stream, subtract, sum, table, text, timestamp, timestampResultDecoder, union, unionAll, unique, uniqueConstraint, unsafeSchemaSql, update, upper, uuid, value, values, where, withCte };
package/dist/index.mjs CHANGED
@@ -1,13 +1,15 @@
1
1
  import { a as assertDialectCapability } from "./json-Db7XRD91.mjs";
2
- import { c as render, n as call, o as cast, r as schemaCall, t as createClause } from "./types-CTENnDh9.mjs";
2
+ import { A as parenthesize, B as resultValueOf, C as makeExpression, E as markSchemaExpression, F as dateResultDecoder, I as decodeResultRow, L as jsonTextResultDecoder, M as ResultDecodingError, N as booleanResultDecoder, O as fragment, P as createResultShape, R as resultShapeValue, S as isSchemaExpression, T as markExpressionCategory, V as timestampResultDecoder, b as snakeCaseIdentifier, i as identifier, k as isFragment, l as value, o as asValue, t as createColumnReference, w as makeSchemaExpression, x as isExpression, y as resolveSqlNames, z as resultValue } from "./column-BzN8KFJa.mjs";
3
+ import { c as render, n as call, o as cast, r as schemaCall, t as createClause } from "./types-BLNRatG_.mjs";
3
4
  import { n as queryValidationError, t as QueryValidationError } from "./errors-Dxv73YJu.mjs";
4
- import { $ as createResultShape, B as isExpression, D as generatedColumn, E as externalGeneratedColumn, G as markSchemaExpression, H as makeExpression, J as isFragment, O as identityColumn, Q as booleanResultDecoder, R as resolveSqlNames, S as uuid, T as externalDefault, U as makeSchemaExpression, V as isSchemaExpression, W as markExpressionCategory, Y as parenthesize, Z as ResultDecodingError, _ as nullable, at as resultValueOf, b as text, c as boolean, d as date, et as dateResultDecoder, f as encodeColumnParameter, g as nativeStorage, h as nativeColumn, i as identifier, it as resultValue, l as column, m as json, nt as jsonTextResultDecoder, o as bigint, ot as timestampResultDecoder, p as integer, q as fragment, rt as resultShapeValue, s as binary, t as createColumnReference, tt as decodeResultRow, v as numeric, x as timestamp, y as portableStorage, z as snakeCaseIdentifier } from "./column-DmazTL67.mjs";
5
- import { i as value, t as asValue } from "./value-BEEj_Ayd.mjs";
6
- import { a as isDistinctFrom, c as lt, d as notLike, f as expressionOperand, i as gte, l as lte, m as renderOperands, n as eq, o as isNotDistinctFrom, p as isNullOperand, r as gt, s as like, u as ne } from "./relational-x3BDVX9e.mjs";
5
+ import { C as identityColumn, S as generatedColumn, _ as uuid, b as externalDefault, c as integer, d as nativeStorage, f as nullable, g as timestamp, h as text, i as column, l as json, m as portableStorage, n as binary, o as date, p as numeric, r as boolean, s as encodeColumnParameter, t as bigint, u as nativeColumn, x as externalGeneratedColumn } from "./column-CFvSbil0.mjs";
6
+ import { a as isDistinctFrom, c as lt, d as notLike, f as expressionOperand, i as gte, l as lte, m as renderOperands, n as eq, o as isNotDistinctFrom, p as isNullOperand, r as gt, s as like, u as ne } from "./relational-DSAJ-l58.mjs";
7
7
  import { t as omit } from "./omit-OxV58AwX.mjs";
8
- import { r as exposeColumns, t as createSource } from "./source-C4Vmu5bb.mjs";
9
- import { n as alias, r as lateral, t as table } from "./table-DLQ7YWth.mjs";
10
- import { C as index, S as unsafeSchemaSql, c as check, d as references, f as unique, i as schema, l as foreignKey, o as catalogCheck, p as uniqueConstraint, s as catalogForeignKey, u as primaryKey } from "./registry-BGqa05et.mjs";
8
+ import { r as exposeColumns, t as createSource } from "./source-BDuUXmAk.mjs";
9
+ import { n as alias, r as lateral, t as table } from "./table-C1QGNe4P.mjs";
10
+ import { a as primaryKey, c as uniqueConstraint, i as foreignKey, n as catalogForeignKey, o as references, r as check, s as unique, t as catalogCheck, u as index } from "./constraints-DM_tarXc.mjs";
11
+ import { c as unsafeSchemaSql } from "./expressions-BCjc08zw.mjs";
12
+ import { i as schema } from "./registry-oWDiqD7i.mjs";
11
13
  //#region src/execution.ts
12
14
  function qubu(adapter, options = {}) {
13
15
  const observation = createObservation(options.hooks);
@@ -389,14 +391,14 @@ function max(expression) {
389
391
  }
390
392
  //#endregion
391
393
  //#region src/expressions/functions/string.ts
392
- function lower(expression) {
393
- return schemaCall("LOWER", expression);
394
+ function lower(input) {
395
+ return schemaCall("LOWER", input);
394
396
  }
395
- function upper(expression) {
396
- return schemaCall("UPPER", expression);
397
+ function upper(input) {
398
+ return schemaCall("UPPER", input);
397
399
  }
398
- function coalesce(...expressions) {
399
- return schemaCall("COALESCE", ...expressions);
400
+ function coalesce(first, ...rest) {
401
+ return schemaCall("COALESCE", first, ...rest);
400
402
  }
401
403
  function concat(...argumentsToConcat) {
402
404
  return schemaCall("CONCAT", ...argumentsToConcat);
@@ -1163,6 +1165,7 @@ function validateMutationClauses(kind, clauses) {
1163
1165
  let whereSeen = false;
1164
1166
  let returningSeen = false;
1165
1167
  let allowAllSeen = false;
1168
+ let updateFromSeen = false;
1166
1169
  for (const clause of clauses) if (clause.clauseKind === "where") {
1167
1170
  if (whereSeen) throw queryValidationError({
1168
1171
  code: "duplicate-clause",
@@ -1190,6 +1193,15 @@ function validateMutationClauses(kind, clauses) {
1190
1193
  hint: "Keep one allowAll() marker when the mutation is intentionally unrestricted."
1191
1194
  });
1192
1195
  allowAllSeen = true;
1196
+ } else if (clause.clauseKind === "update-from") {
1197
+ if (updateFromSeen) throw queryValidationError({
1198
+ code: "duplicate-clause",
1199
+ context: "mutation.update.clauses",
1200
+ path: ["clauses", "updateFrom"],
1201
+ message: "UPDATE accepts only one FROM clause",
1202
+ hint: "Pass every source to one updateFrom() call."
1203
+ });
1204
+ updateFromSeen = true;
1193
1205
  }
1194
1206
  if (!whereSeen && !allowAllSeen) throw queryValidationError({
1195
1207
  code: "unsafe-mutation",
@@ -1199,6 +1211,15 @@ function validateMutationClauses(kind, clauses) {
1199
1211
  hint: "Add where(...) to target rows, or add allowAll() to make the unrestricted intent explicit."
1200
1212
  });
1201
1213
  }
1214
+ function validateMutationWithClauses(kind, clauses) {
1215
+ if (clauses.filter((clause) => clause.clauseKind === "with").length > 1) throw queryValidationError({
1216
+ code: "duplicate-clause",
1217
+ context: `mutation.${kind.toLowerCase()}.clauses`,
1218
+ path: ["clauses", "with"],
1219
+ message: `${kind} accepts only one WITH clause`,
1220
+ hint: "Pass every CTE to one withCte() clause."
1221
+ });
1222
+ }
1202
1223
  //#endregion
1203
1224
  //#region src/query/mutation/insert.ts
1204
1225
  function values(...rows) {
@@ -1220,7 +1241,13 @@ function insertSelect(query, columns) {
1220
1241
  function insertInto(table, source, ...clauses) {
1221
1242
  validateInsert(table, source);
1222
1243
  const insertClauses = clauses;
1244
+ validateMutationWithClauses("INSERT", insertClauses);
1245
+ const withClause = insertClauses.find((clause) => clause.clauseKind === "with");
1223
1246
  return createMutation("insert", insertClauses.find((clause) => clause.clauseKind === "returning")?.row ?? {}, insertClauses.find((clause) => clause.clauseKind === "returning")?.resultShape ?? { fields: [] }, (context) => {
1247
+ if (withClause) {
1248
+ context.render(withClause);
1249
+ context.append(" ");
1250
+ }
1224
1251
  context.append("INSERT INTO ");
1225
1252
  context.render(table.reference);
1226
1253
  if (source.insertKind === "values") {
@@ -1261,6 +1288,7 @@ function insertInto(table, source, ...clauses) {
1261
1288
  context.renderRelation(source.query);
1262
1289
  }
1263
1290
  for (const clause of insertClauses) {
1291
+ if (clause.clauseKind === "with") continue;
1264
1292
  context.append(" ");
1265
1293
  context.render(clause);
1266
1294
  }
@@ -1393,10 +1421,17 @@ function validateInsert(table, source) {
1393
1421
  function update(table, assignments, ...clauses) {
1394
1422
  const normalizedClauses = clauses;
1395
1423
  validateMutationClauses("UPDATE", normalizedClauses);
1424
+ validateMutationWithClauses("UPDATE", normalizedClauses);
1396
1425
  const entries = validateUpdate(table, assignments);
1397
1426
  const whereClause = normalizedClauses.find((clause) => clause.clauseKind === "where");
1427
+ const withClause = normalizedClauses.find((clause) => clause.clauseKind === "with");
1428
+ const fromClause = normalizedClauses.find((clause) => clause.clauseKind === "update-from");
1398
1429
  const returningClause = normalizedClauses.find((clause) => clause.clauseKind === "returning");
1399
1430
  return createMutation("update", returningClause?.row ?? {}, returningClause?.resultShape ?? { fields: [] }, (context) => {
1431
+ if (withClause) {
1432
+ context.render(withClause);
1433
+ context.append(" ");
1434
+ }
1400
1435
  context.append("UPDATE ");
1401
1436
  context.render(table.reference);
1402
1437
  context.append(" SET ");
@@ -1406,6 +1441,10 @@ function update(table, assignments, ...clauses) {
1406
1441
  context.append(" = ");
1407
1442
  renderAssignmentValue(context, value, table.definitions[columnName]);
1408
1443
  });
1444
+ if (fromClause) {
1445
+ context.append(" ");
1446
+ context.render(fromClause);
1447
+ }
1409
1448
  if (whereClause) {
1410
1449
  context.append(" ");
1411
1450
  context.render(whereClause);
@@ -1454,9 +1493,15 @@ function validateUpdate(table, assignments) {
1454
1493
  function deleteFrom(table, ...clauses) {
1455
1494
  const normalizedClauses = clauses;
1456
1495
  validateMutationClauses("DELETE", normalizedClauses);
1496
+ validateMutationWithClauses("DELETE", normalizedClauses);
1457
1497
  const whereClause = normalizedClauses.find((clause) => clause.clauseKind === "where");
1498
+ const withClause = normalizedClauses.find((clause) => clause.clauseKind === "with");
1458
1499
  const returningClause = normalizedClauses.find((clause) => clause.clauseKind === "returning");
1459
1500
  return createMutation("delete", returningClause?.row ?? {}, returningClause?.resultShape ?? { fields: [] }, (context) => {
1501
+ if (withClause) {
1502
+ context.render(withClause);
1503
+ context.append(" ");
1504
+ }
1460
1505
  context.append("DELETE FROM ");
1461
1506
  context.render(table.reference);
1462
1507
  if (whereClause) {
@@ -0,0 +1,26 @@
1
+ import { kt as CatalogConnection, st as IntrospectionCatalog, ut as IntrospectionOptions } from "../types-BEn0N_al.mjs";
2
+ //#region src/introspection/mysql.d.ts
3
+ declare const mysqlServerQuery = "SELECT VERSION() AS version, @@version_comment AS version_comment";
4
+ declare const mysqlTablesQuery = "\n SELECT TABLE_NAME AS table_name, TABLE_TYPE AS table_type,\n ENGINE AS engine, TABLE_COLLATION AS table_collation,\n CREATE_OPTIONS AS create_options, TABLE_COMMENT AS table_comment\n FROM INFORMATION_SCHEMA.TABLES\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME\n";
5
+ declare const mysqlColumnsQuery = "\n SELECT TABLE_NAME AS table_name, COLUMN_NAME AS column_name,\n ORDINAL_POSITION AS ordinal_position, COLUMN_TYPE AS column_type,\n DATA_TYPE AS data_type,\n IS_NULLABLE AS is_nullable, COLUMN_DEFAULT AS column_default,\n EXTRA AS extra, GENERATION_EXPRESSION AS generation_expression,\n CHARACTER_SET_NAME AS character_set_name,\n COLLATION_NAME AS collation_name, COLUMN_COMMENT AS column_comment\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME, ORDINAL_POSITION\n";
6
+ declare const mysqlKeyUsageQuery = "\n SELECT kcu.TABLE_NAME AS table_name, kcu.CONSTRAINT_NAME AS constraint_name,\n tc.CONSTRAINT_TYPE AS constraint_type, tc.ENFORCED AS enforced,\n kcu.COLUMN_NAME AS column_name, kcu.ORDINAL_POSITION AS ordinal_position,\n kcu.REFERENCED_TABLE_NAME AS referenced_table_name,\n kcu.REFERENCED_COLUMN_NAME AS referenced_column_name,\n rc.UPDATE_RULE AS update_rule, rc.DELETE_RULE AS delete_rule,\n rc.MATCH_OPTION AS match_option\n FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu\n JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc\n ON tc.CONSTRAINT_SCHEMA = kcu.CONSTRAINT_SCHEMA\n AND tc.TABLE_NAME = kcu.TABLE_NAME\n AND tc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME\n LEFT JOIN INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc\n ON rc.CONSTRAINT_SCHEMA = kcu.CONSTRAINT_SCHEMA\n AND rc.TABLE_NAME = kcu.TABLE_NAME\n AND rc.CONSTRAINT_NAME = kcu.CONSTRAINT_NAME\n WHERE kcu.CONSTRAINT_SCHEMA = ?\n ORDER BY kcu.TABLE_NAME, kcu.CONSTRAINT_NAME, kcu.ORDINAL_POSITION\n";
7
+ declare const mysqlChecksQuery = "\n SELECT tc.TABLE_NAME AS table_name, tc.CONSTRAINT_NAME AS constraint_name,\n tc.ENFORCED AS enforced, cc.CHECK_CLAUSE AS check_clause\n FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc\n JOIN INFORMATION_SCHEMA.CHECK_CONSTRAINTS cc\n ON cc.CONSTRAINT_SCHEMA = tc.CONSTRAINT_SCHEMA\n AND cc.CONSTRAINT_NAME = tc.CONSTRAINT_NAME\n WHERE tc.CONSTRAINT_SCHEMA = ? AND tc.CONSTRAINT_TYPE = 'CHECK'\n ORDER BY tc.TABLE_NAME, tc.CONSTRAINT_NAME\n";
8
+ declare const mysqlStatisticsQuery = "\n SELECT TABLE_NAME AS table_name, INDEX_NAME AS index_name,\n NON_UNIQUE AS non_unique, SEQ_IN_INDEX AS seq_in_index,\n COLUMN_NAME AS column_name, COLLATION AS collation,\n INDEX_TYPE AS index_type, EXPRESSION AS expression,\n SUB_PART AS sub_part, IS_VISIBLE AS is_visible,\n COMMENT AS comment, INDEX_COMMENT AS index_comment\n FROM INFORMATION_SCHEMA.STATISTICS\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME, INDEX_NAME, SEQ_IN_INDEX\n";
9
+ /** View definitions and execution properties for the selected database. */
10
+ declare const mysqlViewsQuery = "\n SELECT TABLE_NAME AS table_name, VIEW_DEFINITION AS view_definition,\n CHECK_OPTION AS check_option, IS_UPDATABLE AS is_updatable,\n SECURITY_TYPE AS security_type, DEFINER AS definer\n FROM INFORMATION_SCHEMA.VIEWS\n WHERE TABLE_SCHEMA = ?\n ORDER BY TABLE_NAME\n";
11
+ /** Stored function and procedure declarations for the selected database. */
12
+ declare const mysqlRoutinesQuery = "\n SELECT ROUTINE_NAME AS routine_name, ROUTINE_TYPE AS routine_type,\n DATA_TYPE AS data_type, DTD_IDENTIFIER AS dtd_identifier,\n ROUTINE_BODY AS routine_body,\n ROUTINE_DEFINITION AS routine_definition,\n EXTERNAL_LANGUAGE AS external_language,\n SQL_DATA_ACCESS AS sql_data_access,\n IS_DETERMINISTIC AS is_deterministic,\n SECURITY_TYPE AS security_type, SQL_MODE AS sql_mode,\n ROUTINE_COMMENT AS routine_comment\n FROM INFORMATION_SCHEMA.ROUTINES\n WHERE ROUTINE_SCHEMA = ?\n ORDER BY ROUTINE_NAME, ROUTINE_TYPE\n";
13
+ /** Parameter rows, including the ordinal zero return row for functions. */
14
+ declare const mysqlRoutineParametersQuery = "\n SELECT SPECIFIC_NAME AS routine_name, ORDINAL_POSITION AS ordinal_position,\n PARAMETER_MODE AS parameter_mode, PARAMETER_NAME AS parameter_name,\n DATA_TYPE AS data_type, DTD_IDENTIFIER AS dtd_identifier\n FROM INFORMATION_SCHEMA.PARAMETERS\n WHERE SPECIFIC_SCHEMA = ?\n ORDER BY SPECIFIC_NAME, ORDINAL_POSITION\n";
15
+ /** Trigger bodies and their table/event metadata. */
16
+ declare const mysqlTriggersQuery = "\n SELECT TRIGGER_NAME AS trigger_name, EVENT_MANIPULATION AS event_manipulation,\n EVENT_OBJECT_TABLE AS table_name, ACTION_CONDITION AS action_condition,\n ACTION_STATEMENT AS action_statement,\n ACTION_ORIENTATION AS action_orientation,\n ACTION_TIMING AS action_timing, ACTION_ORDER AS action_order,\n DEFINER AS definer, SQL_MODE AS sql_mode\n FROM INFORMATION_SCHEMA.TRIGGERS\n WHERE TRIGGER_SCHEMA = ?\n ORDER BY TRIGGER_NAME, ACTION_ORDER\n";
17
+ /** Partition and subpartition declarations for tables in the selected database. */
18
+ declare const mysqlPartitionsQuery = "\n SELECT TABLE_NAME AS table_name, PARTITION_NAME AS partition_name,\n SUBPARTITION_NAME AS subpartition_name,\n PARTITION_ORDINAL_POSITION AS partition_ordinal_position,\n SUBPARTITION_ORDINAL_POSITION AS subpartition_ordinal_position,\n PARTITION_METHOD AS partition_method,\n SUBPARTITION_METHOD AS subpartition_method,\n PARTITION_EXPRESSION AS partition_expression,\n SUBPARTITION_EXPRESSION AS subpartition_expression,\n PARTITION_DESCRIPTION AS partition_description,\n PARTITION_COMMENT AS partition_comment,\n TABLESPACE_NAME AS tablespace_name\n FROM INFORMATION_SCHEMA.PARTITIONS\n WHERE TABLE_SCHEMA = ? AND PARTITION_NAME IS NOT NULL\n ORDER BY TABLE_NAME, PARTITION_ORDINAL_POSITION, SUBPARTITION_ORDINAL_POSITION\n";
19
+ /** Collations used by tables or columns in the selected database. */
20
+ declare const mysqlCollationsQuery = "\n SELECT c.COLLATION_NAME AS collation_name,\n c.CHARACTER_SET_NAME AS character_set_name,\n c.ID AS collation_id, c.IS_DEFAULT AS is_default,\n c.IS_COMPILED AS is_compiled, c.SORTLEN AS sort_length,\n c.PAD_ATTRIBUTE AS pad_attribute\n FROM INFORMATION_SCHEMA.COLLATIONS c\n JOIN (\n SELECT DISTINCT TABLE_COLLATION AS collation_name\n FROM INFORMATION_SCHEMA.TABLES\n WHERE TABLE_SCHEMA = ? AND TABLE_COLLATION IS NOT NULL\n UNION\n SELECT DISTINCT COLLATION_NAME AS collation_name\n FROM INFORMATION_SCHEMA.COLUMNS\n WHERE TABLE_SCHEMA = ? AND COLLATION_NAME IS NOT NULL\n ) used ON used.collation_name = c.COLLATION_NAME\n ORDER BY c.COLLATION_NAME\n";
21
+ /** Scheduled events are retained as opaque MySQL objects, not migration input. */
22
+ declare const mysqlEventsQuery = "\n SELECT EVENT_NAME AS event_name, EVENT_TYPE AS event_type,\n STATUS AS status, EVENT_DEFINITION AS event_definition,\n EVENT_BODY AS event_body, EXECUTE_AT AS execute_at,\n INTERVAL_VALUE AS interval_value, INTERVAL_FIELD AS interval_field,\n EVENT_COMMENT AS event_comment, DEFINER AS definer\n FROM INFORMATION_SCHEMA.EVENTS\n WHERE EVENT_SCHEMA = ?\n ORDER BY EVENT_NAME\n";
23
+ /** Read one MySQL database into the normalized catalog contract. */
24
+ declare function readCatalog(connection: CatalogConnection, options: IntrospectionOptions): Promise<IntrospectionCatalog>;
25
+ //#endregion
26
+ export { mysqlChecksQuery, mysqlCollationsQuery, mysqlColumnsQuery, mysqlEventsQuery, mysqlKeyUsageQuery, mysqlPartitionsQuery, mysqlRoutineParametersQuery, mysqlRoutinesQuery, mysqlServerQuery, mysqlStatisticsQuery, mysqlTablesQuery, mysqlTriggersQuery, mysqlViewsQuery, readCatalog };