@vibeorm/sql 2.5.0 → 4.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.
Files changed (76) hide show
  1. package/LICENSE +21 -0
  2. package/dist/ast.d.ts +339 -12
  3. package/dist/codecs.d.ts +57 -0
  4. package/dist/dialect.d.ts +54 -0
  5. package/dist/dialects/postgres-index-keys.d.ts +1 -0
  6. package/dist/dialects/postgres-physical-catalog.d.ts +7 -1
  7. package/dist/dialects/sqlite-fts.d.ts +28 -0
  8. package/dist/index.d.ts +19 -7
  9. package/dist/index.js +2100 -983
  10. package/dist/index.js.map +26 -20
  11. package/dist/json-list-parameter.d.ts +37 -0
  12. package/dist/parameter-snapshot.d.ts +6 -0
  13. package/dist/params.d.ts +7 -8
  14. package/dist/pg-array.d.ts +13 -0
  15. package/dist/query/expressions.d.ts +70 -0
  16. package/dist/query/index.d.ts +6 -0
  17. package/dist/query/index.js +1078 -0
  18. package/dist/query/index.js.map +16 -0
  19. package/dist/query/mutations.d.ts +15 -0
  20. package/dist/query/reusable.d.ts +17 -0
  21. package/dist/query/select.d.ts +11 -0
  22. package/dist/query/sources.d.ts +37 -0
  23. package/dist/query/state.d.ts +73 -0
  24. package/dist/query/types.d.ts +188 -0
  25. package/dist/query-plan.d.ts +97 -0
  26. package/dist/render.d.ts +11 -1
  27. package/dist/result-decoder.d.ts +41 -10
  28. package/dist/sql-bindings.d.ts +84 -0
  29. package/dist/sql-input.d.ts +98 -0
  30. package/package.json +9 -3
  31. package/dist/ast.d.ts.map +0 -1
  32. package/dist/capabilities.d.ts.map +0 -1
  33. package/dist/codecs.d.ts.map +0 -1
  34. package/dist/composable.d.ts.map +0 -1
  35. package/dist/dialect.d.ts.map +0 -1
  36. package/dist/dialects/constraint-owned-index.d.ts.map +0 -1
  37. package/dist/dialects/diagnostics.d.ts.map +0 -1
  38. package/dist/dialects/external-dependents.d.ts.map +0 -1
  39. package/dist/dialects/external-ownership.d.ts.map +0 -1
  40. package/dist/dialects/migration-history.d.ts.map +0 -1
  41. package/dist/dialects/migration-inventory.d.ts.map +0 -1
  42. package/dist/dialects/migration-objects.d.ts.map +0 -1
  43. package/dist/dialects/migration-replay-coverage.d.ts.map +0 -1
  44. package/dist/dialects/migration-shadow.d.ts.map +0 -1
  45. package/dist/dialects/migration-visibility.d.ts.map +0 -1
  46. package/dist/dialects/module-dependency.d.ts.map +0 -1
  47. package/dist/dialects/mysql-check-probe.d.ts.map +0 -1
  48. package/dist/dialects/mysql.d.ts.map +0 -1
  49. package/dist/dialects/postgres-default-identity.d.ts.map +0 -1
  50. package/dist/dialects/postgres-diagnostics.d.ts.map +0 -1
  51. package/dist/dialects/postgres-index-keys.d.ts.map +0 -1
  52. package/dist/dialects/postgres-migration.d.ts.map +0 -1
  53. package/dist/dialects/postgres-physical-catalog.d.ts.map +0 -1
  54. package/dist/dialects/postgres-rls-readiness.d.ts.map +0 -1
  55. package/dist/dialects/postgres-rls.d.ts.map +0 -1
  56. package/dist/dialects/postgres-type-identity.d.ts.map +0 -1
  57. package/dist/dialects/postgres.d.ts.map +0 -1
  58. package/dist/dialects/registry.d.ts.map +0 -1
  59. package/dist/dialects/sqlite-constraints.d.ts.map +0 -1
  60. package/dist/dialects/sqlite-session.d.ts.map +0 -1
  61. package/dist/dialects/sqlite-table-definition.d.ts.map +0 -1
  62. package/dist/dialects/sqlite.d.ts.map +0 -1
  63. package/dist/exclusion.d.ts.map +0 -1
  64. package/dist/identifiers.d.ts.map +0 -1
  65. package/dist/index-columns.d.ts.map +0 -1
  66. package/dist/index.d.ts.map +0 -1
  67. package/dist/json-transport.d.ts.map +0 -1
  68. package/dist/like.d.ts.map +0 -1
  69. package/dist/locks.d.ts.map +0 -1
  70. package/dist/module-journal.d.ts.map +0 -1
  71. package/dist/native-enum-parameter.d.ts.map +0 -1
  72. package/dist/params.d.ts.map +0 -1
  73. package/dist/pg-array.d.ts.map +0 -1
  74. package/dist/predicate.d.ts.map +0 -1
  75. package/dist/render.d.ts.map +0 -1
  76. package/dist/result-decoder.d.ts.map +0 -1
@@ -2,7 +2,13 @@ import type { SqlDialect } from "../dialect.ts";
2
2
  import type { RenderedQuery } from "../render.ts";
3
3
  /** Physical schema queries; callers name each namespace without changing search_path. */
4
4
  export type PostgresPhysicalCatalogQuery = "tables" | "views" | "columns" | "constraints" | "checks" | "foreignKeys" | "enums" | "indexes";
5
- /** Read namespace-qualified physical metadata, preserving catalog type and index identities. */
5
+ /**
6
+ * Read namespace-qualified physical metadata, preserving catalog type and index identities.
7
+ * Extension members (`pg_depend.deptype = 'e'`) are left out of `tables`, `views` and `enums`:
8
+ * the extension's own script owns them, so no plan may create or drop them. The other reads hang
9
+ * off a table and reach the schema only through the filtered table list; PostgreSQL never records
10
+ * an index or a constraint as an extension member on its own.
11
+ */
6
12
  export declare function renderPostgresPhysicalCatalog(params: {
7
13
  dialect: SqlDialect;
8
14
  namespace: string;
@@ -0,0 +1,28 @@
1
+ /** @internal SQLite FTS synchronization SQL and its independently verifiable catalog spelling. */
2
+ export declare function renderSqliteFtsUpdateTrigger(params: {
3
+ table: string;
4
+ ftsTable: string;
5
+ columns: readonly string[];
6
+ }): {
7
+ readonly create: string;
8
+ readonly definition: string;
9
+ };
10
+ /** @internal Recognize only complete generated legacy/current triggers and their external-content FTS5 table. */
11
+ export declare function sqliteFtsUpdateUpgrade(params: {
12
+ create: string;
13
+ installed: string;
14
+ table: string;
15
+ name: string;
16
+ tableDefinition?: string;
17
+ }): undefined | {
18
+ readonly kind: "tableRequired";
19
+ readonly ftsTable: string;
20
+ } | {
21
+ readonly kind: "recognized";
22
+ readonly ftsTable: string;
23
+ readonly legacyDefinition: string;
24
+ readonly currentDefinition: string;
25
+ readonly drop: string;
26
+ readonly installed: "legacy" | "current";
27
+ };
28
+ //# sourceMappingURL=sqlite-fts.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export { nativeEnumArrayParameter, isNativeEnumArrayParameter } from "./native-enum-parameter.ts";
2
2
  export type { NativeEnumArrayParameter } from "./native-enum-parameter.ts";
3
+ export { isJsonListParameter, jsonListParameter } from "./json-list-parameter.ts";
4
+ export type { JsonListParameter, JsonListStorage } from "./json-list-parameter.ts";
3
5
  export { renderExternalOwnershipCatalog } from "./dialects/external-ownership.ts";
4
6
  export { renderExternalDependents } from "./dialects/external-dependents.ts";
5
7
  export type { ExternalDependentTarget } from "./dialects/external-dependents.ts";
@@ -14,11 +16,19 @@ export { renderReplayCoverageGaps } from "./dialects/migration-replay-coverage.t
14
16
  export { SHADOW_DATABASE, SHADOW_CAPABILITIES, renderShadowOperation } from "./dialects/migration-shadow.ts";
15
17
  export type { ShadowOperation } from "./dialects/migration-shadow.ts";
16
18
  export { MODULE_JOURNAL_COLUMN, renderModuleJournal } from "./module-journal.ts";
19
+ export { renderSqliteFtsUpdateTrigger, sqliteFtsUpdateUpgrade } from "./dialects/sqlite-fts.ts";
17
20
  export { SQLITE_SESSION_SQL } from "./dialects/sqlite-session.ts";
18
21
  export { sql, isSqlFragment, renderSqlFragment, compileSql, sqlUsesIncoming, mapConflictColumns } from "./composable.ts";
19
22
  export type { SqlFragment, SqlTag } from "./composable.ts";
20
- export { decode } from "./result-decoder.ts";
21
- export type { ResultDecoder, Decoded, ExtendedDateTime } from "./result-decoder.ts";
23
+ export { createSqlQuery, createSqlCommand, isSqlQuery, isSqlCommand, compileSqlQuery, compileSqlCommand } from "./query-plan.ts";
24
+ export type { SqlQuery, SqlCommand, SqlPlanRender, CompiledSqlQuery, CompiledSqlCommand, ReusableSqlQuery, ReusableSqlCommand } from "./query-plan.ts";
25
+ export { createReusableSqlQuery, createReusableSqlCommand, isReusableSqlQuery, isReusableSqlCommand, compileReusableSqlQuery, compileReusableSqlCommand } from "./query-plan.ts";
26
+ export { isSqlParam, createSqlInput, sqlInputContract, createSqlInputScope, sealSqlInputScope, assertSqlParamBuilding, sqlParamContract } from "./sql-input.ts";
27
+ export type { SqlParam, SqlInput, SqlInputMap, SqlInputValue, SqlInputValues, SqlInputTokens, SqlExecutionParams, SqlInputContract, SqlInputScope } from "./sql-input.ts";
28
+ export { isSqlBindingCollector, recordSqlBinding, recordSqlBindingCheck } from "./sql-bindings.ts";
29
+ export type { SqlBindingSource, SqlParameterTransport, SqlBindingEncoder } from "./sql-bindings.ts";
30
+ export { decode, encode, resultScalarContract } from "./result-decoder.ts";
31
+ export type { ResultDecoder, ResultReadDecoder, ResultParameterEncoder, ResultScalarContract, Decoded, ExtendedDateTime } from "./result-decoder.ts";
22
32
  /**
23
33
  * @vibeorm/sql — dialect-aware SQL layer for VibeORM v2.
24
34
  *
@@ -26,8 +36,8 @@ export type { ResultDecoder, Decoded, ExtendedDateTime } from "./result-decoder.
26
36
  * lives in this package; see the root sql-catalog.md for the reviewable surface.
27
37
  */
28
38
  export { compileExclusion, renderExclusionSetup, renderExclusionDdl, renderExclusionCatalog, renderExclusionProbe } from "./exclusion.ts";
29
- export type { AdvisoryLockKey, AdvisoryLockStatement, AggFn, AggRef, AggSelect, ColRef, ComparisonOp, DeleteStatement, ExcludedRef, InnerJoin, InsertStatement, JsonFilterOp, LateralJoin, ListSetOperation, OnConflictClause, OnConflictDoNothing, OnConflictUpdate, OrderByAggregate, OrderByColumn, OrderBySubquery, OrderTerm, RowLock, RowNumberProjection, DbNowMarker, JsonParamCell, SelectExpr, SelectStatement, SetOperation, SetOperator, SqlExpr, SqlStatement, TableRef, UpdateStatement, } from "./ast.ts";
30
- export { ADVISORY_LOCK_RESULT_COLUMN, SQL_DEFAULT_CELL, dbNowMarker, excludedRef, isDbNowMarker, isExcludedRef, isJsonParamCell, isListSetOperation, isSetOperation, isSqlDefaultCell, jsonParamCell, } from "./ast.ts";
39
+ 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";
40
+ 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";
31
41
  export type { AdvisoryLockFunctions, AdvisoryLockModeFunctions, RowLockSyntax, SqlDialect, } from "./dialect.ts";
32
42
  export { ADVISORY_KEY_BOUNDS, describeRowLock, renderAdvisoryLock, renderRowLockClause } from "./locks.ts";
33
43
  export { JSON_TRANSPORT, projectionOutputName } from "./json-transport.ts";
@@ -39,10 +49,11 @@ export { tableDefinitionParts } from "./dialects/sqlite-table-definition.ts";
39
49
  export { renderPredicate } from "./predicate.ts";
40
50
  export type { PredicateModel, PredicateUsage } from "./predicate.ts";
41
51
  export { DIALECT_CAPABILITIES, MYSQL_CAPABILITIES, POSTGRES_CAPABILITIES, SQLITE_CAPABILITIES, } from "./capabilities.ts";
42
- export { DIALECT_CODECS, MYSQL_CODECS, POSTGRES_CODECS, SQLITE_CODECS, decodeIsNoop, enumMembershipCodec, parseDateTimeText, } from "./codecs.ts";
52
+ export { DIALECT_CODECS, MYSQL_CODECS, POSTGRES_CODECS, SQLITE_CODECS, decodeIsNoop, enumMembershipCodec, float32Codec, parseDateTimeText, parseJsonText, postgresArrayElementFromText, shortestFloat32, timeOfDayCodec, } from "./codecs.ts";
43
53
  export type { CodecTable, ScalarCodec, WireFidelity } from "./codecs.ts";
44
- export { renderExpr, renderFragment, renderStatement } from "./render.ts";
54
+ export { renderExpr, renderFragment, renderProjection, renderStatement } from "./render.ts";
45
55
  export type { RenderedQuery } from "./render.ts";
56
+ export { snapshotSqlValue } from "./parameter-snapshot.ts";
46
57
  export { ParamCollector } from "./params.ts";
47
58
  export { NATIVE_RLS, renderRlsColumnType, renderRlsContext, renderRlsDisable, renderRlsDropPolicy, renderRlsEnable, renderRlsForce, renderRlsNoForce, renderRlsPolicy, renderRlsPredicate, renderRlsRole } from "./dialects/postgres-rls.ts";
48
59
  export type { RlsContextStatement, RlsDisableStatement, RlsDropPolicyStatement, RlsEnableStatement, RlsForceStatement, RlsNoForceStatement, RlsPolicyStatement, RlsRoleStatement } from "./ast.ts";
@@ -69,5 +80,6 @@ export { POSTGRES_DIAGNOSTIC_SQL, POSTGRES_WORKLOAD_LIMITS, renderPostgresExplai
69
80
  export type { PostgresExplainOptions, PostgresWorkloadQuery } from "./dialects/postgres-diagnostics.ts";
70
81
  export { renderColumnStateQuery, renderConstraintStateQuery, renderIndexStateQuery, renderMigrationSessionRead, renderMigrationSessionRestore, renderMigrationSessionSet, renderRelationStateQuery, } from "./dialects/postgres-migration.ts";
71
82
  export type { MigrationSessionSetting } from "./dialects/postgres-migration.ts";
72
- export { parsePgArrayLiteral, toPgArrayLiteral } from "./pg-array.ts";
83
+ export { parsePgArrayLiteral, parsePgArrayLiteralNested, toPgArrayLiteral } from "./pg-array.ts";
84
+ export type { PgArrayLiteralElement } from "./pg-array.ts";
73
85
  //# sourceMappingURL=index.d.ts.map