@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,4 +1,4 @@
1
- import { R as RunGeneratorOptions, d as RunGeneratorResult } from './types-CK7cBQbC.js';
1
+ import { R as RunGeneratorOptions, d as RunGeneratorResult } from './types-BaAMXCqK.js';
2
2
 
3
3
  /**
4
4
  * End-to-end generator execution: load config, introspect, render, and optionally write files.
@@ -1,4 +1,4 @@
1
- import { R as RunGeneratorOptions, d as RunGeneratorResult } from './types-Z3-rsiM3.cjs';
1
+ import { R as RunGeneratorOptions, d as RunGeneratorResult } from './types-BBm-kEBL.cjs';
2
2
 
3
3
  /**
4
4
  * End-to-end generator execution: load config, introspect, render, and optionally write files.
@@ -0,0 +1,59 @@
1
+ import { I as EnvLike } from './athena-request-headers-DujFFyMU.cjs';
2
+
3
+ /**
4
+ * Request header / Next.js helpers used by middleware and RSC session loaders.
5
+ * Framework-agnostic (no Next imports).
6
+ */
7
+ /**
8
+ * True when Next.js threw because the route used dynamic APIs during static
9
+ * generation (`DYNAMIC_SERVER_USAGE` digest or matching message).
10
+ *
11
+ * Catch and rethrow (or handle) so Next can mark the route dynamic.
12
+ */
13
+ declare function isDynamicServerUsageError(error: unknown): boolean;
14
+ interface GetOriginFromHeadersOptions {
15
+ /**
16
+ * When `x-forwarded-proto` / scheme is missing, use `http` if true else `https`.
17
+ * Typical: `process.env.NODE_ENV !== "production"`.
18
+ */
19
+ preferHttpWhenMissingProto?: boolean;
20
+ }
21
+ /**
22
+ * Reconstruct public origin from request headers (Origin, or Host + proto).
23
+ *
24
+ * Prefers `Origin`, then `x-forwarded-host` / `host` with
25
+ * `x-forwarded-proto` (first value when comma-separated).
26
+ */
27
+ declare function getOriginFromHeaders(headersList: {
28
+ get: (name: string) => string | null;
29
+ }, options?: GetOriginFromHeadersOptions): string | null;
30
+
31
+ /**
32
+ * Read the first non-empty trimmed environment variable from a name list.
33
+ *
34
+ * @param names - Candidate env keys in priority order
35
+ * @param env - Optional env map (defaults to `process.env`)
36
+ * @returns Trimmed value of the first key that is set and non-empty
37
+ * @throws {Error} When none of the keys yield a non-empty value
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { requireEnv } from "@xylex-group/athena/utils"
42
+ *
43
+ * const authUrl = requireEnv([
44
+ * "ATHENA_AUTH_UPSTREAM_URL",
45
+ * "ATHENA_AUTH_URL",
46
+ * "NEXT_PUBLIC_ATHENA_AUTH_URL",
47
+ * ])
48
+ * ```
49
+ */
50
+ declare function requireEnv(names: readonly string[], env?: EnvLike): string;
51
+ /**
52
+ * Like {@link requireEnv}, but returns `undefined` instead of throwing when
53
+ * none of the keys are set.
54
+ */
55
+ declare function readEnv(names: readonly string[], env?: EnvLike): string | undefined;
56
+
57
+ declare function proxyRequestHeaders(request: Request): Headers;
58
+
59
+ export { type GetOriginFromHeadersOptions as G, requireEnv as a, getOriginFromHeaders as g, isDynamicServerUsageError as i, proxyRequestHeaders as p, readEnv as r };
@@ -0,0 +1,59 @@
1
+ import { I as EnvLike } from './athena-request-headers-C7Jy-c_D.js';
2
+
3
+ /**
4
+ * Request header / Next.js helpers used by middleware and RSC session loaders.
5
+ * Framework-agnostic (no Next imports).
6
+ */
7
+ /**
8
+ * True when Next.js threw because the route used dynamic APIs during static
9
+ * generation (`DYNAMIC_SERVER_USAGE` digest or matching message).
10
+ *
11
+ * Catch and rethrow (or handle) so Next can mark the route dynamic.
12
+ */
13
+ declare function isDynamicServerUsageError(error: unknown): boolean;
14
+ interface GetOriginFromHeadersOptions {
15
+ /**
16
+ * When `x-forwarded-proto` / scheme is missing, use `http` if true else `https`.
17
+ * Typical: `process.env.NODE_ENV !== "production"`.
18
+ */
19
+ preferHttpWhenMissingProto?: boolean;
20
+ }
21
+ /**
22
+ * Reconstruct public origin from request headers (Origin, or Host + proto).
23
+ *
24
+ * Prefers `Origin`, then `x-forwarded-host` / `host` with
25
+ * `x-forwarded-proto` (first value when comma-separated).
26
+ */
27
+ declare function getOriginFromHeaders(headersList: {
28
+ get: (name: string) => string | null;
29
+ }, options?: GetOriginFromHeadersOptions): string | null;
30
+
31
+ /**
32
+ * Read the first non-empty trimmed environment variable from a name list.
33
+ *
34
+ * @param names - Candidate env keys in priority order
35
+ * @param env - Optional env map (defaults to `process.env`)
36
+ * @returns Trimmed value of the first key that is set and non-empty
37
+ * @throws {Error} When none of the keys yield a non-empty value
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { requireEnv } from "@xylex-group/athena/utils"
42
+ *
43
+ * const authUrl = requireEnv([
44
+ * "ATHENA_AUTH_UPSTREAM_URL",
45
+ * "ATHENA_AUTH_URL",
46
+ * "NEXT_PUBLIC_ATHENA_AUTH_URL",
47
+ * ])
48
+ * ```
49
+ */
50
+ declare function requireEnv(names: readonly string[], env?: EnvLike): string;
51
+ /**
52
+ * Like {@link requireEnv}, but returns `undefined` instead of throwing when
53
+ * none of the keys are set.
54
+ */
55
+ declare function readEnv(names: readonly string[], env?: EnvLike): string | undefined;
56
+
57
+ declare function proxyRequestHeaders(request: Request): Headers;
58
+
59
+ export { type GetOriginFromHeadersOptions as G, requireEnv as a, getOriginFromHeaders as g, isDynamicServerUsageError as i, proxyRequestHeaders as p, readEnv as r };
package/dist/react.cjs CHANGED
@@ -86,7 +86,7 @@ function isAthenaGatewayError(error) {
86
86
  }
87
87
 
88
88
  // src/gateway/url.ts
89
- var ATHENA_DEFAULT_BASE_URL = "https://athena-db.com";
89
+ var ATHENA_DEFAULT_BASE_URL = "https://mirror2.athena-cluster.com";
90
90
  function describeReceivedValue(value) {
91
91
  if (value === void 0) return "undefined";
92
92
  if (value === null) return "null";
@@ -109,14 +109,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
109
109
  if (candidate === void 0 || candidate === null) {
110
110
  throw invalidBaseUrlError(
111
111
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
112
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
112
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
113
113
  );
114
114
  }
115
115
  const trimmed = candidate.trim();
116
116
  if (!trimmed) {
117
117
  throw invalidBaseUrlError(
118
118
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
119
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
119
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
120
120
  );
121
121
  }
122
122
  let parsed;
@@ -125,13 +125,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
125
125
  } catch {
126
126
  throw invalidBaseUrlError(
127
127
  `${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
128
- 'Use a full URL including the protocol, for example "https://mirror3.athena-db.com".'
128
+ 'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
129
129
  );
130
130
  }
131
131
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
132
132
  throw invalidBaseUrlError(
133
133
  `${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
134
- 'Use an Athena gateway URL such as "https://mirror3.athena-db.com".'
134
+ 'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
135
135
  );
136
136
  }
137
137
  if (parsed.search || parsed.hash) {
@@ -413,7 +413,7 @@ function buildAthenaRequestHeaders(input) {
413
413
 
414
414
  // package.json
415
415
  var package_default = {
416
- version: "3.0.0"
416
+ version: "3.0.2"
417
417
  };
418
418
 
419
419
  // src/sdk-version.ts
@@ -423,7 +423,7 @@ function buildSdkHeaderValue(sdkName) {
423
423
  }
424
424
 
425
425
  // src/gateway/client.ts
426
- var DEFAULT_CLIENT = "railway_direct";
426
+ var DEFAULT_CLIENT = "DEFAULT_CLIENT";
427
427
  var SDK_NAME = "xylex-group/athena";
428
428
  var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
429
429
  function parseResponseBody(rawText, contentType) {