kern-orm 0.6.0 → 0.7.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/{database-CP4oapsQ.mjs → database-B7Kf5Q9X.mjs} +261 -31
- package/dist/{index-CoKpXcBp.d.mts → index-CLKi9gZL.d.mts} +239 -36
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs +21 -3
- package/dist/{text-Cti9QLK7.mjs → text-CIUxPWPl.mjs} +1 -0
- package/dist/{types-DfoL8Oi9.mjs → types-D3d35qR2.mjs} +4 -13
- package/dist/types.d.mts +3 -8
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as NoRelations, $n as
|
|
2
|
-
export { type AggregateExpression, type AggregateOptions, type AnyColumn, type AnyDb, type AnyExpression, type AnyMutationQuery, type AnyQuery, type AnyRecordQuery, type AnySchema, type AnySelectQuery, type AnySqlQuery, type AnyTable, type AnyTableKeys, type AnyTransformedQuery, type AnyType, type BaseOperators, type BaseType, type BindOptions, type BooleanResult, type BoundOperators, type BoundSelectQuery, type CaseBranch, type CaseCondition, type CaseValue, type Column, type ColumnAttributes, type ColumnDefinitions, type ColumnFieldTypes, type ColumnOperators, type ColumnRefKey, type ColumnRefs, type ColumnShape, type ColumnValue, type ColumnValues, type CombinedCondition, type ComparisonSignature, type CompileOptions, type Condition, type ConditionOperand, type Connection, type CountExpression, type CountValueType, type Database, type DatabaseOptions, type Db, type DbMutationState, type DbOf, type DbQueryState, type DeclaredRelations, type DecodedFields, type Driver, type DriverResult, type EmptyRecord, type EqValue, type EqualityOperator, type EqualityOperators, type ExistsValueType, type Expression, type ExpressionInput, type ExpressionOperators, type ExpressionValue, FALSE, type FieldTypes, type FilteredRows, type FilteredStateRows, type FollowingOperand, type GenericOperator, type GenericOperatorImplementation, type GroupAggregateExpression, type GroupOperandValue, type GroupSelectionResult, type GroupTerm, type GroupTerms, type GroupValue, type Grouped, type GroupedField, type GroupedRecord, type GroupedState, type HasEquality, type Helper, type HelperEffect, type InSignature, type InitialMutationState, type InitialQueryState, type InitialSqlQueryState, type InsertValues, type KeyCheck, type KeyColumns, type KeyKind, type Literal, type MatchCheck, type MatchResult, type MergeOperators, type MergeRelations, type MergeSelection, type MutationQuery, type MutationQueryState, type NestedQuery, type NoOperators, type NoRelations, type NotAColumn, type NotAKey, NotFoundError, type NotSynchronous, type NullSkippingResult, type NumberTypeOperators, type OneRelationKeys, type OneRow, type OneValueRows, type Operand, type OperandUses, type OperandValue, type OperatorDefinitions, type OperatorSignature, type OrderColumns, type OrderDirection, type OrderKey, type OrderTerm, type OrderTerms, type Ordering, type PatternSignature, type Predicate, type PrimaryKeyValues, type QueryContext, type QueryResult, type QueryState, type QueryStateOf, type QueryValueType, type RecordQuery, type RecordQueryState, type Relation, type RelationDeclaration, type RelationDeclarations, type RelationKey, type RelationKeys, type RelationKind, type RelationRefs, type RequiredMember, RequiredRelationError, type ResultByRows, ResultDecodeError, type ResultMode, type ResultOf, type ResultRows, type RowLockOptions, type ScalarQuery, type Schema, type SchemaContext, type SchemaPart, type SchemaPartRelations, type SchemaRelations, type SchemaTables, type SelectQuery, type SelectQueryKind, type SelectQueryState, type Selectable, type SelectedFieldTypes, type SelectedOperandType, type SelectedRefs, type Selection, type SelectionFieldTypes, type SelectionResult, type SelectionState, type SelectionUses, type SqlQuery, type SqlQueryState, type SqlStatement, type SqlTemplate, type StringAggOptions, type SynchronousResult, TRUE, type Table, type TableContext, type TableFactoryOptions, type TableKeys, type TableOptions, type TableRelations, type Tables, type TextConversionSignature, type TextLengthSignature, type TextOperators, type TextTypeOperators, type TextValue, type ToColumn, type ToColumns, type TransactionCoordinator, type TransactionFailure, type TransactionOptions, type TransformedQuery, type TransformedQueryState, type Type, type TypeInput, type TypeOperators, type TypeOptions, type TypeOutput, type TypeTransform, type TypedExpression, type TypedOperand, type TypedOperandInput, type TypedOperandOperators, type TypedScalarQuery, type UnfilteredAggregateOptions, type UnfilteredStringAggOptions, type UntypedExpression, type UpdateSet, type UpdateValues, type UsableRelation, type UsedRelation, type ValueRows, type ValuesQuery, type WhereCallback, type WhereCondition, type WhereFilter, type WhereValues, and, asc, avg, caseWhen, coalesce, compare, count, countDistinct, createDatabase, createStatement, createTableFactory, defineExpression, defineGenericOperator, defineHelper, defineSchema, defineTable, defineType, desc, equalityOperators, every, from, greatest, identifier, least, literal, many, matches, max, min, not, one, or, orderBy, orderingOperators, param, some, sql, stringAgg, sum, textOperators, toSnakeCase };
|
|
1
|
+
import { $ as NoRelations, $i as BoundOperators, $n as ResultOf, $r as ScalarQuery, $t as TypedOperandInput, A as Db, Ai as ResultMode, An as count, Ar as and, At as DecodedFields, Bi as TextValue, Bn as OrderKey, Br as CountValueType, Bt as InitialMutationState, C as BaseOperators, Ci as TableOptions, Cn as CountExpression, Cr as WhereCondition, Ct as AnyRecordQuery, D as UntypedExpression, Di as NotFoundError, Dn as UnfilteredAggregateOptions, Dr as Condition, Dt as AnyQuery, E as TypedExpression, Ei as defineTable, En as StringAggOptions, Er as CombinedCondition, Et as SelectionState, F as DatabaseOptions, Fi as SqlStatement, Fn as some, Fr as OneRow, Ft as AnyMutationQuery, Gi as TypeOutput, Gn as asc, Gr as InSignature, Gt as HelperEffect, Hi as TypeInput, Hn as OrderTerms, Hr as EqualityOperator, Ht as MutationQuery, I as TransactionOptions, Ii as TransactionFailure, In as stringAgg, Ir as OneValueRows, It as ConflictActionRequired, J as SynchronousResult, Ji as AnyColumn, Jn as ColumnRefs, Jr as ComparisonSignature, Jt as CaseCondition, K as AnyTransformedQuery, Ki as TypeTransform, Kn as desc, Kr as equalityOperators, Kt as defineHelper, L as createDatabase, Li as createStatement, Ln as sum, Lr as QueryResult, Lt as ConflictKeyRequired, M as DbOf, Mi as Connection, Mn as every, Mr as or, Mt as InitialSqlQueryState, N as DbQueryState, Ni as Driver, Nn as max, Nr as ExistsValueType, Nt as SqlQuery, O as AnyDb, Oi as RequiredRelationError, On as UnfilteredStringAggOptions, Or as ConditionOperand, Ot as SelectQueryKind, P as Database, Pi as DriverResult, Pn as min, Pr as FilteredRows, Pt as SqlQueryState, Q as MergeRelations, Qi as ToColumn, Qn as BoundSelectQuery, Qr as OperandUses, Qt as TypedOperand, R as TransactionCoordinator, Ri as AnyType, Rn as OrderColumns, Rr as ResultByRows, Rt as ConflictTarget, S as AnyExpression, Si as TableKeys, Sn as AggregateOptions, Sr as WhereCallback, St as defineSchema, T as ExpressionOperators, Ti as createTableFactory, Tn as GroupValue, Tr as WhereValues, Tt as RecordQueryState, Ui as TypeOperators, Un as Ordering, Ur as EqualityOperators, Ut as MutationQueryState, Vi as Type, Vn as OrderTerm, Vr as CompileOptions, Vt as InsertMutationState, Wi as TypeOptions, Wn as SelectedRefs, Wr as HasEquality, Wt as Helper, X as TransformedQueryState, Xi as ColumnAttributes, Xn as RelationRefs, Xr as OperandValue, Xt as FollowingOperand, Y as TransformedQuery, Yi as Column, Yn as QueryContext, Yr as Operand, Yt as CaseValue, Z as DeclaredRelations, Zi as KeyKind, Zn as AnySelectQuery, Zr as compare, Zt as NullSkippingResult, _ as TextOperators, _i as ColumnValues, _n as SelectionResult, _r as KeyCheck, _t as Schema, a as sql, aa as OperatorSignature, ai as InitialQueryState, an as ColumnFieldTypes, ar as InsertValues, at as RelationKeys, b as NumberTypeOperators, bi as Table, bn as literal, br as PrimaryKeyValues, bt as SchemaTables, c as MatchResult, ci as QueryValueType, cn as GroupOperandValue, cr as UpsertValues, ct as SchemaContext, d as defineExpression, di as TableQueryState, dn as GroupedRecord, dr as FoundState, dt as TableRelations, ea as MergeOperators, ei as TypedScalarQuery, en as TypedOperandOperators, er as SelectQuery, et as OneRelationKeys, f as FALSE, fi as AnyTable, fn as MergeSelection, fr as GroupedState, ft as UsableRelation, g as TextLengthSignature, gi as ColumnShape, gn as SelectionFieldTypes, gr as GroupTerms, gt as AnySchema, h as TextConversionSignature, hi as ColumnOperators, hn as Selection, hr as GroupTerm, ht as one, i as param, ia as GenericOperatorImplementation, ii as Grouped, in as least, ir as ConflictUpdateSet, it as RelationKey, j as DbMutationState, ji as ResultRows, jn as countDistinct, jr as not, jt as FieldTypes, k as BindOptions, ki as ResultDecodeError, kn as avg, kr as Predicate, kt as AnySqlQuery, l as NotAColumn, li as SelectQueryState, ln as GroupSelectionResult, lr as FilteredStateRows, lt as SchemaRelations, m as PatternSignature, mi as ColumnDefinitions, mn as SelectedFieldTypes, mr as RowLockOptions, mt as many, n as SqlTemplate, na as OperatorDefinitions, ni as EmptyRecord, nn as coalesce, nr as from, nt as RelationDeclaration, o as ColumnRefKey, oa as defineGenericOperator, oi as QueryState, on as ExpressionInput, or as UpdateSet, ot as RelationKind, p as TRUE, pi as AnyTableKeys, pn as NestedQuery, pr as SelectedOperandType, pt as UsedRelation, q as NotSynchronous, qi as defineType, qn as orderBy, qr as BooleanResult, qt as CaseBranch, r as identifier, ra as GenericOperator, ri as FoundKey, rn as greatest, rr as ColumnValue, rt as RelationDeclarations, s as MatchCheck, si as QueryStateOf, sn as ExpressionValue, sr as UpdateValues, st as RequiredMember, t as toSnakeCase, ta as NoOperators, ti as ValuesQuery, tn as caseWhen, tr as SingletonInsertMany, tt as Relation, u as matches, ui as SingletonQueryState, un as GroupedField, ur as FoundQueryState, ut as TableContext, v as TextTypeOperators, vi as KeyColumns, vn as SelectionUses, vr as NotAKey, vt as SchemaPart, w as Expression, wi as ToColumns, wn as GroupAggregateExpression, wr as WhereFilter, wt as RecordQuery, x as orderingOperators, xi as TableFactoryOptions, xn as AggregateExpression, xr as EqValue, xt as Tables, y as textOperators, yi as Selectable, yn as Literal, yr as PrimaryKeyColumn, yt as SchemaPartRelations, zi as BaseType, zn as OrderDirection, zr as ValueRows, zt as InitialInsertState } from "./index-CLKi9gZL.mjs";
|
|
2
|
+
export { type AggregateExpression, type AggregateOptions, type AnyColumn, type AnyDb, type AnyExpression, type AnyMutationQuery, type AnyQuery, type AnyRecordQuery, type AnySchema, type AnySelectQuery, type AnySqlQuery, type AnyTable, type AnyTableKeys, type AnyTransformedQuery, type AnyType, type BaseOperators, type BaseType, type BindOptions, type BooleanResult, type BoundOperators, type BoundSelectQuery, type CaseBranch, type CaseCondition, type CaseValue, type Column, type ColumnAttributes, type ColumnDefinitions, type ColumnFieldTypes, type ColumnOperators, type ColumnRefKey, type ColumnRefs, type ColumnShape, type ColumnValue, type ColumnValues, type CombinedCondition, type ComparisonSignature, type CompileOptions, type Condition, type ConditionOperand, type ConflictActionRequired, type ConflictKeyRequired, type ConflictTarget, type ConflictUpdateSet, type Connection, type CountExpression, type CountValueType, type Database, type DatabaseOptions, type Db, type DbMutationState, type DbOf, type DbQueryState, type DeclaredRelations, type DecodedFields, type Driver, type DriverResult, type EmptyRecord, type EqValue, type EqualityOperator, type EqualityOperators, type ExistsValueType, type Expression, type ExpressionInput, type ExpressionOperators, type ExpressionValue, FALSE, type FieldTypes, type FilteredRows, type FilteredStateRows, type FollowingOperand, type FoundKey, type FoundQueryState, type FoundState, type GenericOperator, type GenericOperatorImplementation, type GroupAggregateExpression, type GroupOperandValue, type GroupSelectionResult, type GroupTerm, type GroupTerms, type GroupValue, type Grouped, type GroupedField, type GroupedRecord, type GroupedState, type HasEquality, type Helper, type HelperEffect, type InSignature, type InitialInsertState, type InitialMutationState, type InitialQueryState, type InitialSqlQueryState, type InsertMutationState, type InsertValues, type KeyCheck, type KeyColumns, type KeyKind, type Literal, type MatchCheck, type MatchResult, type MergeOperators, type MergeRelations, type MergeSelection, type MutationQuery, type MutationQueryState, type NestedQuery, type NoOperators, type NoRelations, type NotAColumn, type NotAKey, NotFoundError, type NotSynchronous, type NullSkippingResult, type NumberTypeOperators, type OneRelationKeys, type OneRow, type OneValueRows, type Operand, type OperandUses, type OperandValue, type OperatorDefinitions, type OperatorSignature, type OrderColumns, type OrderDirection, type OrderKey, type OrderTerm, type OrderTerms, type Ordering, type PatternSignature, type Predicate, type PrimaryKeyColumn, type PrimaryKeyValues, type QueryContext, type QueryResult, type QueryState, type QueryStateOf, type QueryValueType, type RecordQuery, type RecordQueryState, type Relation, type RelationDeclaration, type RelationDeclarations, type RelationKey, type RelationKeys, type RelationKind, type RelationRefs, type RequiredMember, RequiredRelationError, type ResultByRows, ResultDecodeError, type ResultMode, type ResultOf, type ResultRows, type RowLockOptions, type ScalarQuery, type Schema, type SchemaContext, type SchemaPart, type SchemaPartRelations, type SchemaRelations, type SchemaTables, type SelectQuery, type SelectQueryKind, type SelectQueryState, type Selectable, type SelectedFieldTypes, type SelectedOperandType, type SelectedRefs, type Selection, type SelectionFieldTypes, type SelectionResult, type SelectionState, type SelectionUses, type SingletonInsertMany, type SingletonQueryState, type SqlQuery, type SqlQueryState, type SqlStatement, type SqlTemplate, type StringAggOptions, type SynchronousResult, TRUE, type Table, type TableContext, type TableFactoryOptions, type TableKeys, type TableOptions, type TableQueryState, type TableRelations, type Tables, type TextConversionSignature, type TextLengthSignature, type TextOperators, type TextTypeOperators, type TextValue, type ToColumn, type ToColumns, type TransactionCoordinator, type TransactionFailure, type TransactionOptions, type TransformedQuery, type TransformedQueryState, type Type, type TypeInput, type TypeOperators, type TypeOptions, type TypeOutput, type TypeTransform, type TypedExpression, type TypedOperand, type TypedOperandInput, type TypedOperandOperators, type TypedScalarQuery, type UnfilteredAggregateOptions, type UnfilteredStringAggOptions, type UntypedExpression, type UpdateSet, type UpdateValues, type UpsertValues, type UsableRelation, type UsedRelation, type ValueRows, type ValuesQuery, type WhereCallback, type WhereCondition, type WhereFilter, type WhereValues, and, asc, avg, caseWhen, coalesce, compare, count, countDistinct, createDatabase, createStatement, createTableFactory, defineExpression, defineGenericOperator, defineHelper, defineSchema, defineTable, defineType, desc, equalityOperators, every, from, greatest, identifier, least, literal, many, matches, max, min, not, one, or, orderBy, orderingOperators, param, some, sql, stringAgg, sum, textOperators, toSnakeCase };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as noOrder, C as toNode, D as isType, E as defineType, F as createNode, L as falseNode, N as defineGenericOperator, P as createList, S as toFunctionOperandNode, T as getBooleanType, U as trueNode, _ as isOperandSource, b as toCastValueNode, c as textOperators, d as orderingOperators, f as compare, g as isExpression, h as getType, k as equalityOperators, v as operandNode, x as toExpression, y as toBooleanExpression } from "./text-
|
|
2
|
-
import { A as not, C as countType, D as literal, E as toAggregateType, M as combineNodes, O as and, S as countProjection, T as createCountCall, _ as createTableFactory, a as defineSchema, b as RequiredRelationError, c as requireDerived, d as desc, f as orderBy, g as createStatement, h as one, i as sql, j as or, k as isColumnValues, l as addTerms, m as many, n as identifier, o as SelectQuery, p as matchColumn, r as param, s as from, t as createDatabase, u as asc, v as defineTable, w as createAggregateCall, x as ResultDecodeError, y as NotFoundError } from "./database-
|
|
1
|
+
import { B as noOrder, C as toNode, D as isType, E as defineType, F as createNode, L as falseNode, N as defineGenericOperator, P as createList, S as toFunctionOperandNode, T as getBooleanType, U as trueNode, _ as isOperandSource, b as toCastValueNode, c as textOperators, d as orderingOperators, f as compare, g as isExpression, h as getType, k as equalityOperators, v as operandNode, x as toExpression, y as toBooleanExpression } from "./text-CIUxPWPl.mjs";
|
|
2
|
+
import { A as not, C as countType, D as literal, E as toAggregateType, M as combineNodes, O as and, S as countProjection, T as createCountCall, _ as createTableFactory, a as defineSchema, b as RequiredRelationError, c as requireDerived, d as desc, f as orderBy, g as createStatement, h as one, i as sql, j as or, k as isColumnValues, l as addTerms, m as many, n as identifier, o as SelectQuery, p as matchColumn, r as param, s as from, t as createDatabase, u as asc, v as defineTable, w as createAggregateCall, x as ResultDecodeError, y as NotFoundError } from "./database-B7Kf5Q9X.mjs";
|
|
3
3
|
// src/expression/constants.ts
|
|
4
4
|
/** Condition that always holds, such as for a branch of `and` built in code: `and(check, isAdmin ? TRUE : other)`. */
|
|
5
5
|
const TRUE = /* @__PURE__ */ toExpression(trueNode, /* @__PURE__ */ getBooleanType());
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as PendingTestFixture, G as createTestHelpers, H as TestHelpers, U as TestHooks, V as TestFixture, W as TestTransactionOptions,
|
|
1
|
+
import { B as PendingTestFixture, G as createTestHelpers, H as TestHelpers, Ni as Driver, U as TestHooks, V as TestFixture, W as TestTransactionOptions, z as OpenedTestFixture } from "./index-CLKi9gZL.mjs";
|
|
2
2
|
/** Options of `describeDriverContract`: how to create the driver under test. */
|
|
3
3
|
interface DriverContractOptions {
|
|
4
4
|
/** Creates a driver over a new client of the test database with `max` connections. */
|
package/dist/testing.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as text, t as char } from "./text-
|
|
2
|
-
import { O as and, a as defineSchema, g as createStatement, i as sql, r as param, t as createDatabase, v as defineTable } from "./database-
|
|
3
|
-
import { _ as timestamptz, a as numeric, b as array, d as jsonb, f as enumOf, g as timestamp, h as time, i as integer, l as inet, m as interval, n as bigint, p as date, r as doublePrecision, t as uuid, v as boolean, y as bytea } from "./types-
|
|
1
|
+
import { n as text, t as char } from "./text-CIUxPWPl.mjs";
|
|
2
|
+
import { O as and, a as defineSchema, g as createStatement, i as sql, r as param, t as createDatabase, v as defineTable } from "./database-B7Kf5Q9X.mjs";
|
|
3
|
+
import { _ as timestamptz, a as numeric, b as array, d as jsonb, f as enumOf, g as timestamp, h as time, i as integer, l as inet, m as interval, n as bigint, p as date, r as doublePrecision, t as uuid, v as boolean, y as bytea } from "./types-D3d35qR2.mjs";
|
|
4
4
|
import assert from "node:assert/strict";
|
|
5
5
|
// src/execution/testing.ts
|
|
6
6
|
/** Creates the test helpers of a database created with `test: true`, registering fixtures with the hooks of a test runner. */
|
|
@@ -353,6 +353,24 @@ function describeDriverContract(options, runner) {
|
|
|
353
353
|
assert.equal(await query, "slept");
|
|
354
354
|
assert.deepEqual(settled, ["query", "database"]);
|
|
355
355
|
});
|
|
356
|
+
it("rejects a statement, a script, and a connection requested right after it starts", async () => {
|
|
357
|
+
const driver = createDriver({ max: 1 });
|
|
358
|
+
const held = await driver.acquire();
|
|
359
|
+
const closing = driver.close();
|
|
360
|
+
const acquiring = driver.acquire();
|
|
361
|
+
const rejections = [
|
|
362
|
+
assert.rejects(driver.execute(createStatement("SELECT 1"))),
|
|
363
|
+
assert.rejects(driver.executeScript("SELECT 1")),
|
|
364
|
+
assert.rejects(acquiring)
|
|
365
|
+
];
|
|
366
|
+
acquiring.then((connection) => connection.release()).catch(() => {});
|
|
367
|
+
await held.release();
|
|
368
|
+
try {
|
|
369
|
+
await Promise.all(rejections);
|
|
370
|
+
} finally {
|
|
371
|
+
await closing;
|
|
372
|
+
}
|
|
373
|
+
});
|
|
356
374
|
});
|
|
357
375
|
describe("in test transactions", () => {
|
|
358
376
|
const database = createDatabase({
|
|
@@ -240,6 +240,7 @@ function createType(state) {
|
|
|
240
240
|
withParameters: (format) => derive({ formatSqlType: format }),
|
|
241
241
|
...formatSqlType && { with: (...parameters) => derive({ sqlType: formatSqlType(...parameters) }) },
|
|
242
242
|
nullable: () => derive({ isNullable: true }),
|
|
243
|
+
of: () => type,
|
|
243
244
|
columnName: (name) => new Column(type, {
|
|
244
245
|
name,
|
|
245
246
|
keyKind: void 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as hasEquality, E as defineType, T as getBooleanType, a as stringifyJson, d as orderingOperators, i as formatTypeName, k as equalityOperators, l as defineNumberType, o as decodeBytea, s as encodeBytea, u as getIntegerType } from "./text-
|
|
1
|
+
import { A as hasEquality, E as defineType, T as getBooleanType, a as stringifyJson, d as orderingOperators, i as formatTypeName, k as equalityOperators, l as defineNumberType, o as decodeBytea, s as encodeBytea, u as getIntegerType } from "./text-CIUxPWPl.mjs";
|
|
2
2
|
// src/type/builtins/array.ts
|
|
3
3
|
/**
|
|
4
4
|
* Creates a one-dimensional array type of `element` values.
|
|
@@ -196,10 +196,7 @@ function enumOf(name, _values) {
|
|
|
196
196
|
return defineType({
|
|
197
197
|
sqlType: name,
|
|
198
198
|
castType: name
|
|
199
|
-
}).
|
|
200
|
-
decode: (value) => value,
|
|
201
|
-
encode: (value) => value
|
|
202
|
-
}).withOperators(orderingOperators);
|
|
199
|
+
}).withOperators(orderingOperators).of();
|
|
203
200
|
}
|
|
204
201
|
// src/type/builtins/json.ts
|
|
205
202
|
function createJsonType(sqlType) {
|
|
@@ -208,16 +205,10 @@ function createJsonType(sqlType) {
|
|
|
208
205
|
encode: stringifyJson
|
|
209
206
|
});
|
|
210
207
|
}
|
|
211
|
-
function addShape(type) {
|
|
212
|
-
return Object.freeze({
|
|
213
|
-
...type,
|
|
214
|
-
of: () => type
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
208
|
/** `json` values; `json.of<T>()` declares their shape. PostgreSQL has no `=` for `json`, so its expressions have no `eq`, `ne`, or `in`. */
|
|
218
|
-
const json = /* @__PURE__ */
|
|
209
|
+
const json = /* @__PURE__ */ createJsonType("json");
|
|
219
210
|
/** `jsonb` values; `jsonb.of<T>()` declares their shape. */
|
|
220
|
-
const jsonb = /* @__PURE__ */
|
|
211
|
+
const jsonb = /* @__PURE__ */ createJsonType("jsonb").withOperators(equalityOperators);
|
|
221
212
|
// src/type/builtins/network.ts
|
|
222
213
|
/** IP address with an optional netmask as a string, such as `192.168.0.1`. */
|
|
223
214
|
const inet = /* @__PURE__ */ defineType({ sqlType: "inet" }).withOperators(orderingOperators);
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gr as InSignature, Hr as EqualityOperator, Jr as ComparisonSignature, S as AnyExpression, Ur as EqualityOperators, Vi as Type, Wr as HasEquality, _ as TextOperators, b as NumberTypeOperators, ea as MergeOperators, na as OperatorDefinitions, ra as GenericOperator, ta as NoOperators, v as TextTypeOperators, zi as BaseType } from "./index-CLKi9gZL.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a one-dimensional array type of `element` values.
|
|
4
4
|
*
|
|
@@ -71,15 +71,10 @@ declare function enumOf<const Values extends readonly string[]>(name: string, _v
|
|
|
71
71
|
gt: GenericOperator<ComparisonSignature, AnyExpression<unknown, unknown>>;
|
|
72
72
|
gte: GenericOperator<ComparisonSignature, AnyExpression<unknown, unknown>>;
|
|
73
73
|
}>, undefined>;
|
|
74
|
-
/** JSON type of `unknown` values with operators `O` and `of`, which declares their shape. */
|
|
75
|
-
type JsonType<O extends OperatorDefinitions = NoOperators> = Type<unknown, unknown, O> & {
|
|
76
|
-
/** Declares the shape of the values, which is not validated at runtime. */
|
|
77
|
-
of<T>(): Type<T, T, O>;
|
|
78
|
-
};
|
|
79
74
|
/** `json` values; `json.of<T>()` declares their shape. PostgreSQL has no `=` for `json`, so its expressions have no `eq`, `ne`, or `in`. */
|
|
80
|
-
export declare const json:
|
|
75
|
+
export declare const json: BaseType<unknown, {}, NoOperators, undefined>;
|
|
81
76
|
/** `jsonb` values; `jsonb.of<T>()` declares their shape. */
|
|
82
|
-
export declare const jsonb:
|
|
77
|
+
export declare const jsonb: BaseType<unknown, {}, MergeOperators<NoOperators, EqualityOperators>, undefined>;
|
|
83
78
|
/** IP address with an optional netmask as a string, such as `192.168.0.1`. */
|
|
84
79
|
export declare const inet: BaseType<string, string, MergeOperators<NoOperators, {
|
|
85
80
|
eq: EqualityOperator<ComparisonSignature>;
|
package/dist/types.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as text, r as varchar, t as char } from "./text-
|
|
2
|
-
import { _ as timestamptz, a as numeric, b as array, c as cidr, d as jsonb, f as enumOf, g as timestamp, h as time, i as integer, l as inet, m as interval, n as bigint, o as real, p as date, r as doublePrecision, s as smallint, t as uuid, u as json, v as boolean, y as bytea } from "./types-
|
|
1
|
+
import { n as text, r as varchar, t as char } from "./text-CIUxPWPl.mjs";
|
|
2
|
+
import { _ as timestamptz, a as numeric, b as array, c as cidr, d as jsonb, f as enumOf, g as timestamp, h as time, i as integer, l as inet, m as interval, n as bigint, o as real, p as date, r as doublePrecision, s as smallint, t as uuid, u as json, v as boolean, y as bytea } from "./types-D3d35qR2.mjs";
|
|
3
3
|
export { array, bigint, boolean, bytea, char, cidr, date, doublePrecision, enumOf as enum, inet, integer, interval, json, jsonb, numeric, real, smallint, text, time, timestamp, timestamptz, uuid, varchar };
|