@xylex-group/athena 3.1.0 → 3.3.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.
- package/README.md +1 -1
- package/dist/admin.cjs +55 -1
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +32 -8
- package/dist/admin.d.ts +32 -8
- package/dist/admin.js +54 -2
- package/dist/admin.js.map +1 -1
- package/dist/athena-auth-url-C1FbVmN6.d.cts +200 -0
- package/dist/athena-auth-url-C1FbVmN6.d.ts +200 -0
- package/dist/{athena-request-headers-C7Jy-c_D.d.ts → athena-request-headers-DzimbvOA.d.ts} +48 -200
- package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Lr_m8xCV.d.cts} +48 -200
- package/dist/billing.cjs +1 -1
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.js +1 -1
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +602 -16
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +593 -17
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +141 -6
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +141 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/env.cjs +130 -0
- package/dist/env.cjs.map +1 -0
- package/dist/env.d.cts +70 -0
- package/dist/env.d.ts +70 -0
- package/dist/env.js +122 -0
- package/dist/env.js.map +1 -0
- package/dist/index.cjs +624 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +615 -20
- package/dist/index.js.map +1 -1
- package/dist/{model-form-BhWWsA-7.d.cts → model-form-3Gr8rkdT.d.cts} +24 -2
- package/dist/{model-form-BbdzJ9Uh.d.ts → model-form-CotpEL7z.d.ts} +24 -2
- package/dist/{module-xFd7_Igv.d.cts → module-CQmOaDzP.d.cts} +4 -4
- package/dist/{module-DKkJKOuJ.d.ts → module-CWkUTcUc.d.ts} +4 -4
- package/dist/next/client.cjs +123 -7
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +4 -3
- package/dist/next/client.d.ts +4 -3
- package/dist/next/client.js +123 -7
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +1130 -364
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +121 -8
- package/dist/next/server.d.ts +121 -8
- package/dist/next/server.js +1120 -365
- package/dist/next/server.js.map +1 -1
- package/dist/{pipeline-DuKzYGia.d.cts → pipeline-BnRKO_Pd.d.cts} +1 -1
- package/dist/{pipeline-wer2G9xW.d.ts → pipeline-sWCmlFqu.d.ts} +1 -1
- package/dist/{proxy-request-headers-m4D2Tduy.d.ts → proxy-request-headers-CttlcuRb.d.ts} +1 -1
- package/dist/{proxy-request-headers-DGxdoyA0.d.cts → proxy-request-headers-pIBSn1Fw.d.cts} +1 -1
- package/dist/react.cjs +290 -31
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +59 -9
- package/dist/react.d.ts +59 -9
- package/dist/react.js +290 -32
- package/dist/react.js.map +1 -1
- package/dist/schema-handlers-BtT_IQFi.d.cts +138 -0
- package/dist/schema-handlers-VjFDhIMw.d.ts +138 -0
- package/dist/social-providers.d.cts +1 -1
- package/dist/social-providers.d.ts +1 -1
- package/dist/{types-CccOiXPo.d.ts → types-BDX8zS7w.d.ts} +12 -0
- package/dist/{types-AOY-GLu8.d.cts → types-BVKpQmfY.d.cts} +11 -0
- package/dist/{types-AOY-GLu8.d.ts → types-BVKpQmfY.d.ts} +11 -0
- package/dist/{types-1ztXDgPa.d.cts → types-D-Am7YSd.d.cts} +12 -0
- package/dist/utils.cjs +30 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +30 -1
- package/dist/utils.js.map +1 -1
- package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-G1SLeHRa.d.cts} +23 -1
- package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-ao8BWQ8v.d.ts} +23 -1
- package/package.json +16 -2
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ag as AthenaClient } from './v3-client-G1SLeHRa.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Config accepted by the table schema catalog route and {@link fetchAthenaTableCatalog}.
|
|
5
|
+
*
|
|
6
|
+
* Shape matches the Athena Auth UI table builder client config fields used for
|
|
7
|
+
* gateway schema introspection (not the full builder experimental surface).
|
|
8
|
+
*/
|
|
9
|
+
interface AthenaTableSchemaConfig {
|
|
10
|
+
/** Registry client name (`X-Athena-Client` / `createClient({ client })`). */
|
|
11
|
+
clientName: string;
|
|
12
|
+
/** Logical database label returned in the catalog response. */
|
|
13
|
+
gatewayDatabase: string;
|
|
14
|
+
/** Athena gateway API key. */
|
|
15
|
+
gatewayKey: string;
|
|
16
|
+
/** Athena gateway base URL. */
|
|
17
|
+
gatewayUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* Comma-separated PostgreSQL schema names to introspect
|
|
20
|
+
* (e.g. `"public,athena"`).
|
|
21
|
+
*/
|
|
22
|
+
schemaScope: string;
|
|
23
|
+
}
|
|
24
|
+
interface AthenaTableCatalogColumn {
|
|
25
|
+
dataType: string;
|
|
26
|
+
isNullable: boolean;
|
|
27
|
+
isPrimaryKey: boolean;
|
|
28
|
+
name: string;
|
|
29
|
+
}
|
|
30
|
+
interface AthenaTableCatalogRelation {
|
|
31
|
+
columns: AthenaTableCatalogColumn[];
|
|
32
|
+
name: string;
|
|
33
|
+
targetSchema: string;
|
|
34
|
+
targetTable: string;
|
|
35
|
+
}
|
|
36
|
+
interface AthenaTableCatalogTable {
|
|
37
|
+
columns: AthenaTableCatalogColumn[];
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
primaryKey: string[];
|
|
41
|
+
relations: AthenaTableCatalogRelation[];
|
|
42
|
+
schema: string;
|
|
43
|
+
}
|
|
44
|
+
interface AthenaTableCatalogResponse {
|
|
45
|
+
database: string;
|
|
46
|
+
generatedAt: string;
|
|
47
|
+
tables: AthenaTableCatalogTable[];
|
|
48
|
+
}
|
|
49
|
+
/** @deprecated Prefer {@link AthenaTableSchemaConfig}. */
|
|
50
|
+
type AthenaTableShowcaseConfig = AthenaTableSchemaConfig;
|
|
51
|
+
/** @deprecated Prefer {@link AthenaTableCatalogColumn}. */
|
|
52
|
+
type TableCatalogColumn = AthenaTableCatalogColumn;
|
|
53
|
+
/** @deprecated Prefer {@link AthenaTableCatalogRelation}. */
|
|
54
|
+
type TableCatalogRelation = AthenaTableCatalogRelation;
|
|
55
|
+
/** @deprecated Prefer {@link AthenaTableCatalogTable}. */
|
|
56
|
+
type TableCatalogTable = AthenaTableCatalogTable;
|
|
57
|
+
/** @deprecated Prefer {@link AthenaTableCatalogResponse}. */
|
|
58
|
+
type TableCatalogResponse = AthenaTableCatalogResponse;
|
|
59
|
+
|
|
60
|
+
/** Minimal query surface used by the catalog (v3 client or compatible). */
|
|
61
|
+
interface AthenaTableCatalogQueryClient {
|
|
62
|
+
query: AthenaClient['query'];
|
|
63
|
+
}
|
|
64
|
+
interface FetchAthenaTableCatalogOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Optional pre-built client. When omitted, a short-lived client is created
|
|
67
|
+
* from `config.gatewayUrl`, `config.gatewayKey`, and `config.clientName`.
|
|
68
|
+
*/
|
|
69
|
+
client?: AthenaTableCatalogQueryClient;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse a comma-separated schema scope into unique non-empty names.
|
|
73
|
+
*/
|
|
74
|
+
declare function parseAthenaTableSchemaScope(value: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Build gateway SQL for columns, primary keys, and foreign keys for the
|
|
77
|
+
* given schema list (parameter placeholders inlined for gateway SQL).
|
|
78
|
+
*/
|
|
79
|
+
declare function buildAthenaTableCatalogQueries(schemas: readonly string[]): {
|
|
80
|
+
columns: string;
|
|
81
|
+
foreignKeys: string;
|
|
82
|
+
primaryKeys: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Whether `value` has the required string fields for schema catalog config.
|
|
86
|
+
*/
|
|
87
|
+
declare function isAthenaTableSchemaConfig(value: unknown): value is AthenaTableSchemaConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Whether gateway credentials are non-empty after trim.
|
|
90
|
+
*/
|
|
91
|
+
declare function hasAthenaTableSchemaCredentials(config: AthenaTableSchemaConfig): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Introspect tables, columns, primary keys, and relations for the schemas in
|
|
94
|
+
* `config.schemaScope` via the Athena gateway SQL API.
|
|
95
|
+
*/
|
|
96
|
+
declare function fetchAthenaTableCatalog(config: AthenaTableSchemaConfig, options?: FetchAthenaTableCatalogOptions): Promise<AthenaTableCatalogResponse>;
|
|
97
|
+
/** @deprecated Prefer {@link fetchAthenaTableCatalog}. */
|
|
98
|
+
declare const fetchTableCatalog: typeof fetchAthenaTableCatalog;
|
|
99
|
+
|
|
100
|
+
/** Default path for the table schema catalog App Router route. */
|
|
101
|
+
declare const ATHENA_TABLE_SCHEMA_ROUTE = "/api/tables/schema";
|
|
102
|
+
interface AthenaTableSchemaHandlerOptions extends FetchAthenaTableCatalogOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Optional transform after a valid config is parsed (e.g. fill defaults from
|
|
105
|
+
* server env). Return `null` to reject with 400.
|
|
106
|
+
*/
|
|
107
|
+
resolveConfig?: (config: AthenaTableSchemaConfig, request: Request) => AthenaTableSchemaConfig | null | Promise<AthenaTableSchemaConfig | null>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handle `POST /api/tables/schema` — introspect gateway table metadata.
|
|
111
|
+
*
|
|
112
|
+
* Expected body: `{ "config": AthenaTableSchemaConfig }`.
|
|
113
|
+
*
|
|
114
|
+
* @returns `200` catalog JSON, `400` for invalid config, `500` on failure
|
|
115
|
+
*/
|
|
116
|
+
declare function handleAthenaTableSchemaPost(request: Request, options?: AthenaTableSchemaHandlerOptions): Promise<Response>;
|
|
117
|
+
/**
|
|
118
|
+
* Create App Router handlers for the table schema catalog route.
|
|
119
|
+
*
|
|
120
|
+
* Drop into a route file with no additional wiring:
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* // app/api/tables/schema/route.ts
|
|
125
|
+
* import { createAthenaTableSchemaHandlers } from '@xylex-group/athena'
|
|
126
|
+
*
|
|
127
|
+
* export const dynamic = 'force-dynamic'
|
|
128
|
+
* export const { POST } = createAthenaTableSchemaHandlers()
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @param options - Optional client injection or config resolution
|
|
132
|
+
* @returns Object with a `POST` route handler
|
|
133
|
+
*/
|
|
134
|
+
declare function createAthenaTableSchemaHandlers(options?: AthenaTableSchemaHandlerOptions): {
|
|
135
|
+
POST: (request: Request) => Promise<Response>;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { ATHENA_TABLE_SCHEMA_ROUTE as A, type FetchAthenaTableCatalogOptions as F, type TableCatalogColumn as T, type AthenaTableCatalogColumn as a, type AthenaTableCatalogQueryClient as b, type AthenaTableCatalogRelation as c, type AthenaTableCatalogResponse as d, type AthenaTableCatalogTable as e, type AthenaTableSchemaConfig as f, type AthenaTableSchemaHandlerOptions as g, type AthenaTableShowcaseConfig as h, type TableCatalogRelation as i, type TableCatalogResponse as j, type TableCatalogTable as k, buildAthenaTableCatalogQueries as l, createAthenaTableSchemaHandlers as m, fetchAthenaTableCatalog as n, fetchTableCatalog as o, handleAthenaTableSchemaPost as p, hasAthenaTableSchemaCredentials as q, isAthenaTableSchemaConfig as r, parseAthenaTableSchemaScope as s };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ag as AthenaClient } from './v3-client-ao8BWQ8v.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Config accepted by the table schema catalog route and {@link fetchAthenaTableCatalog}.
|
|
5
|
+
*
|
|
6
|
+
* Shape matches the Athena Auth UI table builder client config fields used for
|
|
7
|
+
* gateway schema introspection (not the full builder experimental surface).
|
|
8
|
+
*/
|
|
9
|
+
interface AthenaTableSchemaConfig {
|
|
10
|
+
/** Registry client name (`X-Athena-Client` / `createClient({ client })`). */
|
|
11
|
+
clientName: string;
|
|
12
|
+
/** Logical database label returned in the catalog response. */
|
|
13
|
+
gatewayDatabase: string;
|
|
14
|
+
/** Athena gateway API key. */
|
|
15
|
+
gatewayKey: string;
|
|
16
|
+
/** Athena gateway base URL. */
|
|
17
|
+
gatewayUrl: string;
|
|
18
|
+
/**
|
|
19
|
+
* Comma-separated PostgreSQL schema names to introspect
|
|
20
|
+
* (e.g. `"public,athena"`).
|
|
21
|
+
*/
|
|
22
|
+
schemaScope: string;
|
|
23
|
+
}
|
|
24
|
+
interface AthenaTableCatalogColumn {
|
|
25
|
+
dataType: string;
|
|
26
|
+
isNullable: boolean;
|
|
27
|
+
isPrimaryKey: boolean;
|
|
28
|
+
name: string;
|
|
29
|
+
}
|
|
30
|
+
interface AthenaTableCatalogRelation {
|
|
31
|
+
columns: AthenaTableCatalogColumn[];
|
|
32
|
+
name: string;
|
|
33
|
+
targetSchema: string;
|
|
34
|
+
targetTable: string;
|
|
35
|
+
}
|
|
36
|
+
interface AthenaTableCatalogTable {
|
|
37
|
+
columns: AthenaTableCatalogColumn[];
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
primaryKey: string[];
|
|
41
|
+
relations: AthenaTableCatalogRelation[];
|
|
42
|
+
schema: string;
|
|
43
|
+
}
|
|
44
|
+
interface AthenaTableCatalogResponse {
|
|
45
|
+
database: string;
|
|
46
|
+
generatedAt: string;
|
|
47
|
+
tables: AthenaTableCatalogTable[];
|
|
48
|
+
}
|
|
49
|
+
/** @deprecated Prefer {@link AthenaTableSchemaConfig}. */
|
|
50
|
+
type AthenaTableShowcaseConfig = AthenaTableSchemaConfig;
|
|
51
|
+
/** @deprecated Prefer {@link AthenaTableCatalogColumn}. */
|
|
52
|
+
type TableCatalogColumn = AthenaTableCatalogColumn;
|
|
53
|
+
/** @deprecated Prefer {@link AthenaTableCatalogRelation}. */
|
|
54
|
+
type TableCatalogRelation = AthenaTableCatalogRelation;
|
|
55
|
+
/** @deprecated Prefer {@link AthenaTableCatalogTable}. */
|
|
56
|
+
type TableCatalogTable = AthenaTableCatalogTable;
|
|
57
|
+
/** @deprecated Prefer {@link AthenaTableCatalogResponse}. */
|
|
58
|
+
type TableCatalogResponse = AthenaTableCatalogResponse;
|
|
59
|
+
|
|
60
|
+
/** Minimal query surface used by the catalog (v3 client or compatible). */
|
|
61
|
+
interface AthenaTableCatalogQueryClient {
|
|
62
|
+
query: AthenaClient['query'];
|
|
63
|
+
}
|
|
64
|
+
interface FetchAthenaTableCatalogOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Optional pre-built client. When omitted, a short-lived client is created
|
|
67
|
+
* from `config.gatewayUrl`, `config.gatewayKey`, and `config.clientName`.
|
|
68
|
+
*/
|
|
69
|
+
client?: AthenaTableCatalogQueryClient;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse a comma-separated schema scope into unique non-empty names.
|
|
73
|
+
*/
|
|
74
|
+
declare function parseAthenaTableSchemaScope(value: string): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Build gateway SQL for columns, primary keys, and foreign keys for the
|
|
77
|
+
* given schema list (parameter placeholders inlined for gateway SQL).
|
|
78
|
+
*/
|
|
79
|
+
declare function buildAthenaTableCatalogQueries(schemas: readonly string[]): {
|
|
80
|
+
columns: string;
|
|
81
|
+
foreignKeys: string;
|
|
82
|
+
primaryKeys: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Whether `value` has the required string fields for schema catalog config.
|
|
86
|
+
*/
|
|
87
|
+
declare function isAthenaTableSchemaConfig(value: unknown): value is AthenaTableSchemaConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Whether gateway credentials are non-empty after trim.
|
|
90
|
+
*/
|
|
91
|
+
declare function hasAthenaTableSchemaCredentials(config: AthenaTableSchemaConfig): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Introspect tables, columns, primary keys, and relations for the schemas in
|
|
94
|
+
* `config.schemaScope` via the Athena gateway SQL API.
|
|
95
|
+
*/
|
|
96
|
+
declare function fetchAthenaTableCatalog(config: AthenaTableSchemaConfig, options?: FetchAthenaTableCatalogOptions): Promise<AthenaTableCatalogResponse>;
|
|
97
|
+
/** @deprecated Prefer {@link fetchAthenaTableCatalog}. */
|
|
98
|
+
declare const fetchTableCatalog: typeof fetchAthenaTableCatalog;
|
|
99
|
+
|
|
100
|
+
/** Default path for the table schema catalog App Router route. */
|
|
101
|
+
declare const ATHENA_TABLE_SCHEMA_ROUTE = "/api/tables/schema";
|
|
102
|
+
interface AthenaTableSchemaHandlerOptions extends FetchAthenaTableCatalogOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Optional transform after a valid config is parsed (e.g. fill defaults from
|
|
105
|
+
* server env). Return `null` to reject with 400.
|
|
106
|
+
*/
|
|
107
|
+
resolveConfig?: (config: AthenaTableSchemaConfig, request: Request) => AthenaTableSchemaConfig | null | Promise<AthenaTableSchemaConfig | null>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handle `POST /api/tables/schema` — introspect gateway table metadata.
|
|
111
|
+
*
|
|
112
|
+
* Expected body: `{ "config": AthenaTableSchemaConfig }`.
|
|
113
|
+
*
|
|
114
|
+
* @returns `200` catalog JSON, `400` for invalid config, `500` on failure
|
|
115
|
+
*/
|
|
116
|
+
declare function handleAthenaTableSchemaPost(request: Request, options?: AthenaTableSchemaHandlerOptions): Promise<Response>;
|
|
117
|
+
/**
|
|
118
|
+
* Create App Router handlers for the table schema catalog route.
|
|
119
|
+
*
|
|
120
|
+
* Drop into a route file with no additional wiring:
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* // app/api/tables/schema/route.ts
|
|
125
|
+
* import { createAthenaTableSchemaHandlers } from '@xylex-group/athena'
|
|
126
|
+
*
|
|
127
|
+
* export const dynamic = 'force-dynamic'
|
|
128
|
+
* export const { POST } = createAthenaTableSchemaHandlers()
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @param options - Optional client injection or config resolution
|
|
132
|
+
* @returns Object with a `POST` route handler
|
|
133
|
+
*/
|
|
134
|
+
declare function createAthenaTableSchemaHandlers(options?: AthenaTableSchemaHandlerOptions): {
|
|
135
|
+
POST: (request: Request) => Promise<Response>;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export { ATHENA_TABLE_SCHEMA_ROUTE as A, type FetchAthenaTableCatalogOptions as F, type TableCatalogColumn as T, type AthenaTableCatalogColumn as a, type AthenaTableCatalogQueryClient as b, type AthenaTableCatalogRelation as c, type AthenaTableCatalogResponse as d, type AthenaTableCatalogTable as e, type AthenaTableSchemaConfig as f, type AthenaTableSchemaHandlerOptions as g, type AthenaTableShowcaseConfig as h, type TableCatalogRelation as i, type TableCatalogResponse as j, type TableCatalogTable as k, buildAthenaTableCatalogQueries as l, createAthenaTableSchemaHandlers as m, fetchAthenaTableCatalog as n, fetchTableCatalog as o, handleAthenaTableSchemaPost as p, hasAthenaTableSchemaCredentials as q, isAthenaTableSchemaConfig as r, parseAthenaTableSchemaScope as s };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
export { aO as AthenaAuthSocialProviderExtensions, aP as AuthOAuthProvider, aQ as AuthSocialProvider, aR as AuthSocialProviderBuiltin } from './types-
|
|
2
|
+
export { aO as AthenaAuthSocialProviderExtensions, aP as AuthOAuthProvider, aQ as AuthSocialProvider, aR as AuthSocialProviderBuiltin } from './types-BVKpQmfY.cjs';
|
|
3
3
|
import { importJWK, JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
export { aO as AthenaAuthSocialProviderExtensions, aP as AuthOAuthProvider, aQ as AuthSocialProvider, aR as AuthSocialProviderBuiltin } from './types-
|
|
2
|
+
export { aO as AthenaAuthSocialProviderExtensions, aP as AuthOAuthProvider, aQ as AuthSocialProvider, aR as AuthSocialProviderBuiltin } from './types-BVKpQmfY.js';
|
|
3
3
|
import { importJWK, JWTPayload } from 'jose';
|
|
4
4
|
|
|
5
5
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -134,6 +134,12 @@ interface PostgresGatewayProviderConfig {
|
|
|
134
134
|
mode: 'gateway';
|
|
135
135
|
gatewayUrl: string;
|
|
136
136
|
apiKey: string;
|
|
137
|
+
/**
|
|
138
|
+
* Tenant / registry client name sent as `X-Athena-Client`.
|
|
139
|
+
* Required on multi-tenant gateways (defaults to env `ATHENA_CLIENT` /
|
|
140
|
+
* `ATHENA_GATEWAY_CLIENT` when omitted).
|
|
141
|
+
*/
|
|
142
|
+
client?: string;
|
|
137
143
|
database: string;
|
|
138
144
|
schemas?: GeneratorSchemaSelection;
|
|
139
145
|
backend?: BackendType;
|
|
@@ -143,6 +149,12 @@ interface PostgresGatewayProviderInputConfig {
|
|
|
143
149
|
mode: 'gateway';
|
|
144
150
|
gatewayUrl?: string;
|
|
145
151
|
apiKey?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Tenant / registry client name sent as `X-Athena-Client`.
|
|
154
|
+
* Prefer `generatorEnv("ATHENA_CLIENT")` or set `ATHENA_CLIENT` /
|
|
155
|
+
* `ATHENA_GATEWAY_CLIENT` in `.env.local`.
|
|
156
|
+
*/
|
|
157
|
+
client?: string;
|
|
146
158
|
database?: string;
|
|
147
159
|
schemas?: GeneratorSchemaSelection;
|
|
148
160
|
backend?: BackendType;
|
|
@@ -1137,6 +1137,17 @@ interface AthenaAuthBindings {
|
|
|
1137
1137
|
} & AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<AthenaAuthTokenVerificationResponse>>;
|
|
1138
1138
|
/** Change current user password. Route: `POST /change-password`. */
|
|
1139
1139
|
changePassword: InternalAthenaAuthModule['changePassword'];
|
|
1140
|
+
/**
|
|
1141
|
+
* Better Auth UI flat aliases — also available nested under
|
|
1142
|
+
* `session` / `account` / `social` / `user`.
|
|
1143
|
+
*/
|
|
1144
|
+
listSessions: InternalAthenaAuthModule['listSessions'];
|
|
1145
|
+
revokeSession: InternalAthenaAuthModule['revokeSession'];
|
|
1146
|
+
revokeOtherSessions: InternalAthenaAuthModule['revokeOtherSessions'];
|
|
1147
|
+
listAccounts: InternalAthenaAuthModule['listAccounts'];
|
|
1148
|
+
unlinkAccount: InternalAthenaAuthModule['unlinkAccount'];
|
|
1149
|
+
linkSocial: InternalAthenaAuthModule['linkSocial'];
|
|
1150
|
+
updateUser: InternalAthenaAuthModule['updateUser'];
|
|
1140
1151
|
user: {
|
|
1141
1152
|
/** Update current user profile fields. Route: `POST /update-user`. */
|
|
1142
1153
|
update: InternalAthenaAuthModule['updateUser'];
|
|
@@ -1137,6 +1137,17 @@ interface AthenaAuthBindings {
|
|
|
1137
1137
|
} & AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<AthenaAuthTokenVerificationResponse>>;
|
|
1138
1138
|
/** Change current user password. Route: `POST /change-password`. */
|
|
1139
1139
|
changePassword: InternalAthenaAuthModule['changePassword'];
|
|
1140
|
+
/**
|
|
1141
|
+
* Better Auth UI flat aliases — also available nested under
|
|
1142
|
+
* `session` / `account` / `social` / `user`.
|
|
1143
|
+
*/
|
|
1144
|
+
listSessions: InternalAthenaAuthModule['listSessions'];
|
|
1145
|
+
revokeSession: InternalAthenaAuthModule['revokeSession'];
|
|
1146
|
+
revokeOtherSessions: InternalAthenaAuthModule['revokeOtherSessions'];
|
|
1147
|
+
listAccounts: InternalAthenaAuthModule['listAccounts'];
|
|
1148
|
+
unlinkAccount: InternalAthenaAuthModule['unlinkAccount'];
|
|
1149
|
+
linkSocial: InternalAthenaAuthModule['linkSocial'];
|
|
1150
|
+
updateUser: InternalAthenaAuthModule['updateUser'];
|
|
1140
1151
|
user: {
|
|
1141
1152
|
/** Update current user profile fields. Route: `POST /update-user`. */
|
|
1142
1153
|
update: InternalAthenaAuthModule['updateUser'];
|
|
@@ -134,6 +134,12 @@ interface PostgresGatewayProviderConfig {
|
|
|
134
134
|
mode: 'gateway';
|
|
135
135
|
gatewayUrl: string;
|
|
136
136
|
apiKey: string;
|
|
137
|
+
/**
|
|
138
|
+
* Tenant / registry client name sent as `X-Athena-Client`.
|
|
139
|
+
* Required on multi-tenant gateways (defaults to env `ATHENA_CLIENT` /
|
|
140
|
+
* `ATHENA_GATEWAY_CLIENT` when omitted).
|
|
141
|
+
*/
|
|
142
|
+
client?: string;
|
|
137
143
|
database: string;
|
|
138
144
|
schemas?: GeneratorSchemaSelection;
|
|
139
145
|
backend?: BackendType;
|
|
@@ -143,6 +149,12 @@ interface PostgresGatewayProviderInputConfig {
|
|
|
143
149
|
mode: 'gateway';
|
|
144
150
|
gatewayUrl?: string;
|
|
145
151
|
apiKey?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Tenant / registry client name sent as `X-Athena-Client`.
|
|
154
|
+
* Prefer `generatorEnv("ATHENA_CLIENT")` or set `ATHENA_CLIENT` /
|
|
155
|
+
* `ATHENA_GATEWAY_CLIENT` in `.env.local`.
|
|
156
|
+
*/
|
|
157
|
+
client?: string;
|
|
146
158
|
database?: string;
|
|
147
159
|
schemas?: GeneratorSchemaSelection;
|
|
148
160
|
backend?: BackendType;
|
package/dist/utils.cjs
CHANGED
|
@@ -246,6 +246,35 @@ function writeExpiredCookie(cookieStore, name, path, domain) {
|
|
|
246
246
|
const domainClause = domain ? ` domain=${domain};` : "";
|
|
247
247
|
cookieStore.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; Max-Age=0; path=${path};${domainClause}`;
|
|
248
248
|
}
|
|
249
|
+
async function signOutAndClearAthenaSession(options) {
|
|
250
|
+
let signOutError = null;
|
|
251
|
+
try {
|
|
252
|
+
await options.signOut();
|
|
253
|
+
} catch (error) {
|
|
254
|
+
signOutError = error;
|
|
255
|
+
if (options.throwOnSignOutError) {
|
|
256
|
+
throw error;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const clearedCookies = clearAuthCookies(options.clearCookieOptions);
|
|
260
|
+
if (options.clearBridge) {
|
|
261
|
+
try {
|
|
262
|
+
await options.clearBridge();
|
|
263
|
+
} catch {
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const redirectTo = options.redirectTo?.trim();
|
|
267
|
+
if (redirectTo && options.hardRedirect !== false) {
|
|
268
|
+
try {
|
|
269
|
+
const location = globalThis.window?.location;
|
|
270
|
+
if (location) {
|
|
271
|
+
location.href = redirectTo;
|
|
272
|
+
}
|
|
273
|
+
} catch {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return { clearedCookies, signOutError };
|
|
277
|
+
}
|
|
249
278
|
function clearAuthCookies(options = {}) {
|
|
250
279
|
const cookieStore = getCookieStore();
|
|
251
280
|
if (!cookieStore) {
|
|
@@ -975,6 +1004,7 @@ exports.resolveHeaderValue = resolveHeaderValue;
|
|
|
975
1004
|
exports.resolveRequestHeaderOverrides = resolveRequestHeaderOverrides;
|
|
976
1005
|
exports.shouldRedirectAuthenticatedAuthMode = shouldRedirectAuthenticatedAuthMode;
|
|
977
1006
|
exports.shouldRedirectAuthenticatedAuthView = shouldRedirectAuthenticatedAuthView;
|
|
1007
|
+
exports.signOutAndClearAthenaSession = signOutAndClearAthenaSession;
|
|
978
1008
|
exports.slugify = slugify;
|
|
979
1009
|
exports.sqlBigInt = sqlBigInt;
|
|
980
1010
|
exports.sqlJsonbLiteral = sqlJsonbLiteral;
|