@m5kdev/backend 0.3.1 → 0.3.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.
@@ -3260,13 +3260,13 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
3260
3260
  $Infer: {
3261
3261
  body: ({
3262
3262
  permission: {
3263
- readonly user?: ("get" | "create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
3263
+ readonly user?: ("get" | "delete" | "list" | "create" | "update" | "set-role" | "ban" | "impersonate" | "set-password")[] | undefined;
3264
3264
  readonly session?: ("delete" | "list" | "revoke")[] | undefined;
3265
3265
  };
3266
3266
  permissions?: never | undefined;
3267
3267
  } | {
3268
3268
  permissions: {
3269
- readonly user?: ("get" | "create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
3269
+ readonly user?: ("get" | "delete" | "list" | "create" | "update" | "set-role" | "ban" | "impersonate" | "set-password")[] | undefined;
3270
3270
  readonly session?: ("delete" | "list" | "revoke")[] | undefined;
3271
3271
  };
3272
3272
  permission?: never | undefined;
@@ -3528,7 +3528,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
3528
3528
  id: string;
3529
3529
  organizationId: string;
3530
3530
  email: string;
3531
- role: "member" | "admin" | "owner";
3531
+ role: "admin" | "member" | "owner";
3532
3532
  status: import("better-auth/plugins", { with: { "resolution-mode": "import" } }).InvitationStatus;
3533
3533
  inviterId: string;
3534
3534
  expiresAt: Date;
@@ -3538,7 +3538,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
3538
3538
  Member: {
3539
3539
  id: string;
3540
3540
  organizationId: string;
3541
- role: "member" | "admin" | "owner";
3541
+ role: "admin" | "member" | "owner";
3542
3542
  createdAt: Date;
3543
3543
  userId: string;
3544
3544
  teamId?: string | undefined | undefined;
@@ -3566,7 +3566,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
3566
3566
  members: {
3567
3567
  id: string;
3568
3568
  organizationId: string;
3569
- role: "member" | "admin" | "owner";
3569
+ role: "admin" | "member" | "owner";
3570
3570
  createdAt: Date;
3571
3571
  userId: string;
3572
3572
  teamId?: string | undefined | undefined;
@@ -3581,7 +3581,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
3581
3581
  id: string;
3582
3582
  organizationId: string;
3583
3583
  email: string;
3584
- role: "member" | "admin" | "owner";
3584
+ role: "admin" | "member" | "owner";
3585
3585
  status: import("better-auth/plugins", { with: { "resolution-mode": "import" } }).InvitationStatus;
3586
3586
  inviterId: string;
3587
3587
  expiresAt: Date;
@@ -49,10 +49,10 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
49
49
  input: void;
50
50
  output: {
51
51
  id: string;
52
- status: string;
53
52
  createdAt: Date;
54
53
  updatedAt: Date | null;
55
54
  expiresAt: Date | null;
55
+ status: string;
56
56
  claimUserId: string | null;
57
57
  claimedAt: Date | null;
58
58
  claimedEmail: string | null;
@@ -65,9 +65,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
65
65
  email?: string | undefined;
66
66
  };
67
67
  output: {
68
+ email: string;
68
69
  url: string;
69
70
  id: string;
70
- email: string;
71
71
  createdAt: Date;
72
72
  userId: string;
73
73
  expiresAt: Date | null;
@@ -80,9 +80,9 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
80
80
  claimId: string;
81
81
  };
82
82
  output: {
83
+ email: string;
83
84
  url: string;
84
85
  id: string;
85
- email: string;
86
86
  createdAt: Date;
87
87
  userId: string;
88
88
  expiresAt: Date | null;
@@ -138,12 +138,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
138
138
  listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
139
139
  input: void;
140
140
  output: {
141
+ email: string | null;
141
142
  name: string | null;
142
143
  id: string;
143
- email: string | null;
144
- status: string;
145
144
  createdAt: Date;
146
145
  updatedAt: Date | null;
146
+ status: string;
147
147
  }[];
148
148
  meta: any;
149
149
  }>;
@@ -152,12 +152,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
152
152
  email: string;
153
153
  };
154
154
  output: {
155
+ email: string | null;
155
156
  name: string | null;
156
157
  id: string;
157
- email: string | null;
158
- status: string;
159
158
  createdAt: Date;
160
159
  updatedAt: Date | null;
160
+ status: string;
161
161
  };
162
162
  meta: any;
163
163
  }>;
@@ -183,12 +183,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
183
183
  id: string;
184
184
  };
185
185
  output: {
186
+ email: string | null;
186
187
  name: string | null;
187
188
  id: string;
188
- email: string | null;
189
- status: string;
190
189
  createdAt: Date;
191
190
  updatedAt: Date | null;
191
+ status: string;
192
192
  };
193
193
  meta: any;
194
194
  }>;
@@ -197,12 +197,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
197
197
  id: string;
198
198
  };
199
199
  output: {
200
+ email: string | null;
200
201
  name: string | null;
201
202
  id: string;
202
- email: string | null;
203
- status: string;
204
203
  createdAt: Date;
205
204
  updatedAt: Date | null;
205
+ status: string;
206
206
  };
207
207
  meta: any;
208
208
  }>;
@@ -211,12 +211,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
211
211
  email: string;
212
212
  };
213
213
  output: {
214
+ email: string | null;
214
215
  name: string | null;
215
216
  id: string;
216
- email: string | null;
217
- status: string;
218
217
  createdAt: Date;
219
218
  updatedAt: Date | null;
219
+ status: string;
220
220
  };
221
221
  meta: any;
222
222
  }>;
@@ -16,43 +16,43 @@ export declare class ConnectService extends BaseService<{
16
16
  url: string;
17
17
  }>;
18
18
  handleCallback(user: User, sessionId: string, providerId: string, code: string, state: string): Promise<import("../base/base.dto").ServerResult<{
19
- provider: string;
19
+ handle: string | null;
20
20
  id: string;
21
21
  createdAt: Date;
22
22
  updatedAt: Date | null;
23
23
  userId: string;
24
+ parentId: string | null;
24
25
  expiresAt: Date | null;
25
26
  accessToken: string;
26
27
  refreshToken: string | null;
27
28
  scope: string | null;
29
+ provider: string;
28
30
  accountType: string;
29
31
  providerAccountId: string;
30
- handle: string | null;
31
32
  displayName: string | null;
32
33
  avatarUrl: string | null;
33
34
  tokenType: string | null;
34
- parentId: string | null;
35
35
  metadataJson: unknown;
36
36
  revokedAt: Date | null;
37
37
  lastRefreshedAt: Date | null;
38
38
  }>>;
39
39
  refreshToken(connectionId: string): Promise<import("../base/base.dto").ServerResult<{
40
- provider: string;
40
+ handle: string | null;
41
41
  id: string;
42
42
  createdAt: Date;
43
43
  updatedAt: Date | null;
44
44
  userId: string;
45
+ parentId: string | null;
45
46
  expiresAt: Date | null;
46
47
  accessToken: string;
47
48
  refreshToken: string | null;
48
49
  scope: string | null;
50
+ provider: string;
49
51
  accountType: string;
50
52
  providerAccountId: string;
51
- handle: string | null;
52
53
  displayName: string | null;
53
54
  avatarUrl: string | null;
54
55
  tokenType: string | null;
55
- parentId: string | null;
56
56
  metadataJson: unknown;
57
57
  revokedAt: Date | null;
58
58
  lastRefreshedAt: Date | null;
@@ -12,20 +12,20 @@ export declare function createConnectTRPC({ router, privateProcedure: procedure
12
12
  inactive?: boolean | undefined;
13
13
  };
14
14
  output: {
15
- provider: string;
16
15
  id: string;
17
16
  createdAt: Date;
18
17
  userId: string;
18
+ provider: string;
19
19
  accountType: string;
20
20
  providerAccountId: string;
21
+ handle?: string | null | undefined;
21
22
  updatedAt?: Date | null | undefined;
23
+ parentId?: string | null | undefined;
22
24
  expiresAt?: Date | null | undefined;
23
25
  scope?: string | null | undefined;
24
- handle?: string | null | undefined;
25
26
  displayName?: string | null | undefined;
26
27
  avatarUrl?: string | null | undefined;
27
28
  tokenType?: string | null | undefined;
28
- parentId?: string | null | undefined;
29
29
  metadataJson?: unknown;
30
30
  revokedAt?: Date | null | undefined;
31
31
  lastRefreshedAt?: Date | null | undefined;
@@ -14,7 +14,6 @@ class EmailService extends base_service_1.BaseService {
14
14
  constructor(props) {
15
15
  super(undefined, undefined);
16
16
  this.client = new resend_1.Resend(props.resendApiKey || process.env.RESEND_API_KEY);
17
- this.client = {};
18
17
  this.brand = props.brand;
19
18
  this.noReplyFrom = props.noReplyFrom;
20
19
  this.templates = props.templates;
@@ -11,11 +11,11 @@ export declare function createRecurrenceTRPC({ router, privateProcedure: procedu
11
11
  page?: number | undefined;
12
12
  limit?: number | undefined;
13
13
  sort?: string | undefined;
14
- order?: "asc" | "desc" | undefined;
14
+ order?: "desc" | "asc" | undefined;
15
15
  filters?: {
16
16
  columnId: string;
17
17
  type: "string" | "number" | "boolean" | "date" | "enum";
18
- method: "on" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "intersect" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
18
+ method: "intersect" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "on" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
19
19
  value: string | number | boolean | string[];
20
20
  valueTo?: string | undefined;
21
21
  endColumnId?: string | undefined;
@@ -139,6 +139,7 @@ class TagRepository extends base_repository_1.BaseTableRepository {
139
139
  return this.throwableAsync(async () => {
140
140
  const db = tx ?? this.orm;
141
141
  const conditions = this.getConditionBuilder(this.table);
142
+ conditions.push((0, drizzle_orm_1.isNull)(this.table.deletedAt));
142
143
  conditions.applyFilters(input);
143
144
  if (input?.assignableTo) {
144
145
  conditions.push(this.helpers.arrayContains(this.table.assignableTo, [input.assignableTo]));
@@ -1,4 +1,4 @@
1
- import type { TagCreateSchema, TagLinkSchema, TagListInputSchema, TagListOutputSchema, TagListSchema, TagSchema, TagUpdateSchema } from "@m5kdev/commons/modules/tag/tag.schema";
1
+ import type { TagCreateSchema, TagDeleteSchema, TagLinkSchema, TagListInputSchema, TagListOutputSchema, TagListSchema, TagSchema, TagUpdateSchema } from "@m5kdev/commons/modules/tag/tag.schema";
2
2
  import type { User } from "../auth/auth.lib";
3
3
  import type { ServerResultAsync } from "../base/base.dto";
4
4
  import { BaseService } from "../base/base.service";
@@ -32,4 +32,7 @@ export declare class TagService extends BaseService<{
32
32
  unlink(data: TagLinkSchema, { user }: {
33
33
  user: User;
34
34
  }): Promise<TagSelectOutputResult>;
35
+ delete(data: TagDeleteSchema): ServerResultAsync<{
36
+ id: string;
37
+ }>;
35
38
  }
@@ -27,5 +27,8 @@ class TagService extends base_service_1.BaseService {
27
27
  async unlink(data, { user }) {
28
28
  return this.repository.tag.unlink({ ...data, userId: user.id });
29
29
  }
30
+ async delete(data) {
31
+ return this.repository.tag.softDeleteById(data.id);
32
+ }
30
33
  }
31
34
  exports.TagService = TagService;
@@ -1,5 +1,5 @@
1
- import type { TagService } from "./tag.service";
2
1
  import { type TRPCMethods } from "../../utils/trpc";
2
+ import type { TagService } from "./tag.service";
3
3
  export declare function createTagTRPC({ router, privateProcedure: procedure }: TRPCMethods, tagService: TagService): import("@trpc/server").TRPCBuiltRouter<{
4
4
  ctx: import("../auth/auth.lib").Context;
5
5
  meta: any;
@@ -11,11 +11,11 @@ export declare function createTagTRPC({ router, privateProcedure: procedure }: T
11
11
  page?: number | undefined;
12
12
  limit?: number | undefined;
13
13
  sort?: string | undefined;
14
- order?: "asc" | "desc" | undefined;
14
+ order?: "desc" | "asc" | undefined;
15
15
  filters?: {
16
16
  columnId: string;
17
17
  type: "string" | "number" | "boolean" | "date" | "enum";
18
- method: "on" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "intersect" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
18
+ method: "intersect" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "on" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
19
19
  value: string | number | boolean | string[];
20
20
  valueTo?: string | undefined;
21
21
  endColumnId?: string | undefined;
@@ -48,7 +48,7 @@ export declare function createTagTRPC({ router, privateProcedure: procedure }: T
48
48
  resourceIds?: {
49
49
  columnId: string;
50
50
  type: "string" | "number" | "boolean" | "date" | "enum";
51
- method: "on" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "intersect" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
51
+ method: "intersect" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "on" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
52
52
  value: string | number | boolean | string[];
53
53
  valueTo?: string | undefined;
54
54
  endColumnId?: string | undefined;
@@ -95,6 +95,7 @@ export declare function createTagTRPC({ router, privateProcedure: procedure }: T
95
95
  id: string;
96
96
  name?: string | undefined;
97
97
  color?: string | undefined;
98
+ assignableTo?: string[] | undefined;
98
99
  };
99
100
  output: {
100
101
  id: string;
@@ -151,4 +152,13 @@ export declare function createTagTRPC({ router, privateProcedure: procedure }: T
151
152
  };
152
153
  meta: any;
153
154
  }>;
155
+ delete: import("@trpc/server").TRPCMutationProcedure<{
156
+ input: {
157
+ id: string;
158
+ };
159
+ output: {
160
+ id: string;
161
+ };
162
+ meta: any;
163
+ }>;
154
164
  }>>;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTagTRPC = createTagTRPC;
4
4
  const tag_schema_1 = require("@m5kdev/commons/modules/tag/tag.schema");
5
- const tag_dto_1 = require("./tag.dto");
6
5
  const trpc_1 = require("../../utils/trpc");
6
+ const tag_dto_1 = require("./tag.dto");
7
7
  function createTagTRPC({ router, privateProcedure: procedure }, tagService) {
8
8
  const tagListInput = tag_schema_1.tagListInputSchema.extend({
9
9
  assignableTo: tag_schema_1.tagListSchema.shape.assignableTo,
@@ -43,5 +43,11 @@ function createTagTRPC({ router, privateProcedure: procedure }, tagService) {
43
43
  .mutation(async ({ ctx, input }) => {
44
44
  return (0, trpc_1.handleTRPCResult)(await tagService.unlink(input, ctx));
45
45
  }),
46
+ delete: procedure
47
+ .input(tag_schema_1.tagDeleteSchema)
48
+ .output(tag_dto_1.tagsSelectOutput.pick({ id: true }))
49
+ .mutation(async ({ input }) => {
50
+ return (0, trpc_1.handleTRPCResult)(await tagService.delete(input));
51
+ }),
46
52
  });
47
53
  }
@@ -58,10 +58,10 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
58
58
  input: void;
59
59
  output: {
60
60
  id: string;
61
- status: string;
62
61
  createdAt: Date;
63
62
  updatedAt: Date | null;
64
63
  expiresAt: Date | null;
64
+ status: string;
65
65
  claimUserId: string | null;
66
66
  claimedAt: Date | null;
67
67
  claimedEmail: string | null;
@@ -74,9 +74,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
74
74
  email?: string | undefined;
75
75
  };
76
76
  output: {
77
+ email: string;
77
78
  url: string;
78
79
  id: string;
79
- email: string;
80
80
  createdAt: Date;
81
81
  userId: string;
82
82
  expiresAt: Date | null;
@@ -89,9 +89,9 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
89
89
  claimId: string;
90
90
  };
91
91
  output: {
92
+ email: string;
92
93
  url: string;
93
94
  id: string;
94
- email: string;
95
95
  createdAt: Date;
96
96
  userId: string;
97
97
  expiresAt: Date | null;
@@ -147,12 +147,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
147
147
  listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
148
148
  input: void;
149
149
  output: {
150
+ email: string | null;
150
151
  name: string | null;
151
152
  id: string;
152
- email: string | null;
153
- status: string;
154
153
  createdAt: Date;
155
154
  updatedAt: Date | null;
155
+ status: string;
156
156
  }[];
157
157
  meta: any;
158
158
  }>;
@@ -161,12 +161,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
161
161
  email: string;
162
162
  };
163
163
  output: {
164
+ email: string | null;
164
165
  name: string | null;
165
166
  id: string;
166
- email: string | null;
167
- status: string;
168
167
  createdAt: Date;
169
168
  updatedAt: Date | null;
169
+ status: string;
170
170
  };
171
171
  meta: any;
172
172
  }>;
@@ -192,12 +192,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
192
192
  id: string;
193
193
  };
194
194
  output: {
195
+ email: string | null;
195
196
  name: string | null;
196
197
  id: string;
197
- email: string | null;
198
- status: string;
199
198
  createdAt: Date;
200
199
  updatedAt: Date | null;
200
+ status: string;
201
201
  };
202
202
  meta: any;
203
203
  }>;
@@ -206,12 +206,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
206
206
  id: string;
207
207
  };
208
208
  output: {
209
+ email: string | null;
209
210
  name: string | null;
210
211
  id: string;
211
- email: string | null;
212
- status: string;
213
212
  createdAt: Date;
214
213
  updatedAt: Date | null;
214
+ status: string;
215
215
  };
216
216
  meta: any;
217
217
  }>;
@@ -220,12 +220,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
220
220
  email: string;
221
221
  };
222
222
  output: {
223
+ email: string | null;
223
224
  name: string | null;
224
225
  id: string;
225
- email: string | null;
226
- status: string;
227
226
  createdAt: Date;
228
227
  updatedAt: Date | null;
228
+ status: string;
229
229
  };
230
230
  meta: any;
231
231
  }>;
@@ -19,8 +19,8 @@ export declare function createAuthContext(auth: BetterAuth): ({ req }: CreateExp
19
19
  createdAt: Date;
20
20
  updatedAt: Date;
21
21
  userId: string;
22
- token: string;
23
22
  expiresAt: Date;
23
+ token: string;
24
24
  ipAddress: string | null;
25
25
  userAgent: string | null;
26
26
  impersonatedBy: string | null;
@@ -30,15 +30,15 @@ export declare function createAuthContext(auth: BetterAuth): ({ req }: CreateExp
30
30
  activeTeamRole: string | null;
31
31
  };
32
32
  user: {
33
- name: string;
34
- id: string;
35
33
  email: string;
36
- metadata: Record<string, unknown>;
37
- emailVerified: boolean;
34
+ name: string;
35
+ role: string | null;
38
36
  image: string | null;
37
+ metadata: Record<string, unknown>;
38
+ id: string;
39
39
  createdAt: Date;
40
40
  updatedAt: Date;
41
- role: string | null;
41
+ emailVerified: boolean;
42
42
  banned: boolean | null;
43
43
  banReason: string | null;
44
44
  banExpires: Date | null;