@absolutejs/auth 0.56.7 → 0.56.9
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/agents/index.js +1459 -737
- package/dist/agents/index.js.map +31 -31
- package/dist/agents/postgresStores.d.ts +30 -10
- package/dist/cli/migrate.js +48 -43
- package/dist/cli/migrate.js.map +3 -3
- package/dist/index.js +1459 -737
- package/dist/index.js.map +31 -31
- package/dist/manifest.js +19 -2
- package/dist/manifest.js.map +3 -3
- package/dist/manifest.json +25 -1
- package/dist/oidc/index.js +1449 -732
- package/dist/oidc/index.js.map +30 -30
- package/dist/server.js +1459 -737
- package/dist/server.js.map +31 -31
- package/dist/vault/index.js +1449 -732
- package/dist/vault/index.js.map +30 -30
- package/package.json +3 -3
package/dist/agents/index.js
CHANGED
|
@@ -2187,6 +2187,9 @@ var SQL = class SQL2 {
|
|
|
2187
2187
|
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
2188
2188
|
return this;
|
|
2189
2189
|
}
|
|
2190
|
+
nullable() {
|
|
2191
|
+
return this;
|
|
2192
|
+
}
|
|
2190
2193
|
inlineParams() {
|
|
2191
2194
|
this.shouldInlineParams = true;
|
|
2192
2195
|
return this;
|
|
@@ -2372,9 +2375,10 @@ function fillPlaceholders(params, values) {
|
|
|
2372
2375
|
if (is(p, Param) && is(p.value, Placeholder)) {
|
|
2373
2376
|
if (!(p.value.name in values))
|
|
2374
2377
|
throw new Error(`No value for placeholder "${p.value.name}" was provided`);
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
+
const value = values[p.value.name];
|
|
2379
|
+
if (value === null)
|
|
2380
|
+
return value;
|
|
2381
|
+
const mapped = p.encoder.mapToDriverValue.isNoop ? value : p.encoder.mapToDriverValue(value);
|
|
2378
2382
|
return p.codec ? p.codec(mapped) : mapped;
|
|
2379
2383
|
}
|
|
2380
2384
|
return p;
|
|
@@ -2744,6 +2748,9 @@ var PgColumn = class extends Column {
|
|
|
2744
2748
|
}
|
|
2745
2749
|
return this;
|
|
2746
2750
|
}
|
|
2751
|
+
shouldDisableInsert() {
|
|
2752
|
+
return this.config.generatedIdentity !== undefined && this.config.generatedIdentity.type !== "byDefault" || this.config.generated !== undefined && this.config.generated.type !== "byDefault";
|
|
2753
|
+
}
|
|
2747
2754
|
mapArrayElements(value, mapper, depth) {
|
|
2748
2755
|
if (depth > 0 && Array.isArray(value))
|
|
2749
2756
|
return value.map((v) => v === null ? null : this.mapArrayElements(v, mapper, depth - 1));
|
|
@@ -3009,20 +3016,59 @@ function orderSelectedFields2(fields, pathPrefix, codecs) {
|
|
|
3009
3016
|
path: newPath,
|
|
3010
3017
|
field,
|
|
3011
3018
|
codec: codecs?.get(field, "normalize"),
|
|
3012
|
-
arrayDimensions: field.dimensions
|
|
3019
|
+
arrayDimensions: field.dimensions,
|
|
3020
|
+
column: field
|
|
3013
3021
|
});
|
|
3014
|
-
else if (is(field,
|
|
3015
|
-
|
|
3022
|
+
else if (is(field, SQL) || is(field, SQL.Aliased)) {
|
|
3023
|
+
const col = getColumnFromDecoder2(field);
|
|
3024
|
+
result.push(col ? {
|
|
3025
|
+
path: newPath,
|
|
3026
|
+
field,
|
|
3027
|
+
codec: codecs?.get(col, "normalize"),
|
|
3028
|
+
arrayDimensions: col.dimensions,
|
|
3029
|
+
column: col
|
|
3030
|
+
} : {
|
|
3031
|
+
path: newPath,
|
|
3032
|
+
field
|
|
3033
|
+
});
|
|
3034
|
+
} else if (is(field, Subquery)) {
|
|
3035
|
+
let column;
|
|
3036
|
+
const entry = Object.values(field._.selectedFields)[0];
|
|
3037
|
+
let fieldDecoder;
|
|
3038
|
+
if (is(entry, Column)) {
|
|
3039
|
+
column = entry;
|
|
3040
|
+
fieldDecoder = entry;
|
|
3041
|
+
} else if (is(entry, SQL)) {
|
|
3042
|
+
column = getColumnFromDecoder2(entry);
|
|
3043
|
+
fieldDecoder = entry.decoder;
|
|
3044
|
+
} else {
|
|
3045
|
+
column = getColumnFromDecoder2(entry);
|
|
3046
|
+
fieldDecoder = entry.sql.decoder;
|
|
3047
|
+
}
|
|
3048
|
+
if (fieldDecoder)
|
|
3049
|
+
field._.sql.decoder = fieldDecoder;
|
|
3050
|
+
result.push(column ? {
|
|
3051
|
+
path: newPath,
|
|
3052
|
+
field,
|
|
3053
|
+
codec: codecs?.get(column, "normalize"),
|
|
3054
|
+
arrayDimensions: column.dimensions,
|
|
3055
|
+
column
|
|
3056
|
+
} : {
|
|
3016
3057
|
path: newPath,
|
|
3017
3058
|
field
|
|
3018
3059
|
});
|
|
3019
|
-
else if (is(field, Table))
|
|
3060
|
+
} else if (is(field, Table))
|
|
3020
3061
|
result.push(...orderSelectedFields2(field[Table.Symbol.Columns], newPath, codecs));
|
|
3021
3062
|
else
|
|
3022
3063
|
result.push(...orderSelectedFields2(field, newPath, codecs));
|
|
3023
3064
|
return result;
|
|
3024
3065
|
}, []);
|
|
3025
3066
|
}
|
|
3067
|
+
function getColumnFromDecoder2(source) {
|
|
3068
|
+
const query = source.getSQL();
|
|
3069
|
+
if (is(query.decoder, Column))
|
|
3070
|
+
return query.decoder;
|
|
3071
|
+
}
|
|
3026
3072
|
function haveSameKeys2(left, right) {
|
|
3027
3073
|
const leftKeys = Object.keys(left);
|
|
3028
3074
|
const rightKeys = Object.keys(right);
|
|
@@ -3166,481 +3212,169 @@ var PgBoolean = class extends PgColumn {
|
|
|
3166
3212
|
function boolean(name2) {
|
|
3167
3213
|
return new PgBooleanBuilder(name2 ?? "");
|
|
3168
3214
|
}
|
|
3169
|
-
// node_modules/drizzle-orm/pg-core/
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
return "double precision";
|
|
3215
|
+
// node_modules/drizzle-orm/pg-core/array.js
|
|
3216
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
3217
|
+
for (let i = startFrom;i < arrayString.length; i++) {
|
|
3218
|
+
const char = arrayString[i];
|
|
3219
|
+
if (char === "\\") {
|
|
3220
|
+
i++;
|
|
3221
|
+
continue;
|
|
3222
|
+
}
|
|
3223
|
+
if (char === '"')
|
|
3224
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
3225
|
+
if (inQuotes)
|
|
3226
|
+
continue;
|
|
3227
|
+
if (char === "," || char === "}")
|
|
3228
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
3184
3229
|
}
|
|
3185
|
-
|
|
3186
|
-
function doublePrecision(name2) {
|
|
3187
|
-
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
3230
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
3188
3231
|
}
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3232
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
3233
|
+
const result = [];
|
|
3234
|
+
let i = startFrom;
|
|
3235
|
+
let lastCharIsComma = false;
|
|
3236
|
+
while (i < arrayString.length) {
|
|
3237
|
+
const char = arrayString[i];
|
|
3238
|
+
if (char === ",") {
|
|
3239
|
+
if (lastCharIsComma || i === startFrom)
|
|
3240
|
+
result.push("");
|
|
3241
|
+
lastCharIsComma = true;
|
|
3242
|
+
i++;
|
|
3243
|
+
continue;
|
|
3244
|
+
}
|
|
3245
|
+
lastCharIsComma = false;
|
|
3246
|
+
if (char === "\\") {
|
|
3247
|
+
i += 2;
|
|
3248
|
+
continue;
|
|
3249
|
+
}
|
|
3250
|
+
if (char === '"') {
|
|
3251
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
3252
|
+
result.push(value2);
|
|
3253
|
+
i = startFrom2;
|
|
3254
|
+
continue;
|
|
3255
|
+
}
|
|
3256
|
+
if (char === "}")
|
|
3257
|
+
return [result, i + 1];
|
|
3258
|
+
if (char === "{") {
|
|
3259
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
3260
|
+
result.push(value2);
|
|
3261
|
+
i = startFrom2;
|
|
3262
|
+
continue;
|
|
3263
|
+
}
|
|
3264
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
3265
|
+
result.push(value);
|
|
3266
|
+
i = newStartFrom;
|
|
3204
3267
|
}
|
|
3205
|
-
|
|
3206
|
-
function integer(name2) {
|
|
3207
|
-
return new PgIntegerBuilder(name2 ?? "");
|
|
3268
|
+
return [result, i];
|
|
3208
3269
|
}
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
constructor(name2) {
|
|
3213
|
-
super(name2, "object json", "PgJsonb");
|
|
3214
|
-
}
|
|
3215
|
-
build(table) {
|
|
3216
|
-
return new PgJsonb(table, this.config);
|
|
3217
|
-
}
|
|
3218
|
-
};
|
|
3219
|
-
var PgJsonb = class extends PgColumn {
|
|
3220
|
-
static [entityKind] = "PgJsonb";
|
|
3221
|
-
codec = "jsonb";
|
|
3222
|
-
constructor(table, config) {
|
|
3223
|
-
super(table, config);
|
|
3224
|
-
}
|
|
3225
|
-
getSQLType() {
|
|
3226
|
-
return "jsonb";
|
|
3227
|
-
}
|
|
3228
|
-
};
|
|
3229
|
-
function jsonb(name2) {
|
|
3230
|
-
return new PgJsonbBuilder(name2 ?? "");
|
|
3270
|
+
function parsePgArray(arrayString) {
|
|
3271
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
3272
|
+
return result;
|
|
3231
3273
|
}
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3274
|
+
function makePgArray(array) {
|
|
3275
|
+
return `{${array.map((item) => {
|
|
3276
|
+
if (Array.isArray(item))
|
|
3277
|
+
return makePgArray(item);
|
|
3278
|
+
if (typeof item === "string")
|
|
3279
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
3280
|
+
return `${item}`;
|
|
3281
|
+
}).join(",")}}`;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
3285
|
+
function hexToBytes(hex) {
|
|
3286
|
+
const bytes = [];
|
|
3287
|
+
for (let c = 0;c < hex.length; c += 2)
|
|
3288
|
+
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
3289
|
+
return new Uint8Array(bytes);
|
|
3290
|
+
}
|
|
3291
|
+
function bytesToFloat64(bytes, offset) {
|
|
3292
|
+
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
3293
|
+
const view = new DataView(buffer);
|
|
3294
|
+
for (let i = 0;i < 8; i++)
|
|
3295
|
+
view.setUint8(i, bytes[offset + i]);
|
|
3296
|
+
return view.getFloat64(0, true);
|
|
3297
|
+
}
|
|
3298
|
+
function parseEWKB(hex) {
|
|
3299
|
+
const bytes = hexToBytes(hex);
|
|
3300
|
+
let offset = 0;
|
|
3301
|
+
const byteOrder = bytes[offset];
|
|
3302
|
+
offset += 1;
|
|
3303
|
+
const view = new DataView(bytes.buffer);
|
|
3304
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
3305
|
+
offset += 4;
|
|
3306
|
+
let srid;
|
|
3307
|
+
if (geomType & 536870912) {
|
|
3308
|
+
srid = view.getUint32(offset, byteOrder === 1);
|
|
3309
|
+
offset += 4;
|
|
3237
3310
|
}
|
|
3238
|
-
|
|
3239
|
-
|
|
3311
|
+
if ((geomType & 65535) === 1) {
|
|
3312
|
+
const x = bytesToFloat64(bytes, offset);
|
|
3313
|
+
offset += 8;
|
|
3314
|
+
const y = bytesToFloat64(bytes, offset);
|
|
3315
|
+
offset += 8;
|
|
3316
|
+
return {
|
|
3317
|
+
srid,
|
|
3318
|
+
point: [x, y]
|
|
3319
|
+
};
|
|
3240
3320
|
}
|
|
3321
|
+
throw new Error("Unsupported geometry type");
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
// node_modules/drizzle-orm/codecs.js
|
|
3325
|
+
var noopCodecs = {};
|
|
3326
|
+
var arrayToItemTypeCodecNameMap = {
|
|
3327
|
+
cast: "cast",
|
|
3328
|
+
castArray: "cast",
|
|
3329
|
+
castInJson: "castInJson",
|
|
3330
|
+
castArrayInJson: "castInJson",
|
|
3331
|
+
castParam: "castParam",
|
|
3332
|
+
castArrayParam: "castParam",
|
|
3333
|
+
normalize: "normalize",
|
|
3334
|
+
normalizeArray: "normalize",
|
|
3335
|
+
normalizeInJson: "normalizeInJson",
|
|
3336
|
+
normalizeArrayInJson: "normalizeInJson",
|
|
3337
|
+
normalizeParam: "normalizeParam",
|
|
3338
|
+
normalizeParamArray: "normalizeParam"
|
|
3241
3339
|
};
|
|
3242
|
-
var
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3340
|
+
var itemToArrayTypeCodecNameMap = {
|
|
3341
|
+
cast: "castArray",
|
|
3342
|
+
castArray: "castArray",
|
|
3343
|
+
castInJson: "castArrayInJson",
|
|
3344
|
+
castArrayInJson: "castArrayInJson",
|
|
3345
|
+
castParam: "castArrayParam",
|
|
3346
|
+
castArrayParam: "castArrayParam",
|
|
3347
|
+
normalize: "normalizeArray",
|
|
3348
|
+
normalizeArray: "normalizeArray",
|
|
3349
|
+
normalizeInJson: "normalizeArrayInJson",
|
|
3350
|
+
normalizeArrayInJson: "normalizeArrayInJson",
|
|
3351
|
+
normalizeParam: "normalizeParamArray",
|
|
3352
|
+
normalizeParamArray: "normalizeParamArray"
|
|
3248
3353
|
};
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
static [entityKind] = "PgTextBuilder";
|
|
3255
|
-
constructor(name2, config) {
|
|
3256
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
3257
|
-
this.config.enumValues = config.enum;
|
|
3258
|
-
}
|
|
3259
|
-
build(table) {
|
|
3260
|
-
return new PgText(table, this.config, this.config.enumValues);
|
|
3354
|
+
var CodecsCollection = class {
|
|
3355
|
+
static [entityKind] = "CodecsCollection";
|
|
3356
|
+
constructor(resolveTypes, codecs = noopCodecs) {
|
|
3357
|
+
this.resolveTypes = resolveTypes;
|
|
3358
|
+
this.codecs = codecs;
|
|
3261
3359
|
}
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
super(table, config);
|
|
3269
|
-
this.enumValues = enumValues;
|
|
3360
|
+
get(column, type, override) {
|
|
3361
|
+
const sqlType = override ?? column.codec;
|
|
3362
|
+
if (!sqlType)
|
|
3363
|
+
return;
|
|
3364
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
3365
|
+
return this.codecs[sqlType]?.[codecType];
|
|
3270
3366
|
}
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
defaultNow() {
|
|
3283
|
-
return this.default(sql`now()`);
|
|
3284
|
-
}
|
|
3285
|
-
};
|
|
3286
|
-
|
|
3287
|
-
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
3288
|
-
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
3289
|
-
static [entityKind] = "PgTimestampBuilder";
|
|
3290
|
-
constructor(name2, withTimezone, precision) {
|
|
3291
|
-
super(name2, "object date", "PgTimestamp");
|
|
3292
|
-
this.config.withTimezone = withTimezone;
|
|
3293
|
-
this.config.precision = precision;
|
|
3294
|
-
}
|
|
3295
|
-
build(table) {
|
|
3296
|
-
return new PgTimestamp(table, this.config);
|
|
3297
|
-
}
|
|
3298
|
-
};
|
|
3299
|
-
var PgTimestamp = class extends PgColumn {
|
|
3300
|
-
static [entityKind] = "PgTimestamp";
|
|
3301
|
-
codec;
|
|
3302
|
-
withTimezone;
|
|
3303
|
-
precision;
|
|
3304
|
-
constructor(table, config) {
|
|
3305
|
-
super(table, config);
|
|
3306
|
-
this.withTimezone = config.withTimezone;
|
|
3307
|
-
this.precision = config.precision;
|
|
3308
|
-
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
3309
|
-
}
|
|
3310
|
-
getSQLType() {
|
|
3311
|
-
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
3312
|
-
}
|
|
3313
|
-
mapToDriverValue = (value) => {
|
|
3314
|
-
if (typeof value === "string")
|
|
3315
|
-
return value;
|
|
3316
|
-
return value.toISOString();
|
|
3317
|
-
};
|
|
3318
|
-
};
|
|
3319
|
-
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
3320
|
-
static [entityKind] = "PgTimestampStringBuilder";
|
|
3321
|
-
constructor(name2, withTimezone, precision) {
|
|
3322
|
-
super(name2, "string timestamp", "PgTimestampString");
|
|
3323
|
-
this.config.withTimezone = withTimezone;
|
|
3324
|
-
this.config.precision = precision;
|
|
3325
|
-
}
|
|
3326
|
-
build(table) {
|
|
3327
|
-
return new PgTimestampString(table, this.config);
|
|
3328
|
-
}
|
|
3329
|
-
};
|
|
3330
|
-
var PgTimestampString = class extends PgColumn {
|
|
3331
|
-
static [entityKind] = "PgTimestampString";
|
|
3332
|
-
codec;
|
|
3333
|
-
withTimezone;
|
|
3334
|
-
precision;
|
|
3335
|
-
constructor(table, config) {
|
|
3336
|
-
super(table, config);
|
|
3337
|
-
this.withTimezone = config.withTimezone;
|
|
3338
|
-
this.precision = config.precision;
|
|
3339
|
-
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
3340
|
-
}
|
|
3341
|
-
getSQLType() {
|
|
3342
|
-
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
3343
|
-
}
|
|
3344
|
-
mapToDriverValue = (value) => {
|
|
3345
|
-
if (typeof value === "string")
|
|
3346
|
-
return value;
|
|
3347
|
-
return value.toISOString();
|
|
3348
|
-
};
|
|
3349
|
-
};
|
|
3350
|
-
function timestamp(a, b = {}) {
|
|
3351
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3352
|
-
if (config?.mode === "string")
|
|
3353
|
-
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
3354
|
-
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
3355
|
-
}
|
|
3356
|
-
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
3357
|
-
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
3358
|
-
static [entityKind] = "PgVarcharBuilder";
|
|
3359
|
-
constructor(name2, config) {
|
|
3360
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
3361
|
-
this.config.length = config.length;
|
|
3362
|
-
this.config.enumValues = config.enum;
|
|
3363
|
-
}
|
|
3364
|
-
build(table) {
|
|
3365
|
-
return new PgVarchar(table, this.config);
|
|
3366
|
-
}
|
|
3367
|
-
};
|
|
3368
|
-
var PgVarchar = class extends PgColumn {
|
|
3369
|
-
static [entityKind] = "PgVarchar";
|
|
3370
|
-
codec = "varchar";
|
|
3371
|
-
enumValues;
|
|
3372
|
-
constructor(table, config) {
|
|
3373
|
-
super(table, config);
|
|
3374
|
-
this.enumValues = config.enumValues;
|
|
3375
|
-
}
|
|
3376
|
-
getSQLType() {
|
|
3377
|
-
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
3378
|
-
}
|
|
3379
|
-
};
|
|
3380
|
-
function varchar(a, b = {}) {
|
|
3381
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3382
|
-
return new PgVarcharBuilder(name2, config);
|
|
3383
|
-
}
|
|
3384
|
-
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
3385
|
-
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
3386
|
-
static [entityKind] = "PgBigSerial53Builder";
|
|
3387
|
-
constructor(name2) {
|
|
3388
|
-
super(name2, "number int53", "PgBigSerial53");
|
|
3389
|
-
this.config.hasDefault = true;
|
|
3390
|
-
this.config.notNull = true;
|
|
3391
|
-
}
|
|
3392
|
-
build(table) {
|
|
3393
|
-
return new PgBigSerial53(table, this.config);
|
|
3394
|
-
}
|
|
3395
|
-
};
|
|
3396
|
-
var PgBigSerial53 = class extends PgColumn {
|
|
3397
|
-
static [entityKind] = "PgBigSerial53";
|
|
3398
|
-
codec = "bigserial:number";
|
|
3399
|
-
getSQLType() {
|
|
3400
|
-
return "bigserial";
|
|
3401
|
-
}
|
|
3402
|
-
};
|
|
3403
|
-
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
3404
|
-
static [entityKind] = "PgBigSerial64Builder";
|
|
3405
|
-
constructor(name2) {
|
|
3406
|
-
super(name2, "bigint int64", "PgBigSerial64");
|
|
3407
|
-
this.config.hasDefault = true;
|
|
3408
|
-
this.config.notNull = true;
|
|
3409
|
-
}
|
|
3410
|
-
build(table) {
|
|
3411
|
-
return new PgBigSerial64(table, this.config);
|
|
3412
|
-
}
|
|
3413
|
-
};
|
|
3414
|
-
var PgBigSerial64 = class extends PgColumn {
|
|
3415
|
-
static [entityKind] = "PgBigSerial64";
|
|
3416
|
-
codec = "bigserial";
|
|
3417
|
-
getSQLType() {
|
|
3418
|
-
return "bigserial";
|
|
3419
|
-
}
|
|
3420
|
-
};
|
|
3421
|
-
function bigserial(a, b) {
|
|
3422
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3423
|
-
if (config.mode === "number")
|
|
3424
|
-
return new PgBigSerial53Builder(name2);
|
|
3425
|
-
return new PgBigSerial64Builder(name2);
|
|
3426
|
-
}
|
|
3427
|
-
|
|
3428
|
-
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
3429
|
-
var PgCharBuilder = class extends PgColumnBuilder {
|
|
3430
|
-
static [entityKind] = "PgCharBuilder";
|
|
3431
|
-
constructor(name2, config) {
|
|
3432
|
-
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
3433
|
-
this.config.length = config.length ?? 1;
|
|
3434
|
-
this.config.setLength = config.length !== undefined;
|
|
3435
|
-
this.config.enumValues = config.enum;
|
|
3436
|
-
}
|
|
3437
|
-
build(table) {
|
|
3438
|
-
return new PgChar(table, this.config);
|
|
3439
|
-
}
|
|
3440
|
-
};
|
|
3441
|
-
var PgChar = class extends PgColumn {
|
|
3442
|
-
static [entityKind] = "PgChar";
|
|
3443
|
-
codec = "char";
|
|
3444
|
-
enumValues;
|
|
3445
|
-
setLength;
|
|
3446
|
-
constructor(table, config) {
|
|
3447
|
-
super(table, config);
|
|
3448
|
-
this.enumValues = config.enumValues;
|
|
3449
|
-
this.setLength = config.setLength;
|
|
3450
|
-
}
|
|
3451
|
-
getSQLType() {
|
|
3452
|
-
return this.setLength ? `char(${this.length})` : `char`;
|
|
3453
|
-
}
|
|
3454
|
-
};
|
|
3455
|
-
function char(a, b = {}) {
|
|
3456
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3457
|
-
return new PgCharBuilder(name2, config);
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
3461
|
-
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
3462
|
-
static [entityKind] = "PgCidrBuilder";
|
|
3463
|
-
constructor(name2) {
|
|
3464
|
-
super(name2, "string cidr", "PgCidr");
|
|
3465
|
-
}
|
|
3466
|
-
build(table) {
|
|
3467
|
-
return new PgCidr(table, this.config);
|
|
3468
|
-
}
|
|
3469
|
-
};
|
|
3470
|
-
var PgCidr = class extends PgColumn {
|
|
3471
|
-
static [entityKind] = "PgCidr";
|
|
3472
|
-
codec = "cidr";
|
|
3473
|
-
getSQLType() {
|
|
3474
|
-
return "cidr";
|
|
3475
|
-
}
|
|
3476
|
-
};
|
|
3477
|
-
function cidr(name2) {
|
|
3478
|
-
return new PgCidrBuilder(name2 ?? "");
|
|
3479
|
-
}
|
|
3480
|
-
|
|
3481
|
-
// node_modules/drizzle-orm/pg-core/array.js
|
|
3482
|
-
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
3483
|
-
for (let i = startFrom;i < arrayString.length; i++) {
|
|
3484
|
-
const char2 = arrayString[i];
|
|
3485
|
-
if (char2 === "\\") {
|
|
3486
|
-
i++;
|
|
3487
|
-
continue;
|
|
3488
|
-
}
|
|
3489
|
-
if (char2 === '"')
|
|
3490
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
3491
|
-
if (inQuotes)
|
|
3492
|
-
continue;
|
|
3493
|
-
if (char2 === "," || char2 === "}")
|
|
3494
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
3495
|
-
}
|
|
3496
|
-
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
3497
|
-
}
|
|
3498
|
-
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
3499
|
-
const result = [];
|
|
3500
|
-
let i = startFrom;
|
|
3501
|
-
let lastCharIsComma = false;
|
|
3502
|
-
while (i < arrayString.length) {
|
|
3503
|
-
const char2 = arrayString[i];
|
|
3504
|
-
if (char2 === ",") {
|
|
3505
|
-
if (lastCharIsComma || i === startFrom)
|
|
3506
|
-
result.push("");
|
|
3507
|
-
lastCharIsComma = true;
|
|
3508
|
-
i++;
|
|
3509
|
-
continue;
|
|
3510
|
-
}
|
|
3511
|
-
lastCharIsComma = false;
|
|
3512
|
-
if (char2 === "\\") {
|
|
3513
|
-
i += 2;
|
|
3514
|
-
continue;
|
|
3515
|
-
}
|
|
3516
|
-
if (char2 === '"') {
|
|
3517
|
-
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
3518
|
-
result.push(value2);
|
|
3519
|
-
i = startFrom2;
|
|
3520
|
-
continue;
|
|
3521
|
-
}
|
|
3522
|
-
if (char2 === "}")
|
|
3523
|
-
return [result, i + 1];
|
|
3524
|
-
if (char2 === "{") {
|
|
3525
|
-
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
3526
|
-
result.push(value2);
|
|
3527
|
-
i = startFrom2;
|
|
3528
|
-
continue;
|
|
3529
|
-
}
|
|
3530
|
-
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
3531
|
-
result.push(value);
|
|
3532
|
-
i = newStartFrom;
|
|
3533
|
-
}
|
|
3534
|
-
return [result, i];
|
|
3535
|
-
}
|
|
3536
|
-
function parsePgArray(arrayString) {
|
|
3537
|
-
const [result] = parsePgNestedArray(arrayString, 1);
|
|
3538
|
-
return result;
|
|
3539
|
-
}
|
|
3540
|
-
function makePgArray(array) {
|
|
3541
|
-
return `{${array.map((item) => {
|
|
3542
|
-
if (Array.isArray(item))
|
|
3543
|
-
return makePgArray(item);
|
|
3544
|
-
if (typeof item === "string")
|
|
3545
|
-
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
3546
|
-
return `${item}`;
|
|
3547
|
-
}).join(",")}}`;
|
|
3548
|
-
}
|
|
3549
|
-
|
|
3550
|
-
// node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
3551
|
-
function hexToBytes(hex) {
|
|
3552
|
-
const bytes = [];
|
|
3553
|
-
for (let c = 0;c < hex.length; c += 2)
|
|
3554
|
-
bytes.push(Number.parseInt(hex.slice(c, c + 2), 16));
|
|
3555
|
-
return new Uint8Array(bytes);
|
|
3556
|
-
}
|
|
3557
|
-
function bytesToFloat64(bytes, offset) {
|
|
3558
|
-
const buffer = /* @__PURE__ */ new ArrayBuffer(8);
|
|
3559
|
-
const view = new DataView(buffer);
|
|
3560
|
-
for (let i = 0;i < 8; i++)
|
|
3561
|
-
view.setUint8(i, bytes[offset + i]);
|
|
3562
|
-
return view.getFloat64(0, true);
|
|
3563
|
-
}
|
|
3564
|
-
function parseEWKB(hex) {
|
|
3565
|
-
const bytes = hexToBytes(hex);
|
|
3566
|
-
let offset = 0;
|
|
3567
|
-
const byteOrder = bytes[offset];
|
|
3568
|
-
offset += 1;
|
|
3569
|
-
const view = new DataView(bytes.buffer);
|
|
3570
|
-
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
3571
|
-
offset += 4;
|
|
3572
|
-
let srid;
|
|
3573
|
-
if (geomType & 536870912) {
|
|
3574
|
-
srid = view.getUint32(offset, byteOrder === 1);
|
|
3575
|
-
offset += 4;
|
|
3576
|
-
}
|
|
3577
|
-
if ((geomType & 65535) === 1) {
|
|
3578
|
-
const x = bytesToFloat64(bytes, offset);
|
|
3579
|
-
offset += 8;
|
|
3580
|
-
const y = bytesToFloat64(bytes, offset);
|
|
3581
|
-
offset += 8;
|
|
3582
|
-
return {
|
|
3583
|
-
srid,
|
|
3584
|
-
point: [x, y]
|
|
3585
|
-
};
|
|
3586
|
-
}
|
|
3587
|
-
throw new Error("Unsupported geometry type");
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3590
|
-
// node_modules/drizzle-orm/codecs.js
|
|
3591
|
-
var noopCodecs = {};
|
|
3592
|
-
var arrayToItemTypeCodecNameMap = {
|
|
3593
|
-
cast: "cast",
|
|
3594
|
-
castArray: "cast",
|
|
3595
|
-
castInJson: "castInJson",
|
|
3596
|
-
castArrayInJson: "castInJson",
|
|
3597
|
-
castParam: "castParam",
|
|
3598
|
-
castArrayParam: "castParam",
|
|
3599
|
-
normalize: "normalize",
|
|
3600
|
-
normalizeArray: "normalize",
|
|
3601
|
-
normalizeInJson: "normalizeInJson",
|
|
3602
|
-
normalizeArrayInJson: "normalizeInJson",
|
|
3603
|
-
normalizeParam: "normalizeParam",
|
|
3604
|
-
normalizeParamArray: "normalizeParam"
|
|
3605
|
-
};
|
|
3606
|
-
var itemToArrayTypeCodecNameMap = {
|
|
3607
|
-
cast: "castArray",
|
|
3608
|
-
castArray: "castArray",
|
|
3609
|
-
castInJson: "castArrayInJson",
|
|
3610
|
-
castArrayInJson: "castArrayInJson",
|
|
3611
|
-
castParam: "castArrayParam",
|
|
3612
|
-
castArrayParam: "castArrayParam",
|
|
3613
|
-
normalize: "normalizeArray",
|
|
3614
|
-
normalizeArray: "normalizeArray",
|
|
3615
|
-
normalizeInJson: "normalizeArrayInJson",
|
|
3616
|
-
normalizeArrayInJson: "normalizeArrayInJson",
|
|
3617
|
-
normalizeParam: "normalizeParamArray",
|
|
3618
|
-
normalizeParamArray: "normalizeParamArray"
|
|
3619
|
-
};
|
|
3620
|
-
var CodecsCollection = class {
|
|
3621
|
-
static [entityKind] = "CodecsCollection";
|
|
3622
|
-
constructor(resolveTypes, codecs = noopCodecs) {
|
|
3623
|
-
this.resolveTypes = resolveTypes;
|
|
3624
|
-
this.codecs = codecs;
|
|
3625
|
-
}
|
|
3626
|
-
get(column, type) {
|
|
3627
|
-
const sqlType = column.codec;
|
|
3628
|
-
if (!sqlType)
|
|
3629
|
-
return;
|
|
3630
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
3631
|
-
return this.codecs[sqlType]?.[codecType];
|
|
3632
|
-
}
|
|
3633
|
-
apply(column, type, value) {
|
|
3634
|
-
const sqlType = column.codec;
|
|
3635
|
-
if (!sqlType)
|
|
3636
|
-
return value;
|
|
3637
|
-
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
3638
|
-
const codec = this.codecs[sqlType]?.[codecType];
|
|
3639
|
-
if (!codec)
|
|
3640
|
-
return value;
|
|
3641
|
-
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
3642
|
-
return codec(value, column, column.dimensions);
|
|
3643
|
-
return codec(value, column.dimensions);
|
|
3367
|
+
apply(column, type, value, override) {
|
|
3368
|
+
const sqlType = override ?? column.codec;
|
|
3369
|
+
if (!sqlType)
|
|
3370
|
+
return value;
|
|
3371
|
+
const codecType = column.dimensions ? itemToArrayTypeCodecNameMap[type] : arrayToItemTypeCodecNameMap[type];
|
|
3372
|
+
const codec = this.codecs[sqlType]?.[codecType];
|
|
3373
|
+
if (!codec)
|
|
3374
|
+
return value;
|
|
3375
|
+
if (codecType === "castParam" || codecType === "castArrayParam")
|
|
3376
|
+
return codec(value, column, column.dimensions);
|
|
3377
|
+
return codec(value, column.dimensions);
|
|
3644
3378
|
}
|
|
3645
3379
|
};
|
|
3646
3380
|
function refineCodecs(source, extension = {}) {
|
|
@@ -3660,34 +3394,661 @@ function refineCodecs(source, extension = {}) {
|
|
|
3660
3394
|
for (const ik of innerKeys)
|
|
3661
3395
|
result[k][ik] = ik in extension[k] ? extension[k][ik] : source[k]?.[ik];
|
|
3662
3396
|
}
|
|
3663
|
-
return result;
|
|
3664
|
-
}
|
|
3665
|
-
|
|
3666
|
-
// node_modules/drizzle-orm/pg-core/codecs.js
|
|
3667
|
-
var PG_ALIAS_TO_TYPE_MAP = {
|
|
3668
|
-
int2: "smallint",
|
|
3669
|
-
integer: "int",
|
|
3670
|
-
int4: "int",
|
|
3671
|
-
int8: "bigint",
|
|
3672
|
-
decimal: "numeric",
|
|
3673
|
-
real: "float4",
|
|
3674
|
-
double: "float8",
|
|
3675
|
-
"double precision": "float8",
|
|
3676
|
-
serial2: "smallserial",
|
|
3677
|
-
serial4: "serial",
|
|
3678
|
-
serial8: "bigserial",
|
|
3679
|
-
character: "char",
|
|
3680
|
-
"character varying": "varchar",
|
|
3681
|
-
"time with time zone": "timetz",
|
|
3682
|
-
"time without time zone": "time",
|
|
3683
|
-
"timestamp with time zone": "timestamptz",
|
|
3684
|
-
"timestamp without time zone": "timestamp",
|
|
3685
|
-
boolean: "bool",
|
|
3686
|
-
"bit varying": "varbit"
|
|
3397
|
+
return result;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
// node_modules/drizzle-orm/pg-core/codecs.js
|
|
3401
|
+
var PG_ALIAS_TO_TYPE_MAP = {
|
|
3402
|
+
int2: "smallint",
|
|
3403
|
+
integer: "int",
|
|
3404
|
+
int4: "int",
|
|
3405
|
+
int8: "bigint",
|
|
3406
|
+
decimal: "numeric",
|
|
3407
|
+
real: "float4",
|
|
3408
|
+
double: "float8",
|
|
3409
|
+
"double precision": "float8",
|
|
3410
|
+
serial2: "smallserial",
|
|
3411
|
+
serial4: "serial",
|
|
3412
|
+
serial8: "bigserial",
|
|
3413
|
+
character: "char",
|
|
3414
|
+
"character varying": "varchar",
|
|
3415
|
+
"time with time zone": "timetz",
|
|
3416
|
+
"time without time zone": "time",
|
|
3417
|
+
"timestamp with time zone": "timestamptz",
|
|
3418
|
+
"timestamp without time zone": "timestamp",
|
|
3419
|
+
boolean: "bool",
|
|
3420
|
+
"bit varying": "varbit"
|
|
3421
|
+
};
|
|
3422
|
+
function resolvePgTypeAlias(type) {
|
|
3423
|
+
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
3424
|
+
}
|
|
3425
|
+
var unionsTypeTable = {
|
|
3426
|
+
smallint: {
|
|
3427
|
+
smallint: "smallint",
|
|
3428
|
+
int: "int",
|
|
3429
|
+
bigint: "bigint:number",
|
|
3430
|
+
"bigint:number": "bigint:number",
|
|
3431
|
+
"bigint:string": "bigint:number",
|
|
3432
|
+
numeric: "numeric:number",
|
|
3433
|
+
"numeric:number": "numeric:number",
|
|
3434
|
+
"numeric:bigint": "numeric:number",
|
|
3435
|
+
float4: "float4",
|
|
3436
|
+
float8: "float8",
|
|
3437
|
+
smallserial: "smallint",
|
|
3438
|
+
serial: "int",
|
|
3439
|
+
bigserial: "bigint:number",
|
|
3440
|
+
"bigserial:number": "bigint:number",
|
|
3441
|
+
oid: "oid",
|
|
3442
|
+
regproc: "regproc",
|
|
3443
|
+
regprocedure: "regprocedure",
|
|
3444
|
+
regoper: "regoper",
|
|
3445
|
+
regoperator: "regoperator",
|
|
3446
|
+
regclass: "regclass",
|
|
3447
|
+
regtype: "regtype",
|
|
3448
|
+
regrole: "regrole",
|
|
3449
|
+
regnamespace: "regnamespace",
|
|
3450
|
+
regconfig: "regconfig",
|
|
3451
|
+
regdictionary: "regdictionary"
|
|
3452
|
+
},
|
|
3453
|
+
int: {
|
|
3454
|
+
smallint: "int",
|
|
3455
|
+
int: "int",
|
|
3456
|
+
bigint: "bigint:number",
|
|
3457
|
+
"bigint:number": "bigint:number",
|
|
3458
|
+
"bigint:string": "bigint:number",
|
|
3459
|
+
numeric: "numeric:number",
|
|
3460
|
+
"numeric:number": "numeric:number",
|
|
3461
|
+
"numeric:bigint": "numeric:number",
|
|
3462
|
+
float4: "float4",
|
|
3463
|
+
float8: "float8",
|
|
3464
|
+
smallserial: "int",
|
|
3465
|
+
serial: "int",
|
|
3466
|
+
bigserial: "bigint:number",
|
|
3467
|
+
"bigserial:number": "bigint:number",
|
|
3468
|
+
oid: "oid",
|
|
3469
|
+
regproc: "regproc",
|
|
3470
|
+
regprocedure: "regprocedure",
|
|
3471
|
+
regoper: "regoper",
|
|
3472
|
+
regoperator: "regoperator",
|
|
3473
|
+
regclass: "regclass",
|
|
3474
|
+
regtype: "regtype",
|
|
3475
|
+
regrole: "regrole",
|
|
3476
|
+
regnamespace: "regnamespace",
|
|
3477
|
+
regconfig: "regconfig",
|
|
3478
|
+
regdictionary: "regdictionary"
|
|
3479
|
+
},
|
|
3480
|
+
bigint: {
|
|
3481
|
+
smallint: "bigint",
|
|
3482
|
+
int: "bigint",
|
|
3483
|
+
bigint: "bigint",
|
|
3484
|
+
"bigint:number": "bigint",
|
|
3485
|
+
"bigint:string": "bigint",
|
|
3486
|
+
numeric: "numeric:bigint",
|
|
3487
|
+
"numeric:number": "numeric:bigint",
|
|
3488
|
+
"numeric:bigint": "numeric:bigint",
|
|
3489
|
+
float4: "float4",
|
|
3490
|
+
float8: "float8",
|
|
3491
|
+
smallserial: "bigint",
|
|
3492
|
+
serial: "bigint",
|
|
3493
|
+
bigserial: "bigint",
|
|
3494
|
+
"bigserial:number": "bigint",
|
|
3495
|
+
oid: "oid",
|
|
3496
|
+
regproc: "regproc",
|
|
3497
|
+
regprocedure: "regprocedure",
|
|
3498
|
+
regoper: "regoper",
|
|
3499
|
+
regoperator: "regoperator",
|
|
3500
|
+
regclass: "regclass",
|
|
3501
|
+
regtype: "regtype",
|
|
3502
|
+
regrole: "regrole",
|
|
3503
|
+
regnamespace: "regnamespace",
|
|
3504
|
+
regconfig: "regconfig",
|
|
3505
|
+
regdictionary: "regdictionary"
|
|
3506
|
+
},
|
|
3507
|
+
"bigint:number": {
|
|
3508
|
+
smallint: "bigint:number",
|
|
3509
|
+
int: "bigint:number",
|
|
3510
|
+
bigint: "bigint:number",
|
|
3511
|
+
"bigint:number": "bigint:number",
|
|
3512
|
+
"bigint:string": "bigint:number",
|
|
3513
|
+
numeric: "numeric:number",
|
|
3514
|
+
"numeric:number": "numeric:number",
|
|
3515
|
+
"numeric:bigint": "numeric:number",
|
|
3516
|
+
float4: "float4",
|
|
3517
|
+
float8: "float8",
|
|
3518
|
+
smallserial: "bigint:number",
|
|
3519
|
+
serial: "bigint:number",
|
|
3520
|
+
bigserial: "bigint:number",
|
|
3521
|
+
"bigserial:number": "bigint:number",
|
|
3522
|
+
oid: "oid",
|
|
3523
|
+
regproc: "regproc",
|
|
3524
|
+
regprocedure: "regprocedure",
|
|
3525
|
+
regoper: "regoper",
|
|
3526
|
+
regoperator: "regoperator",
|
|
3527
|
+
regclass: "regclass",
|
|
3528
|
+
regtype: "regtype",
|
|
3529
|
+
regrole: "regrole",
|
|
3530
|
+
regnamespace: "regnamespace",
|
|
3531
|
+
regconfig: "regconfig",
|
|
3532
|
+
regdictionary: "regdictionary"
|
|
3533
|
+
},
|
|
3534
|
+
"bigint:string": {
|
|
3535
|
+
smallint: "bigint:string",
|
|
3536
|
+
int: "bigint:string",
|
|
3537
|
+
bigint: "bigint:string",
|
|
3538
|
+
"bigint:number": "bigint:string",
|
|
3539
|
+
"bigint:string": "bigint:string",
|
|
3540
|
+
numeric: "numeric",
|
|
3541
|
+
"numeric:number": "numeric",
|
|
3542
|
+
"numeric:bigint": "numeric",
|
|
3543
|
+
float4: "float4",
|
|
3544
|
+
float8: "float8",
|
|
3545
|
+
smallserial: "bigint:string",
|
|
3546
|
+
serial: "bigint:string",
|
|
3547
|
+
bigserial: "bigint:string",
|
|
3548
|
+
"bigserial:number": "bigint:string",
|
|
3549
|
+
oid: "oid",
|
|
3550
|
+
regproc: "regproc",
|
|
3551
|
+
regprocedure: "regprocedure",
|
|
3552
|
+
regoper: "regoper",
|
|
3553
|
+
regoperator: "regoperator",
|
|
3554
|
+
regclass: "regclass",
|
|
3555
|
+
regtype: "regtype",
|
|
3556
|
+
regrole: "regrole",
|
|
3557
|
+
regnamespace: "regnamespace",
|
|
3558
|
+
regconfig: "regconfig",
|
|
3559
|
+
regdictionary: "regdictionary"
|
|
3560
|
+
},
|
|
3561
|
+
numeric: {
|
|
3562
|
+
smallint: "numeric",
|
|
3563
|
+
int: "numeric",
|
|
3564
|
+
bigint: "numeric",
|
|
3565
|
+
"bigint:number": "numeric",
|
|
3566
|
+
"bigint:string": "numeric",
|
|
3567
|
+
numeric: "numeric",
|
|
3568
|
+
"numeric:number": "numeric",
|
|
3569
|
+
"numeric:bigint": "numeric",
|
|
3570
|
+
float4: "float4",
|
|
3571
|
+
float8: "float8",
|
|
3572
|
+
smallserial: "numeric",
|
|
3573
|
+
serial: "numeric",
|
|
3574
|
+
bigserial: "numeric",
|
|
3575
|
+
"bigserial:number": "numeric"
|
|
3576
|
+
},
|
|
3577
|
+
"numeric:number": {
|
|
3578
|
+
smallint: "numeric:number",
|
|
3579
|
+
int: "numeric:number",
|
|
3580
|
+
bigint: "numeric:number",
|
|
3581
|
+
"bigint:number": "numeric:number",
|
|
3582
|
+
"bigint:string": "numeric:number",
|
|
3583
|
+
numeric: "numeric:number",
|
|
3584
|
+
"numeric:number": "numeric:number",
|
|
3585
|
+
"numeric:bigint": "numeric:number",
|
|
3586
|
+
float4: "float4",
|
|
3587
|
+
float8: "float8",
|
|
3588
|
+
smallserial: "numeric:number",
|
|
3589
|
+
serial: "numeric:number",
|
|
3590
|
+
bigserial: "numeric:number",
|
|
3591
|
+
"bigserial:number": "numeric:number"
|
|
3592
|
+
},
|
|
3593
|
+
"numeric:bigint": {
|
|
3594
|
+
smallint: "numeric:bigint",
|
|
3595
|
+
int: "numeric:bigint",
|
|
3596
|
+
bigint: "numeric:bigint",
|
|
3597
|
+
"bigint:number": "numeric:bigint",
|
|
3598
|
+
"bigint:string": "numeric:bigint",
|
|
3599
|
+
numeric: "numeric:bigint",
|
|
3600
|
+
"numeric:number": "numeric:bigint",
|
|
3601
|
+
"numeric:bigint": "numeric:bigint",
|
|
3602
|
+
float4: "float4",
|
|
3603
|
+
float8: "float8",
|
|
3604
|
+
smallserial: "numeric:bigint",
|
|
3605
|
+
serial: "numeric:bigint",
|
|
3606
|
+
bigserial: "numeric:bigint",
|
|
3607
|
+
"bigserial:number": "numeric:bigint"
|
|
3608
|
+
},
|
|
3609
|
+
float4: {
|
|
3610
|
+
smallint: "float4",
|
|
3611
|
+
int: "float4",
|
|
3612
|
+
bigint: "float4",
|
|
3613
|
+
"bigint:number": "float4",
|
|
3614
|
+
"bigint:string": "float4",
|
|
3615
|
+
numeric: "float4",
|
|
3616
|
+
"numeric:number": "float4",
|
|
3617
|
+
"numeric:bigint": "float4",
|
|
3618
|
+
float4: "float4",
|
|
3619
|
+
float8: "float8",
|
|
3620
|
+
smallserial: "float4",
|
|
3621
|
+
serial: "float4",
|
|
3622
|
+
bigserial: "float4",
|
|
3623
|
+
"bigserial:number": "float4"
|
|
3624
|
+
},
|
|
3625
|
+
float8: {
|
|
3626
|
+
smallint: "float8",
|
|
3627
|
+
int: "float8",
|
|
3628
|
+
bigint: "float8",
|
|
3629
|
+
"bigint:number": "float8",
|
|
3630
|
+
"bigint:string": "float8",
|
|
3631
|
+
numeric: "float8",
|
|
3632
|
+
"numeric:number": "float8",
|
|
3633
|
+
"numeric:bigint": "float8",
|
|
3634
|
+
float4: "float8",
|
|
3635
|
+
float8: "float8",
|
|
3636
|
+
smallserial: "float8",
|
|
3637
|
+
serial: "float8",
|
|
3638
|
+
bigserial: "float8",
|
|
3639
|
+
"bigserial:number": "float8"
|
|
3640
|
+
},
|
|
3641
|
+
money: { money: "money" },
|
|
3642
|
+
smallserial: {
|
|
3643
|
+
smallint: "smallint",
|
|
3644
|
+
int: "int",
|
|
3645
|
+
bigint: "bigint:number",
|
|
3646
|
+
"bigint:number": "bigint:number",
|
|
3647
|
+
"bigint:string": "bigint:number",
|
|
3648
|
+
numeric: "numeric:number",
|
|
3649
|
+
"numeric:number": "numeric:number",
|
|
3650
|
+
"numeric:bigint": "numeric:number",
|
|
3651
|
+
float4: "float4",
|
|
3652
|
+
float8: "float8",
|
|
3653
|
+
smallserial: "smallint",
|
|
3654
|
+
serial: "int",
|
|
3655
|
+
bigserial: "bigint:number",
|
|
3656
|
+
"bigserial:number": "bigint:number",
|
|
3657
|
+
oid: "oid",
|
|
3658
|
+
regproc: "regproc",
|
|
3659
|
+
regprocedure: "regprocedure",
|
|
3660
|
+
regoper: "regoper",
|
|
3661
|
+
regoperator: "regoperator",
|
|
3662
|
+
regclass: "regclass",
|
|
3663
|
+
regtype: "regtype",
|
|
3664
|
+
regrole: "regrole",
|
|
3665
|
+
regnamespace: "regnamespace",
|
|
3666
|
+
regconfig: "regconfig",
|
|
3667
|
+
regdictionary: "regdictionary"
|
|
3668
|
+
},
|
|
3669
|
+
serial: {
|
|
3670
|
+
smallint: "int",
|
|
3671
|
+
int: "int",
|
|
3672
|
+
bigint: "bigint:number",
|
|
3673
|
+
"bigint:number": "bigint:number",
|
|
3674
|
+
"bigint:string": "bigint:number",
|
|
3675
|
+
numeric: "numeric:number",
|
|
3676
|
+
"numeric:number": "numeric:number",
|
|
3677
|
+
"numeric:bigint": "numeric:number",
|
|
3678
|
+
float4: "float4",
|
|
3679
|
+
float8: "float8",
|
|
3680
|
+
smallserial: "int",
|
|
3681
|
+
serial: "int",
|
|
3682
|
+
bigserial: "bigint:number",
|
|
3683
|
+
"bigserial:number": "bigint:number",
|
|
3684
|
+
oid: "oid",
|
|
3685
|
+
regproc: "regproc",
|
|
3686
|
+
regprocedure: "regprocedure",
|
|
3687
|
+
regoper: "regoper",
|
|
3688
|
+
regoperator: "regoperator",
|
|
3689
|
+
regclass: "regclass",
|
|
3690
|
+
regtype: "regtype",
|
|
3691
|
+
regrole: "regrole",
|
|
3692
|
+
regnamespace: "regnamespace",
|
|
3693
|
+
regconfig: "regconfig",
|
|
3694
|
+
regdictionary: "regdictionary"
|
|
3695
|
+
},
|
|
3696
|
+
bigserial: {
|
|
3697
|
+
smallint: "bigint",
|
|
3698
|
+
int: "bigint",
|
|
3699
|
+
bigint: "bigint",
|
|
3700
|
+
"bigint:number": "bigint",
|
|
3701
|
+
"bigint:string": "bigint",
|
|
3702
|
+
numeric: "numeric:bigint",
|
|
3703
|
+
"numeric:number": "numeric:bigint",
|
|
3704
|
+
"numeric:bigint": "numeric:bigint",
|
|
3705
|
+
float4: "float4",
|
|
3706
|
+
float8: "float8",
|
|
3707
|
+
smallserial: "bigint",
|
|
3708
|
+
serial: "bigint",
|
|
3709
|
+
bigserial: "bigint",
|
|
3710
|
+
"bigserial:number": "bigint",
|
|
3711
|
+
oid: "oid",
|
|
3712
|
+
regproc: "regproc",
|
|
3713
|
+
regprocedure: "regprocedure",
|
|
3714
|
+
regoper: "regoper",
|
|
3715
|
+
regoperator: "regoperator",
|
|
3716
|
+
regclass: "regclass",
|
|
3717
|
+
regtype: "regtype",
|
|
3718
|
+
regrole: "regrole",
|
|
3719
|
+
regnamespace: "regnamespace",
|
|
3720
|
+
regconfig: "regconfig",
|
|
3721
|
+
regdictionary: "regdictionary"
|
|
3722
|
+
},
|
|
3723
|
+
"bigserial:number": {
|
|
3724
|
+
smallint: "bigint:number",
|
|
3725
|
+
int: "bigint:number",
|
|
3726
|
+
bigint: "bigint:number",
|
|
3727
|
+
"bigint:number": "bigint:number",
|
|
3728
|
+
"bigint:string": "bigint:number",
|
|
3729
|
+
numeric: "numeric:number",
|
|
3730
|
+
"numeric:number": "numeric:number",
|
|
3731
|
+
"numeric:bigint": "numeric:number",
|
|
3732
|
+
float4: "float4",
|
|
3733
|
+
float8: "float8",
|
|
3734
|
+
smallserial: "bigint:number",
|
|
3735
|
+
serial: "bigint:number",
|
|
3736
|
+
bigserial: "bigint:number",
|
|
3737
|
+
"bigserial:number": "bigint:number",
|
|
3738
|
+
oid: "oid",
|
|
3739
|
+
regproc: "regproc",
|
|
3740
|
+
regprocedure: "regprocedure",
|
|
3741
|
+
regoper: "regoper",
|
|
3742
|
+
regoperator: "regoperator",
|
|
3743
|
+
regclass: "regclass",
|
|
3744
|
+
regtype: "regtype",
|
|
3745
|
+
regrole: "regrole",
|
|
3746
|
+
regnamespace: "regnamespace",
|
|
3747
|
+
regconfig: "regconfig",
|
|
3748
|
+
regdictionary: "regdictionary"
|
|
3749
|
+
},
|
|
3750
|
+
char: {
|
|
3751
|
+
char: "char",
|
|
3752
|
+
varchar: "char",
|
|
3753
|
+
text: "char"
|
|
3754
|
+
},
|
|
3755
|
+
varchar: {
|
|
3756
|
+
char: "varchar",
|
|
3757
|
+
varchar: "varchar",
|
|
3758
|
+
text: "varchar"
|
|
3759
|
+
},
|
|
3760
|
+
text: {
|
|
3761
|
+
char: "text",
|
|
3762
|
+
varchar: "text",
|
|
3763
|
+
text: "text"
|
|
3764
|
+
},
|
|
3765
|
+
bytea: { bytea: "bytea" },
|
|
3766
|
+
date: {
|
|
3767
|
+
date: "date",
|
|
3768
|
+
"date:string": "date",
|
|
3769
|
+
timestamp: "timestamp",
|
|
3770
|
+
"timestamp:string": "timestamp",
|
|
3771
|
+
timestamptz: "timestamptz",
|
|
3772
|
+
"timestamptz:string": "timestamptz"
|
|
3773
|
+
},
|
|
3774
|
+
"date:string": {
|
|
3775
|
+
date: "date:string",
|
|
3776
|
+
"date:string": "date:string",
|
|
3777
|
+
timestamp: "timestamp:string",
|
|
3778
|
+
"timestamp:string": "timestamp:string",
|
|
3779
|
+
timestamptz: "timestamptz:string",
|
|
3780
|
+
"timestamptz:string": "timestamptz:string"
|
|
3781
|
+
},
|
|
3782
|
+
time: {
|
|
3783
|
+
time: "time",
|
|
3784
|
+
timetz: "timetz"
|
|
3785
|
+
},
|
|
3786
|
+
timetz: {
|
|
3787
|
+
time: "timetz",
|
|
3788
|
+
timetz: "timetz"
|
|
3789
|
+
},
|
|
3790
|
+
timestamp: {
|
|
3791
|
+
date: "timestamp",
|
|
3792
|
+
"date:string": "timestamp",
|
|
3793
|
+
timestamp: "timestamp",
|
|
3794
|
+
"timestamp:string": "timestamp",
|
|
3795
|
+
timestamptz: "timestamptz",
|
|
3796
|
+
"timestamptz:string": "timestamptz"
|
|
3797
|
+
},
|
|
3798
|
+
"timestamp:string": {
|
|
3799
|
+
date: "timestamp:string",
|
|
3800
|
+
"date:string": "timestamp:string",
|
|
3801
|
+
timestamp: "timestamp:string",
|
|
3802
|
+
"timestamp:string": "timestamp:string",
|
|
3803
|
+
timestamptz: "timestamptz:string",
|
|
3804
|
+
"timestamptz:string": "timestamptz:string"
|
|
3805
|
+
},
|
|
3806
|
+
timestamptz: {
|
|
3807
|
+
date: "timestamptz",
|
|
3808
|
+
"date:string": "timestamptz",
|
|
3809
|
+
timestamp: "timestamptz",
|
|
3810
|
+
"timestamp:string": "timestamptz",
|
|
3811
|
+
timestamptz: "timestamptz",
|
|
3812
|
+
"timestamptz:string": "timestamptz"
|
|
3813
|
+
},
|
|
3814
|
+
"timestamptz:string": {
|
|
3815
|
+
date: "timestamptz:string",
|
|
3816
|
+
"date:string": "timestamptz:string",
|
|
3817
|
+
timestamp: "timestamptz:string",
|
|
3818
|
+
"timestamp:string": "timestamptz:string",
|
|
3819
|
+
timestamptz: "timestamptz:string",
|
|
3820
|
+
"timestamptz:string": "timestamptz:string"
|
|
3821
|
+
},
|
|
3822
|
+
interval: {
|
|
3823
|
+
interval: "interval",
|
|
3824
|
+
"interval:tuple": "interval"
|
|
3825
|
+
},
|
|
3826
|
+
"interval:tuple": {
|
|
3827
|
+
interval: "interval:tuple",
|
|
3828
|
+
"interval:tuple": "interval:tuple"
|
|
3829
|
+
},
|
|
3830
|
+
bool: { bool: "bool" },
|
|
3831
|
+
enum: { enum: "enum" },
|
|
3832
|
+
point: {
|
|
3833
|
+
point: "point",
|
|
3834
|
+
"point:tuple": "point"
|
|
3835
|
+
},
|
|
3836
|
+
"point:tuple": {
|
|
3837
|
+
point: "point:tuple",
|
|
3838
|
+
"point:tuple": "point:tuple"
|
|
3839
|
+
},
|
|
3840
|
+
line: {
|
|
3841
|
+
line: "line",
|
|
3842
|
+
"line:tuple": "line"
|
|
3843
|
+
},
|
|
3844
|
+
"line:tuple": {
|
|
3845
|
+
line: "line:tuple",
|
|
3846
|
+
"line:tuple": "line:tuple"
|
|
3847
|
+
},
|
|
3848
|
+
lseg: { lseg: "lseg" },
|
|
3849
|
+
box: { box: "box" },
|
|
3850
|
+
path: { path: "path" },
|
|
3851
|
+
polygon: { polygon: "polygon" },
|
|
3852
|
+
circle: { circle: "circle" },
|
|
3853
|
+
cidr: {
|
|
3854
|
+
cidr: "cidr",
|
|
3855
|
+
inet: "inet"
|
|
3856
|
+
},
|
|
3857
|
+
inet: {
|
|
3858
|
+
cidr: "inet",
|
|
3859
|
+
inet: "inet"
|
|
3860
|
+
},
|
|
3861
|
+
macaddr: {
|
|
3862
|
+
macaddr: "macaddr",
|
|
3863
|
+
macaddr8: "macaddr"
|
|
3864
|
+
},
|
|
3865
|
+
macaddr8: {
|
|
3866
|
+
macaddr: "macaddr8",
|
|
3867
|
+
macaddr8: "macaddr8"
|
|
3868
|
+
},
|
|
3869
|
+
bit: {
|
|
3870
|
+
bit: "bit",
|
|
3871
|
+
varbit: "bit"
|
|
3872
|
+
},
|
|
3873
|
+
varbit: {
|
|
3874
|
+
bit: "varbit",
|
|
3875
|
+
varbit: "varbit"
|
|
3876
|
+
},
|
|
3877
|
+
tsvector: { tsvector: "tsvector" },
|
|
3878
|
+
tsquery: { tsquery: "tsquery" },
|
|
3879
|
+
uuid: { uuid: "uuid" },
|
|
3880
|
+
xml: { xml: "xml" },
|
|
3881
|
+
json: { json: "json" },
|
|
3882
|
+
jsonb: { jsonb: "jsonb" },
|
|
3883
|
+
int4range: { int4range: "int4range" },
|
|
3884
|
+
int8range: { int8range: "int8range" },
|
|
3885
|
+
numrange: { numrange: "numrange" },
|
|
3886
|
+
tsrange: { tsrange: "tsrange" },
|
|
3887
|
+
tstzrange: { tstzrange: "tstzrange" },
|
|
3888
|
+
daterange: { daterange: "daterange" },
|
|
3889
|
+
int4multirange: { int4multirange: "int4multirange" },
|
|
3890
|
+
int8multirange: { int8multirange: "int8multirange" },
|
|
3891
|
+
nummultirange: { nummultirange: "nummultirange" },
|
|
3892
|
+
tsmultirange: { tsmultirange: "tsmultirange" },
|
|
3893
|
+
tstzmultirange: { tstzmultirange: "tstzmultirange" },
|
|
3894
|
+
datemultirange: { datemultirange: "datemultirange" },
|
|
3895
|
+
oid: {
|
|
3896
|
+
smallint: "oid",
|
|
3897
|
+
int: "oid",
|
|
3898
|
+
bigint: "oid",
|
|
3899
|
+
"bigint:number": "oid",
|
|
3900
|
+
"bigint:string": "oid",
|
|
3901
|
+
smallserial: "oid",
|
|
3902
|
+
serial: "oid",
|
|
3903
|
+
bigserial: "oid",
|
|
3904
|
+
"bigserial:number": "oid",
|
|
3905
|
+
oid: "oid",
|
|
3906
|
+
regproc: "oid",
|
|
3907
|
+
regprocedure: "oid",
|
|
3908
|
+
regoper: "oid",
|
|
3909
|
+
regoperator: "oid",
|
|
3910
|
+
regclass: "oid",
|
|
3911
|
+
regtype: "oid",
|
|
3912
|
+
regrole: "oid",
|
|
3913
|
+
regnamespace: "oid",
|
|
3914
|
+
regconfig: "oid",
|
|
3915
|
+
regdictionary: "oid"
|
|
3916
|
+
},
|
|
3917
|
+
regproc: {
|
|
3918
|
+
smallint: "regproc",
|
|
3919
|
+
int: "regproc",
|
|
3920
|
+
bigint: "regproc",
|
|
3921
|
+
"bigint:number": "regproc",
|
|
3922
|
+
"bigint:string": "regproc",
|
|
3923
|
+
smallserial: "regproc",
|
|
3924
|
+
serial: "regproc",
|
|
3925
|
+
bigserial: "regproc",
|
|
3926
|
+
"bigserial:number": "regproc",
|
|
3927
|
+
oid: "regproc",
|
|
3928
|
+
regproc: "regproc",
|
|
3929
|
+
regprocedure: "regproc"
|
|
3930
|
+
},
|
|
3931
|
+
regprocedure: {
|
|
3932
|
+
smallint: "regprocedure",
|
|
3933
|
+
int: "regprocedure",
|
|
3934
|
+
bigint: "regprocedure",
|
|
3935
|
+
"bigint:number": "regprocedure",
|
|
3936
|
+
"bigint:string": "regprocedure",
|
|
3937
|
+
smallserial: "regprocedure",
|
|
3938
|
+
serial: "regprocedure",
|
|
3939
|
+
bigserial: "regprocedure",
|
|
3940
|
+
"bigserial:number": "regprocedure",
|
|
3941
|
+
oid: "regprocedure",
|
|
3942
|
+
regproc: "regprocedure",
|
|
3943
|
+
regprocedure: "regprocedure"
|
|
3944
|
+
},
|
|
3945
|
+
regoper: {
|
|
3946
|
+
smallint: "regoper",
|
|
3947
|
+
int: "regoper",
|
|
3948
|
+
bigint: "regoper",
|
|
3949
|
+
"bigint:number": "regoper",
|
|
3950
|
+
"bigint:string": "regoper",
|
|
3951
|
+
smallserial: "regoper",
|
|
3952
|
+
serial: "regoper",
|
|
3953
|
+
bigserial: "regoper",
|
|
3954
|
+
"bigserial:number": "regoper",
|
|
3955
|
+
oid: "regoper",
|
|
3956
|
+
regoper: "regoper",
|
|
3957
|
+
regoperator: "regoper"
|
|
3958
|
+
},
|
|
3959
|
+
regoperator: {
|
|
3960
|
+
smallint: "regoperator",
|
|
3961
|
+
int: "regoperator",
|
|
3962
|
+
bigint: "regoperator",
|
|
3963
|
+
"bigint:number": "regoperator",
|
|
3964
|
+
"bigint:string": "regoperator",
|
|
3965
|
+
smallserial: "regoperator",
|
|
3966
|
+
serial: "regoperator",
|
|
3967
|
+
bigserial: "regoperator",
|
|
3968
|
+
"bigserial:number": "regoperator",
|
|
3969
|
+
oid: "regoperator",
|
|
3970
|
+
regoper: "regoperator",
|
|
3971
|
+
regoperator: "regoperator"
|
|
3972
|
+
},
|
|
3973
|
+
regclass: {
|
|
3974
|
+
smallint: "regclass",
|
|
3975
|
+
int: "regclass",
|
|
3976
|
+
bigint: "regclass",
|
|
3977
|
+
"bigint:number": "regclass",
|
|
3978
|
+
"bigint:string": "regclass",
|
|
3979
|
+
smallserial: "regclass",
|
|
3980
|
+
serial: "regclass",
|
|
3981
|
+
bigserial: "regclass",
|
|
3982
|
+
"bigserial:number": "regclass",
|
|
3983
|
+
oid: "regclass",
|
|
3984
|
+
regclass: "regclass"
|
|
3985
|
+
},
|
|
3986
|
+
regtype: {
|
|
3987
|
+
smallint: "regtype",
|
|
3988
|
+
int: "regtype",
|
|
3989
|
+
bigint: "regtype",
|
|
3990
|
+
"bigint:number": "regtype",
|
|
3991
|
+
"bigint:string": "regtype",
|
|
3992
|
+
smallserial: "regtype",
|
|
3993
|
+
serial: "regtype",
|
|
3994
|
+
bigserial: "regtype",
|
|
3995
|
+
"bigserial:number": "regtype",
|
|
3996
|
+
oid: "regtype",
|
|
3997
|
+
regtype: "regtype"
|
|
3998
|
+
},
|
|
3999
|
+
regrole: {
|
|
4000
|
+
smallint: "regrole",
|
|
4001
|
+
int: "regrole",
|
|
4002
|
+
bigint: "regrole",
|
|
4003
|
+
"bigint:number": "regrole",
|
|
4004
|
+
"bigint:string": "regrole",
|
|
4005
|
+
smallserial: "regrole",
|
|
4006
|
+
serial: "regrole",
|
|
4007
|
+
bigserial: "regrole",
|
|
4008
|
+
"bigserial:number": "regrole",
|
|
4009
|
+
oid: "regrole",
|
|
4010
|
+
regrole: "regrole"
|
|
4011
|
+
},
|
|
4012
|
+
regnamespace: {
|
|
4013
|
+
smallint: "regnamespace",
|
|
4014
|
+
int: "regnamespace",
|
|
4015
|
+
bigint: "regnamespace",
|
|
4016
|
+
"bigint:number": "regnamespace",
|
|
4017
|
+
"bigint:string": "regnamespace",
|
|
4018
|
+
smallserial: "regnamespace",
|
|
4019
|
+
serial: "regnamespace",
|
|
4020
|
+
bigserial: "regnamespace",
|
|
4021
|
+
"bigserial:number": "regnamespace",
|
|
4022
|
+
oid: "regnamespace",
|
|
4023
|
+
regnamespace: "regnamespace"
|
|
4024
|
+
},
|
|
4025
|
+
regconfig: {
|
|
4026
|
+
smallint: "regconfig",
|
|
4027
|
+
int: "regconfig",
|
|
4028
|
+
bigint: "regconfig",
|
|
4029
|
+
"bigint:number": "regconfig",
|
|
4030
|
+
"bigint:string": "regconfig",
|
|
4031
|
+
smallserial: "regconfig",
|
|
4032
|
+
serial: "regconfig",
|
|
4033
|
+
bigserial: "regconfig",
|
|
4034
|
+
"bigserial:number": "regconfig",
|
|
4035
|
+
oid: "regconfig",
|
|
4036
|
+
regconfig: "regconfig"
|
|
4037
|
+
},
|
|
4038
|
+
regdictionary: {
|
|
4039
|
+
smallint: "regdictionary",
|
|
4040
|
+
int: "regdictionary",
|
|
4041
|
+
bigint: "regdictionary",
|
|
4042
|
+
"bigint:number": "regdictionary",
|
|
4043
|
+
"bigint:string": "regdictionary",
|
|
4044
|
+
smallserial: "regdictionary",
|
|
4045
|
+
serial: "regdictionary",
|
|
4046
|
+
bigserial: "regdictionary",
|
|
4047
|
+
"bigserial:number": "regdictionary",
|
|
4048
|
+
oid: "regdictionary",
|
|
4049
|
+
regdictionary: "regdictionary"
|
|
4050
|
+
}
|
|
3687
4051
|
};
|
|
3688
|
-
function resolvePgTypeAlias(type) {
|
|
3689
|
-
return PG_ALIAS_TO_TYPE_MAP[type] ?? type;
|
|
3690
|
-
}
|
|
3691
4052
|
var castToText = (name2) => sql`${name2}::text`;
|
|
3692
4053
|
var castToTextArr = (name2, arrayDimensions) => sql`${name2}::text${sql.raw("[]".repeat(arrayDimensions))}`;
|
|
3693
4054
|
var arrayCompatCast = (cast) => (name2, arrayDimensions) => {
|
|
@@ -3941,57 +4302,368 @@ var genericPgCodecs = {
|
|
|
3941
4302
|
normalizeArrayInJson: arrayCompatNormalize(parsePgVector)
|
|
3942
4303
|
}
|
|
3943
4304
|
};
|
|
3944
|
-
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
4305
|
+
var refineGenericPgCodecs = (extension) => refineCodecs(genericPgCodecs, extension);
|
|
4306
|
+
|
|
4307
|
+
// node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
4308
|
+
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
4309
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
4310
|
+
constructor(name2, fieldConfig, customTypeParams) {
|
|
4311
|
+
super(name2, "custom", "PgCustomColumn");
|
|
4312
|
+
this.config.fieldConfig = fieldConfig;
|
|
4313
|
+
this.config.customTypeParams = customTypeParams;
|
|
4314
|
+
}
|
|
4315
|
+
build(table) {
|
|
4316
|
+
return new PgCustomColumn(table, this.config);
|
|
4317
|
+
}
|
|
4318
|
+
};
|
|
4319
|
+
var PgCustomColumn = class extends PgColumn {
|
|
4320
|
+
static [entityKind] = "PgCustomColumn";
|
|
4321
|
+
codec;
|
|
4322
|
+
sqlName;
|
|
4323
|
+
mapFromJsonValue;
|
|
4324
|
+
jsonSelectIdentifier;
|
|
4325
|
+
constructor(table, config) {
|
|
4326
|
+
super(table, config);
|
|
4327
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
4328
|
+
this.mapToDriverValue = config.customTypeParams.toDriver ?? this.mapToDriverValue;
|
|
4329
|
+
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
4330
|
+
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
4331
|
+
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
4332
|
+
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
4333
|
+
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
4334
|
+
if (this.dimensions && config.customTypeParams.fromJson)
|
|
4335
|
+
this.mapFromJsonValue = (value) => {
|
|
4336
|
+
if (value === null)
|
|
4337
|
+
return value;
|
|
4338
|
+
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
4339
|
+
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
4340
|
+
};
|
|
4341
|
+
}
|
|
4342
|
+
mapJsonArrayElements(value, mapper, depth) {
|
|
4343
|
+
if (depth > 0 && Array.isArray(value))
|
|
4344
|
+
return value.map((v) => v === null ? null : this.mapJsonArrayElements(v, mapper, depth - 1));
|
|
4345
|
+
return mapper(value);
|
|
4346
|
+
}
|
|
4347
|
+
getSQLType() {
|
|
4348
|
+
return this.sqlName;
|
|
4349
|
+
}
|
|
4350
|
+
};
|
|
4351
|
+
function customType(customTypeParams) {
|
|
4352
|
+
return (a, b) => {
|
|
4353
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
4354
|
+
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
4355
|
+
};
|
|
4356
|
+
}
|
|
4357
|
+
// node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
4358
|
+
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
4359
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
4360
|
+
constructor(name2) {
|
|
4361
|
+
super(name2, "number double", "PgDoublePrecision");
|
|
4362
|
+
}
|
|
4363
|
+
build(table) {
|
|
4364
|
+
return new PgDoublePrecision(table, this.config);
|
|
4365
|
+
}
|
|
4366
|
+
};
|
|
4367
|
+
var PgDoublePrecision = class extends PgColumn {
|
|
4368
|
+
static [entityKind] = "PgDoublePrecision";
|
|
4369
|
+
codec = "float8";
|
|
4370
|
+
getSQLType() {
|
|
4371
|
+
return "double precision";
|
|
4372
|
+
}
|
|
4373
|
+
};
|
|
4374
|
+
function doublePrecision(name2) {
|
|
4375
|
+
return new PgDoublePrecisionBuilder(name2 ?? "");
|
|
4376
|
+
}
|
|
4377
|
+
// node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
4378
|
+
var PgIntegerBuilder = class extends PgIntColumnBuilder {
|
|
4379
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
4380
|
+
constructor(name2) {
|
|
4381
|
+
super(name2, "number int32", "PgInteger");
|
|
4382
|
+
}
|
|
4383
|
+
build(table) {
|
|
4384
|
+
return new PgInteger(table, this.config);
|
|
4385
|
+
}
|
|
4386
|
+
};
|
|
4387
|
+
var PgInteger = class extends PgColumn {
|
|
4388
|
+
static [entityKind] = "PgInteger";
|
|
4389
|
+
codec = "int";
|
|
4390
|
+
getSQLType() {
|
|
4391
|
+
return "integer";
|
|
4392
|
+
}
|
|
4393
|
+
};
|
|
4394
|
+
function integer(name2) {
|
|
4395
|
+
return new PgIntegerBuilder(name2 ?? "");
|
|
4396
|
+
}
|
|
4397
|
+
// node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
4398
|
+
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
4399
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
4400
|
+
constructor(name2) {
|
|
4401
|
+
super(name2, "object json", "PgJsonb");
|
|
4402
|
+
}
|
|
4403
|
+
build(table) {
|
|
4404
|
+
return new PgJsonb(table, this.config);
|
|
4405
|
+
}
|
|
4406
|
+
};
|
|
4407
|
+
var PgJsonb = class extends PgColumn {
|
|
4408
|
+
static [entityKind] = "PgJsonb";
|
|
4409
|
+
codec = "jsonb";
|
|
4410
|
+
constructor(table, config) {
|
|
4411
|
+
super(table, config);
|
|
4412
|
+
}
|
|
4413
|
+
getSQLType() {
|
|
4414
|
+
return "jsonb";
|
|
4415
|
+
}
|
|
4416
|
+
};
|
|
4417
|
+
function jsonb(name2) {
|
|
4418
|
+
return new PgJsonbBuilder(name2 ?? "");
|
|
4419
|
+
}
|
|
4420
|
+
// node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
4421
|
+
var PgSmallIntBuilder = class extends PgIntColumnBuilder {
|
|
4422
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
4423
|
+
constructor(name2) {
|
|
4424
|
+
super(name2, "number int16", "PgSmallInt");
|
|
4425
|
+
}
|
|
4426
|
+
build(table) {
|
|
4427
|
+
return new PgSmallInt(table, this.config);
|
|
4428
|
+
}
|
|
4429
|
+
};
|
|
4430
|
+
var PgSmallInt = class extends PgColumn {
|
|
4431
|
+
static [entityKind] = "PgSmallInt";
|
|
4432
|
+
codec = "smallint";
|
|
4433
|
+
getSQLType() {
|
|
4434
|
+
return "smallint";
|
|
4435
|
+
}
|
|
4436
|
+
};
|
|
4437
|
+
function smallint(name2) {
|
|
4438
|
+
return new PgSmallIntBuilder(name2 ?? "");
|
|
4439
|
+
}
|
|
4440
|
+
// node_modules/drizzle-orm/pg-core/columns/text.js
|
|
4441
|
+
var PgTextBuilder = class extends PgColumnBuilder {
|
|
4442
|
+
static [entityKind] = "PgTextBuilder";
|
|
4443
|
+
constructor(name2, config) {
|
|
4444
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgText");
|
|
4445
|
+
this.config.enumValues = config.enum;
|
|
4446
|
+
}
|
|
4447
|
+
build(table) {
|
|
4448
|
+
return new PgText(table, this.config, this.config.enumValues);
|
|
4449
|
+
}
|
|
4450
|
+
};
|
|
4451
|
+
var PgText = class extends PgColumn {
|
|
4452
|
+
static [entityKind] = "PgText";
|
|
4453
|
+
enumValues;
|
|
4454
|
+
codec = "text";
|
|
4455
|
+
constructor(table, config, enumValues) {
|
|
4456
|
+
super(table, config);
|
|
4457
|
+
this.enumValues = enumValues;
|
|
4458
|
+
}
|
|
4459
|
+
getSQLType() {
|
|
4460
|
+
return "text";
|
|
4461
|
+
}
|
|
4462
|
+
};
|
|
4463
|
+
function text(a, b = {}) {
|
|
4464
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
4465
|
+
return new PgTextBuilder(name2, config);
|
|
4466
|
+
}
|
|
4467
|
+
// node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
4468
|
+
var PgDateColumnBuilder = class extends PgColumnBuilder {
|
|
4469
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
4470
|
+
defaultNow() {
|
|
4471
|
+
return this.default(sql`now()`);
|
|
4472
|
+
}
|
|
4473
|
+
};
|
|
4474
|
+
|
|
4475
|
+
// node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
4476
|
+
var PgTimestampBuilder = class extends PgDateColumnBuilder {
|
|
4477
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
4478
|
+
constructor(name2, withTimezone, precision) {
|
|
4479
|
+
super(name2, "object date", "PgTimestamp");
|
|
4480
|
+
this.config.withTimezone = withTimezone;
|
|
4481
|
+
this.config.precision = precision;
|
|
4482
|
+
}
|
|
4483
|
+
build(table) {
|
|
4484
|
+
return new PgTimestamp(table, this.config);
|
|
4485
|
+
}
|
|
4486
|
+
};
|
|
4487
|
+
var PgTimestamp = class extends PgColumn {
|
|
4488
|
+
static [entityKind] = "PgTimestamp";
|
|
4489
|
+
codec;
|
|
4490
|
+
withTimezone;
|
|
4491
|
+
precision;
|
|
4492
|
+
constructor(table, config) {
|
|
4493
|
+
super(table, config);
|
|
4494
|
+
this.withTimezone = config.withTimezone;
|
|
4495
|
+
this.precision = config.precision;
|
|
4496
|
+
this.codec = this.withTimezone ? "timestamptz" : "timestamp";
|
|
4497
|
+
}
|
|
4498
|
+
getSQLType() {
|
|
4499
|
+
return `timestamp${this.precision === undefined ? "" : ` (${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
4500
|
+
}
|
|
4501
|
+
mapToDriverValue = (value) => {
|
|
4502
|
+
if (typeof value === "string")
|
|
4503
|
+
return value;
|
|
4504
|
+
return value.toISOString();
|
|
4505
|
+
};
|
|
4506
|
+
};
|
|
4507
|
+
var PgTimestampStringBuilder = class extends PgDateColumnBuilder {
|
|
4508
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
4509
|
+
constructor(name2, withTimezone, precision) {
|
|
4510
|
+
super(name2, "string timestamp", "PgTimestampString");
|
|
4511
|
+
this.config.withTimezone = withTimezone;
|
|
4512
|
+
this.config.precision = precision;
|
|
4513
|
+
}
|
|
4514
|
+
build(table) {
|
|
4515
|
+
return new PgTimestampString(table, this.config);
|
|
4516
|
+
}
|
|
4517
|
+
};
|
|
4518
|
+
var PgTimestampString = class extends PgColumn {
|
|
4519
|
+
static [entityKind] = "PgTimestampString";
|
|
4520
|
+
codec;
|
|
4521
|
+
withTimezone;
|
|
4522
|
+
precision;
|
|
4523
|
+
constructor(table, config) {
|
|
4524
|
+
super(table, config);
|
|
4525
|
+
this.withTimezone = config.withTimezone;
|
|
4526
|
+
this.precision = config.precision;
|
|
4527
|
+
this.codec = this.withTimezone ? "timestamptz:string" : "timestamp:string";
|
|
4528
|
+
}
|
|
4529
|
+
getSQLType() {
|
|
4530
|
+
return `timestamp${this.precision === undefined ? "" : `(${this.precision})`}${this.withTimezone ? " with time zone" : ""}`;
|
|
4531
|
+
}
|
|
4532
|
+
mapToDriverValue = (value) => {
|
|
4533
|
+
if (typeof value === "string")
|
|
4534
|
+
return value;
|
|
4535
|
+
return value.toISOString();
|
|
4536
|
+
};
|
|
4537
|
+
};
|
|
4538
|
+
function timestamp(a, b = {}) {
|
|
4539
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
4540
|
+
if (config?.mode === "string")
|
|
4541
|
+
return new PgTimestampStringBuilder(name2, config.withTimezone ?? false, config.precision);
|
|
4542
|
+
return new PgTimestampBuilder(name2, config?.withTimezone ?? false, config?.precision);
|
|
4543
|
+
}
|
|
4544
|
+
// node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
4545
|
+
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
4546
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
4547
|
+
constructor(name2, config) {
|
|
4548
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgVarchar");
|
|
4549
|
+
this.config.length = config.length;
|
|
4550
|
+
this.config.enumValues = config.enum;
|
|
4551
|
+
}
|
|
4552
|
+
build(table) {
|
|
4553
|
+
return new PgVarchar(table, this.config);
|
|
4554
|
+
}
|
|
4555
|
+
};
|
|
4556
|
+
var PgVarchar = class extends PgColumn {
|
|
4557
|
+
static [entityKind] = "PgVarchar";
|
|
4558
|
+
codec = "varchar";
|
|
4559
|
+
enumValues;
|
|
4560
|
+
constructor(table, config) {
|
|
4561
|
+
super(table, config);
|
|
4562
|
+
this.enumValues = config.enumValues;
|
|
4563
|
+
}
|
|
4564
|
+
getSQLType() {
|
|
4565
|
+
return this.length === undefined ? `varchar` : `varchar(${this.length})`;
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
function varchar(a, b = {}) {
|
|
4569
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
4570
|
+
return new PgVarcharBuilder(name2, config);
|
|
4571
|
+
}
|
|
4572
|
+
// node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
4573
|
+
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
4574
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
4575
|
+
constructor(name2) {
|
|
4576
|
+
super(name2, "number int53", "PgBigSerial53");
|
|
4577
|
+
this.config.hasDefault = true;
|
|
4578
|
+
this.config.notNull = true;
|
|
4579
|
+
}
|
|
4580
|
+
build(table) {
|
|
4581
|
+
return new PgBigSerial53(table, this.config);
|
|
4582
|
+
}
|
|
4583
|
+
};
|
|
4584
|
+
var PgBigSerial53 = class extends PgColumn {
|
|
4585
|
+
static [entityKind] = "PgBigSerial53";
|
|
4586
|
+
codec = "bigserial:number";
|
|
4587
|
+
getSQLType() {
|
|
4588
|
+
return "bigserial";
|
|
4589
|
+
}
|
|
4590
|
+
};
|
|
4591
|
+
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
4592
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
4593
|
+
constructor(name2) {
|
|
4594
|
+
super(name2, "bigint int64", "PgBigSerial64");
|
|
4595
|
+
this.config.hasDefault = true;
|
|
4596
|
+
this.config.notNull = true;
|
|
4597
|
+
}
|
|
4598
|
+
build(table) {
|
|
4599
|
+
return new PgBigSerial64(table, this.config);
|
|
4600
|
+
}
|
|
4601
|
+
};
|
|
4602
|
+
var PgBigSerial64 = class extends PgColumn {
|
|
4603
|
+
static [entityKind] = "PgBigSerial64";
|
|
4604
|
+
codec = "bigserial";
|
|
4605
|
+
getSQLType() {
|
|
4606
|
+
return "bigserial";
|
|
4607
|
+
}
|
|
4608
|
+
};
|
|
4609
|
+
function bigserial(a, b) {
|
|
4610
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
4611
|
+
if (config.mode === "number")
|
|
4612
|
+
return new PgBigSerial53Builder(name2);
|
|
4613
|
+
return new PgBigSerial64Builder(name2);
|
|
4614
|
+
}
|
|
3945
4615
|
|
|
3946
|
-
// node_modules/drizzle-orm/pg-core/columns/
|
|
3947
|
-
var
|
|
3948
|
-
static [entityKind] = "
|
|
3949
|
-
constructor(name2,
|
|
3950
|
-
super(name2, "
|
|
3951
|
-
this.config.
|
|
3952
|
-
this.config.
|
|
4616
|
+
// node_modules/drizzle-orm/pg-core/columns/char.js
|
|
4617
|
+
var PgCharBuilder = class extends PgColumnBuilder {
|
|
4618
|
+
static [entityKind] = "PgCharBuilder";
|
|
4619
|
+
constructor(name2, config) {
|
|
4620
|
+
super(name2, config.enum?.length ? "string enum" : "string", "PgChar");
|
|
4621
|
+
this.config.length = config.length ?? 1;
|
|
4622
|
+
this.config.setLength = config.length !== undefined;
|
|
4623
|
+
this.config.enumValues = config.enum;
|
|
3953
4624
|
}
|
|
3954
4625
|
build(table) {
|
|
3955
|
-
return new
|
|
4626
|
+
return new PgChar(table, this.config);
|
|
3956
4627
|
}
|
|
3957
4628
|
};
|
|
3958
|
-
var
|
|
3959
|
-
static [entityKind] = "
|
|
3960
|
-
codec;
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
jsonSelectIdentifier;
|
|
4629
|
+
var PgChar = class extends PgColumn {
|
|
4630
|
+
static [entityKind] = "PgChar";
|
|
4631
|
+
codec = "char";
|
|
4632
|
+
enumValues;
|
|
4633
|
+
setLength;
|
|
3964
4634
|
constructor(table, config) {
|
|
3965
4635
|
super(table, config);
|
|
3966
|
-
this.
|
|
3967
|
-
this.
|
|
3968
|
-
this.mapFromDriverValue = config.customTypeParams.fromDriver ?? this.mapFromDriverValue;
|
|
3969
|
-
this.mapFromJsonValue = config.customTypeParams.fromJson;
|
|
3970
|
-
this.jsonSelectIdentifier = config.customTypeParams.forJsonSelect;
|
|
3971
|
-
const cfgCodec = typeof config.customTypeParams.codec === "string" || typeof config.customTypeParams.codec === "undefined" ? config.customTypeParams.codec : config.customTypeParams.codec(config.fieldConfig);
|
|
3972
|
-
this.codec = typeof cfgCodec === "string" ? resolvePgTypeAlias(cfgCodec) : undefined;
|
|
3973
|
-
if (this.dimensions && config.customTypeParams.fromJson)
|
|
3974
|
-
this.mapFromJsonValue = (value) => {
|
|
3975
|
-
if (value === null)
|
|
3976
|
-
return value;
|
|
3977
|
-
const arr = typeof value === "string" ? parsePgArray(value) : value;
|
|
3978
|
-
return this.mapJsonArrayElements(arr, config.customTypeParams.fromJson, this.dimensions);
|
|
3979
|
-
};
|
|
4636
|
+
this.enumValues = config.enumValues;
|
|
4637
|
+
this.setLength = config.setLength;
|
|
3980
4638
|
}
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
4639
|
+
getSQLType() {
|
|
4640
|
+
return this.setLength ? `char(${this.length})` : `char`;
|
|
4641
|
+
}
|
|
4642
|
+
};
|
|
4643
|
+
function char(a, b = {}) {
|
|
4644
|
+
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
4645
|
+
return new PgCharBuilder(name2, config);
|
|
4646
|
+
}
|
|
4647
|
+
|
|
4648
|
+
// node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
4649
|
+
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
4650
|
+
static [entityKind] = "PgCidrBuilder";
|
|
4651
|
+
constructor(name2) {
|
|
4652
|
+
super(name2, "string cidr", "PgCidr");
|
|
4653
|
+
}
|
|
4654
|
+
build(table) {
|
|
4655
|
+
return new PgCidr(table, this.config);
|
|
3985
4656
|
}
|
|
4657
|
+
};
|
|
4658
|
+
var PgCidr = class extends PgColumn {
|
|
4659
|
+
static [entityKind] = "PgCidr";
|
|
4660
|
+
codec = "cidr";
|
|
3986
4661
|
getSQLType() {
|
|
3987
|
-
return
|
|
4662
|
+
return "cidr";
|
|
3988
4663
|
}
|
|
3989
4664
|
};
|
|
3990
|
-
function
|
|
3991
|
-
return (
|
|
3992
|
-
const { name: name2, config } = getColumnNameAndConfig2(a, b);
|
|
3993
|
-
return new PgCustomColumnBuilder(name2, config, customTypeParams);
|
|
3994
|
-
};
|
|
4665
|
+
function cidr(name2) {
|
|
4666
|
+
return new PgCidrBuilder(name2 ?? "");
|
|
3995
4667
|
}
|
|
3996
4668
|
|
|
3997
4669
|
// node_modules/drizzle-orm/pg-core/columns/date.js
|
|
@@ -10005,12 +10677,12 @@ async function hashQuery(sql2, params) {
|
|
|
10005
10677
|
var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
10006
10678
|
static [entityKind] = "PgCountBuilder";
|
|
10007
10679
|
dialect;
|
|
10008
|
-
static
|
|
10680
|
+
static buildCount(source, filters, parens) {
|
|
10009
10681
|
const query = sql`select count(*) from ${source}${sql` where ${filters}`.if(filters)}`;
|
|
10010
10682
|
return parens ? sql`(${query})` : query;
|
|
10011
10683
|
}
|
|
10012
10684
|
constructor(countConfig) {
|
|
10013
|
-
super(PgCountBuilder2.
|
|
10685
|
+
super(PgCountBuilder2.buildCount(countConfig.source, countConfig.filters, true).queryChunks);
|
|
10014
10686
|
this.countConfig = countConfig;
|
|
10015
10687
|
this.dialect = countConfig.dialect;
|
|
10016
10688
|
this.mapWith((e) => {
|
|
@@ -10019,10 +10691,13 @@ var PgCountBuilder = class PgCountBuilder2 extends SQL {
|
|
|
10019
10691
|
return Number(e ?? 0);
|
|
10020
10692
|
});
|
|
10021
10693
|
}
|
|
10694
|
+
executableSql;
|
|
10022
10695
|
build() {
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
|
|
10696
|
+
if (!this.executableSql) {
|
|
10697
|
+
const { source, filters } = this.countConfig;
|
|
10698
|
+
this.executableSql = PgCountBuilder2.buildCount(source, filters);
|
|
10699
|
+
}
|
|
10700
|
+
return this.dialect.sqlToQuery(this.executableSql);
|
|
10026
10701
|
}
|
|
10027
10702
|
};
|
|
10028
10703
|
|
|
@@ -10274,7 +10949,6 @@ var SelectionProxyHandler = class SelectionProxyHandler2 {
|
|
|
10274
10949
|
var PgDeleteBase2 = class {
|
|
10275
10950
|
static [entityKind] = "PgDelete";
|
|
10276
10951
|
config;
|
|
10277
|
-
cacheConfig;
|
|
10278
10952
|
constructor(table, session, dialect, withList) {
|
|
10279
10953
|
this.session = session;
|
|
10280
10954
|
this.dialect = dialect;
|
|
@@ -10322,7 +10996,7 @@ var PgDeleteBase2 = class {
|
|
|
10322
10996
|
var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
10323
10997
|
static [entityKind] = "PgAsyncDelete";
|
|
10324
10998
|
_prepare(name2, generateName = false) {
|
|
10325
|
-
const { session, config, dialect
|
|
10999
|
+
const { session, config, dialect } = this;
|
|
10326
11000
|
const { returning: fields } = config;
|
|
10327
11001
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
10328
11002
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -10330,7 +11004,7 @@ var PgAsyncDeleteBase2 = class extends PgDeleteBase2 {
|
|
|
10330
11004
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
10331
11005
|
type: "delete",
|
|
10332
11006
|
tables: [...extractUsedTable(this.config.table)]
|
|
10333
|
-
}
|
|
11007
|
+
});
|
|
10334
11008
|
});
|
|
10335
11009
|
}
|
|
10336
11010
|
prepare(name2) {
|
|
@@ -10377,7 +11051,6 @@ var PgSelectBuilder2 = class {
|
|
|
10377
11051
|
if (config.withList)
|
|
10378
11052
|
this.withList = config.withList;
|
|
10379
11053
|
this.distinct = config.distinct;
|
|
10380
|
-
this.tagged = config.tagged;
|
|
10381
11054
|
}
|
|
10382
11055
|
from(source) {
|
|
10383
11056
|
const isPartialSelect = !!this.fields;
|
|
@@ -10400,8 +11073,7 @@ var PgSelectBuilder2 = class {
|
|
|
10400
11073
|
session: this.session,
|
|
10401
11074
|
dialect: this.dialect,
|
|
10402
11075
|
withList: this.withList,
|
|
10403
|
-
distinct: this.distinct
|
|
10404
|
-
tagged: this.tagged
|
|
11076
|
+
distinct: this.distinct
|
|
10405
11077
|
});
|
|
10406
11078
|
}
|
|
10407
11079
|
};
|
|
@@ -10425,8 +11097,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
10425
11097
|
table: config.table,
|
|
10426
11098
|
fields: { ...config.fields },
|
|
10427
11099
|
distinct: config.distinct,
|
|
10428
|
-
setOperators: []
|
|
10429
|
-
_tagged: config.tagged
|
|
11100
|
+
setOperators: []
|
|
10430
11101
|
};
|
|
10431
11102
|
this.isPartialSelect = config.isPartialSelect;
|
|
10432
11103
|
this._ = {
|
|
@@ -10603,6 +11274,7 @@ var PgSelectBase2 = class extends TypedQueryBuilder {
|
|
|
10603
11274
|
return this;
|
|
10604
11275
|
}
|
|
10605
11276
|
getSQL() {
|
|
11277
|
+
this.config.fieldsFlat = orderSelectedFields2(this.config.fields, undefined, this.dialect.codecs);
|
|
10606
11278
|
return this.dialect.buildSelectQuery(this.config);
|
|
10607
11279
|
}
|
|
10608
11280
|
toSQL() {
|
|
@@ -10698,7 +11370,6 @@ params: ${params}`);
|
|
|
10698
11370
|
this.cause = cause;
|
|
10699
11371
|
}
|
|
10700
11372
|
};
|
|
10701
|
-
|
|
10702
11373
|
// node_modules/drizzle-orm/relations.js
|
|
10703
11374
|
var Relation2 = class {
|
|
10704
11375
|
static [entityKind] = "RelationV2";
|
|
@@ -10779,15 +11450,13 @@ var orderByOperators2 = {
|
|
|
10779
11450
|
asc,
|
|
10780
11451
|
desc
|
|
10781
11452
|
};
|
|
10782
|
-
function mapRelationalRow2(rows, isOne, buildQueryResultSelection,
|
|
11453
|
+
function mapRelationalRow2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false, useJsonMappers = true) {
|
|
10783
11454
|
const maxIdx = isOne ? 1 : rows.length;
|
|
10784
11455
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
10785
11456
|
let decoder;
|
|
10786
|
-
if (is(field, Column))
|
|
10787
|
-
if (useJsonMappers && field.mapFromJsonValue)
|
|
10788
|
-
return (v2) => field.mapFromJsonValue(v2);
|
|
11457
|
+
if (is(field, Column))
|
|
10789
11458
|
decoder = field;
|
|
10790
|
-
|
|
11459
|
+
else if (is(field, SQL))
|
|
10791
11460
|
decoder = field.decoder;
|
|
10792
11461
|
else if (is(field, SQL.Aliased))
|
|
10793
11462
|
decoder = field.sql.decoder;
|
|
@@ -10795,6 +11464,8 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
10795
11464
|
decoder = noopDecoder;
|
|
10796
11465
|
else
|
|
10797
11466
|
decoder = field.getSQL().decoder;
|
|
11467
|
+
if (useJsonMappers && field.mapFromJsonValue)
|
|
11468
|
+
return (v2) => field.mapFromJsonValue(v2);
|
|
10798
11469
|
return decoder.mapFromDriverValue.isNoop ? codec ? (value) => codec(value, arrayDimensions) : undefined : codec ? (value) => decoder.mapFromDriverValue(codec(value, arrayDimensions)) : (value) => decoder.mapFromDriverValue(value);
|
|
10799
11470
|
});
|
|
10800
11471
|
for (let i = 0;i < maxIdx; ++i) {
|
|
@@ -10811,14 +11482,12 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
10811
11482
|
} else if (parseJsonIfString && typeof row[selectionItem.key] === "string")
|
|
10812
11483
|
row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
|
|
10813
11484
|
if (selectionItem.isArray) {
|
|
10814
|
-
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection,
|
|
11485
|
+
mapRelationalRow2(row[selectionItem.key], false, selectionItem.selection, false, parseJsonIfString);
|
|
10815
11486
|
continue;
|
|
10816
11487
|
}
|
|
10817
|
-
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection,
|
|
11488
|
+
mapRelationalRow2(row[selectionItem.key], true, selectionItem.selection, false, parseJsonIfString);
|
|
10818
11489
|
continue;
|
|
10819
11490
|
}
|
|
10820
|
-
if (mapColumnValue)
|
|
10821
|
-
row[selectionItem.key] = mapColumnValue(row[selectionItem.key]);
|
|
10822
11491
|
if (row[selectionItem.key] === null)
|
|
10823
11492
|
continue;
|
|
10824
11493
|
const decoder = decoders[selectionItemIdx];
|
|
@@ -10829,7 +11498,7 @@ function mapRelationalRow2(rows, isOne, buildQueryResultSelection, mapColumnValu
|
|
|
10829
11498
|
}
|
|
10830
11499
|
return rows;
|
|
10831
11500
|
}
|
|
10832
|
-
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection,
|
|
11501
|
+
function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, parseJson = false, parseJsonIfString = false) {
|
|
10833
11502
|
const maxIdx = isOne ? 1 : rows.length;
|
|
10834
11503
|
const decoders = buildQueryResultSelection.map(({ field, codec, arrayDimensions }) => {
|
|
10835
11504
|
let decoder;
|
|
@@ -10866,14 +11535,12 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
10866
11535
|
} else if (parseJsonIfString && typeof value === "string")
|
|
10867
11536
|
value = JSON.parse(value);
|
|
10868
11537
|
if (selectionItem.isArray)
|
|
10869
|
-
mapRelationalRow2(value, false, selectionItem.selection,
|
|
11538
|
+
mapRelationalRow2(value, false, selectionItem.selection, false, parseJsonIfString);
|
|
10870
11539
|
else
|
|
10871
|
-
mapRelationalRow2(value, true, selectionItem.selection,
|
|
11540
|
+
mapRelationalRow2(value, true, selectionItem.selection, false, parseJsonIfString);
|
|
10872
11541
|
result[selectionItem.key] = value;
|
|
10873
11542
|
continue;
|
|
10874
11543
|
}
|
|
10875
|
-
if (mapColumnValue)
|
|
10876
|
-
value = mapColumnValue(value);
|
|
10877
11544
|
if (value === null) {
|
|
10878
11545
|
result[selectionItem.key] = null;
|
|
10879
11546
|
continue;
|
|
@@ -10885,14 +11552,14 @@ function mapRelationalRowFromArrays2(rows, isOne, buildQueryResultSelection, map
|
|
|
10885
11552
|
}
|
|
10886
11553
|
return isOne ? results[0] : results;
|
|
10887
11554
|
}
|
|
10888
|
-
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
11555
|
+
function makeDefaultRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
10889
11556
|
return (rows) => {
|
|
10890
11557
|
if (isFirst && !rows[0])
|
|
10891
11558
|
return rows[0];
|
|
10892
|
-
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection,
|
|
11559
|
+
return arrayModeRoot ? mapRelationalRowFromArrays2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString) : mapRelationalRow2(isFirst ? rows[0] : rows, isFirst, selection, parseJson, parseJsonIfString, rootJsonMappers);
|
|
10893
11560
|
};
|
|
10894
11561
|
}
|
|
10895
|
-
function makeJitRqbMapperInner(selection, rowExpr, selectionVar,
|
|
11562
|
+
function makeJitRqbMapperInner(selection, rowExpr, selectionVar, parseJson, parseJsonIfString, useJsonMappers, preFn, counter, accessByIdx) {
|
|
10896
11563
|
const bodyStmts = [];
|
|
10897
11564
|
const literalEntries = [];
|
|
10898
11565
|
let hasWork = false;
|
|
@@ -10916,7 +11583,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
10916
11583
|
preFn.push(`const { selection: ${nestedSelVar} } = ${sel};`);
|
|
10917
11584
|
if (isArray) {
|
|
10918
11585
|
const j = `j${counter.n++}`;
|
|
10919
|
-
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar,
|
|
11586
|
+
const inner = makeJitRqbMapperInner(innerSelection, `${slot}[${j}]`, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
10920
11587
|
if (inner.hasWork) {
|
|
10921
11588
|
hasWork = true;
|
|
10922
11589
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -10929,7 +11596,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
10929
11596
|
} else
|
|
10930
11597
|
preFn.splice(savedPreFnLen, 1);
|
|
10931
11598
|
} else {
|
|
10932
|
-
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar,
|
|
11599
|
+
const inner = makeJitRqbMapperInner(innerSelection, slot, nestedSelVar, false, parseJsonIfString, true, preFn, counter, false);
|
|
10933
11600
|
if (inner.hasWork) {
|
|
10934
11601
|
hasWork = true;
|
|
10935
11602
|
bodyStmts.push(`if (${slot} !== null) {`);
|
|
@@ -10958,21 +11625,39 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
10958
11625
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
10959
11626
|
}
|
|
10960
11627
|
} else if (is(field, SQL)) {
|
|
10961
|
-
if (
|
|
11628
|
+
if (useJsonMappers && field.decoder.mapFromJsonValue) {
|
|
11629
|
+
bypassCodecs = true;
|
|
11630
|
+
const id = counter.n++;
|
|
11631
|
+
destructure = `field: { decoder: dec${id} }`;
|
|
11632
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
11633
|
+
} else if (!field.decoder.mapFromDriverValue.isNoop) {
|
|
10962
11634
|
const id = counter.n++;
|
|
10963
11635
|
destructure = `field: { decoder: dec${id} }`;
|
|
10964
11636
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
10965
11637
|
}
|
|
10966
11638
|
} else if (is(field, SQL.Aliased)) {
|
|
10967
|
-
if (
|
|
11639
|
+
if (useJsonMappers && field.sql.decoder.mapFromJsonValue) {
|
|
11640
|
+
bypassCodecs = true;
|
|
11641
|
+
const id = counter.n++;
|
|
11642
|
+
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
11643
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
11644
|
+
} else if (!field.sql.decoder.mapFromDriverValue.isNoop) {
|
|
10968
11645
|
const id = counter.n++;
|
|
10969
11646
|
destructure = `field: { sql: { decoder: dec${id} } }`;
|
|
10970
11647
|
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
10971
11648
|
}
|
|
10972
|
-
} else if (is(field, Table) || is(field, View)) {} else
|
|
10973
|
-
const
|
|
10974
|
-
|
|
10975
|
-
|
|
11649
|
+
} else if (is(field, Table) || is(field, View)) {} else {
|
|
11650
|
+
const sqlExpr = field.getSQL();
|
|
11651
|
+
if (useJsonMappers && sqlExpr.decoder.mapFromJsonValue) {
|
|
11652
|
+
bypassCodecs = true;
|
|
11653
|
+
const id = counter.n++;
|
|
11654
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
11655
|
+
decoderExpr = `dec${id}.mapFromJsonValue`;
|
|
11656
|
+
} else if (!sqlExpr.decoder.mapFromDriverValue.isNoop) {
|
|
11657
|
+
const id = counter.n++;
|
|
11658
|
+
preFn.push(`const dec${id} = ${sel}.field.getSQL().decoder;`);
|
|
11659
|
+
decoderExpr = `dec${id}.mapFromDriverValue`;
|
|
11660
|
+
}
|
|
10976
11661
|
}
|
|
10977
11662
|
let codecVar = "";
|
|
10978
11663
|
if (!bypassCodecs && codec)
|
|
@@ -10985,19 +11670,7 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
10985
11670
|
parts.push(`codec: ${codecVar}`);
|
|
10986
11671
|
preFn.push(`const { ${parts.join(", ")} } = ${sel};`);
|
|
10987
11672
|
}
|
|
10988
|
-
if (
|
|
10989
|
-
hasWork = true;
|
|
10990
|
-
bodyStmts.push(`${slot} = mapColumnValue(${slot});`);
|
|
10991
|
-
if (decoderExpr || codecVar) {
|
|
10992
|
-
let decoded = slot;
|
|
10993
|
-
if (codecVar)
|
|
10994
|
-
decoded = `${codecVar}(${decoded}, ${arrayDimensions})`;
|
|
10995
|
-
if (decoderExpr)
|
|
10996
|
-
decoded = `${decoderExpr}(${decoded})`;
|
|
10997
|
-
bodyStmts.push(`if (${slot} !== null) ${slot} = ${decoded};`);
|
|
10998
|
-
}
|
|
10999
|
-
literalEntries.push(`${keyStr}: ${slot}`);
|
|
11000
|
-
} else if (decoderExpr || codecVar) {
|
|
11673
|
+
if (decoderExpr || codecVar) {
|
|
11001
11674
|
hasWork = true;
|
|
11002
11675
|
let decoded = slot;
|
|
11003
11676
|
if (codecVar)
|
|
@@ -11014,12 +11687,12 @@ function makeJitRqbMapperInner(selection, rowExpr, selectionVar, mapColumnValue,
|
|
|
11014
11687
|
hasWork
|
|
11015
11688
|
};
|
|
11016
11689
|
}
|
|
11017
|
-
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }
|
|
11690
|
+
function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, rootJsonMappers, arrayModeRoot }) {
|
|
11018
11691
|
const preFn = [];
|
|
11019
|
-
const inner = makeJitRqbMapperInner(selection, "row", "selection",
|
|
11692
|
+
const inner = makeJitRqbMapperInner(selection, "row", "selection", parseJson, parseJsonIfString, arrayModeRoot ? false : rootJsonMappers, preFn, { n: 0 }, !!arrayModeRoot);
|
|
11020
11693
|
const lines = [];
|
|
11021
11694
|
lines.push(` "use strict";
|
|
11022
|
-
const { selection
|
|
11695
|
+
const { selection } = this;`);
|
|
11023
11696
|
for (const p2 of preFn)
|
|
11024
11697
|
lines.push(` ${p2}`);
|
|
11025
11698
|
if (arrayModeRoot)
|
|
@@ -11061,10 +11734,7 @@ function makeJitRqbMapper2({ selection, isFirst, parseJson, parseJsonIfString, r
|
|
|
11061
11734
|
lines.push("\t//# sourceURL=drizzle:jit-relational-query-mapper");
|
|
11062
11735
|
const compiled = lines.join(`
|
|
11063
11736
|
`);
|
|
11064
|
-
return Object.assign(new FnConstructor2("rows", compiled).bind({
|
|
11065
|
-
selection,
|
|
11066
|
-
mapColumnValue
|
|
11067
|
-
}), { body: `function jitRqbMapper (rows) {
|
|
11737
|
+
return Object.assign(new FnConstructor2("rows", compiled).bind({ selection }), { body: `function jitRqbMapper (rows) {
|
|
11068
11738
|
${compiled}
|
|
11069
11739
|
}` });
|
|
11070
11740
|
}
|
|
@@ -11187,17 +11857,23 @@ function relationsOrderToSQL2(table, orders) {
|
|
|
11187
11857
|
return;
|
|
11188
11858
|
return sql.join(entries.map(([target, value]) => (value === "asc" ? asc : desc)(fieldSelectionToSQL2(table, target))), sql`, `);
|
|
11189
11859
|
}
|
|
11190
|
-
function relationExtrasToSQL2(table, extras) {
|
|
11860
|
+
function relationExtrasToSQL2(table, extras, codecs, inJson) {
|
|
11191
11861
|
const subqueries = [];
|
|
11192
11862
|
const selection = [];
|
|
11193
11863
|
for (const [key, field] of Object.entries(extras)) {
|
|
11194
11864
|
if (!field)
|
|
11195
11865
|
continue;
|
|
11196
|
-
const
|
|
11197
|
-
const
|
|
11198
|
-
query
|
|
11866
|
+
const subq = (typeof field === "function" ? field(table, { sql: operators2.sql }) : field).getSQL();
|
|
11867
|
+
const column = codecs ? getColumnFromDecoder2(subq) : undefined;
|
|
11868
|
+
const query = column && (!inJson || !column.jsonSelectIdentifier) ? sql`${codecs.apply(column, inJson ? "castInJson" : "cast", sql`(${subq})`)} as ${sql.identifier(key)}` : sql`(${subq}) as ${sql.identifier(key)}`;
|
|
11869
|
+
query.decoder = subq.decoder;
|
|
11199
11870
|
subqueries.push(query);
|
|
11200
|
-
selection.push({
|
|
11871
|
+
selection.push(column && (!inJson || !column.mapFromJsonValue) ? {
|
|
11872
|
+
key,
|
|
11873
|
+
field: query,
|
|
11874
|
+
codec: codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
11875
|
+
arrayDimensions: column.dimensions
|
|
11876
|
+
} : {
|
|
11201
11877
|
key,
|
|
11202
11878
|
field: query
|
|
11203
11879
|
});
|
|
@@ -11306,43 +11982,58 @@ var PgDialect2 = class {
|
|
|
11306
11982
|
}
|
|
11307
11983
|
buildSelection(fields, { isSingleTable = false, ignoreCastCodecs = false } = {}) {
|
|
11308
11984
|
const columnsLen = fields.length;
|
|
11309
|
-
const chunks = fields.flatMap(({ field }, i) => {
|
|
11985
|
+
const chunks = fields.flatMap(({ field, codecOverride, column }, i) => {
|
|
11310
11986
|
const chunk = [];
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11987
|
+
const override = codecOverride;
|
|
11988
|
+
if (is(field, SQL.Aliased))
|
|
11989
|
+
if (field.isSelectionField) {
|
|
11990
|
+
const query = !isSingleTable && field.origin !== undefined ? sql`${sql.identifier(field.origin)}.${sql.identifier(field.fieldAlias)}` : sql.identifier(field.fieldAlias);
|
|
11991
|
+
if (column && !ignoreCastCodecs)
|
|
11992
|
+
chunk.push(this.codecs.apply(column, "cast", query, override));
|
|
11993
|
+
else
|
|
11994
|
+
chunk.push(query);
|
|
11995
|
+
} else {
|
|
11996
|
+
const query = field.sql;
|
|
11997
|
+
if (isSingleTable) {
|
|
11998
|
+
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
11999
|
+
if (is(c, PgColumn))
|
|
12000
|
+
return sql.identifier(c.name);
|
|
12001
|
+
return c;
|
|
12002
|
+
}));
|
|
12003
|
+
if (query.shouldInlineParams)
|
|
12004
|
+
newSql.inlineParams();
|
|
12005
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
12006
|
+
} else
|
|
12007
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
12008
|
+
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
12009
|
+
}
|
|
12010
|
+
else if (is(field, SQL)) {
|
|
12011
|
+
const query = field;
|
|
11317
12012
|
if (isSingleTable) {
|
|
11318
12013
|
const newSql = new SQL(query.queryChunks.map((c) => {
|
|
11319
12014
|
if (is(c, PgColumn))
|
|
11320
12015
|
return sql.identifier(c.name);
|
|
11321
12016
|
return c;
|
|
11322
12017
|
}));
|
|
11323
|
-
|
|
12018
|
+
if (query.shouldInlineParams)
|
|
12019
|
+
newSql.inlineParams();
|
|
12020
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", newSql, override) : newSql);
|
|
11324
12021
|
} else
|
|
11325
|
-
chunk.push(query);
|
|
11326
|
-
if (is(field, SQL.Aliased))
|
|
11327
|
-
chunk.push(sql` as ${sql.identifier(field.fieldAlias)}`);
|
|
12022
|
+
chunk.push(column && !ignoreCastCodecs ? this.codecs.apply(column, "cast", query, override) : query);
|
|
11328
12023
|
} else if (is(field, Column)) {
|
|
11329
12024
|
let name2;
|
|
11330
12025
|
if (isSingleTable)
|
|
11331
12026
|
name2 = field.isAlias ? sql.identifier(getOriginalColumnFromAlias2(field).name) : sql.identifier(field.name);
|
|
11332
12027
|
else
|
|
11333
12028
|
name2 = field.isAlias ? getOriginalColumnFromAlias2(field) : field;
|
|
11334
|
-
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2);
|
|
12029
|
+
const casted = ignoreCastCodecs ? name2 : this.codecs.apply(field, "cast", name2, override);
|
|
11335
12030
|
chunk.push(field.isAlias ? sql`${casted} as ${field}` : casted);
|
|
11336
|
-
} else if (is(field, Subquery))
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
field._.sql.decoder = fieldDecoder;
|
|
11343
|
-
}
|
|
11344
|
-
chunk.push(field);
|
|
11345
|
-
}
|
|
12031
|
+
} else if (is(field, Subquery))
|
|
12032
|
+
if (column && !ignoreCastCodecs && !field._.isWith) {
|
|
12033
|
+
const innerCasted = this.codecs.apply(column, "cast", sql`(${field._.sql})`, override);
|
|
12034
|
+
chunk.push(sql`${innerCasted} ${sql.identifier(field._.alias)}`);
|
|
12035
|
+
} else
|
|
12036
|
+
chunk.push(column ? this.codecs.apply(column, "cast", field) : field, override);
|
|
11346
12037
|
if (i < columnsLen - 1)
|
|
11347
12038
|
chunk.push(sql`, `);
|
|
11348
12039
|
return chunk;
|
|
@@ -11393,8 +12084,10 @@ var PgDialect2 = class {
|
|
|
11393
12084
|
}
|
|
11394
12085
|
return table;
|
|
11395
12086
|
}
|
|
11396
|
-
buildSelectQuery({ withList,
|
|
11397
|
-
|
|
12087
|
+
buildSelectQuery({ withList, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, comment, ignoreSelectionCastCodecs }) {
|
|
12088
|
+
if (!fieldsFlat)
|
|
12089
|
+
throw new Error("Select query builder must be provided with `fieldsFlat` on `buildSelectQuery` invocation");
|
|
12090
|
+
const fieldsList = fieldsFlat;
|
|
11398
12091
|
for (const f of fieldsList)
|
|
11399
12092
|
if (is(f.field, Column) && getTableName(f.field.table) !== (is(table, Subquery) ? table._.alias : is(table, PgViewBase) ? table[ViewBaseConfig].name : is(table, SQL) ? undefined : getTableName(table)) && !((table2) => joins?.some(({ alias: alias2 }) => alias2 === (table2[Table.Symbol.IsAlias] ? getTableName(table2) : table2[Table.Symbol.BaseName])))(f.field.table)) {
|
|
11400
12093
|
const tableName = getTableName(f.field.table);
|
|
@@ -11407,7 +12100,7 @@ var PgDialect2 = class {
|
|
|
11407
12100
|
distinctSql = distinct === true ? sql` distinct` : sql` distinct on (${sql.join(distinct.on, sql`, `)})`;
|
|
11408
12101
|
const selection = this.buildSelection(fieldsList, {
|
|
11409
12102
|
isSingleTable,
|
|
11410
|
-
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
12103
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs || setOperators.length > 0
|
|
11411
12104
|
});
|
|
11412
12105
|
const tableSql = this.buildFromTable(table);
|
|
11413
12106
|
const joinsSql = this.buildJoins(joins);
|
|
@@ -11434,26 +12127,67 @@ var PgDialect2 = class {
|
|
|
11434
12127
|
}
|
|
11435
12128
|
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClauseSql}${comment !== undefined ? sql` ${comment}` : undefined}`;
|
|
11436
12129
|
if (setOperators.length > 0)
|
|
11437
|
-
return this.buildSetOperations(finalQuery, setOperators);
|
|
12130
|
+
return this.buildSetOperations(finalQuery, fieldsList, ignoreSelectionCastCodecs, setOperators);
|
|
11438
12131
|
return finalQuery;
|
|
11439
12132
|
}
|
|
11440
|
-
buildSetOperations(leftSelect, setOperators) {
|
|
11441
|
-
const
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
12133
|
+
buildSetOperations(leftSelect, leftSelection, ignoreSelectionCastCodecs, setOperators) {
|
|
12134
|
+
const outputSelection = leftSelection;
|
|
12135
|
+
for (let i = 0;i < setOperators.length; ++i) {
|
|
12136
|
+
const setOperator = setOperators[i];
|
|
12137
|
+
if (!setOperator)
|
|
12138
|
+
throw new Error("Cannot pass undefined values to any set operator");
|
|
12139
|
+
leftSelect = this.buildSetOperationQuery({
|
|
11446
12140
|
leftSelect,
|
|
11447
12141
|
setOperator
|
|
11448
12142
|
});
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
12143
|
+
const rightSelection = orderSelectedFields2(setOperator.rightSelect.getSelectedFields());
|
|
12144
|
+
for (let j = 0;j < outputSelection.length; ++j) {
|
|
12145
|
+
const l = outputSelection[j];
|
|
12146
|
+
const lPath = l.path.join(".");
|
|
12147
|
+
const r = rightSelection.find((e) => e.path.join(".") === lPath);
|
|
12148
|
+
const lc = l.codecOverride ?? l.column?.codec;
|
|
12149
|
+
const rc = r.codecOverride ?? r.column?.codec;
|
|
12150
|
+
outputSelection[j].codecOverride = lc && rc ? unionsTypeTable[lc]?.[rc] : lc;
|
|
12151
|
+
}
|
|
12152
|
+
}
|
|
12153
|
+
for (let i = 0;i < outputSelection.length; ++i) {
|
|
12154
|
+
const out = outputSelection[i];
|
|
12155
|
+
out.codec = out.codecOverride ? this.codecs.get(out.column, "normalize", out.codecOverride) : out.codec;
|
|
12156
|
+
}
|
|
12157
|
+
return ignoreSelectionCastCodecs ? leftSelect : sql`select ${this.buildSelection(outputSelection.map((field) => {
|
|
12158
|
+
if (is(field.field, SQL.Aliased)) {
|
|
12159
|
+
const ref = field.field.clone();
|
|
12160
|
+
ref.isSelectionField = true;
|
|
12161
|
+
return {
|
|
12162
|
+
...field,
|
|
12163
|
+
field: ref
|
|
12164
|
+
};
|
|
12165
|
+
}
|
|
12166
|
+
if (is(field.field, Column) && field.field.isAlias) {
|
|
12167
|
+
const ref = new SQL.Aliased(sql`${sql.identifier(field.field.name)}`, field.field.name);
|
|
12168
|
+
ref.isSelectionField = true;
|
|
12169
|
+
return {
|
|
12170
|
+
...field,
|
|
12171
|
+
field: ref
|
|
12172
|
+
};
|
|
12173
|
+
}
|
|
12174
|
+
if (is(field.field, Subquery)) {
|
|
12175
|
+
const ref = new SQL.Aliased(sql`${field.field.getSQL()}`, field.field._.alias);
|
|
12176
|
+
ref.isSelectionField = true;
|
|
12177
|
+
return {
|
|
12178
|
+
...field,
|
|
12179
|
+
field: ref
|
|
12180
|
+
};
|
|
12181
|
+
}
|
|
12182
|
+
return field;
|
|
12183
|
+
}), {
|
|
12184
|
+
isSingleTable: true,
|
|
12185
|
+
ignoreCastCodecs: ignoreSelectionCastCodecs
|
|
12186
|
+
})} from (${leftSelect}) ${sql.identifier("drizzle_union")}`;
|
|
11453
12187
|
}
|
|
11454
12188
|
buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset } }) {
|
|
11455
12189
|
const leftChunk = sql`(${leftSelect.getSQL()}) `;
|
|
11456
|
-
const rightChunk = sql`(${rightSelect.getSQL()})`;
|
|
12190
|
+
const rightChunk = sql`(${rightSelect.withoutSelectionCastCodecs().getSQL()})`;
|
|
11457
12191
|
let orderBySql;
|
|
11458
12192
|
if (orderBy && orderBy.length > 0) {
|
|
11459
12193
|
const orderByValues = [];
|
|
@@ -11479,8 +12213,9 @@ var PgDialect2 = class {
|
|
|
11479
12213
|
buildInsertQuery({ table, values: valuesOrSelect, onConflict, returning, withList, select, overridingSystemValue_, comment, ignoreSelectionCastCodecs }) {
|
|
11480
12214
|
const valuesSqlList = [];
|
|
11481
12215
|
const columns = table[Table.Symbol.Columns];
|
|
11482
|
-
const colEntries = Object.entries(columns)
|
|
11483
|
-
const
|
|
12216
|
+
const colEntries = Object.entries(columns);
|
|
12217
|
+
const colFilteredEntries = select && !is(valuesOrSelect, SQL) ? Object.keys(valuesOrSelect.getSelectedFields()).map((key) => [key, columns[key]]) : overridingSystemValue_ ? colEntries : colEntries.filter(([_, col]) => !col.shouldDisableInsert());
|
|
12218
|
+
const insertOrder = colFilteredEntries.map(([, column]) => sql.identifier(column.name));
|
|
11484
12219
|
if (select) {
|
|
11485
12220
|
const select2 = valuesOrSelect;
|
|
11486
12221
|
if (is(select2, SQL))
|
|
@@ -11492,7 +12227,7 @@ var PgDialect2 = class {
|
|
|
11492
12227
|
valuesSqlList.push(sql.raw("values "));
|
|
11493
12228
|
for (const [valueIndex, value] of values.entries()) {
|
|
11494
12229
|
const valueList = [];
|
|
11495
|
-
for (const [fieldName, col] of
|
|
12230
|
+
for (const [fieldName, col] of colFilteredEntries) {
|
|
11496
12231
|
const colValue = value[fieldName];
|
|
11497
12232
|
if (colValue === undefined || is(colValue, Param) && colValue.value === undefined)
|
|
11498
12233
|
if (col.defaultFn !== undefined) {
|
|
@@ -11543,31 +12278,48 @@ var PgDialect2 = class {
|
|
|
11543
12278
|
tagged: true
|
|
11544
12279
|
});
|
|
11545
12280
|
}
|
|
11546
|
-
|
|
12281
|
+
buildRqbColumn(table, field, key, inJson) {
|
|
12282
|
+
if (is(field, Column)) {
|
|
12283
|
+
const name2 = sql`${table}.${sql.identifier(field.name)}`;
|
|
12284
|
+
return sql`${inJson && field.jsonSelectIdentifier ? field.jsonSelectIdentifier(name2, sql, field.dimensions) : this.codecs.apply(field, inJson ? "castInJson" : "cast", name2)} as ${sql.identifier(key)}`;
|
|
12285
|
+
}
|
|
12286
|
+
if (is(field, SQL.Aliased)) {
|
|
12287
|
+
const column = getColumnFromDecoder2(field);
|
|
12288
|
+
const q = sql`${table}.${sql.identifier(field.fieldAlias)}`;
|
|
12289
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
12290
|
+
}
|
|
12291
|
+
if (isSQLWrapper(field)) {
|
|
12292
|
+
const column = getColumnFromDecoder2(field);
|
|
12293
|
+
const q = sql`${table}.${sql.identifier(key)}`;
|
|
12294
|
+
return sql`${column ? this.codecs.apply(column, inJson ? "castInJson" : "cast", q) : q} as ${sql.identifier(key)}`;
|
|
12295
|
+
}
|
|
11547
12296
|
throw new DrizzleError2({ message: `Views with nested selections are not supported by the relational query builder` });
|
|
11548
12297
|
}
|
|
11549
|
-
|
|
11550
|
-
if (is(
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
12298
|
+
resolveSelection(field, key, inJson) {
|
|
12299
|
+
if (is(field, Column))
|
|
12300
|
+
return {
|
|
12301
|
+
key,
|
|
12302
|
+
field,
|
|
12303
|
+
codec: this.codecs.get(field, inJson ? "normalizeInJson" : "normalize"),
|
|
12304
|
+
arrayDimensions: field.dimensions
|
|
12305
|
+
};
|
|
12306
|
+
const decoderColumn = getColumnFromDecoder2(field);
|
|
12307
|
+
return decoderColumn ? {
|
|
12308
|
+
key,
|
|
12309
|
+
field,
|
|
12310
|
+
codec: decoderColumn && (!inJson || !decoderColumn.mapFromJsonValue) ? this.codecs.get(decoderColumn, inJson ? "normalizeInJson" : "normalize") : undefined,
|
|
12311
|
+
arrayDimensions: decoderColumn.dimensions
|
|
12312
|
+
} : {
|
|
12313
|
+
key,
|
|
12314
|
+
field
|
|
12315
|
+
};
|
|
11555
12316
|
}
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
field: v2
|
|
11563
|
-
} : {
|
|
11564
|
-
key: k,
|
|
11565
|
-
field: v2
|
|
11566
|
-
});
|
|
11567
|
-
return this.buildRqbColumn(table, v2, k, inJson);
|
|
11568
|
-
}), sql`, `);
|
|
11569
|
-
};
|
|
11570
|
-
buildColumns = (table, selection, inJson, config) => config?.columns ? (() => {
|
|
12317
|
+
buildColumns = (table, selection, inJson, config) => {
|
|
12318
|
+
if (!config?.columns)
|
|
12319
|
+
return sql.join(Object.entries(table[TableColumns]).map(([k, v2]) => {
|
|
12320
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
12321
|
+
return this.buildRqbColumn(table, v2, k, inJson);
|
|
12322
|
+
}), sql`, `);
|
|
11571
12323
|
const entries = Object.entries(config.columns);
|
|
11572
12324
|
const columnContainer = table[TableColumns];
|
|
11573
12325
|
const columnIdentifiers = [];
|
|
@@ -11579,15 +12331,7 @@ var PgDialect2 = class {
|
|
|
11579
12331
|
if (v2) {
|
|
11580
12332
|
const column = columnContainer[k];
|
|
11581
12333
|
columnIdentifiers.push(this.buildRqbColumn(table, column, k, inJson));
|
|
11582
|
-
selection.push(
|
|
11583
|
-
key: k,
|
|
11584
|
-
codec: this.codecs.get(column, inJson ? "normalizeInJson" : "normalize"),
|
|
11585
|
-
arrayDimensions: column.dimensions,
|
|
11586
|
-
field: column
|
|
11587
|
-
} : {
|
|
11588
|
-
key: k,
|
|
11589
|
-
field: column
|
|
11590
|
-
});
|
|
12334
|
+
selection.push(this.resolveSelection(column, k, inJson));
|
|
11591
12335
|
}
|
|
11592
12336
|
}
|
|
11593
12337
|
if (colSelectionMode === false)
|
|
@@ -11595,18 +12339,10 @@ var PgDialect2 = class {
|
|
|
11595
12339
|
if (config.columns[k] === false)
|
|
11596
12340
|
continue;
|
|
11597
12341
|
columnIdentifiers.push(this.buildRqbColumn(table, v2, k, inJson));
|
|
11598
|
-
selection.push(
|
|
11599
|
-
key: k,
|
|
11600
|
-
codec: this.codecs.get(v2, inJson ? "normalizeInJson" : "normalize"),
|
|
11601
|
-
arrayDimensions: v2.dimensions,
|
|
11602
|
-
field: v2
|
|
11603
|
-
} : {
|
|
11604
|
-
key: k,
|
|
11605
|
-
field: v2
|
|
11606
|
-
});
|
|
12342
|
+
selection.push(this.resolveSelection(v2, k, inJson));
|
|
11607
12343
|
}
|
|
11608
12344
|
return columnIdentifiers.length ? sql.join(columnIdentifiers, sql`, `) : undefined;
|
|
11609
|
-
}
|
|
12345
|
+
};
|
|
11610
12346
|
buildRelationalQuery({ schema, table, tableConfig, queryConfig: config, relationWhere, mode, errorPath, depth, throughJoin, nested }) {
|
|
11611
12347
|
const selection = [];
|
|
11612
12348
|
const isSingle = mode === "first";
|
|
@@ -11620,7 +12356,7 @@ var PgDialect2 = class {
|
|
|
11620
12356
|
const where = params?.where && relationWhere ? and(relationsFilterToSQL2(table, params.where, tableConfig.relations, schema), relationWhere) : params?.where ? relationsFilterToSQL2(table, params.where, tableConfig.relations, schema) : relationWhere;
|
|
11621
12357
|
const order = params?.orderBy ? relationsOrderToSQL2(table, params.orderBy) : undefined;
|
|
11622
12358
|
const columns = this.buildColumns(table, selection, !!nested, params);
|
|
11623
|
-
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras) : undefined;
|
|
12359
|
+
const extras = params?.extras ? relationExtrasToSQL2(table, params.extras, this.codecs, nested) : undefined;
|
|
11624
12360
|
if (extras)
|
|
11625
12361
|
selection.push(...extras.selection);
|
|
11626
12362
|
const selectionArr = columns ? [columns] : [];
|
|
@@ -11770,11 +12506,6 @@ var PgInsertBuilder2 = class {
|
|
|
11770
12506
|
this.overridingSystemValue_ = overridingSystemValue_;
|
|
11771
12507
|
this.builder = builder;
|
|
11772
12508
|
}
|
|
11773
|
-
authToken;
|
|
11774
|
-
setToken(token) {
|
|
11775
|
-
this.authToken = token;
|
|
11776
|
-
return this;
|
|
11777
|
-
}
|
|
11778
12509
|
overridingSystemValue() {
|
|
11779
12510
|
this.overridingSystemValue_ = true;
|
|
11780
12511
|
return this;
|
|
@@ -11792,27 +12523,25 @@ var PgInsertBuilder2 = class {
|
|
|
11792
12523
|
}
|
|
11793
12524
|
return result;
|
|
11794
12525
|
});
|
|
11795
|
-
|
|
11796
|
-
if ("setToken" in builder)
|
|
11797
|
-
builder.setToken(this.authToken);
|
|
11798
|
-
return builder;
|
|
12526
|
+
return new this.builder(this.table, mappedValues, this.session, this.dialect, this.withList, false, this.overridingSystemValue_);
|
|
11799
12527
|
}
|
|
11800
12528
|
select(selectQuery) {
|
|
11801
12529
|
const select = typeof selectQuery === "function" ? selectQuery(new QueryBuilder2) : selectQuery;
|
|
11802
12530
|
if ("withoutSelectionCastCodecs" in select)
|
|
11803
12531
|
select.withoutSelectionCastCodecs();
|
|
11804
|
-
if (!is(select, SQL)
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
12532
|
+
if (!is(select, SQL)) {
|
|
12533
|
+
const insertCols = Object.keys(this.table[Table.Symbol.Columns]);
|
|
12534
|
+
const selected = Object.keys(select._.selectedFields);
|
|
12535
|
+
for (const col of selected)
|
|
12536
|
+
if (!insertCols.includes(col))
|
|
12537
|
+
throw new Error(`Insert select error: column "${col}" does not exist in table "${this.table[Table.Symbol.Name]}"`);
|
|
12538
|
+
}
|
|
12539
|
+
return new this.builder(this.table, select, this.session, this.dialect, this.withList, true, this.overridingSystemValue_);
|
|
11810
12540
|
}
|
|
11811
12541
|
};
|
|
11812
12542
|
var PgInsertBase2 = class {
|
|
11813
12543
|
static [entityKind] = "PgInsert";
|
|
11814
12544
|
config;
|
|
11815
|
-
cacheConfig;
|
|
11816
12545
|
constructor(table, values, session, dialect, withList, select, overridingSystemValue_) {
|
|
11817
12546
|
this.session = session;
|
|
11818
12547
|
this.dialect = dialect;
|
|
@@ -11882,7 +12611,7 @@ var PgInsertBase2 = class {
|
|
|
11882
12611
|
var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
11883
12612
|
static [entityKind] = "PgAsyncInsert";
|
|
11884
12613
|
_prepare(name2, generateName = false) {
|
|
11885
|
-
const { session, config, dialect
|
|
12614
|
+
const { session, config, dialect } = this;
|
|
11886
12615
|
const { returning: fields } = config;
|
|
11887
12616
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
11888
12617
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -11890,7 +12619,7 @@ var PgAsyncInsertBase2 = class extends PgInsertBase2 {
|
|
|
11890
12619
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
11891
12620
|
type: "insert",
|
|
11892
12621
|
tables: [...extractUsedTable(this.config.table)]
|
|
11893
|
-
}
|
|
12622
|
+
});
|
|
11894
12623
|
});
|
|
11895
12624
|
}
|
|
11896
12625
|
prepare(name2) {
|
|
@@ -11935,10 +12664,10 @@ applyMixins2(PgAsyncRelationalQuery2, [QueryPromise2]);
|
|
|
11935
12664
|
// node_modules/drizzle-orm/pg-core/query-builders/raw.js
|
|
11936
12665
|
var PgRaw = class {
|
|
11937
12666
|
static [entityKind] = "PgRaw";
|
|
11938
|
-
constructor(sql2, query
|
|
12667
|
+
constructor(prepared, sql2, query) {
|
|
12668
|
+
this.prepared = prepared;
|
|
11939
12669
|
this.sql = sql2;
|
|
11940
12670
|
this.query = query;
|
|
11941
|
-
this.mapBatchResult = mapBatchResult;
|
|
11942
12671
|
}
|
|
11943
12672
|
getSQL() {
|
|
11944
12673
|
return this.sql;
|
|
@@ -11946,20 +12675,22 @@ var PgRaw = class {
|
|
|
11946
12675
|
getQuery() {
|
|
11947
12676
|
return this.query;
|
|
11948
12677
|
}
|
|
11949
|
-
|
|
11950
|
-
return
|
|
12678
|
+
_prepare() {
|
|
12679
|
+
return this.prepared;
|
|
11951
12680
|
}
|
|
11952
12681
|
};
|
|
11953
12682
|
|
|
11954
12683
|
// node_modules/drizzle-orm/pg-core/async/raw.js
|
|
11955
12684
|
var PgAsyncRaw2 = class extends PgRaw {
|
|
11956
12685
|
static [entityKind] = "PgAsyncRaw";
|
|
11957
|
-
constructor(
|
|
11958
|
-
super(sql2, query
|
|
11959
|
-
|
|
12686
|
+
constructor(prepared, sql2, query) {
|
|
12687
|
+
super(prepared, sql2, query);
|
|
12688
|
+
}
|
|
12689
|
+
execute(placeholderValues) {
|
|
12690
|
+
return this.prepared.execute(placeholderValues);
|
|
11960
12691
|
}
|
|
11961
12692
|
_prepare() {
|
|
11962
|
-
return this;
|
|
12693
|
+
return this.prepared;
|
|
11963
12694
|
}
|
|
11964
12695
|
};
|
|
11965
12696
|
applyMixins2(PgAsyncRaw2, [QueryPromise2]);
|
|
@@ -12017,12 +12748,11 @@ applyMixins2(PgAsyncRefreshMaterializedView2, [QueryPromise2]);
|
|
|
12017
12748
|
var PgAsyncSelectBase2 = class extends PgSelectBase2 {
|
|
12018
12749
|
static [entityKind] = "PgAsyncSelectQueryBuilder";
|
|
12019
12750
|
_prepare(name2, generateName = false) {
|
|
12020
|
-
const { session,
|
|
12021
|
-
const { fields } = config;
|
|
12751
|
+
const { session, dialect, cacheConfig, usedTables } = this;
|
|
12022
12752
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
12023
|
-
const query = this.config.
|
|
12024
|
-
const fieldsList =
|
|
12025
|
-
const mapper = this.dialect.mapperGenerators.rows(fieldsList, joinsNotNullableMap);
|
|
12753
|
+
const query = this.config.tagged ? dialect._sqlToQuery(this.getSQL()) : dialect.sqlToQuery(this.getSQL());
|
|
12754
|
+
const fieldsList = this.config.fieldsFlat;
|
|
12755
|
+
const mapper = this.dialect.mapperGenerators.rows(fieldsList, this.joinsNotNullableMap);
|
|
12026
12756
|
return session.prepareQuery(query, "arrays", name2 ?? generateName, mapper, {
|
|
12027
12757
|
type: "select",
|
|
12028
12758
|
tables: [...usedTables]
|
|
@@ -12050,16 +12780,8 @@ var PgUpdateBuilder2 = class {
|
|
|
12050
12780
|
this.withList = withList;
|
|
12051
12781
|
this.builder = builder;
|
|
12052
12782
|
}
|
|
12053
|
-
authToken;
|
|
12054
|
-
setToken(token) {
|
|
12055
|
-
this.authToken = token;
|
|
12056
|
-
return this;
|
|
12057
|
-
}
|
|
12058
12783
|
set(values) {
|
|
12059
|
-
|
|
12060
|
-
if ("setToken" in builder)
|
|
12061
|
-
builder.setToken(this.authToken);
|
|
12062
|
-
return builder;
|
|
12784
|
+
return new this.builder(this.table, mapUpdateSet2(this.table, values), this.session, this.dialect, this.withList);
|
|
12063
12785
|
}
|
|
12064
12786
|
};
|
|
12065
12787
|
var PgUpdateBase2 = class {
|
|
@@ -12067,7 +12789,6 @@ var PgUpdateBase2 = class {
|
|
|
12067
12789
|
config;
|
|
12068
12790
|
tableName;
|
|
12069
12791
|
joinsNotNullableMap;
|
|
12070
|
-
cacheConfig;
|
|
12071
12792
|
constructor(table, set, session, dialect, withList) {
|
|
12072
12793
|
this.session = session;
|
|
12073
12794
|
this.dialect = dialect;
|
|
@@ -12196,7 +12917,7 @@ var PgUpdateBase2 = class {
|
|
|
12196
12917
|
var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
12197
12918
|
static [entityKind] = "PgAsyncUpdate";
|
|
12198
12919
|
_prepare(name2, generateName = false) {
|
|
12199
|
-
const { session, config, dialect, joinsNotNullableMap
|
|
12920
|
+
const { session, config, dialect, joinsNotNullableMap } = this;
|
|
12200
12921
|
const { returning: fields } = config;
|
|
12201
12922
|
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
|
|
12202
12923
|
const query = dialect.sqlToQuery(this.getSQL());
|
|
@@ -12204,7 +12925,7 @@ var PgAsyncUpdateBase2 = class extends PgUpdateBase2 {
|
|
|
12204
12925
|
return session.prepareQuery(query, fields ? "arrays" : "raw", name2 ?? generateName, mapper, {
|
|
12205
12926
|
type: "update",
|
|
12206
12927
|
tables: [...extractUsedTable(this.config.table)]
|
|
12207
|
-
}
|
|
12928
|
+
});
|
|
12208
12929
|
});
|
|
12209
12930
|
}
|
|
12210
12931
|
prepare(name2) {
|
|
@@ -12344,8 +13065,7 @@ var PgAsyncDatabase2 = class {
|
|
|
12344
13065
|
execute(query) {
|
|
12345
13066
|
const sequel = typeof query === "string" ? sql.raw(query) : query.getSQL();
|
|
12346
13067
|
const builtQuery = this.dialect.sqlToQuery(sequel);
|
|
12347
|
-
|
|
12348
|
-
return new PgAsyncRaw2(() => prepared.execute(), sequel, builtQuery, (result) => prepared.mapResult(result, true));
|
|
13068
|
+
return new PgAsyncRaw2(this.session.prepareQuery(builtQuery, "raw", false), sequel, builtQuery);
|
|
12349
13069
|
}
|
|
12350
13070
|
transaction(transaction, config) {
|
|
12351
13071
|
return this.session.transaction(transaction, config);
|
|
@@ -12358,9 +13078,6 @@ var PgBasePreparedQuery2 = class {
|
|
|
12358
13078
|
constructor(query) {
|
|
12359
13079
|
this.query = query;
|
|
12360
13080
|
}
|
|
12361
|
-
mapResult(_, __) {
|
|
12362
|
-
throw new Error("Method not implemented.");
|
|
12363
|
-
}
|
|
12364
13081
|
getQuery() {
|
|
12365
13082
|
return this.query;
|
|
12366
13083
|
}
|
|
@@ -12606,23 +13323,28 @@ var createNeonDatabase = (databaseUrl) => drizzle({ client: as(databaseUrl) });
|
|
|
12606
13323
|
var ID_LENGTH = 255;
|
|
12607
13324
|
var NAME_LENGTH = 255;
|
|
12608
13325
|
var STATUS_LENGTH = 16;
|
|
13326
|
+
var portableJsonb = customType({
|
|
13327
|
+
dataType: () => "jsonb",
|
|
13328
|
+
fromDriver: (value) => typeof value === "string" ? JSON.parse(value) : value,
|
|
13329
|
+
toDriver: (value) => JSON.stringify(value)
|
|
13330
|
+
});
|
|
12609
13331
|
var agentDelegationsTable = pgTable("auth_agent_delegations", {
|
|
12610
13332
|
agent_id: varchar("agent_id", { length: ID_LENGTH }).notNull(),
|
|
12611
|
-
authorization_details:
|
|
13333
|
+
authorization_details: portableJsonb("authorization_details").$type(),
|
|
12612
13334
|
created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
12613
13335
|
delegation_id: varchar("delegation_id", {
|
|
12614
13336
|
length: ID_LENGTH
|
|
12615
13337
|
}).primaryKey(),
|
|
12616
13338
|
expires_at_ms: bigint("expires_at_ms", { mode: "number" }),
|
|
12617
13339
|
organization_id: varchar("organization_id", { length: ID_LENGTH }),
|
|
12618
|
-
scopes:
|
|
13340
|
+
scopes: portableJsonb("scopes").$type().notNull().default([]),
|
|
12619
13341
|
status: varchar("status", { length: STATUS_LENGTH }).$type().notNull(),
|
|
12620
13342
|
updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull(),
|
|
12621
13343
|
user_id: varchar("user_id", { length: ID_LENGTH }).notNull()
|
|
12622
13344
|
});
|
|
12623
13345
|
var agentIdentityRegistrationsTable = pgTable("auth_agent_identity_registrations", {
|
|
12624
13346
|
agent_id: varchar("agent_id", { length: ID_LENGTH }).notNull().unique(),
|
|
12625
|
-
claim_attempt:
|
|
13347
|
+
claim_attempt: portableJsonb("claim_attempt").$type(),
|
|
12626
13348
|
claim_attempt_token_hash: varchar("claim_attempt_token_hash", {
|
|
12627
13349
|
length: ID_LENGTH
|
|
12628
13350
|
}).unique(),
|
|
@@ -12654,10 +13376,10 @@ var agentIdentityRegistrationsTable = pgTable("auth_agent_identity_registrations
|
|
|
12654
13376
|
]);
|
|
12655
13377
|
var agentRegistrationsTable = pgTable("auth_agent_registrations", {
|
|
12656
13378
|
agent_id: varchar("agent_id", { length: ID_LENGTH }).primaryKey(),
|
|
12657
|
-
allowed_scopes:
|
|
13379
|
+
allowed_scopes: portableJsonb("allowed_scopes").$type().notNull().default([]),
|
|
12658
13380
|
client_id: varchar("client_id", { length: ID_LENGTH }).unique(),
|
|
12659
13381
|
created_at_ms: bigint("created_at_ms", { mode: "number" }).notNull(),
|
|
12660
|
-
metadata:
|
|
13382
|
+
metadata: portableJsonb("metadata").$type(),
|
|
12661
13383
|
name: varchar("name", { length: NAME_LENGTH }).notNull(),
|
|
12662
13384
|
status: varchar("status", { length: STATUS_LENGTH }).$type().notNull(),
|
|
12663
13385
|
updated_at_ms: bigint("updated_at_ms", { mode: "number" }).notNull()
|
|
@@ -12876,5 +13598,5 @@ export {
|
|
|
12876
13598
|
AGENT_CLAIM_GRANT_TYPE
|
|
12877
13599
|
};
|
|
12878
13600
|
|
|
12879
|
-
//# debugId=
|
|
13601
|
+
//# debugId=5036CB994778D6CC64756E2164756E21
|
|
12880
13602
|
//# sourceMappingURL=index.js.map
|