drizzle-kit 0.31.0 → 0.31.1-08944da
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/api.js +386 -349
- package/api.mjs +386 -349
- package/bin.cjs +17155 -18660
- package/package.json +10 -11
- package/utils.js +51 -181
- package/utils.mjs +51 -181
package/api.mjs
CHANGED
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
40
40
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
41
41
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
42
42
|
|
43
|
-
// ../node_modules/.pnpm/chalk@5.
|
43
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
44
44
|
function assembleStyles() {
|
45
45
|
const codes = /* @__PURE__ */ new Map();
|
46
46
|
for (const [groupName, group] of Object.entries(styles)) {
|
@@ -157,7 +157,7 @@ function assembleStyles() {
|
|
157
157
|
}
|
158
158
|
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
159
159
|
var init_ansi_styles = __esm({
|
160
|
-
"../node_modules/.pnpm/chalk@5.
|
160
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
161
161
|
"use strict";
|
162
162
|
ANSI_BACKGROUND_OFFSET = 10;
|
163
163
|
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
@@ -232,7 +232,7 @@ var init_ansi_styles = __esm({
|
|
232
232
|
}
|
233
233
|
});
|
234
234
|
|
235
|
-
// ../node_modules/.pnpm/chalk@5.
|
235
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
|
236
236
|
import process2 from "node:process";
|
237
237
|
import os from "node:os";
|
238
238
|
import tty from "node:tty";
|
@@ -299,10 +299,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
299
299
|
return 1;
|
300
300
|
}
|
301
301
|
if ("CI" in env) {
|
302
|
-
if (
|
302
|
+
if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
303
303
|
return 3;
|
304
304
|
}
|
305
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
305
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
306
306
|
return 1;
|
307
307
|
}
|
308
308
|
return min2;
|
@@ -347,7 +347,7 @@ function createSupportsColor(stream, options = {}) {
|
|
347
347
|
}
|
348
348
|
var env, flagForceColor, supportsColor, supports_color_default;
|
349
349
|
var init_supports_color = __esm({
|
350
|
-
"../node_modules/.pnpm/chalk@5.
|
350
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
351
351
|
"use strict";
|
352
352
|
({ env } = process2);
|
353
353
|
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
@@ -363,7 +363,7 @@ var init_supports_color = __esm({
|
|
363
363
|
}
|
364
364
|
});
|
365
365
|
|
366
|
-
// ../node_modules/.pnpm/chalk@5.
|
366
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
|
367
367
|
function stringReplaceAll(string, substring, replacer) {
|
368
368
|
let index6 = string.indexOf(substring);
|
369
369
|
if (index6 === -1) {
|
@@ -393,18 +393,18 @@ function stringEncaseCRLFWithFirstIndex(string, prefix2, postfix, index6) {
|
|
393
393
|
return returnValue;
|
394
394
|
}
|
395
395
|
var init_utilities = __esm({
|
396
|
-
"../node_modules/.pnpm/chalk@5.
|
396
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
|
397
397
|
"use strict";
|
398
398
|
}
|
399
399
|
});
|
400
400
|
|
401
|
-
// ../node_modules/.pnpm/chalk@5.
|
401
|
+
// ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
|
402
402
|
function createChalk(options) {
|
403
403
|
return chalkFactory(options);
|
404
404
|
}
|
405
405
|
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
406
406
|
var init_source = __esm({
|
407
|
-
"../node_modules/.pnpm/chalk@5.
|
407
|
+
"../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
|
408
408
|
"use strict";
|
409
409
|
init_ansi_styles();
|
410
410
|
init_supports_color();
|
@@ -3443,7 +3443,7 @@ var init_global = __esm({
|
|
3443
3443
|
}
|
3444
3444
|
});
|
3445
3445
|
|
3446
|
-
// ../node_modules/.pnpm/zod@3.
|
3446
|
+
// ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
|
3447
3447
|
function getErrorMap() {
|
3448
3448
|
return overrideErrorMap;
|
3449
3449
|
}
|
@@ -3455,11 +3455,8 @@ function addIssueToContext(ctx, issueData) {
|
|
3455
3455
|
path: ctx.path,
|
3456
3456
|
errorMaps: [
|
3457
3457
|
ctx.common.contextualErrorMap,
|
3458
|
-
// contextual error map is first priority
|
3459
3458
|
ctx.schemaErrorMap,
|
3460
|
-
// then schema-bound map if available
|
3461
3459
|
overrideMap,
|
3462
|
-
// then global override map
|
3463
3460
|
overrideMap === errorMap ? void 0 : errorMap
|
3464
3461
|
// then global default map
|
3465
3462
|
].filter((x) => !!x)
|
@@ -3531,33 +3528,6 @@ function isValidIP(ip, version2) {
|
|
3531
3528
|
}
|
3532
3529
|
return false;
|
3533
3530
|
}
|
3534
|
-
function isValidJWT(jwt, alg) {
|
3535
|
-
if (!jwtRegex.test(jwt))
|
3536
|
-
return false;
|
3537
|
-
try {
|
3538
|
-
const [header] = jwt.split(".");
|
3539
|
-
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
3540
|
-
const decoded = JSON.parse(atob(base64));
|
3541
|
-
if (typeof decoded !== "object" || decoded === null)
|
3542
|
-
return false;
|
3543
|
-
if (!decoded.typ || !decoded.alg)
|
3544
|
-
return false;
|
3545
|
-
if (alg && decoded.alg !== alg)
|
3546
|
-
return false;
|
3547
|
-
return true;
|
3548
|
-
} catch (_a435) {
|
3549
|
-
return false;
|
3550
|
-
}
|
3551
|
-
}
|
3552
|
-
function isValidCidr(ip, version2) {
|
3553
|
-
if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
|
3554
|
-
return true;
|
3555
|
-
}
|
3556
|
-
if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
|
3557
|
-
return true;
|
3558
|
-
}
|
3559
|
-
return false;
|
3560
|
-
}
|
3561
3531
|
function floatSafeRemainder(val, step) {
|
3562
3532
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
3563
3533
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
@@ -3637,9 +3607,9 @@ function createZodEnum(values, params) {
|
|
3637
3607
|
...processCreateParams(params)
|
3638
3608
|
});
|
3639
3609
|
}
|
3640
|
-
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex,
|
3610
|
+
var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
|
3641
3611
|
var init_lib = __esm({
|
3642
|
-
"../node_modules/.pnpm/zod@3.
|
3612
|
+
"../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs"() {
|
3643
3613
|
"use strict";
|
3644
3614
|
(function(util2) {
|
3645
3615
|
util2.assertEqual = (val) => val;
|
@@ -3789,9 +3759,6 @@ var init_lib = __esm({
|
|
3789
3759
|
"not_finite"
|
3790
3760
|
]);
|
3791
3761
|
ZodError = class _ZodError extends Error {
|
3792
|
-
get errors() {
|
3793
|
-
return this.issues;
|
3794
|
-
}
|
3795
3762
|
constructor(issues) {
|
3796
3763
|
super();
|
3797
3764
|
this.issues = [];
|
@@ -3810,6 +3777,9 @@ var init_lib = __esm({
|
|
3810
3777
|
this.name = "ZodError";
|
3811
3778
|
this.issues = issues;
|
3812
3779
|
}
|
3780
|
+
get errors() {
|
3781
|
+
return this.issues;
|
3782
|
+
}
|
3813
3783
|
format(_mapper) {
|
3814
3784
|
const mapper = _mapper || function(issue) {
|
3815
3785
|
return issue.message;
|
@@ -4111,6 +4081,34 @@ var init_lib = __esm({
|
|
4111
4081
|
}
|
4112
4082
|
};
|
4113
4083
|
ZodType = class {
|
4084
|
+
constructor(def) {
|
4085
|
+
this.spa = this.safeParseAsync;
|
4086
|
+
this._def = def;
|
4087
|
+
this.parse = this.parse.bind(this);
|
4088
|
+
this.safeParse = this.safeParse.bind(this);
|
4089
|
+
this.parseAsync = this.parseAsync.bind(this);
|
4090
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
4091
|
+
this.spa = this.spa.bind(this);
|
4092
|
+
this.refine = this.refine.bind(this);
|
4093
|
+
this.refinement = this.refinement.bind(this);
|
4094
|
+
this.superRefine = this.superRefine.bind(this);
|
4095
|
+
this.optional = this.optional.bind(this);
|
4096
|
+
this.nullable = this.nullable.bind(this);
|
4097
|
+
this.nullish = this.nullish.bind(this);
|
4098
|
+
this.array = this.array.bind(this);
|
4099
|
+
this.promise = this.promise.bind(this);
|
4100
|
+
this.or = this.or.bind(this);
|
4101
|
+
this.and = this.and.bind(this);
|
4102
|
+
this.transform = this.transform.bind(this);
|
4103
|
+
this.brand = this.brand.bind(this);
|
4104
|
+
this.default = this.default.bind(this);
|
4105
|
+
this.catch = this.catch.bind(this);
|
4106
|
+
this.describe = this.describe.bind(this);
|
4107
|
+
this.pipe = this.pipe.bind(this);
|
4108
|
+
this.readonly = this.readonly.bind(this);
|
4109
|
+
this.isNullable = this.isNullable.bind(this);
|
4110
|
+
this.isOptional = this.isOptional.bind(this);
|
4111
|
+
}
|
4114
4112
|
get description() {
|
4115
4113
|
return this._def.description;
|
4116
4114
|
}
|
@@ -4174,43 +4172,6 @@ var init_lib = __esm({
|
|
4174
4172
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
4175
4173
|
return handleResult(ctx, result);
|
4176
4174
|
}
|
4177
|
-
"~validate"(data) {
|
4178
|
-
var _a435, _b325;
|
4179
|
-
const ctx = {
|
4180
|
-
common: {
|
4181
|
-
issues: [],
|
4182
|
-
async: !!this["~standard"].async
|
4183
|
-
},
|
4184
|
-
path: [],
|
4185
|
-
schemaErrorMap: this._def.errorMap,
|
4186
|
-
parent: null,
|
4187
|
-
data,
|
4188
|
-
parsedType: getParsedType(data)
|
4189
|
-
};
|
4190
|
-
if (!this["~standard"].async) {
|
4191
|
-
try {
|
4192
|
-
const result = this._parseSync({ data, path: [], parent: ctx });
|
4193
|
-
return isValid(result) ? {
|
4194
|
-
value: result.value
|
4195
|
-
} : {
|
4196
|
-
issues: ctx.common.issues
|
4197
|
-
};
|
4198
|
-
} catch (err) {
|
4199
|
-
if ((_b325 = (_a435 = err === null || err === void 0 ? void 0 : err.message) === null || _a435 === void 0 ? void 0 : _a435.toLowerCase()) === null || _b325 === void 0 ? void 0 : _b325.includes("encountered")) {
|
4200
|
-
this["~standard"].async = true;
|
4201
|
-
}
|
4202
|
-
ctx.common = {
|
4203
|
-
issues: [],
|
4204
|
-
async: true
|
4205
|
-
};
|
4206
|
-
}
|
4207
|
-
}
|
4208
|
-
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
4209
|
-
value: result.value
|
4210
|
-
} : {
|
4211
|
-
issues: ctx.common.issues
|
4212
|
-
});
|
4213
|
-
}
|
4214
4175
|
async parseAsync(data, params) {
|
4215
4176
|
const result = await this.safeParseAsync(data, params);
|
4216
4177
|
if (result.success)
|
@@ -4288,39 +4249,6 @@ var init_lib = __esm({
|
|
4288
4249
|
superRefine(refinement) {
|
4289
4250
|
return this._refinement(refinement);
|
4290
4251
|
}
|
4291
|
-
constructor(def) {
|
4292
|
-
this.spa = this.safeParseAsync;
|
4293
|
-
this._def = def;
|
4294
|
-
this.parse = this.parse.bind(this);
|
4295
|
-
this.safeParse = this.safeParse.bind(this);
|
4296
|
-
this.parseAsync = this.parseAsync.bind(this);
|
4297
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
4298
|
-
this.spa = this.spa.bind(this);
|
4299
|
-
this.refine = this.refine.bind(this);
|
4300
|
-
this.refinement = this.refinement.bind(this);
|
4301
|
-
this.superRefine = this.superRefine.bind(this);
|
4302
|
-
this.optional = this.optional.bind(this);
|
4303
|
-
this.nullable = this.nullable.bind(this);
|
4304
|
-
this.nullish = this.nullish.bind(this);
|
4305
|
-
this.array = this.array.bind(this);
|
4306
|
-
this.promise = this.promise.bind(this);
|
4307
|
-
this.or = this.or.bind(this);
|
4308
|
-
this.and = this.and.bind(this);
|
4309
|
-
this.transform = this.transform.bind(this);
|
4310
|
-
this.brand = this.brand.bind(this);
|
4311
|
-
this.default = this.default.bind(this);
|
4312
|
-
this.catch = this.catch.bind(this);
|
4313
|
-
this.describe = this.describe.bind(this);
|
4314
|
-
this.pipe = this.pipe.bind(this);
|
4315
|
-
this.readonly = this.readonly.bind(this);
|
4316
|
-
this.isNullable = this.isNullable.bind(this);
|
4317
|
-
this.isOptional = this.isOptional.bind(this);
|
4318
|
-
this["~standard"] = {
|
4319
|
-
version: 1,
|
4320
|
-
vendor: "zod",
|
4321
|
-
validate: (data) => this["~validate"](data)
|
4322
|
-
};
|
4323
|
-
}
|
4324
4252
|
optional() {
|
4325
4253
|
return ZodOptional.create(this, this._def);
|
4326
4254
|
}
|
@@ -4331,7 +4259,7 @@ var init_lib = __esm({
|
|
4331
4259
|
return this.nullable().optional();
|
4332
4260
|
}
|
4333
4261
|
array() {
|
4334
|
-
return ZodArray.create(this);
|
4262
|
+
return ZodArray.create(this, this._def);
|
4335
4263
|
}
|
4336
4264
|
promise() {
|
4337
4265
|
return ZodPromise.create(this, this._def);
|
@@ -4397,19 +4325,15 @@ var init_lib = __esm({
|
|
4397
4325
|
};
|
4398
4326
|
cuidRegex = /^c[^\s-]{8,}$/i;
|
4399
4327
|
cuid2Regex = /^[0-9a-z]+$/;
|
4400
|
-
ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
4328
|
+
ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
4401
4329
|
uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
4402
4330
|
nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
4403
|
-
jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
4404
4331
|
durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
4405
4332
|
emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
4406
4333
|
_emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
4407
4334
|
ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
4408
|
-
|
4409
|
-
ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
4410
|
-
ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
4335
|
+
ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
4411
4336
|
base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
4412
|
-
base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
4413
4337
|
dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
4414
4338
|
dateRegex = new RegExp(`^${dateRegexSource}$`);
|
4415
4339
|
ZodString = class _ZodString extends ZodType {
|
@@ -4668,26 +4592,6 @@ var init_lib = __esm({
|
|
4668
4592
|
});
|
4669
4593
|
status.dirty();
|
4670
4594
|
}
|
4671
|
-
} else if (check.kind === "jwt") {
|
4672
|
-
if (!isValidJWT(input.data, check.alg)) {
|
4673
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
4674
|
-
addIssueToContext(ctx, {
|
4675
|
-
validation: "jwt",
|
4676
|
-
code: ZodIssueCode.invalid_string,
|
4677
|
-
message: check.message
|
4678
|
-
});
|
4679
|
-
status.dirty();
|
4680
|
-
}
|
4681
|
-
} else if (check.kind === "cidr") {
|
4682
|
-
if (!isValidCidr(input.data, check.version)) {
|
4683
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
4684
|
-
addIssueToContext(ctx, {
|
4685
|
-
validation: "cidr",
|
4686
|
-
code: ZodIssueCode.invalid_string,
|
4687
|
-
message: check.message
|
4688
|
-
});
|
4689
|
-
status.dirty();
|
4690
|
-
}
|
4691
4595
|
} else if (check.kind === "base64") {
|
4692
4596
|
if (!base64Regex.test(input.data)) {
|
4693
4597
|
ctx = this._getOrReturnCtx(input, ctx);
|
@@ -4698,16 +4602,6 @@ var init_lib = __esm({
|
|
4698
4602
|
});
|
4699
4603
|
status.dirty();
|
4700
4604
|
}
|
4701
|
-
} else if (check.kind === "base64url") {
|
4702
|
-
if (!base64urlRegex.test(input.data)) {
|
4703
|
-
ctx = this._getOrReturnCtx(input, ctx);
|
4704
|
-
addIssueToContext(ctx, {
|
4705
|
-
validation: "base64url",
|
4706
|
-
code: ZodIssueCode.invalid_string,
|
4707
|
-
message: check.message
|
4708
|
-
});
|
4709
|
-
status.dirty();
|
4710
|
-
}
|
4711
4605
|
} else {
|
4712
4606
|
util.assertNever(check);
|
4713
4607
|
}
|
@@ -4754,21 +4648,9 @@ var init_lib = __esm({
|
|
4754
4648
|
base64(message) {
|
4755
4649
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
4756
4650
|
}
|
4757
|
-
base64url(message) {
|
4758
|
-
return this._addCheck({
|
4759
|
-
kind: "base64url",
|
4760
|
-
...errorUtil.errToObj(message)
|
4761
|
-
});
|
4762
|
-
}
|
4763
|
-
jwt(options) {
|
4764
|
-
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
4765
|
-
}
|
4766
4651
|
ip(options) {
|
4767
4652
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
4768
4653
|
}
|
4769
|
-
cidr(options) {
|
4770
|
-
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
4771
|
-
}
|
4772
4654
|
datetime(options) {
|
4773
4655
|
var _a435, _b325;
|
4774
4656
|
if (typeof options === "string") {
|
@@ -4859,7 +4741,8 @@ var init_lib = __esm({
|
|
4859
4741
|
});
|
4860
4742
|
}
|
4861
4743
|
/**
|
4862
|
-
*
|
4744
|
+
* @deprecated Use z.string().min(1) instead.
|
4745
|
+
* @see {@link ZodString.min}
|
4863
4746
|
*/
|
4864
4747
|
nonempty(message) {
|
4865
4748
|
return this.min(1, errorUtil.errToObj(message));
|
@@ -4921,15 +4804,9 @@ var init_lib = __esm({
|
|
4921
4804
|
get isIP() {
|
4922
4805
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
4923
4806
|
}
|
4924
|
-
get isCIDR() {
|
4925
|
-
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
4926
|
-
}
|
4927
4807
|
get isBase64() {
|
4928
4808
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
4929
4809
|
}
|
4930
|
-
get isBase64url() {
|
4931
|
-
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
4932
|
-
}
|
4933
4810
|
get minLength() {
|
4934
4811
|
let min2 = null;
|
4935
4812
|
for (const ch of this._def.checks) {
|
@@ -5199,15 +5076,17 @@ var init_lib = __esm({
|
|
5199
5076
|
}
|
5200
5077
|
_parse(input) {
|
5201
5078
|
if (this._def.coerce) {
|
5202
|
-
|
5203
|
-
input.data = BigInt(input.data);
|
5204
|
-
} catch (_a435) {
|
5205
|
-
return this._getInvalidInput(input);
|
5206
|
-
}
|
5079
|
+
input.data = BigInt(input.data);
|
5207
5080
|
}
|
5208
5081
|
const parsedType = this._getType(input);
|
5209
5082
|
if (parsedType !== ZodParsedType.bigint) {
|
5210
|
-
|
5083
|
+
const ctx2 = this._getOrReturnCtx(input);
|
5084
|
+
addIssueToContext(ctx2, {
|
5085
|
+
code: ZodIssueCode.invalid_type,
|
5086
|
+
expected: ZodParsedType.bigint,
|
5087
|
+
received: ctx2.parsedType
|
5088
|
+
});
|
5089
|
+
return INVALID;
|
5211
5090
|
}
|
5212
5091
|
let ctx = void 0;
|
5213
5092
|
const status = new ParseStatus();
|
@@ -5254,15 +5133,6 @@ var init_lib = __esm({
|
|
5254
5133
|
}
|
5255
5134
|
return { status: status.value, value: input.data };
|
5256
5135
|
}
|
5257
|
-
_getInvalidInput(input) {
|
5258
|
-
const ctx = this._getOrReturnCtx(input);
|
5259
|
-
addIssueToContext(ctx, {
|
5260
|
-
code: ZodIssueCode.invalid_type,
|
5261
|
-
expected: ZodParsedType.bigint,
|
5262
|
-
received: ctx.parsedType
|
5263
|
-
});
|
5264
|
-
return INVALID;
|
5265
|
-
}
|
5266
5136
|
gte(value, message) {
|
5267
5137
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
5268
5138
|
}
|
@@ -22101,8 +21971,7 @@ var init_column_builder = __esm({
|
|
22101
21971
|
}
|
22102
21972
|
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
22103
21973
|
setName(name2) {
|
22104
|
-
if (this.config.name !== "")
|
22105
|
-
return;
|
21974
|
+
if (this.config.name !== "") return;
|
22106
21975
|
this.config.name = name2;
|
22107
21976
|
}
|
22108
21977
|
};
|
@@ -22534,8 +22403,7 @@ var init_common2 = __esm({
|
|
22534
22403
|
const a = value.map(
|
22535
22404
|
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
22536
22405
|
);
|
22537
|
-
if (isNestedArray)
|
22538
|
-
return a;
|
22406
|
+
if (isNestedArray) return a;
|
22539
22407
|
return makePgArray(a);
|
22540
22408
|
}
|
22541
22409
|
};
|
@@ -22667,7 +22535,7 @@ var version;
|
|
22667
22535
|
var init_version = __esm({
|
22668
22536
|
"../drizzle-orm/dist/version.js"() {
|
22669
22537
|
"use strict";
|
22670
|
-
version = "0.
|
22538
|
+
version = "0.43.1";
|
22671
22539
|
}
|
22672
22540
|
});
|
22673
22541
|
|
@@ -23527,8 +23395,7 @@ function mapUpdateSet(table6, values) {
|
|
23527
23395
|
function applyMixins(baseClass, extendedClasses) {
|
23528
23396
|
for (const extendedClass of extendedClasses) {
|
23529
23397
|
for (const name2 of Object.getOwnPropertyNames(extendedClass.prototype)) {
|
23530
|
-
if (name2 === "constructor")
|
23531
|
-
continue;
|
23398
|
+
if (name2 === "constructor") continue;
|
23532
23399
|
Object.defineProperty(
|
23533
23400
|
baseClass.prototype,
|
23534
23401
|
name2,
|
@@ -23553,47 +23420,38 @@ function getColumnNameAndConfig(a, b) {
|
|
23553
23420
|
};
|
23554
23421
|
}
|
23555
23422
|
function isConfig(data) {
|
23556
|
-
if (typeof data !== "object" || data === null)
|
23557
|
-
|
23558
|
-
if (data.constructor.name !== "Object")
|
23559
|
-
return false;
|
23423
|
+
if (typeof data !== "object" || data === null) return false;
|
23424
|
+
if (data.constructor.name !== "Object") return false;
|
23560
23425
|
if ("logger" in data) {
|
23561
23426
|
const type = typeof data["logger"];
|
23562
|
-
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined")
|
23563
|
-
return false;
|
23427
|
+
if (type !== "boolean" && (type !== "object" || typeof data["logger"]["logQuery"] !== "function") && type !== "undefined") return false;
|
23564
23428
|
return true;
|
23565
23429
|
}
|
23566
23430
|
if ("schema" in data) {
|
23567
23431
|
const type = typeof data["schema"];
|
23568
|
-
if (type !== "object" && type !== "undefined")
|
23569
|
-
return false;
|
23432
|
+
if (type !== "object" && type !== "undefined") return false;
|
23570
23433
|
return true;
|
23571
23434
|
}
|
23572
23435
|
if ("casing" in data) {
|
23573
23436
|
const type = typeof data["casing"];
|
23574
|
-
if (type !== "string" && type !== "undefined")
|
23575
|
-
return false;
|
23437
|
+
if (type !== "string" && type !== "undefined") return false;
|
23576
23438
|
return true;
|
23577
23439
|
}
|
23578
23440
|
if ("mode" in data) {
|
23579
|
-
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0)
|
23580
|
-
return false;
|
23441
|
+
if (data["mode"] !== "default" || data["mode"] !== "planetscale" || data["mode"] !== void 0) return false;
|
23581
23442
|
return true;
|
23582
23443
|
}
|
23583
23444
|
if ("connection" in data) {
|
23584
23445
|
const type = typeof data["connection"];
|
23585
|
-
if (type !== "string" && type !== "object" && type !== "undefined")
|
23586
|
-
return false;
|
23446
|
+
if (type !== "string" && type !== "object" && type !== "undefined") return false;
|
23587
23447
|
return true;
|
23588
23448
|
}
|
23589
23449
|
if ("client" in data) {
|
23590
23450
|
const type = typeof data["client"];
|
23591
|
-
if (type !== "object" && type !== "function" && type !== "undefined")
|
23592
|
-
return false;
|
23451
|
+
if (type !== "object" && type !== "function" && type !== "undefined") return false;
|
23593
23452
|
return true;
|
23594
23453
|
}
|
23595
|
-
if (Object.keys(data).length === 0)
|
23596
|
-
return true;
|
23454
|
+
if (Object.keys(data).length === 0) return true;
|
23597
23455
|
return false;
|
23598
23456
|
}
|
23599
23457
|
var init_utils2 = __esm({
|
@@ -24411,8 +24269,7 @@ var init_numeric = __esm({
|
|
24411
24269
|
this.scale = config.scale;
|
24412
24270
|
}
|
24413
24271
|
mapFromDriverValue(value) {
|
24414
|
-
if (typeof value === "string")
|
24415
|
-
return value;
|
24272
|
+
if (typeof value === "string") return value;
|
24416
24273
|
return String(value);
|
24417
24274
|
}
|
24418
24275
|
getSQLType() {
|
@@ -24451,8 +24308,7 @@ var init_numeric = __esm({
|
|
24451
24308
|
this.scale = config.scale;
|
24452
24309
|
}
|
24453
24310
|
mapFromDriverValue(value) {
|
24454
|
-
if (typeof value === "number")
|
24455
|
-
return value;
|
24311
|
+
if (typeof value === "number") return value;
|
24456
24312
|
return Number(value);
|
24457
24313
|
}
|
24458
24314
|
getSQLType() {
|
@@ -26431,8 +26287,7 @@ var init_casing = __esm({
|
|
26431
26287
|
this.convert = casing2 === "snake_case" ? toSnakeCase : casing2 === "camelCase" ? toCamelCase : noopCase;
|
26432
26288
|
}
|
26433
26289
|
getColumnCasing(column6) {
|
26434
|
-
if (!column6.keyAsName)
|
26435
|
-
return column6.name;
|
26290
|
+
if (!column6.keyAsName) return column6.name;
|
26436
26291
|
const schema5 = column6.table[Table2.Symbol.Schema] ?? "public";
|
26437
26292
|
const tableName = column6.table[Table2.Symbol.OriginalName];
|
26438
26293
|
const key = `${schema5}.${tableName}.${column6.name}`;
|
@@ -26541,8 +26396,7 @@ var init_dialect = __esm({
|
|
26541
26396
|
return `'${str.replace(/'/g, "''")}'`;
|
26542
26397
|
}
|
26543
26398
|
buildWithCTE(queries) {
|
26544
|
-
if (!queries?.length)
|
26545
|
-
return void 0;
|
26399
|
+
if (!queries?.length) return void 0;
|
26546
26400
|
const withSqlChunks = [sql`with `];
|
26547
26401
|
for (const [i, w] of queries.entries()) {
|
26548
26402
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -26650,13 +26504,14 @@ var init_dialect = __esm({
|
|
26650
26504
|
}
|
26651
26505
|
const table6 = joinMeta.table;
|
26652
26506
|
const lateralSql = joinMeta.lateral ? sql` lateral` : void 0;
|
26507
|
+
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
|
26653
26508
|
if (is(table6, PgTable)) {
|
26654
26509
|
const tableName = table6[PgTable.Symbol.Name];
|
26655
26510
|
const tableSchema = table6[PgTable.Symbol.Schema];
|
26656
26511
|
const origTableName = table6[PgTable.Symbol.OriginalName];
|
26657
26512
|
const alias = tableName === origTableName ? void 0 : joinMeta.alias;
|
26658
26513
|
joinsArray.push(
|
26659
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}
|
26514
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
26660
26515
|
);
|
26661
26516
|
} else if (is(table6, View3)) {
|
26662
26517
|
const viewName = table6[ViewBaseConfig].name;
|
@@ -26664,11 +26519,11 @@ var init_dialect = __esm({
|
|
26664
26519
|
const origViewName = table6[ViewBaseConfig].originalName;
|
26665
26520
|
const alias = viewName === origViewName ? void 0 : joinMeta.alias;
|
26666
26521
|
joinsArray.push(
|
26667
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : void 0}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}
|
26522
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : void 0}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
26668
26523
|
);
|
26669
26524
|
} else {
|
26670
26525
|
joinsArray.push(
|
26671
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table6}
|
26526
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table6}${onSql}`
|
26672
26527
|
);
|
26673
26528
|
}
|
26674
26529
|
if (index6 < joins.length - 1) {
|
@@ -26747,7 +26602,7 @@ var init_dialect = __esm({
|
|
26747
26602
|
);
|
26748
26603
|
}
|
26749
26604
|
if (lockingClause.config.noWait) {
|
26750
|
-
clauseSql.append(sql`
|
26605
|
+
clauseSql.append(sql` nowait`);
|
26751
26606
|
} else if (lockingClause.config.skipLocked) {
|
26752
26607
|
clauseSql.append(sql` skip locked`);
|
26753
26608
|
}
|
@@ -27723,12 +27578,12 @@ var init_select2 = __esm({
|
|
27723
27578
|
*
|
27724
27579
|
* ```ts
|
27725
27580
|
* // Select all users and their pets
|
27726
|
-
* const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()
|
27581
|
+
* const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()
|
27727
27582
|
* .from(users)
|
27728
27583
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
27729
27584
|
*
|
27730
27585
|
* // Select userId and petId
|
27731
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
27586
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
27732
27587
|
* userId: users.id,
|
27733
27588
|
* petId: pets.id,
|
27734
27589
|
* })
|
@@ -27736,7 +27591,20 @@ var init_select2 = __esm({
|
|
27736
27591
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
27737
27592
|
* ```
|
27738
27593
|
*/
|
27739
|
-
__publicField(this, "leftJoin", this.createJoin("left"));
|
27594
|
+
__publicField(this, "leftJoin", this.createJoin("left", false));
|
27595
|
+
/**
|
27596
|
+
* Executes a `left join lateral` operation by adding subquery to the current query.
|
27597
|
+
*
|
27598
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
27599
|
+
*
|
27600
|
+
* Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.
|
27601
|
+
*
|
27602
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}
|
27603
|
+
*
|
27604
|
+
* @param table the subquery to join.
|
27605
|
+
* @param on the `on` clause.
|
27606
|
+
*/
|
27607
|
+
__publicField(this, "leftJoinLateral", this.createJoin("left", true));
|
27740
27608
|
/**
|
27741
27609
|
* Executes a `right join` operation by adding another table to the current query.
|
27742
27610
|
*
|
@@ -27751,12 +27619,12 @@ var init_select2 = __esm({
|
|
27751
27619
|
*
|
27752
27620
|
* ```ts
|
27753
27621
|
* // Select all users and their pets
|
27754
|
-
* const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()
|
27622
|
+
* const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()
|
27755
27623
|
* .from(users)
|
27756
27624
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
27757
27625
|
*
|
27758
27626
|
* // Select userId and petId
|
27759
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({
|
27627
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({
|
27760
27628
|
* userId: users.id,
|
27761
27629
|
* petId: pets.id,
|
27762
27630
|
* })
|
@@ -27764,7 +27632,7 @@ var init_select2 = __esm({
|
|
27764
27632
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
27765
27633
|
* ```
|
27766
27634
|
*/
|
27767
|
-
__publicField(this, "rightJoin", this.createJoin("right"));
|
27635
|
+
__publicField(this, "rightJoin", this.createJoin("right", false));
|
27768
27636
|
/**
|
27769
27637
|
* Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.
|
27770
27638
|
*
|
@@ -27779,12 +27647,12 @@ var init_select2 = __esm({
|
|
27779
27647
|
*
|
27780
27648
|
* ```ts
|
27781
27649
|
* // Select all users and their pets
|
27782
|
-
* const usersWithPets: { user: User; pets: Pet }[] = await db.select()
|
27650
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
27783
27651
|
* .from(users)
|
27784
27652
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
27785
27653
|
*
|
27786
27654
|
* // Select userId and petId
|
27787
|
-
* const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({
|
27655
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
27788
27656
|
* userId: users.id,
|
27789
27657
|
* petId: pets.id,
|
27790
27658
|
* })
|
@@ -27792,7 +27660,20 @@ var init_select2 = __esm({
|
|
27792
27660
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
27793
27661
|
* ```
|
27794
27662
|
*/
|
27795
|
-
__publicField(this, "innerJoin", this.createJoin("inner"));
|
27663
|
+
__publicField(this, "innerJoin", this.createJoin("inner", false));
|
27664
|
+
/**
|
27665
|
+
* Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.
|
27666
|
+
*
|
27667
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
27668
|
+
*
|
27669
|
+
* Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.
|
27670
|
+
*
|
27671
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}
|
27672
|
+
*
|
27673
|
+
* @param table the subquery to join.
|
27674
|
+
* @param on the `on` clause.
|
27675
|
+
*/
|
27676
|
+
__publicField(this, "innerJoinLateral", this.createJoin("inner", true));
|
27796
27677
|
/**
|
27797
27678
|
* Executes a `full join` operation by combining rows from two tables into a new table.
|
27798
27679
|
*
|
@@ -27807,12 +27688,12 @@ var init_select2 = __esm({
|
|
27807
27688
|
*
|
27808
27689
|
* ```ts
|
27809
27690
|
* // Select all users and their pets
|
27810
|
-
* const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select()
|
27691
|
+
* const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()
|
27811
27692
|
* .from(users)
|
27812
27693
|
* .fullJoin(pets, eq(users.id, pets.ownerId))
|
27813
27694
|
*
|
27814
27695
|
* // Select userId and petId
|
27815
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({
|
27696
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({
|
27816
27697
|
* userId: users.id,
|
27817
27698
|
* petId: pets.id,
|
27818
27699
|
* })
|
@@ -27820,7 +27701,46 @@ var init_select2 = __esm({
|
|
27820
27701
|
* .fullJoin(pets, eq(users.id, pets.ownerId))
|
27821
27702
|
* ```
|
27822
27703
|
*/
|
27823
|
-
__publicField(this, "fullJoin", this.createJoin("full"));
|
27704
|
+
__publicField(this, "fullJoin", this.createJoin("full", false));
|
27705
|
+
/**
|
27706
|
+
* Executes a `cross join` operation by combining rows from two tables into a new table.
|
27707
|
+
*
|
27708
|
+
* Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.
|
27709
|
+
*
|
27710
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}
|
27711
|
+
*
|
27712
|
+
* @param table the table to join.
|
27713
|
+
*
|
27714
|
+
* @example
|
27715
|
+
*
|
27716
|
+
* ```ts
|
27717
|
+
* // Select all users, each user with every pet
|
27718
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
27719
|
+
* .from(users)
|
27720
|
+
* .crossJoin(pets)
|
27721
|
+
*
|
27722
|
+
* // Select userId and petId
|
27723
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
27724
|
+
* userId: users.id,
|
27725
|
+
* petId: pets.id,
|
27726
|
+
* })
|
27727
|
+
* .from(users)
|
27728
|
+
* .crossJoin(pets)
|
27729
|
+
* ```
|
27730
|
+
*/
|
27731
|
+
__publicField(this, "crossJoin", this.createJoin("cross", false));
|
27732
|
+
/**
|
27733
|
+
* Executes a `cross join lateral` operation by combining rows from two queries into a new table.
|
27734
|
+
*
|
27735
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
27736
|
+
*
|
27737
|
+
* Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.
|
27738
|
+
*
|
27739
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}
|
27740
|
+
*
|
27741
|
+
* @param table the query to join.
|
27742
|
+
*/
|
27743
|
+
__publicField(this, "crossJoinLateral", this.createJoin("cross", true));
|
27824
27744
|
/**
|
27825
27745
|
* Adds `union` set operator to the query.
|
27826
27746
|
*
|
@@ -28023,7 +27943,7 @@ var init_select2 = __esm({
|
|
28023
27943
|
this.tableName = getTableLikeName(table6);
|
28024
27944
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
28025
27945
|
}
|
28026
|
-
createJoin(joinType) {
|
27946
|
+
createJoin(joinType, lateral) {
|
28027
27947
|
return (table6, on) => {
|
28028
27948
|
const baseTableName = this.tableName;
|
28029
27949
|
const tableName = getTableLikeName(table6);
|
@@ -28052,7 +27972,7 @@ var init_select2 = __esm({
|
|
28052
27972
|
if (!this.config.joins) {
|
28053
27973
|
this.config.joins = [];
|
28054
27974
|
}
|
28055
|
-
this.config.joins.push({ on, table: table6, joinType, alias: tableName });
|
27975
|
+
this.config.joins.push({ on, table: table6, joinType, alias: tableName, lateral });
|
28056
27976
|
if (typeof tableName === "string") {
|
28057
27977
|
switch (joinType) {
|
28058
27978
|
case "left": {
|
@@ -28066,6 +27986,7 @@ var init_select2 = __esm({
|
|
28066
27986
|
this.joinsNotNullableMap[tableName] = true;
|
28067
27987
|
break;
|
28068
27988
|
}
|
27989
|
+
case "cross":
|
28069
27990
|
case "inner": {
|
28070
27991
|
this.joinsNotNullableMap[tableName] = true;
|
28071
27992
|
break;
|
@@ -29981,18 +29902,18 @@ var init_schema = __esm({
|
|
29981
29902
|
__publicField(this, "materializedView", (name2, columns) => {
|
29982
29903
|
return pgMaterializedViewWithSchema(name2, columns, this.schemaName);
|
29983
29904
|
});
|
29984
|
-
__publicField(this, "enum", (enumName, input) => {
|
29985
|
-
return Array.isArray(input) ? pgEnumWithSchema(
|
29986
|
-
enumName,
|
29987
|
-
[...input],
|
29988
|
-
this.schemaName
|
29989
|
-
) : pgEnumObjectWithSchema(enumName, input, this.schemaName);
|
29990
|
-
});
|
29991
29905
|
__publicField(this, "sequence", (name2, options) => {
|
29992
29906
|
return pgSequenceWithSchema(name2, options, this.schemaName);
|
29993
29907
|
});
|
29994
29908
|
this.schemaName = schemaName;
|
29995
29909
|
}
|
29910
|
+
enum(enumName, input) {
|
29911
|
+
return Array.isArray(input) ? pgEnumWithSchema(
|
29912
|
+
enumName,
|
29913
|
+
[...input],
|
29914
|
+
this.schemaName
|
29915
|
+
) : pgEnumObjectWithSchema(enumName, input, this.schemaName);
|
29916
|
+
}
|
29996
29917
|
getSQL() {
|
29997
29918
|
return new SQL([sql.identifier(this.schemaName)]);
|
29998
29919
|
}
|
@@ -32443,8 +32364,7 @@ var init_numeric2 = __esm({
|
|
32443
32364
|
__publicField(SQLiteNumericBuilder, _a193, "SQLiteNumericBuilder");
|
32444
32365
|
SQLiteNumeric = class extends (_b139 = SQLiteColumn, _a194 = entityKind, _b139) {
|
32445
32366
|
mapFromDriverValue(value) {
|
32446
|
-
if (typeof value === "string")
|
32447
|
-
return value;
|
32367
|
+
if (typeof value === "string") return value;
|
32448
32368
|
return String(value);
|
32449
32369
|
}
|
32450
32370
|
getSQLType() {
|
@@ -32471,8 +32391,7 @@ var init_numeric2 = __esm({
|
|
32471
32391
|
__publicField(this, "mapToDriverValue", String);
|
32472
32392
|
}
|
32473
32393
|
mapFromDriverValue(value) {
|
32474
|
-
if (typeof value === "number")
|
32475
|
-
return value;
|
32394
|
+
if (typeof value === "number") return value;
|
32476
32395
|
return Number(value);
|
32477
32396
|
}
|
32478
32397
|
getSQLType() {
|
@@ -32864,8 +32783,7 @@ var init_dialect2 = __esm({
|
|
32864
32783
|
return `'${str.replace(/'/g, "''")}'`;
|
32865
32784
|
}
|
32866
32785
|
buildWithCTE(queries) {
|
32867
|
-
if (!queries?.length)
|
32868
|
-
return void 0;
|
32786
|
+
if (!queries?.length) return void 0;
|
32869
32787
|
const withSqlChunks = [sql`with `];
|
32870
32788
|
for (const [i, w] of queries.entries()) {
|
32871
32789
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -32983,17 +32901,18 @@ var init_dialect2 = __esm({
|
|
32983
32901
|
joinsArray.push(sql` `);
|
32984
32902
|
}
|
32985
32903
|
const table6 = joinMeta.table;
|
32904
|
+
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
|
32986
32905
|
if (is(table6, SQLiteTable)) {
|
32987
32906
|
const tableName = table6[SQLiteTable.Symbol.Name];
|
32988
32907
|
const tableSchema = table6[SQLiteTable.Symbol.Schema];
|
32989
32908
|
const origTableName = table6[SQLiteTable.Symbol.OriginalName];
|
32990
32909
|
const alias = tableName === origTableName ? void 0 : joinMeta.alias;
|
32991
32910
|
joinsArray.push(
|
32992
|
-
sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}
|
32911
|
+
sql`${sql.raw(joinMeta.joinType)} join ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
32993
32912
|
);
|
32994
32913
|
} else {
|
32995
32914
|
joinsArray.push(
|
32996
|
-
sql`${sql.raw(joinMeta.joinType)} join ${table6}
|
32915
|
+
sql`${sql.raw(joinMeta.joinType)} join ${table6}${onSql}`
|
32997
32916
|
);
|
32998
32917
|
}
|
32999
32918
|
if (index6 < joins.length - 1) {
|
@@ -33567,12 +33486,12 @@ var init_select3 = __esm({
|
|
33567
33486
|
*
|
33568
33487
|
* ```ts
|
33569
33488
|
* // Select all users and their pets
|
33570
|
-
* const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()
|
33489
|
+
* const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()
|
33571
33490
|
* .from(users)
|
33572
33491
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
33573
33492
|
*
|
33574
33493
|
* // Select userId and petId
|
33575
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
33494
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
33576
33495
|
* userId: users.id,
|
33577
33496
|
* petId: pets.id,
|
33578
33497
|
* })
|
@@ -33595,12 +33514,12 @@ var init_select3 = __esm({
|
|
33595
33514
|
*
|
33596
33515
|
* ```ts
|
33597
33516
|
* // Select all users and their pets
|
33598
|
-
* const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()
|
33517
|
+
* const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()
|
33599
33518
|
* .from(users)
|
33600
33519
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
33601
33520
|
*
|
33602
33521
|
* // Select userId and petId
|
33603
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({
|
33522
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({
|
33604
33523
|
* userId: users.id,
|
33605
33524
|
* petId: pets.id,
|
33606
33525
|
* })
|
@@ -33623,12 +33542,12 @@ var init_select3 = __esm({
|
|
33623
33542
|
*
|
33624
33543
|
* ```ts
|
33625
33544
|
* // Select all users and their pets
|
33626
|
-
* const usersWithPets: { user: User; pets: Pet }[] = await db.select()
|
33545
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
33627
33546
|
* .from(users)
|
33628
33547
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
33629
33548
|
*
|
33630
33549
|
* // Select userId and petId
|
33631
|
-
* const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({
|
33550
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
33632
33551
|
* userId: users.id,
|
33633
33552
|
* petId: pets.id,
|
33634
33553
|
* })
|
@@ -33651,12 +33570,12 @@ var init_select3 = __esm({
|
|
33651
33570
|
*
|
33652
33571
|
* ```ts
|
33653
33572
|
* // Select all users and their pets
|
33654
|
-
* const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select()
|
33573
|
+
* const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()
|
33655
33574
|
* .from(users)
|
33656
33575
|
* .fullJoin(pets, eq(users.id, pets.ownerId))
|
33657
33576
|
*
|
33658
33577
|
* // Select userId and petId
|
33659
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({
|
33578
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({
|
33660
33579
|
* userId: users.id,
|
33661
33580
|
* petId: pets.id,
|
33662
33581
|
* })
|
@@ -33665,6 +33584,33 @@ var init_select3 = __esm({
|
|
33665
33584
|
* ```
|
33666
33585
|
*/
|
33667
33586
|
__publicField(this, "fullJoin", this.createJoin("full"));
|
33587
|
+
/**
|
33588
|
+
* Executes a `cross join` operation by combining rows from two tables into a new table.
|
33589
|
+
*
|
33590
|
+
* Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.
|
33591
|
+
*
|
33592
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}
|
33593
|
+
*
|
33594
|
+
* @param table the table to join.
|
33595
|
+
*
|
33596
|
+
* @example
|
33597
|
+
*
|
33598
|
+
* ```ts
|
33599
|
+
* // Select all users, each user with every pet
|
33600
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
33601
|
+
* .from(users)
|
33602
|
+
* .crossJoin(pets)
|
33603
|
+
*
|
33604
|
+
* // Select userId and petId
|
33605
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
33606
|
+
* userId: users.id,
|
33607
|
+
* petId: pets.id,
|
33608
|
+
* })
|
33609
|
+
* .from(users)
|
33610
|
+
* .crossJoin(pets)
|
33611
|
+
* ```
|
33612
|
+
*/
|
33613
|
+
__publicField(this, "crossJoin", this.createJoin("cross"));
|
33668
33614
|
/**
|
33669
33615
|
* Adds `union` set operator to the query.
|
33670
33616
|
*
|
@@ -33828,6 +33774,7 @@ var init_select3 = __esm({
|
|
33828
33774
|
this.joinsNotNullableMap[tableName] = true;
|
33829
33775
|
break;
|
33830
33776
|
}
|
33777
|
+
case "cross":
|
33831
33778
|
case "inner": {
|
33832
33779
|
this.joinsNotNullableMap[tableName] = true;
|
33833
33780
|
break;
|
@@ -34276,8 +34223,7 @@ var init_insert2 = __esm({
|
|
34276
34223
|
* ```
|
34277
34224
|
*/
|
34278
34225
|
onConflictDoNothing(config = {}) {
|
34279
|
-
if (!this.config.onConflict)
|
34280
|
-
this.config.onConflict = [];
|
34226
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34281
34227
|
if (config.target === void 0) {
|
34282
34228
|
this.config.onConflict.push(sql` on conflict do nothing`);
|
34283
34229
|
} else {
|
@@ -34322,8 +34268,7 @@ var init_insert2 = __esm({
|
|
34322
34268
|
'You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.'
|
34323
34269
|
);
|
34324
34270
|
}
|
34325
|
-
if (!this.config.onConflict)
|
34326
|
-
this.config.onConflict = [];
|
34271
|
+
if (!this.config.onConflict) this.config.onConflict = [];
|
34327
34272
|
const whereSql = config.where ? sql` where ${config.where}` : void 0;
|
34328
34273
|
const targetWhereSql = config.targetWhere ? sql` where ${config.targetWhere}` : void 0;
|
34329
34274
|
const setWhereSql = config.setWhere ? sql` where ${config.setWhere}` : void 0;
|
@@ -36552,10 +36497,8 @@ var init_binary = __esm({
|
|
36552
36497
|
__publicField(this, "length", this.config.length);
|
36553
36498
|
}
|
36554
36499
|
mapFromDriverValue(value) {
|
36555
|
-
if (typeof value === "string")
|
36556
|
-
|
36557
|
-
if (Buffer.isBuffer(value))
|
36558
|
-
return value.toString();
|
36500
|
+
if (typeof value === "string") return value;
|
36501
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
36559
36502
|
const str = [];
|
36560
36503
|
for (const v of value) {
|
36561
36504
|
str.push(v === 49 ? "1" : "0");
|
@@ -36877,8 +36820,7 @@ var init_decimal = __esm({
|
|
36877
36820
|
__publicField(this, "unsigned", this.config.unsigned);
|
36878
36821
|
}
|
36879
36822
|
mapFromDriverValue(value) {
|
36880
|
-
if (typeof value === "string")
|
36881
|
-
return value;
|
36823
|
+
if (typeof value === "string") return value;
|
36882
36824
|
return String(value);
|
36883
36825
|
}
|
36884
36826
|
getSQLType() {
|
@@ -36920,8 +36862,7 @@ var init_decimal = __esm({
|
|
36920
36862
|
__publicField(this, "mapToDriverValue", String);
|
36921
36863
|
}
|
36922
36864
|
mapFromDriverValue(value) {
|
36923
|
-
if (typeof value === "number")
|
36924
|
-
return value;
|
36865
|
+
if (typeof value === "number") return value;
|
36925
36866
|
return Number(value);
|
36926
36867
|
}
|
36927
36868
|
getSQLType() {
|
@@ -37650,10 +37591,8 @@ var init_varbinary = __esm({
|
|
37650
37591
|
__publicField(this, "length", this.config.length);
|
37651
37592
|
}
|
37652
37593
|
mapFromDriverValue(value) {
|
37653
|
-
if (typeof value === "string")
|
37654
|
-
|
37655
|
-
if (Buffer.isBuffer(value))
|
37656
|
-
return value.toString();
|
37594
|
+
if (typeof value === "string") return value;
|
37595
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
37657
37596
|
const str = [];
|
37658
37597
|
for (const v of value) {
|
37659
37598
|
str.push(v === 49 ? "1" : "0");
|
@@ -38118,8 +38057,7 @@ var init_dialect3 = __esm({
|
|
38118
38057
|
return `'${str.replace(/'/g, "''")}'`;
|
38119
38058
|
}
|
38120
38059
|
buildWithCTE(queries) {
|
38121
|
-
if (!queries?.length)
|
38122
|
-
return void 0;
|
38060
|
+
if (!queries?.length) return void 0;
|
38123
38061
|
const withSqlChunks = [sql`with `];
|
38124
38062
|
for (const [i, w] of queries.entries()) {
|
38125
38063
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -38273,6 +38211,7 @@ var init_dialect3 = __esm({
|
|
38273
38211
|
}
|
38274
38212
|
const table22 = joinMeta.table;
|
38275
38213
|
const lateralSql = joinMeta.lateral ? sql` lateral` : void 0;
|
38214
|
+
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
|
38276
38215
|
if (is(table22, MySqlTable)) {
|
38277
38216
|
const tableName = table22[MySqlTable.Symbol.Name];
|
38278
38217
|
const tableSchema = table22[MySqlTable.Symbol.Schema];
|
@@ -38282,7 +38221,7 @@ var init_dialect3 = __esm({
|
|
38282
38221
|
const forceIndexSql2 = this.buildIndex({ indexes: joinMeta.forceIndex, indexFor: "FORCE" });
|
38283
38222
|
const ignoreIndexSql2 = this.buildIndex({ indexes: joinMeta.ignoreIndex, indexFor: "IGNORE" });
|
38284
38223
|
joinsArray.push(
|
38285
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${useIndexSql2}${forceIndexSql2}${ignoreIndexSql2}${alias && sql` ${sql.identifier(alias)}`}
|
38224
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${useIndexSql2}${forceIndexSql2}${ignoreIndexSql2}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
38286
38225
|
);
|
38287
38226
|
} else if (is(table22, View3)) {
|
38288
38227
|
const viewName = table22[ViewBaseConfig].name;
|
@@ -38290,11 +38229,11 @@ var init_dialect3 = __esm({
|
|
38290
38229
|
const origViewName = table22[ViewBaseConfig].originalName;
|
38291
38230
|
const alias = viewName === origViewName ? void 0 : joinMeta.alias;
|
38292
38231
|
joinsArray.push(
|
38293
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : void 0}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}
|
38232
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : void 0}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
38294
38233
|
);
|
38295
38234
|
} else {
|
38296
38235
|
joinsArray.push(
|
38297
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table22}
|
38236
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table22}${onSql}`
|
38298
38237
|
);
|
38299
38238
|
}
|
38300
38239
|
if (index6 < joins.length - 1) {
|
@@ -38317,7 +38256,7 @@ var init_dialect3 = __esm({
|
|
38317
38256
|
const { config, strength } = lockingClause;
|
38318
38257
|
lockingClausesSql = sql` for ${sql.raw(strength)}`;
|
38319
38258
|
if (config.noWait) {
|
38320
|
-
lockingClausesSql.append(sql`
|
38259
|
+
lockingClausesSql.append(sql` nowait`);
|
38321
38260
|
} else if (config.skipLocked) {
|
38322
38261
|
lockingClausesSql.append(sql` skip locked`);
|
38323
38262
|
}
|
@@ -39184,17 +39123,18 @@ var init_select4 = __esm({
|
|
39184
39123
|
*
|
39185
39124
|
* @param table the table to join.
|
39186
39125
|
* @param on the `on` clause.
|
39126
|
+
* @param onIndex index hint.
|
39187
39127
|
*
|
39188
39128
|
* @example
|
39189
39129
|
*
|
39190
39130
|
* ```ts
|
39191
39131
|
* // Select all users and their pets
|
39192
|
-
* const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()
|
39132
|
+
* const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()
|
39193
39133
|
* .from(users)
|
39194
39134
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
39195
39135
|
*
|
39196
39136
|
* // Select userId and petId
|
39197
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
39137
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
39198
39138
|
* userId: users.id,
|
39199
39139
|
* petId: pets.id,
|
39200
39140
|
* })
|
@@ -39202,7 +39142,7 @@ var init_select4 = __esm({
|
|
39202
39142
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
39203
39143
|
*
|
39204
39144
|
* // Select userId and petId with use index hint
|
39205
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
39145
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
39206
39146
|
* userId: users.id,
|
39207
39147
|
* petId: pets.id,
|
39208
39148
|
* })
|
@@ -39212,7 +39152,20 @@ var init_select4 = __esm({
|
|
39212
39152
|
* })
|
39213
39153
|
* ```
|
39214
39154
|
*/
|
39215
|
-
__publicField(this, "leftJoin", this.createJoin("left"));
|
39155
|
+
__publicField(this, "leftJoin", this.createJoin("left", false));
|
39156
|
+
/**
|
39157
|
+
* Executes a `left join lateral` operation by adding subquery to the current query.
|
39158
|
+
*
|
39159
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
39160
|
+
*
|
39161
|
+
* Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.
|
39162
|
+
*
|
39163
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}
|
39164
|
+
*
|
39165
|
+
* @param table the subquery to join.
|
39166
|
+
* @param on the `on` clause.
|
39167
|
+
*/
|
39168
|
+
__publicField(this, "leftJoinLateral", this.createJoin("left", true));
|
39216
39169
|
/**
|
39217
39170
|
* Executes a `right join` operation by adding another table to the current query.
|
39218
39171
|
*
|
@@ -39222,17 +39175,18 @@ var init_select4 = __esm({
|
|
39222
39175
|
*
|
39223
39176
|
* @param table the table to join.
|
39224
39177
|
* @param on the `on` clause.
|
39178
|
+
* @param onIndex index hint.
|
39225
39179
|
*
|
39226
39180
|
* @example
|
39227
39181
|
*
|
39228
39182
|
* ```ts
|
39229
39183
|
* // Select all users and their pets
|
39230
|
-
* const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()
|
39184
|
+
* const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()
|
39231
39185
|
* .from(users)
|
39232
39186
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
39233
39187
|
*
|
39234
39188
|
* // Select userId and petId
|
39235
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({
|
39189
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({
|
39236
39190
|
* userId: users.id,
|
39237
39191
|
* petId: pets.id,
|
39238
39192
|
* })
|
@@ -39240,7 +39194,7 @@ var init_select4 = __esm({
|
|
39240
39194
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
39241
39195
|
*
|
39242
39196
|
* // Select userId and petId with use index hint
|
39243
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
39197
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
39244
39198
|
* userId: users.id,
|
39245
39199
|
* petId: pets.id,
|
39246
39200
|
* })
|
@@ -39250,7 +39204,7 @@ var init_select4 = __esm({
|
|
39250
39204
|
* })
|
39251
39205
|
* ```
|
39252
39206
|
*/
|
39253
|
-
__publicField(this, "rightJoin", this.createJoin("right"));
|
39207
|
+
__publicField(this, "rightJoin", this.createJoin("right", false));
|
39254
39208
|
/**
|
39255
39209
|
* Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.
|
39256
39210
|
*
|
@@ -39260,17 +39214,18 @@ var init_select4 = __esm({
|
|
39260
39214
|
*
|
39261
39215
|
* @param table the table to join.
|
39262
39216
|
* @param on the `on` clause.
|
39217
|
+
* @param onIndex index hint.
|
39263
39218
|
*
|
39264
39219
|
* @example
|
39265
39220
|
*
|
39266
39221
|
* ```ts
|
39267
39222
|
* // Select all users and their pets
|
39268
|
-
* const usersWithPets: { user: User; pets: Pet }[] = await db.select()
|
39223
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
39269
39224
|
* .from(users)
|
39270
39225
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
39271
39226
|
*
|
39272
39227
|
* // Select userId and petId
|
39273
|
-
* const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({
|
39228
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
39274
39229
|
* userId: users.id,
|
39275
39230
|
* petId: pets.id,
|
39276
39231
|
* })
|
@@ -39278,7 +39233,7 @@ var init_select4 = __esm({
|
|
39278
39233
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
39279
39234
|
*
|
39280
39235
|
* // Select userId and petId with use index hint
|
39281
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
39236
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
39282
39237
|
* userId: users.id,
|
39283
39238
|
* petId: pets.id,
|
39284
39239
|
* })
|
@@ -39288,45 +39243,70 @@ var init_select4 = __esm({
|
|
39288
39243
|
* })
|
39289
39244
|
* ```
|
39290
39245
|
*/
|
39291
|
-
__publicField(this, "innerJoin", this.createJoin("inner"));
|
39246
|
+
__publicField(this, "innerJoin", this.createJoin("inner", false));
|
39292
39247
|
/**
|
39293
|
-
* Executes
|
39248
|
+
* Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.
|
39294
39249
|
*
|
39295
|
-
*
|
39250
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
39296
39251
|
*
|
39297
|
-
*
|
39252
|
+
* Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.
|
39298
39253
|
*
|
39299
|
-
*
|
39254
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}
|
39255
|
+
*
|
39256
|
+
* @param table the subquery to join.
|
39300
39257
|
* @param on the `on` clause.
|
39258
|
+
*/
|
39259
|
+
__publicField(this, "innerJoinLateral", this.createJoin("inner", true));
|
39260
|
+
/**
|
39261
|
+
* Executes a `cross join` operation by combining rows from two tables into a new table.
|
39262
|
+
*
|
39263
|
+
* Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.
|
39264
|
+
*
|
39265
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}
|
39266
|
+
*
|
39267
|
+
* @param table the table to join.
|
39268
|
+
* @param onIndex index hint.
|
39301
39269
|
*
|
39302
39270
|
* @example
|
39303
39271
|
*
|
39304
39272
|
* ```ts
|
39305
|
-
* // Select all users
|
39306
|
-
* const usersWithPets: { user: User
|
39273
|
+
* // Select all users, each user with every pet
|
39274
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
39307
39275
|
* .from(users)
|
39308
|
-
* .
|
39276
|
+
* .crossJoin(pets)
|
39309
39277
|
*
|
39310
39278
|
* // Select userId and petId
|
39311
|
-
* const usersIdsAndPetIds: { userId: number
|
39279
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
39312
39280
|
* userId: users.id,
|
39313
39281
|
* petId: pets.id,
|
39314
39282
|
* })
|
39315
39283
|
* .from(users)
|
39316
|
-
* .
|
39284
|
+
* .crossJoin(pets)
|
39317
39285
|
*
|
39318
39286
|
* // Select userId and petId with use index hint
|
39319
|
-
* const usersIdsAndPetIds: { userId: number; petId: number
|
39287
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
39320
39288
|
* userId: users.id,
|
39321
39289
|
* petId: pets.id,
|
39322
39290
|
* })
|
39323
39291
|
* .from(users)
|
39324
|
-
* .
|
39292
|
+
* .crossJoin(pets, {
|
39325
39293
|
* useIndex: ['pets_owner_id_index']
|
39326
39294
|
* })
|
39327
39295
|
* ```
|
39328
39296
|
*/
|
39329
|
-
__publicField(this, "
|
39297
|
+
__publicField(this, "crossJoin", this.createJoin("cross", false));
|
39298
|
+
/**
|
39299
|
+
* Executes a `cross join lateral` operation by combining rows from two queries into a new table.
|
39300
|
+
*
|
39301
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
39302
|
+
*
|
39303
|
+
* Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.
|
39304
|
+
*
|
39305
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}
|
39306
|
+
*
|
39307
|
+
* @param table the query to join.
|
39308
|
+
*/
|
39309
|
+
__publicField(this, "crossJoinLateral", this.createJoin("cross", true));
|
39330
39310
|
/**
|
39331
39311
|
* Adds `union` set operator to the query.
|
39332
39312
|
*
|
@@ -39532,8 +39512,11 @@ var init_select4 = __esm({
|
|
39532
39512
|
this.tableName = getTableLikeName(table6);
|
39533
39513
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
39534
39514
|
}
|
39535
|
-
createJoin(joinType) {
|
39536
|
-
return (table6,
|
39515
|
+
createJoin(joinType, lateral) {
|
39516
|
+
return (table6, a, b) => {
|
39517
|
+
const isCrossJoin = joinType === "cross";
|
39518
|
+
let on = isCrossJoin ? void 0 : a;
|
39519
|
+
const onIndex = isCrossJoin ? a : b;
|
39537
39520
|
const baseTableName = this.tableName;
|
39538
39521
|
const tableName = getTableLikeName(table6);
|
39539
39522
|
if (typeof tableName === "string" && this.config.joins?.some((join) => join.alias === tableName)) {
|
@@ -39575,7 +39558,7 @@ var init_select4 = __esm({
|
|
39575
39558
|
ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex));
|
39576
39559
|
}
|
39577
39560
|
}
|
39578
|
-
this.config.joins.push({ on, table: table6, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex });
|
39561
|
+
this.config.joins.push({ on, table: table6, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex, lateral });
|
39579
39562
|
if (typeof tableName === "string") {
|
39580
39563
|
switch (joinType) {
|
39581
39564
|
case "left": {
|
@@ -39589,17 +39572,11 @@ var init_select4 = __esm({
|
|
39589
39572
|
this.joinsNotNullableMap[tableName] = true;
|
39590
39573
|
break;
|
39591
39574
|
}
|
39575
|
+
case "cross":
|
39592
39576
|
case "inner": {
|
39593
39577
|
this.joinsNotNullableMap[tableName] = true;
|
39594
39578
|
break;
|
39595
39579
|
}
|
39596
|
-
case "full": {
|
39597
|
-
this.joinsNotNullableMap = Object.fromEntries(
|
39598
|
-
Object.entries(this.joinsNotNullableMap).map(([key]) => [key, false])
|
39599
|
-
);
|
39600
|
-
this.joinsNotNullableMap[tableName] = false;
|
39601
|
-
break;
|
39602
|
-
}
|
39603
39580
|
}
|
39604
39581
|
}
|
39605
39582
|
return this;
|
@@ -42237,10 +42214,8 @@ var init_binary2 = __esm({
|
|
42237
42214
|
__publicField(this, "length", this.config.length);
|
42238
42215
|
}
|
42239
42216
|
mapFromDriverValue(value) {
|
42240
|
-
if (typeof value === "string")
|
42241
|
-
|
42242
|
-
if (Buffer.isBuffer(value))
|
42243
|
-
return value.toString();
|
42217
|
+
if (typeof value === "string") return value;
|
42218
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
42244
42219
|
const str = [];
|
42245
42220
|
for (const v of value) {
|
42246
42221
|
str.push(v === 49 ? "1" : "0");
|
@@ -42567,8 +42542,7 @@ var init_decimal2 = __esm({
|
|
42567
42542
|
__publicField(this, "unsigned", this.config.unsigned);
|
42568
42543
|
}
|
42569
42544
|
mapFromDriverValue(value) {
|
42570
|
-
if (typeof value === "string")
|
42571
|
-
return value;
|
42545
|
+
if (typeof value === "string") return value;
|
42572
42546
|
return String(value);
|
42573
42547
|
}
|
42574
42548
|
getSQLType() {
|
@@ -42610,8 +42584,7 @@ var init_decimal2 = __esm({
|
|
42610
42584
|
__publicField(this, "mapToDriverValue", String);
|
42611
42585
|
}
|
42612
42586
|
mapFromDriverValue(value) {
|
42613
|
-
if (typeof value === "number")
|
42614
|
-
return value;
|
42587
|
+
if (typeof value === "number") return value;
|
42615
42588
|
return Number(value);
|
42616
42589
|
}
|
42617
42590
|
getSQLType() {
|
@@ -43320,10 +43293,8 @@ var init_varbinary2 = __esm({
|
|
43320
43293
|
__publicField(this, "length", this.config.length);
|
43321
43294
|
}
|
43322
43295
|
mapFromDriverValue(value) {
|
43323
|
-
if (typeof value === "string")
|
43324
|
-
|
43325
|
-
if (Buffer.isBuffer(value))
|
43326
|
-
return value.toString();
|
43296
|
+
if (typeof value === "string") return value;
|
43297
|
+
if (Buffer.isBuffer(value)) return value.toString();
|
43327
43298
|
const str = [];
|
43328
43299
|
for (const v of value) {
|
43329
43300
|
str.push(v === 49 ? "1" : "0");
|
@@ -43947,8 +43918,7 @@ var init_dialect4 = __esm({
|
|
43947
43918
|
return `'${str.replace(/'/g, "''")}'`;
|
43948
43919
|
}
|
43949
43920
|
buildWithCTE(queries) {
|
43950
|
-
if (!queries?.length)
|
43951
|
-
return void 0;
|
43921
|
+
if (!queries?.length) return void 0;
|
43952
43922
|
const withSqlChunks = [sql`with `];
|
43953
43923
|
for (const [i, w] of queries.entries()) {
|
43954
43924
|
withSqlChunks.push(sql`${sql.identifier(w._.alias)} as (${w._.sql})`);
|
@@ -44093,13 +44063,14 @@ var init_dialect4 = __esm({
|
|
44093
44063
|
}
|
44094
44064
|
const table22 = joinMeta.table;
|
44095
44065
|
const lateralSql = joinMeta.lateral ? sql` lateral` : void 0;
|
44066
|
+
const onSql = joinMeta.on ? sql` on ${joinMeta.on}` : void 0;
|
44096
44067
|
if (is(table22, SingleStoreTable)) {
|
44097
44068
|
const tableName = table22[SingleStoreTable.Symbol.Name];
|
44098
44069
|
const tableSchema = table22[SingleStoreTable.Symbol.Schema];
|
44099
44070
|
const origTableName = table22[SingleStoreTable.Symbol.OriginalName];
|
44100
44071
|
const alias = tableName === origTableName ? void 0 : joinMeta.alias;
|
44101
44072
|
joinsArray.push(
|
44102
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}
|
44073
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
44103
44074
|
);
|
44104
44075
|
} else if (is(table22, View3)) {
|
44105
44076
|
const viewName = table22[ViewBaseConfig].name;
|
@@ -44107,11 +44078,11 @@ var init_dialect4 = __esm({
|
|
44107
44078
|
const origViewName = table22[ViewBaseConfig].originalName;
|
44108
44079
|
const alias = viewName === origViewName ? void 0 : joinMeta.alias;
|
44109
44080
|
joinsArray.push(
|
44110
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : void 0}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}
|
44081
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${viewSchema ? sql`${sql.identifier(viewSchema)}.` : void 0}${sql.identifier(origViewName)}${alias && sql` ${sql.identifier(alias)}`}${onSql}`
|
44111
44082
|
);
|
44112
44083
|
} else {
|
44113
44084
|
joinsArray.push(
|
44114
|
-
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table22}
|
44085
|
+
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${table22}${onSql}`
|
44115
44086
|
);
|
44116
44087
|
}
|
44117
44088
|
if (index6 < joins.length - 1) {
|
@@ -44131,7 +44102,7 @@ var init_dialect4 = __esm({
|
|
44131
44102
|
const { config, strength } = lockingClause;
|
44132
44103
|
lockingClausesSql = sql` for ${sql.raw(strength)}`;
|
44133
44104
|
if (config.noWait) {
|
44134
|
-
lockingClausesSql.append(sql`
|
44105
|
+
lockingClausesSql.append(sql` nowait`);
|
44135
44106
|
} else if (config.skipLocked) {
|
44136
44107
|
lockingClausesSql.append(sql` skip locked`);
|
44137
44108
|
}
|
@@ -44571,12 +44542,12 @@ var init_select5 = __esm({
|
|
44571
44542
|
*
|
44572
44543
|
* ```ts
|
44573
44544
|
* // Select all users and their pets
|
44574
|
-
* const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()
|
44545
|
+
* const usersWithPets: { user: User; pets: Pet | null; }[] = await db.select()
|
44575
44546
|
* .from(users)
|
44576
44547
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
44577
44548
|
*
|
44578
44549
|
* // Select userId and petId
|
44579
|
-
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
|
44550
|
+
* const usersIdsAndPetIds: { userId: number; petId: number | null; }[] = await db.select({
|
44580
44551
|
* userId: users.id,
|
44581
44552
|
* petId: pets.id,
|
44582
44553
|
* })
|
@@ -44584,7 +44555,20 @@ var init_select5 = __esm({
|
|
44584
44555
|
* .leftJoin(pets, eq(users.id, pets.ownerId))
|
44585
44556
|
* ```
|
44586
44557
|
*/
|
44587
|
-
__publicField(this, "leftJoin", this.createJoin("left"));
|
44558
|
+
__publicField(this, "leftJoin", this.createJoin("left", false));
|
44559
|
+
/**
|
44560
|
+
* Executes a `left join lateral` operation by adding subquery to the current query.
|
44561
|
+
*
|
44562
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
44563
|
+
*
|
44564
|
+
* Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.
|
44565
|
+
*
|
44566
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#left-join-lateral}
|
44567
|
+
*
|
44568
|
+
* @param table the subquery to join.
|
44569
|
+
* @param on the `on` clause.
|
44570
|
+
*/
|
44571
|
+
__publicField(this, "leftJoinLateral", this.createJoin("left", true));
|
44588
44572
|
/**
|
44589
44573
|
* Executes a `right join` operation by adding another table to the current query.
|
44590
44574
|
*
|
@@ -44599,12 +44583,12 @@ var init_select5 = __esm({
|
|
44599
44583
|
*
|
44600
44584
|
* ```ts
|
44601
44585
|
* // Select all users and their pets
|
44602
|
-
* const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()
|
44586
|
+
* const usersWithPets: { user: User | null; pets: Pet; }[] = await db.select()
|
44603
44587
|
* .from(users)
|
44604
44588
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
44605
44589
|
*
|
44606
44590
|
* // Select userId and petId
|
44607
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({
|
44591
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number; }[] = await db.select({
|
44608
44592
|
* userId: users.id,
|
44609
44593
|
* petId: pets.id,
|
44610
44594
|
* })
|
@@ -44612,7 +44596,7 @@ var init_select5 = __esm({
|
|
44612
44596
|
* .rightJoin(pets, eq(users.id, pets.ownerId))
|
44613
44597
|
* ```
|
44614
44598
|
*/
|
44615
|
-
__publicField(this, "rightJoin", this.createJoin("right"));
|
44599
|
+
__publicField(this, "rightJoin", this.createJoin("right", false));
|
44616
44600
|
/**
|
44617
44601
|
* Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.
|
44618
44602
|
*
|
@@ -44627,12 +44611,12 @@ var init_select5 = __esm({
|
|
44627
44611
|
*
|
44628
44612
|
* ```ts
|
44629
44613
|
* // Select all users and their pets
|
44630
|
-
* const usersWithPets: { user: User; pets: Pet }[] = await db.select()
|
44614
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
44631
44615
|
* .from(users)
|
44632
44616
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
44633
44617
|
*
|
44634
44618
|
* // Select userId and petId
|
44635
|
-
* const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({
|
44619
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
44636
44620
|
* userId: users.id,
|
44637
44621
|
* petId: pets.id,
|
44638
44622
|
* })
|
@@ -44640,7 +44624,20 @@ var init_select5 = __esm({
|
|
44640
44624
|
* .innerJoin(pets, eq(users.id, pets.ownerId))
|
44641
44625
|
* ```
|
44642
44626
|
*/
|
44643
|
-
__publicField(this, "innerJoin", this.createJoin("inner"));
|
44627
|
+
__publicField(this, "innerJoin", this.createJoin("inner", false));
|
44628
|
+
/**
|
44629
|
+
* Executes an `inner join lateral` operation, creating a new table by combining rows from two queries that have matching values.
|
44630
|
+
*
|
44631
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
44632
|
+
*
|
44633
|
+
* Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.
|
44634
|
+
*
|
44635
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#inner-join-lateral}
|
44636
|
+
*
|
44637
|
+
* @param table the subquery to join.
|
44638
|
+
* @param on the `on` clause.
|
44639
|
+
*/
|
44640
|
+
__publicField(this, "innerJoinLateral", this.createJoin("inner", true));
|
44644
44641
|
/**
|
44645
44642
|
* Executes a `full join` operation by combining rows from two tables into a new table.
|
44646
44643
|
*
|
@@ -44655,12 +44652,12 @@ var init_select5 = __esm({
|
|
44655
44652
|
*
|
44656
44653
|
* ```ts
|
44657
44654
|
* // Select all users and their pets
|
44658
|
-
* const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select()
|
44655
|
+
* const usersWithPets: { user: User | null; pets: Pet | null; }[] = await db.select()
|
44659
44656
|
* .from(users)
|
44660
44657
|
* .fullJoin(pets, eq(users.id, pets.ownerId))
|
44661
44658
|
*
|
44662
44659
|
* // Select userId and petId
|
44663
|
-
* const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({
|
44660
|
+
* const usersIdsAndPetIds: { userId: number | null; petId: number | null; }[] = await db.select({
|
44664
44661
|
* userId: users.id,
|
44665
44662
|
* petId: pets.id,
|
44666
44663
|
* })
|
@@ -44668,7 +44665,46 @@ var init_select5 = __esm({
|
|
44668
44665
|
* .fullJoin(pets, eq(users.id, pets.ownerId))
|
44669
44666
|
* ```
|
44670
44667
|
*/
|
44671
|
-
__publicField(this, "fullJoin", this.createJoin("full"));
|
44668
|
+
__publicField(this, "fullJoin", this.createJoin("full", false));
|
44669
|
+
/**
|
44670
|
+
* Executes a `cross join` operation by combining rows from two tables into a new table.
|
44671
|
+
*
|
44672
|
+
* Calling this method retrieves all rows from both main and joined tables, merging all rows from each table.
|
44673
|
+
*
|
44674
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join}
|
44675
|
+
*
|
44676
|
+
* @param table the table to join.
|
44677
|
+
*
|
44678
|
+
* @example
|
44679
|
+
*
|
44680
|
+
* ```ts
|
44681
|
+
* // Select all users, each user with every pet
|
44682
|
+
* const usersWithPets: { user: User; pets: Pet; }[] = await db.select()
|
44683
|
+
* .from(users)
|
44684
|
+
* .crossJoin(pets)
|
44685
|
+
*
|
44686
|
+
* // Select userId and petId
|
44687
|
+
* const usersIdsAndPetIds: { userId: number; petId: number; }[] = await db.select({
|
44688
|
+
* userId: users.id,
|
44689
|
+
* petId: pets.id,
|
44690
|
+
* })
|
44691
|
+
* .from(users)
|
44692
|
+
* .crossJoin(pets)
|
44693
|
+
* ```
|
44694
|
+
*/
|
44695
|
+
__publicField(this, "crossJoin", this.createJoin("cross", false));
|
44696
|
+
/**
|
44697
|
+
* Executes a `cross join lateral` operation by combining rows from two queries into a new table.
|
44698
|
+
*
|
44699
|
+
* A `lateral` join allows the right-hand expression to refer to columns from the left-hand side.
|
44700
|
+
*
|
44701
|
+
* Calling this method retrieves all rows from both main and joined queries, merging all rows from each query.
|
44702
|
+
*
|
44703
|
+
* See docs: {@link https://orm.drizzle.team/docs/joins#cross-join-lateral}
|
44704
|
+
*
|
44705
|
+
* @param table the query to join.
|
44706
|
+
*/
|
44707
|
+
__publicField(this, "crossJoinLateral", this.createJoin("cross", true));
|
44672
44708
|
/**
|
44673
44709
|
* Adds `union` set operator to the query.
|
44674
44710
|
*
|
@@ -44813,7 +44849,7 @@ var init_select5 = __esm({
|
|
44813
44849
|
this.tableName = getTableLikeName(table6);
|
44814
44850
|
this.joinsNotNullableMap = typeof this.tableName === "string" ? { [this.tableName]: true } : {};
|
44815
44851
|
}
|
44816
|
-
createJoin(joinType) {
|
44852
|
+
createJoin(joinType, lateral) {
|
44817
44853
|
return (table6, on) => {
|
44818
44854
|
const baseTableName = this.tableName;
|
44819
44855
|
const tableName = getTableLikeName(table6);
|
@@ -44842,7 +44878,7 @@ var init_select5 = __esm({
|
|
44842
44878
|
if (!this.config.joins) {
|
44843
44879
|
this.config.joins = [];
|
44844
44880
|
}
|
44845
|
-
this.config.joins.push({ on, table: table6, joinType, alias: tableName });
|
44881
|
+
this.config.joins.push({ on, table: table6, joinType, alias: tableName, lateral });
|
44846
44882
|
if (typeof tableName === "string") {
|
44847
44883
|
switch (joinType) {
|
44848
44884
|
case "left": {
|
@@ -44856,6 +44892,7 @@ var init_select5 = __esm({
|
|
44856
44892
|
this.joinsNotNullableMap[tableName] = true;
|
44857
44893
|
break;
|
44858
44894
|
}
|
44895
|
+
case "cross":
|
44859
44896
|
case "inner": {
|
44860
44897
|
this.joinsNotNullableMap[tableName] = true;
|
44861
44898
|
break;
|