@unchainedshop/core-users 4.7.2 → 4.8.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.
@@ -45,8 +45,6 @@ export type User = {
45
45
  pushSubscriptions: PushSubscriptionObject[];
46
46
  username?: string;
47
47
  meta?: any;
48
- tokenVersion?: number;
49
- oidcLogoutAt?: Date;
50
48
  } & TimestampFields;
51
49
  export interface UserQuery {
52
50
  includeGuests?: boolean;
@@ -124,10 +124,6 @@ export declare const configureUsersModule: (moduleInput: ModuleInput<UserSetting
124
124
  updateLastBillingAddress: (_id: string, lastBillingAddress: Address) => Promise<mongodb.WithId<User> | null>;
125
125
  updateLastContact: (_id: string, lastContact: Contact) => Promise<mongodb.WithId<User> | null>;
126
126
  updateRoles: (_id: string, roles: string[]) => Promise<mongodb.WithId<User> | null>;
127
- incrementTokenVersion: (userId: string) => Promise<{
128
- tokenVersion: number;
129
- } | null>;
130
- updateOidcLogoutAt: (userId: string, date: Date) => Promise<User | null>;
131
127
  updateTags: (_id: string, tags: string[]) => Promise<mongodb.WithId<User> | null>;
132
128
  updateUser: (selector: mongodb.Filter<User>, modifier: mongodb.UpdateFilter<User>, updateOptions?: mongodb.FindOneAndUpdateOptions) => Promise<mongodb.WithId<User> | null>;
133
129
  addPushSubscription: (userId: string, subscription: any, subscriptionOptions?: {
@@ -588,7 +588,9 @@ export const configureUsersModule = async (moduleInput) => {
588
588
  return user;
589
589
  },
590
590
  markDeleted: async (userId) => {
591
- await Users.updateOne({ _id: userId }, { $inc: { tokenVersion: 1 } });
591
+ await db.collection('sessions').deleteMany({
592
+ session: insensitiveTrimmedRegexOperator(`"user":"${userId}"`),
593
+ });
592
594
  const user = await Users.findOneAndUpdate({ _id: userId }, {
593
595
  $set: {
594
596
  username: `deleted-${Date.now()}`,
@@ -721,25 +723,6 @@ export const configureUsersModule = async (moduleInput) => {
721
723
  });
722
724
  return user;
723
725
  },
724
- incrementTokenVersion: async (userId) => {
725
- const user = await Users.findOneAndUpdate(generateDbFilterById(userId), {
726
- $inc: { tokenVersion: 1 },
727
- $set: { updated: new Date() },
728
- }, { returnDocument: 'after' });
729
- if (!user)
730
- return null;
731
- return { tokenVersion: user.tokenVersion ?? 1 };
732
- },
733
- updateOidcLogoutAt: async (userId, date) => {
734
- const user = await Users.findOneAndUpdate(generateDbFilterById(userId), {
735
- $set: {
736
- oidcLogoutAt: date,
737
- updated: new Date(),
738
- },
739
- $inc: { tokenVersion: 1 },
740
- }, { returnDocument: 'after' });
741
- return user;
742
- },
743
726
  updateTags: async (_id, tags) => {
744
727
  const user = await Users.findOneAndUpdate(generateDbFilterById(_id), {
745
728
  $set: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-users",
3
3
  "description": "User management module for the Unchained Engine with authentication support",
4
- "version": "4.7.2",
4
+ "version": "4.8.1",
5
5
  "main": "lib/users-index.js",
6
6
  "types": "lib/users-index.d.ts",
7
7
  "type": "module",
@@ -37,6 +37,7 @@
37
37
  "dependencies": {
38
38
  "@passwordless-id/webauthn": "^2.3.1",
39
39
  "@unchainedshop/events": "^4.6.0",
40
+ "@unchainedshop/file-upload": "^4.6.0",
40
41
  "@unchainedshop/logger": "^4.6.0",
41
42
  "@unchainedshop/mongodb": "^4.6.0",
42
43
  "@unchainedshop/roles": "^4.6.0",