@xylex-group/athena 3.0.0 → 3.0.2
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 +24 -10
- package/dist/{athena-auth-url-oLux_57a.d.cts → athena-request-headers-C7Jy-c_D.d.ts} +85 -1
- package/dist/{athena-auth-url-oLux_57a.d.ts → athena-request-headers-DujFFyMU.d.cts} +85 -1
- package/dist/billing.cjs +133 -21
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +41 -1
- package/dist/billing.d.ts +41 -1
- package/dist/billing.js +133 -21
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +138 -45
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +9 -9
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +138 -45
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +130 -45
- 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 +130 -45
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +138 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +138 -45
- package/dist/index.js.map +1 -1
- package/dist/{model-form-BKetpu6Q.d.ts → model-form-Dh0sisdL.d.ts} +1 -1
- package/dist/{model-form-BEfCGB5b.d.cts → model-form-oOAJUVd4.d.cts} +1 -1
- package/dist/{module-CrrSmpML.d.cts → module-CB25egcO.d.cts} +17 -5
- package/dist/{module-8dSMcy0K.d.cts → module-C_ab-MM1.d.cts} +46 -12
- package/dist/{module-8dSMcy0K.d.ts → module-C_ab-MM1.d.ts} +46 -12
- package/dist/{module-Bef_MAPO.d.ts → module-CkUM6v58.d.ts} +17 -5
- package/dist/next/client.cjs +9817 -3
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +26 -1
- package/dist/next/client.d.ts +26 -1
- package/dist/next/client.js +9788 -4
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +10398 -42
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +39 -4
- package/dist/next/server.d.ts +39 -4
- package/dist/next/server.js +10339 -43
- package/dist/next/server.js.map +1 -1
- package/dist/{pipeline-BXFQbsUW.d.ts → pipeline-B8aN2EHe.d.ts} +1 -1
- package/dist/{pipeline-Dfsed4VD.d.cts → pipeline-D4W-Cc-A.d.cts} +1 -1
- package/dist/proxy-request-headers-DGxdoyA0.d.cts +59 -0
- package/dist/proxy-request-headers-m4D2Tduy.d.ts +59 -0
- package/dist/react.cjs +7 -7
- 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 +7 -7
- package/dist/react.js.map +1 -1
- package/dist/social-providers.cjs +15 -11
- package/dist/social-providers.cjs.map +1 -1
- package/dist/social-providers.d.cts +17 -57
- package/dist/social-providers.d.ts +17 -57
- package/dist/social-providers.js +15 -11
- package/dist/social-providers.js.map +1 -1
- package/dist/{types-jClgDy1J.d.ts → types-B75PdABb.d.ts} +1 -1
- package/dist/{types-Z3-rsiM3.d.cts → types-BBm-kEBL.d.cts} +1 -1
- package/dist/{types-CK7cBQbC.d.ts → types-BaAMXCqK.d.ts} +1 -1
- package/dist/{types-kO_Ut5wU.d.cts → types-CgCv5o6R.d.cts} +1 -1
- package/dist/utils.d.cts +4 -142
- package/dist/utils.d.ts +4 -142
- package/dist/{v3-client-G8JMOilK.d.cts → v3-client-CWfZHcKL.d.cts} +37 -21
- package/dist/{v3-client-CuCNy-JJ.d.ts → v3-client-DZp2NEhK.d.ts} +37 -21
- package/package.json +6 -3
package/dist/cli/index.cjs
CHANGED
|
@@ -3222,7 +3222,7 @@ function buildRpcDebugSql(payload) {
|
|
|
3222
3222
|
}
|
|
3223
3223
|
|
|
3224
3224
|
// src/gateway/url.ts
|
|
3225
|
-
var ATHENA_DEFAULT_BASE_URL = "https://athena-
|
|
3225
|
+
var ATHENA_DEFAULT_BASE_URL = "https://mirror2.athena-cluster.com";
|
|
3226
3226
|
function describeReceivedValue(value) {
|
|
3227
3227
|
if (value === void 0) return "undefined";
|
|
3228
3228
|
if (value === null) return "null";
|
|
@@ -3245,14 +3245,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
|
|
|
3245
3245
|
if (candidate === void 0 || candidate === null) {
|
|
3246
3246
|
throw invalidBaseUrlError(
|
|
3247
3247
|
`${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
|
|
3248
|
-
'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://
|
|
3248
|
+
'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
|
|
3249
3249
|
);
|
|
3250
3250
|
}
|
|
3251
3251
|
const trimmed = candidate.trim();
|
|
3252
3252
|
if (!trimmed) {
|
|
3253
3253
|
throw invalidBaseUrlError(
|
|
3254
3254
|
`${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
|
|
3255
|
-
'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://
|
|
3255
|
+
'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
|
|
3256
3256
|
);
|
|
3257
3257
|
}
|
|
3258
3258
|
let parsed;
|
|
@@ -3261,13 +3261,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
|
|
|
3261
3261
|
} catch {
|
|
3262
3262
|
throw invalidBaseUrlError(
|
|
3263
3263
|
`${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
|
|
3264
|
-
'Use a full URL including the protocol, for example "https://
|
|
3264
|
+
'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
|
|
3265
3265
|
);
|
|
3266
3266
|
}
|
|
3267
3267
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
3268
3268
|
throw invalidBaseUrlError(
|
|
3269
3269
|
`${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
|
|
3270
|
-
'Use an Athena gateway URL such as "https://
|
|
3270
|
+
'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
|
|
3271
3271
|
);
|
|
3272
3272
|
}
|
|
3273
3273
|
if (parsed.search || parsed.hash) {
|
|
@@ -3290,7 +3290,7 @@ function buildAthenaGatewayUrl(baseUrl, path) {
|
|
|
3290
3290
|
|
|
3291
3291
|
// package.json
|
|
3292
3292
|
var package_default = {
|
|
3293
|
-
version: "3.0.
|
|
3293
|
+
version: "3.0.2"
|
|
3294
3294
|
};
|
|
3295
3295
|
|
|
3296
3296
|
// src/sdk-version.ts
|
|
@@ -3700,7 +3700,7 @@ function createAthenaRequest(config, resolveContext) {
|
|
|
3700
3700
|
}
|
|
3701
3701
|
|
|
3702
3702
|
// src/gateway/client.ts
|
|
3703
|
-
var DEFAULT_CLIENT = "
|
|
3703
|
+
var DEFAULT_CLIENT = "DEFAULT_CLIENT";
|
|
3704
3704
|
var SDK_NAME2 = "xylex-group/athena";
|
|
3705
3705
|
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME2);
|
|
3706
3706
|
function parseResponseBody(rawText, contentType) {
|
|
@@ -10528,6 +10528,25 @@ function createBillingModule(config) {
|
|
|
10528
10528
|
createCheckout(body, options) {
|
|
10529
10529
|
return call("POST", "/billing/v1/checkouts", body, options);
|
|
10530
10530
|
},
|
|
10531
|
+
listProducts(input, options) {
|
|
10532
|
+
return call(
|
|
10533
|
+
"GET",
|
|
10534
|
+
appendQuery3("/billing/v1/products", connectionQuery(input)),
|
|
10535
|
+
void 0,
|
|
10536
|
+
options
|
|
10537
|
+
);
|
|
10538
|
+
},
|
|
10539
|
+
listPrices(input, options) {
|
|
10540
|
+
return call(
|
|
10541
|
+
"GET",
|
|
10542
|
+
appendQuery3("/billing/v1/prices", {
|
|
10543
|
+
...connectionQuery(input),
|
|
10544
|
+
...input.productId ? { productId: input.productId } : {}
|
|
10545
|
+
}),
|
|
10546
|
+
void 0,
|
|
10547
|
+
options
|
|
10548
|
+
);
|
|
10549
|
+
},
|
|
10531
10550
|
listCustomers(input, options) {
|
|
10532
10551
|
return call(
|
|
10533
10552
|
"GET",
|
|
@@ -10674,10 +10693,7 @@ function createBillingModule(config) {
|
|
|
10674
10693
|
getRefund(id, input, options) {
|
|
10675
10694
|
return call(
|
|
10676
10695
|
"GET",
|
|
10677
|
-
appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id),
|
|
10678
|
-
...connectionQuery(input),
|
|
10679
|
-
...input.paymentId ? { paymentId: input.paymentId } : {}
|
|
10680
|
-
}),
|
|
10696
|
+
appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), connectionQuery(input)),
|
|
10681
10697
|
void 0,
|
|
10682
10698
|
options
|
|
10683
10699
|
);
|
|
@@ -10685,10 +10701,7 @@ function createBillingModule(config) {
|
|
|
10685
10701
|
cancelRefund(id, input, options) {
|
|
10686
10702
|
return call(
|
|
10687
10703
|
"POST",
|
|
10688
|
-
appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id),
|
|
10689
|
-
...connectionQuery(input),
|
|
10690
|
-
...input.paymentId ? { paymentId: input.paymentId } : {}
|
|
10691
|
-
}),
|
|
10704
|
+
appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), connectionQuery(input)),
|
|
10692
10705
|
{},
|
|
10693
10706
|
options
|
|
10694
10707
|
);
|
|
@@ -10707,10 +10720,10 @@ function createBillingModule(config) {
|
|
|
10707
10720
|
getSubscription(id, input, options) {
|
|
10708
10721
|
return call(
|
|
10709
10722
|
"GET",
|
|
10710
|
-
appendQuery3(
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10723
|
+
appendQuery3(
|
|
10724
|
+
withPathParam2("/billing/v1/subscriptions/{id}", "id", id),
|
|
10725
|
+
connectionQuery(input)
|
|
10726
|
+
),
|
|
10714
10727
|
void 0,
|
|
10715
10728
|
options
|
|
10716
10729
|
);
|
|
@@ -10726,10 +10739,10 @@ function createBillingModule(config) {
|
|
|
10726
10739
|
cancelSubscription(id, input, options) {
|
|
10727
10740
|
return call(
|
|
10728
10741
|
"POST",
|
|
10729
|
-
appendQuery3(
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10742
|
+
appendQuery3(
|
|
10743
|
+
withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id),
|
|
10744
|
+
connectionQuery(input)
|
|
10745
|
+
),
|
|
10733
10746
|
{},
|
|
10734
10747
|
options
|
|
10735
10748
|
);
|
|
@@ -10753,6 +10766,57 @@ function createBillingModule(config) {
|
|
|
10753
10766
|
options
|
|
10754
10767
|
);
|
|
10755
10768
|
},
|
|
10769
|
+
listWebhooks(input, options) {
|
|
10770
|
+
return call(
|
|
10771
|
+
"GET",
|
|
10772
|
+
appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
|
|
10773
|
+
void 0,
|
|
10774
|
+
options
|
|
10775
|
+
);
|
|
10776
|
+
},
|
|
10777
|
+
createWebhook(input, body, options) {
|
|
10778
|
+
return call(
|
|
10779
|
+
"POST",
|
|
10780
|
+
appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
|
|
10781
|
+
body,
|
|
10782
|
+
options
|
|
10783
|
+
);
|
|
10784
|
+
},
|
|
10785
|
+
getWebhook(id, input, options) {
|
|
10786
|
+
return call(
|
|
10787
|
+
"GET",
|
|
10788
|
+
appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
|
|
10789
|
+
void 0,
|
|
10790
|
+
options
|
|
10791
|
+
);
|
|
10792
|
+
},
|
|
10793
|
+
updateWebhook(id, input, body, options) {
|
|
10794
|
+
return call(
|
|
10795
|
+
"PATCH",
|
|
10796
|
+
appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
|
|
10797
|
+
body,
|
|
10798
|
+
options
|
|
10799
|
+
);
|
|
10800
|
+
},
|
|
10801
|
+
deleteWebhook(id, input, options) {
|
|
10802
|
+
return call(
|
|
10803
|
+
"DELETE",
|
|
10804
|
+
appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
|
|
10805
|
+
void 0,
|
|
10806
|
+
options
|
|
10807
|
+
);
|
|
10808
|
+
},
|
|
10809
|
+
testWebhook(id, input, options) {
|
|
10810
|
+
return call(
|
|
10811
|
+
"POST",
|
|
10812
|
+
appendQuery3(
|
|
10813
|
+
withPathParam2("/billing/v1/webhooks/{id}/test", "id", id),
|
|
10814
|
+
connectionQuery(input)
|
|
10815
|
+
),
|
|
10816
|
+
{},
|
|
10817
|
+
options
|
|
10818
|
+
);
|
|
10819
|
+
},
|
|
10756
10820
|
listConnections(clientName, options) {
|
|
10757
10821
|
return call(
|
|
10758
10822
|
"GET",
|
|
@@ -10930,6 +10994,31 @@ function createBillingModule(config) {
|
|
|
10930
10994
|
};
|
|
10931
10995
|
}
|
|
10932
10996
|
|
|
10997
|
+
// src/config/errors.ts
|
|
10998
|
+
var AthenaConfigurationError = class extends Error {
|
|
10999
|
+
code;
|
|
11000
|
+
service;
|
|
11001
|
+
constructor(code, message, service) {
|
|
11002
|
+
super(message);
|
|
11003
|
+
this.name = "AthenaConfigurationError";
|
|
11004
|
+
this.code = code;
|
|
11005
|
+
this.service = service;
|
|
11006
|
+
}
|
|
11007
|
+
};
|
|
11008
|
+
|
|
11009
|
+
// src/context/merge.ts
|
|
11010
|
+
function mergeAthenaRequestContexts(base, override) {
|
|
11011
|
+
if (!base && !override) return void 0;
|
|
11012
|
+
return {
|
|
11013
|
+
...base,
|
|
11014
|
+
...override,
|
|
11015
|
+
headers: base?.headers || override?.headers ? {
|
|
11016
|
+
...base?.headers ?? {},
|
|
11017
|
+
...override?.headers ?? {}
|
|
11018
|
+
} : void 0
|
|
11019
|
+
};
|
|
11020
|
+
}
|
|
11021
|
+
|
|
10933
11022
|
// src/v3-client.ts
|
|
10934
11023
|
var ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
|
|
10935
11024
|
var ENV_DB_URL_KEYS = ["ATHENA_DB_URL", "ATHENA_GATEWAY_URL", "NEXT_PUBLIC_ATHENA_DB_API_URL"];
|
|
@@ -10940,15 +11029,6 @@ var ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_UR
|
|
|
10940
11029
|
var ENV_KEY_KEYS = ["ATHENA_API_KEY", "NEXT_PUBLIC_ATHENA_API_KEY", "ATHENA_GATEWAY_API_KEY", "X_API_KEY"];
|
|
10941
11030
|
var ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
|
|
10942
11031
|
var MISSING_DB_SENTINEL = "https://athena.invalid/db";
|
|
10943
|
-
var AthenaConfigurationError = class extends Error {
|
|
10944
|
-
code = "ATHENA_SERVICE_NOT_CONFIGURED";
|
|
10945
|
-
service;
|
|
10946
|
-
constructor(service, message = `Athena ${service} is not configured.`) {
|
|
10947
|
-
super(message);
|
|
10948
|
-
this.name = "AthenaConfigurationError";
|
|
10949
|
-
this.service = service;
|
|
10950
|
-
}
|
|
10951
|
-
};
|
|
10952
11032
|
function readFirstEnv(env, keys) {
|
|
10953
11033
|
for (const key of keys) {
|
|
10954
11034
|
const value = env?.[key]?.trim();
|
|
@@ -10989,11 +11069,18 @@ function resolveCore(config) {
|
|
|
10989
11069
|
chatWs: normalizeOptional(config.chat?.wsUrl) ?? (explicitRootWinsOverEnvServices && root ? toWebSocketUrl(root) : void 0) ?? readFirstEnv(env, ENV_CHAT_WS_URL_KEYS) ?? (root ? toWebSocketUrl(root) : void 0)
|
|
10990
11070
|
};
|
|
10991
11071
|
if (!urls.db && !urls.auth && !urls.chat && !urls.storage && !urls.billing) {
|
|
10992
|
-
throw new AthenaConfigurationError(
|
|
11072
|
+
throw new AthenaConfigurationError(
|
|
11073
|
+
"ATHENA_NO_SERVICE_CONFIGURED",
|
|
11074
|
+
"Athena requires a unified URL or at least one configured service URL.",
|
|
11075
|
+
"db"
|
|
11076
|
+
);
|
|
10993
11077
|
}
|
|
10994
11078
|
const key = normalizeOptional(config.key) ?? readFirstEnv(env, ENV_KEY_KEYS);
|
|
10995
11079
|
if (!key) {
|
|
10996
|
-
throw new
|
|
11080
|
+
throw new AthenaConfigurationError(
|
|
11081
|
+
"ATHENA_API_KEY_REQUIRED",
|
|
11082
|
+
"Athena API key is required. Pass key or provide it through the explicit env object."
|
|
11083
|
+
);
|
|
10997
11084
|
}
|
|
10998
11085
|
const base = {
|
|
10999
11086
|
config,
|
|
@@ -11006,18 +11093,10 @@ function resolveCore(config) {
|
|
|
11006
11093
|
internalCore: createInternalClientCore(createInternalConfig(base))
|
|
11007
11094
|
};
|
|
11008
11095
|
}
|
|
11009
|
-
function mergeContexts(base, override) {
|
|
11010
|
-
if (!base && !override) return void 0;
|
|
11011
|
-
return {
|
|
11012
|
-
...base,
|
|
11013
|
-
...override,
|
|
11014
|
-
headers: base?.headers || override?.headers ? { ...base?.headers ?? {}, ...override?.headers ?? {} } : void 0
|
|
11015
|
-
};
|
|
11016
|
-
}
|
|
11017
11096
|
async function resolveConfiguredContext(core, viewContext) {
|
|
11018
11097
|
const configured = core.config.context;
|
|
11019
11098
|
const base = typeof configured === "function" ? await configured() : configured;
|
|
11020
|
-
return
|
|
11099
|
+
return mergeAthenaRequestContexts(base, viewContext);
|
|
11021
11100
|
}
|
|
11022
11101
|
function createInternalConfig(core) {
|
|
11023
11102
|
const { config, urls } = core;
|
|
@@ -11050,7 +11129,13 @@ function createInternalConfig(core) {
|
|
|
11050
11129
|
};
|
|
11051
11130
|
}
|
|
11052
11131
|
function serviceGuard(urls, service) {
|
|
11053
|
-
if (!urls[service])
|
|
11132
|
+
if (!urls[service]) {
|
|
11133
|
+
throw new AthenaConfigurationError(
|
|
11134
|
+
"ATHENA_SERVICE_NOT_CONFIGURED",
|
|
11135
|
+
`Athena ${service} is not configured.`,
|
|
11136
|
+
service
|
|
11137
|
+
);
|
|
11138
|
+
}
|
|
11054
11139
|
}
|
|
11055
11140
|
function createUnavailableNamespace(service, urls, path = []) {
|
|
11056
11141
|
return new Proxy(() => void 0, {
|
|
@@ -11109,7 +11194,7 @@ function createClientView(core, viewContext) {
|
|
|
11109
11194
|
return resolved.verifyConnection(options);
|
|
11110
11195
|
},
|
|
11111
11196
|
withContext(context) {
|
|
11112
|
-
return createClientView(core,
|
|
11197
|
+
return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
|
|
11113
11198
|
}
|
|
11114
11199
|
};
|
|
11115
11200
|
return Object.freeze(client);
|