@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
@@ -82,6 +82,9 @@ interface AthenaDeletePayload {
82
82
  columns?: string[] | string;
83
83
  conditions?: AthenaGatewayCondition[];
84
84
  sort_by?: AthenaSortBy;
85
+ /** Fluent `.limit()` / `.range()` bounds (preferred over page_* when both are set). */
86
+ limit?: number;
87
+ offset?: number;
85
88
  current_page?: number;
86
89
  page_size?: number;
87
90
  total_pages?: number;
@@ -114,6 +117,8 @@ interface AthenaRpcPayload<TArgs = AthenaJsonObject> {
114
117
  }
115
118
  interface AthenaQueryPayload {
116
119
  query: string;
120
+ /** Optional bind parameters (D1 / SQLite-safe query path; HTTP gateways may ignore). */
121
+ params?: unknown[];
117
122
  }
118
123
  /** Backend type for Athena client (aligns with athena-rs) */
119
124
  type BackendType = 'athena' | 'postgrest' | 'postgresql' | 'scylladb';
@@ -166,6 +171,8 @@ interface AthenaGatewayCallOptions extends AthenaGatewayBaseOptions {
166
171
  stripNulls?: boolean;
167
172
  onConflict?: string | string[];
168
173
  updateBody?: AthenaJsonObject;
174
+ /** Bind parameters for `queryGateway` / `client.query` (edge D1 and SQL-aware gateways). */
175
+ params?: unknown[];
169
176
  }
170
177
  interface AthenaRpcCallOptions extends AthenaGatewayCallOptions {
171
178
  count?: AthenaCountOption;
@@ -231,4 +238,4 @@ interface AthenaGatewayHookResult {
231
238
  baseUrl: string;
232
239
  }
233
240
 
234
- export { type AthenaConditionCastType as A, Backend as B, type AthenaQueryPayload as C, type AthenaGatewayBaseOptions as D, type AthenaConditionValue as E, type AthenaConditionArrayValue as F, type AthenaGatewayCondition as G, type AthenaSortBy as H, type AthenaConditionOperator as I, type AthenaGatewayCallOptions as a, type AthenaGatewayConnectionOptions as b, type AthenaGatewayConnectionResult as c, type AthenaGatewayErrorCode as d, type AthenaGatewayErrorDetails as e, type AthenaJsonArray as f, type AthenaJsonObject as g, type AthenaJsonPrimitive as h, type AthenaJsonValue as i, type AthenaRpcCallOptions as j, type AthenaRpcFilter as k, type AthenaRpcFilterOperator as l, type AthenaRpcOrder as m, type AthenaRpcPayload as n, type BackendConfig as o, type BackendType as p, type AthenaGatewayEndpointPath as q, type AthenaGatewayMethod as r, type AthenaGatewayResponse as s, type BackendOption as t, type AthenaGatewayHookConfig as u, type AthenaGatewayHookResult as v, type AthenaDeletePayload as w, type AthenaFetchPayload as x, type AthenaInsertPayload as y, type AthenaUpdatePayload as z };
241
+ export { type AthenaConditionCastType as A, Backend as B, type AthenaQueryPayload as C, type AthenaGatewayBaseOptions as D, type AthenaConditionValue as E, type AthenaConditionArrayValue as F, type AthenaGatewayCondition as G, type AthenaSortBy as H, type AthenaConditionOperator as I, type AthenaGatewayCallOptions as a, type AthenaGatewayConnectionOptions as b, type AthenaGatewayConnectionResult as c, type AthenaGatewayErrorCode as d, type AthenaGatewayErrorDetails as e, type AthenaJsonArray as f, type AthenaJsonObject as g, type AthenaJsonPrimitive as h, type AthenaJsonValue as i, type AthenaRpcCallOptions as j, type AthenaRpcFilter as k, type AthenaRpcFilterOperator as l, type AthenaRpcOrder as m, type AthenaRpcPayload as n, type BackendConfig as o, type BackendType as p, type AthenaGatewayEndpointPath as q, type AthenaGatewayMethod as r, type AthenaGatewayResponse as s, type BackendOption as t, type AthenaFetchPayload as u, type AthenaDeletePayload as v, type AthenaInsertPayload as w, type AthenaUpdatePayload as x, type AthenaGatewayHookConfig as y, type AthenaGatewayHookResult as z };
@@ -82,6 +82,9 @@ interface AthenaDeletePayload {
82
82
  columns?: string[] | string;
83
83
  conditions?: AthenaGatewayCondition[];
84
84
  sort_by?: AthenaSortBy;
85
+ /** Fluent `.limit()` / `.range()` bounds (preferred over page_* when both are set). */
86
+ limit?: number;
87
+ offset?: number;
85
88
  current_page?: number;
86
89
  page_size?: number;
87
90
  total_pages?: number;
@@ -114,6 +117,8 @@ interface AthenaRpcPayload<TArgs = AthenaJsonObject> {
114
117
  }
115
118
  interface AthenaQueryPayload {
116
119
  query: string;
120
+ /** Optional bind parameters (D1 / SQLite-safe query path; HTTP gateways may ignore). */
121
+ params?: unknown[];
117
122
  }
118
123
  /** Backend type for Athena client (aligns with athena-rs) */
119
124
  type BackendType = 'athena' | 'postgrest' | 'postgresql' | 'scylladb';
@@ -166,6 +171,8 @@ interface AthenaGatewayCallOptions extends AthenaGatewayBaseOptions {
166
171
  stripNulls?: boolean;
167
172
  onConflict?: string | string[];
168
173
  updateBody?: AthenaJsonObject;
174
+ /** Bind parameters for `queryGateway` / `client.query` (edge D1 and SQL-aware gateways). */
175
+ params?: unknown[];
169
176
  }
170
177
  interface AthenaRpcCallOptions extends AthenaGatewayCallOptions {
171
178
  count?: AthenaCountOption;
@@ -231,4 +238,4 @@ interface AthenaGatewayHookResult {
231
238
  baseUrl: string;
232
239
  }
233
240
 
234
- export { type AthenaConditionCastType as A, Backend as B, type AthenaQueryPayload as C, type AthenaGatewayBaseOptions as D, type AthenaConditionValue as E, type AthenaConditionArrayValue as F, type AthenaGatewayCondition as G, type AthenaSortBy as H, type AthenaConditionOperator as I, type AthenaGatewayCallOptions as a, type AthenaGatewayConnectionOptions as b, type AthenaGatewayConnectionResult as c, type AthenaGatewayErrorCode as d, type AthenaGatewayErrorDetails as e, type AthenaJsonArray as f, type AthenaJsonObject as g, type AthenaJsonPrimitive as h, type AthenaJsonValue as i, type AthenaRpcCallOptions as j, type AthenaRpcFilter as k, type AthenaRpcFilterOperator as l, type AthenaRpcOrder as m, type AthenaRpcPayload as n, type BackendConfig as o, type BackendType as p, type AthenaGatewayEndpointPath as q, type AthenaGatewayMethod as r, type AthenaGatewayResponse as s, type BackendOption as t, type AthenaGatewayHookConfig as u, type AthenaGatewayHookResult as v, type AthenaDeletePayload as w, type AthenaFetchPayload as x, type AthenaInsertPayload as y, type AthenaUpdatePayload as z };
241
+ export { type AthenaConditionCastType as A, Backend as B, type AthenaQueryPayload as C, type AthenaGatewayBaseOptions as D, type AthenaConditionValue as E, type AthenaConditionArrayValue as F, type AthenaGatewayCondition as G, type AthenaSortBy as H, type AthenaConditionOperator as I, type AthenaGatewayCallOptions as a, type AthenaGatewayConnectionOptions as b, type AthenaGatewayConnectionResult as c, type AthenaGatewayErrorCode as d, type AthenaGatewayErrorDetails as e, type AthenaJsonArray as f, type AthenaJsonObject as g, type AthenaJsonPrimitive as h, type AthenaJsonValue as i, type AthenaRpcCallOptions as j, type AthenaRpcFilter as k, type AthenaRpcFilterOperator as l, type AthenaRpcOrder as m, type AthenaRpcPayload as n, type BackendConfig as o, type BackendType as p, type AthenaGatewayEndpointPath as q, type AthenaGatewayMethod as r, type AthenaGatewayResponse as s, type BackendOption as t, type AthenaFetchPayload as u, type AthenaDeletePayload as v, type AthenaInsertPayload as w, type AthenaUpdatePayload as x, type AthenaGatewayHookConfig as y, type AthenaGatewayHookResult as z };
@@ -1,5 +1,5 @@
1
- import { p as BackendType } from './types-Bltx6iL6.cjs';
2
- import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-CgCv5o6R.cjs';
1
+ import { p as BackendType } from './types-B2RZPivM.js';
2
+ import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-S-bTMPiM.js';
3
3
 
4
4
  /**
5
5
  * Supported case transformations for generated symbols and path token variants.
@@ -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'];
@@ -1,4 +1,4 @@
1
- import { p as BackendType } from './types-Bltx6iL6.cjs';
1
+ import { p as BackendType } from './types-B2RZPivM.cjs';
2
2
 
3
3
  type ModelKey = string;
4
4
  type ColumnKey = string;
@@ -1,5 +1,5 @@
1
- import { p as BackendType } from './types-Bltx6iL6.js';
2
- import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-B75PdABb.js';
1
+ import { p as BackendType } from './types-B2RZPivM.cjs';
2
+ import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-D5dj1v5Z.cjs';
3
3
 
4
4
  /**
5
5
  * Supported case transformations for generated symbols and path token variants.
@@ -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;
@@ -1,4 +1,4 @@
1
- import { p as BackendType } from './types-Bltx6iL6.js';
1
+ import { p as BackendType } from './types-B2RZPivM.js';
2
2
 
3
3
  type ModelKey = string;
4
4
  type ColumnKey = string;
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;