@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.
Files changed (70) hide show
  1. package/README.md +24 -10
  2. package/dist/{athena-auth-url-oLux_57a.d.cts → athena-request-headers-C7Jy-c_D.d.ts} +85 -1
  3. package/dist/{athena-auth-url-oLux_57a.d.ts → athena-request-headers-DujFFyMU.d.cts} +85 -1
  4. package/dist/billing.cjs +133 -21
  5. package/dist/billing.cjs.map +1 -1
  6. package/dist/billing.d.cts +41 -1
  7. package/dist/billing.d.ts +41 -1
  8. package/dist/billing.js +133 -21
  9. package/dist/billing.js.map +1 -1
  10. package/dist/browser.cjs +138 -45
  11. package/dist/browser.cjs.map +1 -1
  12. package/dist/browser.d.cts +9 -9
  13. package/dist/browser.d.ts +9 -9
  14. package/dist/browser.js +138 -45
  15. package/dist/browser.js.map +1 -1
  16. package/dist/cli/index.cjs +130 -45
  17. package/dist/cli/index.cjs.map +1 -1
  18. package/dist/cli/index.d.cts +3 -3
  19. package/dist/cli/index.d.ts +3 -3
  20. package/dist/cli/index.js +130 -45
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/index.cjs +138 -45
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +9 -9
  25. package/dist/index.d.ts +9 -9
  26. package/dist/index.js +138 -45
  27. package/dist/index.js.map +1 -1
  28. package/dist/{model-form-BKetpu6Q.d.ts → model-form-Dh0sisdL.d.ts} +1 -1
  29. package/dist/{model-form-BEfCGB5b.d.cts → model-form-oOAJUVd4.d.cts} +1 -1
  30. package/dist/{module-CrrSmpML.d.cts → module-CB25egcO.d.cts} +17 -5
  31. package/dist/{module-8dSMcy0K.d.cts → module-C_ab-MM1.d.cts} +46 -12
  32. package/dist/{module-8dSMcy0K.d.ts → module-C_ab-MM1.d.ts} +46 -12
  33. package/dist/{module-Bef_MAPO.d.ts → module-CkUM6v58.d.ts} +17 -5
  34. package/dist/next/client.cjs +9817 -3
  35. package/dist/next/client.cjs.map +1 -1
  36. package/dist/next/client.d.cts +26 -1
  37. package/dist/next/client.d.ts +26 -1
  38. package/dist/next/client.js +9788 -4
  39. package/dist/next/client.js.map +1 -1
  40. package/dist/next/server.cjs +10398 -42
  41. package/dist/next/server.cjs.map +1 -1
  42. package/dist/next/server.d.cts +39 -4
  43. package/dist/next/server.d.ts +39 -4
  44. package/dist/next/server.js +10339 -43
  45. package/dist/next/server.js.map +1 -1
  46. package/dist/{pipeline-BXFQbsUW.d.ts → pipeline-B8aN2EHe.d.ts} +1 -1
  47. package/dist/{pipeline-Dfsed4VD.d.cts → pipeline-D4W-Cc-A.d.cts} +1 -1
  48. package/dist/proxy-request-headers-DGxdoyA0.d.cts +59 -0
  49. package/dist/proxy-request-headers-m4D2Tduy.d.ts +59 -0
  50. package/dist/react.cjs +7 -7
  51. package/dist/react.cjs.map +1 -1
  52. package/dist/react.d.cts +4 -4
  53. package/dist/react.d.ts +4 -4
  54. package/dist/react.js +7 -7
  55. package/dist/react.js.map +1 -1
  56. package/dist/social-providers.cjs +15 -11
  57. package/dist/social-providers.cjs.map +1 -1
  58. package/dist/social-providers.d.cts +17 -57
  59. package/dist/social-providers.d.ts +17 -57
  60. package/dist/social-providers.js +15 -11
  61. package/dist/social-providers.js.map +1 -1
  62. package/dist/{types-jClgDy1J.d.ts → types-B75PdABb.d.ts} +1 -1
  63. package/dist/{types-Z3-rsiM3.d.cts → types-BBm-kEBL.d.cts} +1 -1
  64. package/dist/{types-CK7cBQbC.d.ts → types-BaAMXCqK.d.ts} +1 -1
  65. package/dist/{types-kO_Ut5wU.d.cts → types-CgCv5o6R.d.cts} +1 -1
  66. package/dist/utils.d.cts +4 -142
  67. package/dist/utils.d.ts +4 -142
  68. package/dist/{v3-client-G8JMOilK.d.cts → v3-client-CWfZHcKL.d.cts} +37 -21
  69. package/dist/{v3-client-CuCNy-JJ.d.ts → v3-client-DZp2NEhK.d.ts} +37 -21
  70. package/package.json +6 -3
package/dist/index.cjs CHANGED
@@ -1941,7 +1941,7 @@ function buildRpcDebugSql(payload) {
1941
1941
  }
1942
1942
 
1943
1943
  // src/gateway/url.ts
1944
- var ATHENA_DEFAULT_BASE_URL = "https://athena-db.com";
1944
+ var ATHENA_DEFAULT_BASE_URL = "https://mirror2.athena-cluster.com";
1945
1945
  function describeReceivedValue(value) {
1946
1946
  if (value === void 0) return "undefined";
1947
1947
  if (value === null) return "null";
@@ -1964,14 +1964,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
1964
1964
  if (candidate === void 0 || candidate === null) {
1965
1965
  throw invalidBaseUrlError(
1966
1966
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
1967
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
1967
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
1968
1968
  );
1969
1969
  }
1970
1970
  const trimmed = candidate.trim();
1971
1971
  if (!trimmed) {
1972
1972
  throw invalidBaseUrlError(
1973
1973
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
1974
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
1974
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
1975
1975
  );
1976
1976
  }
1977
1977
  let parsed;
@@ -1980,13 +1980,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
1980
1980
  } catch {
1981
1981
  throw invalidBaseUrlError(
1982
1982
  `${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
1983
- 'Use a full URL including the protocol, for example "https://mirror3.athena-db.com".'
1983
+ 'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
1984
1984
  );
1985
1985
  }
1986
1986
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
1987
1987
  throw invalidBaseUrlError(
1988
1988
  `${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
1989
- 'Use an Athena gateway URL such as "https://mirror3.athena-db.com".'
1989
+ 'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
1990
1990
  );
1991
1991
  }
1992
1992
  if (parsed.search || parsed.hash) {
@@ -2009,7 +2009,7 @@ function buildAthenaGatewayUrl(baseUrl, path) {
2009
2009
 
2010
2010
  // package.json
2011
2011
  var package_default = {
2012
- version: "3.0.0"
2012
+ version: "3.0.2"
2013
2013
  };
2014
2014
 
2015
2015
  // src/sdk-version.ts
@@ -3057,7 +3057,7 @@ function createAthenaRequest(config, resolveContext) {
3057
3057
  }
3058
3058
 
3059
3059
  // src/gateway/client.ts
3060
- var DEFAULT_CLIENT = "railway_direct";
3060
+ var DEFAULT_CLIENT = "DEFAULT_CLIENT";
3061
3061
  var SDK_NAME2 = "xylex-group/athena";
3062
3062
  var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME2);
3063
3063
  function parseResponseBody(rawText, contentType) {
@@ -9886,6 +9886,8 @@ var billingSdkManifest = {
9886
9886
  methods: [
9887
9887
  { name: "getCapabilities", method: "GET", path: "/billing/v1/capabilities" },
9888
9888
  { name: "createCheckout", method: "POST", path: "/billing/v1/checkouts" },
9889
+ { name: "listProducts", method: "GET", path: "/billing/v1/products" },
9890
+ { name: "listPrices", method: "GET", path: "/billing/v1/prices" },
9889
9891
  { name: "listCustomers", method: "GET", path: "/billing/v1/customers" },
9890
9892
  { name: "createCustomer", method: "POST", path: "/billing/v1/customers" },
9891
9893
  { name: "getCustomer", method: "GET", path: "/billing/v1/customers/{id}" },
@@ -9911,6 +9913,12 @@ var billingSdkManifest = {
9911
9913
  { name: "cancelSubscription", method: "POST", path: "/billing/v1/subscriptions/{id}/cancel" },
9912
9914
  { name: "listInvoices", method: "GET", path: "/billing/v1/invoices" },
9913
9915
  { name: "getInvoice", method: "GET", path: "/billing/v1/invoices/{id}" },
9916
+ { name: "listWebhooks", method: "GET", path: "/billing/v1/webhooks" },
9917
+ { name: "createWebhook", method: "POST", path: "/billing/v1/webhooks" },
9918
+ { name: "getWebhook", method: "GET", path: "/billing/v1/webhooks/{id}" },
9919
+ { name: "updateWebhook", method: "PATCH", path: "/billing/v1/webhooks/{id}" },
9920
+ { name: "deleteWebhook", method: "DELETE", path: "/billing/v1/webhooks/{id}" },
9921
+ { name: "testWebhook", method: "POST", path: "/billing/v1/webhooks/{id}/test" },
9914
9922
  {
9915
9923
  name: "listConnections",
9916
9924
  method: "GET",
@@ -10079,6 +10087,25 @@ function createBillingModule(config) {
10079
10087
  createCheckout(body, options) {
10080
10088
  return call("POST", "/billing/v1/checkouts", body, options);
10081
10089
  },
10090
+ listProducts(input, options) {
10091
+ return call(
10092
+ "GET",
10093
+ appendQuery3("/billing/v1/products", connectionQuery(input)),
10094
+ void 0,
10095
+ options
10096
+ );
10097
+ },
10098
+ listPrices(input, options) {
10099
+ return call(
10100
+ "GET",
10101
+ appendQuery3("/billing/v1/prices", {
10102
+ ...connectionQuery(input),
10103
+ ...input.productId ? { productId: input.productId } : {}
10104
+ }),
10105
+ void 0,
10106
+ options
10107
+ );
10108
+ },
10082
10109
  listCustomers(input, options) {
10083
10110
  return call(
10084
10111
  "GET",
@@ -10225,10 +10252,7 @@ function createBillingModule(config) {
10225
10252
  getRefund(id, input, options) {
10226
10253
  return call(
10227
10254
  "GET",
10228
- appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), {
10229
- ...connectionQuery(input),
10230
- ...input.paymentId ? { paymentId: input.paymentId } : {}
10231
- }),
10255
+ appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), connectionQuery(input)),
10232
10256
  void 0,
10233
10257
  options
10234
10258
  );
@@ -10236,10 +10260,7 @@ function createBillingModule(config) {
10236
10260
  cancelRefund(id, input, options) {
10237
10261
  return call(
10238
10262
  "POST",
10239
- appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), {
10240
- ...connectionQuery(input),
10241
- ...input.paymentId ? { paymentId: input.paymentId } : {}
10242
- }),
10263
+ appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), connectionQuery(input)),
10243
10264
  {},
10244
10265
  options
10245
10266
  );
@@ -10258,10 +10279,10 @@ function createBillingModule(config) {
10258
10279
  getSubscription(id, input, options) {
10259
10280
  return call(
10260
10281
  "GET",
10261
- appendQuery3(withPathParam2("/billing/v1/subscriptions/{id}", "id", id), {
10262
- ...connectionQuery(input),
10263
- ...input.customerId ? { customerId: input.customerId } : {}
10264
- }),
10282
+ appendQuery3(
10283
+ withPathParam2("/billing/v1/subscriptions/{id}", "id", id),
10284
+ connectionQuery(input)
10285
+ ),
10265
10286
  void 0,
10266
10287
  options
10267
10288
  );
@@ -10277,10 +10298,10 @@ function createBillingModule(config) {
10277
10298
  cancelSubscription(id, input, options) {
10278
10299
  return call(
10279
10300
  "POST",
10280
- appendQuery3(withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id), {
10281
- ...connectionQuery(input),
10282
- customerId: input.customerId
10283
- }),
10301
+ appendQuery3(
10302
+ withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id),
10303
+ connectionQuery(input)
10304
+ ),
10284
10305
  {},
10285
10306
  options
10286
10307
  );
@@ -10304,6 +10325,57 @@ function createBillingModule(config) {
10304
10325
  options
10305
10326
  );
10306
10327
  },
10328
+ listWebhooks(input, options) {
10329
+ return call(
10330
+ "GET",
10331
+ appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
10332
+ void 0,
10333
+ options
10334
+ );
10335
+ },
10336
+ createWebhook(input, body, options) {
10337
+ return call(
10338
+ "POST",
10339
+ appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
10340
+ body,
10341
+ options
10342
+ );
10343
+ },
10344
+ getWebhook(id, input, options) {
10345
+ return call(
10346
+ "GET",
10347
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10348
+ void 0,
10349
+ options
10350
+ );
10351
+ },
10352
+ updateWebhook(id, input, body, options) {
10353
+ return call(
10354
+ "PATCH",
10355
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10356
+ body,
10357
+ options
10358
+ );
10359
+ },
10360
+ deleteWebhook(id, input, options) {
10361
+ return call(
10362
+ "DELETE",
10363
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10364
+ void 0,
10365
+ options
10366
+ );
10367
+ },
10368
+ testWebhook(id, input, options) {
10369
+ return call(
10370
+ "POST",
10371
+ appendQuery3(
10372
+ withPathParam2("/billing/v1/webhooks/{id}/test", "id", id),
10373
+ connectionQuery(input)
10374
+ ),
10375
+ {},
10376
+ options
10377
+ );
10378
+ },
10307
10379
  listConnections(clientName, options) {
10308
10380
  return call(
10309
10381
  "GET",
@@ -10481,6 +10553,31 @@ function createBillingModule(config) {
10481
10553
  };
10482
10554
  }
10483
10555
 
10556
+ // src/config/errors.ts
10557
+ var AthenaConfigurationError = class extends Error {
10558
+ code;
10559
+ service;
10560
+ constructor(code, message, service) {
10561
+ super(message);
10562
+ this.name = "AthenaConfigurationError";
10563
+ this.code = code;
10564
+ this.service = service;
10565
+ }
10566
+ };
10567
+
10568
+ // src/context/merge.ts
10569
+ function mergeAthenaRequestContexts(base, override) {
10570
+ if (!base && !override) return void 0;
10571
+ return {
10572
+ ...base,
10573
+ ...override,
10574
+ headers: base?.headers || override?.headers ? {
10575
+ ...base?.headers ?? {},
10576
+ ...override?.headers ?? {}
10577
+ } : void 0
10578
+ };
10579
+ }
10580
+
10484
10581
  // src/v3-client.ts
10485
10582
  var ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
10486
10583
  var ENV_DB_URL_KEYS = ["ATHENA_DB_URL", "ATHENA_GATEWAY_URL", "NEXT_PUBLIC_ATHENA_DB_API_URL"];
@@ -10491,15 +10588,6 @@ var ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_UR
10491
10588
  var ENV_KEY_KEYS = ["ATHENA_API_KEY", "NEXT_PUBLIC_ATHENA_API_KEY", "ATHENA_GATEWAY_API_KEY", "X_API_KEY"];
10492
10589
  var ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
10493
10590
  var MISSING_DB_SENTINEL = "https://athena.invalid/db";
10494
- var AthenaConfigurationError = class extends Error {
10495
- code = "ATHENA_SERVICE_NOT_CONFIGURED";
10496
- service;
10497
- constructor(service, message = `Athena ${service} is not configured.`) {
10498
- super(message);
10499
- this.name = "AthenaConfigurationError";
10500
- this.service = service;
10501
- }
10502
- };
10503
10591
  function readFirstEnv(env, keys) {
10504
10592
  for (const key of keys) {
10505
10593
  const value = env?.[key]?.trim();
@@ -10540,11 +10628,18 @@ function resolveCore(config) {
10540
10628
  chatWs: normalizeOptional(config.chat?.wsUrl) ?? (explicitRootWinsOverEnvServices && root ? toWebSocketUrl(root) : void 0) ?? readFirstEnv(env, ENV_CHAT_WS_URL_KEYS) ?? (root ? toWebSocketUrl(root) : void 0)
10541
10629
  };
10542
10630
  if (!urls.db && !urls.auth && !urls.chat && !urls.storage && !urls.billing) {
10543
- throw new AthenaConfigurationError("db", "Athena requires a unified URL or at least one configured service URL.");
10631
+ throw new AthenaConfigurationError(
10632
+ "ATHENA_NO_SERVICE_CONFIGURED",
10633
+ "Athena requires a unified URL or at least one configured service URL.",
10634
+ "db"
10635
+ );
10544
10636
  }
10545
10637
  const key = normalizeOptional(config.key) ?? readFirstEnv(env, ENV_KEY_KEYS);
10546
10638
  if (!key) {
10547
- throw new Error("Athena API key is required. Pass key or provide it through the explicit env object.");
10639
+ throw new AthenaConfigurationError(
10640
+ "ATHENA_API_KEY_REQUIRED",
10641
+ "Athena API key is required. Pass key or provide it through the explicit env object."
10642
+ );
10548
10643
  }
10549
10644
  const base = {
10550
10645
  config,
@@ -10557,18 +10652,10 @@ function resolveCore(config) {
10557
10652
  internalCore: createInternalClientCore(createInternalConfig(base))
10558
10653
  };
10559
10654
  }
10560
- function mergeContexts(base, override) {
10561
- if (!base && !override) return void 0;
10562
- return {
10563
- ...base,
10564
- ...override,
10565
- headers: base?.headers || override?.headers ? { ...base?.headers ?? {}, ...override?.headers ?? {} } : void 0
10566
- };
10567
- }
10568
10655
  async function resolveConfiguredContext(core, viewContext) {
10569
10656
  const configured = core.config.context;
10570
10657
  const base = typeof configured === "function" ? await configured() : configured;
10571
- return mergeContexts(base, viewContext);
10658
+ return mergeAthenaRequestContexts(base, viewContext);
10572
10659
  }
10573
10660
  function createInternalConfig(core) {
10574
10661
  const { config, urls } = core;
@@ -10601,7 +10688,13 @@ function createInternalConfig(core) {
10601
10688
  };
10602
10689
  }
10603
10690
  function serviceGuard(urls, service) {
10604
- if (!urls[service]) throw new AthenaConfigurationError(service);
10691
+ if (!urls[service]) {
10692
+ throw new AthenaConfigurationError(
10693
+ "ATHENA_SERVICE_NOT_CONFIGURED",
10694
+ `Athena ${service} is not configured.`,
10695
+ service
10696
+ );
10697
+ }
10605
10698
  }
10606
10699
  function createUnavailableNamespace(service, urls, path = []) {
10607
10700
  return new Proxy(() => void 0, {
@@ -10660,7 +10753,7 @@ function createClientView(core, viewContext) {
10660
10753
  return resolved.verifyConnection(options);
10661
10754
  },
10662
10755
  withContext(context) {
10663
- return createClientView(core, mergeContexts(viewContext, context));
10756
+ return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
10664
10757
  }
10665
10758
  };
10666
10759
  return Object.freeze(client);