@xylex-group/athena 3.1.0 → 3.5.1

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 (100) hide show
  1. package/README.md +17 -1
  2. package/dist/admin.cjs +55 -1
  3. package/dist/admin.cjs.map +1 -1
  4. package/dist/admin.d.cts +32 -8
  5. package/dist/admin.d.ts +32 -8
  6. package/dist/admin.js +54 -2
  7. package/dist/admin.js.map +1 -1
  8. package/dist/athena-auth-url-C1FbVmN6.d.cts +200 -0
  9. package/dist/athena-auth-url-C1FbVmN6.d.ts +200 -0
  10. package/dist/{athena-request-headers-C7Jy-c_D.d.ts → athena-request-headers-BnFN2mbd.d.cts} +49 -201
  11. package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Dwdkq2WR.d.ts} +49 -201
  12. package/dist/billing.cjs +1 -1
  13. package/dist/billing.cjs.map +1 -1
  14. package/dist/billing.js +1 -1
  15. package/dist/billing.js.map +1 -1
  16. package/dist/browser.cjs +3735 -248
  17. package/dist/browser.cjs.map +1 -1
  18. package/dist/browser.d.cts +11 -10
  19. package/dist/browser.d.ts +11 -10
  20. package/dist/browser.js +3726 -249
  21. package/dist/browser.js.map +1 -1
  22. package/dist/cli/index.cjs +3232 -190
  23. package/dist/cli/index.cjs.map +1 -1
  24. package/dist/cli/index.d.cts +4 -4
  25. package/dist/cli/index.d.ts +4 -4
  26. package/dist/cli/index.js +3232 -190
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cloudflare.cjs +12914 -0
  29. package/dist/cloudflare.cjs.map +1 -0
  30. package/dist/cloudflare.d.cts +368 -0
  31. package/dist/cloudflare.d.ts +368 -0
  32. package/dist/cloudflare.js +12885 -0
  33. package/dist/cloudflare.js.map +1 -0
  34. package/dist/cookies.cjs +4 -3
  35. package/dist/cookies.cjs.map +1 -1
  36. package/dist/cookies.js +4 -3
  37. package/dist/cookies.js.map +1 -1
  38. package/dist/env.cjs +130 -0
  39. package/dist/env.cjs.map +1 -0
  40. package/dist/env.d.cts +70 -0
  41. package/dist/env.d.ts +70 -0
  42. package/dist/env.js +122 -0
  43. package/dist/env.js.map +1 -0
  44. package/dist/index.cjs +3749 -241
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +11 -10
  47. package/dist/index.d.ts +11 -10
  48. package/dist/index.js +3739 -242
  49. package/dist/index.js.map +1 -1
  50. package/dist/{model-form-BhWWsA-7.d.cts → model-form-D0ykVVOs.d.cts} +26 -4
  51. package/dist/{model-form-BbdzJ9Uh.d.ts → model-form-U8NVtfSA.d.ts} +26 -4
  52. package/dist/{module-xFd7_Igv.d.cts → module-CMWlJ1z3.d.cts} +5 -5
  53. package/dist/{module-DKkJKOuJ.d.ts → module-CZ-wPcf2.d.ts} +5 -5
  54. package/dist/next/client.cjs +3212 -196
  55. package/dist/next/client.cjs.map +1 -1
  56. package/dist/next/client.d.cts +6 -5
  57. package/dist/next/client.d.ts +6 -5
  58. package/dist/next/client.js +3212 -196
  59. package/dist/next/client.js.map +1 -1
  60. package/dist/next/server.cjs +4461 -781
  61. package/dist/next/server.cjs.map +1 -1
  62. package/dist/next/server.d.cts +139 -13
  63. package/dist/next/server.d.ts +139 -13
  64. package/dist/next/server.js +4451 -782
  65. package/dist/next/server.js.map +1 -1
  66. package/dist/{pipeline-DuKzYGia.d.cts → pipeline-BCpb4BX1.d.cts} +1 -1
  67. package/dist/{pipeline-wer2G9xW.d.ts → pipeline-CgmXwMeX.d.ts} +1 -1
  68. package/dist/{proxy-request-headers-m4D2Tduy.d.ts → proxy-request-headers-CttlcuRb.d.ts} +1 -1
  69. package/dist/{proxy-request-headers-DGxdoyA0.d.cts → proxy-request-headers-pIBSn1Fw.d.cts} +1 -1
  70. package/dist/react.cjs +290 -31
  71. package/dist/react.cjs.map +1 -1
  72. package/dist/react.d.cts +62 -12
  73. package/dist/react.d.ts +62 -12
  74. package/dist/react.js +290 -32
  75. package/dist/react.js.map +1 -1
  76. package/dist/schema-handlers-CvWqF-dW.d.ts +138 -0
  77. package/dist/schema-handlers-Dr8h9Jg-.d.cts +138 -0
  78. package/dist/social-providers.cjs +1 -1
  79. package/dist/social-providers.cjs.map +1 -1
  80. package/dist/social-providers.d.cts +1 -1
  81. package/dist/social-providers.d.ts +1 -1
  82. package/dist/social-providers.js +1 -1
  83. package/dist/social-providers.js.map +1 -1
  84. package/dist/{types-Bltx6iL6.d.ts → types-B2RZPivM.d.cts} +8 -1
  85. package/dist/{types-Bltx6iL6.d.cts → types-B2RZPivM.d.ts} +8 -1
  86. package/dist/{types-1ztXDgPa.d.cts → types-BKklrX4J.d.ts} +14 -2
  87. package/dist/{types-AOY-GLu8.d.cts → types-BVKpQmfY.d.cts} +11 -0
  88. package/dist/{types-AOY-GLu8.d.ts → types-BVKpQmfY.d.ts} +11 -0
  89. package/dist/{types-CgCv5o6R.d.cts → types-D5dj1v5Z.d.cts} +1 -1
  90. package/dist/{types-CccOiXPo.d.ts → types-DqBFwfhn.d.cts} +14 -2
  91. package/dist/{types-B75PdABb.d.ts → types-S-bTMPiM.d.ts} +1 -1
  92. package/dist/utils.cjs +30 -0
  93. package/dist/utils.cjs.map +1 -1
  94. package/dist/utils.d.cts +4 -3
  95. package/dist/utils.d.ts +4 -3
  96. package/dist/utils.js +30 -1
  97. package/dist/utils.js.map +1 -1
  98. package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-DP-qg82X.d.cts} +323 -5
  99. package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-OAai_JNs.d.ts} +323 -5
  100. package/package.json +25 -4
@@ -0,0 +1,138 @@
1
+ import { ag as AthenaClient } from './v3-client-OAai_JNs.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 };
@@ -0,0 +1,138 @@
1
+ import { ag as AthenaClient } from './v3-client-DP-qg82X.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 };
@@ -32,7 +32,7 @@ function shouldPublishLog(current, level) {
32
32
  }
33
33
  function resolveLogLevel() {
34
34
  try {
35
- const env = typeof process !== "undefined" && process.env ? process.env.ATHENA_AUTH_LOG_LEVEL : void 0;
35
+ const env = globalThis.process?.env?.ATHENA_AUTH_LOG_LEVEL;
36
36
  if (env === "debug" || env === "info" || env === "warn" || env === "error" || env === "success") {
37
37
  return env;
38
38
  }