@objectstack/plugin-auth 3.2.3 → 3.2.5

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @objectstack/plugin-auth@3.2.3 build /home/runner/work/spec/spec/packages/plugins/plugin-auth
2
+ > @objectstack/plugin-auth@3.2.5 build /home/runner/work/spec/spec/packages/plugins/plugin-auth
3
3
  > tsup --config ../../../tsup.config.ts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -10,13 +10,13 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- ESM dist/index.mjs 20.62 KB
14
- ESM dist/index.mjs.map 44.89 KB
15
- ESM ⚡️ Build success in 53ms
16
- CJS dist/index.js 22.36 KB
17
- CJS dist/index.js.map 45.45 KB
18
- CJS ⚡️ Build success in 54ms
13
+ ESM dist/index.mjs 26.88 KB
14
+ ESM dist/index.mjs.map 65.75 KB
15
+ ESM ⚡️ Build success in 63ms
16
+ CJS dist/index.js 29.59 KB
17
+ CJS dist/index.js.map 66.40 KB
18
+ CJS ⚡️ Build success in 72ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 7878ms
21
- DTS dist/index.d.mts 409.21 KB
22
- DTS dist/index.d.ts 409.21 KB
20
+ DTS ⚡️ Build success in 7688ms
21
+ DTS dist/index.d.mts 421.97 KB
22
+ DTS dist/index.d.ts 421.97 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - e854538: fix beyyer-auth
8
+ - @objectstack/spec@3.2.5
9
+ - @objectstack/core@3.2.5
10
+
11
+ ## 3.2.4
12
+
13
+ ### Patch Changes
14
+
15
+ - f490991: fix better-auth
16
+ - @objectstack/spec@3.2.4
17
+ - @objectstack/core@3.2.4
18
+
3
19
  ## 3.2.3
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -215,38 +215,75 @@ export const AuthUser = ObjectSchema.create({
215
215
  **Database Objects:**
216
216
  Uses ObjectStack `sys_` prefixed protocol names with snake_case field naming.
217
217
  The adapter automatically maps better-auth model names to protocol names:
218
+
219
+ *Core models:*
218
220
  - `sys_user` (← better-auth `user`) - User accounts (id, email, name, email_verified, created_at, etc.)
219
221
  - `sys_session` (← better-auth `session`) - Active sessions (id, token, user_id, expires_at, ip_address, etc.)
220
222
  - `sys_account` (← better-auth `account`) - OAuth provider accounts (id, provider_id, account_id, user_id, tokens, etc.)
221
223
  - `sys_verification` (← better-auth `verification`) - Verification tokens (id, value, identifier, expires_at, etc.)
222
224
 
223
- **Adapter:**
224
- The `createObjectQLAdapter()` function bridges better-auth's database interface to ObjectQL's IDataEngine. It includes a model→protocol name mapping (`AUTH_MODEL_TO_PROTOCOL`) that translates better-auth's hardcoded model names (e.g. `user`) to ObjectStack protocol names (e.g. `sys_user`):
225
+ *Organization plugin (when `plugins.organization: true`):*
226
+ - `sys_organization` (← `organization`) - Organizations (id, name, slug, logo, created_at, etc.)
227
+ - `sys_member` (← `member`) - Organization members (id, organization_id, user_id, role, created_at)
228
+ - `sys_invitation` (← `invitation`) - Invitations (id, organization_id, inviter_id, email, role, expires_at, etc.)
229
+ - `sys_team` (← `team`) - Teams (id, name, organization_id, created_at, etc.)
230
+ - `sys_team_member` (← `teamMember`) - Team members (id, team_id, user_id, created_at)
225
231
 
226
- ```typescript
227
- // Better-auth ObjectQL Adapter (handles model name mapping + field transformation)
228
- import { createObjectQLAdapter, AUTH_MODEL_TO_PROTOCOL } from '@objectstack/plugin-auth';
232
+ *Two-Factor plugin (when `plugins.twoFactor: true`):*
233
+ - `sys_two_factor` (← `twoFactor`) - 2FA secrets (id, secret, backup_codes, user_id)
234
+
235
+ **Schema Mapping (modelName + fields):**
229
236
 
230
- const adapter = createObjectQLAdapter(dataEngine);
237
+ better-auth uses camelCase field names internally (`emailVerified`, `userId`, `createdAt`, etc.)
238
+ while ObjectStack's protocol layer uses snake_case (`email_verified`, `user_id`, `created_at`).
231
239
 
232
- // Mapping: { user: 'sys_user', session: 'sys_session', account: 'sys_account', verification: 'sys_verification' }
233
- console.log(AUTH_MODEL_TO_PROTOCOL);
240
+ The plugin leverages better-auth's official `modelName` / `fields` schema customisation API
241
+ to declare the mapping at configuration time. The `createAdapterFactory` wrapper then
242
+ transforms data and where-clauses automatically — no runtime camelCase ↔ snake_case
243
+ conversion is needed in the adapter itself.
234
244
 
235
- // better-auth requires a DBAdapterInstance (factory function), not a raw adapter object.
236
- // Passing a plain object falls through to the Kysely adapter path and fails silently.
237
- // Wrap the adapter in a factory function:
245
+ ```typescript
246
+ // Schema mapping constants (auth-schema-config.ts)
247
+ import {
248
+ AUTH_USER_CONFIG,
249
+ AUTH_SESSION_CONFIG,
250
+ AUTH_ACCOUNT_CONFIG,
251
+ AUTH_VERIFICATION_CONFIG,
252
+ buildOrganizationPluginSchema,
253
+ buildTwoFactorPluginSchema,
254
+ } from '@objectstack/plugin-auth';
255
+
256
+ // Applied to the betterAuth() config:
238
257
  const auth = betterAuth({
239
- database: (options) => ({
240
- id: 'objectql',
241
- ...adapter,
242
- transaction: async (cb) => cb(adapter),
243
- }),
244
- // ... other config
258
+ database: createObjectQLAdapterFactory(dataEngine),
259
+ user: { ...AUTH_USER_CONFIG },
260
+ session: { ...AUTH_SESSION_CONFIG, expiresIn: 604800 },
261
+ account: { ...AUTH_ACCOUNT_CONFIG },
262
+ verification: { ...AUTH_VERIFICATION_CONFIG },
263
+ plugins: [
264
+ organization({ schema: buildOrganizationPluginSchema() }),
265
+ twoFactor({ schema: buildTwoFactorPluginSchema() }),
266
+ ],
245
267
  });
246
268
  ```
247
269
 
248
- > **Note:** `AuthManager` handles this wrapping automatically when you provide a `dataEngine`.
249
- > You only need the factory pattern above when using `createObjectQLAdapter()` directly.
270
+ **Adapter Factory:**
271
+ The `createObjectQLAdapterFactory()` function uses better-auth's `createAdapterFactory` to
272
+ bridge ObjectQL's IDataEngine with better-auth. Model-name and field-name transformations
273
+ are applied by the factory wrapper so the adapter code stays simple:
274
+
275
+ ```typescript
276
+ import { createObjectQLAdapterFactory } from '@objectstack/plugin-auth';
277
+
278
+ const adapterFactory = createObjectQLAdapterFactory(dataEngine);
279
+ // adapterFactory is (options: BetterAuthOptions) => DBAdapter
280
+ ```
281
+
282
+ > **Note:** `AuthManager` handles all of this automatically when you provide a `dataEngine`.
283
+ > You only need the factory/config above when using the adapter directly.
284
+
285
+ A legacy `createObjectQLAdapter()` function (with manual model-name mapping via
286
+ `AUTH_MODEL_TO_PROTOCOL`) is still exported for backward compatibility.
250
287
 
251
288
  ## Development
252
289
 
package/dist/index.d.mts CHANGED
@@ -3,6 +3,7 @@ import { AuthConfig } from '@objectstack/spec/system';
3
3
  export { AuthConfig, AuthPluginConfig, AuthProviderConfig } from '@objectstack/spec/system';
4
4
  import * as better_auth from 'better-auth';
5
5
  import { Auth } from 'better-auth';
6
+ import * as better_auth_adapters from 'better-auth/adapters';
6
7
  import { CleanedWhere } from 'better-auth/adapters';
7
8
  import { z } from 'zod';
8
9
  import * as _objectstack_spec_data from '@objectstack/spec/data';
@@ -90,6 +91,13 @@ interface AuthManagerOptions extends Partial<AuthConfig> {
90
91
  * Required for database operations using ObjectQL instead of third-party ORMs
91
92
  */
92
93
  dataEngine?: IDataEngine;
94
+ /**
95
+ * Base path for auth routes
96
+ * Forwarded to better-auth's basePath option so it can match incoming
97
+ * request URLs without manual path rewriting.
98
+ * @default '/api/v1/auth'
99
+ */
100
+ basePath?: string;
93
101
  }
94
102
  /**
95
103
  * Authentication Manager
@@ -115,6 +123,14 @@ declare class AuthManager {
115
123
  * Create a better-auth instance from configuration
116
124
  */
117
125
  private createAuthInstance;
126
+ /**
127
+ * Build the list of better-auth plugins based on AuthPluginConfig flags.
128
+ *
129
+ * Each plugin that introduces its own database tables is configured with
130
+ * a `schema` option containing the appropriate snake_case field mappings,
131
+ * so that `createAdapterFactory` transforms them automatically.
132
+ */
133
+ private buildPluginList;
118
134
  /**
119
135
  * Create database configuration using ObjectQL adapter
120
136
  *
@@ -2257,17 +2273,35 @@ declare const AUTH_MODEL_TO_PROTOCOL: Record<string, string>;
2257
2273
  */
2258
2274
  declare function resolveProtocolName(model: string): string;
2259
2275
  /**
2260
- * ObjectQL Adapter for better-auth
2276
+ * Create an ObjectQL adapter **factory** for better-auth.
2277
+ *
2278
+ * Uses better-auth's official `createAdapterFactory` so that model-name and
2279
+ * field-name transformations (declared via `modelName` / `fields` in the
2280
+ * betterAuth config) are applied **automatically** before any data reaches
2281
+ * ObjectQL. This eliminates the need for manual camelCase ↔ snake_case
2282
+ * conversion inside the adapter.
2283
+ *
2284
+ * The returned value is an `AdapterFactory` – a function of type
2285
+ * `(options: BetterAuthOptions) => DBAdapter` – which is the shape expected
2286
+ * by `betterAuth({ database: … })`.
2287
+ *
2288
+ * @param dataEngine - ObjectQL data engine instance
2289
+ * @returns better-auth AdapterFactory
2290
+ */
2291
+ declare function createObjectQLAdapterFactory(dataEngine: IDataEngine): better_auth_adapters.AdapterFactory<better_auth.BetterAuthOptions>;
2292
+ /**
2293
+ * Create a raw ObjectQL adapter for better-auth (without factory wrapping).
2261
2294
  *
2262
- * Bridges better-auth's database adapter interface with ObjectQL's IDataEngine.
2263
- * This allows better-auth to use ObjectQL for data persistence instead of
2264
- * third-party ORMs like drizzle-orm.
2295
+ * > **Prefer {@link createObjectQLAdapterFactory}** for production use.
2296
+ * > The factory version leverages `createAdapterFactory` and automatically
2297
+ * > handles model-name + field-name transformations declared in the
2298
+ * > better-auth config.
2265
2299
  *
2266
- * Model names from better-auth (e.g. 'user') are automatically mapped to
2267
- * ObjectStack protocol names (e.g. 'sys_user') via {@link AUTH_MODEL_TO_PROTOCOL}.
2300
+ * This function is retained for direct / low-level usage where callers
2301
+ * manage field-name conversion themselves.
2268
2302
  *
2269
2303
  * @param dataEngine - ObjectQL data engine instance
2270
- * @returns better-auth CustomAdapter
2304
+ * @returns better-auth CustomAdapter (raw, without factory wrapping)
2271
2305
  */
2272
2306
  declare function createObjectQLAdapter(dataEngine: IDataEngine): {
2273
2307
  create: <T extends Record<string, any>>({ model, data, select: _select }: {
@@ -2316,6 +2350,313 @@ declare function createObjectQLAdapter(dataEngine: IDataEngine): {
2316
2350
  }) => Promise<number>;
2317
2351
  };
2318
2352
 
2353
+ /**
2354
+ * better-auth ↔ ObjectStack Schema Mapping
2355
+ *
2356
+ * better-auth uses camelCase field names internally (e.g. `emailVerified`, `userId`)
2357
+ * while ObjectStack's protocol layer uses snake_case (e.g. `email_verified`, `user_id`).
2358
+ *
2359
+ * These constants declare the `modelName` and `fields` mappings for each core auth
2360
+ * model, following better-auth's official schema customisation API
2361
+ * ({@link https://www.better-auth.com/docs/concepts/database}).
2362
+ *
2363
+ * The mappings serve two purposes:
2364
+ * 1. `modelName` — maps the default model name to the ObjectStack protocol name
2365
+ * (e.g. `user` → `sys_user`).
2366
+ * 2. `fields` — maps camelCase field names to their snake_case database column
2367
+ * equivalents. Only fields whose names differ need to be listed; fields that
2368
+ * are already identical (e.g. `email`, `name`, `token`) are omitted.
2369
+ *
2370
+ * These mappings are consumed by:
2371
+ * - The `betterAuth()` configuration in {@link AuthManager} so that
2372
+ * `getAuthTables()` builds the correct schema.
2373
+ * - The ObjectQL adapter factory (via `createAdapterFactory`) which uses the
2374
+ * schema to transform data and where-clauses automatically.
2375
+ */
2376
+ /**
2377
+ * better-auth `user` model mapping.
2378
+ *
2379
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2380
+ * |:------------------------|:-------------------------|
2381
+ * | emailVerified | email_verified |
2382
+ * | createdAt | created_at |
2383
+ * | updatedAt | updated_at |
2384
+ */
2385
+ declare const AUTH_USER_CONFIG: {
2386
+ readonly modelName: "sys_user";
2387
+ readonly fields: {
2388
+ readonly emailVerified: "email_verified";
2389
+ readonly createdAt: "created_at";
2390
+ readonly updatedAt: "updated_at";
2391
+ };
2392
+ };
2393
+ /**
2394
+ * better-auth `session` model mapping.
2395
+ *
2396
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2397
+ * |:------------------------|:-------------------------|
2398
+ * | userId | user_id |
2399
+ * | expiresAt | expires_at |
2400
+ * | createdAt | created_at |
2401
+ * | updatedAt | updated_at |
2402
+ * | ipAddress | ip_address |
2403
+ * | userAgent | user_agent |
2404
+ */
2405
+ declare const AUTH_SESSION_CONFIG: {
2406
+ readonly modelName: "sys_session";
2407
+ readonly fields: {
2408
+ readonly userId: "user_id";
2409
+ readonly expiresAt: "expires_at";
2410
+ readonly createdAt: "created_at";
2411
+ readonly updatedAt: "updated_at";
2412
+ readonly ipAddress: "ip_address";
2413
+ readonly userAgent: "user_agent";
2414
+ };
2415
+ };
2416
+ /**
2417
+ * better-auth `account` model mapping.
2418
+ *
2419
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2420
+ * |:--------------------------|:-------------------------------|
2421
+ * | userId | user_id |
2422
+ * | providerId | provider_id |
2423
+ * | accountId | account_id |
2424
+ * | accessToken | access_token |
2425
+ * | refreshToken | refresh_token |
2426
+ * | idToken | id_token |
2427
+ * | accessTokenExpiresAt | access_token_expires_at |
2428
+ * | refreshTokenExpiresAt | refresh_token_expires_at |
2429
+ * | createdAt | created_at |
2430
+ * | updatedAt | updated_at |
2431
+ */
2432
+ declare const AUTH_ACCOUNT_CONFIG: {
2433
+ readonly modelName: "sys_account";
2434
+ readonly fields: {
2435
+ readonly userId: "user_id";
2436
+ readonly providerId: "provider_id";
2437
+ readonly accountId: "account_id";
2438
+ readonly accessToken: "access_token";
2439
+ readonly refreshToken: "refresh_token";
2440
+ readonly idToken: "id_token";
2441
+ readonly accessTokenExpiresAt: "access_token_expires_at";
2442
+ readonly refreshTokenExpiresAt: "refresh_token_expires_at";
2443
+ readonly createdAt: "created_at";
2444
+ readonly updatedAt: "updated_at";
2445
+ };
2446
+ };
2447
+ /**
2448
+ * better-auth `verification` model mapping.
2449
+ *
2450
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2451
+ * |:------------------------|:-------------------------|
2452
+ * | expiresAt | expires_at |
2453
+ * | createdAt | created_at |
2454
+ * | updatedAt | updated_at |
2455
+ */
2456
+ declare const AUTH_VERIFICATION_CONFIG: {
2457
+ readonly modelName: "sys_verification";
2458
+ readonly fields: {
2459
+ readonly expiresAt: "expires_at";
2460
+ readonly createdAt: "created_at";
2461
+ readonly updatedAt: "updated_at";
2462
+ };
2463
+ };
2464
+ /**
2465
+ * better-auth Organization plugin `organization` model mapping.
2466
+ *
2467
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2468
+ * |:------------------------|:-------------------------|
2469
+ * | createdAt | created_at |
2470
+ * | updatedAt | updated_at |
2471
+ */
2472
+ declare const AUTH_ORGANIZATION_SCHEMA: {
2473
+ readonly modelName: "sys_organization";
2474
+ readonly fields: {
2475
+ readonly createdAt: "created_at";
2476
+ readonly updatedAt: "updated_at";
2477
+ };
2478
+ };
2479
+ /**
2480
+ * better-auth Organization plugin `member` model mapping.
2481
+ *
2482
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2483
+ * |:------------------------|:-------------------------|
2484
+ * | organizationId | organization_id |
2485
+ * | userId | user_id |
2486
+ * | createdAt | created_at |
2487
+ */
2488
+ declare const AUTH_MEMBER_SCHEMA: {
2489
+ readonly modelName: "sys_member";
2490
+ readonly fields: {
2491
+ readonly organizationId: "organization_id";
2492
+ readonly userId: "user_id";
2493
+ readonly createdAt: "created_at";
2494
+ };
2495
+ };
2496
+ /**
2497
+ * better-auth Organization plugin `invitation` model mapping.
2498
+ *
2499
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2500
+ * |:------------------------|:-------------------------|
2501
+ * | organizationId | organization_id |
2502
+ * | inviterId | inviter_id |
2503
+ * | expiresAt | expires_at |
2504
+ * | createdAt | created_at |
2505
+ * | teamId | team_id |
2506
+ */
2507
+ declare const AUTH_INVITATION_SCHEMA: {
2508
+ readonly modelName: "sys_invitation";
2509
+ readonly fields: {
2510
+ readonly organizationId: "organization_id";
2511
+ readonly inviterId: "inviter_id";
2512
+ readonly expiresAt: "expires_at";
2513
+ readonly createdAt: "created_at";
2514
+ readonly teamId: "team_id";
2515
+ };
2516
+ };
2517
+ /**
2518
+ * Organization plugin adds `activeOrganizationId` (and optionally
2519
+ * `activeTeamId`) to the session model. These field mappings are
2520
+ * injected via the organization plugin's `schema.session.fields`.
2521
+ */
2522
+ declare const AUTH_ORG_SESSION_FIELDS: {
2523
+ readonly activeOrganizationId: "active_organization_id";
2524
+ readonly activeTeamId: "active_team_id";
2525
+ };
2526
+ /**
2527
+ * better-auth Organization plugin `team` model mapping.
2528
+ *
2529
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2530
+ * |:------------------------|:-------------------------|
2531
+ * | organizationId | organization_id |
2532
+ * | createdAt | created_at |
2533
+ * | updatedAt | updated_at |
2534
+ */
2535
+ declare const AUTH_TEAM_SCHEMA: {
2536
+ readonly modelName: "sys_team";
2537
+ readonly fields: {
2538
+ readonly organizationId: "organization_id";
2539
+ readonly createdAt: "created_at";
2540
+ readonly updatedAt: "updated_at";
2541
+ };
2542
+ };
2543
+ /**
2544
+ * better-auth Organization plugin `teamMember` model mapping.
2545
+ *
2546
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2547
+ * |:------------------------|:-------------------------|
2548
+ * | teamId | team_id |
2549
+ * | userId | user_id |
2550
+ * | createdAt | created_at |
2551
+ */
2552
+ declare const AUTH_TEAM_MEMBER_SCHEMA: {
2553
+ readonly modelName: "sys_team_member";
2554
+ readonly fields: {
2555
+ readonly teamId: "team_id";
2556
+ readonly userId: "user_id";
2557
+ readonly createdAt: "created_at";
2558
+ };
2559
+ };
2560
+ /**
2561
+ * better-auth Two-Factor plugin `twoFactor` model mapping.
2562
+ *
2563
+ * | camelCase (better-auth) | snake_case (ObjectStack) |
2564
+ * |:------------------------|:-------------------------|
2565
+ * | backupCodes | backup_codes |
2566
+ * | userId | user_id |
2567
+ */
2568
+ declare const AUTH_TWO_FACTOR_SCHEMA: {
2569
+ readonly modelName: "sys_two_factor";
2570
+ readonly fields: {
2571
+ readonly backupCodes: "backup_codes";
2572
+ readonly userId: "user_id";
2573
+ };
2574
+ };
2575
+ /**
2576
+ * Two-Factor plugin adds a `twoFactorEnabled` field to the user model.
2577
+ */
2578
+ declare const AUTH_TWO_FACTOR_USER_FIELDS: {
2579
+ readonly twoFactorEnabled: "two_factor_enabled";
2580
+ };
2581
+ /**
2582
+ * Builds the `schema` option for better-auth's `twoFactor()` plugin.
2583
+ *
2584
+ * @returns An object suitable for `twoFactor({ schema: … })`
2585
+ */
2586
+ declare function buildTwoFactorPluginSchema(): {
2587
+ twoFactor: {
2588
+ readonly modelName: "sys_two_factor";
2589
+ readonly fields: {
2590
+ readonly backupCodes: "backup_codes";
2591
+ readonly userId: "user_id";
2592
+ };
2593
+ };
2594
+ user: {
2595
+ fields: {
2596
+ readonly twoFactorEnabled: "two_factor_enabled";
2597
+ };
2598
+ };
2599
+ };
2600
+ /**
2601
+ * Builds the `schema` option for better-auth's `organization()` plugin.
2602
+ *
2603
+ * The organization plugin accepts a `schema` sub-option that allows
2604
+ * customising model names and field names for each table it manages.
2605
+ * This helper assembles the correct snake_case mappings from the
2606
+ * individual `AUTH_*_SCHEMA` constants above.
2607
+ *
2608
+ * @returns An object suitable for `organization({ schema: … })`
2609
+ */
2610
+ declare function buildOrganizationPluginSchema(): {
2611
+ organization: {
2612
+ readonly modelName: "sys_organization";
2613
+ readonly fields: {
2614
+ readonly createdAt: "created_at";
2615
+ readonly updatedAt: "updated_at";
2616
+ };
2617
+ };
2618
+ member: {
2619
+ readonly modelName: "sys_member";
2620
+ readonly fields: {
2621
+ readonly organizationId: "organization_id";
2622
+ readonly userId: "user_id";
2623
+ readonly createdAt: "created_at";
2624
+ };
2625
+ };
2626
+ invitation: {
2627
+ readonly modelName: "sys_invitation";
2628
+ readonly fields: {
2629
+ readonly organizationId: "organization_id";
2630
+ readonly inviterId: "inviter_id";
2631
+ readonly expiresAt: "expires_at";
2632
+ readonly createdAt: "created_at";
2633
+ readonly teamId: "team_id";
2634
+ };
2635
+ };
2636
+ team: {
2637
+ readonly modelName: "sys_team";
2638
+ readonly fields: {
2639
+ readonly organizationId: "organization_id";
2640
+ readonly createdAt: "created_at";
2641
+ readonly updatedAt: "updated_at";
2642
+ };
2643
+ };
2644
+ teamMember: {
2645
+ readonly modelName: "sys_team_member";
2646
+ readonly fields: {
2647
+ readonly teamId: "team_id";
2648
+ readonly userId: "user_id";
2649
+ readonly createdAt: "created_at";
2650
+ };
2651
+ };
2652
+ session: {
2653
+ fields: {
2654
+ readonly activeOrganizationId: "active_organization_id";
2655
+ readonly activeTeamId: "active_team_id";
2656
+ };
2657
+ };
2658
+ };
2659
+
2319
2660
  /**
2320
2661
  * XState-inspired State Machine Protocol
2321
2662
  * Used to define strict business logic constraints and lifecycle management.
@@ -2382,7 +2723,7 @@ declare const AuthUser: Omit<{
2382
2723
  abstract: boolean;
2383
2724
  datasource: string;
2384
2725
  fields: Record<string, {
2385
- type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "time" | "code" | "password" | "image" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
2726
+ type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "image" | "password" | "time" | "code" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
2386
2727
  required: boolean;
2387
2728
  searchable: boolean;
2388
2729
  multiple: boolean;
@@ -3859,7 +4200,7 @@ declare const AuthSession: Omit<{
3859
4200
  abstract: boolean;
3860
4201
  datasource: string;
3861
4202
  fields: Record<string, {
3862
- type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "time" | "code" | "password" | "image" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
4203
+ type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "image" | "password" | "time" | "code" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
3863
4204
  required: boolean;
3864
4205
  searchable: boolean;
3865
4206
  multiple: boolean;
@@ -5494,7 +5835,7 @@ declare const AuthAccount: Omit<{
5494
5835
  abstract: boolean;
5495
5836
  datasource: string;
5496
5837
  fields: Record<string, {
5497
- type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "time" | "code" | "password" | "image" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
5838
+ type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "image" | "password" | "time" | "code" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
5498
5839
  required: boolean;
5499
5840
  searchable: boolean;
5500
5841
  multiple: boolean;
@@ -7909,7 +8250,7 @@ declare const AuthVerification: Omit<{
7909
8250
  abstract: boolean;
7910
8251
  datasource: string;
7911
8252
  fields: Record<string, {
7912
- type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "time" | "code" | "password" | "image" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
8253
+ type: "number" | "boolean" | "select" | "date" | "file" | "email" | "url" | "image" | "password" | "time" | "code" | "json" | "location" | "tags" | "lookup" | "text" | "textarea" | "phone" | "markdown" | "html" | "richtext" | "currency" | "percent" | "datetime" | "toggle" | "multiselect" | "radio" | "checkboxes" | "master_detail" | "tree" | "avatar" | "video" | "audio" | "formula" | "summary" | "autonumber" | "address" | "color" | "rating" | "slider" | "signature" | "qrcode" | "progress" | "vector";
7913
8254
  required: boolean;
7914
8255
  searchable: boolean;
7915
8256
  multiple: boolean;
@@ -9203,4 +9544,4 @@ declare const AuthVerification: Omit<{
9203
9544
  };
9204
9545
  }, "fields">;
9205
9546
 
9206
- export { AUTH_MODEL_TO_PROTOCOL, AuthAccount, AuthManager, type AuthManagerOptions, AuthPlugin, type AuthPluginOptions, AuthSession, AuthUser, AuthVerification, createObjectQLAdapter, resolveProtocolName };
9547
+ export { AUTH_ACCOUNT_CONFIG, AUTH_INVITATION_SCHEMA, AUTH_MEMBER_SCHEMA, AUTH_MODEL_TO_PROTOCOL, AUTH_ORGANIZATION_SCHEMA, AUTH_ORG_SESSION_FIELDS, AUTH_SESSION_CONFIG, AUTH_TEAM_MEMBER_SCHEMA, AUTH_TEAM_SCHEMA, AUTH_TWO_FACTOR_SCHEMA, AUTH_TWO_FACTOR_USER_FIELDS, AUTH_USER_CONFIG, AUTH_VERIFICATION_CONFIG, AuthAccount, AuthManager, type AuthManagerOptions, AuthPlugin, type AuthPluginOptions, AuthSession, AuthUser, AuthVerification, buildOrganizationPluginSchema, buildTwoFactorPluginSchema, createObjectQLAdapter, createObjectQLAdapterFactory, resolveProtocolName };