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