@xylex-group/athena 3.0.3 → 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 +912 -5
- 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 +881 -6
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +7909 -7061
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +17 -10
- package/dist/cli/index.d.ts +17 -10
- package/dist/cli/index.js +7911 -7063
- 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 +1570 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -8
- package/dist/index.d.ts +31 -8
- package/dist/index.js +1532 -100
- package/dist/index.js.map +1 -1
- package/dist/model-form-3Gr8rkdT.d.cts +281 -0
- package/dist/model-form-CotpEL7z.d.ts +281 -0
- package/dist/{module-CPG3ULxQ.d.cts → module-CQmOaDzP.d.cts} +4 -4
- package/dist/{module-BruTcxe0.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-BnRKO_Pd.d.cts +93 -0
- package/dist/pipeline-sWCmlFqu.d.ts +93 -0
- 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 +672 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +123 -8
- package/dist/react.d.ts +123 -8
- package/dist/react.js +671 -17
- 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-D6tZ9aoq.d.ts → types-BDX8zS7w.d.ts} +40 -1
- 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-DFr2cL1N.d.cts → types-D-Am7YSd.d.cts} +40 -1
- 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
- package/dist/model-form-Dh0sisdL.d.ts +0 -97
- package/dist/model-form-oOAJUVd4.d.cts +0 -97
- package/dist/pipeline-CIzV9f7b.d.cts +0 -8
- package/dist/pipeline-DNlc8Ayn.d.ts +0 -8
|
@@ -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;
|
|
@@ -227,6 +239,29 @@ interface RunGeneratorOptions {
|
|
|
227
239
|
configPath?: string;
|
|
228
240
|
dryRun?: boolean;
|
|
229
241
|
provider?: SchemaIntrospectionProvider;
|
|
242
|
+
/**
|
|
243
|
+
* When true (default), ensure/update `athena.config.ts` intelligently:
|
|
244
|
+
* create when missing, auto-fill schemas when discovery finds more,
|
|
245
|
+
* skip writes when nothing changed.
|
|
246
|
+
*
|
|
247
|
+
* Pass false for pure env-only CI runs that must not touch the config file.
|
|
248
|
+
*/
|
|
249
|
+
writeConfig?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Discover live PostgreSQL schemas and expand the effective schema list
|
|
252
|
+
* used for introspection. Defaults to true.
|
|
253
|
+
*/
|
|
254
|
+
discoverSchemas?: boolean;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Summary of intelligent config-file ensure work performed during generate.
|
|
258
|
+
*/
|
|
259
|
+
interface GeneratorConfigEnsureSummary {
|
|
260
|
+
action: 'created' | 'updated' | 'unchanged' | 'skipped';
|
|
261
|
+
path: string;
|
|
262
|
+
schemas: string[];
|
|
263
|
+
changes: string[];
|
|
264
|
+
reason?: string;
|
|
230
265
|
}
|
|
231
266
|
/**
|
|
232
267
|
* Generator execution result including files written to disk.
|
|
@@ -237,6 +272,10 @@ interface RunGeneratorResult extends GeneratedArtifacts {
|
|
|
237
272
|
writtenFiles: string[];
|
|
238
273
|
writtenDetails: WrittenGeneratedArtifact[];
|
|
239
274
|
skippedFiles: SkippedGeneratedArtifact[];
|
|
275
|
+
/**
|
|
276
|
+
* Present when generate ran config ensure/sync (even if action is unchanged).
|
|
277
|
+
*/
|
|
278
|
+
configEnsure?: GeneratorConfigEnsureSummary;
|
|
240
279
|
}
|
|
241
280
|
type SkippedGeneratedArtifactReason = 'protected-existing-file' | 'merge-conflict' | 'merge-lint-failed' | 'merge-unparseable' | 'already-current';
|
|
242
281
|
type WrittenGeneratedArtifactReason = 'created' | 'overwritten' | 'merged';
|
|
@@ -257,4 +296,4 @@ interface WrittenGeneratedArtifact {
|
|
|
257
296
|
preservedCustom?: string[];
|
|
258
297
|
}
|
|
259
298
|
|
|
260
|
-
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, SkippedGeneratedArtifact as S, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, RunGeneratorResult as d, GeneratedArtifact as e, GeneratorArtifactKind as f, GeneratorFeatureFlags as g, GeneratorFilterConfig as h, GeneratorInternalConfig as i, GeneratorNamingConfig as j, GeneratorOutputConfig as k, GeneratorOutputFormat as l, GeneratorOutputPreset as m, GeneratorOutputTargets as n, GeneratorSchemaSelection as o, GeneratorTableSelection as p, NamingStyle as q, NormalizedGeneratorFilterConfig as r, NormalizedGeneratorOutputConfig as s, SkippedGeneratedArtifactReason as t };
|
|
299
|
+
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, SkippedGeneratedArtifact as S, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, RunGeneratorResult as d, GeneratedArtifact as e, GeneratorArtifactKind as f, GeneratorFeatureFlags as g, GeneratorFilterConfig as h, GeneratorInternalConfig as i, GeneratorNamingConfig as j, GeneratorOutputConfig as k, GeneratorOutputFormat as l, GeneratorOutputPreset as m, GeneratorOutputTargets as n, GeneratorSchemaSelection as o, GeneratorTableSelection as p, NamingStyle as q, NormalizedGeneratorFilterConfig as r, NormalizedGeneratorOutputConfig as s, SkippedGeneratedArtifactReason as t, GeneratorConfigEnsureSummary as u };
|
|
@@ -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;
|
|
@@ -227,6 +239,29 @@ interface RunGeneratorOptions {
|
|
|
227
239
|
configPath?: string;
|
|
228
240
|
dryRun?: boolean;
|
|
229
241
|
provider?: SchemaIntrospectionProvider;
|
|
242
|
+
/**
|
|
243
|
+
* When true (default), ensure/update `athena.config.ts` intelligently:
|
|
244
|
+
* create when missing, auto-fill schemas when discovery finds more,
|
|
245
|
+
* skip writes when nothing changed.
|
|
246
|
+
*
|
|
247
|
+
* Pass false for pure env-only CI runs that must not touch the config file.
|
|
248
|
+
*/
|
|
249
|
+
writeConfig?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Discover live PostgreSQL schemas and expand the effective schema list
|
|
252
|
+
* used for introspection. Defaults to true.
|
|
253
|
+
*/
|
|
254
|
+
discoverSchemas?: boolean;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Summary of intelligent config-file ensure work performed during generate.
|
|
258
|
+
*/
|
|
259
|
+
interface GeneratorConfigEnsureSummary {
|
|
260
|
+
action: 'created' | 'updated' | 'unchanged' | 'skipped';
|
|
261
|
+
path: string;
|
|
262
|
+
schemas: string[];
|
|
263
|
+
changes: string[];
|
|
264
|
+
reason?: string;
|
|
230
265
|
}
|
|
231
266
|
/**
|
|
232
267
|
* Generator execution result including files written to disk.
|
|
@@ -237,6 +272,10 @@ interface RunGeneratorResult extends GeneratedArtifacts {
|
|
|
237
272
|
writtenFiles: string[];
|
|
238
273
|
writtenDetails: WrittenGeneratedArtifact[];
|
|
239
274
|
skippedFiles: SkippedGeneratedArtifact[];
|
|
275
|
+
/**
|
|
276
|
+
* Present when generate ran config ensure/sync (even if action is unchanged).
|
|
277
|
+
*/
|
|
278
|
+
configEnsure?: GeneratorConfigEnsureSummary;
|
|
240
279
|
}
|
|
241
280
|
type SkippedGeneratedArtifactReason = 'protected-existing-file' | 'merge-conflict' | 'merge-lint-failed' | 'merge-unparseable' | 'already-current';
|
|
242
281
|
type WrittenGeneratedArtifactReason = 'created' | 'overwritten' | 'merged';
|
|
@@ -257,4 +296,4 @@ interface WrittenGeneratedArtifact {
|
|
|
257
296
|
preservedCustom?: string[];
|
|
258
297
|
}
|
|
259
298
|
|
|
260
|
-
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, SkippedGeneratedArtifact as S, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, RunGeneratorResult as d, GeneratedArtifact as e, GeneratorArtifactKind as f, GeneratorFeatureFlags as g, GeneratorFilterConfig as h, GeneratorInternalConfig as i, GeneratorNamingConfig as j, GeneratorOutputConfig as k, GeneratorOutputFormat as l, GeneratorOutputPreset as m, GeneratorOutputTargets as n, GeneratorSchemaSelection as o, GeneratorTableSelection as p, NamingStyle as q, NormalizedGeneratorFilterConfig as r, NormalizedGeneratorOutputConfig as s, SkippedGeneratedArtifactReason as t };
|
|
299
|
+
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, SkippedGeneratedArtifact as S, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, RunGeneratorResult as d, GeneratedArtifact as e, GeneratorArtifactKind as f, GeneratorFeatureFlags as g, GeneratorFilterConfig as h, GeneratorInternalConfig as i, GeneratorNamingConfig as j, GeneratorOutputConfig as k, GeneratorOutputFormat as l, GeneratorOutputPreset as m, GeneratorOutputTargets as n, GeneratorSchemaSelection as o, GeneratorTableSelection as p, NamingStyle as q, NormalizedGeneratorFilterConfig as r, NormalizedGeneratorOutputConfig as s, SkippedGeneratedArtifactReason as t, GeneratorConfigEnsureSummary as u };
|
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;
|