@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
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @xylex-group/athena
2
2
 
3
- current version: `3.0.0`
3
+ current version: `3.0.2`
4
4
  Athena JS 3 is the runtime-neutral TypeScript SDK for Athena database, authentication, chat, and storage services.
5
5
 
6
6
  ## Install
@@ -30,6 +30,7 @@ athena.db
30
30
  athena.auth
31
31
  athena.chat
32
32
  athena.storage
33
+ athena.billing
33
34
  ```
34
35
 
35
36
  The root retains common database shortcuts:
@@ -132,26 +133,39 @@ Header precedence is client headers, configured context, `withContext`, then ope
132
133
 
133
134
  ## Next.js
134
135
 
135
- ```ts
136
- import { createClient } from '@xylex-group/athena'
137
- import { resolveNextRequestContext } from '@xylex-group/athena/next/server'
136
+ Thin façades on `@xylex-group/athena/next/client` and `.../next/server` adapt
137
+ browser-safe config or request context, then call `createClient`. Full guide:
138
+ [docs/next-js.md](./docs/next-js.md).
138
139
 
139
- export const athena = createClient({ env: process.env })
140
+ ```ts
141
+ // Client Components
142
+ import { createAthenaBrowserClient } from '@xylex-group/athena/next/client'
143
+ export const athena = createAthenaBrowserClient({
144
+ url: process.env.NEXT_PUBLIC_ATHENA_URL!,
145
+ key: process.env.NEXT_PUBLIC_ATHENA_PUBLISHABLE_KEY!,
146
+ })
140
147
 
141
- export async function athenaForRequest() {
142
- return athena.withContext(await resolveNextRequestContext())
148
+ // Server Components / Actions / Route Handlers
149
+ import { createAthenaServerClient } from '@xylex-group/athena/next/server'
150
+ export function createServerAthena() {
151
+ return createAthenaServerClient({
152
+ url: process.env.ATHENA_URL!,
153
+ key: process.env.ATHENA_API_KEY!,
154
+ })
143
155
  }
156
+ const athena = await createServerAthena()
144
157
  ```
145
158
 
146
- Next subpaths provide request-context and session-bridge helpers. They do not construct clients.
147
-
148
159
  ## Documentation
149
160
 
161
+ - [Docs index](./docs/index.md) — tracks for runtime, Next, auth, types, generator
150
162
  - [Getting started](./docs/getting-started.md)
163
+ - [Next.js integration](./docs/next-js.md)
151
164
  - [API reference](./docs/api-reference.md)
152
165
  - [Complete generated method reference](./docs/complete-method-reference.md)
153
166
  - [Typed schema registry](./docs/typed-schema-registry.md)
154
167
  - [v2.16.0 to v3.0.0 migration](./docs/migration-v2-to-v3.md)
155
168
  - [Client internal architecture](./docs/client-internal-architecture.md)
156
- - [Accepted ADR catalog](./docs/adr/README.md)
169
+ - [Site dual-publish (package → apps/docs)](./docs/site-publish.md)
170
+ - [Accepted ADR catalog](./docs/adr/README.md) (includes [ADR 0014](./docs/adr/0014-next-client-construction-facades.md))
157
171
  - [3.0 release readiness](./docs/client-v3-release-readiness-report.md)
@@ -1,3 +1,5 @@
1
+ import { t as BackendOption } from './types-Bltx6iL6.js';
2
+
1
3
  /**
2
4
  * Cookie name prefixes treated as Athena Auth / Better Auth session material.
3
5
  *
@@ -374,4 +376,86 @@ declare function resolveEmailVerificationCallbackUrl(rawBaseUrl?: string | EnvLi
374
376
  */
375
377
  declare function createFreshSessionLookupUrl(baseUrl: string | URL): URL;
376
378
 
377
- export { ATHENA_AUTH_COOKIE_PREFIXES as A, AUTH_SESSION_PATH as B, type ClearAuthCookiesOptions as C, DEFAULT_ATHENA_AUTH_ORIGIN as D, type EnvLike as E, AUTH_TWO_FACTOR_SEGMENT as F, type AthenaAuthClientBaseUrlOptions as G, type AthenaAuthUpstreamEnv as H, type AthenaAuthUpstreamEnvKey as I, type AuthMode as J, type AuthModeRedirects as K, type AuthRoutes as L, DEFAULT_ATHENA_AUTH_UPSTREAM_URL as M, DEFAULT_AUTH_COOKIE_PREFIXES as N, DISABLE_COOKIE_CACHE_QUERY_PARAM as O, DISABLE_COOKIE_CACHE_QUERY_VALUE as P, LOCAL_DEV_ORIGIN as Q, createAuthModeRedirects as R, SESSION_DATA_HEADER as S, createAuthRoutes as T, createFreshSessionLookupUrl as U, isAuthMode as V, readAthenaAuthUpstreamUrlFromEnv as W, resolveAuthModeRedirect as X, shouldRedirectAuthenticatedAuthMode as Y, ATHENA_AUTH_PATH as a, ATHENA_AUTH_UPSTREAM_ENV_KEYS as b, ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES as c, AUTH_DEFAULT_VIEW as d, AUTH_ROUTES as e, AUTH_VIEW_BY_SEGMENT as f, type AuthView as g, clearAuthCookies as h, isAbsoluteUrl as i, resolveAthenaAuthRequestUrl as j, resolveAthenaAuthUpstreamUrl as k, resolveAuthViewFromSegment as l, resolveEmailVerificationCallbackUrl as m, normalizeAthenaAuthBaseUrl as n, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM as o, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE as p, ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH as q, resolveAthenaAuthClientBaseUrl as r, shouldRedirectAuthenticatedAuthView as s, ATHENA_AUTH_GET_SESSION_PATH as t, ATHENA_AUTH_VERIFY_EMAIL_PATH as u, ATHENA_SESSION_DATA_HEADER as v, AUTHENTICATED_REDIRECT_MODE_SET as w, AUTHENTICATED_REDIRECT_VIEW_SET as x, AUTH_MODE_REDIRECTS as y, AUTH_MODE_SET as z };
379
+ declare function asString(value: unknown): string | null;
380
+ declare function asBoolean(value: unknown): boolean;
381
+ declare function asBooleanOrNull(value: unknown): boolean | null;
382
+ declare function asRecord(value: unknown): Record<string, unknown> | null;
383
+ declare function asIdentifier(value: unknown): string | null;
384
+ declare function firstString(record: Record<string, unknown> | null | undefined, keys: readonly string[]): string | null;
385
+ declare function readTrimmedString(value: unknown): string | null;
386
+ /**
387
+ * Trim a string value; return `undefined` when not a non-empty string.
388
+ *
389
+ * Unlike {@link asString}, does not coerce numbers/bigints.
390
+ * Unlike {@link readTrimmedString}, returns `undefined` instead of `null`
391
+ * (handy for optional fields and `??` defaults).
392
+ */
393
+ declare function asNonEmptyString(value: unknown): string | undefined;
394
+ declare function asNumber(value: unknown): number | null;
395
+ declare function asStringArray(value: unknown): string[];
396
+
397
+ type AthenaRequestHeaderProfile = 'gateway' | 'auth' | 'chat' | 'storage' | 'minimal';
398
+ interface BuildAthenaRequestHeadersInput {
399
+ profile: AthenaRequestHeaderProfile;
400
+ sdkHeaderValue: string;
401
+ apiKey?: string | null;
402
+ client?: string | null;
403
+ userId?: string | null;
404
+ organizationId?: string | null;
405
+ backend?: BackendOption;
406
+ publishEvent?: string | null;
407
+ stripNulls?: boolean;
408
+ bearerToken?: string | null;
409
+ cookie?: string | null;
410
+ sessionToken?: string | null;
411
+ pgUri?: string | null;
412
+ jdbcUrl?: string | null;
413
+ forceNoCache?: boolean;
414
+ configHeaders?: Record<string, string>;
415
+ callHeaders?: Record<string, string>;
416
+ contentType?: string | null;
417
+ accept?: string | null;
418
+ }
419
+ /** Shared config/call fields consumed by gateway, chat, auth, and `client.request(...)`. */
420
+ interface AthenaRequestHeaderOverrideFields {
421
+ apiKey?: string | null;
422
+ client?: string | null;
423
+ userId?: string | null;
424
+ organizationId?: string | null;
425
+ backend?: BackendOption;
426
+ publishEvent?: string | null;
427
+ stripNulls?: boolean;
428
+ bearerToken?: string | null;
429
+ cookie?: string | null;
430
+ sessionToken?: string | null;
431
+ pgUri?: string | null;
432
+ jdbcUrl?: string | null;
433
+ forceNoCache?: boolean;
434
+ headers?: Record<string, string>;
435
+ }
436
+ type ResolvedRequestHeaderOverrides = Omit<BuildAthenaRequestHeadersInput, 'profile' | 'sdkHeaderValue' | 'contentType' | 'accept'>;
437
+ declare function hasHeaderIgnoreCase(headers: Record<string, string>, targetKey: string): boolean;
438
+ declare function resolveHeaderValue(headers: Record<string, string>, candidates: readonly string[]): string | undefined;
439
+ declare function resolveRequestHeaderOverrides(config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, defaults?: Pick<AthenaRequestHeaderOverrideFields, 'client' | 'stripNulls'>): ResolvedRequestHeaderOverrides;
440
+ declare function buildServiceRequestHeaders(profile: Exclude<AthenaRequestHeaderProfile, 'minimal'>, sdkHeaderValue: string, config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, extras?: Pick<BuildAthenaRequestHeadersInput, 'contentType' | 'accept'> & {
441
+ client?: string | null;
442
+ stripNulls?: boolean;
443
+ }): Record<string, string>;
444
+ declare function applyAthenaApiKeyHeaders(headers: Record<string, string>, apiKey?: string | null): void;
445
+ declare function applyAthenaAuthContextHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'bearerToken' | 'cookie' | 'sessionToken' | 'profile' | 'configHeaders' | 'callHeaders'>): void;
446
+ declare function applyAthenaPgUriHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'pgUri' | 'jdbcUrl' | 'configHeaders' | 'callHeaders'>): void;
447
+ /**
448
+ * Minimal gateway/data request headers used by many apps before they adopt
449
+ * the full {@link buildAthenaRequestHeaders} profile model.
450
+ *
451
+ * Additive convenience — does not replace client-built headers. Prefer
452
+ * `createClient({ client, key })` so the SDK sets these on every call.
453
+ */
454
+ declare function buildAthenaGatewayHeaders(input: {
455
+ clientName?: string | null;
456
+ gatewayKey?: string | null;
457
+ headers?: Record<string, string | null | undefined>;
458
+ }): Record<string, string>;
459
+ declare function buildAthenaRequestHeaders(input: BuildAthenaRequestHeadersInput): Record<string, string>;
460
+
461
+ export { resolveAuthModeRedirect as $, ATHENA_AUTH_COOKIE_PREFIXES as A, type AuthView as B, type BuildAthenaRequestHeadersInput as C, type ClearAuthCookiesOptions as D, DEFAULT_ATHENA_AUTH_ORIGIN as E, DEFAULT_ATHENA_AUTH_UPSTREAM_URL as F, DISABLE_COOKIE_CACHE_QUERY_PARAM as G, DISABLE_COOKIE_CACHE_QUERY_VALUE as H, type EnvLike as I, asNonEmptyString as J, asString as K, LOCAL_DEV_ORIGIN as L, buildAthenaGatewayHeaders as M, buildAthenaRequestHeaders as N, clearAuthCookies as O, createAuthModeRedirects as P, createAuthRoutes as Q, createFreshSessionLookupUrl as R, SESSION_DATA_HEADER as S, isAbsoluteUrl as T, isAuthMode as U, normalizeAthenaAuthBaseUrl as V, readAthenaAuthUpstreamUrlFromEnv as W, readTrimmedString as X, resolveAthenaAuthClientBaseUrl as Y, resolveAthenaAuthRequestUrl as Z, resolveAthenaAuthUpstreamUrl as _, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM as a, resolveAuthViewFromSegment as a0, resolveEmailVerificationCallbackUrl as a1, shouldRedirectAuthenticatedAuthMode as a2, shouldRedirectAuthenticatedAuthView as a3, type ResolvedRequestHeaderOverrides as a4, applyAthenaApiKeyHeaders as a5, applyAthenaAuthContextHeaders as a6, applyAthenaPgUriHeaders as a7, buildServiceRequestHeaders as a8, hasHeaderIgnoreCase as a9, resolveHeaderValue as aa, resolveRequestHeaderOverrides as ab, DEFAULT_AUTH_COOKIE_PREFIXES as ac, asBoolean as ad, asBooleanOrNull as ae, asIdentifier as af, asNumber as ag, asRecord as ah, asStringArray as ai, firstString as aj, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE as b, ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH as c, ATHENA_AUTH_GET_SESSION_PATH as d, ATHENA_AUTH_PATH as e, ATHENA_AUTH_UPSTREAM_ENV_KEYS as f, ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES as g, ATHENA_AUTH_VERIFY_EMAIL_PATH as h, ATHENA_SESSION_DATA_HEADER as i, AUTHENTICATED_REDIRECT_MODE_SET as j, AUTHENTICATED_REDIRECT_VIEW_SET as k, AUTH_DEFAULT_VIEW as l, AUTH_MODE_REDIRECTS as m, AUTH_MODE_SET as n, AUTH_ROUTES as o, AUTH_SESSION_PATH as p, AUTH_TWO_FACTOR_SEGMENT as q, AUTH_VIEW_BY_SEGMENT as r, type AthenaAuthClientBaseUrlOptions as s, type AthenaAuthUpstreamEnv as t, type AthenaAuthUpstreamEnvKey as u, type AthenaRequestHeaderOverrideFields as v, type AthenaRequestHeaderProfile as w, type AuthMode as x, type AuthModeRedirects as y, type AuthRoutes as z };
@@ -1,3 +1,5 @@
1
+ import { t as BackendOption } from './types-Bltx6iL6.cjs';
2
+
1
3
  /**
2
4
  * Cookie name prefixes treated as Athena Auth / Better Auth session material.
3
5
  *
@@ -374,4 +376,86 @@ declare function resolveEmailVerificationCallbackUrl(rawBaseUrl?: string | EnvLi
374
376
  */
375
377
  declare function createFreshSessionLookupUrl(baseUrl: string | URL): URL;
376
378
 
377
- export { ATHENA_AUTH_COOKIE_PREFIXES as A, AUTH_SESSION_PATH as B, type ClearAuthCookiesOptions as C, DEFAULT_ATHENA_AUTH_ORIGIN as D, type EnvLike as E, AUTH_TWO_FACTOR_SEGMENT as F, type AthenaAuthClientBaseUrlOptions as G, type AthenaAuthUpstreamEnv as H, type AthenaAuthUpstreamEnvKey as I, type AuthMode as J, type AuthModeRedirects as K, type AuthRoutes as L, DEFAULT_ATHENA_AUTH_UPSTREAM_URL as M, DEFAULT_AUTH_COOKIE_PREFIXES as N, DISABLE_COOKIE_CACHE_QUERY_PARAM as O, DISABLE_COOKIE_CACHE_QUERY_VALUE as P, LOCAL_DEV_ORIGIN as Q, createAuthModeRedirects as R, SESSION_DATA_HEADER as S, createAuthRoutes as T, createFreshSessionLookupUrl as U, isAuthMode as V, readAthenaAuthUpstreamUrlFromEnv as W, resolveAuthModeRedirect as X, shouldRedirectAuthenticatedAuthMode as Y, ATHENA_AUTH_PATH as a, ATHENA_AUTH_UPSTREAM_ENV_KEYS as b, ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES as c, AUTH_DEFAULT_VIEW as d, AUTH_ROUTES as e, AUTH_VIEW_BY_SEGMENT as f, type AuthView as g, clearAuthCookies as h, isAbsoluteUrl as i, resolveAthenaAuthRequestUrl as j, resolveAthenaAuthUpstreamUrl as k, resolveAuthViewFromSegment as l, resolveEmailVerificationCallbackUrl as m, normalizeAthenaAuthBaseUrl as n, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM as o, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE as p, ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH as q, resolveAthenaAuthClientBaseUrl as r, shouldRedirectAuthenticatedAuthView as s, ATHENA_AUTH_GET_SESSION_PATH as t, ATHENA_AUTH_VERIFY_EMAIL_PATH as u, ATHENA_SESSION_DATA_HEADER as v, AUTHENTICATED_REDIRECT_MODE_SET as w, AUTHENTICATED_REDIRECT_VIEW_SET as x, AUTH_MODE_REDIRECTS as y, AUTH_MODE_SET as z };
379
+ declare function asString(value: unknown): string | null;
380
+ declare function asBoolean(value: unknown): boolean;
381
+ declare function asBooleanOrNull(value: unknown): boolean | null;
382
+ declare function asRecord(value: unknown): Record<string, unknown> | null;
383
+ declare function asIdentifier(value: unknown): string | null;
384
+ declare function firstString(record: Record<string, unknown> | null | undefined, keys: readonly string[]): string | null;
385
+ declare function readTrimmedString(value: unknown): string | null;
386
+ /**
387
+ * Trim a string value; return `undefined` when not a non-empty string.
388
+ *
389
+ * Unlike {@link asString}, does not coerce numbers/bigints.
390
+ * Unlike {@link readTrimmedString}, returns `undefined` instead of `null`
391
+ * (handy for optional fields and `??` defaults).
392
+ */
393
+ declare function asNonEmptyString(value: unknown): string | undefined;
394
+ declare function asNumber(value: unknown): number | null;
395
+ declare function asStringArray(value: unknown): string[];
396
+
397
+ type AthenaRequestHeaderProfile = 'gateway' | 'auth' | 'chat' | 'storage' | 'minimal';
398
+ interface BuildAthenaRequestHeadersInput {
399
+ profile: AthenaRequestHeaderProfile;
400
+ sdkHeaderValue: string;
401
+ apiKey?: string | null;
402
+ client?: string | null;
403
+ userId?: string | null;
404
+ organizationId?: string | null;
405
+ backend?: BackendOption;
406
+ publishEvent?: string | null;
407
+ stripNulls?: boolean;
408
+ bearerToken?: string | null;
409
+ cookie?: string | null;
410
+ sessionToken?: string | null;
411
+ pgUri?: string | null;
412
+ jdbcUrl?: string | null;
413
+ forceNoCache?: boolean;
414
+ configHeaders?: Record<string, string>;
415
+ callHeaders?: Record<string, string>;
416
+ contentType?: string | null;
417
+ accept?: string | null;
418
+ }
419
+ /** Shared config/call fields consumed by gateway, chat, auth, and `client.request(...)`. */
420
+ interface AthenaRequestHeaderOverrideFields {
421
+ apiKey?: string | null;
422
+ client?: string | null;
423
+ userId?: string | null;
424
+ organizationId?: string | null;
425
+ backend?: BackendOption;
426
+ publishEvent?: string | null;
427
+ stripNulls?: boolean;
428
+ bearerToken?: string | null;
429
+ cookie?: string | null;
430
+ sessionToken?: string | null;
431
+ pgUri?: string | null;
432
+ jdbcUrl?: string | null;
433
+ forceNoCache?: boolean;
434
+ headers?: Record<string, string>;
435
+ }
436
+ type ResolvedRequestHeaderOverrides = Omit<BuildAthenaRequestHeadersInput, 'profile' | 'sdkHeaderValue' | 'contentType' | 'accept'>;
437
+ declare function hasHeaderIgnoreCase(headers: Record<string, string>, targetKey: string): boolean;
438
+ declare function resolveHeaderValue(headers: Record<string, string>, candidates: readonly string[]): string | undefined;
439
+ declare function resolveRequestHeaderOverrides(config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, defaults?: Pick<AthenaRequestHeaderOverrideFields, 'client' | 'stripNulls'>): ResolvedRequestHeaderOverrides;
440
+ declare function buildServiceRequestHeaders(profile: Exclude<AthenaRequestHeaderProfile, 'minimal'>, sdkHeaderValue: string, config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, extras?: Pick<BuildAthenaRequestHeadersInput, 'contentType' | 'accept'> & {
441
+ client?: string | null;
442
+ stripNulls?: boolean;
443
+ }): Record<string, string>;
444
+ declare function applyAthenaApiKeyHeaders(headers: Record<string, string>, apiKey?: string | null): void;
445
+ declare function applyAthenaAuthContextHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'bearerToken' | 'cookie' | 'sessionToken' | 'profile' | 'configHeaders' | 'callHeaders'>): void;
446
+ declare function applyAthenaPgUriHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'pgUri' | 'jdbcUrl' | 'configHeaders' | 'callHeaders'>): void;
447
+ /**
448
+ * Minimal gateway/data request headers used by many apps before they adopt
449
+ * the full {@link buildAthenaRequestHeaders} profile model.
450
+ *
451
+ * Additive convenience — does not replace client-built headers. Prefer
452
+ * `createClient({ client, key })` so the SDK sets these on every call.
453
+ */
454
+ declare function buildAthenaGatewayHeaders(input: {
455
+ clientName?: string | null;
456
+ gatewayKey?: string | null;
457
+ headers?: Record<string, string | null | undefined>;
458
+ }): Record<string, string>;
459
+ declare function buildAthenaRequestHeaders(input: BuildAthenaRequestHeadersInput): Record<string, string>;
460
+
461
+ export { resolveAuthModeRedirect as $, ATHENA_AUTH_COOKIE_PREFIXES as A, type AuthView as B, type BuildAthenaRequestHeadersInput as C, type ClearAuthCookiesOptions as D, DEFAULT_ATHENA_AUTH_ORIGIN as E, DEFAULT_ATHENA_AUTH_UPSTREAM_URL as F, DISABLE_COOKIE_CACHE_QUERY_PARAM as G, DISABLE_COOKIE_CACHE_QUERY_VALUE as H, type EnvLike as I, asNonEmptyString as J, asString as K, LOCAL_DEV_ORIGIN as L, buildAthenaGatewayHeaders as M, buildAthenaRequestHeaders as N, clearAuthCookies as O, createAuthModeRedirects as P, createAuthRoutes as Q, createFreshSessionLookupUrl as R, SESSION_DATA_HEADER as S, isAbsoluteUrl as T, isAuthMode as U, normalizeAthenaAuthBaseUrl as V, readAthenaAuthUpstreamUrlFromEnv as W, readTrimmedString as X, resolveAthenaAuthClientBaseUrl as Y, resolveAthenaAuthRequestUrl as Z, resolveAthenaAuthUpstreamUrl as _, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM as a, resolveAuthViewFromSegment as a0, resolveEmailVerificationCallbackUrl as a1, shouldRedirectAuthenticatedAuthMode as a2, shouldRedirectAuthenticatedAuthView as a3, type ResolvedRequestHeaderOverrides as a4, applyAthenaApiKeyHeaders as a5, applyAthenaAuthContextHeaders as a6, applyAthenaPgUriHeaders as a7, buildServiceRequestHeaders as a8, hasHeaderIgnoreCase as a9, resolveHeaderValue as aa, resolveRequestHeaderOverrides as ab, DEFAULT_AUTH_COOKIE_PREFIXES as ac, asBoolean as ad, asBooleanOrNull as ae, asIdentifier as af, asNumber as ag, asRecord as ah, asStringArray as ai, firstString as aj, ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE as b, ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH as c, ATHENA_AUTH_GET_SESSION_PATH as d, ATHENA_AUTH_PATH as e, ATHENA_AUTH_UPSTREAM_ENV_KEYS as f, ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES as g, ATHENA_AUTH_VERIFY_EMAIL_PATH as h, ATHENA_SESSION_DATA_HEADER as i, AUTHENTICATED_REDIRECT_MODE_SET as j, AUTHENTICATED_REDIRECT_VIEW_SET as k, AUTH_DEFAULT_VIEW as l, AUTH_MODE_REDIRECTS as m, AUTH_MODE_SET as n, AUTH_ROUTES as o, AUTH_SESSION_PATH as p, AUTH_TWO_FACTOR_SEGMENT as q, AUTH_VIEW_BY_SEGMENT as r, type AthenaAuthClientBaseUrlOptions as s, type AthenaAuthUpstreamEnv as t, type AthenaAuthUpstreamEnvKey as u, type AthenaRequestHeaderOverrideFields as v, type AthenaRequestHeaderProfile as w, type AuthMode as x, type AuthModeRedirects as y, type AuthRoutes as z };
package/dist/billing.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // package.json
4
4
  var package_default = {
5
- version: "3.0.0"
5
+ version: "3.0.2"
6
6
  };
7
7
 
8
8
  // src/sdk-version.ts
@@ -318,14 +318,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
318
318
  if (candidate === void 0 || candidate === null) {
319
319
  throw invalidBaseUrlError(
320
320
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
321
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
321
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
322
322
  );
323
323
  }
324
324
  const trimmed = candidate.trim();
325
325
  if (!trimmed) {
326
326
  throw invalidBaseUrlError(
327
327
  `${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
328
- 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror3.athena-db.com".'
328
+ 'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
329
329
  );
330
330
  }
331
331
  let parsed;
@@ -334,13 +334,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
334
334
  } catch {
335
335
  throw invalidBaseUrlError(
336
336
  `${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
337
- 'Use a full URL including the protocol, for example "https://mirror3.athena-db.com".'
337
+ 'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
338
338
  );
339
339
  }
340
340
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
341
341
  throw invalidBaseUrlError(
342
342
  `${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
343
- 'Use an Athena gateway URL such as "https://mirror3.athena-db.com".'
343
+ 'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
344
344
  );
345
345
  }
346
346
  if (parsed.search || parsed.hash) {
@@ -375,6 +375,8 @@ var billingSdkManifest = {
375
375
  methods: [
376
376
  { name: "getCapabilities", method: "GET", path: "/billing/v1/capabilities" },
377
377
  { name: "createCheckout", method: "POST", path: "/billing/v1/checkouts" },
378
+ { name: "listProducts", method: "GET", path: "/billing/v1/products" },
379
+ { name: "listPrices", method: "GET", path: "/billing/v1/prices" },
378
380
  { name: "listCustomers", method: "GET", path: "/billing/v1/customers" },
379
381
  { name: "createCustomer", method: "POST", path: "/billing/v1/customers" },
380
382
  { name: "getCustomer", method: "GET", path: "/billing/v1/customers/{id}" },
@@ -400,6 +402,12 @@ var billingSdkManifest = {
400
402
  { name: "cancelSubscription", method: "POST", path: "/billing/v1/subscriptions/{id}/cancel" },
401
403
  { name: "listInvoices", method: "GET", path: "/billing/v1/invoices" },
402
404
  { name: "getInvoice", method: "GET", path: "/billing/v1/invoices/{id}" },
405
+ { name: "listWebhooks", method: "GET", path: "/billing/v1/webhooks" },
406
+ { name: "createWebhook", method: "POST", path: "/billing/v1/webhooks" },
407
+ { name: "getWebhook", method: "GET", path: "/billing/v1/webhooks/{id}" },
408
+ { name: "updateWebhook", method: "PATCH", path: "/billing/v1/webhooks/{id}" },
409
+ { name: "deleteWebhook", method: "DELETE", path: "/billing/v1/webhooks/{id}" },
410
+ { name: "testWebhook", method: "POST", path: "/billing/v1/webhooks/{id}/test" },
403
411
  {
404
412
  name: "listConnections",
405
413
  method: "GET",
@@ -568,6 +576,25 @@ function createBillingModule(config) {
568
576
  createCheckout(body, options) {
569
577
  return call("POST", "/billing/v1/checkouts", body, options);
570
578
  },
579
+ listProducts(input, options) {
580
+ return call(
581
+ "GET",
582
+ appendQuery("/billing/v1/products", connectionQuery(input)),
583
+ void 0,
584
+ options
585
+ );
586
+ },
587
+ listPrices(input, options) {
588
+ return call(
589
+ "GET",
590
+ appendQuery("/billing/v1/prices", {
591
+ ...connectionQuery(input),
592
+ ...input.productId ? { productId: input.productId } : {}
593
+ }),
594
+ void 0,
595
+ options
596
+ );
597
+ },
571
598
  listCustomers(input, options) {
572
599
  return call(
573
600
  "GET",
@@ -714,10 +741,7 @@ function createBillingModule(config) {
714
741
  getRefund(id, input, options) {
715
742
  return call(
716
743
  "GET",
717
- appendQuery(withPathParam("/billing/v1/refunds/{id}", "id", id), {
718
- ...connectionQuery(input),
719
- ...input.paymentId ? { paymentId: input.paymentId } : {}
720
- }),
744
+ appendQuery(withPathParam("/billing/v1/refunds/{id}", "id", id), connectionQuery(input)),
721
745
  void 0,
722
746
  options
723
747
  );
@@ -725,10 +749,7 @@ function createBillingModule(config) {
725
749
  cancelRefund(id, input, options) {
726
750
  return call(
727
751
  "POST",
728
- appendQuery(withPathParam("/billing/v1/refunds/{id}/cancel", "id", id), {
729
- ...connectionQuery(input),
730
- ...input.paymentId ? { paymentId: input.paymentId } : {}
731
- }),
752
+ appendQuery(withPathParam("/billing/v1/refunds/{id}/cancel", "id", id), connectionQuery(input)),
732
753
  {},
733
754
  options
734
755
  );
@@ -747,10 +768,10 @@ function createBillingModule(config) {
747
768
  getSubscription(id, input, options) {
748
769
  return call(
749
770
  "GET",
750
- appendQuery(withPathParam("/billing/v1/subscriptions/{id}", "id", id), {
751
- ...connectionQuery(input),
752
- ...input.customerId ? { customerId: input.customerId } : {}
753
- }),
771
+ appendQuery(
772
+ withPathParam("/billing/v1/subscriptions/{id}", "id", id),
773
+ connectionQuery(input)
774
+ ),
754
775
  void 0,
755
776
  options
756
777
  );
@@ -766,10 +787,10 @@ function createBillingModule(config) {
766
787
  cancelSubscription(id, input, options) {
767
788
  return call(
768
789
  "POST",
769
- appendQuery(withPathParam("/billing/v1/subscriptions/{id}/cancel", "id", id), {
770
- ...connectionQuery(input),
771
- customerId: input.customerId
772
- }),
790
+ appendQuery(
791
+ withPathParam("/billing/v1/subscriptions/{id}/cancel", "id", id),
792
+ connectionQuery(input)
793
+ ),
773
794
  {},
774
795
  options
775
796
  );
@@ -793,6 +814,57 @@ function createBillingModule(config) {
793
814
  options
794
815
  );
795
816
  },
817
+ listWebhooks(input, options) {
818
+ return call(
819
+ "GET",
820
+ appendQuery("/billing/v1/webhooks", connectionQuery(input)),
821
+ void 0,
822
+ options
823
+ );
824
+ },
825
+ createWebhook(input, body, options) {
826
+ return call(
827
+ "POST",
828
+ appendQuery("/billing/v1/webhooks", connectionQuery(input)),
829
+ body,
830
+ options
831
+ );
832
+ },
833
+ getWebhook(id, input, options) {
834
+ return call(
835
+ "GET",
836
+ appendQuery(withPathParam("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
837
+ void 0,
838
+ options
839
+ );
840
+ },
841
+ updateWebhook(id, input, body, options) {
842
+ return call(
843
+ "PATCH",
844
+ appendQuery(withPathParam("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
845
+ body,
846
+ options
847
+ );
848
+ },
849
+ deleteWebhook(id, input, options) {
850
+ return call(
851
+ "DELETE",
852
+ appendQuery(withPathParam("/billing/v1/webhooks/{id}", "id", id), connectionQuery(input)),
853
+ void 0,
854
+ options
855
+ );
856
+ },
857
+ testWebhook(id, input, options) {
858
+ return call(
859
+ "POST",
860
+ appendQuery(
861
+ withPathParam("/billing/v1/webhooks/{id}/test", "id", id),
862
+ connectionQuery(input)
863
+ ),
864
+ {},
865
+ options
866
+ );
867
+ },
796
868
  listConnections(clientName, options) {
797
869
  return call(
798
870
  "GET",
@@ -1051,6 +1123,16 @@ var live_http_routes_default = {
1051
1123
  path: "/billing/v1/checkouts",
1052
1124
  surface: "billingV1"
1053
1125
  },
1126
+ {
1127
+ method: "GET",
1128
+ path: "/billing/v1/products",
1129
+ surface: "billingV1"
1130
+ },
1131
+ {
1132
+ method: "GET",
1133
+ path: "/billing/v1/prices",
1134
+ surface: "billingV1"
1135
+ },
1054
1136
  {
1055
1137
  method: "GET",
1056
1138
  path: "/billing/v1/customers",
@@ -1176,6 +1258,36 @@ var live_http_routes_default = {
1176
1258
  path: "/billing/v1/subscriptions/{id}/cancel",
1177
1259
  surface: "billingV1"
1178
1260
  },
1261
+ {
1262
+ method: "GET",
1263
+ path: "/billing/v1/webhooks",
1264
+ surface: "billingV1"
1265
+ },
1266
+ {
1267
+ method: "POST",
1268
+ path: "/billing/v1/webhooks",
1269
+ surface: "billingV1"
1270
+ },
1271
+ {
1272
+ method: "DELETE",
1273
+ path: "/billing/v1/webhooks/{id}",
1274
+ surface: "billingV1"
1275
+ },
1276
+ {
1277
+ method: "GET",
1278
+ path: "/billing/v1/webhooks/{id}",
1279
+ surface: "billingV1"
1280
+ },
1281
+ {
1282
+ method: "PATCH",
1283
+ path: "/billing/v1/webhooks/{id}",
1284
+ surface: "billingV1"
1285
+ },
1286
+ {
1287
+ method: "POST",
1288
+ path: "/billing/v1/webhooks/{id}/test",
1289
+ surface: "billingV1"
1290
+ },
1179
1291
  {
1180
1292
  method: "GET",
1181
1293
  path: "/debug/billing",