@dbsp/core 1.4.0 → 1.5.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/index.d.ts +43 -11
- package/dist/index.js +661 -124
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5131,7 +5131,28 @@ interface GeneratedColumn {
|
|
|
5131
5131
|
/**
|
|
5132
5132
|
* Table definition in generated schema.
|
|
5133
5133
|
*/
|
|
5134
|
-
|
|
5134
|
+
interface GeneratedForeignKey {
|
|
5135
|
+
readonly columns: readonly string[];
|
|
5136
|
+
readonly references: {
|
|
5137
|
+
readonly table: string;
|
|
5138
|
+
readonly columns: readonly string[];
|
|
5139
|
+
};
|
|
5140
|
+
readonly onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
|
|
5141
|
+
readonly onUpdate?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
|
|
5142
|
+
}
|
|
5143
|
+
interface GeneratedIndex {
|
|
5144
|
+
readonly columns: readonly string[];
|
|
5145
|
+
readonly unique?: boolean;
|
|
5146
|
+
readonly name?: string;
|
|
5147
|
+
}
|
|
5148
|
+
interface GeneratedTableWithConfig {
|
|
5149
|
+
readonly columns: Record<string, GeneratedColumn>;
|
|
5150
|
+
readonly primaryKey?: string | readonly string[];
|
|
5151
|
+
readonly foreignKeys?: readonly GeneratedForeignKey[];
|
|
5152
|
+
readonly indexes?: readonly GeneratedIndex[];
|
|
5153
|
+
}
|
|
5154
|
+
type GeneratedFlatTable = Record<string, GeneratedColumn>;
|
|
5155
|
+
type GeneratedTable = GeneratedFlatTable | GeneratedTableWithConfig;
|
|
5135
5156
|
/**
|
|
5136
5157
|
* Relation kind in generated schema (discriminated union).
|
|
5137
5158
|
*/
|
|
@@ -5146,8 +5167,8 @@ type GeneratedIncludeStrategy = 'join' | 'subquery' | 'cte' | 'lateral' | 'json_
|
|
|
5146
5167
|
interface GeneratedBelongsTo {
|
|
5147
5168
|
readonly kind: 'belongsTo';
|
|
5148
5169
|
readonly target: string;
|
|
5149
|
-
readonly foreignKey: string;
|
|
5150
|
-
readonly targetKey?: string;
|
|
5170
|
+
readonly foreignKey: string | readonly string[];
|
|
5171
|
+
readonly targetKey?: string | readonly string[];
|
|
5151
5172
|
readonly includeStrategy?: GeneratedIncludeStrategy;
|
|
5152
5173
|
}
|
|
5153
5174
|
/**
|
|
@@ -5156,8 +5177,8 @@ interface GeneratedBelongsTo {
|
|
|
5156
5177
|
interface GeneratedHasMany {
|
|
5157
5178
|
readonly kind: 'hasMany';
|
|
5158
5179
|
readonly target: string;
|
|
5159
|
-
readonly foreignKey: string;
|
|
5160
|
-
readonly sourceKey?: string;
|
|
5180
|
+
readonly foreignKey: string | readonly string[];
|
|
5181
|
+
readonly sourceKey?: string | readonly string[];
|
|
5161
5182
|
readonly includeStrategy?: GeneratedIncludeStrategy;
|
|
5162
5183
|
readonly cardinality?: 'one' | 'many';
|
|
5163
5184
|
}
|
|
@@ -5226,8 +5247,9 @@ type ColumnTypeToTS<T extends GeneratedColumnType> = T extends 'string' | 'text'
|
|
|
5226
5247
|
/**
|
|
5227
5248
|
* Infer the TypeScript row type from a GeneratedTable definition.
|
|
5228
5249
|
*/
|
|
5250
|
+
type GeneratedColumnsOf<T extends GeneratedTable> = T extends GeneratedTableWithConfig ? T['columns'] : T;
|
|
5229
5251
|
type InferRowType<T extends GeneratedTable> = {
|
|
5230
|
-
[K in keyof T]: T[K]['nullable'] extends true ? ColumnTypeToTS<T[K]['type']> | null : ColumnTypeToTS<T[K]['type']
|
|
5252
|
+
[K in keyof GeneratedColumnsOf<T>]: GeneratedColumnsOf<T>[K] extends GeneratedColumn ? GeneratedColumnsOf<T>[K]['nullable'] extends true ? ColumnTypeToTS<GeneratedColumnsOf<T>[K]['type']> | null : ColumnTypeToTS<GeneratedColumnsOf<T>[K]['type']> : never;
|
|
5231
5253
|
};
|
|
5232
5254
|
/**
|
|
5233
5255
|
* Infer the database type from a GeneratedSchema.
|
|
@@ -5342,7 +5364,16 @@ declare const ResolvedSchemaValidation: v.ObjectSchema<{
|
|
|
5342
5364
|
}, undefined>, undefined>;
|
|
5343
5365
|
readonly index: v.OptionalSchema<v.UnionSchema<[v.BooleanSchema<undefined>, v.StringSchema<undefined>], undefined>, undefined>;
|
|
5344
5366
|
}, undefined>, undefined>]>;
|
|
5345
|
-
readonly primaryKey: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
5367
|
+
readonly primaryKey: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>, undefined>;
|
|
5368
|
+
readonly foreignKeys: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
5369
|
+
readonly columns: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
5370
|
+
readonly references: v.ObjectSchema<{
|
|
5371
|
+
readonly table: v.StringSchema<undefined>;
|
|
5372
|
+
readonly columns: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
5373
|
+
}, undefined>;
|
|
5374
|
+
readonly onDelete: v.OptionalSchema<v.PicklistSchema<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION"], undefined>, undefined>;
|
|
5375
|
+
readonly onUpdate: v.OptionalSchema<v.PicklistSchema<["CASCADE", "SET NULL", "RESTRICT", "NO ACTION"], undefined>, undefined>;
|
|
5376
|
+
}, undefined>, undefined>, undefined>;
|
|
5346
5377
|
readonly indexes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
5347
5378
|
readonly columns: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
5348
5379
|
readonly unique: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
@@ -5368,14 +5399,14 @@ declare const ResolvedSchemaValidation: v.ObjectSchema<{
|
|
|
5368
5399
|
readonly relations: v.SchemaWithPipe<readonly [v.UnknownSchema, v.CheckAction<unknown, "Schema keys must not include prototype-pollution names (__proto__, constructor, prototype)">, v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"kind", [v.ObjectSchema<{
|
|
5369
5400
|
readonly kind: v.LiteralSchema<"belongsTo", undefined>;
|
|
5370
5401
|
readonly target: v.StringSchema<undefined>;
|
|
5371
|
-
readonly foreignKey: v.StringSchema<undefined>;
|
|
5372
|
-
readonly targetKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
5402
|
+
readonly foreignKey: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
5403
|
+
readonly targetKey: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>, undefined>;
|
|
5373
5404
|
readonly includeStrategy: v.OptionalSchema<v.PicklistSchema<["join", "subquery", "cte", "lateral", "json_agg", "auto"], undefined>, undefined>;
|
|
5374
5405
|
}, undefined>, v.ObjectSchema<{
|
|
5375
5406
|
readonly kind: v.LiteralSchema<"hasMany", undefined>;
|
|
5376
5407
|
readonly target: v.StringSchema<undefined>;
|
|
5377
|
-
readonly foreignKey: v.StringSchema<undefined>;
|
|
5378
|
-
readonly sourceKey: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
5408
|
+
readonly foreignKey: v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>;
|
|
5409
|
+
readonly sourceKey: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>], undefined>, undefined>;
|
|
5379
5410
|
readonly includeStrategy: v.OptionalSchema<v.PicklistSchema<["join", "subquery", "cte", "lateral", "json_agg", "auto"], undefined>, undefined>;
|
|
5380
5411
|
}, undefined>, v.ObjectSchema<{
|
|
5381
5412
|
readonly kind: v.LiteralSchema<"manyToMany", undefined>;
|
|
@@ -7914,6 +7945,7 @@ declare class ResultHydrator<TResult = unknown> {
|
|
|
7914
7945
|
* case (slower but collision-safe for any value content).
|
|
7915
7946
|
*/
|
|
7916
7947
|
private extractKeyValue;
|
|
7948
|
+
private extractQueryKeyValue;
|
|
7917
7949
|
}
|
|
7918
7950
|
|
|
7919
7951
|
/**
|