@vibeorm/sql 4.2.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast.d.ts +322 -9
- package/dist/codecs.d.ts +46 -0
- package/dist/dialect.d.ts +155 -5
- package/dist/dialects/migration-inventory.d.ts +58 -1
- package/dist/dialects/migration-objects.d.ts +36 -0
- package/dist/dialects/migration-visibility.d.ts +6 -1
- package/dist/dialects/mysql-check-probe.d.ts +1 -0
- package/dist/dialects/mysql-generated-columns.d.ts +43 -0
- package/dist/dialects/mysql-index-expressions.d.ts +20 -0
- package/dist/dialects/mysql-row-rules.d.ts +8 -0
- package/dist/dialects/mysql.d.ts +3 -2
- package/dist/dialects/postgres-generated-columns.d.ts +30 -0
- package/dist/dialects/postgres-index-expressions.d.ts +10 -0
- package/dist/dialects/postgres-index-keys.d.ts +15 -0
- package/dist/dialects/postgres-rls.d.ts +16 -1
- package/dist/dialects/postgres-row-rules.d.ts +25 -0
- package/dist/dialects/sqlite-generated-columns.d.ts +18 -0
- package/dist/dialects/sqlite-index-expressions.d.ts +23 -0
- package/dist/dialects/sqlite-row-rules.d.ts +8 -0
- package/dist/dialects/sqlite-table-definition.d.ts +25 -5
- package/dist/generated-columns.d.ts +18 -0
- package/dist/index-expressions.d.ts +61 -0
- package/dist/index.d.ts +23 -9
- package/dist/index.js +2662 -1161
- package/dist/index.js.map +35 -21
- package/dist/key-list.d.ts +83 -0
- package/dist/like.d.ts +17 -0
- package/dist/local-date.d.ts +9 -0
- package/dist/pg-array.d.ts +6 -0
- package/dist/predicate.d.ts +21 -7
- package/dist/query/index.js +59 -19
- package/dist/query/index.js.map +7 -7
- package/dist/query/state.d.ts +5 -0
- package/dist/query/types.d.ts +2 -0
- package/dist/row-rules.d.ts +57 -0
- package/dist/timestamp-identity.d.ts +8 -2
- package/package.json +2 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { GeneratedColumnIR } from "@vibeorm/schema";
|
|
2
|
+
import type { SqlDialect } from "./dialect.ts";
|
|
3
|
+
/** SQL helper name for the canonical stored generation declaration. */
|
|
4
|
+
export type GeneratedColumnDeclaration = GeneratedColumnIR;
|
|
5
|
+
/** Source evidence; virtual storage is reported for the caller's admission check. */
|
|
6
|
+
export type ExtractedGeneratedColumn = {
|
|
7
|
+
readonly expression: string;
|
|
8
|
+
readonly storage: "stored" | "virtual";
|
|
9
|
+
readonly columnSql: string;
|
|
10
|
+
/** Declaration prefix, including any type/charset/collation/nullability qualifiers. */
|
|
11
|
+
readonly typeSql: string;
|
|
12
|
+
};
|
|
13
|
+
/** Render trusted physical SQL without interpreting or rewriting its expression. */
|
|
14
|
+
export declare function renderGeneratedColumnClause({ dialect, generated }: {
|
|
15
|
+
readonly dialect: SqlDialect;
|
|
16
|
+
readonly generated: GeneratedColumnDeclaration;
|
|
17
|
+
}): string;
|
|
18
|
+
//# sourceMappingURL=generated-columns.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Dialect, EnumIR, IndexIR, QualifiedSqlName } from "@vibeorm/schema";
|
|
2
|
+
import type { SqlDialect } from "./dialect.ts";
|
|
3
|
+
import type { PredicateModel } from "./predicate.ts";
|
|
4
|
+
import type { RenderedQuery } from "./render.ts";
|
|
5
|
+
/** Complete ordered physical keys; expression text has no key wrapper or direction. */
|
|
6
|
+
export type IndexKeyOperand = {
|
|
7
|
+
readonly kind: "field";
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly desc: boolean;
|
|
10
|
+
readonly decimal?: boolean;
|
|
11
|
+
readonly operatorClass?: QualifiedSqlName;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: "expression";
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly desc: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** Scratch statements only: sessions, normalization context and cleanup belong to migrate. */
|
|
18
|
+
export type IndexExpressionProbeParams = {
|
|
19
|
+
readonly dialect: SqlDialect;
|
|
20
|
+
readonly operation: "context" | "clone" | "createIndex" | "read" | "drop";
|
|
21
|
+
readonly probe: {
|
|
22
|
+
readonly table: string;
|
|
23
|
+
readonly index: string;
|
|
24
|
+
};
|
|
25
|
+
readonly table?: QualifiedSqlName;
|
|
26
|
+
readonly keys?: readonly IndexKeyOperand[];
|
|
27
|
+
readonly unique?: boolean;
|
|
28
|
+
readonly definition?: string;
|
|
29
|
+
readonly backslashEscapes?: boolean;
|
|
30
|
+
readonly where?: string;
|
|
31
|
+
readonly nullsNotDistinct?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/** Resolve logical terms using the shared scalar renderer, then qualify physical key storage. */
|
|
34
|
+
export declare function resolveIndexKeys({ index, model, dialect, enums, site }: {
|
|
35
|
+
readonly index: IndexIR;
|
|
36
|
+
readonly model: PredicateModel;
|
|
37
|
+
readonly dialect: SqlDialect;
|
|
38
|
+
readonly enums?: readonly EnumIR[];
|
|
39
|
+
readonly site: string;
|
|
40
|
+
}): readonly IndexKeyOperand[];
|
|
41
|
+
/** Render complete key fragments; the caller owns the outer CREATE/ALTER list. */
|
|
42
|
+
export declare function renderIndexKeys({ dialect, keys, unique }: {
|
|
43
|
+
readonly dialect: SqlDialect;
|
|
44
|
+
readonly keys: readonly IndexKeyOperand[];
|
|
45
|
+
readonly unique: boolean;
|
|
46
|
+
}): readonly string[];
|
|
47
|
+
/** Recover raw physical terms without inventing typed logical expressions or Decimal origin. */
|
|
48
|
+
export declare function extractIndexKeys({ dialect, definition, index, backslashEscapes }: {
|
|
49
|
+
readonly dialect: Dialect;
|
|
50
|
+
readonly definition: string;
|
|
51
|
+
readonly index: string;
|
|
52
|
+
readonly backslashEscapes?: boolean;
|
|
53
|
+
}): readonly IndexKeyOperand[] | undefined;
|
|
54
|
+
/** Render a real expression-index normalization host, never a scalar CHECK surrogate. */
|
|
55
|
+
export declare function renderIndexExpressionProbe({ ...params }: IndexExpressionProbeParams): readonly RenderedQuery[];
|
|
56
|
+
/** Version admission after a connection reveals its host, before scratch or user index DDL. */
|
|
57
|
+
export declare function assertIndexExpressionVersion({ dialect, version }: {
|
|
58
|
+
readonly dialect: Dialect;
|
|
59
|
+
readonly version: string;
|
|
60
|
+
}): void;
|
|
61
|
+
//# sourceMappingURL=index-expressions.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export { renderExternalDependents } from "./dialects/external-dependents.ts";
|
|
|
8
8
|
export type { ExternalDependentTarget } from "./dialects/external-dependents.ts";
|
|
9
9
|
export { renderPostgresPhysicalCatalog } from "./dialects/postgres-physical-catalog.ts";
|
|
10
10
|
export type { PostgresPhysicalCatalogQuery } from "./dialects/postgres-physical-catalog.ts";
|
|
11
|
-
export { renderPostgresIndexKeys } from "./dialects/postgres-index-keys.ts";
|
|
11
|
+
export { renderPostgresIndexKeys, renderPostgresJitSuspend, renderPostgresJitRestore } from "./dialects/postgres-index-keys.ts";
|
|
12
12
|
export { renderIndexColumns } from "./index-columns.ts";
|
|
13
13
|
export type { IndexColumnOperand } from "./index-columns.ts";
|
|
14
|
+
export { resolveIndexKeys, renderIndexKeys, extractIndexKeys, renderIndexExpressionProbe, assertIndexExpressionVersion } from "./index-expressions.ts";
|
|
15
|
+
export type { IndexKeyOperand, IndexExpressionProbeParams } from "./index-expressions.ts";
|
|
14
16
|
export { renderModuleDependencyQuery } from "./dialects/module-dependency.ts";
|
|
15
17
|
export type { ModuleDependencyOperation } from "./dialects/module-dependency.ts";
|
|
16
18
|
export { renderReplayCoverageGaps } from "./dialects/migration-replay-coverage.ts";
|
|
@@ -38,8 +40,8 @@ export type { ResultDecoder, ResultReadDecoder, ResultParameterEncoder, ResultSc
|
|
|
38
40
|
* lives in this package; see the root sql-catalog.md for the reviewable surface.
|
|
39
41
|
*/
|
|
40
42
|
export { compileExclusion, renderExclusionSetup, renderExclusionDdl, renderExclusionCatalog, renderExclusionProbe } from "./exclusion.ts";
|
|
41
|
-
export type { AdvisoryLockKey, AdvisoryLockStatement, AggFn, AggRef, AggSelect, ChainResult, ChainRowSource, ChainStatement, ChainStep, ChainStepStatement, ChainTally, ChainVeto, ColRef, ComparisonOp, CountSubquery, DeleteStatement, ExcludedRef, InnerJoin, KeyTableJoin, KeyTableMember, InsertSelectStatement, InsertStatement, ReturningColumn, JsonFilterOp, LateralJoin, ListSetOperation, OnConflictClause, OnConflictDoNothing, OnConflictUpdate, OrderByAggregate, OrderByColumn, OrderBySubquery, OrderTerm, RowLock, RowNumberProjection, DbNowMarker, JsonParamCell, SelectExpr, SelectStatement, SetOperation, SetOperator, SqlExpr, SqlStatement, StepColumnRef, TableRef, UpdateStatement, } from "./ast.ts";
|
|
42
|
-
export { ADVISORY_LOCK_RESULT_COLUMN, CHAIN_VETO_PREFIX, CHAIN_VETO_TOKEN_PATTERN, SQL_DEFAULT_CELL, chainVetoToken, dbNowMarker, excludedRef, isDbNowMarker, isExcludedRef, isJsonParamCell, isListSetOperation, isSetOperation, isSqlDefaultCell, isStepColumnRef, jsonParamCell, returningColumnName, stepColumnRef, } from "./ast.ts";
|
|
43
|
+
export type { AdvisoryLockKey, AdvisoryLockStatement, AggFn, AggRef, AggSelect, ChainResult, ChainRowSource, ChainStatement, ChainStep, ChainStepStatement, ChainTally, ChainVeto, ColRef, ComparisonOp, CountSubquery, DeleteStatement, ExcludedRef, InnerJoin, KeyListMember, KeyPage, KeyRows, KeyTableJoin, KeyTableMember, InsertSelectStatement, InsertStatement, ReturningColumn, JsonFilterOp, LateralJoin, LeftJoin, ListSetOperation, OnConflictClause, OnConflictDoNothing, OnConflictUpdate, OrderByAggregate, OrderByColumn, OrderBySubquery, OrderTerm, RowLock, RowNumberProjection, DbNowMarker, JsonParamCell, SelectExpr, SelectStatement, SetOperation, SetOperator, SqlExpr, SqlStatement, StepColumnRef, TableRef, UpdateStatement, } from "./ast.ts";
|
|
44
|
+
export { ADVISORY_LOCK_RESULT_COLUMN, CHAIN_VETO_PREFIX, CHAIN_VETO_TOKEN_PATTERN, SQL_DEFAULT_CELL, SQL_KEEP_CELL, chainVetoToken, dbNowMarker, excludedRef, isDbNowMarker, isExcludedRef, isJsonParamCell, isListSetOperation, isSetOperation, isSqlDefaultCell, isSqlKeepCell, isStepColumnRef, jsonParamCell, returningColumnName, stepColumnRef, } from "./ast.ts";
|
|
43
45
|
export type { AdvisoryLockFunctions, AdvisoryLockModeFunctions, RowLockSyntax, EmptyInsertSyntax, SqlDialect, } from "./dialect.ts";
|
|
44
46
|
export { ADVISORY_KEY_BOUNDS, describeRowLock, renderAdvisoryLock, renderRowLockClause } from "./locks.ts";
|
|
45
47
|
export { JSON_TRANSPORT, projectionOutputName } from "./json-transport.ts";
|
|
@@ -48,10 +50,21 @@ export { sqliteDialect } from "./dialects/sqlite.ts";
|
|
|
48
50
|
export { mysqlDialect } from "./dialects/mysql.ts";
|
|
49
51
|
export { SQL_DIALECTS, getSqlDialect } from "./dialects/registry.ts";
|
|
50
52
|
export { tableDefinitionParts } from "./dialects/sqlite-table-definition.ts";
|
|
51
|
-
export {
|
|
53
|
+
export { keyListBindsUntypedRows, postgresBulkInsertArrayCastOf, postgresKeyListElementTypeOf } from "./key-list.ts";
|
|
54
|
+
export { renderPredicate, renderSchemaExpression } from "./predicate.ts";
|
|
55
|
+
export { renderLocalDateCheck } from "./local-date.ts";
|
|
56
|
+
export { renderGeneratedColumnClause } from "./generated-columns.ts";
|
|
57
|
+
export type { GeneratedColumnDeclaration, ExtractedGeneratedColumn } from "./generated-columns.ts";
|
|
58
|
+
export { renderPostgresGeneratedColumnProbe, renderPostgresDropGeneratedExpression } from "./dialects/postgres-generated-columns.ts";
|
|
59
|
+
export type { PostgresGeneratedColumnProbe } from "./dialects/postgres-generated-columns.ts";
|
|
60
|
+
export { renderMysqlGeneratedColumnProbe, extractMysqlGeneratedColumn } from "./dialects/mysql-generated-columns.ts";
|
|
61
|
+
export type { MysqlGeneratedColumnProbe } from "./dialects/mysql-generated-columns.ts";
|
|
62
|
+
export { extractSqliteGeneratedColumn } from "./dialects/sqlite-generated-columns.ts";
|
|
63
|
+
export { renderRowRule } from "./row-rules.ts";
|
|
64
|
+
export type { RenderedRowRule, RowRuleStatement, RowRuleTriggerPlacement } from "./row-rules.ts";
|
|
52
65
|
export type { PredicateModel, PredicateUsage } from "./predicate.ts";
|
|
53
66
|
export { DIALECT_CAPABILITIES, MYSQL_CAPABILITIES, POSTGRES_CAPABILITIES, SQLITE_CAPABILITIES, } from "./capabilities.ts";
|
|
54
|
-
export { DIALECT_CODECS, MYSQL_CODECS, POSTGRES_CODECS, SQLITE_CODECS, decodeIsNoop, enumMembershipCodec, float32Codec, parseDateTimeText, parseJsonText, postgresArrayElementFromText, shortestFloat32, timeOfDayCodec, } from "./codecs.ts";
|
|
67
|
+
export { DIALECT_CODECS, MYSQL_CODECS, POSTGRES_CODECS, SQLITE_CODECS, decodeIsNoop, decodedDateTimeRefusal, enumMembershipCodec, float32Codec, localDateCodec, parseDateTimeText, parseExtendedDateTimeText, parseJsonText, postgresArrayElementFromText, shortestFloat32, timeOfDayCodec, } from "./codecs.ts";
|
|
55
68
|
export type { CodecTable, ScalarCodec, WireFidelity } from "./codecs.ts";
|
|
56
69
|
export { renderExpr, renderFragment, renderProjection, renderStatement } from "./render.ts";
|
|
57
70
|
export type { RenderedQuery } from "./render.ts";
|
|
@@ -59,7 +72,7 @@ export { snapshotSqlValue } from "./parameter-snapshot.ts";
|
|
|
59
72
|
export { ParamCollector } from "./params.ts";
|
|
60
73
|
export { NATIVE_RLS, renderRlsColumnType, renderRlsContext, renderRlsDisable, renderRlsDropPolicy, renderRlsEnable, renderRlsForce, renderRlsNoForce, renderRlsPolicy, renderRlsPredicate, renderRlsRole } from "./dialects/postgres-rls.ts";
|
|
61
74
|
export type { RlsContextStatement, RlsDisableStatement, RlsDropPolicyStatement, RlsEnableStatement, RlsForceStatement, RlsNoForceStatement, RlsPolicyStatement, RlsRoleStatement } from "./ast.ts";
|
|
62
|
-
export { containsPattern, endsWithPattern, escapeGlobPattern, escapeLikePattern, startsWithPattern, strictMatchPattern } from "./like.ts";
|
|
75
|
+
export { containsPattern, endsWithPattern, escapeGlobPattern, escapeLikePattern, startsWithPattern, strictMatchCollationPrefilter, strictMatchPattern } from "./like.ts";
|
|
63
76
|
export { RLS_READINESS_SQL, NATIVE_RLS_PROBE_POLICY, renderRlsReadinessQuery, renderRlsProbeTable, renderRlsPolicyPath } from "./dialects/postgres-rls-readiness.ts";
|
|
64
77
|
export type { RlsReadinessQuery } from "./dialects/postgres-rls-readiness.ts";
|
|
65
78
|
export { isFixedDiagnostic, renderDiagnostic } from "./dialects/diagnostics.ts";
|
|
@@ -74,9 +87,10 @@ export { renderMigrationHistoryQuery } from "./dialects/migration-history.ts";
|
|
|
74
87
|
export { sqliteTableConstraints } from "./dialects/sqlite-constraints.ts";
|
|
75
88
|
export type { SqliteConstraintClause } from "./dialects/sqlite-constraints.ts";
|
|
76
89
|
export { renderMigrationVisibility } from "./dialects/migration-visibility.ts";
|
|
77
|
-
export { renderMigrationInventory, renderSqliteColumnInventory, renderSqliteForeignKeyInventory, renderSqliteRebuildObjects } from "./dialects/migration-inventory.ts";
|
|
78
|
-
export { renderMigrationObjectBatch, renderMigrationObjectQuery, renderCheckProbe, renderMigrationNamespace, renderMigrationServerVersion, renderMigrationDependencies, renderMysqlObjectMembers } from "./dialects/migration-objects.ts";
|
|
79
|
-
export type { MigrationObjectBatch } from "./dialects/migration-objects.ts";
|
|
90
|
+
export { renderMigrationInventory, renderSqliteColumnInventory, renderSqliteForeignKeyInventory, renderSqliteRebuildObjects, renderSqliteColumnInventoryBatch, renderSqliteForeignKeyInventoryBatch, renderSqliteIntrospectionPragmaBatch } from "./dialects/migration-inventory.ts";
|
|
91
|
+
export { renderMigrationObjectBatch, renderMigrationObjectQuery, renderCheckProbe, renderMigrationNamespace, renderMigrationServerVersion, renderMigrationDependencies, renderMysqlObjectMembers, renderMysqlObjectBatch, renderMysqlObjectMembersBatch } from "./dialects/migration-objects.ts";
|
|
92
|
+
export type { MigrationObjectBatch, MysqlObjectBatch } from "./dialects/migration-objects.ts";
|
|
93
|
+
export type { SqliteIntrospectionPragma } from "./dialects/migration-inventory.ts";
|
|
80
94
|
export type { DiagnosticStatement, FixedDiagnosticQuery } from "./dialects/diagnostics.ts";
|
|
81
95
|
export { POSTGRES_DIAGNOSTIC_SQL, POSTGRES_WORKLOAD_LIMITS, renderPostgresExplain, renderPostgresWorkload, } from "./dialects/postgres-diagnostics.ts";
|
|
82
96
|
export type { PostgresExplainOptions, PostgresWorkloadQuery } from "./dialects/postgres-diagnostics.ts";
|