@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
@@ -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-db.com";
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://mirror3.athena-db.com".'
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://mirror3.athena-db.com".'
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://mirror3.athena-db.com".'
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://mirror3.athena-db.com".'
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.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 = "railway_direct";
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(withPathParam2("/billing/v1/subscriptions/{id}", "id", id), {
10711
- ...connectionQuery(input),
10712
- ...input.customerId ? { customerId: input.customerId } : {}
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(withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id), {
10730
- ...connectionQuery(input),
10731
- customerId: input.customerId
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("db", "Athena requires a unified URL or at least one configured service URL.");
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 Error("Athena API key is required. Pass key or provide it through the explicit env object.");
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 mergeContexts(base, viewContext);
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]) throw new AthenaConfigurationError(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, mergeContexts(viewContext, context));
11197
+ return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
11113
11198
  }
11114
11199
  };
11115
11200
  return Object.freeze(client);