@xylex-group/athena 2.4.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -1
- package/bin/athena-js.js +0 -0
- package/dist/browser.cjs +1912 -49
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +1905 -50
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +708 -22
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +708 -22
- package/dist/cli/index.js.map +1 -1
- package/dist/cookies.d.cts +1 -174
- package/dist/cookies.d.ts +1 -174
- package/dist/index-CVcQCGyG.d.cts +174 -0
- package/dist/index-CVcQCGyG.d.ts +174 -0
- package/dist/index.cjs +1912 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1905 -50
- package/dist/index.js.map +1 -1
- package/dist/{model-form-4LPnOPAF.d.cts → model-form-BaHWi3gm.d.cts} +1 -1
- package/dist/{model-form-CO4-LmNC.d.ts → model-form-Dh6gWjL0.d.ts} +1 -1
- package/dist/{pipeline-CR4V15jF.d.ts → pipeline-Ce3pTw5h.d.ts} +1 -1
- package/dist/{pipeline-DZeExYMA.d.cts → pipeline-D1ZYeoH7.d.cts} +1 -1
- package/dist/{react-email-Buhcpglm.d.ts → react-email-B8O1Jeff.d.cts} +596 -23
- package/dist/{react-email-6mOyxBo4.d.cts → react-email-CDEF0jij.d.ts} +596 -23
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/{types-D1JvL21V.d.cts → types-CUuo4NDi.d.cts} +1 -1
- package/dist/{types-09Q4D86N.d.cts → types-DSX6AT5B.d.cts} +3 -3
- package/dist/{types-09Q4D86N.d.ts → types-DSX6AT5B.d.ts} +3 -3
- package/dist/{types-DU3gNdFv.d.ts → types-DapchQY5.d.ts} +1 -1
- package/package.json +193 -192
package/dist/cli/index.js
CHANGED
|
@@ -1504,7 +1504,7 @@ var getSessionCookie = (request, config) => {
|
|
|
1504
1504
|
|
|
1505
1505
|
// package.json
|
|
1506
1506
|
var package_default = {
|
|
1507
|
-
version: "2.
|
|
1507
|
+
version: "2.6.0"
|
|
1508
1508
|
};
|
|
1509
1509
|
|
|
1510
1510
|
// src/sdk-version.ts
|
|
@@ -3479,6 +3479,684 @@ function createDbModule(input) {
|
|
|
3479
3479
|
return db;
|
|
3480
3480
|
}
|
|
3481
3481
|
|
|
3482
|
+
// src/storage/module.ts
|
|
3483
|
+
var storageSdkManifest = {
|
|
3484
|
+
methods: [
|
|
3485
|
+
{
|
|
3486
|
+
name: "listStorageCatalogs",
|
|
3487
|
+
method: "GET",
|
|
3488
|
+
path: "/storage/catalogs",
|
|
3489
|
+
responseEnvelope: "raw",
|
|
3490
|
+
responseType: "{ data: S3CatalogItem[] }"
|
|
3491
|
+
},
|
|
3492
|
+
{
|
|
3493
|
+
name: "createStorageCatalog",
|
|
3494
|
+
method: "POST",
|
|
3495
|
+
path: "/storage/catalogs",
|
|
3496
|
+
requestType: "CreateStorageCatalogRequest",
|
|
3497
|
+
responseEnvelope: "raw",
|
|
3498
|
+
responseType: "S3CatalogItem"
|
|
3499
|
+
},
|
|
3500
|
+
{
|
|
3501
|
+
name: "updateStorageCatalog",
|
|
3502
|
+
method: "PATCH",
|
|
3503
|
+
path: "/storage/catalogs/{id}",
|
|
3504
|
+
pathParams: ["id"],
|
|
3505
|
+
requestType: "UpdateStorageCatalogRequest",
|
|
3506
|
+
responseEnvelope: "raw",
|
|
3507
|
+
responseType: "S3CatalogItem"
|
|
3508
|
+
},
|
|
3509
|
+
{
|
|
3510
|
+
name: "deleteStorageCatalog",
|
|
3511
|
+
method: "DELETE",
|
|
3512
|
+
path: "/storage/catalogs/{id}",
|
|
3513
|
+
pathParams: ["id"],
|
|
3514
|
+
responseEnvelope: "raw",
|
|
3515
|
+
responseType: "{ id: string; deleted: boolean }"
|
|
3516
|
+
},
|
|
3517
|
+
{
|
|
3518
|
+
name: "listStorageCredentials",
|
|
3519
|
+
method: "GET",
|
|
3520
|
+
path: "/storage/credentials",
|
|
3521
|
+
responseEnvelope: "raw",
|
|
3522
|
+
responseType: "{ data: S3CredentialListItem[] }"
|
|
3523
|
+
},
|
|
3524
|
+
{
|
|
3525
|
+
name: "createStorageUploadUrl",
|
|
3526
|
+
method: "POST",
|
|
3527
|
+
path: "/storage/files/upload-url",
|
|
3528
|
+
requestType: "CreateStorageUploadUrlRequest",
|
|
3529
|
+
responseEnvelope: "athena",
|
|
3530
|
+
responseType: "StorageUploadUrlResponse"
|
|
3531
|
+
},
|
|
3532
|
+
{
|
|
3533
|
+
name: "createStorageUploadUrls",
|
|
3534
|
+
method: "POST",
|
|
3535
|
+
path: "/storage/files/upload-urls",
|
|
3536
|
+
requestType: "CreateStorageUploadUrlsRequest",
|
|
3537
|
+
responseEnvelope: "athena",
|
|
3538
|
+
responseType: "StorageBatchUploadUrlResponse"
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
name: "listStorageFiles",
|
|
3542
|
+
method: "POST",
|
|
3543
|
+
path: "/storage/files/list",
|
|
3544
|
+
requestType: "ListStorageFilesRequest",
|
|
3545
|
+
responseEnvelope: "athena",
|
|
3546
|
+
responseType: "StorageListFilesResponse"
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
name: "getStorageFile",
|
|
3550
|
+
method: "GET",
|
|
3551
|
+
path: "/storage/files/{file_id}",
|
|
3552
|
+
pathParams: ["file_id"],
|
|
3553
|
+
responseEnvelope: "athena",
|
|
3554
|
+
responseType: "StorageFileMutationResponse"
|
|
3555
|
+
},
|
|
3556
|
+
{
|
|
3557
|
+
name: "getStorageFileUrl",
|
|
3558
|
+
method: "GET",
|
|
3559
|
+
path: "/storage/files/{file_id}/url",
|
|
3560
|
+
pathParams: ["file_id"],
|
|
3561
|
+
queryParams: ["purpose"],
|
|
3562
|
+
responseEnvelope: "athena",
|
|
3563
|
+
responseType: "PresignedFileUrlResponse"
|
|
3564
|
+
},
|
|
3565
|
+
{
|
|
3566
|
+
name: "getStorageFileProxy",
|
|
3567
|
+
method: "GET",
|
|
3568
|
+
path: "/storage/files/{file_id}/proxy",
|
|
3569
|
+
pathParams: ["file_id"],
|
|
3570
|
+
queryParams: ["purpose"],
|
|
3571
|
+
responseEnvelope: "raw",
|
|
3572
|
+
responseType: "Response",
|
|
3573
|
+
binary: true
|
|
3574
|
+
},
|
|
3575
|
+
{
|
|
3576
|
+
name: "updateStorageFile",
|
|
3577
|
+
method: "PATCH",
|
|
3578
|
+
path: "/storage/files/{file_id}",
|
|
3579
|
+
pathParams: ["file_id"],
|
|
3580
|
+
requestType: "UpdateStorageFileRequest",
|
|
3581
|
+
responseEnvelope: "athena",
|
|
3582
|
+
responseType: "StorageFileMutationResponse"
|
|
3583
|
+
},
|
|
3584
|
+
{
|
|
3585
|
+
name: "deleteStorageFile",
|
|
3586
|
+
method: "DELETE",
|
|
3587
|
+
path: "/storage/files/{file_id}",
|
|
3588
|
+
pathParams: ["file_id"],
|
|
3589
|
+
responseEnvelope: "athena",
|
|
3590
|
+
responseType: "StorageFileMutationResponse"
|
|
3591
|
+
},
|
|
3592
|
+
{
|
|
3593
|
+
name: "setStorageFileVisibility",
|
|
3594
|
+
method: "PATCH",
|
|
3595
|
+
path: "/storage/files/{file_id}/visibility",
|
|
3596
|
+
pathParams: ["file_id"],
|
|
3597
|
+
requestType: "SetStorageFileVisibilityRequest",
|
|
3598
|
+
responseEnvelope: "athena",
|
|
3599
|
+
responseType: "StorageFileMutationResponse"
|
|
3600
|
+
},
|
|
3601
|
+
{
|
|
3602
|
+
name: "deleteStorageFolder",
|
|
3603
|
+
method: "POST",
|
|
3604
|
+
path: "/storage/folders/delete",
|
|
3605
|
+
requestType: "DeleteStorageFolderRequest",
|
|
3606
|
+
responseEnvelope: "athena",
|
|
3607
|
+
responseType: "StorageFolderMutationResponse"
|
|
3608
|
+
},
|
|
3609
|
+
{
|
|
3610
|
+
name: "moveStorageFolder",
|
|
3611
|
+
method: "POST",
|
|
3612
|
+
path: "/storage/folders/move",
|
|
3613
|
+
requestType: "MoveStorageFolderRequest",
|
|
3614
|
+
responseEnvelope: "athena",
|
|
3615
|
+
responseType: "StorageFolderMutationResponse"
|
|
3616
|
+
}
|
|
3617
|
+
]
|
|
3618
|
+
};
|
|
3619
|
+
var AthenaStorageError = class extends Error {
|
|
3620
|
+
code;
|
|
3621
|
+
athenaCode;
|
|
3622
|
+
kind;
|
|
3623
|
+
category;
|
|
3624
|
+
retryable;
|
|
3625
|
+
status;
|
|
3626
|
+
endpoint;
|
|
3627
|
+
method;
|
|
3628
|
+
requestId;
|
|
3629
|
+
hint;
|
|
3630
|
+
causeDetail;
|
|
3631
|
+
raw;
|
|
3632
|
+
normalized;
|
|
3633
|
+
__athenaNormalizedError;
|
|
3634
|
+
constructor(input) {
|
|
3635
|
+
super(input.message, { cause: input.cause });
|
|
3636
|
+
this.name = "AthenaStorageError";
|
|
3637
|
+
this.code = input.code;
|
|
3638
|
+
this.status = input.status;
|
|
3639
|
+
this.endpoint = input.endpoint;
|
|
3640
|
+
this.method = input.method;
|
|
3641
|
+
this.requestId = input.requestId;
|
|
3642
|
+
this.hint = input.hint;
|
|
3643
|
+
this.causeDetail = causeToString(input.cause);
|
|
3644
|
+
this.raw = input.raw ?? null;
|
|
3645
|
+
this.normalized = normalizeStorageErrorInput(input);
|
|
3646
|
+
this.__athenaNormalizedError = this.normalized;
|
|
3647
|
+
this.athenaCode = this.normalized.code;
|
|
3648
|
+
this.kind = this.normalized.kind;
|
|
3649
|
+
this.category = this.normalized.category;
|
|
3650
|
+
this.retryable = this.normalized.retryable;
|
|
3651
|
+
Object.defineProperty(this, "__athenaNormalizedError", {
|
|
3652
|
+
value: this.normalized,
|
|
3653
|
+
enumerable: false,
|
|
3654
|
+
configurable: false,
|
|
3655
|
+
writable: false
|
|
3656
|
+
});
|
|
3657
|
+
}
|
|
3658
|
+
toDetails() {
|
|
3659
|
+
return {
|
|
3660
|
+
code: this.code,
|
|
3661
|
+
athenaCode: this.athenaCode,
|
|
3662
|
+
kind: this.kind,
|
|
3663
|
+
category: this.category,
|
|
3664
|
+
retryable: this.retryable,
|
|
3665
|
+
message: this.message,
|
|
3666
|
+
status: this.status,
|
|
3667
|
+
endpoint: this.endpoint,
|
|
3668
|
+
method: this.method,
|
|
3669
|
+
requestId: this.requestId,
|
|
3670
|
+
hint: this.hint,
|
|
3671
|
+
cause: this.causeDetail,
|
|
3672
|
+
raw: this.raw
|
|
3673
|
+
};
|
|
3674
|
+
}
|
|
3675
|
+
};
|
|
3676
|
+
function isRecord5(value) {
|
|
3677
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3678
|
+
}
|
|
3679
|
+
function causeToString(cause) {
|
|
3680
|
+
if (cause === void 0 || cause === null) return void 0;
|
|
3681
|
+
if (typeof cause === "string") return cause;
|
|
3682
|
+
if (cause instanceof Error && cause.message.trim()) return cause.message.trim();
|
|
3683
|
+
try {
|
|
3684
|
+
return JSON.stringify(cause);
|
|
3685
|
+
} catch {
|
|
3686
|
+
return String(cause);
|
|
3687
|
+
}
|
|
3688
|
+
}
|
|
3689
|
+
function storageGatewayCode(code) {
|
|
3690
|
+
if (code === "INVALID_URL") return "INVALID_URL";
|
|
3691
|
+
if (code === "NETWORK_ERROR") return "NETWORK_ERROR";
|
|
3692
|
+
if (code === "INVALID_JSON" || code === "INVALID_ATHENA_ENVELOPE") return "INVALID_JSON";
|
|
3693
|
+
if (code === "HTTP_ERROR") return "HTTP_ERROR";
|
|
3694
|
+
return "UNKNOWN_ERROR";
|
|
3695
|
+
}
|
|
3696
|
+
function headerValue(headers, names) {
|
|
3697
|
+
for (const name of names) {
|
|
3698
|
+
const value = headers.get(name);
|
|
3699
|
+
if (value?.trim()) return value.trim();
|
|
3700
|
+
}
|
|
3701
|
+
return void 0;
|
|
3702
|
+
}
|
|
3703
|
+
function storageOperationFromEndpoint(endpoint, method) {
|
|
3704
|
+
const endpointPath = String(endpoint).split("?")[0];
|
|
3705
|
+
for (const candidate of storageSdkManifest.methods) {
|
|
3706
|
+
if (candidate.method !== method) continue;
|
|
3707
|
+
const pattern = `^${candidate.path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\\\{[^/]+\\\}/g, "[^/]+")}$`;
|
|
3708
|
+
if (new RegExp(pattern).test(endpointPath)) {
|
|
3709
|
+
return candidate.name;
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
return `storage:${method.toLowerCase()}`;
|
|
3713
|
+
}
|
|
3714
|
+
function normalizeStorageErrorInput(input) {
|
|
3715
|
+
return normalizeAthenaError(
|
|
3716
|
+
{
|
|
3717
|
+
data: null,
|
|
3718
|
+
error: {
|
|
3719
|
+
message: input.message,
|
|
3720
|
+
gatewayCode: storageGatewayCode(input.code),
|
|
3721
|
+
status: input.status,
|
|
3722
|
+
raw: input.raw ?? input.cause ?? null
|
|
3723
|
+
},
|
|
3724
|
+
errorDetails: {
|
|
3725
|
+
code: storageGatewayCode(input.code),
|
|
3726
|
+
message: input.message,
|
|
3727
|
+
status: input.status,
|
|
3728
|
+
endpoint: input.endpoint,
|
|
3729
|
+
method: input.method,
|
|
3730
|
+
requestId: input.requestId,
|
|
3731
|
+
hint: input.hint,
|
|
3732
|
+
cause: causeToString(input.cause)
|
|
3733
|
+
},
|
|
3734
|
+
raw: input.raw ?? input.cause ?? null,
|
|
3735
|
+
status: input.status
|
|
3736
|
+
},
|
|
3737
|
+
{ operation: storageOperationFromEndpoint(input.endpoint, input.method) }
|
|
3738
|
+
);
|
|
3739
|
+
}
|
|
3740
|
+
function createAthenaStorageError(input) {
|
|
3741
|
+
return new AthenaStorageError(input);
|
|
3742
|
+
}
|
|
3743
|
+
async function notifyStorageError(error, options, runtimeOptions) {
|
|
3744
|
+
const handlers = [runtimeOptions?.onError, options?.onError].filter(
|
|
3745
|
+
(handler) => typeof handler === "function"
|
|
3746
|
+
);
|
|
3747
|
+
for (const handler of handlers) {
|
|
3748
|
+
try {
|
|
3749
|
+
await handler(error);
|
|
3750
|
+
} catch {
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
async function rejectStorageError(input, options, runtimeOptions) {
|
|
3755
|
+
const error = createAthenaStorageError(input);
|
|
3756
|
+
await notifyStorageError(error, options, runtimeOptions);
|
|
3757
|
+
throw error;
|
|
3758
|
+
}
|
|
3759
|
+
function parseResponseBody3(rawText, contentType) {
|
|
3760
|
+
if (!rawText) {
|
|
3761
|
+
return { parsed: null, parseFailed: false };
|
|
3762
|
+
}
|
|
3763
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
3764
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
3765
|
+
if (!looksJson) {
|
|
3766
|
+
return { parsed: rawText, parseFailed: false };
|
|
3767
|
+
}
|
|
3768
|
+
try {
|
|
3769
|
+
return { parsed: JSON.parse(rawText), parseFailed: false };
|
|
3770
|
+
} catch {
|
|
3771
|
+
return { parsed: rawText, parseFailed: true };
|
|
3772
|
+
}
|
|
3773
|
+
}
|
|
3774
|
+
function appendQuery(path, query) {
|
|
3775
|
+
if (!query) return path;
|
|
3776
|
+
const params = new URLSearchParams();
|
|
3777
|
+
for (const [key, value] of Object.entries(query)) {
|
|
3778
|
+
if (value === void 0 || value === null) continue;
|
|
3779
|
+
params.set(key, String(value));
|
|
3780
|
+
}
|
|
3781
|
+
const queryText = params.toString();
|
|
3782
|
+
return queryText ? `${path}?${queryText}` : path;
|
|
3783
|
+
}
|
|
3784
|
+
function storagePath(path) {
|
|
3785
|
+
return path;
|
|
3786
|
+
}
|
|
3787
|
+
function withPathParam(path, name, value) {
|
|
3788
|
+
return path.replace(`{${name}}`, encodeURIComponent(value));
|
|
3789
|
+
}
|
|
3790
|
+
function resolveErrorMessage3(payload, fallback) {
|
|
3791
|
+
if (isRecord5(payload)) {
|
|
3792
|
+
const message = payload.message ?? payload.error ?? payload.details;
|
|
3793
|
+
if (typeof message === "string" && message.trim()) {
|
|
3794
|
+
return message.trim();
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
if (typeof payload === "string" && payload.trim()) {
|
|
3798
|
+
return payload.trim();
|
|
3799
|
+
}
|
|
3800
|
+
return fallback;
|
|
3801
|
+
}
|
|
3802
|
+
function resolveErrorHint2(payload) {
|
|
3803
|
+
if (!isRecord5(payload)) return void 0;
|
|
3804
|
+
const hint = payload.hint ?? payload.suggestion;
|
|
3805
|
+
return typeof hint === "string" && hint.trim() ? hint.trim() : void 0;
|
|
3806
|
+
}
|
|
3807
|
+
function resolveErrorCause(payload) {
|
|
3808
|
+
if (!isRecord5(payload)) return void 0;
|
|
3809
|
+
const cause = payload.cause ?? payload.reason;
|
|
3810
|
+
return typeof cause === "string" && cause.trim() ? cause.trim() : void 0;
|
|
3811
|
+
}
|
|
3812
|
+
function storageCodeFromUnknown(error) {
|
|
3813
|
+
if (isAthenaGatewayError(error)) {
|
|
3814
|
+
if (error.code === "INVALID_URL") return "INVALID_URL";
|
|
3815
|
+
if (error.code === "NETWORK_ERROR") return "NETWORK_ERROR";
|
|
3816
|
+
if (error.code === "INVALID_JSON") return "INVALID_JSON";
|
|
3817
|
+
if (error.code === "HTTP_ERROR") return "HTTP_ERROR";
|
|
3818
|
+
}
|
|
3819
|
+
return "UNKNOWN_ERROR";
|
|
3820
|
+
}
|
|
3821
|
+
async function callStorageEndpoint(gateway, endpoint, method, envelope, payload, options, runtimeOptions) {
|
|
3822
|
+
let url;
|
|
3823
|
+
let headers;
|
|
3824
|
+
try {
|
|
3825
|
+
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
|
|
3826
|
+
url = buildAthenaGatewayUrl(baseUrl, endpoint);
|
|
3827
|
+
headers = gateway.buildHeaders(options);
|
|
3828
|
+
} catch (error) {
|
|
3829
|
+
return rejectStorageError(
|
|
3830
|
+
{
|
|
3831
|
+
code: storageCodeFromUnknown(error),
|
|
3832
|
+
message: error instanceof Error ? error.message : `Athena storage ${method} ${endpoint} failed before sending the request`,
|
|
3833
|
+
status: isAthenaGatewayError(error) ? error.status : 0,
|
|
3834
|
+
endpoint,
|
|
3835
|
+
method,
|
|
3836
|
+
raw: error,
|
|
3837
|
+
requestId: isAthenaGatewayError(error) ? error.requestId : void 0,
|
|
3838
|
+
hint: isAthenaGatewayError(error) ? error.hint : void 0,
|
|
3839
|
+
cause: error
|
|
3840
|
+
},
|
|
3841
|
+
options,
|
|
3842
|
+
runtimeOptions
|
|
3843
|
+
);
|
|
3844
|
+
}
|
|
3845
|
+
const requestInit = {
|
|
3846
|
+
method,
|
|
3847
|
+
headers,
|
|
3848
|
+
signal: options?.signal
|
|
3849
|
+
};
|
|
3850
|
+
if (payload !== void 0 && method !== "GET") {
|
|
3851
|
+
requestInit.body = JSON.stringify(payload);
|
|
3852
|
+
}
|
|
3853
|
+
let response;
|
|
3854
|
+
try {
|
|
3855
|
+
response = await fetch(url, requestInit);
|
|
3856
|
+
} catch (error) {
|
|
3857
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3858
|
+
return rejectStorageError(
|
|
3859
|
+
{
|
|
3860
|
+
code: "NETWORK_ERROR",
|
|
3861
|
+
message: `Network error while calling Athena storage ${method} ${endpoint}: ${message}`,
|
|
3862
|
+
status: 0,
|
|
3863
|
+
endpoint,
|
|
3864
|
+
method,
|
|
3865
|
+
cause: error
|
|
3866
|
+
},
|
|
3867
|
+
options,
|
|
3868
|
+
runtimeOptions
|
|
3869
|
+
);
|
|
3870
|
+
}
|
|
3871
|
+
let rawText;
|
|
3872
|
+
try {
|
|
3873
|
+
rawText = await response.text();
|
|
3874
|
+
} catch (error) {
|
|
3875
|
+
return rejectStorageError(
|
|
3876
|
+
{
|
|
3877
|
+
code: "NETWORK_ERROR",
|
|
3878
|
+
message: `Athena storage ${method} ${endpoint} response body could not be read`,
|
|
3879
|
+
status: response.status,
|
|
3880
|
+
endpoint,
|
|
3881
|
+
method,
|
|
3882
|
+
requestId: headerValue(response.headers, ["x-athena-request-id", "x-request-id", "request-id"]),
|
|
3883
|
+
cause: error
|
|
3884
|
+
},
|
|
3885
|
+
options,
|
|
3886
|
+
runtimeOptions
|
|
3887
|
+
);
|
|
3888
|
+
}
|
|
3889
|
+
const parsedBody = parseResponseBody3(rawText ?? "", response.headers.get("content-type"));
|
|
3890
|
+
const requestId = headerValue(response.headers, ["x-athena-request-id", "x-request-id", "request-id"]);
|
|
3891
|
+
if (parsedBody.parseFailed) {
|
|
3892
|
+
return rejectStorageError(
|
|
3893
|
+
{
|
|
3894
|
+
code: "INVALID_JSON",
|
|
3895
|
+
message: `Athena storage ${method} ${endpoint} returned malformed JSON`,
|
|
3896
|
+
status: response.status,
|
|
3897
|
+
endpoint,
|
|
3898
|
+
method,
|
|
3899
|
+
requestId,
|
|
3900
|
+
raw: parsedBody.parsed
|
|
3901
|
+
},
|
|
3902
|
+
options,
|
|
3903
|
+
runtimeOptions
|
|
3904
|
+
);
|
|
3905
|
+
}
|
|
3906
|
+
if (!response.ok) {
|
|
3907
|
+
return rejectStorageError(
|
|
3908
|
+
{
|
|
3909
|
+
code: "HTTP_ERROR",
|
|
3910
|
+
message: resolveErrorMessage3(
|
|
3911
|
+
parsedBody.parsed,
|
|
3912
|
+
`Athena storage ${method} ${endpoint} failed with status ${response.status}`
|
|
3913
|
+
),
|
|
3914
|
+
status: response.status,
|
|
3915
|
+
endpoint,
|
|
3916
|
+
method,
|
|
3917
|
+
requestId,
|
|
3918
|
+
hint: resolveErrorHint2(parsedBody.parsed),
|
|
3919
|
+
cause: resolveErrorCause(parsedBody.parsed),
|
|
3920
|
+
raw: parsedBody.parsed
|
|
3921
|
+
},
|
|
3922
|
+
options,
|
|
3923
|
+
runtimeOptions
|
|
3924
|
+
);
|
|
3925
|
+
}
|
|
3926
|
+
if (envelope === "athena") {
|
|
3927
|
+
if (!isRecord5(parsedBody.parsed) || !("data" in parsedBody.parsed)) {
|
|
3928
|
+
return rejectStorageError(
|
|
3929
|
+
{
|
|
3930
|
+
code: "INVALID_ATHENA_ENVELOPE",
|
|
3931
|
+
message: `Athena storage ${method} ${endpoint} returned an invalid Athena envelope`,
|
|
3932
|
+
status: response.status,
|
|
3933
|
+
endpoint,
|
|
3934
|
+
method,
|
|
3935
|
+
requestId,
|
|
3936
|
+
raw: parsedBody.parsed
|
|
3937
|
+
},
|
|
3938
|
+
options,
|
|
3939
|
+
runtimeOptions
|
|
3940
|
+
);
|
|
3941
|
+
}
|
|
3942
|
+
return parsedBody.parsed.data;
|
|
3943
|
+
}
|
|
3944
|
+
return parsedBody.parsed;
|
|
3945
|
+
}
|
|
3946
|
+
async function callStorageBinaryEndpoint(gateway, endpoint, method, options, runtimeOptions) {
|
|
3947
|
+
let url;
|
|
3948
|
+
let headers;
|
|
3949
|
+
try {
|
|
3950
|
+
const baseUrl = options?.baseUrl ? normalizeAthenaGatewayBaseUrl(options.baseUrl) : gateway.baseUrl;
|
|
3951
|
+
url = buildAthenaGatewayUrl(baseUrl, endpoint);
|
|
3952
|
+
headers = gateway.buildHeaders(options);
|
|
3953
|
+
} catch (error) {
|
|
3954
|
+
return rejectStorageError(
|
|
3955
|
+
{
|
|
3956
|
+
code: storageCodeFromUnknown(error),
|
|
3957
|
+
message: error instanceof Error ? error.message : `Athena storage ${method} ${endpoint} failed before sending the request`,
|
|
3958
|
+
status: isAthenaGatewayError(error) ? error.status : 0,
|
|
3959
|
+
endpoint,
|
|
3960
|
+
method,
|
|
3961
|
+
raw: error,
|
|
3962
|
+
requestId: isAthenaGatewayError(error) ? error.requestId : void 0,
|
|
3963
|
+
hint: isAthenaGatewayError(error) ? error.hint : void 0,
|
|
3964
|
+
cause: error
|
|
3965
|
+
},
|
|
3966
|
+
options,
|
|
3967
|
+
runtimeOptions
|
|
3968
|
+
);
|
|
3969
|
+
}
|
|
3970
|
+
let response;
|
|
3971
|
+
try {
|
|
3972
|
+
response = await fetch(url, {
|
|
3973
|
+
method,
|
|
3974
|
+
headers,
|
|
3975
|
+
signal: options?.signal
|
|
3976
|
+
});
|
|
3977
|
+
} catch (error) {
|
|
3978
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
3979
|
+
return rejectStorageError(
|
|
3980
|
+
{
|
|
3981
|
+
code: "NETWORK_ERROR",
|
|
3982
|
+
message: `Network error while calling Athena storage ${method} ${endpoint}: ${message}`,
|
|
3983
|
+
status: 0,
|
|
3984
|
+
endpoint,
|
|
3985
|
+
method,
|
|
3986
|
+
cause: error
|
|
3987
|
+
},
|
|
3988
|
+
options,
|
|
3989
|
+
runtimeOptions
|
|
3990
|
+
);
|
|
3991
|
+
}
|
|
3992
|
+
if (response.ok) {
|
|
3993
|
+
return response;
|
|
3994
|
+
}
|
|
3995
|
+
const requestId = headerValue(response.headers, ["x-athena-request-id", "x-request-id", "request-id"]);
|
|
3996
|
+
let rawErrorBody = null;
|
|
3997
|
+
try {
|
|
3998
|
+
const rawText = await response.text();
|
|
3999
|
+
const parsedBody = parseResponseBody3(rawText ?? "", response.headers.get("content-type"));
|
|
4000
|
+
rawErrorBody = parsedBody.parsed;
|
|
4001
|
+
} catch (error) {
|
|
4002
|
+
return rejectStorageError(
|
|
4003
|
+
{
|
|
4004
|
+
code: "NETWORK_ERROR",
|
|
4005
|
+
message: `Athena storage ${method} ${endpoint} error response body could not be read`,
|
|
4006
|
+
status: response.status,
|
|
4007
|
+
endpoint,
|
|
4008
|
+
method,
|
|
4009
|
+
requestId,
|
|
4010
|
+
cause: error
|
|
4011
|
+
},
|
|
4012
|
+
options,
|
|
4013
|
+
runtimeOptions
|
|
4014
|
+
);
|
|
4015
|
+
}
|
|
4016
|
+
return rejectStorageError(
|
|
4017
|
+
{
|
|
4018
|
+
code: "HTTP_ERROR",
|
|
4019
|
+
message: resolveErrorMessage3(
|
|
4020
|
+
rawErrorBody,
|
|
4021
|
+
`Athena storage ${method} ${endpoint} failed with status ${response.status}`
|
|
4022
|
+
),
|
|
4023
|
+
status: response.status,
|
|
4024
|
+
endpoint,
|
|
4025
|
+
method,
|
|
4026
|
+
requestId,
|
|
4027
|
+
hint: resolveErrorHint2(rawErrorBody),
|
|
4028
|
+
cause: resolveErrorCause(rawErrorBody),
|
|
4029
|
+
raw: rawErrorBody
|
|
4030
|
+
},
|
|
4031
|
+
options,
|
|
4032
|
+
runtimeOptions
|
|
4033
|
+
);
|
|
4034
|
+
}
|
|
4035
|
+
function createStorageModule(gateway, runtimeOptions) {
|
|
4036
|
+
return {
|
|
4037
|
+
listStorageCatalogs(options) {
|
|
4038
|
+
return callStorageEndpoint(gateway, storagePath("/storage/catalogs"), "GET", "raw", void 0, options, runtimeOptions);
|
|
4039
|
+
},
|
|
4040
|
+
createStorageCatalog(input, options) {
|
|
4041
|
+
return callStorageEndpoint(gateway, storagePath("/storage/catalogs"), "POST", "raw", input, options, runtimeOptions);
|
|
4042
|
+
},
|
|
4043
|
+
updateStorageCatalog(id, input, options) {
|
|
4044
|
+
return callStorageEndpoint(
|
|
4045
|
+
gateway,
|
|
4046
|
+
storagePath(withPathParam("/storage/catalogs/{id}", "id", id)),
|
|
4047
|
+
"PATCH",
|
|
4048
|
+
"raw",
|
|
4049
|
+
input,
|
|
4050
|
+
options,
|
|
4051
|
+
runtimeOptions
|
|
4052
|
+
);
|
|
4053
|
+
},
|
|
4054
|
+
deleteStorageCatalog(id, options) {
|
|
4055
|
+
return callStorageEndpoint(
|
|
4056
|
+
gateway,
|
|
4057
|
+
storagePath(withPathParam("/storage/catalogs/{id}", "id", id)),
|
|
4058
|
+
"DELETE",
|
|
4059
|
+
"raw",
|
|
4060
|
+
void 0,
|
|
4061
|
+
options,
|
|
4062
|
+
runtimeOptions
|
|
4063
|
+
);
|
|
4064
|
+
},
|
|
4065
|
+
listStorageCredentials(options) {
|
|
4066
|
+
return callStorageEndpoint(gateway, storagePath("/storage/credentials"), "GET", "raw", void 0, options, runtimeOptions);
|
|
4067
|
+
},
|
|
4068
|
+
createStorageUploadUrl(input, options) {
|
|
4069
|
+
return callStorageEndpoint(
|
|
4070
|
+
gateway,
|
|
4071
|
+
storagePath("/storage/files/upload-url"),
|
|
4072
|
+
"POST",
|
|
4073
|
+
"athena",
|
|
4074
|
+
input,
|
|
4075
|
+
options,
|
|
4076
|
+
runtimeOptions
|
|
4077
|
+
);
|
|
4078
|
+
},
|
|
4079
|
+
createStorageUploadUrls(input, options) {
|
|
4080
|
+
return callStorageEndpoint(
|
|
4081
|
+
gateway,
|
|
4082
|
+
storagePath("/storage/files/upload-urls"),
|
|
4083
|
+
"POST",
|
|
4084
|
+
"athena",
|
|
4085
|
+
input,
|
|
4086
|
+
options,
|
|
4087
|
+
runtimeOptions
|
|
4088
|
+
);
|
|
4089
|
+
},
|
|
4090
|
+
listStorageFiles(input, options) {
|
|
4091
|
+
return callStorageEndpoint(gateway, storagePath("/storage/files/list"), "POST", "athena", input, options, runtimeOptions);
|
|
4092
|
+
},
|
|
4093
|
+
getStorageFile(fileId, options) {
|
|
4094
|
+
return callStorageEndpoint(
|
|
4095
|
+
gateway,
|
|
4096
|
+
storagePath(withPathParam("/storage/files/{file_id}", "file_id", fileId)),
|
|
4097
|
+
"GET",
|
|
4098
|
+
"athena",
|
|
4099
|
+
void 0,
|
|
4100
|
+
options,
|
|
4101
|
+
runtimeOptions
|
|
4102
|
+
);
|
|
4103
|
+
},
|
|
4104
|
+
getStorageFileUrl(fileId, query, options) {
|
|
4105
|
+
const path = appendQuery(
|
|
4106
|
+
withPathParam("/storage/files/{file_id}/url", "file_id", fileId),
|
|
4107
|
+
query
|
|
4108
|
+
);
|
|
4109
|
+
return callStorageEndpoint(gateway, storagePath(path), "GET", "athena", void 0, options, runtimeOptions);
|
|
4110
|
+
},
|
|
4111
|
+
getStorageFileProxy(fileId, query, options) {
|
|
4112
|
+
const path = appendQuery(
|
|
4113
|
+
withPathParam("/storage/files/{file_id}/proxy", "file_id", fileId),
|
|
4114
|
+
query
|
|
4115
|
+
);
|
|
4116
|
+
return callStorageBinaryEndpoint(gateway, storagePath(path), "GET", options, runtimeOptions);
|
|
4117
|
+
},
|
|
4118
|
+
updateStorageFile(fileId, input, options) {
|
|
4119
|
+
return callStorageEndpoint(
|
|
4120
|
+
gateway,
|
|
4121
|
+
storagePath(withPathParam("/storage/files/{file_id}", "file_id", fileId)),
|
|
4122
|
+
"PATCH",
|
|
4123
|
+
"athena",
|
|
4124
|
+
input,
|
|
4125
|
+
options,
|
|
4126
|
+
runtimeOptions
|
|
4127
|
+
);
|
|
4128
|
+
},
|
|
4129
|
+
deleteStorageFile(fileId, options) {
|
|
4130
|
+
return callStorageEndpoint(
|
|
4131
|
+
gateway,
|
|
4132
|
+
storagePath(withPathParam("/storage/files/{file_id}", "file_id", fileId)),
|
|
4133
|
+
"DELETE",
|
|
4134
|
+
"athena",
|
|
4135
|
+
void 0,
|
|
4136
|
+
options,
|
|
4137
|
+
runtimeOptions
|
|
4138
|
+
);
|
|
4139
|
+
},
|
|
4140
|
+
setStorageFileVisibility(fileId, input, options) {
|
|
4141
|
+
return callStorageEndpoint(
|
|
4142
|
+
gateway,
|
|
4143
|
+
storagePath(withPathParam("/storage/files/{file_id}/visibility", "file_id", fileId)),
|
|
4144
|
+
"PATCH",
|
|
4145
|
+
"athena",
|
|
4146
|
+
input,
|
|
4147
|
+
options,
|
|
4148
|
+
runtimeOptions
|
|
4149
|
+
);
|
|
4150
|
+
},
|
|
4151
|
+
deleteStorageFolder(input, options) {
|
|
4152
|
+
return callStorageEndpoint(gateway, storagePath("/storage/folders/delete"), "POST", "athena", input, options, runtimeOptions);
|
|
4153
|
+
},
|
|
4154
|
+
moveStorageFolder(input, options) {
|
|
4155
|
+
return callStorageEndpoint(gateway, storagePath("/storage/folders/move"), "POST", "athena", input, options, runtimeOptions);
|
|
4156
|
+
}
|
|
4157
|
+
};
|
|
4158
|
+
}
|
|
4159
|
+
|
|
3482
4160
|
// src/query-ast.ts
|
|
3483
4161
|
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
3484
4162
|
var FILTER_OPERATORS = /* @__PURE__ */ new Set([
|
|
@@ -3506,7 +4184,7 @@ var BOOLEAN_SAFE_OPERATORS = /* @__PURE__ */ new Set([
|
|
|
3506
4184
|
"ilike",
|
|
3507
4185
|
"is"
|
|
3508
4186
|
]);
|
|
3509
|
-
function
|
|
4187
|
+
function isRecord6(value) {
|
|
3510
4188
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3511
4189
|
}
|
|
3512
4190
|
function isUuidString(value) {
|
|
@@ -3519,7 +4197,7 @@ function shouldUseUuidTextComparison(column, value) {
|
|
|
3519
4197
|
return typeof value === "string" && isUuidString(value) && isUuidIdentifierColumn(column);
|
|
3520
4198
|
}
|
|
3521
4199
|
function isRelationSelectNode(value) {
|
|
3522
|
-
return
|
|
4200
|
+
return isRecord6(value) && isRecord6(value.select);
|
|
3523
4201
|
}
|
|
3524
4202
|
function normalizeIdentifier(value, label) {
|
|
3525
4203
|
const normalized = value.trim();
|
|
@@ -3575,7 +4253,7 @@ function compileRelationToken(key, node) {
|
|
|
3575
4253
|
return `${prefix}${relationToken}(${nested})`;
|
|
3576
4254
|
}
|
|
3577
4255
|
function compileSelectShape(select) {
|
|
3578
|
-
if (!
|
|
4256
|
+
if (!isRecord6(select)) {
|
|
3579
4257
|
throw new Error("findMany select must be an object");
|
|
3580
4258
|
}
|
|
3581
4259
|
const tokens = [];
|
|
@@ -3599,7 +4277,7 @@ function compileSelectShape(select) {
|
|
|
3599
4277
|
return tokens.join(",");
|
|
3600
4278
|
}
|
|
3601
4279
|
function selectShapeUsesRelationSchema(select) {
|
|
3602
|
-
if (!
|
|
4280
|
+
if (!isRecord6(select)) {
|
|
3603
4281
|
return false;
|
|
3604
4282
|
}
|
|
3605
4283
|
for (const rawValue of Object.values(select)) {
|
|
@@ -3617,7 +4295,7 @@ function selectShapeUsesRelationSchema(select) {
|
|
|
3617
4295
|
}
|
|
3618
4296
|
function compileColumnWhere(column, input) {
|
|
3619
4297
|
const normalizedColumn = normalizeIdentifier(column, "where column");
|
|
3620
|
-
if (!
|
|
4298
|
+
if (!isRecord6(input)) {
|
|
3621
4299
|
return [buildGatewayCondition("eq", normalizedColumn, input)];
|
|
3622
4300
|
}
|
|
3623
4301
|
const conditions = [];
|
|
@@ -3645,7 +4323,7 @@ function compileColumnWhere(column, input) {
|
|
|
3645
4323
|
return conditions;
|
|
3646
4324
|
}
|
|
3647
4325
|
function compileBooleanExpressionTerms(clause, label) {
|
|
3648
|
-
if (!
|
|
4326
|
+
if (!isRecord6(clause)) {
|
|
3649
4327
|
throw new Error(`findMany where.${label} clauses must be objects`);
|
|
3650
4328
|
}
|
|
3651
4329
|
const entries = Object.entries(clause).filter(([, value]) => value !== void 0);
|
|
@@ -3654,7 +4332,7 @@ function compileBooleanExpressionTerms(clause, label) {
|
|
|
3654
4332
|
}
|
|
3655
4333
|
const [rawColumn, rawValue] = entries[0];
|
|
3656
4334
|
const column = normalizeIdentifier(rawColumn, `where.${label} column`);
|
|
3657
|
-
if (!
|
|
4335
|
+
if (!isRecord6(rawValue)) {
|
|
3658
4336
|
return [`${column}.eq.${stringifyFilterValue(rawValue)}`];
|
|
3659
4337
|
}
|
|
3660
4338
|
const operatorEntries = Object.entries(rawValue).filter(([, value]) => value !== void 0);
|
|
@@ -3678,7 +4356,7 @@ function compileWhere(where) {
|
|
|
3678
4356
|
if (where === void 0) {
|
|
3679
4357
|
return void 0;
|
|
3680
4358
|
}
|
|
3681
|
-
if (!
|
|
4359
|
+
if (!isRecord6(where)) {
|
|
3682
4360
|
throw new Error("findMany where must be an object");
|
|
3683
4361
|
}
|
|
3684
4362
|
const conditions = [];
|
|
@@ -3728,7 +4406,7 @@ function compileOrderBy(orderBy) {
|
|
|
3728
4406
|
if (orderBy === void 0) {
|
|
3729
4407
|
return void 0;
|
|
3730
4408
|
}
|
|
3731
|
-
if (!
|
|
4409
|
+
if (!isRecord6(orderBy)) {
|
|
3732
4410
|
throw new Error("findMany orderBy must be an object");
|
|
3733
4411
|
}
|
|
3734
4412
|
if ("column" in orderBy) {
|
|
@@ -3903,11 +4581,11 @@ function toFindManyAstOrder(order) {
|
|
|
3903
4581
|
ascending: order.direction !== "descending"
|
|
3904
4582
|
};
|
|
3905
4583
|
}
|
|
3906
|
-
function
|
|
4584
|
+
function isRecord7(value) {
|
|
3907
4585
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3908
4586
|
}
|
|
3909
4587
|
function normalizeFindManyAstColumnPredicate(value) {
|
|
3910
|
-
if (!
|
|
4588
|
+
if (!isRecord7(value)) {
|
|
3911
4589
|
return {
|
|
3912
4590
|
eq: value
|
|
3913
4591
|
};
|
|
@@ -3931,7 +4609,7 @@ function normalizeFindManyAstBooleanOperand(clause) {
|
|
|
3931
4609
|
return normalized;
|
|
3932
4610
|
}
|
|
3933
4611
|
function normalizeFindManyAstWhere(where) {
|
|
3934
|
-
if (!where || !
|
|
4612
|
+
if (!where || !isRecord7(where)) {
|
|
3935
4613
|
return where;
|
|
3936
4614
|
}
|
|
3937
4615
|
const normalized = {};
|
|
@@ -3945,7 +4623,7 @@ function normalizeFindManyAstWhere(where) {
|
|
|
3945
4623
|
);
|
|
3946
4624
|
continue;
|
|
3947
4625
|
}
|
|
3948
|
-
if (key === "not" &&
|
|
4626
|
+
if (key === "not" && isRecord7(value)) {
|
|
3949
4627
|
normalized.not = normalizeFindManyAstBooleanOperand(
|
|
3950
4628
|
value
|
|
3951
4629
|
);
|
|
@@ -3956,7 +4634,7 @@ function normalizeFindManyAstWhere(where) {
|
|
|
3956
4634
|
return normalized;
|
|
3957
4635
|
}
|
|
3958
4636
|
function predicateRequiresUuidQueryFallback(column, value) {
|
|
3959
|
-
if (!
|
|
4637
|
+
if (!isRecord7(value)) {
|
|
3960
4638
|
return shouldUseUuidTextComparison(column, value);
|
|
3961
4639
|
}
|
|
3962
4640
|
const eqValue = value.eq;
|
|
@@ -3974,7 +4652,7 @@ function booleanOperandRequiresUuidQueryFallback(clause) {
|
|
|
3974
4652
|
return false;
|
|
3975
4653
|
}
|
|
3976
4654
|
function findManyAstWhereRequiresLegacyTransport(where) {
|
|
3977
|
-
if (!where || !
|
|
4655
|
+
if (!where || !isRecord7(where)) {
|
|
3978
4656
|
return false;
|
|
3979
4657
|
}
|
|
3980
4658
|
for (const [key, value] of Object.entries(where)) {
|
|
@@ -3989,7 +4667,7 @@ function findManyAstWhereRequiresLegacyTransport(where) {
|
|
|
3989
4667
|
}
|
|
3990
4668
|
continue;
|
|
3991
4669
|
}
|
|
3992
|
-
if (key === "not" &&
|
|
4670
|
+
if (key === "not" && isRecord7(value)) {
|
|
3993
4671
|
if (booleanOperandRequiresUuidQueryFallback(value)) {
|
|
3994
4672
|
return true;
|
|
3995
4673
|
}
|
|
@@ -4191,7 +4869,7 @@ async function executeExperimentalRead(experimental, runner) {
|
|
|
4191
4869
|
throw error;
|
|
4192
4870
|
}
|
|
4193
4871
|
}
|
|
4194
|
-
function
|
|
4872
|
+
function isRecord8(value) {
|
|
4195
4873
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4196
4874
|
}
|
|
4197
4875
|
function firstNonEmptyString2(...values) {
|
|
@@ -4203,8 +4881,8 @@ function firstNonEmptyString2(...values) {
|
|
|
4203
4881
|
return void 0;
|
|
4204
4882
|
}
|
|
4205
4883
|
function resolveStructuredErrorPayload2(raw) {
|
|
4206
|
-
if (!
|
|
4207
|
-
return
|
|
4884
|
+
if (!isRecord8(raw)) return null;
|
|
4885
|
+
return isRecord8(raw.error) ? raw.error : raw;
|
|
4208
4886
|
}
|
|
4209
4887
|
function resolveStructuredErrorDetails(payload, message) {
|
|
4210
4888
|
if (!payload || !("details" in payload)) {
|
|
@@ -4220,7 +4898,7 @@ function resolveStructuredErrorDetails(payload, message) {
|
|
|
4220
4898
|
return details;
|
|
4221
4899
|
}
|
|
4222
4900
|
function createResultError(response, result, normalized) {
|
|
4223
|
-
const rawRecord =
|
|
4901
|
+
const rawRecord = isRecord8(response.raw) ? response.raw : null;
|
|
4224
4902
|
const payload = resolveStructuredErrorPayload2(response.raw);
|
|
4225
4903
|
const message = firstNonEmptyString2(
|
|
4226
4904
|
response.error,
|
|
@@ -5683,7 +6361,7 @@ function createClientFromConfig(config) {
|
|
|
5683
6361
|
};
|
|
5684
6362
|
const query = createQueryBuilder(gateway, formatGatewayResult, config.experimental, queryTracer);
|
|
5685
6363
|
const db = createDbModule({ from, rpc, query });
|
|
5686
|
-
|
|
6364
|
+
const sdkClient = {
|
|
5687
6365
|
from,
|
|
5688
6366
|
db,
|
|
5689
6367
|
rpc,
|
|
@@ -5691,6 +6369,14 @@ function createClientFromConfig(config) {
|
|
|
5691
6369
|
verifyConnection: gateway.verifyConnection,
|
|
5692
6370
|
auth: auth.auth
|
|
5693
6371
|
};
|
|
6372
|
+
if (config.experimental?.athenaStorageBackend) {
|
|
6373
|
+
const storageClient = {
|
|
6374
|
+
...sdkClient,
|
|
6375
|
+
storage: createStorageModule(gateway, config.experimental.storage)
|
|
6376
|
+
};
|
|
6377
|
+
return storageClient;
|
|
6378
|
+
}
|
|
6379
|
+
return sdkClient;
|
|
5694
6380
|
}
|
|
5695
6381
|
var DEFAULT_BACKEND = { type: "athena" };
|
|
5696
6382
|
function toBackendConfig(b) {
|