najm-auth 2.0.10 → 2.0.11
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/dist/index.d.ts +2 -2
- package/dist/index.js +12 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -545,7 +545,7 @@ declare class UserRepository {
|
|
|
545
545
|
private schema;
|
|
546
546
|
private get users();
|
|
547
547
|
private get roles();
|
|
548
|
-
/** Shared query helper */
|
|
548
|
+
/** Shared query helper, scoped to the current database/transaction identity. */
|
|
549
549
|
private queryHelper?;
|
|
550
550
|
private get q();
|
|
551
551
|
getAll(limit?: number, offset?: number): Promise<UserWithPermissions[]>;
|
|
@@ -847,7 +847,7 @@ declare class TokenRepository {
|
|
|
847
847
|
private schema;
|
|
848
848
|
private get tokens();
|
|
849
849
|
private get users();
|
|
850
|
-
/** Shared query helper */
|
|
850
|
+
/** Shared query helper, scoped to the current database/transaction identity. */
|
|
851
851
|
private queryHelper?;
|
|
852
852
|
private get q();
|
|
853
853
|
/**
|
package/dist/index.js
CHANGED
|
@@ -573,10 +573,14 @@ var UserRepository = class UserRepository2 {
|
|
|
573
573
|
get roles() {
|
|
574
574
|
return this.schema.roles;
|
|
575
575
|
}
|
|
576
|
-
/** Shared query helper */
|
|
576
|
+
/** Shared query helper, scoped to the current database/transaction identity. */
|
|
577
577
|
queryHelper;
|
|
578
578
|
get q() {
|
|
579
|
-
|
|
579
|
+
const db = this.db;
|
|
580
|
+
if (this.queryHelper?.db !== db) {
|
|
581
|
+
this.queryHelper = { db, queries: new AuthQueries(db, this.schema) };
|
|
582
|
+
}
|
|
583
|
+
return this.queryHelper.queries;
|
|
580
584
|
}
|
|
581
585
|
async getAll(limit = 50, offset = 0) {
|
|
582
586
|
const allUsers = await this.db.select(this.q.userSelection()).from(this.users).leftJoin(this.roles, eq2(this.users.roleId, this.roles.id)).limit(limit).offset(offset);
|
|
@@ -1423,10 +1427,14 @@ var TokenRepository = class TokenRepository2 {
|
|
|
1423
1427
|
get users() {
|
|
1424
1428
|
return this.schema.users;
|
|
1425
1429
|
}
|
|
1426
|
-
/** Shared query helper */
|
|
1430
|
+
/** Shared query helper, scoped to the current database/transaction identity. */
|
|
1427
1431
|
queryHelper;
|
|
1428
1432
|
get q() {
|
|
1429
|
-
|
|
1433
|
+
const db = this.db;
|
|
1434
|
+
if (this.queryHelper?.db !== db) {
|
|
1435
|
+
this.queryHelper = { db, queries: new AuthQueries(db, this.schema) };
|
|
1436
|
+
}
|
|
1437
|
+
return this.queryHelper.queries;
|
|
1430
1438
|
}
|
|
1431
1439
|
/**
|
|
1432
1440
|
* Upsert the refresh-token row for a session, keyed on `tokenFamily` (the
|