@rio.js/enterprise 1.4.2 → 1.4.3

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,8 +1,8 @@
1
- import { n as db } from "./db-Bd2Dgk3D.mjs";
1
+ import { $ as teamRole, A as oauthAccessTokenRelations, B as organizationRoleRelations, C as memberAssetRoleRelations, D as memberTeamRole, E as memberRelations, F as object, G as schemaDefinition, H as platformRole, I as objectRelations, J as sessionRelations, K as schemaDefinitionRelations, L as organization$1, M as oauthApplicationRelations, N as oauthConsent, O as memberTeamRoleRelations, P as oauthConsentRelations, Q as teamRelations, R as organizationRelations, S as memberAssetRole, T as memberOrganizationRoleRelations, U as relationship, V as person, W as relationshipRelations, X as teamMember, Y as team, Z as teamMemberRelations, _ as assetType, a as agent, at as verification, b as invitationRelations, c as apikeyRelations, d as assetRole, et as teamRoleRelations, f as assetRoleRelations, g as assetShareRelations, h as assetShareLinkRelations, i as accountRelations, it as userRelations, j as oauthApplication, k as oauthAccessToken, l as asset, m as assetShareLink, n as db, nt as twoFactorRelations, o as agentRelations, ot as enterpriseSchema, p as assetShare, q as session, r as account, rt as user, s as apikey, st as __export, tt as twoFactor$1, u as assetRelations, v as assetTypeRelations, w as memberOrganizationRole, x as member, y as invitation, z as organizationRole } from "./db-Bd2Dgk3D.mjs";
2
2
  import { G as getCurrentTransactionAdapter, W as getCurrentGraphContext } from "./json-oFuWgANh-CZSe35mm.mjs";
3
3
  import { f as logger, g as BetterAuthError, v as invariant } from "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
4
  import { A as apiKey, E as admin, K as graph, R as lastLoginMethod, U as organization, a as openAPI, it as APIError$1, j as assets, k as agents, rt as twoFactor, z as mcp } from "./plugins-C_-kHHzW.mjs";
5
- import { n as betterAuth, t as db_schema_final_exports } from "./db-schema.final-U_UYOH47.mjs";
5
+ import { t as betterAuth } from "./dist-DGeBMuXr.mjs";
6
6
  import { t as createAdapterFactory } from "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
7
7
  import { and, asc, count, desc, eq, gt, gte, inArray, like, lt, lte, ne, notInArray, or, sql } from "drizzle-orm";
8
8
  import cuid from "cuid";
@@ -295,6 +295,69 @@ const drizzleAdapter = (db$1, config) => {
295
295
  };
296
296
  };
297
297
 
298
+ //#endregion
299
+ //#region src/db-schema.final.ts
300
+ var db_schema_final_exports = /* @__PURE__ */ __export({
301
+ account: () => account,
302
+ accountRelations: () => accountRelations,
303
+ agent: () => agent,
304
+ agentRelations: () => agentRelations,
305
+ apikey: () => apikey,
306
+ apikeyRelations: () => apikeyRelations,
307
+ asset: () => asset,
308
+ assetRelations: () => assetRelations,
309
+ assetRole: () => assetRole,
310
+ assetRoleRelations: () => assetRoleRelations,
311
+ assetShare: () => assetShare,
312
+ assetShareLink: () => assetShareLink,
313
+ assetShareLinkRelations: () => assetShareLinkRelations,
314
+ assetShareRelations: () => assetShareRelations,
315
+ assetType: () => assetType,
316
+ assetTypeRelations: () => assetTypeRelations,
317
+ enterpriseSchema: () => enterpriseSchema,
318
+ invitation: () => invitation,
319
+ invitationRelations: () => invitationRelations,
320
+ member: () => member,
321
+ memberAssetRole: () => memberAssetRole,
322
+ memberAssetRoleRelations: () => memberAssetRoleRelations,
323
+ memberOrganizationRole: () => memberOrganizationRole,
324
+ memberOrganizationRoleRelations: () => memberOrganizationRoleRelations,
325
+ memberRelations: () => memberRelations,
326
+ memberTeamRole: () => memberTeamRole,
327
+ memberTeamRoleRelations: () => memberTeamRoleRelations,
328
+ oauthAccessToken: () => oauthAccessToken,
329
+ oauthAccessTokenRelations: () => oauthAccessTokenRelations,
330
+ oauthApplication: () => oauthApplication,
331
+ oauthApplicationRelations: () => oauthApplicationRelations,
332
+ oauthConsent: () => oauthConsent,
333
+ oauthConsentRelations: () => oauthConsentRelations,
334
+ object: () => object,
335
+ objectRelations: () => objectRelations,
336
+ organization: () => organization$1,
337
+ organizationRelations: () => organizationRelations,
338
+ organizationRole: () => organizationRole,
339
+ organizationRoleRelations: () => organizationRoleRelations,
340
+ person: () => person,
341
+ platformRole: () => platformRole,
342
+ relationship: () => relationship,
343
+ relationshipRelations: () => relationshipRelations,
344
+ schemaDefinition: () => schemaDefinition,
345
+ schemaDefinitionRelations: () => schemaDefinitionRelations,
346
+ session: () => session,
347
+ sessionRelations: () => sessionRelations,
348
+ team: () => team,
349
+ teamMember: () => teamMember,
350
+ teamMemberRelations: () => teamMemberRelations,
351
+ teamRelations: () => teamRelations,
352
+ teamRole: () => teamRole,
353
+ teamRoleRelations: () => teamRoleRelations,
354
+ twoFactor: () => twoFactor$1,
355
+ twoFactorRelations: () => twoFactorRelations,
356
+ user: () => user,
357
+ userRelations: () => userRelations,
358
+ verification: () => verification
359
+ });
360
+
298
361
  //#endregion
299
362
  //#region src/utils/email.ts
300
363
  /**
@@ -365,11 +428,11 @@ async function getOrCreatePersonalOrganization(userId, userName) {
365
428
  value: userId
366
429
  }]
367
430
  });
368
- for (const member of existingMembers) if (await adapter.findOne({
431
+ for (const member$1 of existingMembers) if (await adapter.findOne({
369
432
  model: "organization",
370
433
  where: [{
371
434
  field: "id",
372
- value: member.organizationId
435
+ value: member$1.organizationId
373
436
  }, {
374
437
  field: "slug",
375
438
  value: `user-${userId}`
@@ -489,9 +552,9 @@ function createAuthSystem(options) {
489
552
  emailAndPassword: {
490
553
  enabled: true,
491
554
  requireEmailVerification: true,
492
- sendResetPassword: async ({ user, url, token }, request) => {
555
+ sendResetPassword: async ({ user: user$1, url, token }, request) => {
493
556
  await sendEmail({
494
- to: user.email,
557
+ to: user$1.email,
495
558
  subject: "Reset your password",
496
559
  text: `Click the link to reset your password: ${url}`
497
560
  });
@@ -499,32 +562,32 @@ function createAuthSystem(options) {
499
562
  },
500
563
  hooks: {},
501
564
  databaseHooks: { user: { create: {
502
- async before(user, options$1) {
503
- if (user.actorType === "agent") {} else {
565
+ async before(user$1, options$1) {
566
+ if (user$1.actorType === "agent") {} else {
504
567
  invariant(!!options$1?.context.adapter, "Adapter is required");
505
- if (!user.id) user.id = generatePrefixedId("user");
568
+ if (!user$1.id) user$1.id = generatePrefixedId("user");
506
569
  const adapter = await getCurrentTransactionAdapter();
507
570
  const graphAdapter = await getCurrentGraphContext();
508
- const person = await adapter.create({
571
+ const person$1 = await adapter.create({
509
572
  model: "person",
510
- data: { name: user.name },
573
+ data: { name: user$1.name },
511
574
  select: ["id"]
512
575
  });
513
576
  await graphAdapter.addRelationship({
514
- subjectId: person.id,
577
+ subjectId: person$1.id,
515
578
  subjectType: "person",
516
- objectId: user.id,
579
+ objectId: user$1.id,
517
580
  objectType: "user",
518
581
  relationshipType: "person_profile"
519
582
  });
520
- if (!person) throw new Error("Failed to create person");
521
- user.actorType = "person";
522
- user.actorId = person.id;
583
+ if (!person$1) throw new Error("Failed to create person");
584
+ user$1.actorType = "person";
585
+ user$1.actorId = person$1.id;
523
586
  }
524
- return { data: user };
587
+ return { data: user$1 };
525
588
  },
526
- async after(user, context) {
527
- if (user.actorType === "person" && user.id) await getOrCreatePersonalOrganization(user.id, user.name || "User");
589
+ async after(user$1, context) {
590
+ if (user$1.actorType === "person" && user$1.id) await getOrCreatePersonalOrganization(user$1.id, user$1.name || "User");
528
591
  }
529
592
  } } },
530
593
  user: { additionalFields: {
@@ -547,7 +610,7 @@ function createAuthSystem(options) {
547
610
  });
548
611
  }
549
612
  },
550
- database: drizzleAdapter(db, {
613
+ database: drizzleAdapter(options.db ?? db, {
551
614
  provider: "pg",
552
615
  schema: db_schema_final_exports,
553
616
  usePlural: false,
@@ -1,9 +1,11 @@
1
+ import { n as db } from "./db-D5eWeSOf.mjs";
1
2
  import * as better_auth0 from "better-auth";
2
3
  import { BetterAuthPlugin, betterAuth } from "better-auth";
3
4
 
4
5
  //#region src/better-auth.d.ts
5
6
  declare function createAuthSystem(options: {
6
7
  plugins?: BetterAuthPlugin[];
8
+ db?: typeof db;
7
9
  }): ReturnType<typeof betterAuth>;
8
10
  declare const auth: better_auth0.Auth<better_auth0.BetterAuthOptions>;
9
11
  //#endregion
@@ -1,2 +1,3 @@
1
- import { n as createAuthSystem, t as auth } from "./better-auth-D2WGpedB.mjs";
1
+ import "./db-D5eWeSOf.mjs";
2
+ import { n as createAuthSystem, t as auth } from "./better-auth-RunrSBmw.mjs";
2
3
  export { auth, createAuthSystem };
@@ -10,8 +10,8 @@ import "./dist-BidhxJQx.mjs";
10
10
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
11
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
12
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import "./db-schema.final-U_UYOH47.mjs";
13
+ import "./dist-DGeBMuXr.mjs";
14
14
  import "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
15
- import { n as createAuthSystem, t as auth } from "./better-auth-CIRYXm77.mjs";
15
+ import { n as createAuthSystem, t as auth } from "./better-auth-C0GYWCr8.mjs";
16
16
 
17
17
  export { auth, createAuthSystem };
package/dist/db.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as db, t as databaseSchema } from "./db-DCIm6th7.mjs";
1
+ import { n as db, t as databaseSchema } from "./db-D5eWeSOf.mjs";
2
2
  export { databaseSchema, db };
@@ -1,4 +1,3 @@
1
- import { $ as teamRole, A as oauthAccessTokenRelations, B as organizationRoleRelations, C as memberAssetRoleRelations, D as memberTeamRole, E as memberRelations, F as object, G as schemaDefinition, H as platformRole, I as objectRelations, J as sessionRelations, K as schemaDefinitionRelations, L as organization, M as oauthApplicationRelations, N as oauthConsent, O as memberTeamRoleRelations, P as oauthConsentRelations, Q as teamRelations, R as organizationRelations, S as memberAssetRole, T as memberOrganizationRoleRelations, U as relationship, V as person, W as relationshipRelations, X as teamMember, Y as team, Z as teamMemberRelations, _ as assetType, a as agent, at as verification, b as invitationRelations, c as apikeyRelations, d as assetRole, et as teamRoleRelations, f as assetRoleRelations, g as assetShareRelations, h as assetShareLinkRelations, i as accountRelations, it as userRelations, j as oauthApplication, k as oauthAccessToken, l as asset, m as assetShareLink, nt as twoFactorRelations, o as agentRelations, ot as enterpriseSchema, p as assetShare, q as session, r as account, rt as user, s as apikey, st as __export, tt as twoFactor, u as assetRelations, v as assetTypeRelations, w as memberOrganizationRole, x as member, y as invitation, z as organizationRole } from "./db-Bd2Dgk3D.mjs";
2
1
  import { c as generateId, f as createHash, h as hashPassword, n as getAuthTables, p as createRandomStringGenerator, q as runWithAdapter, v as verifyPassword } from "./json-oFuWgANh-CZSe35mm.mjs";
3
2
  import { a as getBooleanEnvVar, f as logger, g as BetterAuthError, h as BASE_ERROR_CODES, i as env, l as isProduction, r as createLogger, s as getEnvVar, t as ENV, u as isTest } from "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
3
  import { H as base64 } from "./verify-BmFXks5a.mjs";
@@ -636,8 +635,8 @@ async function createAuthContext(adapter, options, getDatabaseType) {
636
635
  },
637
636
  checkPassword
638
637
  },
639
- setNewSession(session$1) {
640
- this.newSession = session$1;
638
+ setNewSession(session) {
639
+ this.newSession = session;
641
640
  },
642
641
  newSession: null,
643
642
  adapter,
@@ -719,67 +718,4 @@ const betterAuth = (options) => {
719
718
  };
720
719
 
721
720
  //#endregion
722
- //#region src/db-schema.final.ts
723
- var db_schema_final_exports = /* @__PURE__ */ __export({
724
- account: () => account,
725
- accountRelations: () => accountRelations,
726
- agent: () => agent,
727
- agentRelations: () => agentRelations,
728
- apikey: () => apikey,
729
- apikeyRelations: () => apikeyRelations,
730
- asset: () => asset,
731
- assetRelations: () => assetRelations,
732
- assetRole: () => assetRole,
733
- assetRoleRelations: () => assetRoleRelations,
734
- assetShare: () => assetShare,
735
- assetShareLink: () => assetShareLink,
736
- assetShareLinkRelations: () => assetShareLinkRelations,
737
- assetShareRelations: () => assetShareRelations,
738
- assetType: () => assetType,
739
- assetTypeRelations: () => assetTypeRelations,
740
- enterpriseSchema: () => enterpriseSchema,
741
- invitation: () => invitation,
742
- invitationRelations: () => invitationRelations,
743
- member: () => member,
744
- memberAssetRole: () => memberAssetRole,
745
- memberAssetRoleRelations: () => memberAssetRoleRelations,
746
- memberOrganizationRole: () => memberOrganizationRole,
747
- memberOrganizationRoleRelations: () => memberOrganizationRoleRelations,
748
- memberRelations: () => memberRelations,
749
- memberTeamRole: () => memberTeamRole,
750
- memberTeamRoleRelations: () => memberTeamRoleRelations,
751
- oauthAccessToken: () => oauthAccessToken,
752
- oauthAccessTokenRelations: () => oauthAccessTokenRelations,
753
- oauthApplication: () => oauthApplication,
754
- oauthApplicationRelations: () => oauthApplicationRelations,
755
- oauthConsent: () => oauthConsent,
756
- oauthConsentRelations: () => oauthConsentRelations,
757
- object: () => object,
758
- objectRelations: () => objectRelations,
759
- organization: () => organization,
760
- organizationRelations: () => organizationRelations,
761
- organizationRole: () => organizationRole,
762
- organizationRoleRelations: () => organizationRoleRelations,
763
- person: () => person,
764
- platformRole: () => platformRole,
765
- relationship: () => relationship,
766
- relationshipRelations: () => relationshipRelations,
767
- schemaDefinition: () => schemaDefinition,
768
- schemaDefinitionRelations: () => schemaDefinitionRelations,
769
- session: () => session,
770
- sessionRelations: () => sessionRelations,
771
- team: () => team,
772
- teamMember: () => teamMember,
773
- teamMemberRelations: () => teamMemberRelations,
774
- teamRelations: () => teamRelations,
775
- teamRole: () => teamRole,
776
- teamRoleRelations: () => teamRoleRelations,
777
- twoFactor: () => twoFactor,
778
- twoFactorRelations: () => twoFactorRelations,
779
- user: () => user,
780
- userRelations: () => userRelations,
781
- verification: () => verification
782
- });
783
-
784
- //#endregion
785
- export { getTelemetryAuthConfig as i, betterAuth as n, createTelemetry as r, db_schema_final_exports as t };
721
+ export { createTelemetry as n, getTelemetryAuthConfig as r, betterAuth as t };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as createAuthSystem } from "./better-auth-D2WGpedB.mjs";
2
- import { n as db } from "./db-DCIm6th7.mjs";
1
+ import { n as db } from "./db-D5eWeSOf.mjs";
2
+ import { n as createAuthSystem } from "./better-auth-RunrSBmw.mjs";
3
3
  import { parseSetCookieHeader } from "better-auth/cookies";
4
4
  export * from "better-auth";
5
5
  export * from "better-auth/crypto";
package/dist/index.mjs CHANGED
@@ -10,8 +10,8 @@ import "./dist-BidhxJQx.mjs";
10
10
  import { t as capitalizeFirstLetter } from "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
11
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
12
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import { i as getTelemetryAuthConfig, n as betterAuth, r as createTelemetry } from "./db-schema.final-U_UYOH47.mjs";
13
+ import { n as createTelemetry, r as getTelemetryAuthConfig, t as betterAuth } from "./dist-DGeBMuXr.mjs";
14
14
  import "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
15
- import { n as createAuthSystem } from "./better-auth-CIRYXm77.mjs";
15
+ import { n as createAuthSystem } from "./better-auth-C0GYWCr8.mjs";
16
16
 
17
17
  export { APIError$1 as APIError, BASE_ERROR_CODES, BetterAuthError, ENV, HIDE_METADATA, TTY_COLORS, accountSchema, betterAuth, capitalizeFirstLetter, clientCredentialsToken, constantTimeEqual, coreSchema, createAuthSystem, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createLogger, createRefreshAccessTokenRequest, createTelemetry, defineErrorCodes, db as enterpriseDB, env, generateCodeChallenge, generateId, generateRandomString, generateState, getBooleanEnvVar, getColorDepth, getCurrentAdapter, getCurrentGraphContext, getCurrentTransactionAdapter, getEnvVar, getOAuth2Tokens, getTelemetryAuthConfig, hashPassword, initializeGraph, invariant, isDevelopment, isProduction, isTest, levels, logger, nodeENV, parseSetCookieHeader, parseState, rateLimitSchema, refreshAccessToken, sessionSchema, shouldPublishLog, signJWT, symmetricDecodeJWT, symmetricDecrypt, symmetricEncodeJWT, symmetricEncrypt, userSchema, validateAuthorizationCode, validateToken, verificationSchema, verifyJWT, verifyPassword };
package/dist/init.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import "./db-Bd2Dgk3D.mjs";
2
1
  import "./json-oFuWgANh-CZSe35mm.mjs";
3
2
  import "./env-DwlNAN_D-C1zHd0cf-DcFsKQM_.mjs";
4
3
  import "./verify-BmFXks5a.mjs";
@@ -10,7 +9,7 @@ import "./dist-BidhxJQx.mjs";
10
9
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
10
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
11
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import "./db-schema.final-U_UYOH47.mjs";
12
+ import "./dist-DGeBMuXr.mjs";
14
13
  import { readFile } from "fs/promises";
15
14
 
16
15
  //#region src/init.ts
package/dist/server.mjs CHANGED
@@ -10,9 +10,9 @@ import "./dist-BidhxJQx.mjs";
10
10
  import "./misc-CbURQDlR-Dpe-5X_i.mjs";
11
11
  import "./parser-bL7W2mQ0-JPVS1FmJ.mjs";
12
12
  import "./client--1_AEBPu-Dl2Y0Yen.mjs";
13
- import "./db-schema.final-U_UYOH47.mjs";
13
+ import "./dist-DGeBMuXr.mjs";
14
14
  import "./adapter-factory-BTRALCLD-Bv_0fQx-.mjs";
15
- import { t as auth } from "./better-auth-CIRYXm77.mjs";
15
+ import { t as auth } from "./better-auth-C0GYWCr8.mjs";
16
16
  import "dotenv/config";
17
17
  import { cors } from "@elysiajs/cors";
18
18
  import { jwt } from "@elysiajs/jwt";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rio.js/enterprise",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "srvx --import=jiti/register --port 3001",
File without changes