@xylex-group/athena 2.13.0 → 3.0.0

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 (79) hide show
  1. package/README.md +91 -1398
  2. package/bin/athena-js.js +0 -0
  3. package/dist/admin.d.cts +1 -1
  4. package/dist/admin.d.ts +1 -1
  5. package/dist/billing.cjs +1199 -0
  6. package/dist/billing.cjs.map +1 -0
  7. package/dist/billing.d.cts +230 -0
  8. package/dist/billing.d.ts +230 -0
  9. package/dist/billing.js +1194 -0
  10. package/dist/billing.js.map +1 -0
  11. package/dist/browser.cjs +8934 -8075
  12. package/dist/browser.cjs.map +1 -1
  13. package/dist/browser.d.cts +11 -10
  14. package/dist/browser.d.ts +11 -10
  15. package/dist/browser.js +8931 -8073
  16. package/dist/browser.js.map +1 -1
  17. package/dist/cli/index.cjs +8328 -7062
  18. package/dist/cli/index.cjs.map +1 -1
  19. package/dist/cli/index.d.cts +4 -4
  20. package/dist/cli/index.d.ts +4 -4
  21. package/dist/cli/index.js +8328 -7062
  22. package/dist/cli/index.js.map +1 -1
  23. package/dist/index.cjs +9391 -8526
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +11 -10
  26. package/dist/index.d.ts +11 -10
  27. package/dist/index.js +9384 -8524
  28. package/dist/index.js.map +1 -1
  29. package/dist/{model-form-Dw4zEL5a.d.cts → model-form-BEfCGB5b.d.cts} +2 -2
  30. package/dist/{model-form-yRg71q3H.d.ts → model-form-BKetpu6Q.d.ts} +2 -2
  31. package/dist/module-8dSMcy0K.d.cts +326 -0
  32. package/dist/module-8dSMcy0K.d.ts +326 -0
  33. package/dist/{module-DBteUIob.d.ts → module-Bef_MAPO.d.ts} +6 -52
  34. package/dist/{module-yoX49uQC.d.cts → module-CrrSmpML.d.cts} +6 -52
  35. package/dist/next/client.cjs +2 -8668
  36. package/dist/next/client.cjs.map +1 -1
  37. package/dist/next/client.d.cts +1 -27
  38. package/dist/next/client.d.ts +1 -27
  39. package/dist/next/client.js +3 -8668
  40. package/dist/next/client.js.map +1 -1
  41. package/dist/next/server.cjs +79 -8779
  42. package/dist/next/server.cjs.map +1 -1
  43. package/dist/next/server.d.cts +30 -46
  44. package/dist/next/server.d.ts +30 -46
  45. package/dist/next/server.js +79 -8779
  46. package/dist/next/server.js.map +1 -1
  47. package/dist/{payload-DEOWN_oo.d.ts → payload-DWI1rw-e.d.cts} +1 -35
  48. package/dist/{payload-BzVbUgY_.d.cts → payload-DWI1rw-e.d.ts} +1 -35
  49. package/dist/{pipeline-Bj6RWt1A.d.ts → pipeline-BXFQbsUW.d.ts} +1 -1
  50. package/dist/{pipeline-Dwck-wZO.d.cts → pipeline-Dfsed4VD.d.cts} +1 -1
  51. package/dist/react.cjs +114 -13
  52. package/dist/react.cjs.map +1 -1
  53. package/dist/react.d.cts +46 -16
  54. package/dist/react.d.ts +46 -16
  55. package/dist/react.js +113 -14
  56. package/dist/react.js.map +1 -1
  57. package/dist/social-providers.cjs +33 -24
  58. package/dist/social-providers.cjs.map +1 -1
  59. package/dist/social-providers.d.cts +79 -82
  60. package/dist/social-providers.d.ts +79 -82
  61. package/dist/social-providers.js +33 -24
  62. package/dist/social-providers.js.map +1 -1
  63. package/dist/{types-eAKAh71s.d.cts → types-AOY-GLu8.d.cts} +27 -54
  64. package/dist/{types-eAKAh71s.d.ts → types-AOY-GLu8.d.ts} +27 -54
  65. package/dist/{types-CH78O90i.d.cts → types-Bltx6iL6.d.cts} +4 -6
  66. package/dist/{types-CH78O90i.d.ts → types-Bltx6iL6.d.ts} +4 -6
  67. package/dist/{types-DPgejxYC.d.ts → types-CK7cBQbC.d.ts} +2 -2
  68. package/dist/{types-CjC9_5ZQ.d.cts → types-Z3-rsiM3.d.cts} +2 -2
  69. package/dist/{types-BRP7sfSF.d.ts → types-jClgDy1J.d.ts} +2 -2
  70. package/dist/{types-BU8uJH_b.d.cts → types-kO_Ut5wU.d.cts} +2 -2
  71. package/dist/utils.cjs +7 -8
  72. package/dist/utils.cjs.map +1 -1
  73. package/dist/utils.d.cts +2 -5
  74. package/dist/utils.d.ts +2 -5
  75. package/dist/utils.js +7 -8
  76. package/dist/utils.js.map +1 -1
  77. package/dist/{client-DVOKSYDI.d.ts → v3-client-CuCNy-JJ.d.ts} +532 -470
  78. package/dist/{client-BJjUwDSg.d.cts → v3-client-G8JMOilK.d.cts} +532 -470
  79. package/package.json +31 -21
@@ -167,7 +167,7 @@ async function athenaFetch(url, options = {}) {
167
167
  redirect: options.redirect ?? "follow",
168
168
  signal: options.signal
169
169
  });
170
- options.onResponse?.({ response });
170
+ await options.onResponse?.({ response });
171
171
  if (!response.ok) {
172
172
  let message = response.statusText || `HTTP ${response.status}`;
173
173
  try {
@@ -184,7 +184,7 @@ async function athenaFetch(url, options = {}) {
184
184
  status: response.status,
185
185
  statusText: response.statusText
186
186
  };
187
- options.onError?.({ response, error });
187
+ await options.onError?.({ response, error });
188
188
  return { data: null, error };
189
189
  }
190
190
  const contentType = response.headers.get("content-type") ?? "";
@@ -207,7 +207,7 @@ async function athenaFetch(url, options = {}) {
207
207
  status: 0,
208
208
  statusText: "NetworkError"
209
209
  };
210
- options.onError?.({
210
+ await options.onError?.({
211
211
  response: new Response(null, { status: 502, statusText: "Network Error" }),
212
212
  error: cause
213
213
  });
@@ -304,13 +304,13 @@ async function createAuthorizationURL({
304
304
  url.searchParams.set("scope", scopes.join(scopeJoiner || " "));
305
305
  }
306
306
  url.searchParams.set("redirect_uri", options.redirectURI || redirectURI);
307
- duration && url.searchParams.set("duration", duration);
308
- display && url.searchParams.set("display", display);
309
- loginHint && url.searchParams.set("login_hint", loginHint);
310
- prompt && url.searchParams.set("prompt", prompt);
311
- hd && url.searchParams.set("hd", hd);
312
- accessType && url.searchParams.set("access_type", accessType);
313
- responseMode && url.searchParams.set("response_mode", responseMode);
307
+ if (duration) url.searchParams.set("duration", duration);
308
+ if (display) url.searchParams.set("display", display);
309
+ if (loginHint) url.searchParams.set("login_hint", loginHint);
310
+ if (prompt) url.searchParams.set("prompt", prompt);
311
+ if (hd) url.searchParams.set("hd", hd);
312
+ if (accessType) url.searchParams.set("access_type", accessType);
313
+ if (responseMode) url.searchParams.set("response_mode", responseMode);
314
314
  if (codeVerifier) {
315
315
  const codeChallenge = await generateCodeChallenge(codeVerifier);
316
316
  url.searchParams.set("code_challenge_method", "S256");
@@ -354,16 +354,17 @@ function createRefreshAccessTokenRequest({
354
354
  };
355
355
  body.set("grant_type", "refresh_token");
356
356
  body.set("refresh_token", refreshToken);
357
+ const primaryClientId = getPrimaryClientId(options.clientId);
357
358
  if (authentication === "basic") {
358
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
359
359
  if (primaryClientId) {
360
360
  headers["authorization"] = "Basic " + base64.encode(`${primaryClientId}:${options.clientSecret ?? ""}`);
361
361
  } else {
362
362
  headers["authorization"] = "Basic " + base64.encode(`:${options.clientSecret ?? ""}`);
363
363
  }
364
364
  } else {
365
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
366
- body.set("client_id", primaryClientId);
365
+ if (primaryClientId) {
366
+ body.set("client_id", primaryClientId);
367
+ }
367
368
  if (options.clientSecret) {
368
369
  body.set("client_secret", options.clientSecret);
369
370
  }
@@ -472,9 +473,15 @@ function createAuthorizationCodeRequest({
472
473
  };
473
474
  body.set("grant_type", "authorization_code");
474
475
  body.set("code", code);
475
- codeVerifier && body.set("code_verifier", codeVerifier);
476
- options.clientKey && body.set("client_key", options.clientKey);
477
- deviceId && body.set("device_id", deviceId);
476
+ if (codeVerifier) {
477
+ body.set("code_verifier", codeVerifier);
478
+ }
479
+ if (options.clientKey) {
480
+ body.set("client_key", options.clientKey);
481
+ }
482
+ if (deviceId) {
483
+ body.set("device_id", deviceId);
484
+ }
478
485
  body.set("redirect_uri", options.redirectURI || redirectURI);
479
486
  if (resource) {
480
487
  if (typeof resource === "string") {
@@ -485,15 +492,16 @@ function createAuthorizationCodeRequest({
485
492
  }
486
493
  }
487
494
  }
495
+ const primaryClientId = getPrimaryClientId(options.clientId);
488
496
  if (authentication === "basic") {
489
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
490
497
  const encodedCredentials = base64.encode(
491
- `${primaryClientId}:${options.clientSecret ?? ""}`
498
+ `${primaryClientId ?? ""}:${options.clientSecret ?? ""}`
492
499
  );
493
500
  requestHeaders["authorization"] = `Basic ${encodedCredentials}`;
494
501
  } else {
495
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
496
- body.set("client_id", primaryClientId);
502
+ if (primaryClientId) {
503
+ body.set("client_id", primaryClientId);
504
+ }
497
505
  if (options.clientSecret) {
498
506
  body.set("client_secret", options.clientSecret);
499
507
  }
@@ -3900,8 +3908,8 @@ var wechat = (options) => {
3900
3908
  name: "WeChat",
3901
3909
  createAuthorizationURL({ state, scopes, redirectURI }) {
3902
3910
  const _scopes = options.disableDefaultScope ? [] : ["snsapi_login"];
3903
- options.scope && _scopes.push(...options.scope);
3904
- scopes && _scopes.push(...scopes);
3911
+ if (options.scope) _scopes.push(...options.scope);
3912
+ if (scopes) _scopes.push(...scopes);
3905
3913
  const url = new URL("https://open.weixin.qq.com/connect/qrconnect");
3906
3914
  url.searchParams.set("scope", _scopes.join(","));
3907
3915
  url.searchParams.set("response_type", "code");
@@ -4047,7 +4055,7 @@ var zoom = (userOptions) => {
4047
4055
  codeVerifier,
4048
4056
  options,
4049
4057
  tokenEndpoint: "https://zoom.us/oauth/token",
4050
- authentication: "post"
4058
+ authentication: "basic"
4051
4059
  });
4052
4060
  },
4053
4061
  refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => refreshAccessToken({
@@ -4057,7 +4065,8 @@ var zoom = (userOptions) => {
4057
4065
  clientKey: options.clientKey,
4058
4066
  clientSecret: options.clientSecret
4059
4067
  },
4060
- tokenEndpoint: "https://zoom.us/oauth/token"
4068
+ tokenEndpoint: "https://zoom.us/oauth/token",
4069
+ authentication: "basic"
4061
4070
  }),
4062
4071
  async getUserInfo(token) {
4063
4072
  if (options.getUserInfo) {