@m5kdev/backend 0.1.5 → 0.2.0
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/src/modules/ai/ai.trpc.d.ts +5 -41
- package/dist/src/modules/ai/ai.trpc.js +5 -5
- package/dist/src/modules/auth/auth.lib.d.ts +2 -2
- package/dist/src/modules/auth/auth.trpc.d.ts +41 -77
- package/dist/src/modules/auth/auth.trpc.js +55 -53
- package/dist/src/modules/base/base.service.d.ts +2 -3
- package/dist/src/modules/billing/billing.trpc.d.ts +6 -42
- package/dist/src/modules/billing/billing.trpc.js +7 -7
- package/dist/src/modules/connect/connect.trpc.d.ts +9 -45
- package/dist/src/modules/connect/connect.trpc.js +7 -7
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts +12 -48
- package/dist/src/modules/recurrence/recurrence.trpc.js +17 -17
- package/dist/src/modules/tag/tag.trpc.d.ts +12 -48
- package/dist/src/modules/tag/tag.trpc.js +15 -15
- package/dist/src/modules/workflow/workflow.trpc.d.ts +6 -42
- package/dist/src/modules/workflow/workflow.trpc.js +7 -7
- package/dist/src/types.d.ts +50 -197
- package/dist/src/types.js +4 -5
- package/dist/src/utils/trpc.d.ts +58 -0
- package/dist/src/utils/trpc.js +63 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -8
|
@@ -1,45 +1,9 @@
|
|
|
1
1
|
import type { Mastra } from "@mastra/core";
|
|
2
2
|
import type { AIService } from "#modules/ai/ai.service";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
expiresAt: Date;
|
|
10
|
-
token: string;
|
|
11
|
-
ipAddress: string | null;
|
|
12
|
-
userAgent: string | null;
|
|
13
|
-
userId: string;
|
|
14
|
-
impersonatedBy: string | null;
|
|
15
|
-
activeOrganizationId: string | null;
|
|
16
|
-
activeOrganizationRole: string | null;
|
|
17
|
-
activeTeamId: string | null;
|
|
18
|
-
activeTeamRole: string | null;
|
|
19
|
-
};
|
|
20
|
-
user: {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
email: string;
|
|
24
|
-
emailVerified: boolean;
|
|
25
|
-
image: string | null;
|
|
26
|
-
createdAt: Date;
|
|
27
|
-
updatedAt: Date;
|
|
28
|
-
role: string | null;
|
|
29
|
-
banned: boolean | null;
|
|
30
|
-
banReason: string | null;
|
|
31
|
-
banExpires: Date | null;
|
|
32
|
-
stripeCustomerId: string | null;
|
|
33
|
-
paymentCustomerId: string | null;
|
|
34
|
-
paymentPlanTier: string | null;
|
|
35
|
-
paymentPlanExpiresAt: Date | null;
|
|
36
|
-
preferences: string | null;
|
|
37
|
-
metadata: Record<string, unknown>;
|
|
38
|
-
onboarding: number | null;
|
|
39
|
-
flags: string | null;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
3
|
+
import { type TRPCMethods } from "#utils/trpc";
|
|
4
|
+
export declare function createAITRPC<MastraInstance extends Mastra>({ router, adminProcedure }: TRPCMethods, aiService: AIService<MastraInstance>): import("@trpc/server").TRPCBuiltRouter<{
|
|
5
|
+
ctx: import("../auth/auth.lib").Context;
|
|
6
|
+
meta: any;
|
|
43
7
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
44
8
|
transformer: true;
|
|
45
9
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
@@ -53,6 +17,6 @@ export declare function createAITRPC<MastraInstance extends Mastra>(aiService: A
|
|
|
53
17
|
totalTokens: number | null;
|
|
54
18
|
cost: number | null;
|
|
55
19
|
};
|
|
56
|
-
meta:
|
|
20
|
+
meta: any;
|
|
57
21
|
}>;
|
|
58
22
|
}>>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAITRPC = createAITRPC;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
function createAITRPC(aiService) {
|
|
7
|
-
return
|
|
8
|
-
getUserUsage:
|
|
5
|
+
const trpc_1 = require("#utils/trpc");
|
|
6
|
+
function createAITRPC({ router, adminProcedure }, aiService) {
|
|
7
|
+
return router({
|
|
8
|
+
getUserUsage: adminProcedure
|
|
9
9
|
.input(zod_1.z.object({ userId: zod_1.z.string() }))
|
|
10
10
|
.output(zod_1.z.object({
|
|
11
11
|
inputTokens: zod_1.z.number().nullable(),
|
|
@@ -14,7 +14,7 @@ function createAITRPC(aiService) {
|
|
|
14
14
|
cost: zod_1.z.number().nullable(),
|
|
15
15
|
}))
|
|
16
16
|
.query(async ({ input }) => {
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, trpc_1.handleTRPCResult)(await aiService.getUsage(input.userId));
|
|
18
18
|
}),
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -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" | "set-role" | "create" | "
|
|
3263
|
+
readonly user?: ("update" | "get" | "set-role" | "create" | "delete" | "list" | "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" | "set-role" | "create" | "
|
|
3269
|
+
readonly user?: ("update" | "get" | "set-role" | "create" | "delete" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
|
|
3270
3270
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3271
3271
|
};
|
|
3272
3272
|
permission?: never | undefined;
|
|
@@ -1,51 +1,15 @@
|
|
|
1
1
|
import type { AuthService } from "#modules/auth/auth.service";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
createdAt: Date;
|
|
7
|
-
updatedAt: Date;
|
|
8
|
-
expiresAt: Date;
|
|
9
|
-
token: string;
|
|
10
|
-
ipAddress: string | null;
|
|
11
|
-
userAgent: string | null;
|
|
12
|
-
userId: string;
|
|
13
|
-
impersonatedBy: string | null;
|
|
14
|
-
activeOrganizationId: string | null;
|
|
15
|
-
activeOrganizationRole: string | null;
|
|
16
|
-
activeTeamId: string | null;
|
|
17
|
-
activeTeamRole: string | null;
|
|
18
|
-
};
|
|
19
|
-
user: {
|
|
20
|
-
id: string;
|
|
21
|
-
name: string;
|
|
22
|
-
email: string;
|
|
23
|
-
emailVerified: boolean;
|
|
24
|
-
image: string | null;
|
|
25
|
-
createdAt: Date;
|
|
26
|
-
updatedAt: Date;
|
|
27
|
-
role: string | null;
|
|
28
|
-
banned: boolean | null;
|
|
29
|
-
banReason: string | null;
|
|
30
|
-
banExpires: Date | null;
|
|
31
|
-
stripeCustomerId: string | null;
|
|
32
|
-
paymentCustomerId: string | null;
|
|
33
|
-
paymentPlanTier: string | null;
|
|
34
|
-
paymentPlanExpiresAt: Date | null;
|
|
35
|
-
preferences: string | null;
|
|
36
|
-
metadata: Record<string, unknown>;
|
|
37
|
-
onboarding: number | null;
|
|
38
|
-
flags: string | null;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
2
|
+
import { type TRPCMethods } from "#utils/trpc";
|
|
3
|
+
export declare function createAuthTRPC({ router, publicProcedure, privateProcedure: procedure, adminProcedure }: TRPCMethods, authService: AuthService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
|
+
ctx: import("./auth.lib").Context;
|
|
5
|
+
meta: any;
|
|
42
6
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
43
7
|
transformer: true;
|
|
44
8
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
45
9
|
getUserWaitlistCount: import("@trpc/server").TRPCQueryProcedure<{
|
|
46
10
|
input: void;
|
|
47
11
|
output: number;
|
|
48
|
-
meta:
|
|
12
|
+
meta: any;
|
|
49
13
|
}>;
|
|
50
14
|
createInvitationCode: import("@trpc/server").TRPCMutationProcedure<{
|
|
51
15
|
input: {
|
|
@@ -61,7 +25,7 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
61
25
|
code: string | null;
|
|
62
26
|
expiresAt: Date | null;
|
|
63
27
|
};
|
|
64
|
-
meta:
|
|
28
|
+
meta: any;
|
|
65
29
|
}>;
|
|
66
30
|
createAccountClaimCode: import("@trpc/server").TRPCMutationProcedure<{
|
|
67
31
|
input: {
|
|
@@ -79,21 +43,21 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
79
43
|
createdAt: Date;
|
|
80
44
|
updatedAt: Date | null;
|
|
81
45
|
};
|
|
82
|
-
meta:
|
|
46
|
+
meta: any;
|
|
83
47
|
}>;
|
|
84
48
|
listAccountClaims: import("@trpc/server").TRPCQueryProcedure<{
|
|
85
49
|
input: void;
|
|
86
50
|
output: {
|
|
51
|
+
expiresAt: Date | null;
|
|
87
52
|
id: string;
|
|
88
53
|
createdAt: Date;
|
|
89
54
|
updatedAt: Date | null;
|
|
90
|
-
expiresAt: Date | null;
|
|
91
55
|
status: string;
|
|
92
56
|
claimUserId: string | null;
|
|
93
57
|
claimedAt: Date | null;
|
|
94
58
|
claimedEmail: string | null;
|
|
95
59
|
}[];
|
|
96
|
-
meta:
|
|
60
|
+
meta: any;
|
|
97
61
|
}>;
|
|
98
62
|
generateAccountClaimMagicLink: import("@trpc/server").TRPCMutationProcedure<{
|
|
99
63
|
input: {
|
|
@@ -101,30 +65,30 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
101
65
|
email?: string | undefined;
|
|
102
66
|
};
|
|
103
67
|
output: {
|
|
104
|
-
id: string;
|
|
105
68
|
email: string;
|
|
106
|
-
|
|
69
|
+
url: string;
|
|
107
70
|
expiresAt: Date | null;
|
|
71
|
+
id: string;
|
|
108
72
|
userId: string;
|
|
73
|
+
createdAt: Date;
|
|
109
74
|
claimId: string;
|
|
110
|
-
url: string;
|
|
111
75
|
};
|
|
112
|
-
meta:
|
|
76
|
+
meta: any;
|
|
113
77
|
}>;
|
|
114
78
|
listAccountClaimMagicLinks: import("@trpc/server").TRPCQueryProcedure<{
|
|
115
79
|
input: {
|
|
116
80
|
claimId: string;
|
|
117
81
|
};
|
|
118
82
|
output: {
|
|
119
|
-
id: string;
|
|
120
83
|
email: string;
|
|
121
|
-
|
|
84
|
+
url: string;
|
|
122
85
|
expiresAt: Date | null;
|
|
86
|
+
id: string;
|
|
123
87
|
userId: string;
|
|
88
|
+
createdAt: Date;
|
|
124
89
|
claimId: string;
|
|
125
|
-
url: string;
|
|
126
90
|
}[];
|
|
127
|
-
meta:
|
|
91
|
+
meta: any;
|
|
128
92
|
}>;
|
|
129
93
|
getMyAccountClaimStatus: import("@trpc/server").TRPCQueryProcedure<{
|
|
130
94
|
input: void;
|
|
@@ -139,7 +103,7 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
139
103
|
createdAt: Date;
|
|
140
104
|
updatedAt: Date | null;
|
|
141
105
|
} | null;
|
|
142
|
-
meta:
|
|
106
|
+
meta: any;
|
|
143
107
|
}>;
|
|
144
108
|
setMyAccountClaimEmail: import("@trpc/server").TRPCMutationProcedure<{
|
|
145
109
|
input: {
|
|
@@ -148,14 +112,14 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
148
112
|
output: {
|
|
149
113
|
status: boolean;
|
|
150
114
|
};
|
|
151
|
-
meta:
|
|
115
|
+
meta: any;
|
|
152
116
|
}>;
|
|
153
117
|
acceptMyAccountClaim: import("@trpc/server").TRPCMutationProcedure<{
|
|
154
118
|
input: void;
|
|
155
119
|
output: {
|
|
156
120
|
status: boolean;
|
|
157
121
|
};
|
|
158
|
-
meta:
|
|
122
|
+
meta: any;
|
|
159
123
|
}>;
|
|
160
124
|
listWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
161
125
|
input: void;
|
|
@@ -169,33 +133,33 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
169
133
|
code: string | null;
|
|
170
134
|
expiresAt: Date | null;
|
|
171
135
|
}[];
|
|
172
|
-
meta:
|
|
136
|
+
meta: any;
|
|
173
137
|
}>;
|
|
174
138
|
listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
175
139
|
input: void;
|
|
176
140
|
output: {
|
|
141
|
+
email: string | null;
|
|
177
142
|
id: string;
|
|
178
143
|
name: string | null;
|
|
179
|
-
email: string | null;
|
|
180
144
|
createdAt: Date;
|
|
181
145
|
updatedAt: Date | null;
|
|
182
146
|
status: string;
|
|
183
147
|
}[];
|
|
184
|
-
meta:
|
|
148
|
+
meta: any;
|
|
185
149
|
}>;
|
|
186
150
|
addToWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
187
151
|
input: {
|
|
188
152
|
email: string;
|
|
189
153
|
};
|
|
190
154
|
output: {
|
|
155
|
+
email: string | null;
|
|
191
156
|
id: string;
|
|
192
157
|
name: string | null;
|
|
193
|
-
email: string | null;
|
|
194
158
|
createdAt: Date;
|
|
195
159
|
updatedAt: Date | null;
|
|
196
160
|
status: string;
|
|
197
161
|
};
|
|
198
|
-
meta:
|
|
162
|
+
meta: any;
|
|
199
163
|
}>;
|
|
200
164
|
inviteToWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
201
165
|
input: {
|
|
@@ -212,89 +176,89 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
212
176
|
code: string | null;
|
|
213
177
|
expiresAt: Date | null;
|
|
214
178
|
};
|
|
215
|
-
meta:
|
|
179
|
+
meta: any;
|
|
216
180
|
}>;
|
|
217
181
|
inviteFromWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
218
182
|
input: {
|
|
219
183
|
id: string;
|
|
220
184
|
};
|
|
221
185
|
output: {
|
|
186
|
+
email: string | null;
|
|
222
187
|
id: string;
|
|
223
188
|
name: string | null;
|
|
224
|
-
email: string | null;
|
|
225
189
|
createdAt: Date;
|
|
226
190
|
updatedAt: Date | null;
|
|
227
191
|
status: string;
|
|
228
192
|
};
|
|
229
|
-
meta:
|
|
193
|
+
meta: any;
|
|
230
194
|
}>;
|
|
231
195
|
removeFromWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
232
196
|
input: {
|
|
233
197
|
id: string;
|
|
234
198
|
};
|
|
235
199
|
output: {
|
|
200
|
+
email: string | null;
|
|
236
201
|
id: string;
|
|
237
202
|
name: string | null;
|
|
238
|
-
email: string | null;
|
|
239
203
|
createdAt: Date;
|
|
240
204
|
updatedAt: Date | null;
|
|
241
205
|
status: string;
|
|
242
206
|
};
|
|
243
|
-
meta:
|
|
207
|
+
meta: any;
|
|
244
208
|
}>;
|
|
245
209
|
joinWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
246
210
|
input: {
|
|
247
211
|
email: string;
|
|
248
212
|
};
|
|
249
213
|
output: {
|
|
214
|
+
email: string | null;
|
|
250
215
|
id: string;
|
|
251
216
|
name: string | null;
|
|
252
|
-
email: string | null;
|
|
253
217
|
createdAt: Date;
|
|
254
218
|
updatedAt: Date | null;
|
|
255
219
|
status: string;
|
|
256
220
|
};
|
|
257
|
-
meta:
|
|
221
|
+
meta: any;
|
|
258
222
|
}>;
|
|
259
223
|
getOnboarding: import("@trpc/server").TRPCQueryProcedure<{
|
|
260
224
|
input: void;
|
|
261
225
|
output: number;
|
|
262
|
-
meta:
|
|
226
|
+
meta: any;
|
|
263
227
|
}>;
|
|
264
228
|
setOnboarding: import("@trpc/server").TRPCMutationProcedure<{
|
|
265
229
|
input: number;
|
|
266
230
|
output: number;
|
|
267
|
-
meta:
|
|
231
|
+
meta: any;
|
|
268
232
|
}>;
|
|
269
233
|
getPreferences: import("@trpc/server").TRPCQueryProcedure<{
|
|
270
234
|
input: void;
|
|
271
235
|
output: Record<string, unknown>;
|
|
272
|
-
meta:
|
|
236
|
+
meta: any;
|
|
273
237
|
}>;
|
|
274
238
|
setPreferences: import("@trpc/server").TRPCMutationProcedure<{
|
|
275
239
|
input: Record<string, unknown>;
|
|
276
240
|
output: Record<string, unknown>;
|
|
277
|
-
meta:
|
|
241
|
+
meta: any;
|
|
278
242
|
}>;
|
|
279
243
|
getMetadata: import("@trpc/server").TRPCQueryProcedure<{
|
|
280
244
|
input: void;
|
|
281
245
|
output: Record<string, unknown>;
|
|
282
|
-
meta:
|
|
246
|
+
meta: any;
|
|
283
247
|
}>;
|
|
284
248
|
setMetadata: import("@trpc/server").TRPCMutationProcedure<{
|
|
285
249
|
input: Record<string, unknown>;
|
|
286
250
|
output: Record<string, unknown>;
|
|
287
|
-
meta:
|
|
251
|
+
meta: any;
|
|
288
252
|
}>;
|
|
289
253
|
getFlags: import("@trpc/server").TRPCQueryProcedure<{
|
|
290
254
|
input: void;
|
|
291
255
|
output: string[];
|
|
292
|
-
meta:
|
|
256
|
+
meta: any;
|
|
293
257
|
}>;
|
|
294
258
|
setFlags: import("@trpc/server").TRPCMutationProcedure<{
|
|
295
259
|
input: string[];
|
|
296
260
|
output: string[];
|
|
297
|
-
meta:
|
|
261
|
+
meta: any;
|
|
298
262
|
}>;
|
|
299
263
|
validateWaitlistCode: import("@trpc/server").TRPCQueryProcedure<{
|
|
300
264
|
input: {
|
|
@@ -303,6 +267,6 @@ export declare function createAuthTRPC(authService: AuthService): import("@trpc/
|
|
|
303
267
|
output: {
|
|
304
268
|
status: string;
|
|
305
269
|
};
|
|
306
|
-
meta:
|
|
270
|
+
meta: any;
|
|
307
271
|
}>;
|
|
308
272
|
}>>;
|
|
@@ -3,147 +3,149 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createAuthTRPC = createAuthTRPC;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const auth_dto_1 = require("#modules/auth/auth.dto");
|
|
6
|
-
const
|
|
7
|
-
function createAuthTRPC(authService) {
|
|
8
|
-
return
|
|
9
|
-
getUserWaitlistCount:
|
|
10
|
-
return (0,
|
|
6
|
+
const trpc_1 = require("#utils/trpc");
|
|
7
|
+
function createAuthTRPC({ router, publicProcedure, privateProcedure: procedure, adminProcedure }, authService) {
|
|
8
|
+
return router({
|
|
9
|
+
getUserWaitlistCount: procedure.output(zod_1.z.number()).query(async ({ ctx }) => {
|
|
10
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getUserWaitlistCount(ctx));
|
|
11
11
|
}),
|
|
12
|
-
createInvitationCode:
|
|
12
|
+
createInvitationCode: procedure
|
|
13
13
|
.input(zod_1.z.object({ name: zod_1.z.string().optional() }))
|
|
14
14
|
.output(auth_dto_1.waitlistSchema)
|
|
15
15
|
.mutation(async ({ input, ctx }) => {
|
|
16
|
-
return (0,
|
|
16
|
+
return (0, trpc_1.handleTRPCResult)(await authService.createInvitationCode(input, ctx));
|
|
17
17
|
}),
|
|
18
|
-
createAccountClaimCode:
|
|
18
|
+
createAccountClaimCode: adminProcedure
|
|
19
19
|
.input(zod_1.z.object({
|
|
20
20
|
userId: zod_1.z.string(),
|
|
21
21
|
expiresInHours: zod_1.z.number().optional(),
|
|
22
22
|
}))
|
|
23
23
|
.output(auth_dto_1.accountClaimSchema)
|
|
24
24
|
.mutation(async ({ input }) => {
|
|
25
|
-
return (0,
|
|
25
|
+
return (0, trpc_1.handleTRPCResult)(await authService.createAccountClaimCode(input));
|
|
26
26
|
}),
|
|
27
|
-
listAccountClaims:
|
|
28
|
-
return (0,
|
|
27
|
+
listAccountClaims: adminProcedure.output(zod_1.z.array(auth_dto_1.accountClaimOutputSchema)).query(async () => {
|
|
28
|
+
return (0, trpc_1.handleTRPCResult)(await authService.listAccountClaims());
|
|
29
29
|
}),
|
|
30
|
-
generateAccountClaimMagicLink:
|
|
30
|
+
generateAccountClaimMagicLink: adminProcedure
|
|
31
31
|
.input(zod_1.z.object({
|
|
32
32
|
claimId: zod_1.z.string(),
|
|
33
33
|
email: zod_1.z.string().email().optional(),
|
|
34
34
|
}))
|
|
35
35
|
.output(auth_dto_1.accountClaimMagicLinkOutputSchema)
|
|
36
36
|
.mutation(async ({ input }) => {
|
|
37
|
-
return (0,
|
|
37
|
+
return (0, trpc_1.handleTRPCResult)(await authService.generateAccountClaimMagicLink(input));
|
|
38
38
|
}),
|
|
39
|
-
listAccountClaimMagicLinks:
|
|
39
|
+
listAccountClaimMagicLinks: adminProcedure
|
|
40
40
|
.input(zod_1.z.object({
|
|
41
41
|
claimId: zod_1.z.string(),
|
|
42
42
|
}))
|
|
43
43
|
.output(zod_1.z.array(auth_dto_1.accountClaimMagicLinkOutputSchema))
|
|
44
44
|
.query(async ({ input }) => {
|
|
45
|
-
return (0,
|
|
45
|
+
return (0, trpc_1.handleTRPCResult)(await authService.listAccountClaimMagicLinks(input));
|
|
46
46
|
}),
|
|
47
|
-
getMyAccountClaimStatus:
|
|
48
|
-
|
|
47
|
+
getMyAccountClaimStatus: procedure
|
|
48
|
+
.output(auth_dto_1.accountClaimSchema.nullable())
|
|
49
|
+
.query(async ({ ctx }) => {
|
|
50
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getMyAccountClaimStatus(ctx));
|
|
49
51
|
}),
|
|
50
|
-
setMyAccountClaimEmail:
|
|
52
|
+
setMyAccountClaimEmail: procedure
|
|
51
53
|
.input(zod_1.z.object({
|
|
52
54
|
email: zod_1.z.string().email(),
|
|
53
55
|
}))
|
|
54
56
|
.output(zod_1.z.object({ status: zod_1.z.boolean() }))
|
|
55
57
|
.mutation(async ({ input, ctx }) => {
|
|
56
|
-
return (0,
|
|
58
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setMyAccountClaimEmail(input, ctx));
|
|
57
59
|
}),
|
|
58
|
-
acceptMyAccountClaim:
|
|
60
|
+
acceptMyAccountClaim: procedure
|
|
59
61
|
.output(zod_1.z.object({ status: zod_1.z.boolean() }))
|
|
60
62
|
.mutation(async ({ ctx }) => {
|
|
61
|
-
return (0,
|
|
63
|
+
return (0, trpc_1.handleTRPCResult)(await authService.acceptMyAccountClaim(ctx));
|
|
62
64
|
}),
|
|
63
|
-
listWaitlist:
|
|
64
|
-
return (0,
|
|
65
|
+
listWaitlist: procedure.output(zod_1.z.array(auth_dto_1.waitlistSchema)).query(async ({ ctx }) => {
|
|
66
|
+
return (0, trpc_1.handleTRPCResult)(await authService.listWaitlist(ctx));
|
|
65
67
|
}),
|
|
66
|
-
listAdminWaitlist:
|
|
67
|
-
return (0,
|
|
68
|
+
listAdminWaitlist: adminProcedure.output(zod_1.z.array(auth_dto_1.waitlistOutputSchema)).query(async () => {
|
|
69
|
+
return (0, trpc_1.handleTRPCResult)(await authService.listAdminWaitlist());
|
|
68
70
|
}),
|
|
69
|
-
addToWaitlist:
|
|
71
|
+
addToWaitlist: adminProcedure
|
|
70
72
|
.input(zod_1.z.object({
|
|
71
73
|
email: zod_1.z.string(),
|
|
72
74
|
}))
|
|
73
75
|
.output(auth_dto_1.waitlistOutputSchema)
|
|
74
76
|
.mutation(async ({ input }) => {
|
|
75
|
-
return (0,
|
|
77
|
+
return (0, trpc_1.handleTRPCResult)(await authService.addToWaitlist(input));
|
|
76
78
|
}),
|
|
77
|
-
inviteToWaitlist:
|
|
79
|
+
inviteToWaitlist: procedure
|
|
78
80
|
.input(zod_1.z.object({
|
|
79
81
|
email: zod_1.z.string(),
|
|
80
82
|
name: zod_1.z.string().optional(),
|
|
81
83
|
}))
|
|
82
84
|
.output(auth_dto_1.waitlistSchema)
|
|
83
85
|
.mutation(async ({ input, ctx }) => {
|
|
84
|
-
return (0,
|
|
86
|
+
return (0, trpc_1.handleTRPCResult)(await authService.inviteToWaitlist(input, ctx));
|
|
85
87
|
}),
|
|
86
|
-
inviteFromWaitlist:
|
|
88
|
+
inviteFromWaitlist: adminProcedure
|
|
87
89
|
.input(zod_1.z.object({
|
|
88
90
|
id: zod_1.z.string(),
|
|
89
91
|
}))
|
|
90
92
|
.output(auth_dto_1.waitlistOutputSchema)
|
|
91
93
|
.mutation(async ({ input }) => {
|
|
92
|
-
return (0,
|
|
94
|
+
return (0, trpc_1.handleTRPCResult)(await authService.inviteFromWaitlist(input));
|
|
93
95
|
}),
|
|
94
|
-
removeFromWaitlist:
|
|
96
|
+
removeFromWaitlist: adminProcedure
|
|
95
97
|
.input(zod_1.z.object({
|
|
96
98
|
id: zod_1.z.string(),
|
|
97
99
|
}))
|
|
98
100
|
.output(auth_dto_1.waitlistOutputSchema)
|
|
99
101
|
.mutation(async ({ input }) => {
|
|
100
|
-
return (0,
|
|
102
|
+
return (0, trpc_1.handleTRPCResult)(await authService.removeFromWaitlist(input));
|
|
101
103
|
}),
|
|
102
|
-
joinWaitlist:
|
|
104
|
+
joinWaitlist: publicProcedure
|
|
103
105
|
.input(zod_1.z.object({
|
|
104
106
|
email: zod_1.z.string(),
|
|
105
107
|
}))
|
|
106
108
|
.output(auth_dto_1.waitlistOutputSchema)
|
|
107
109
|
.mutation(async ({ input }) => {
|
|
108
|
-
return (0,
|
|
110
|
+
return (0, trpc_1.handleTRPCResult)(await authService.joinWaitlist(input));
|
|
109
111
|
}),
|
|
110
|
-
getOnboarding:
|
|
111
|
-
return (0,
|
|
112
|
+
getOnboarding: procedure.output(zod_1.z.number()).query(async ({ ctx }) => {
|
|
113
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getOnboarding(ctx));
|
|
112
114
|
}),
|
|
113
|
-
setOnboarding:
|
|
115
|
+
setOnboarding: procedure
|
|
114
116
|
.input(zod_1.z.number())
|
|
115
117
|
.output(zod_1.z.number())
|
|
116
118
|
.mutation(async ({ ctx, input }) => {
|
|
117
|
-
return (0,
|
|
119
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setOnboarding(input, ctx));
|
|
118
120
|
}),
|
|
119
|
-
getPreferences:
|
|
120
|
-
return (0,
|
|
121
|
+
getPreferences: procedure.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).query(async ({ ctx }) => {
|
|
122
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getPreferences(ctx));
|
|
121
123
|
}),
|
|
122
|
-
setPreferences:
|
|
124
|
+
setPreferences: procedure
|
|
123
125
|
.input(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
124
126
|
.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
125
127
|
.mutation(async ({ ctx, input }) => {
|
|
126
|
-
return (0,
|
|
128
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setPreferences(input, ctx));
|
|
127
129
|
}),
|
|
128
|
-
getMetadata:
|
|
129
|
-
return (0,
|
|
130
|
+
getMetadata: procedure.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).query(async ({ ctx }) => {
|
|
131
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getMetadata(ctx));
|
|
130
132
|
}),
|
|
131
|
-
setMetadata:
|
|
133
|
+
setMetadata: procedure
|
|
132
134
|
.input(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
133
135
|
.output(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
|
|
134
136
|
.mutation(async ({ ctx, input }) => {
|
|
135
|
-
return (0,
|
|
137
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setMetadata(input, ctx));
|
|
136
138
|
}),
|
|
137
|
-
getFlags:
|
|
138
|
-
return (0,
|
|
139
|
+
getFlags: procedure.output(zod_1.z.array(zod_1.z.string())).query(async ({ ctx }) => {
|
|
140
|
+
return (0, trpc_1.handleTRPCResult)(await authService.getFlags(ctx));
|
|
139
141
|
}),
|
|
140
|
-
setFlags:
|
|
142
|
+
setFlags: procedure
|
|
141
143
|
.input(zod_1.z.array(zod_1.z.string()))
|
|
142
144
|
.output(zod_1.z.array(zod_1.z.string()))
|
|
143
145
|
.mutation(async ({ ctx, input }) => {
|
|
144
|
-
return (0,
|
|
146
|
+
return (0, trpc_1.handleTRPCResult)(await authService.setFlags(input, ctx));
|
|
145
147
|
}),
|
|
146
|
-
validateWaitlistCode:
|
|
148
|
+
validateWaitlistCode: publicProcedure
|
|
147
149
|
.input(zod_1.z.object({
|
|
148
150
|
code: zod_1.z.string(),
|
|
149
151
|
}))
|
|
@@ -151,7 +153,7 @@ function createAuthTRPC(authService) {
|
|
|
151
153
|
status: zod_1.z.string(),
|
|
152
154
|
}))
|
|
153
155
|
.query(async ({ input }) => {
|
|
154
|
-
return (0,
|
|
156
|
+
return (0, trpc_1.handleTRPCResult)(await authService.validateWaitlistCode(input.code));
|
|
155
157
|
}),
|
|
156
158
|
});
|
|
157
159
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { QueryFilter, QueryInput } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
2
|
-
import type { Session, User } from "#modules/auth/auth.lib";
|
|
2
|
+
import type { Context, Session, User } from "#modules/auth/auth.lib";
|
|
3
3
|
import { Base } from "#modules/base/base.abstract";
|
|
4
4
|
import type { ServerResult, ServerResultAsync } from "#modules/base/base.dto";
|
|
5
5
|
import { type Entity, type ResourceActionGrant, type ResourceGrant } from "#modules/base/base.grants";
|
|
6
6
|
import type { BaseExternaRepository, BaseRepository } from "#modules/base/base.repository";
|
|
7
|
-
import type { Context } from "#trpc";
|
|
8
7
|
export declare class BaseService<Repositories extends Record<string, BaseRepository<any, any, any> | BaseExternaRepository>, Services extends Record<string, BaseService<any, any>>> extends Base {
|
|
9
8
|
repository: Repositories;
|
|
10
9
|
service: Services;
|
|
11
10
|
constructor(repository?: Repositories, service?: Services);
|
|
12
11
|
addUserFilter(value: string, query?: QueryInput, columnId?: string, method?: QueryFilter["method"]): QueryInput;
|
|
13
|
-
addContextFilter(ctx:
|
|
12
|
+
addContextFilter(ctx: Context, include?: {
|
|
14
13
|
user?: boolean;
|
|
15
14
|
organization?: boolean;
|
|
16
15
|
team?: boolean;
|