@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
@@ -145,7 +145,7 @@ async function athenaFetch(url, options = {}) {
145
145
  redirect: options.redirect ?? "follow",
146
146
  signal: options.signal
147
147
  });
148
- options.onResponse?.({ response });
148
+ await options.onResponse?.({ response });
149
149
  if (!response.ok) {
150
150
  let message = response.statusText || `HTTP ${response.status}`;
151
151
  try {
@@ -162,7 +162,7 @@ async function athenaFetch(url, options = {}) {
162
162
  status: response.status,
163
163
  statusText: response.statusText
164
164
  };
165
- options.onError?.({ response, error });
165
+ await options.onError?.({ response, error });
166
166
  return { data: null, error };
167
167
  }
168
168
  const contentType = response.headers.get("content-type") ?? "";
@@ -185,7 +185,7 @@ async function athenaFetch(url, options = {}) {
185
185
  status: 0,
186
186
  statusText: "NetworkError"
187
187
  };
188
- options.onError?.({
188
+ await options.onError?.({
189
189
  response: new Response(null, { status: 502, statusText: "Network Error" }),
190
190
  error: cause
191
191
  });
@@ -282,13 +282,13 @@ async function createAuthorizationURL({
282
282
  url.searchParams.set("scope", scopes.join(scopeJoiner || " "));
283
283
  }
284
284
  url.searchParams.set("redirect_uri", options.redirectURI || redirectURI);
285
- duration && url.searchParams.set("duration", duration);
286
- display && url.searchParams.set("display", display);
287
- loginHint && url.searchParams.set("login_hint", loginHint);
288
- prompt && url.searchParams.set("prompt", prompt);
289
- hd && url.searchParams.set("hd", hd);
290
- accessType && url.searchParams.set("access_type", accessType);
291
- responseMode && url.searchParams.set("response_mode", responseMode);
285
+ if (duration) url.searchParams.set("duration", duration);
286
+ if (display) url.searchParams.set("display", display);
287
+ if (loginHint) url.searchParams.set("login_hint", loginHint);
288
+ if (prompt) url.searchParams.set("prompt", prompt);
289
+ if (hd) url.searchParams.set("hd", hd);
290
+ if (accessType) url.searchParams.set("access_type", accessType);
291
+ if (responseMode) url.searchParams.set("response_mode", responseMode);
292
292
  if (codeVerifier) {
293
293
  const codeChallenge = await generateCodeChallenge(codeVerifier);
294
294
  url.searchParams.set("code_challenge_method", "S256");
@@ -332,16 +332,17 @@ function createRefreshAccessTokenRequest({
332
332
  };
333
333
  body.set("grant_type", "refresh_token");
334
334
  body.set("refresh_token", refreshToken);
335
+ const primaryClientId = getPrimaryClientId(options.clientId);
335
336
  if (authentication === "basic") {
336
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
337
337
  if (primaryClientId) {
338
338
  headers["authorization"] = "Basic " + base64.encode(`${primaryClientId}:${options.clientSecret ?? ""}`);
339
339
  } else {
340
340
  headers["authorization"] = "Basic " + base64.encode(`:${options.clientSecret ?? ""}`);
341
341
  }
342
342
  } else {
343
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
344
- body.set("client_id", primaryClientId);
343
+ if (primaryClientId) {
344
+ body.set("client_id", primaryClientId);
345
+ }
345
346
  if (options.clientSecret) {
346
347
  body.set("client_secret", options.clientSecret);
347
348
  }
@@ -450,9 +451,15 @@ function createAuthorizationCodeRequest({
450
451
  };
451
452
  body.set("grant_type", "authorization_code");
452
453
  body.set("code", code);
453
- codeVerifier && body.set("code_verifier", codeVerifier);
454
- options.clientKey && body.set("client_key", options.clientKey);
455
- deviceId && body.set("device_id", deviceId);
454
+ if (codeVerifier) {
455
+ body.set("code_verifier", codeVerifier);
456
+ }
457
+ if (options.clientKey) {
458
+ body.set("client_key", options.clientKey);
459
+ }
460
+ if (deviceId) {
461
+ body.set("device_id", deviceId);
462
+ }
456
463
  body.set("redirect_uri", options.redirectURI || redirectURI);
457
464
  if (resource) {
458
465
  if (typeof resource === "string") {
@@ -463,15 +470,16 @@ function createAuthorizationCodeRequest({
463
470
  }
464
471
  }
465
472
  }
473
+ const primaryClientId = getPrimaryClientId(options.clientId);
466
474
  if (authentication === "basic") {
467
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
468
475
  const encodedCredentials = base64.encode(
469
- `${primaryClientId}:${options.clientSecret ?? ""}`
476
+ `${primaryClientId ?? ""}:${options.clientSecret ?? ""}`
470
477
  );
471
478
  requestHeaders["authorization"] = `Basic ${encodedCredentials}`;
472
479
  } else {
473
- const primaryClientId = Array.isArray(options.clientId) ? options.clientId[0] : options.clientId;
474
- body.set("client_id", primaryClientId);
480
+ if (primaryClientId) {
481
+ body.set("client_id", primaryClientId);
482
+ }
475
483
  if (options.clientSecret) {
476
484
  body.set("client_secret", options.clientSecret);
477
485
  }
@@ -3878,8 +3886,8 @@ var wechat = (options) => {
3878
3886
  name: "WeChat",
3879
3887
  createAuthorizationURL({ state, scopes, redirectURI }) {
3880
3888
  const _scopes = options.disableDefaultScope ? [] : ["snsapi_login"];
3881
- options.scope && _scopes.push(...options.scope);
3882
- scopes && _scopes.push(...scopes);
3889
+ if (options.scope) _scopes.push(...options.scope);
3890
+ if (scopes) _scopes.push(...scopes);
3883
3891
  const url = new URL("https://open.weixin.qq.com/connect/qrconnect");
3884
3892
  url.searchParams.set("scope", _scopes.join(","));
3885
3893
  url.searchParams.set("response_type", "code");
@@ -4025,7 +4033,7 @@ var zoom = (userOptions) => {
4025
4033
  codeVerifier,
4026
4034
  options,
4027
4035
  tokenEndpoint: "https://zoom.us/oauth/token",
4028
- authentication: "post"
4036
+ authentication: "basic"
4029
4037
  });
4030
4038
  },
4031
4039
  refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => refreshAccessToken({
@@ -4035,7 +4043,8 @@ var zoom = (userOptions) => {
4035
4043
  clientKey: options.clientKey,
4036
4044
  clientSecret: options.clientSecret
4037
4045
  },
4038
- tokenEndpoint: "https://zoom.us/oauth/token"
4046
+ tokenEndpoint: "https://zoom.us/oauth/token",
4047
+ authentication: "basic"
4039
4048
  }),
4040
4049
  async getUserInfo(token) {
4041
4050
  if (options.getUserInfo) {