@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/browser.cjs CHANGED
@@ -1937,7 +1937,7 @@ function buildRpcDebugSql(payload) {
1937
1937
  }
1938
1938
 
1939
1939
  // src/gateway/url.ts
1940
- var ATHENA_DEFAULT_BASE_URL = "https://athena-db.com";
1940
+ var ATHENA_DEFAULT_BASE_URL = "https://mirror2.athena-cluster.com";
1941
1941
  function describeReceivedValue(value) {
1942
1942
  if (value === void 0) return "undefined";
1943
1943
  if (value === null) return "null";
@@ -1960,14 +1960,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
1960
1960
  if (candidate === void 0 || candidate === null) {
1961
1961
  throw invalidBaseUrlError(
1962
1962
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
1963
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
1963
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
1964
1964
  );
1965
1965
  }
1966
1966
  const trimmed = candidate.trim();
1967
1967
  if (!trimmed) {
1968
1968
  throw invalidBaseUrlError(
1969
1969
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
1970
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
1970
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
1971
1971
  );
1972
1972
  }
1973
1973
  let parsed;
@@ -1976,13 +1976,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
1976
1976
  } catch {
1977
1977
  throw invalidBaseUrlError(
1978
1978
  `${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
1979
- 'Use a full URL including the protocol, for example "https://mirror3.athena-db.com".'
1979
+ 'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
1980
1980
  );
1981
1981
  }
1982
1982
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
1983
1983
  throw invalidBaseUrlError(
1984
1984
  `${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
1985
- 'Use an Athena gateway URL such as "https://mirror3.athena-db.com".'
1985
+ 'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
1986
1986
  );
1987
1987
  }
1988
1988
  if (parsed.search || parsed.hash) {
@@ -2005,7 +2005,7 @@ function buildAthenaGatewayUrl(baseUrl, path) {
2005
2005
 
2006
2006
  // package.json
2007
2007
  var package_default = {
2008
- version: "3.0.0"
2008
+ version: "3.0.2"
2009
2009
  };
2010
2010
 
2011
2011
  // src/sdk-version.ts
@@ -3053,7 +3053,7 @@ function createAthenaRequest(config, resolveContext) {
3053
3053
  }
3054
3054
 
3055
3055
  // src/gateway/client.ts
3056
- var DEFAULT_CLIENT = "railway_direct";
3056
+ var DEFAULT_CLIENT = "DEFAULT_CLIENT";
3057
3057
  var SDK_NAME2 = "xylex-group/athena";
3058
3058
  var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME2);
3059
3059
  function parseResponseBody(rawText, contentType) {
@@ -9882,6 +9882,8 @@ var billingSdkManifest = {
9882
9882
  methods: [
9883
9883
  { name: "getCapabilities", method: "GET", path: "/billing/v1/capabilities" },
9884
9884
  { name: "createCheckout", method: "POST", path: "/billing/v1/checkouts" },
9885
+ { name: "listProducts", method: "GET", path: "/billing/v1/products" },
9886
+ { name: "listPrices", method: "GET", path: "/billing/v1/prices" },
9885
9887
  { name: "listCustomers", method: "GET", path: "/billing/v1/customers" },
9886
9888
  { name: "createCustomer", method: "POST", path: "/billing/v1/customers" },
9887
9889
  { name: "getCustomer", method: "GET", path: "/billing/v1/customers/{id}" },
@@ -9907,6 +9909,12 @@ var billingSdkManifest = {
9907
9909
  { name: "cancelSubscription", method: "POST", path: "/billing/v1/subscriptions/{id}/cancel" },
9908
9910
  { name: "listInvoices", method: "GET", path: "/billing/v1/invoices" },
9909
9911
  { name: "getInvoice", method: "GET", path: "/billing/v1/invoices/{id}" },
9912
+ { name: "listWebhooks", method: "GET", path: "/billing/v1/webhooks" },
9913
+ { name: "createWebhook", method: "POST", path: "/billing/v1/webhooks" },
9914
+ { name: "getWebhook", method: "GET", path: "/billing/v1/webhooks/{id}" },
9915
+ { name: "updateWebhook", method: "PATCH", path: "/billing/v1/webhooks/{id}" },
9916
+ { name: "deleteWebhook", method: "DELETE", path: "/billing/v1/webhooks/{id}" },
9917
+ { name: "testWebhook", method: "POST", path: "/billing/v1/webhooks/{id}/test" },
9910
9918
  {
9911
9919
  name: "listConnections",
9912
9920
  method: "GET",
@@ -10075,6 +10083,25 @@ function createBillingModule(config) {
10075
10083
  createCheckout(body, options) {
10076
10084
  return call("POST", "/billing/v1/checkouts", body, options);
10077
10085
  },
10086
+ listProducts(input, options) {
10087
+ return call(
10088
+ "GET",
10089
+ appendQuery3("/billing/v1/products", connectionQuery(input)),
10090
+ void 0,
10091
+ options
10092
+ );
10093
+ },
10094
+ listPrices(input, options) {
10095
+ return call(
10096
+ "GET",
10097
+ appendQuery3("/billing/v1/prices", {
10098
+ ...connectionQuery(input),
10099
+ ...input.productId ? { productId: input.productId } : {}
10100
+ }),
10101
+ void 0,
10102
+ options
10103
+ );
10104
+ },
10078
10105
  listCustomers(input, options) {
10079
10106
  return call(
10080
10107
  "GET",
@@ -10221,10 +10248,7 @@ function createBillingModule(config) {
10221
10248
  getRefund(id, input, options) {
10222
10249
  return call(
10223
10250
  "GET",
10224
- appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), {
10225
- ...connectionQuery(input),
10226
- ...input.paymentId ? { paymentId: input.paymentId } : {}
10227
- }),
10251
+ appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), connectionQuery(input)),
10228
10252
  void 0,
10229
10253
  options
10230
10254
  );
@@ -10232,10 +10256,7 @@ function createBillingModule(config) {
10232
10256
  cancelRefund(id, input, options) {
10233
10257
  return call(
10234
10258
  "POST",
10235
- appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), {
10236
- ...connectionQuery(input),
10237
- ...input.paymentId ? { paymentId: input.paymentId } : {}
10238
- }),
10259
+ appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), connectionQuery(input)),
10239
10260
  {},
10240
10261
  options
10241
10262
  );
@@ -10254,10 +10275,10 @@ function createBillingModule(config) {
10254
10275
  getSubscription(id, input, options) {
10255
10276
  return call(
10256
10277
  "GET",
10257
- appendQuery3(withPathParam2("/billing/v1/subscriptions/{id}", "id", id), {
10258
- ...connectionQuery(input),
10259
- ...input.customerId ? { customerId: input.customerId } : {}
10260
- }),
10278
+ appendQuery3(
10279
+ withPathParam2("/billing/v1/subscriptions/{id}", "id", id),
10280
+ connectionQuery(input)
10281
+ ),
10261
10282
  void 0,
10262
10283
  options
10263
10284
  );
@@ -10273,10 +10294,10 @@ function createBillingModule(config) {
10273
10294
  cancelSubscription(id, input, options) {
10274
10295
  return call(
10275
10296
  "POST",
10276
- appendQuery3(withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id), {
10277
- ...connectionQuery(input),
10278
- customerId: input.customerId
10279
- }),
10297
+ appendQuery3(
10298
+ withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id),
10299
+ connectionQuery(input)
10300
+ ),
10280
10301
  {},
10281
10302
  options
10282
10303
  );
@@ -10300,6 +10321,57 @@ function createBillingModule(config) {
10300
10321
  options
10301
10322
  );
10302
10323
  },
10324
+ listWebhooks(input, options) {
10325
+ return call(
10326
+ "GET",
10327
+ appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
10328
+ void 0,
10329
+ options
10330
+ );
10331
+ },
10332
+ createWebhook(input, body, options) {
10333
+ return call(
10334
+ "POST",
10335
+ appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
10336
+ body,
10337
+ options
10338
+ );
10339
+ },
10340
+ getWebhook(id, input, options) {
10341
+ return call(
10342
+ "GET",
10343
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10344
+ void 0,
10345
+ options
10346
+ );
10347
+ },
10348
+ updateWebhook(id, input, body, options) {
10349
+ return call(
10350
+ "PATCH",
10351
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10352
+ body,
10353
+ options
10354
+ );
10355
+ },
10356
+ deleteWebhook(id, input, options) {
10357
+ return call(
10358
+ "DELETE",
10359
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10360
+ void 0,
10361
+ options
10362
+ );
10363
+ },
10364
+ testWebhook(id, input, options) {
10365
+ return call(
10366
+ "POST",
10367
+ appendQuery3(
10368
+ withPathParam2("/billing/v1/webhooks/{id}/test", "id", id),
10369
+ connectionQuery(input)
10370
+ ),
10371
+ {},
10372
+ options
10373
+ );
10374
+ },
10303
10375
  listConnections(clientName, options) {
10304
10376
  return call(
10305
10377
  "GET",
@@ -10477,6 +10549,31 @@ function createBillingModule(config) {
10477
10549
  };
10478
10550
  }
10479
10551
 
10552
+ // src/config/errors.ts
10553
+ var AthenaConfigurationError = class extends Error {
10554
+ code;
10555
+ service;
10556
+ constructor(code, message, service) {
10557
+ super(message);
10558
+ this.name = "AthenaConfigurationError";
10559
+ this.code = code;
10560
+ this.service = service;
10561
+ }
10562
+ };
10563
+
10564
+ // src/context/merge.ts
10565
+ function mergeAthenaRequestContexts(base, override) {
10566
+ if (!base && !override) return void 0;
10567
+ return {
10568
+ ...base,
10569
+ ...override,
10570
+ headers: base?.headers || override?.headers ? {
10571
+ ...base?.headers ?? {},
10572
+ ...override?.headers ?? {}
10573
+ } : void 0
10574
+ };
10575
+ }
10576
+
10480
10577
  // src/v3-client.ts
10481
10578
  var ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
10482
10579
  var ENV_DB_URL_KEYS = ["ATHENA_DB_URL", "ATHENA_GATEWAY_URL", "NEXT_PUBLIC_ATHENA_DB_API_URL"];
@@ -10487,15 +10584,6 @@ var ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_UR
10487
10584
  var ENV_KEY_KEYS = ["ATHENA_API_KEY", "NEXT_PUBLIC_ATHENA_API_KEY", "ATHENA_GATEWAY_API_KEY", "X_API_KEY"];
10488
10585
  var ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
10489
10586
  var MISSING_DB_SENTINEL = "https://athena.invalid/db";
10490
- var AthenaConfigurationError = class extends Error {
10491
- code = "ATHENA_SERVICE_NOT_CONFIGURED";
10492
- service;
10493
- constructor(service, message = `Athena ${service} is not configured.`) {
10494
- super(message);
10495
- this.name = "AthenaConfigurationError";
10496
- this.service = service;
10497
- }
10498
- };
10499
10587
  function readFirstEnv(env, keys) {
10500
10588
  for (const key of keys) {
10501
10589
  const value = env?.[key]?.trim();
@@ -10536,11 +10624,18 @@ function resolveCore(config) {
10536
10624
  chatWs: normalizeOptional(config.chat?.wsUrl) ?? (explicitRootWinsOverEnvServices && root ? toWebSocketUrl(root) : void 0) ?? readFirstEnv(env, ENV_CHAT_WS_URL_KEYS) ?? (root ? toWebSocketUrl(root) : void 0)
10537
10625
  };
10538
10626
  if (!urls.db && !urls.auth && !urls.chat && !urls.storage && !urls.billing) {
10539
- throw new AthenaConfigurationError("db", "Athena requires a unified URL or at least one configured service URL.");
10627
+ throw new AthenaConfigurationError(
10628
+ "ATHENA_NO_SERVICE_CONFIGURED",
10629
+ "Athena requires a unified URL or at least one configured service URL.",
10630
+ "db"
10631
+ );
10540
10632
  }
10541
10633
  const key = normalizeOptional(config.key) ?? readFirstEnv(env, ENV_KEY_KEYS);
10542
10634
  if (!key) {
10543
- throw new Error("Athena API key is required. Pass key or provide it through the explicit env object.");
10635
+ throw new AthenaConfigurationError(
10636
+ "ATHENA_API_KEY_REQUIRED",
10637
+ "Athena API key is required. Pass key or provide it through the explicit env object."
10638
+ );
10544
10639
  }
10545
10640
  const base = {
10546
10641
  config,
@@ -10553,18 +10648,10 @@ function resolveCore(config) {
10553
10648
  internalCore: createInternalClientCore(createInternalConfig(base))
10554
10649
  };
10555
10650
  }
10556
- function mergeContexts(base, override) {
10557
- if (!base && !override) return void 0;
10558
- return {
10559
- ...base,
10560
- ...override,
10561
- headers: base?.headers || override?.headers ? { ...base?.headers ?? {}, ...override?.headers ?? {} } : void 0
10562
- };
10563
- }
10564
10651
  async function resolveConfiguredContext(core, viewContext) {
10565
10652
  const configured = core.config.context;
10566
10653
  const base = typeof configured === "function" ? await configured() : configured;
10567
- return mergeContexts(base, viewContext);
10654
+ return mergeAthenaRequestContexts(base, viewContext);
10568
10655
  }
10569
10656
  function createInternalConfig(core) {
10570
10657
  const { config, urls } = core;
@@ -10597,7 +10684,13 @@ function createInternalConfig(core) {
10597
10684
  };
10598
10685
  }
10599
10686
  function serviceGuard(urls, service) {
10600
- if (!urls[service]) throw new AthenaConfigurationError(service);
10687
+ if (!urls[service]) {
10688
+ throw new AthenaConfigurationError(
10689
+ "ATHENA_SERVICE_NOT_CONFIGURED",
10690
+ `Athena ${service} is not configured.`,
10691
+ service
10692
+ );
10693
+ }
10601
10694
  }
10602
10695
  function createUnavailableNamespace(service, urls, path = []) {
10603
10696
  return new Proxy(() => void 0, {
@@ -10656,7 +10749,7 @@ function createClientView(core, viewContext) {
10656
10749
  return resolved.verifyConnection(options);
10657
10750
  },
10658
10751
  withContext(context) {
10659
- return createClientView(core, mergeContexts(viewContext, context));
10752
+ return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
10660
10753
  }
10661
10754
  };
10662
10755
  return Object.freeze(client);