@xylex-group/athena 2.1.2 → 2.3.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 +287 -116
- package/dist/browser.cjs +1628 -156
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +14 -14
- package/dist/browser.d.ts +14 -14
- package/dist/browser.js +1625 -156
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1532 -145
- 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 +1533 -146
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +1658 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1656 -168
- package/dist/index.js.map +1 -1
- package/dist/{model-form-2hqmoOUX.d.ts → model-form-BpDXlbxb.d.ts} +97 -2
- package/dist/{model-form-Cy-zaO0u.d.cts → model-form-hoE2jHIi.d.cts} +97 -2
- package/dist/{pipeline-BOPszLsL.d.ts → pipeline-BNIw8pDQ.d.ts} +1 -1
- package/dist/{pipeline-E3FDbs4W.d.cts → pipeline-DNIpEsN8.d.cts} +1 -1
- package/dist/{client-dpAp-NZK.d.cts → react-email-BvyCZnfW.d.cts} +349 -174
- package/dist/{client-BX0NQqOn.d.ts → react-email-qPA1wjFV.d.ts} +349 -174
- package/dist/react.cjs +30 -9
- 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 +30 -9
- package/dist/react.js.map +1 -1
- package/dist/{types-BaBzjwXr.d.cts → types-A5e97acl.d.cts} +2 -1
- package/dist/{types-BaBzjwXr.d.ts → types-A5e97acl.d.ts} +2 -1
- package/dist/{types-CeBPrnGj.d.ts → types-BnD22-vb.d.ts} +1 -1
- package/dist/{types-CpqL-pZx.d.cts → types-bDlr4u7p.d.cts} +1 -1
- package/dist/utils.cjs +153 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +23 -0
- package/dist/utils.d.ts +23 -0
- package/dist/utils.js +146 -0
- package/dist/utils.js.map +1 -0
- package/package.json +75 -17
package/dist/react.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as AthenaGatewayHookConfig, N as AthenaGatewayHookResult } from './types-
|
|
2
|
-
export { O as AthenaDeletePayload, P as AthenaFetchPayload, a as AthenaGatewayCallOptions, b as AthenaGatewayErrorCode, c as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, V as AthenaInsertPayload, d as AthenaJsonArray, e as AthenaJsonObject, f as AthenaJsonPrimitive, g as AthenaJsonValue, h as AthenaRpcCallOptions, i as AthenaRpcFilter, j as AthenaRpcFilterOperator, k as AthenaRpcOrder, l as AthenaRpcPayload, W as AthenaUpdatePayload } from './types-
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { L as AthenaGatewayHookConfig, N as AthenaGatewayHookResult } from './types-A5e97acl.cjs';
|
|
2
|
+
export { O as AthenaDeletePayload, P as AthenaFetchPayload, a as AthenaGatewayCallOptions, b as AthenaGatewayErrorCode, c as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, V as AthenaInsertPayload, d as AthenaJsonArray, e as AthenaJsonObject, f as AthenaJsonPrimitive, g as AthenaJsonValue, h as AthenaRpcCallOptions, i as AthenaRpcFilter, j as AthenaRpcFilterOperator, k as AthenaRpcOrder, l as AthenaRpcPayload, W as AthenaUpdatePayload } from './types-A5e97acl.cjs';
|
|
3
|
+
import { aj as AthenaAuthFetchCompatibleInput, b as AthenaAuthCallOptions, L as AthenaAuthSessionResponse, m as AthenaAuthErrorDetails, H as AthenaAuthResult } from './model-form-hoE2jHIi.cjs';
|
|
4
|
+
export { _ as AthenaGatewayError, a9 as ModelFormAdapter, aa as ModelFormDefaults, ab as ModelFormNullishMode, ac as ModelFormValues, ad as ToModelFormDefaultsOptions, ae as ToModelPayloadOptions, af as createModelFormAdapter, ag as isAthenaGatewayError, ah as toModelFormDefaults, ai as toModelPayload } from './model-form-hoE2jHIi.cjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as AthenaGatewayHookConfig, N as AthenaGatewayHookResult } from './types-
|
|
2
|
-
export { O as AthenaDeletePayload, P as AthenaFetchPayload, a as AthenaGatewayCallOptions, b as AthenaGatewayErrorCode, c as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, V as AthenaInsertPayload, d as AthenaJsonArray, e as AthenaJsonObject, f as AthenaJsonPrimitive, g as AthenaJsonValue, h as AthenaRpcCallOptions, i as AthenaRpcFilter, j as AthenaRpcFilterOperator, k as AthenaRpcOrder, l as AthenaRpcPayload, W as AthenaUpdatePayload } from './types-
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { L as AthenaGatewayHookConfig, N as AthenaGatewayHookResult } from './types-A5e97acl.js';
|
|
2
|
+
export { O as AthenaDeletePayload, P as AthenaFetchPayload, a as AthenaGatewayCallOptions, b as AthenaGatewayErrorCode, c as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, V as AthenaInsertPayload, d as AthenaJsonArray, e as AthenaJsonObject, f as AthenaJsonPrimitive, g as AthenaJsonValue, h as AthenaRpcCallOptions, i as AthenaRpcFilter, j as AthenaRpcFilterOperator, k as AthenaRpcOrder, l as AthenaRpcPayload, W as AthenaUpdatePayload } from './types-A5e97acl.js';
|
|
3
|
+
import { aj as AthenaAuthFetchCompatibleInput, b as AthenaAuthCallOptions, L as AthenaAuthSessionResponse, m as AthenaAuthErrorDetails, H as AthenaAuthResult } from './model-form-BpDXlbxb.js';
|
|
4
|
+
export { _ as AthenaGatewayError, a9 as ModelFormAdapter, aa as ModelFormDefaults, ab as ModelFormNullishMode, ac as ModelFormValues, ad as ToModelFormDefaultsOptions, ae as ToModelPayloadOptions, af as createModelFormAdapter, ag as isAthenaGatewayError, ah as toModelFormDefaults, ai as toModelPayload } from './model-form-BpDXlbxb.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
package/dist/react.js
CHANGED
|
@@ -91,23 +91,39 @@ function normalizeHeaderValue(value) {
|
|
|
91
91
|
function isRecord(value) {
|
|
92
92
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
93
93
|
}
|
|
94
|
+
function nonEmptyString(value) {
|
|
95
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
|
|
96
|
+
}
|
|
97
|
+
function resolveStructuredErrorPayload(payload) {
|
|
98
|
+
if (!isRecord(payload)) return null;
|
|
99
|
+
return isRecord(payload.error) ? payload.error : payload;
|
|
100
|
+
}
|
|
94
101
|
function resolveRequestId(headers) {
|
|
95
102
|
return headers.get("x-request-id") ?? headers.get("x-correlation-id") ?? headers.get("x-athena-request-id") ?? void 0;
|
|
96
103
|
}
|
|
97
104
|
function resolveErrorMessage(payload, fallback) {
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
const structuredPayload = resolveStructuredErrorPayload(payload);
|
|
106
|
+
if (structuredPayload) {
|
|
107
|
+
const messageCandidates = [structuredPayload.message, structuredPayload.error, structuredPayload.details];
|
|
100
108
|
for (const candidate of messageCandidates) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
109
|
+
const resolved = nonEmptyString(candidate);
|
|
110
|
+
if (resolved) return resolved;
|
|
104
111
|
}
|
|
105
112
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
113
|
+
const rawMessage = nonEmptyString(payload);
|
|
114
|
+
if (rawMessage) return rawMessage;
|
|
109
115
|
return fallback;
|
|
110
116
|
}
|
|
117
|
+
function resolveErrorHint(payload) {
|
|
118
|
+
const structuredPayload = resolveStructuredErrorPayload(payload);
|
|
119
|
+
return structuredPayload ? nonEmptyString(structuredPayload.hint) : void 0;
|
|
120
|
+
}
|
|
121
|
+
function resolveStatusText(response, payload) {
|
|
122
|
+
const rawStatusText = nonEmptyString(response.statusText);
|
|
123
|
+
if (rawStatusText) return rawStatusText;
|
|
124
|
+
const payloadRecord = isRecord(payload) ? payload : null;
|
|
125
|
+
return payloadRecord ? nonEmptyString(payloadRecord.statusText) ?? null : null;
|
|
126
|
+
}
|
|
111
127
|
function detailsFromError(error) {
|
|
112
128
|
return error.toDetails();
|
|
113
129
|
}
|
|
@@ -278,6 +294,7 @@ async function callAthena(config, endpoint, method, payload, options) {
|
|
|
278
294
|
return {
|
|
279
295
|
ok: false,
|
|
280
296
|
status: response.status,
|
|
297
|
+
statusText: resolveStatusText(response, parsedBody.parsed),
|
|
281
298
|
data: null,
|
|
282
299
|
error: invalidJsonError.message,
|
|
283
300
|
errorDetails: detailsFromError(invalidJsonError),
|
|
@@ -296,11 +313,13 @@ async function callAthena(config, endpoint, method, payload, options) {
|
|
|
296
313
|
status: response.status,
|
|
297
314
|
endpoint,
|
|
298
315
|
method,
|
|
299
|
-
requestId
|
|
316
|
+
requestId,
|
|
317
|
+
hint: resolveErrorHint(parsed)
|
|
300
318
|
});
|
|
301
319
|
return {
|
|
302
320
|
ok: false,
|
|
303
321
|
status: response.status,
|
|
322
|
+
statusText: resolveStatusText(response, parsed),
|
|
304
323
|
data: null,
|
|
305
324
|
error: httpError.message,
|
|
306
325
|
errorDetails: detailsFromError(httpError),
|
|
@@ -312,6 +331,7 @@ async function callAthena(config, endpoint, method, payload, options) {
|
|
|
312
331
|
return {
|
|
313
332
|
ok: true,
|
|
314
333
|
status: response.status,
|
|
334
|
+
statusText: resolveStatusText(response, parsed),
|
|
315
335
|
data: payloadData ?? null,
|
|
316
336
|
count: payloadCount,
|
|
317
337
|
error: void 0,
|
|
@@ -331,6 +351,7 @@ async function callAthena(config, endpoint, method, payload, options) {
|
|
|
331
351
|
return {
|
|
332
352
|
ok: false,
|
|
333
353
|
status: 0,
|
|
354
|
+
statusText: null,
|
|
334
355
|
data: null,
|
|
335
356
|
error: networkError.message,
|
|
336
357
|
errorDetails: detailsFromError(networkError),
|