@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
@@ -1,7 +1,7 @@
1
- import { r as runSchemaGenerator } from '../pipeline-Dfsed4VD.cjs';
2
- import '../types-Z3-rsiM3.cjs';
1
+ import { r as runSchemaGenerator } from '../pipeline-D4W-Cc-A.cjs';
2
+ import '../types-BBm-kEBL.cjs';
3
3
  import '../types-Bltx6iL6.cjs';
4
- import '../types-kO_Ut5wU.cjs';
4
+ import '../types-CgCv5o6R.cjs';
5
5
 
6
6
  interface GenerateCommand {
7
7
  command: 'generate';
@@ -1,7 +1,7 @@
1
- import { r as runSchemaGenerator } from '../pipeline-BXFQbsUW.js';
2
- import '../types-CK7cBQbC.js';
1
+ import { r as runSchemaGenerator } from '../pipeline-B8aN2EHe.js';
2
+ import '../types-BaAMXCqK.js';
3
3
  import '../types-Bltx6iL6.js';
4
- import '../types-jClgDy1J.js';
4
+ import '../types-B75PdABb.js';
5
5
 
6
6
  interface GenerateCommand {
7
7
  command: 'generate';
package/dist/cli/index.js CHANGED
@@ -3220,7 +3220,7 @@ function buildRpcDebugSql(payload) {
3220
3220
  }
3221
3221
 
3222
3222
  // src/gateway/url.ts
3223
- var ATHENA_DEFAULT_BASE_URL = "https://athena-db.com";
3223
+ var ATHENA_DEFAULT_BASE_URL = "https://mirror2.athena-cluster.com";
3224
3224
  function describeReceivedValue(value) {
3225
3225
  if (value === void 0) return "undefined";
3226
3226
  if (value === null) return "null";
@@ -3243,14 +3243,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
3243
3243
  if (candidate === void 0 || candidate === null) {
3244
3244
  throw invalidBaseUrlError(
3245
3245
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
3246
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
3246
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
3247
3247
  );
3248
3248
  }
3249
3249
  const trimmed = candidate.trim();
3250
3250
  if (!trimmed) {
3251
3251
  throw invalidBaseUrlError(
3252
3252
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
3253
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
3253
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
3254
3254
  );
3255
3255
  }
3256
3256
  let parsed;
@@ -3259,13 +3259,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
3259
3259
  } catch {
3260
3260
  throw invalidBaseUrlError(
3261
3261
  `${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
3262
- 'Use a full URL including the protocol, for example "https://mirror3.athena-db.com".'
3262
+ 'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
3263
3263
  );
3264
3264
  }
3265
3265
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
3266
3266
  throw invalidBaseUrlError(
3267
3267
  `${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
3268
- 'Use an Athena gateway URL such as "https://mirror3.athena-db.com".'
3268
+ 'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
3269
3269
  );
3270
3270
  }
3271
3271
  if (parsed.search || parsed.hash) {
@@ -3288,7 +3288,7 @@ function buildAthenaGatewayUrl(baseUrl, path) {
3288
3288
 
3289
3289
  // package.json
3290
3290
  var package_default = {
3291
- version: "3.0.0"
3291
+ version: "3.0.2"
3292
3292
  };
3293
3293
 
3294
3294
  // src/sdk-version.ts
@@ -3698,7 +3698,7 @@ function createAthenaRequest(config, resolveContext) {
3698
3698
  }
3699
3699
 
3700
3700
  // src/gateway/client.ts
3701
- var DEFAULT_CLIENT = "railway_direct";
3701
+ var DEFAULT_CLIENT = "DEFAULT_CLIENT";
3702
3702
  var SDK_NAME2 = "xylex-group/athena";
3703
3703
  var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME2);
3704
3704
  function parseResponseBody(rawText, contentType) {
@@ -10526,6 +10526,25 @@ function createBillingModule(config) {
10526
10526
  createCheckout(body, options) {
10527
10527
  return call("POST", "/billing/v1/checkouts", body, options);
10528
10528
  },
10529
+ listProducts(input, options) {
10530
+ return call(
10531
+ "GET",
10532
+ appendQuery3("/billing/v1/products", connectionQuery(input)),
10533
+ void 0,
10534
+ options
10535
+ );
10536
+ },
10537
+ listPrices(input, options) {
10538
+ return call(
10539
+ "GET",
10540
+ appendQuery3("/billing/v1/prices", {
10541
+ ...connectionQuery(input),
10542
+ ...input.productId ? { productId: input.productId } : {}
10543
+ }),
10544
+ void 0,
10545
+ options
10546
+ );
10547
+ },
10529
10548
  listCustomers(input, options) {
10530
10549
  return call(
10531
10550
  "GET",
@@ -10672,10 +10691,7 @@ function createBillingModule(config) {
10672
10691
  getRefund(id, input, options) {
10673
10692
  return call(
10674
10693
  "GET",
10675
- appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), {
10676
- ...connectionQuery(input),
10677
- ...input.paymentId ? { paymentId: input.paymentId } : {}
10678
- }),
10694
+ appendQuery3(withPathParam2("/billing/v1/refunds/{id}", "id", id), connectionQuery(input)),
10679
10695
  void 0,
10680
10696
  options
10681
10697
  );
@@ -10683,10 +10699,7 @@ function createBillingModule(config) {
10683
10699
  cancelRefund(id, input, options) {
10684
10700
  return call(
10685
10701
  "POST",
10686
- appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), {
10687
- ...connectionQuery(input),
10688
- ...input.paymentId ? { paymentId: input.paymentId } : {}
10689
- }),
10702
+ appendQuery3(withPathParam2("/billing/v1/refunds/{id}/cancel", "id", id), connectionQuery(input)),
10690
10703
  {},
10691
10704
  options
10692
10705
  );
@@ -10705,10 +10718,10 @@ function createBillingModule(config) {
10705
10718
  getSubscription(id, input, options) {
10706
10719
  return call(
10707
10720
  "GET",
10708
- appendQuery3(withPathParam2("/billing/v1/subscriptions/{id}", "id", id), {
10709
- ...connectionQuery(input),
10710
- ...input.customerId ? { customerId: input.customerId } : {}
10711
- }),
10721
+ appendQuery3(
10722
+ withPathParam2("/billing/v1/subscriptions/{id}", "id", id),
10723
+ connectionQuery(input)
10724
+ ),
10712
10725
  void 0,
10713
10726
  options
10714
10727
  );
@@ -10724,10 +10737,10 @@ function createBillingModule(config) {
10724
10737
  cancelSubscription(id, input, options) {
10725
10738
  return call(
10726
10739
  "POST",
10727
- appendQuery3(withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id), {
10728
- ...connectionQuery(input),
10729
- customerId: input.customerId
10730
- }),
10740
+ appendQuery3(
10741
+ withPathParam2("/billing/v1/subscriptions/{id}/cancel", "id", id),
10742
+ connectionQuery(input)
10743
+ ),
10731
10744
  {},
10732
10745
  options
10733
10746
  );
@@ -10751,6 +10764,57 @@ function createBillingModule(config) {
10751
10764
  options
10752
10765
  );
10753
10766
  },
10767
+ listWebhooks(input, options) {
10768
+ return call(
10769
+ "GET",
10770
+ appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
10771
+ void 0,
10772
+ options
10773
+ );
10774
+ },
10775
+ createWebhook(input, body, options) {
10776
+ return call(
10777
+ "POST",
10778
+ appendQuery3("/billing/v1/webhooks", connectionQuery(input)),
10779
+ body,
10780
+ options
10781
+ );
10782
+ },
10783
+ getWebhook(id, input, options) {
10784
+ return call(
10785
+ "GET",
10786
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10787
+ void 0,
10788
+ options
10789
+ );
10790
+ },
10791
+ updateWebhook(id, input, body, options) {
10792
+ return call(
10793
+ "PATCH",
10794
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10795
+ body,
10796
+ options
10797
+ );
10798
+ },
10799
+ deleteWebhook(id, input, options) {
10800
+ return call(
10801
+ "DELETE",
10802
+ appendQuery3(withPathParam2("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
10803
+ void 0,
10804
+ options
10805
+ );
10806
+ },
10807
+ testWebhook(id, input, options) {
10808
+ return call(
10809
+ "POST",
10810
+ appendQuery3(
10811
+ withPathParam2("/billing/v1/webhooks/{id}/test", "id", id),
10812
+ connectionQuery(input)
10813
+ ),
10814
+ {},
10815
+ options
10816
+ );
10817
+ },
10754
10818
  listConnections(clientName, options) {
10755
10819
  return call(
10756
10820
  "GET",
@@ -10928,6 +10992,31 @@ function createBillingModule(config) {
10928
10992
  };
10929
10993
  }
10930
10994
 
10995
+ // src/config/errors.ts
10996
+ var AthenaConfigurationError = class extends Error {
10997
+ code;
10998
+ service;
10999
+ constructor(code, message, service) {
11000
+ super(message);
11001
+ this.name = "AthenaConfigurationError";
11002
+ this.code = code;
11003
+ this.service = service;
11004
+ }
11005
+ };
11006
+
11007
+ // src/context/merge.ts
11008
+ function mergeAthenaRequestContexts(base, override) {
11009
+ if (!base && !override) return void 0;
11010
+ return {
11011
+ ...base,
11012
+ ...override,
11013
+ headers: base?.headers || override?.headers ? {
11014
+ ...base?.headers ?? {},
11015
+ ...override?.headers ?? {}
11016
+ } : void 0
11017
+ };
11018
+ }
11019
+
10931
11020
  // src/v3-client.ts
10932
11021
  var ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
10933
11022
  var ENV_DB_URL_KEYS = ["ATHENA_DB_URL", "ATHENA_GATEWAY_URL", "NEXT_PUBLIC_ATHENA_DB_API_URL"];
@@ -10938,15 +11027,6 @@ var ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_UR
10938
11027
  var ENV_KEY_KEYS = ["ATHENA_API_KEY", "NEXT_PUBLIC_ATHENA_API_KEY", "ATHENA_GATEWAY_API_KEY", "X_API_KEY"];
10939
11028
  var ENV_CLIENT_KEYS = ["ATHENA_CLIENT", "NEXT_PUBLIC_ATHENA_CLIENT"];
10940
11029
  var MISSING_DB_SENTINEL = "https://athena.invalid/db";
10941
- var AthenaConfigurationError = class extends Error {
10942
- code = "ATHENA_SERVICE_NOT_CONFIGURED";
10943
- service;
10944
- constructor(service, message = `Athena ${service} is not configured.`) {
10945
- super(message);
10946
- this.name = "AthenaConfigurationError";
10947
- this.service = service;
10948
- }
10949
- };
10950
11030
  function readFirstEnv(env, keys) {
10951
11031
  for (const key of keys) {
10952
11032
  const value = env?.[key]?.trim();
@@ -10987,11 +11067,18 @@ function resolveCore(config) {
10987
11067
  chatWs: normalizeOptional(config.chat?.wsUrl) ?? (explicitRootWinsOverEnvServices && root ? toWebSocketUrl(root) : void 0) ?? readFirstEnv(env, ENV_CHAT_WS_URL_KEYS) ?? (root ? toWebSocketUrl(root) : void 0)
10988
11068
  };
10989
11069
  if (!urls.db && !urls.auth && !urls.chat && !urls.storage && !urls.billing) {
10990
- throw new AthenaConfigurationError("db", "Athena requires a unified URL or at least one configured service URL.");
11070
+ throw new AthenaConfigurationError(
11071
+ "ATHENA_NO_SERVICE_CONFIGURED",
11072
+ "Athena requires a unified URL or at least one configured service URL.",
11073
+ "db"
11074
+ );
10991
11075
  }
10992
11076
  const key = normalizeOptional(config.key) ?? readFirstEnv(env, ENV_KEY_KEYS);
10993
11077
  if (!key) {
10994
- throw new Error("Athena API key is required. Pass key or provide it through the explicit env object.");
11078
+ throw new AthenaConfigurationError(
11079
+ "ATHENA_API_KEY_REQUIRED",
11080
+ "Athena API key is required. Pass key or provide it through the explicit env object."
11081
+ );
10995
11082
  }
10996
11083
  const base = {
10997
11084
  config,
@@ -11004,18 +11091,10 @@ function resolveCore(config) {
11004
11091
  internalCore: createInternalClientCore(createInternalConfig(base))
11005
11092
  };
11006
11093
  }
11007
- function mergeContexts(base, override) {
11008
- if (!base && !override) return void 0;
11009
- return {
11010
- ...base,
11011
- ...override,
11012
- headers: base?.headers || override?.headers ? { ...base?.headers ?? {}, ...override?.headers ?? {} } : void 0
11013
- };
11014
- }
11015
11094
  async function resolveConfiguredContext(core, viewContext) {
11016
11095
  const configured = core.config.context;
11017
11096
  const base = typeof configured === "function" ? await configured() : configured;
11018
- return mergeContexts(base, viewContext);
11097
+ return mergeAthenaRequestContexts(base, viewContext);
11019
11098
  }
11020
11099
  function createInternalConfig(core) {
11021
11100
  const { config, urls } = core;
@@ -11048,7 +11127,13 @@ function createInternalConfig(core) {
11048
11127
  };
11049
11128
  }
11050
11129
  function serviceGuard(urls, service) {
11051
- if (!urls[service]) throw new AthenaConfigurationError(service);
11130
+ if (!urls[service]) {
11131
+ throw new AthenaConfigurationError(
11132
+ "ATHENA_SERVICE_NOT_CONFIGURED",
11133
+ `Athena ${service} is not configured.`,
11134
+ service
11135
+ );
11136
+ }
11052
11137
  }
11053
11138
  function createUnavailableNamespace(service, urls, path = []) {
11054
11139
  return new Proxy(() => void 0, {
@@ -11107,7 +11192,7 @@ function createClientView(core, viewContext) {
11107
11192
  return resolved.verifyConnection(options);
11108
11193
  },
11109
11194
  withContext(context) {
11110
- return createClientView(core, mergeContexts(viewContext, context));
11195
+ return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
11111
11196
  }
11112
11197
  };
11113
11198
  return Object.freeze(client);