@xylex-group/athena 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +837 -114
  3. package/dist/browser.cjs.map +1 -1
  4. package/dist/browser.d.cts +7 -7
  5. package/dist/browser.d.ts +7 -7
  6. package/dist/browser.js +837 -114
  7. package/dist/browser.js.map +1 -1
  8. package/dist/cli/index.cjs +830 -107
  9. package/dist/cli/index.cjs.map +1 -1
  10. package/dist/cli/index.d.cts +3 -3
  11. package/dist/cli/index.d.ts +3 -3
  12. package/dist/cli/index.js +830 -107
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/cookies.cjs +10 -3
  15. package/dist/cookies.cjs.map +1 -1
  16. package/dist/cookies.js +10 -3
  17. package/dist/cookies.js.map +1 -1
  18. package/dist/index.cjs +837 -114
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +7 -7
  21. package/dist/index.d.ts +7 -7
  22. package/dist/index.js +837 -114
  23. package/dist/index.js.map +1 -1
  24. package/dist/model-form-AKYrgede.d.ts +2772 -0
  25. package/dist/model-form-ehfqLuG7.d.cts +2772 -0
  26. package/dist/{pipeline-Ce3pTw5h.d.ts → pipeline-BUsR9XlO.d.ts} +1 -1
  27. package/dist/{pipeline-D1ZYeoH7.d.cts → pipeline-BfCWSRYl.d.cts} +1 -1
  28. package/dist/react-email-BQzmXBDE.d.cts +304 -0
  29. package/dist/react-email-BrVRp80B.d.ts +304 -0
  30. package/dist/react.cjs +178 -71
  31. package/dist/react.cjs.map +1 -1
  32. package/dist/react.d.cts +22 -5
  33. package/dist/react.d.ts +22 -5
  34. package/dist/react.js +92 -5
  35. package/dist/react.js.map +1 -1
  36. package/dist/{types-CUuo4NDi.d.cts → types-BSIsyss1.d.cts} +1 -1
  37. package/dist/{types-DSX6AT5B.d.cts → types-BsyRW49r.d.cts} +1 -1
  38. package/dist/{types-DSX6AT5B.d.ts → types-BsyRW49r.d.ts} +1 -1
  39. package/dist/{types-DapchQY5.d.ts → types-t_TVqnmp.d.ts} +1 -1
  40. package/package.json +193 -193
  41. package/dist/model-form-BaHWi3gm.d.cts +0 -1383
  42. package/dist/model-form-Dh6gWjL0.d.ts +0 -1383
  43. package/dist/react-email-B8O1Jeff.d.cts +0 -1230
  44. package/dist/react-email-CDEF0jij.d.ts +0 -1230
@@ -1497,16 +1497,23 @@ var getSessionCookie = (request, config) => {
1497
1497
  const { cookieName = "session_token", cookiePrefix = "athena-auth" } = {};
1498
1498
  const parsedCookie = parseCookies(cookies);
1499
1499
  const getCookie = (name) => parsedCookie.get(name) || parsedCookie.get(`${SECURE_COOKIE_PREFIX}${name}`);
1500
- const sessionToken = getCookie(`${cookiePrefix}.${cookieName}`) || getCookie(`${cookiePrefix}-${cookieName}`);
1501
- if (sessionToken) {
1502
- return sessionToken;
1500
+ const candidateCookieNames = Array.from(/* @__PURE__ */ new Set([
1501
+ cookieName,
1502
+ cookieName.replace(/_/g, "-"),
1503
+ cookieName.replace(/-/g, "_")
1504
+ ])).filter(Boolean);
1505
+ for (const candidateName of candidateCookieNames) {
1506
+ const sessionToken = getCookie(`${cookiePrefix}.${candidateName}`) || getCookie(`${cookiePrefix}-${candidateName}`);
1507
+ if (sessionToken) {
1508
+ return sessionToken;
1509
+ }
1503
1510
  }
1504
1511
  return null;
1505
1512
  };
1506
1513
 
1507
1514
  // package.json
1508
1515
  var package_default = {
1509
- version: "2.6.0"
1516
+ version: "2.7.0"
1510
1517
  };
1511
1518
 
1512
1519
  // src/sdk-version.ts
@@ -3481,6 +3488,344 @@ function createDbModule(input) {
3481
3488
  return db;
3482
3489
  }
3483
3490
 
3491
+ // src/storage/file.ts
3492
+ function createStorageFileModule(base, config = {}) {
3493
+ const upload = async (input, options) => {
3494
+ const sources = normalizeUploadSources(input);
3495
+ validateUploadConstraints(sources, input);
3496
+ const uploadRequests = sources.map((source, index) => {
3497
+ const storageKey = resolveUploadStorageKey(input, source, index, options, config);
3498
+ return {
3499
+ source,
3500
+ uploadRequest: {
3501
+ s3_id: input.s3_id,
3502
+ bucket: input.bucket,
3503
+ storage_key: storageKey,
3504
+ name: input.name ?? source.fileName,
3505
+ original_name: input.original_name ?? source.fileName,
3506
+ resource_id: input.resource_id ?? input.resourceId,
3507
+ mime_type: input.mime_type ?? source.contentType,
3508
+ content_type: input.content_type ?? source.contentType,
3509
+ size_bytes: source.sizeBytes,
3510
+ public: input.public,
3511
+ metadata: input.metadata
3512
+ }
3513
+ };
3514
+ });
3515
+ input.onProgress?.(createProgressSnapshot("preparing", sources, 0, 0, 0));
3516
+ const uploadUrls = uploadRequests.length === 1 ? [await base.createStorageUploadUrl(uploadRequests[0].uploadRequest, options)] : (await base.createStorageUploadUrls({ files: uploadRequests.map((request) => request.uploadRequest) }, options)).files;
3517
+ const aggregateLoaded = new Array(uploadRequests.length).fill(0);
3518
+ const uploaded = [];
3519
+ for (let index = 0; index < uploadRequests.length; index += 1) {
3520
+ const request = uploadRequests[index];
3521
+ const uploadUrl = uploadUrls[index];
3522
+ const response = await putUploadBody(uploadUrl.upload.url, request.source, input, options, (progress) => {
3523
+ aggregateLoaded[index] = progress.loaded;
3524
+ input.onProgress?.(createProgressSnapshot("uploading", sources, index, progress.loaded, sum(aggregateLoaded)));
3525
+ });
3526
+ uploaded.push({
3527
+ file: uploadUrl.file,
3528
+ upload: uploadUrl.upload,
3529
+ source: request.source.source,
3530
+ fileName: request.source.fileName,
3531
+ storage_key: request.uploadRequest.storage_key,
3532
+ response
3533
+ });
3534
+ aggregateLoaded[index] = request.source.sizeBytes;
3535
+ input.onProgress?.(createProgressSnapshot("complete", sources, index, request.source.sizeBytes, sum(aggregateLoaded)));
3536
+ }
3537
+ return {
3538
+ files: uploaded,
3539
+ count: uploaded.length
3540
+ };
3541
+ };
3542
+ const download = ((input, queryOrOptions, maybeOptions) => {
3543
+ const { fileIds, query, options } = normalizeDownloadArgs(input, queryOrOptions, maybeOptions);
3544
+ const downloads = fileIds.map((fileId) => base.getStorageFileProxy(fileId, query, options));
3545
+ return Array.isArray(input) || isRecord5(input) && Array.isArray(input.fileIds) ? Promise.all(downloads) : downloads[0];
3546
+ });
3547
+ const deleteFile = ((input, options) => {
3548
+ if (Array.isArray(input)) {
3549
+ return Promise.all(input.map((fileId) => base.deleteStorageFile(fileId, options)));
3550
+ }
3551
+ return base.deleteStorageFile(input, options);
3552
+ });
3553
+ return {
3554
+ upload,
3555
+ download,
3556
+ list(input, options) {
3557
+ const prefix = resolveStoragePath(input.prefix ?? "", input, options, config);
3558
+ return base.listStorageFiles(
3559
+ {
3560
+ s3_id: input.s3_id,
3561
+ prefix
3562
+ },
3563
+ options
3564
+ );
3565
+ },
3566
+ delete: deleteFile
3567
+ };
3568
+ }
3569
+ function resolveStoragePath(path, input, options, config = {}) {
3570
+ const context = createPathContext(input, options, config);
3571
+ const prefixPath = input.prefixPath ?? config.prefixPath;
3572
+ const prefix = typeof prefixPath === "function" ? prefixPath(context) : prefixPath;
3573
+ return joinStoragePath(renderStorageTemplate(prefix ?? "", context), renderStorageTemplate(path, context));
3574
+ }
3575
+ function resolveUploadStorageKey(input, source, index, options, config) {
3576
+ const explicitKey = input.storage_key ?? input.storageKey;
3577
+ const keyTemplate = input.storageKeyTemplate;
3578
+ const fallbackName = source.fileName;
3579
+ const context = createPathContext(input, options, config);
3580
+ const key = keyTemplate ? renderStorageTemplate(keyTemplate, {
3581
+ ...context,
3582
+ vars: {
3583
+ ...context.vars,
3584
+ index,
3585
+ fileName: source.fileName,
3586
+ name: source.fileName
3587
+ }
3588
+ }) : explicitKey ?? fallbackName;
3589
+ return resolveStoragePath(key, input, options, config);
3590
+ }
3591
+ function normalizeUploadSources(input) {
3592
+ const files = toArray(input.files);
3593
+ if (files.length === 0) {
3594
+ throw new Error("athena.storage.file.upload requires at least one file");
3595
+ }
3596
+ return files.map((source, index) => {
3597
+ const fileName = input.fileName ?? sourceName(source) ?? `file-${index + 1}`;
3598
+ const sizeBytes = sourceSize(source);
3599
+ const contentType = input.content_type ?? input.mime_type ?? sourceContentType(source);
3600
+ return {
3601
+ source,
3602
+ fileName,
3603
+ sizeBytes,
3604
+ contentType
3605
+ };
3606
+ });
3607
+ }
3608
+ function validateUploadConstraints(sources, input) {
3609
+ const maxFiles = input.maxFiles ?? 1;
3610
+ if (sources.length > maxFiles) {
3611
+ throw new Error(`athena.storage.file.upload accepts at most ${maxFiles} file${maxFiles === 1 ? "" : "s"} for this call`);
3612
+ }
3613
+ const maxFileSizeBytes = input.maxFileSizeBytes ?? (input.maxFileSizeMb === void 0 ? void 0 : Math.floor(input.maxFileSizeMb * 1024 * 1024));
3614
+ if (maxFileSizeBytes !== void 0) {
3615
+ const tooLarge = sources.find((source) => source.sizeBytes > maxFileSizeBytes);
3616
+ if (tooLarge) {
3617
+ throw new Error(`athena.storage.file.upload rejected ${tooLarge.fileName}: file exceeds ${maxFileSizeBytes} bytes`);
3618
+ }
3619
+ }
3620
+ const allowedExtensions = normalizeExtensions(input.allowedExtensions ?? input.extensions);
3621
+ if (allowedExtensions.size > 0) {
3622
+ const invalid = sources.find((source) => !allowedExtensions.has(fileExtension(source.fileName)));
3623
+ if (invalid) {
3624
+ throw new Error(`athena.storage.file.upload rejected ${invalid.fileName}: extension is not allowed`);
3625
+ }
3626
+ }
3627
+ }
3628
+ async function putUploadBody(url, source, input, options, onProgress) {
3629
+ const headers = new Headers(input.uploadHeaders);
3630
+ if (source.contentType && !headers.has("Content-Type")) {
3631
+ headers.set("Content-Type", source.contentType);
3632
+ }
3633
+ if (typeof XMLHttpRequest !== "undefined") {
3634
+ return putUploadBodyWithXhr(url, source, headers, options, onProgress);
3635
+ }
3636
+ onProgress({ loaded: 0 });
3637
+ const response = await fetch(url, {
3638
+ method: "PUT",
3639
+ headers,
3640
+ body: source.source,
3641
+ signal: options?.signal
3642
+ });
3643
+ if (!response.ok) {
3644
+ throw new Error(`athena.storage.file.upload failed with status ${response.status}`);
3645
+ }
3646
+ onProgress({ loaded: source.sizeBytes });
3647
+ return response;
3648
+ }
3649
+ function putUploadBodyWithXhr(url, source, headers, options, onProgress) {
3650
+ const Xhr = XMLHttpRequest;
3651
+ if (Xhr === void 0) {
3652
+ return Promise.reject(new Error("athena.storage.file.upload requires XMLHttpRequest in this runtime"));
3653
+ }
3654
+ return new Promise((resolve3, reject) => {
3655
+ const xhr = new Xhr();
3656
+ const abort = () => xhr.abort();
3657
+ xhr.open("PUT", url);
3658
+ headers.forEach((value, key) => xhr.setRequestHeader(key, value));
3659
+ xhr.upload.onprogress = (event) => {
3660
+ onProgress({ loaded: event.loaded });
3661
+ };
3662
+ xhr.onload = () => {
3663
+ if (options?.signal) {
3664
+ options.signal.removeEventListener("abort", abort);
3665
+ }
3666
+ if (xhr.status < 200 || xhr.status >= 300) {
3667
+ reject(new Error(`athena.storage.file.upload failed with status ${xhr.status}`));
3668
+ return;
3669
+ }
3670
+ onProgress({ loaded: source.sizeBytes });
3671
+ resolve3(new Response(xhr.response, {
3672
+ status: xhr.status,
3673
+ statusText: xhr.statusText,
3674
+ headers: parseXhrHeaders(xhr.getAllResponseHeaders())
3675
+ }));
3676
+ };
3677
+ xhr.onerror = () => {
3678
+ if (options?.signal) {
3679
+ options.signal.removeEventListener("abort", abort);
3680
+ }
3681
+ reject(new Error("athena.storage.file.upload failed with a network error"));
3682
+ };
3683
+ xhr.onabort = () => {
3684
+ if (options?.signal) {
3685
+ options.signal.removeEventListener("abort", abort);
3686
+ }
3687
+ reject(new DOMException("Upload aborted", "AbortError"));
3688
+ };
3689
+ if (options?.signal) {
3690
+ if (options.signal.aborted) {
3691
+ abort();
3692
+ return;
3693
+ }
3694
+ options.signal.addEventListener("abort", abort, { once: true });
3695
+ }
3696
+ xhr.send(source.source);
3697
+ });
3698
+ }
3699
+ function normalizeDownloadArgs(input, queryOrOptions, maybeOptions) {
3700
+ if (typeof input === "string") {
3701
+ return { fileIds: [input], query: queryOrOptions, options: maybeOptions };
3702
+ }
3703
+ if (Array.isArray(input)) {
3704
+ return { fileIds: [...input], query: queryOrOptions, options: maybeOptions };
3705
+ }
3706
+ const downloadInput = input;
3707
+ const { fileId, fileIds, ...query } = downloadInput;
3708
+ return {
3709
+ fileIds: fileIds ? [...fileIds] : fileId ? [fileId] : [],
3710
+ query,
3711
+ options: queryOrOptions
3712
+ };
3713
+ }
3714
+ function createPathContext(input, options, config) {
3715
+ const organizationId = input.organizationId ?? input.organization_id ?? options?.organizationId ?? void 0;
3716
+ const userId = input.userId ?? input.user_id ?? options?.userId ?? void 0;
3717
+ const resourceId = input.resourceId ?? input.resource_id ?? void 0;
3718
+ const vars = {
3719
+ ...config.vars ?? {},
3720
+ ...input.vars ?? {}
3721
+ };
3722
+ if (organizationId !== void 0) {
3723
+ vars.organizationId = organizationId;
3724
+ vars.organization_id = organizationId;
3725
+ }
3726
+ if (userId !== void 0) {
3727
+ vars.userId = userId;
3728
+ vars.user_id = userId;
3729
+ }
3730
+ if (resourceId !== void 0) {
3731
+ vars.resourceId = resourceId;
3732
+ vars.resource_id = resourceId;
3733
+ }
3734
+ return {
3735
+ vars,
3736
+ env: {
3737
+ ...readProcessEnv(),
3738
+ ...config.env ?? {},
3739
+ ...input.env ?? {}
3740
+ },
3741
+ organizationId,
3742
+ organization_id: organizationId,
3743
+ userId,
3744
+ user_id: userId,
3745
+ resourceId,
3746
+ resource_id: resourceId
3747
+ };
3748
+ }
3749
+ function renderStorageTemplate(template, context) {
3750
+ return template.replace(/\$\{([^}]+)\}|\{([^}]+)\}/g, (_match, shellToken, braceToken) => {
3751
+ const token = (shellToken ?? braceToken ?? "").trim();
3752
+ if (!token) return "";
3753
+ const value = resolveTemplateToken(token, context);
3754
+ return value === void 0 || value === null ? "" : String(value);
3755
+ });
3756
+ }
3757
+ function resolveTemplateToken(token, context) {
3758
+ if (token.startsWith("env.")) {
3759
+ return context.env[token.slice(4)];
3760
+ }
3761
+ if (token in context.vars) {
3762
+ return context.vars[token];
3763
+ }
3764
+ return context.env[token];
3765
+ }
3766
+ function joinStoragePath(...parts) {
3767
+ return parts.map((part) => part.trim().replace(/^\/+|\/+$/g, "")).filter(Boolean).join("/");
3768
+ }
3769
+ function toArray(files) {
3770
+ if (isUploadSource(files)) return [files];
3771
+ return Array.from(files);
3772
+ }
3773
+ function isUploadSource(value) {
3774
+ return value instanceof Blob || value instanceof ArrayBuffer || value instanceof Uint8Array;
3775
+ }
3776
+ function sourceName(source) {
3777
+ return isRecord5(source) && typeof source.name === "string" && source.name.trim() ? source.name.trim() : void 0;
3778
+ }
3779
+ function sourceSize(source) {
3780
+ if (source instanceof Blob) return source.size;
3781
+ return source.byteLength;
3782
+ }
3783
+ function sourceContentType(source) {
3784
+ return source instanceof Blob && source.type.trim() ? source.type.trim() : void 0;
3785
+ }
3786
+ function normalizeExtensions(extensions) {
3787
+ return new Set((extensions ?? []).map((extension) => extension.replace(/^\./, "").toLowerCase()).filter(Boolean));
3788
+ }
3789
+ function fileExtension(fileName) {
3790
+ const lastDot = fileName.lastIndexOf(".");
3791
+ return lastDot === -1 ? "" : fileName.slice(lastDot + 1).toLowerCase();
3792
+ }
3793
+ function createProgressSnapshot(phase, sources, fileIndex, loaded, aggregateLoaded) {
3794
+ const total = sources[fileIndex]?.sizeBytes ?? 0;
3795
+ const aggregateTotal = sources.reduce((totalBytes, source) => totalBytes + source.sizeBytes, 0);
3796
+ return {
3797
+ phase,
3798
+ fileIndex,
3799
+ fileCount: sources.length,
3800
+ fileName: sources[fileIndex]?.fileName ?? "",
3801
+ loaded,
3802
+ total,
3803
+ percent: total > 0 ? Math.round(loaded / total * 100) : 100,
3804
+ aggregateLoaded,
3805
+ aggregateTotal,
3806
+ aggregatePercent: aggregateTotal > 0 ? Math.round(aggregateLoaded / aggregateTotal * 100) : 100
3807
+ };
3808
+ }
3809
+ function sum(values) {
3810
+ return values.reduce((total, value) => total + value, 0);
3811
+ }
3812
+ function parseXhrHeaders(raw) {
3813
+ const headers = new Headers();
3814
+ for (const line of raw.trim().split(/[\r\n]+/)) {
3815
+ const index = line.indexOf(":");
3816
+ if (index === -1) continue;
3817
+ headers.set(line.slice(0, index).trim(), line.slice(index + 1).trim());
3818
+ }
3819
+ return headers;
3820
+ }
3821
+ function readProcessEnv() {
3822
+ const processLike = globalThis.process;
3823
+ return processLike?.env ?? {};
3824
+ }
3825
+ function isRecord5(value) {
3826
+ return Boolean(value) && typeof value === "object";
3827
+ }
3828
+
3484
3829
  // src/storage/module.ts
3485
3830
  var storageSdkManifest = {
3486
3831
  methods: [
@@ -3675,7 +4020,7 @@ var AthenaStorageError = class extends Error {
3675
4020
  };
3676
4021
  }
3677
4022
  };
3678
- function isRecord5(value) {
4023
+ function isRecord6(value) {
3679
4024
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3680
4025
  }
3681
4026
  function causeToString(cause) {
@@ -3790,7 +4135,7 @@ function withPathParam(path, name, value) {
3790
4135
  return path.replace(`{${name}}`, encodeURIComponent(value));
3791
4136
  }
3792
4137
  function resolveErrorMessage3(payload, fallback) {
3793
- if (isRecord5(payload)) {
4138
+ if (isRecord6(payload)) {
3794
4139
  const message = payload.message ?? payload.error ?? payload.details;
3795
4140
  if (typeof message === "string" && message.trim()) {
3796
4141
  return message.trim();
@@ -3802,12 +4147,12 @@ function resolveErrorMessage3(payload, fallback) {
3802
4147
  return fallback;
3803
4148
  }
3804
4149
  function resolveErrorHint2(payload) {
3805
- if (!isRecord5(payload)) return void 0;
4150
+ if (!isRecord6(payload)) return void 0;
3806
4151
  const hint = payload.hint ?? payload.suggestion;
3807
4152
  return typeof hint === "string" && hint.trim() ? hint.trim() : void 0;
3808
4153
  }
3809
4154
  function resolveErrorCause(payload) {
3810
- if (!isRecord5(payload)) return void 0;
4155
+ if (!isRecord6(payload)) return void 0;
3811
4156
  const cause = payload.cause ?? payload.reason;
3812
4157
  return typeof cause === "string" && cause.trim() ? cause.trim() : void 0;
3813
4158
  }
@@ -3926,7 +4271,7 @@ async function callStorageEndpoint(gateway, endpoint, method, envelope, payload,
3926
4271
  );
3927
4272
  }
3928
4273
  if (envelope === "athena") {
3929
- if (!isRecord5(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
4274
+ if (!isRecord6(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
3930
4275
  return rejectStorageError(
3931
4276
  {
3932
4277
  code: "INVALID_ATHENA_ENVELOPE",
@@ -4034,81 +4379,260 @@ async function callStorageBinaryEndpoint(gateway, endpoint, method, options, run
4034
4379
  runtimeOptions
4035
4380
  );
4036
4381
  }
4037
- function createStorageModule(gateway, runtimeOptions) {
4382
+ function isBlobBody(body) {
4383
+ return typeof Blob !== "undefined" && body instanceof Blob;
4384
+ }
4385
+ function isReadableStreamBody(body) {
4386
+ return typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
4387
+ }
4388
+ async function putPresignedUploadBody(uploadUrl, uploadHeaders, body, options) {
4389
+ const headers = new Headers(uploadHeaders);
4390
+ Object.entries(options?.headers ?? {}).forEach(([key, value]) => headers.set(key, value));
4391
+ if (!headers.has("Content-Type") && isBlobBody(body) && body.type) {
4392
+ headers.set("Content-Type", body.type);
4393
+ }
4394
+ const init = {
4395
+ method: "PUT",
4396
+ headers,
4397
+ body,
4398
+ signal: options?.signal
4399
+ };
4400
+ if (isReadableStreamBody(body)) {
4401
+ init.duplex = "half";
4402
+ }
4403
+ return fetch(uploadUrl, init);
4404
+ }
4405
+ function attachManagedUpload(upload) {
4406
+ const headers = {};
4407
+ return {
4408
+ ...upload,
4409
+ method: "PUT",
4410
+ headers,
4411
+ expiresAt: upload.expires_at,
4412
+ put(body, options) {
4413
+ return putPresignedUploadBody(upload.url, headers, body, options);
4414
+ }
4415
+ };
4416
+ }
4417
+ function attachUploadHelper(response) {
4418
+ return {
4419
+ ...response,
4420
+ upload: attachManagedUpload(response.upload)
4421
+ };
4422
+ }
4423
+ function attachUploadHelpers(response) {
4038
4424
  return {
4425
+ files: response.files.map(attachUploadHelper)
4426
+ };
4427
+ }
4428
+ function normalizeUploadUrlRequest(input) {
4429
+ const s3_id = input.s3_id ?? input.s3Id;
4430
+ const storage_key = input.storage_key ?? input.storageKey;
4431
+ if (!s3_id?.trim()) {
4432
+ throw new Error("athena.storage.file.upload requires s3_id or s3Id");
4433
+ }
4434
+ if (!storage_key?.trim()) {
4435
+ throw new Error("athena.storage.file.upload requires storage_key or storageKey");
4436
+ }
4437
+ const fileName = input.fileName?.trim();
4438
+ const originalName = input.originalName?.trim();
4439
+ return {
4440
+ s3_id,
4441
+ bucket: input.bucket,
4442
+ storage_key,
4443
+ name: input.name ?? fileName,
4444
+ original_name: input.original_name ?? originalName ?? fileName,
4445
+ resource_id: input.resource_id ?? input.resourceId,
4446
+ mime_type: input.mime_type ?? input.mimeType,
4447
+ content_type: input.content_type ?? input.contentType,
4448
+ size_bytes: input.size_bytes ?? input.sizeBytes,
4449
+ file_id: input.file_id ?? input.fileId,
4450
+ public: input.public,
4451
+ visibility: input.visibility,
4452
+ metadata: input.metadata
4453
+ };
4454
+ }
4455
+ async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options, runtimeOptions) {
4456
+ let url;
4457
+ let headers;
4458
+ try {
4459
+ const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
4460
+ url = buildAthenaGatewayUrl(baseUrl, endpoint);
4461
+ headers = gateway.buildHeaders(options);
4462
+ } catch (error) {
4463
+ return rejectStorageError(
4464
+ {
4465
+ code: storageCodeFromUnknown(error),
4466
+ message: error instanceof Error ? error.message : `Athena storage PUT ${endpoint} failed before sending the request`,
4467
+ status: isAthenaGatewayError(error) ? error.status : 0,
4468
+ endpoint,
4469
+ method: "PUT",
4470
+ raw: error,
4471
+ requestId: isAthenaGatewayError(error) ? error.requestId : void 0,
4472
+ hint: isAthenaGatewayError(error) ? error.hint : void 0,
4473
+ cause: error
4474
+ },
4475
+ options,
4476
+ runtimeOptions
4477
+ );
4478
+ }
4479
+ delete headers["Content-Type"];
4480
+ delete headers["content-type"];
4481
+ if (isBlobBody(body) && body.type) {
4482
+ headers["Content-Type"] = body.type;
4483
+ }
4484
+ const requestInit = {
4485
+ method: "PUT",
4486
+ headers,
4487
+ body,
4488
+ signal: options?.signal
4489
+ };
4490
+ if (isReadableStreamBody(body)) {
4491
+ requestInit.duplex = "half";
4492
+ }
4493
+ let response;
4494
+ try {
4495
+ response = await fetch(url, requestInit);
4496
+ } catch (error) {
4497
+ const message = error instanceof Error ? error.message : String(error);
4498
+ return rejectStorageError(
4499
+ {
4500
+ code: "NETWORK_ERROR",
4501
+ message: `Network error while calling Athena storage PUT ${endpoint}: ${message}`,
4502
+ status: 0,
4503
+ endpoint,
4504
+ method: "PUT",
4505
+ cause: error
4506
+ },
4507
+ options,
4508
+ runtimeOptions
4509
+ );
4510
+ }
4511
+ let rawText;
4512
+ try {
4513
+ rawText = await response.text();
4514
+ } catch (error) {
4515
+ return rejectStorageError(
4516
+ {
4517
+ code: "NETWORK_ERROR",
4518
+ message: `Athena storage PUT ${endpoint} response body could not be read`,
4519
+ status: response.status,
4520
+ endpoint,
4521
+ method: "PUT",
4522
+ requestId: headerValue(response.headers, ["x-athena-request-id", "x-request-id", "request-id"]),
4523
+ cause: error
4524
+ },
4525
+ options,
4526
+ runtimeOptions
4527
+ );
4528
+ }
4529
+ const parsedBody = parseResponseBody3(rawText ?? "", response.headers.get("content-type"));
4530
+ const requestId = headerValue(response.headers, ["x-athena-request-id", "x-request-id", "request-id"]);
4531
+ if (parsedBody.parseFailed) {
4532
+ return rejectStorageError(
4533
+ {
4534
+ code: "INVALID_JSON",
4535
+ message: `Athena storage PUT ${endpoint} returned malformed JSON`,
4536
+ status: response.status,
4537
+ endpoint,
4538
+ method: "PUT",
4539
+ requestId,
4540
+ raw: parsedBody.parsed
4541
+ },
4542
+ options,
4543
+ runtimeOptions
4544
+ );
4545
+ }
4546
+ if (!response.ok) {
4547
+ return rejectStorageError(
4548
+ {
4549
+ code: "HTTP_ERROR",
4550
+ message: resolveErrorMessage3(
4551
+ parsedBody.parsed,
4552
+ `Athena storage PUT ${endpoint} failed with status ${response.status}`
4553
+ ),
4554
+ status: response.status,
4555
+ endpoint,
4556
+ method: "PUT",
4557
+ requestId,
4558
+ hint: resolveErrorHint2(parsedBody.parsed),
4559
+ cause: resolveErrorCause(parsedBody.parsed),
4560
+ raw: parsedBody.parsed
4561
+ },
4562
+ options,
4563
+ runtimeOptions
4564
+ );
4565
+ }
4566
+ if (!isRecord6(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
4567
+ return rejectStorageError(
4568
+ {
4569
+ code: "INVALID_ATHENA_ENVELOPE",
4570
+ message: `Athena storage PUT ${endpoint} returned an invalid Athena envelope`,
4571
+ status: response.status,
4572
+ endpoint,
4573
+ method: "PUT",
4574
+ requestId,
4575
+ raw: parsedBody.parsed
4576
+ },
4577
+ options,
4578
+ runtimeOptions
4579
+ );
4580
+ }
4581
+ return parsedBody.parsed.data;
4582
+ }
4583
+ function createStorageModule(gateway, runtimeOptions) {
4584
+ const callRaw = (path, method, payload, options) => callStorageEndpoint(
4585
+ gateway,
4586
+ storagePath(path),
4587
+ method,
4588
+ "raw",
4589
+ payload,
4590
+ options,
4591
+ runtimeOptions
4592
+ );
4593
+ const callAthena2 = (path, method, payload, options) => callStorageEndpoint(
4594
+ gateway,
4595
+ storagePath(path),
4596
+ method,
4597
+ "athena",
4598
+ payload,
4599
+ options,
4600
+ runtimeOptions
4601
+ );
4602
+ const base = {
4039
4603
  listStorageCatalogs(options) {
4040
- return callStorageEndpoint(gateway, storagePath("/storage/catalogs"), "GET", "raw", void 0, options, runtimeOptions);
4604
+ return callRaw("/storage/catalogs", "GET", void 0, options);
4041
4605
  },
4042
4606
  createStorageCatalog(input, options) {
4043
- return callStorageEndpoint(gateway, storagePath("/storage/catalogs"), "POST", "raw", input, options, runtimeOptions);
4607
+ return callRaw("/storage/catalogs", "POST", input, options);
4044
4608
  },
4045
4609
  updateStorageCatalog(id, input, options) {
4046
- return callStorageEndpoint(
4047
- gateway,
4048
- storagePath(withPathParam("/storage/catalogs/{id}", "id", id)),
4049
- "PATCH",
4050
- "raw",
4051
- input,
4052
- options,
4053
- runtimeOptions
4054
- );
4610
+ return callRaw(withPathParam("/storage/catalogs/{id}", "id", id), "PATCH", input, options);
4055
4611
  },
4056
4612
  deleteStorageCatalog(id, options) {
4057
- return callStorageEndpoint(
4058
- gateway,
4059
- storagePath(withPathParam("/storage/catalogs/{id}", "id", id)),
4060
- "DELETE",
4061
- "raw",
4062
- void 0,
4063
- options,
4064
- runtimeOptions
4065
- );
4613
+ return callRaw(withPathParam("/storage/catalogs/{id}", "id", id), "DELETE", void 0, options);
4066
4614
  },
4067
4615
  listStorageCredentials(options) {
4068
- return callStorageEndpoint(gateway, storagePath("/storage/credentials"), "GET", "raw", void 0, options, runtimeOptions);
4616
+ return callRaw("/storage/credentials", "GET", void 0, options);
4069
4617
  },
4070
4618
  createStorageUploadUrl(input, options) {
4071
- return callStorageEndpoint(
4072
- gateway,
4073
- storagePath("/storage/files/upload-url"),
4074
- "POST",
4075
- "athena",
4076
- input,
4077
- options,
4078
- runtimeOptions
4079
- );
4619
+ return callAthena2("/storage/files/upload-url", "POST", input, options);
4080
4620
  },
4081
4621
  createStorageUploadUrls(input, options) {
4082
- return callStorageEndpoint(
4083
- gateway,
4084
- storagePath("/storage/files/upload-urls"),
4085
- "POST",
4086
- "athena",
4087
- input,
4088
- options,
4089
- runtimeOptions
4090
- );
4622
+ return callAthena2("/storage/files/upload-urls", "POST", input, options);
4091
4623
  },
4092
4624
  listStorageFiles(input, options) {
4093
- return callStorageEndpoint(gateway, storagePath("/storage/files/list"), "POST", "athena", input, options, runtimeOptions);
4625
+ return callAthena2("/storage/files/list", "POST", input, options);
4094
4626
  },
4095
4627
  getStorageFile(fileId, options) {
4096
- return callStorageEndpoint(
4097
- gateway,
4098
- storagePath(withPathParam("/storage/files/{file_id}", "file_id", fileId)),
4099
- "GET",
4100
- "athena",
4101
- void 0,
4102
- options,
4103
- runtimeOptions
4104
- );
4628
+ return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "GET", void 0, options);
4105
4629
  },
4106
4630
  getStorageFileUrl(fileId, query, options) {
4107
4631
  const path = appendQuery(
4108
4632
  withPathParam("/storage/files/{file_id}/url", "file_id", fileId),
4109
4633
  query
4110
4634
  );
4111
- return callStorageEndpoint(gateway, storagePath(path), "GET", "athena", void 0, options, runtimeOptions);
4635
+ return callAthena2(path, "GET", void 0, options);
4112
4636
  },
4113
4637
  getStorageFileProxy(fileId, query, options) {
4114
4638
  const path = appendQuery(
@@ -4118,45 +4642,244 @@ function createStorageModule(gateway, runtimeOptions) {
4118
4642
  return callStorageBinaryEndpoint(gateway, storagePath(path), "GET", options, runtimeOptions);
4119
4643
  },
4120
4644
  updateStorageFile(fileId, input, options) {
4121
- return callStorageEndpoint(
4122
- gateway,
4123
- storagePath(withPathParam("/storage/files/{file_id}", "file_id", fileId)),
4124
- "PATCH",
4125
- "athena",
4126
- input,
4127
- options,
4128
- runtimeOptions
4129
- );
4645
+ return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "PATCH", input, options);
4130
4646
  },
4131
4647
  deleteStorageFile(fileId, options) {
4132
- return callStorageEndpoint(
4133
- gateway,
4134
- storagePath(withPathParam("/storage/files/{file_id}", "file_id", fileId)),
4135
- "DELETE",
4136
- "athena",
4137
- void 0,
4138
- options,
4139
- runtimeOptions
4140
- );
4648
+ return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "DELETE", void 0, options);
4141
4649
  },
4142
4650
  setStorageFileVisibility(fileId, input, options) {
4143
- return callStorageEndpoint(
4651
+ return callAthena2(withPathParam("/storage/files/{file_id}/visibility", "file_id", fileId), "PATCH", input, options);
4652
+ },
4653
+ deleteStorageFolder(input, options) {
4654
+ return callAthena2("/storage/folders/delete", "POST", input, options);
4655
+ },
4656
+ moveStorageFolder(input, options) {
4657
+ return callAthena2("/storage/folders/move", "POST", input, options);
4658
+ }
4659
+ };
4660
+ const fileFacade = createStorageFileModule(base, runtimeOptions);
4661
+ const fileUpload = ((input, options) => {
4662
+ if (isRecord6(input) && "files" in input) {
4663
+ return fileFacade.upload(input, options);
4664
+ }
4665
+ return base.createStorageUploadUrl(
4666
+ normalizeUploadUrlRequest(input),
4667
+ options
4668
+ ).then(attachUploadHelper);
4669
+ });
4670
+ const fileDelete = ((input, options) => fileFacade.delete(input, options));
4671
+ const file = {
4672
+ ...fileFacade,
4673
+ upload: fileUpload,
4674
+ uploadMany(input, options) {
4675
+ return base.createStorageUploadUrls(
4676
+ { files: input.files.map(normalizeUploadUrlRequest) },
4677
+ options
4678
+ ).then(attachUploadHelpers);
4679
+ },
4680
+ confirmUpload(fileId, input, options) {
4681
+ return callAthena2(withPathParam("/storage/files/{file_id}/confirm-upload", "file_id", fileId), "POST", input ?? {}, options);
4682
+ },
4683
+ uploadBinary(fileId, body, options) {
4684
+ return callStorageUploadBinaryEndpoint(
4144
4685
  gateway,
4145
- storagePath(withPathParam("/storage/files/{file_id}/visibility", "file_id", fileId)),
4146
- "PATCH",
4147
- "athena",
4148
- input,
4686
+ storagePath(withPathParam("/storage/files/{file_id}/upload", "file_id", fileId)),
4687
+ body,
4149
4688
  options,
4150
4689
  runtimeOptions
4151
4690
  );
4152
4691
  },
4153
- deleteStorageFolder(input, options) {
4154
- return callStorageEndpoint(gateway, storagePath("/storage/folders/delete"), "POST", "athena", input, options, runtimeOptions);
4692
+ search(input, options) {
4693
+ return callAthena2("/storage/files/search", "POST", input, options);
4155
4694
  },
4156
- moveStorageFolder(input, options) {
4157
- return callStorageEndpoint(gateway, storagePath("/storage/folders/move"), "POST", "athena", input, options, runtimeOptions);
4695
+ get(fileId, options) {
4696
+ return base.getStorageFile(fileId, options);
4697
+ },
4698
+ update(fileId, input, options) {
4699
+ return base.updateStorageFile(fileId, input, options);
4700
+ },
4701
+ delete: fileDelete,
4702
+ deleteMany(input, options) {
4703
+ return callAthena2("/storage/files/delete-many", "POST", input, options);
4704
+ },
4705
+ updateMany(input, options) {
4706
+ return callAthena2("/storage/files/update-many", "POST", input, options);
4707
+ },
4708
+ restore(fileId, options) {
4709
+ return callAthena2(withPathParam("/storage/files/{file_id}/restore", "file_id", fileId), "POST", {}, options);
4710
+ },
4711
+ purge(fileId, options) {
4712
+ return callAthena2(withPathParam("/storage/files/{file_id}/purge", "file_id", fileId), "DELETE", void 0, options);
4713
+ },
4714
+ copy(fileId, input, options) {
4715
+ return callAthena2(withPathParam("/storage/files/{file_id}/copy", "file_id", fileId), "POST", input, options);
4716
+ },
4717
+ url(fileId, query, options) {
4718
+ return base.getStorageFileUrl(fileId, query, options);
4719
+ },
4720
+ publicUrl(fileId, options) {
4721
+ return callAthena2(withPathParam("/storage/files/{file_id}/public-url", "file_id", fileId), "GET", void 0, options);
4722
+ },
4723
+ proxy(fileId, query, options) {
4724
+ return base.getStorageFileProxy(fileId, query, options);
4725
+ },
4726
+ visibility: {
4727
+ set(fileId, input, options) {
4728
+ return base.setStorageFileVisibility(fileId, input, options);
4729
+ },
4730
+ setMany(input, options) {
4731
+ return callAthena2("/storage/files/visibility-many", "POST", input, options);
4732
+ }
4733
+ }
4734
+ };
4735
+ const credentials = {
4736
+ list(options) {
4737
+ return base.listStorageCredentials(options);
4738
+ }
4739
+ };
4740
+ const catalog = {
4741
+ list(options) {
4742
+ return base.listStorageCatalogs(options);
4743
+ },
4744
+ create(input, options) {
4745
+ return base.createStorageCatalog(input, options);
4746
+ },
4747
+ update(id, input, options) {
4748
+ return base.updateStorageCatalog(id, input, options);
4749
+ },
4750
+ delete(id, options) {
4751
+ return base.deleteStorageCatalog(id, options);
4158
4752
  }
4159
4753
  };
4754
+ const folder = {
4755
+ list(input, options) {
4756
+ return callAthena2("/storage/folders/list", "POST", input, options);
4757
+ },
4758
+ tree(input, options) {
4759
+ return callAthena2("/storage/folders/tree", "POST", input, options);
4760
+ },
4761
+ delete(input, options) {
4762
+ return base.deleteStorageFolder(input, options);
4763
+ },
4764
+ move(input, options) {
4765
+ return base.moveStorageFolder(input, options);
4766
+ }
4767
+ };
4768
+ const permission = {
4769
+ list(input, options) {
4770
+ return callAthena2("/storage/permissions/list", "POST", input, options);
4771
+ },
4772
+ grant(input, options) {
4773
+ return callAthena2("/storage/permissions/grant", "POST", input, options);
4774
+ },
4775
+ revoke(input, options) {
4776
+ return callAthena2("/storage/permissions/revoke", "POST", input, options);
4777
+ },
4778
+ check(input, options) {
4779
+ return callAthena2("/storage/permissions/check", "POST", input, options);
4780
+ }
4781
+ };
4782
+ const objectFolder = {
4783
+ create(input, options) {
4784
+ return callAthena2("/storage/objects/folder", "POST", input, options);
4785
+ },
4786
+ delete(input, options) {
4787
+ return callAthena2("/storage/objects/folder/delete", "POST", input, options);
4788
+ },
4789
+ rename(input, options) {
4790
+ return callAthena2("/storage/objects/folder/rename", "POST", input, options);
4791
+ }
4792
+ };
4793
+ const object = {
4794
+ list(input, options) {
4795
+ return callAthena2("/storage/objects", "POST", input, options);
4796
+ },
4797
+ head(input, options) {
4798
+ return callAthena2("/storage/objects/head", "POST", input, options);
4799
+ },
4800
+ exists(input, options) {
4801
+ return callAthena2("/storage/objects/exists", "POST", input, options);
4802
+ },
4803
+ validate(input, options) {
4804
+ return callAthena2("/storage/objects/validate", "POST", input, options);
4805
+ },
4806
+ update(input, options) {
4807
+ return callAthena2("/storage/objects/update", "POST", input, options);
4808
+ },
4809
+ copy(input, options) {
4810
+ return callAthena2("/storage/objects/copy", "POST", input, options);
4811
+ },
4812
+ url(input, options) {
4813
+ return callAthena2("/storage/objects/url", "POST", input, options);
4814
+ },
4815
+ publicUrl(input, options) {
4816
+ return callAthena2("/storage/objects/public-url", "POST", input, options);
4817
+ },
4818
+ delete(input, options) {
4819
+ return callAthena2("/storage/objects/delete", "POST", input, options);
4820
+ },
4821
+ uploadUrl(input, options) {
4822
+ return callAthena2("/storage/objects/upload-url", "POST", input, options);
4823
+ },
4824
+ folder: objectFolder
4825
+ };
4826
+ const bucket = {
4827
+ list(input, options) {
4828
+ return callAthena2("/storage/buckets/list", "POST", input, options);
4829
+ },
4830
+ create(input, options) {
4831
+ return callAthena2("/storage/buckets/create", "POST", input, options);
4832
+ },
4833
+ delete(input, options) {
4834
+ return callAthena2("/storage/buckets/delete", "POST", input, options);
4835
+ },
4836
+ cors: {
4837
+ get(input, options) {
4838
+ return callAthena2("/storage/buckets/cors", "POST", input, options);
4839
+ },
4840
+ set(input, options) {
4841
+ return callAthena2("/storage/buckets/cors/set", "POST", input, options);
4842
+ },
4843
+ delete(input, options) {
4844
+ return callAthena2("/storage/buckets/cors/delete", "POST", input, options);
4845
+ }
4846
+ }
4847
+ };
4848
+ const multipart = {
4849
+ create(input, options) {
4850
+ return callAthena2("/storage/multipart/create", "POST", input, options);
4851
+ },
4852
+ signPart(input, options) {
4853
+ return callAthena2("/storage/multipart/sign-part", "POST", input, options);
4854
+ },
4855
+ complete(input, options) {
4856
+ return callAthena2("/storage/multipart/complete", "POST", input, options);
4857
+ },
4858
+ abort(input, options) {
4859
+ return callAthena2("/storage/multipart/abort", "POST", input, options);
4860
+ },
4861
+ listParts(input, options) {
4862
+ return callAthena2("/storage/multipart/list-parts", "POST", input, options);
4863
+ }
4864
+ };
4865
+ const audit = {
4866
+ list(input, options) {
4867
+ return callAthena2("/storage/audit/list", "POST", input, options);
4868
+ }
4869
+ };
4870
+ return {
4871
+ ...base,
4872
+ credentials,
4873
+ catalog,
4874
+ file,
4875
+ folder,
4876
+ permission,
4877
+ object,
4878
+ bucket,
4879
+ multipart,
4880
+ audit,
4881
+ delete: file.delete
4882
+ };
4160
4883
  }
4161
4884
 
4162
4885
  // src/query-ast.ts
@@ -4186,7 +4909,7 @@ var BOOLEAN_SAFE_OPERATORS = /* @__PURE__ */ new Set([
4186
4909
  "ilike",
4187
4910
  "is"
4188
4911
  ]);
4189
- function isRecord6(value) {
4912
+ function isRecord7(value) {
4190
4913
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4191
4914
  }
4192
4915
  function isUuidString(value) {
@@ -4199,7 +4922,7 @@ function shouldUseUuidTextComparison(column, value) {
4199
4922
  return typeof value === "string" && isUuidString(value) && isUuidIdentifierColumn(column);
4200
4923
  }
4201
4924
  function isRelationSelectNode(value) {
4202
- return isRecord6(value) && isRecord6(value.select);
4925
+ return isRecord7(value) && isRecord7(value.select);
4203
4926
  }
4204
4927
  function normalizeIdentifier(value, label) {
4205
4928
  const normalized = value.trim();
@@ -4255,7 +4978,7 @@ function compileRelationToken(key, node) {
4255
4978
  return `${prefix}${relationToken}(${nested})`;
4256
4979
  }
4257
4980
  function compileSelectShape(select) {
4258
- if (!isRecord6(select)) {
4981
+ if (!isRecord7(select)) {
4259
4982
  throw new Error("findMany select must be an object");
4260
4983
  }
4261
4984
  const tokens = [];
@@ -4279,7 +5002,7 @@ function compileSelectShape(select) {
4279
5002
  return tokens.join(",");
4280
5003
  }
4281
5004
  function selectShapeUsesRelationSchema(select) {
4282
- if (!isRecord6(select)) {
5005
+ if (!isRecord7(select)) {
4283
5006
  return false;
4284
5007
  }
4285
5008
  for (const rawValue of Object.values(select)) {
@@ -4297,7 +5020,7 @@ function selectShapeUsesRelationSchema(select) {
4297
5020
  }
4298
5021
  function compileColumnWhere(column, input) {
4299
5022
  const normalizedColumn = normalizeIdentifier(column, "where column");
4300
- if (!isRecord6(input)) {
5023
+ if (!isRecord7(input)) {
4301
5024
  return [buildGatewayCondition("eq", normalizedColumn, input)];
4302
5025
  }
4303
5026
  const conditions = [];
@@ -4325,7 +5048,7 @@ function compileColumnWhere(column, input) {
4325
5048
  return conditions;
4326
5049
  }
4327
5050
  function compileBooleanExpressionTerms(clause, label) {
4328
- if (!isRecord6(clause)) {
5051
+ if (!isRecord7(clause)) {
4329
5052
  throw new Error(`findMany where.${label} clauses must be objects`);
4330
5053
  }
4331
5054
  const entries = Object.entries(clause).filter(([, value]) => value !== void 0);
@@ -4334,7 +5057,7 @@ function compileBooleanExpressionTerms(clause, label) {
4334
5057
  }
4335
5058
  const [rawColumn, rawValue] = entries[0];
4336
5059
  const column = normalizeIdentifier(rawColumn, `where.${label} column`);
4337
- if (!isRecord6(rawValue)) {
5060
+ if (!isRecord7(rawValue)) {
4338
5061
  return [`${column}.eq.${stringifyFilterValue(rawValue)}`];
4339
5062
  }
4340
5063
  const operatorEntries = Object.entries(rawValue).filter(([, value]) => value !== void 0);
@@ -4358,7 +5081,7 @@ function compileWhere(where) {
4358
5081
  if (where === void 0) {
4359
5082
  return void 0;
4360
5083
  }
4361
- if (!isRecord6(where)) {
5084
+ if (!isRecord7(where)) {
4362
5085
  throw new Error("findMany where must be an object");
4363
5086
  }
4364
5087
  const conditions = [];
@@ -4408,7 +5131,7 @@ function compileOrderBy(orderBy) {
4408
5131
  if (orderBy === void 0) {
4409
5132
  return void 0;
4410
5133
  }
4411
- if (!isRecord6(orderBy)) {
5134
+ if (!isRecord7(orderBy)) {
4412
5135
  throw new Error("findMany orderBy must be an object");
4413
5136
  }
4414
5137
  if ("column" in orderBy) {
@@ -4583,11 +5306,11 @@ function toFindManyAstOrder(order) {
4583
5306
  ascending: order.direction !== "descending"
4584
5307
  };
4585
5308
  }
4586
- function isRecord7(value) {
5309
+ function isRecord8(value) {
4587
5310
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4588
5311
  }
4589
5312
  function normalizeFindManyAstColumnPredicate(value) {
4590
- if (!isRecord7(value)) {
5313
+ if (!isRecord8(value)) {
4591
5314
  return {
4592
5315
  eq: value
4593
5316
  };
@@ -4611,7 +5334,7 @@ function normalizeFindManyAstBooleanOperand(clause) {
4611
5334
  return normalized;
4612
5335
  }
4613
5336
  function normalizeFindManyAstWhere(where) {
4614
- if (!where || !isRecord7(where)) {
5337
+ if (!where || !isRecord8(where)) {
4615
5338
  return where;
4616
5339
  }
4617
5340
  const normalized = {};
@@ -4625,7 +5348,7 @@ function normalizeFindManyAstWhere(where) {
4625
5348
  );
4626
5349
  continue;
4627
5350
  }
4628
- if (key === "not" && isRecord7(value)) {
5351
+ if (key === "not" && isRecord8(value)) {
4629
5352
  normalized.not = normalizeFindManyAstBooleanOperand(
4630
5353
  value
4631
5354
  );
@@ -4636,7 +5359,7 @@ function normalizeFindManyAstWhere(where) {
4636
5359
  return normalized;
4637
5360
  }
4638
5361
  function predicateRequiresUuidQueryFallback(column, value) {
4639
- if (!isRecord7(value)) {
5362
+ if (!isRecord8(value)) {
4640
5363
  return shouldUseUuidTextComparison(column, value);
4641
5364
  }
4642
5365
  const eqValue = value.eq;
@@ -4654,7 +5377,7 @@ function booleanOperandRequiresUuidQueryFallback(clause) {
4654
5377
  return false;
4655
5378
  }
4656
5379
  function findManyAstWhereRequiresLegacyTransport(where) {
4657
- if (!where || !isRecord7(where)) {
5380
+ if (!where || !isRecord8(where)) {
4658
5381
  return false;
4659
5382
  }
4660
5383
  for (const [key, value] of Object.entries(where)) {
@@ -4669,7 +5392,7 @@ function findManyAstWhereRequiresLegacyTransport(where) {
4669
5392
  }
4670
5393
  continue;
4671
5394
  }
4672
- if (key === "not" && isRecord7(value)) {
5395
+ if (key === "not" && isRecord8(value)) {
4673
5396
  if (booleanOperandRequiresUuidQueryFallback(value)) {
4674
5397
  return true;
4675
5398
  }
@@ -4871,7 +5594,7 @@ async function executeExperimentalRead(experimental, runner) {
4871
5594
  throw error;
4872
5595
  }
4873
5596
  }
4874
- function isRecord8(value) {
5597
+ function isRecord9(value) {
4875
5598
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
4876
5599
  }
4877
5600
  function firstNonEmptyString2(...values) {
@@ -4883,8 +5606,8 @@ function firstNonEmptyString2(...values) {
4883
5606
  return void 0;
4884
5607
  }
4885
5608
  function resolveStructuredErrorPayload2(raw) {
4886
- if (!isRecord8(raw)) return null;
4887
- return isRecord8(raw.error) ? raw.error : raw;
5609
+ if (!isRecord9(raw)) return null;
5610
+ return isRecord9(raw.error) ? raw.error : raw;
4888
5611
  }
4889
5612
  function resolveStructuredErrorDetails(payload, message) {
4890
5613
  if (!payload || !("details" in payload)) {
@@ -4900,7 +5623,7 @@ function resolveStructuredErrorDetails(payload, message) {
4900
5623
  return details;
4901
5624
  }
4902
5625
  function createResultError(response, result, normalized) {
4903
- const rawRecord = isRecord8(response.raw) ? response.raw : null;
5626
+ const rawRecord = isRecord9(response.raw) ? response.raw : null;
4904
5627
  const payload = resolveStructuredErrorPayload2(response.raw);
4905
5628
  const message = firstNonEmptyString2(
4906
5629
  response.error,