@m5kdev/backend 0.1.5 → 0.3.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/access/access.repository.d.ts +2 -2
- package/dist/src/modules/access/access.repository.js +2 -2
- package/dist/src/modules/access/access.service.d.ts +4 -4
- package/dist/src/modules/access/access.service.js +1 -1
- package/dist/src/modules/access/access.test.js +4 -4
- package/dist/src/modules/ai/ai.db.js +1 -1
- package/dist/src/modules/ai/ai.prompt.js +1 -1
- package/dist/src/modules/ai/ai.repository.d.ts +2 -2
- package/dist/src/modules/ai/ai.repository.js +2 -2
- package/dist/src/modules/ai/ai.service.d.ts +6 -6
- package/dist/src/modules/ai/ai.service.js +1 -1
- package/dist/src/modules/ai/ai.trpc.d.ts +6 -42
- package/dist/src/modules/ai/ai.trpc.js +5 -5
- package/dist/src/modules/ai/ideogram/ideogram.dto.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.prompt.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts +3 -3
- package/dist/src/modules/ai/ideogram/ideogram.repository.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts +4 -4
- package/dist/src/modules/ai/ideogram/ideogram.service.js +1 -1
- package/dist/src/modules/auth/auth.dto.d.ts +5 -5
- package/dist/src/modules/auth/auth.lib.d.ts +10 -10
- package/dist/src/modules/auth/auth.lib.js +4 -4
- package/dist/src/modules/auth/auth.middleware.d.ts +1 -1
- package/dist/src/modules/auth/auth.middleware.js +2 -2
- package/dist/src/modules/auth/auth.repository.d.ts +4 -4
- package/dist/src/modules/auth/auth.repository.js +2 -2
- package/dist/src/modules/auth/auth.service.d.ts +7 -7
- package/dist/src/modules/auth/auth.service.js +2 -2
- package/dist/src/modules/auth/auth.trpc.d.ts +45 -81
- package/dist/src/modules/auth/auth.trpc.js +57 -55
- package/dist/src/modules/auth/auth.utils.js +1 -1
- package/dist/src/modules/base/base.abstract.d.ts +4 -4
- package/dist/src/modules/base/base.abstract.js +2 -2
- package/dist/src/modules/base/base.dto.d.ts +3 -3
- package/dist/src/modules/base/base.grants.d.ts +2 -2
- package/dist/src/modules/base/base.grants.test.js +2 -2
- package/dist/src/modules/base/base.repository.d.ts +2 -2
- package/dist/src/modules/base/base.repository.js +5 -5
- package/dist/src/modules/base/base.service.d.ts +6 -7
- package/dist/src/modules/base/base.service.js +2 -2
- package/dist/src/modules/billing/billing.repository.d.ts +2 -2
- package/dist/src/modules/billing/billing.repository.js +4 -4
- package/dist/src/modules/billing/billing.router.d.ts +2 -2
- package/dist/src/modules/billing/billing.service.d.ts +4 -4
- package/dist/src/modules/billing/billing.service.js +2 -2
- package/dist/src/modules/billing/billing.trpc.d.ts +7 -43
- package/dist/src/modules/billing/billing.trpc.js +7 -7
- package/dist/src/modules/clay/clay.repository.d.ts +2 -2
- package/dist/src/modules/clay/clay.repository.js +1 -1
- package/dist/src/modules/clay/clay.service.d.ts +3 -3
- package/dist/src/modules/clay/clay.service.js +1 -1
- package/dist/src/modules/connect/connect.dto.d.ts +4 -4
- package/dist/src/modules/connect/connect.oauth.js +1 -1
- package/dist/src/modules/connect/connect.repository.d.ts +4 -4
- package/dist/src/modules/connect/connect.repository.js +2 -2
- package/dist/src/modules/connect/connect.router.d.ts +1 -1
- package/dist/src/modules/connect/connect.service.d.ts +12 -12
- package/dist/src/modules/connect/connect.service.js +1 -1
- package/dist/src/modules/connect/connect.trpc.d.ts +7 -43
- package/dist/src/modules/connect/connect.trpc.js +7 -7
- package/dist/src/modules/crypto/crypto.repository.d.ts +1 -1
- package/dist/src/modules/crypto/crypto.repository.js +2 -2
- package/dist/src/modules/crypto/crypto.service.d.ts +3 -3
- package/dist/src/modules/crypto/crypto.service.js +1 -1
- package/dist/src/modules/email/email.service.d.ts +1 -1
- package/dist/src/modules/email/email.service.js +1 -1
- package/dist/src/modules/file/file.repository.d.ts +2 -2
- package/dist/src/modules/file/file.repository.js +1 -1
- package/dist/src/modules/file/file.router.js +2 -2
- package/dist/src/modules/file/file.service.d.ts +3 -3
- package/dist/src/modules/file/file.service.js +1 -1
- package/dist/src/modules/recurrence/recurrence.db.js +1 -1
- package/dist/src/modules/recurrence/recurrence.repository.d.ts +2 -2
- package/dist/src/modules/recurrence/recurrence.repository.js +2 -2
- package/dist/src/modules/recurrence/recurrence.service.d.ts +4 -4
- package/dist/src/modules/recurrence/recurrence.service.js +1 -1
- 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/social/social.service.d.ts +5 -5
- package/dist/src/modules/social/social.service.js +1 -1
- package/dist/src/modules/social/social.types.d.ts +2 -2
- package/dist/src/modules/tag/tag.db.js +1 -1
- package/dist/src/modules/tag/tag.dto.d.ts +1 -1
- package/dist/src/modules/tag/tag.dto.js +2 -2
- package/dist/src/modules/tag/tag.repository.d.ts +3 -3
- package/dist/src/modules/tag/tag.repository.js +2 -2
- package/dist/src/modules/tag/tag.service.d.ts +6 -6
- package/dist/src/modules/tag/tag.service.js +1 -1
- package/dist/src/modules/tag/tag.trpc.d.ts +11 -47
- package/dist/src/modules/tag/tag.trpc.js +16 -16
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts +1 -1
- package/dist/src/modules/video/video.service.d.ts +2 -2
- package/dist/src/modules/video/video.service.js +1 -1
- package/dist/src/modules/webhook/webhook.dto.js +1 -1
- package/dist/src/modules/webhook/webhook.repository.d.ts +2 -2
- package/dist/src/modules/webhook/webhook.repository.js +1 -1
- package/dist/src/modules/webhook/webhook.service.d.ts +2 -2
- package/dist/src/modules/webhook/webhook.service.js +1 -1
- package/dist/src/modules/workflow/workflow.db.js +1 -1
- package/dist/src/modules/workflow/workflow.repository.d.ts +2 -2
- package/dist/src/modules/workflow/workflow.repository.js +2 -2
- package/dist/src/modules/workflow/workflow.service.d.ts +4 -4
- package/dist/src/modules/workflow/workflow.service.js +1 -1
- package/dist/src/modules/workflow/workflow.trpc.d.ts +7 -43
- package/dist/src/modules/workflow/workflow.trpc.js +7 -7
- package/dist/src/modules/workflow/workflow.types.d.ts +2 -2
- package/dist/src/modules/workflow/workflow.utils.js +3 -3
- package/dist/src/types.d.ts +56 -203
- package/dist/src/types.js +7 -8
- package/dist/src/utils/errors.d.ts +1 -1
- 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 -30
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.recurrenceRules = exports.recurrence = void 0;
|
|
4
4
|
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
-
const auth_db_1 = require("
|
|
6
|
+
const auth_db_1 = require("../auth/auth.db");
|
|
7
7
|
exports.recurrence = (0, sqlite_core_1.sqliteTable)("recurrence", {
|
|
8
8
|
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
9
9
|
userId: (0, sqlite_core_1.text)("user_id").references(() => auth_db_1.users.id, { onDelete: "cascade" }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
|
2
2
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseTableRepository } from "
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseTableRepository } from "../base/base.repository";
|
|
5
5
|
declare const schema: {
|
|
6
6
|
recurrence: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
7
7
|
name: "recurrence";
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RecurrenceRulesRepository = exports.RecurrenceRepository = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const neverthrow_1 = require("neverthrow");
|
|
6
|
-
const base_repository_1 = require("
|
|
7
|
-
const recurrence = tslib_1.__importStar(require("
|
|
6
|
+
const base_repository_1 = require("../base/base.repository");
|
|
7
|
+
const recurrence = tslib_1.__importStar(require("./recurrence.db"));
|
|
8
8
|
const schema = { ...recurrence };
|
|
9
9
|
class RecurrenceRepository extends base_repository_1.BaseTableRepository {
|
|
10
10
|
async createWithRules(recurrenceData, rulesData, tx) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CreateRecurrenceSchema, DeleteRecurrenceRulesSchema, DeleteRecurrenceSchema, UpdateRecurrenceRulesSchema, UpdateRecurrenceSchema } from "@m5kdev/commons/modules/recurrence/recurrence.schema";
|
|
2
2
|
import type { QueryInput } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
3
|
-
import type { Context, User } from "
|
|
4
|
-
import type { ServerResultAsync } from "
|
|
5
|
-
import { BaseService } from "
|
|
6
|
-
import type { CreateWithRulesResult, RecurrenceRepository, RecurrenceRulesRepository } from "
|
|
3
|
+
import type { Context, User } from "../auth/auth.lib";
|
|
4
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
|
+
import { BaseService } from "../base/base.service";
|
|
6
|
+
import type { CreateWithRulesResult, RecurrenceRepository, RecurrenceRulesRepository } from "./recurrence.repository";
|
|
7
7
|
export declare class RecurrenceService extends BaseService<{
|
|
8
8
|
recurrence: RecurrenceRepository;
|
|
9
9
|
recurrenceRules: RecurrenceRulesRepository;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RecurrenceService = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const base_service_1 = require("
|
|
5
|
+
const base_service_1 = require("../base/base.service");
|
|
6
6
|
const RECURRENCE_RULE_INSERT_KEYS = [
|
|
7
7
|
"freq",
|
|
8
8
|
"dtstart",
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import type { RecurrenceService } from "
|
|
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;
|
|
1
|
+
import type { RecurrenceService } from "./recurrence.service";
|
|
2
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
3
|
+
export declare function createRecurrenceTRPC({ router, privateProcedure: procedure }: TRPCMethods, recurrenceService: RecurrenceService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
|
+
ctx: import("../auth/auth.lib").Context;
|
|
5
|
+
meta: any;
|
|
42
6
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
43
7
|
transformer: true;
|
|
44
8
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
@@ -72,7 +36,7 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
72
36
|
}[];
|
|
73
37
|
total: number;
|
|
74
38
|
};
|
|
75
|
-
meta:
|
|
39
|
+
meta: any;
|
|
76
40
|
}>;
|
|
77
41
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
78
42
|
input: {
|
|
@@ -135,7 +99,7 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
135
99
|
bysecond?: number | number[] | null | undefined;
|
|
136
100
|
}[];
|
|
137
101
|
};
|
|
138
|
-
meta:
|
|
102
|
+
meta: any;
|
|
139
103
|
}>;
|
|
140
104
|
findById: import("@trpc/server").TRPCQueryProcedure<{
|
|
141
105
|
input: {
|
|
@@ -153,7 +117,7 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
153
117
|
kind?: string | null | undefined;
|
|
154
118
|
metadata?: Record<string, unknown> | null | undefined;
|
|
155
119
|
} | null;
|
|
156
|
-
meta:
|
|
120
|
+
meta: any;
|
|
157
121
|
}>;
|
|
158
122
|
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
159
123
|
input: {
|
|
@@ -175,7 +139,7 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
175
139
|
kind?: string | null | undefined;
|
|
176
140
|
metadata?: Record<string, unknown> | null | undefined;
|
|
177
141
|
};
|
|
178
|
-
meta:
|
|
142
|
+
meta: any;
|
|
179
143
|
}>;
|
|
180
144
|
updateRule: import("@trpc/server").TRPCMutationProcedure<{
|
|
181
145
|
input: {
|
|
@@ -219,7 +183,7 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
219
183
|
byminute?: number | number[] | null | undefined;
|
|
220
184
|
bysecond?: number | number[] | null | undefined;
|
|
221
185
|
};
|
|
222
|
-
meta:
|
|
186
|
+
meta: any;
|
|
223
187
|
}>;
|
|
224
188
|
delete: import("@trpc/server").TRPCMutationProcedure<{
|
|
225
189
|
input: {
|
|
@@ -228,7 +192,7 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
228
192
|
output: {
|
|
229
193
|
id: string;
|
|
230
194
|
};
|
|
231
|
-
meta:
|
|
195
|
+
meta: any;
|
|
232
196
|
}>;
|
|
233
197
|
deleteRule: import("@trpc/server").TRPCMutationProcedure<{
|
|
234
198
|
input: {
|
|
@@ -237,6 +201,6 @@ export declare function createRecurrenceTRPC(recurrenceService: RecurrenceServic
|
|
|
237
201
|
output: {
|
|
238
202
|
id: string;
|
|
239
203
|
};
|
|
240
|
-
meta:
|
|
204
|
+
meta: any;
|
|
241
205
|
}>;
|
|
242
206
|
}>>;
|
|
@@ -4,7 +4,7 @@ exports.createRecurrenceTRPC = createRecurrenceTRPC;
|
|
|
4
4
|
const recurrence_schema_1 = require("@m5kdev/commons/modules/recurrence/recurrence.schema");
|
|
5
5
|
const query_schema_1 = require("@m5kdev/commons/modules/schemas/query.schema");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
-
const
|
|
7
|
+
const trpc_1 = require("../../utils/trpc");
|
|
8
8
|
const createRecurrenceOutputSchema = zod_1.z.object({
|
|
9
9
|
recurrence: recurrence_schema_1.recurrenceSchema,
|
|
10
10
|
rules: zod_1.z.array(recurrence_schema_1.recurrenceRulesSchema),
|
|
@@ -17,49 +17,49 @@ const updateRecurrenceInputSchema = recurrence_schema_1.updateRecurrenceSchema.e
|
|
|
17
17
|
id: zod_1.z.string(),
|
|
18
18
|
});
|
|
19
19
|
const deleteRecurrenceOutputSchema = zod_1.z.object({ id: zod_1.z.string() });
|
|
20
|
-
function createRecurrenceTRPC(recurrenceService) {
|
|
21
|
-
return
|
|
22
|
-
list:
|
|
20
|
+
function createRecurrenceTRPC({ router, privateProcedure: procedure }, recurrenceService) {
|
|
21
|
+
return router({
|
|
22
|
+
list: procedure
|
|
23
23
|
.input(query_schema_1.querySchema.optional())
|
|
24
24
|
.output(listRecurrenceOutputSchema)
|
|
25
25
|
.query(async ({ ctx, input }) => {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.list(input, ctx));
|
|
27
27
|
}),
|
|
28
|
-
create:
|
|
28
|
+
create: procedure
|
|
29
29
|
.input(recurrence_schema_1.createRecurrenceSchema)
|
|
30
30
|
.output(createRecurrenceOutputSchema)
|
|
31
31
|
.mutation(async ({ ctx, input }) => {
|
|
32
|
-
return (0,
|
|
32
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.create(input, ctx));
|
|
33
33
|
}),
|
|
34
|
-
findById:
|
|
34
|
+
findById: procedure
|
|
35
35
|
.input(zod_1.z.object({ id: zod_1.z.string() }))
|
|
36
36
|
.output(recurrence_schema_1.recurrenceSchema.nullable())
|
|
37
37
|
.query(async ({ input }) => {
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.findById(input.id));
|
|
39
39
|
}),
|
|
40
|
-
update:
|
|
40
|
+
update: procedure
|
|
41
41
|
.input(updateRecurrenceInputSchema)
|
|
42
42
|
.output(recurrence_schema_1.recurrenceSchema)
|
|
43
43
|
.mutation(async ({ input }) => {
|
|
44
|
-
return (0,
|
|
44
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.update(input));
|
|
45
45
|
}),
|
|
46
|
-
updateRule:
|
|
46
|
+
updateRule: procedure
|
|
47
47
|
.input(recurrence_schema_1.updateRecurrenceRulesSchema)
|
|
48
48
|
.output(recurrence_schema_1.recurrenceRulesSchema)
|
|
49
49
|
.mutation(async ({ input }) => {
|
|
50
|
-
return (0,
|
|
50
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.updateRule(input));
|
|
51
51
|
}),
|
|
52
|
-
delete:
|
|
52
|
+
delete: procedure
|
|
53
53
|
.input(recurrence_schema_1.deleteRecurrenceSchema)
|
|
54
54
|
.output(deleteRecurrenceOutputSchema)
|
|
55
55
|
.mutation(async ({ input }) => {
|
|
56
|
-
return (0,
|
|
56
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.delete(input));
|
|
57
57
|
}),
|
|
58
|
-
deleteRule:
|
|
58
|
+
deleteRule: procedure
|
|
59
59
|
.input(recurrence_schema_1.deleteRecurrenceRulesSchema)
|
|
60
60
|
.output(deleteRecurrenceOutputSchema)
|
|
61
61
|
.mutation(async ({ input }) => {
|
|
62
|
-
return (0,
|
|
62
|
+
return (0, trpc_1.handleTRPCResult)(await recurrenceService.deleteRule(input));
|
|
63
63
|
}),
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ServerResultAsync } from "
|
|
2
|
-
import { BaseService } from "
|
|
3
|
-
import type { ConnectRepository } from "
|
|
4
|
-
import type { ConnectService } from "
|
|
5
|
-
import type { FileService } from "
|
|
1
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
2
|
+
import { BaseService } from "../base/base.service";
|
|
3
|
+
import type { ConnectRepository } from "../connect/connect.repository";
|
|
4
|
+
import type { ConnectService } from "../connect/connect.service";
|
|
5
|
+
import type { FileService } from "../file/file.service";
|
|
6
6
|
import type { SocialPostInput } from "./social.dto";
|
|
7
7
|
import type { SocialPostResult, SocialProvider } from "./social.types";
|
|
8
8
|
export declare class SocialService extends BaseService<{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SocialService = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const base_service_1 = require("
|
|
5
|
+
const base_service_1 = require("../base/base.service");
|
|
6
6
|
class SocialService extends base_service_1.BaseService {
|
|
7
7
|
providers = new Map();
|
|
8
8
|
constructor(repositories, services, providers) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ConnectRow } from "
|
|
2
|
-
import type { FileService } from "
|
|
1
|
+
import type { ConnectRow } from "../connect/connect.repository";
|
|
2
|
+
import type { FileService } from "../file/file.service";
|
|
3
3
|
export type SocialMediaType = "image" | "video" | "document";
|
|
4
4
|
export interface SocialMediaDescriptor {
|
|
5
5
|
readonly s3Path: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.taggings = exports.tags = void 0;
|
|
4
4
|
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
-
const auth_db_1 = require("
|
|
6
|
+
const auth_db_1 = require("../auth/auth.db");
|
|
7
7
|
exports.tags = (0, sqlite_core_1.sqliteTable)("tags", {
|
|
8
8
|
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
9
9
|
createdAt: (0, sqlite_core_1.integer)("created_at", { mode: "timestamp" })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Result } from "neverthrow";
|
|
2
2
|
import type { z } from "zod";
|
|
3
|
-
import type { ServerError } from "
|
|
3
|
+
import type { ServerError } from "../../utils/errors";
|
|
4
4
|
export declare const tagsSelectDTO: {
|
|
5
5
|
columns: {
|
|
6
6
|
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.taggingsSelectOutput = exports.tagsSelectOutput = exports.taggingsSelectDTO = exports.tagsSelectDTO = void 0;
|
|
4
|
-
const base_dto_1 = require("
|
|
5
|
-
const tag_db_1 = require("
|
|
4
|
+
const base_dto_1 = require("../base/base.dto");
|
|
5
|
+
const tag_db_1 = require("./tag.db");
|
|
6
6
|
exports.tagsSelectDTO = (0, base_dto_1.createSelectDTO)(tag_db_1.tags);
|
|
7
7
|
exports.taggingsSelectDTO = (0, base_dto_1.createSelectDTO)(tag_db_1.taggings);
|
|
8
8
|
exports.tagsSelectOutput = exports.tagsSelectDTO.schema;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TaggingSchema, TagLinkSchema, TagListInputSchema, TagListSchema, TagSchema } from "@m5kdev/commons/modules/tag/tag.schema";
|
|
2
2
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseTableRepository } from "
|
|
5
|
-
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseTableRepository } from "../base/base.repository";
|
|
5
|
+
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "./tag.dto";
|
|
6
6
|
declare const schema: {
|
|
7
7
|
tags: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
8
8
|
name: "tags";
|
|
@@ -4,8 +4,8 @@ exports.TagRepository = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
6
|
const neverthrow_1 = require("neverthrow");
|
|
7
|
-
const base_repository_1 = require("
|
|
8
|
-
const tag = tslib_1.__importStar(require("
|
|
7
|
+
const base_repository_1 = require("../base/base.repository");
|
|
8
|
+
const tag = tslib_1.__importStar(require("./tag.db"));
|
|
9
9
|
const schema = { ...tag };
|
|
10
10
|
class TagRepository extends base_repository_1.BaseTableRepository {
|
|
11
11
|
async link({ userId, ...data }, tx) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TagCreateSchema, TagLinkSchema, TagListInputSchema, TagListOutputSchema, TagListSchema, TagSchema, TagUpdateSchema } from "@m5kdev/commons/modules/tag/tag.schema";
|
|
2
|
-
import type { User } from "
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseService } from "
|
|
5
|
-
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "
|
|
6
|
-
import type { TagRepository } from "
|
|
2
|
+
import type { User } from "../auth/auth.lib";
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseService } from "../base/base.service";
|
|
5
|
+
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "./tag.dto";
|
|
6
|
+
import type { TagRepository } from "./tag.repository";
|
|
7
7
|
export declare class TagService extends BaseService<{
|
|
8
8
|
tag: TagRepository;
|
|
9
9
|
}, Record<string, never>> {
|
|
@@ -11,7 +11,7 @@ export declare class TagService extends BaseService<{
|
|
|
11
11
|
listTaggings(input: {
|
|
12
12
|
resourceType: string;
|
|
13
13
|
resourceIds?: readonly string[];
|
|
14
|
-
}): Promise<import("
|
|
14
|
+
}): Promise<import("../base/base.dto").ServerResult<{
|
|
15
15
|
id: string;
|
|
16
16
|
createdAt: Date;
|
|
17
17
|
tagId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TagService = void 0;
|
|
4
|
-
const base_service_1 = require("
|
|
4
|
+
const base_service_1 = require("../base/base.service");
|
|
5
5
|
class TagService extends base_service_1.BaseService {
|
|
6
6
|
async list(input) {
|
|
7
7
|
return this.repository.tag.list(input);
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
import type { TagService } from "
|
|
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;
|
|
1
|
+
import type { TagService } from "./tag.service";
|
|
2
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
3
|
+
export declare function createTagTRPC({ router, privateProcedure: procedure }: TRPCMethods, tagService: TagService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
|
+
ctx: import("../auth/auth.lib").Context;
|
|
5
|
+
meta: any;
|
|
42
6
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
43
7
|
transformer: true;
|
|
44
8
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
@@ -76,7 +40,7 @@ export declare function createTagTRPC(tagService: TagService): import("@trpc/ser
|
|
|
76
40
|
}[];
|
|
77
41
|
total: number;
|
|
78
42
|
};
|
|
79
|
-
meta:
|
|
43
|
+
meta: any;
|
|
80
44
|
}>;
|
|
81
45
|
listTaggings: import("@trpc/server").TRPCQueryProcedure<{
|
|
82
46
|
input: {
|
|
@@ -97,7 +61,7 @@ export declare function createTagTRPC(tagService: TagService): import("@trpc/ser
|
|
|
97
61
|
resourceType: string;
|
|
98
62
|
resourceId: string;
|
|
99
63
|
}[];
|
|
100
|
-
meta:
|
|
64
|
+
meta: any;
|
|
101
65
|
}>;
|
|
102
66
|
create: import("@trpc/server").TRPCMutationProcedure<{
|
|
103
67
|
input: {
|
|
@@ -124,7 +88,7 @@ export declare function createTagTRPC(tagService: TagService): import("@trpc/ser
|
|
|
124
88
|
parentId: string | null;
|
|
125
89
|
assignableTo: string[];
|
|
126
90
|
};
|
|
127
|
-
meta:
|
|
91
|
+
meta: any;
|
|
128
92
|
}>;
|
|
129
93
|
update: import("@trpc/server").TRPCMutationProcedure<{
|
|
130
94
|
input: {
|
|
@@ -147,7 +111,7 @@ export declare function createTagTRPC(tagService: TagService): import("@trpc/ser
|
|
|
147
111
|
parentId: string | null;
|
|
148
112
|
assignableTo: string[];
|
|
149
113
|
};
|
|
150
|
-
meta:
|
|
114
|
+
meta: any;
|
|
151
115
|
}>;
|
|
152
116
|
link: import("@trpc/server").TRPCMutationProcedure<{
|
|
153
117
|
input: {
|
|
@@ -162,7 +126,7 @@ export declare function createTagTRPC(tagService: TagService): import("@trpc/ser
|
|
|
162
126
|
resourceType: string;
|
|
163
127
|
resourceId: string;
|
|
164
128
|
};
|
|
165
|
-
meta:
|
|
129
|
+
meta: any;
|
|
166
130
|
}>;
|
|
167
131
|
unlink: import("@trpc/server").TRPCMutationProcedure<{
|
|
168
132
|
input: {
|
|
@@ -185,6 +149,6 @@ export declare function createTagTRPC(tagService: TagService): import("@trpc/ser
|
|
|
185
149
|
parentId: string | null;
|
|
186
150
|
assignableTo: string[];
|
|
187
151
|
};
|
|
188
|
-
meta:
|
|
152
|
+
meta: any;
|
|
189
153
|
}>;
|
|
190
154
|
}>>;
|
|
@@ -2,46 +2,46 @@
|
|
|
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("
|
|
6
|
-
const
|
|
7
|
-
function createTagTRPC(tagService) {
|
|
5
|
+
const tag_dto_1 = require("./tag.dto");
|
|
6
|
+
const trpc_1 = require("../../utils/trpc");
|
|
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,
|
|
10
10
|
});
|
|
11
|
-
return
|
|
12
|
-
list:
|
|
11
|
+
return router({
|
|
12
|
+
list: procedure
|
|
13
13
|
.input(tagListInput)
|
|
14
14
|
.output(tag_schema_1.tagListOutputSchema)
|
|
15
|
-
.query(async ({ input }) => (0,
|
|
16
|
-
listTaggings:
|
|
15
|
+
.query(async ({ input }) => (0, trpc_1.handleTRPCResult)(await tagService.list(input))),
|
|
16
|
+
listTaggings: procedure
|
|
17
17
|
.input(tag_schema_1.taggingSchema
|
|
18
18
|
.pick({ resourceType: true })
|
|
19
19
|
.extend({ resourceIds: tag_schema_1.tagListInputSchema.shape.filters.optional() }))
|
|
20
20
|
.output(tag_dto_1.taggingsSelectOutput.array())
|
|
21
|
-
.query(async ({ input }) => (0,
|
|
22
|
-
create:
|
|
21
|
+
.query(async ({ input }) => (0, trpc_1.handleTRPCResult)(await tagService.listTaggings(input))),
|
|
22
|
+
create: procedure
|
|
23
23
|
.input(tag_schema_1.tagCreateSchema)
|
|
24
24
|
.output(tag_dto_1.tagsSelectOutput)
|
|
25
25
|
.mutation(async ({ ctx, input }) => {
|
|
26
|
-
return (0,
|
|
26
|
+
return (0, trpc_1.handleTRPCResult)(await tagService.create(input, ctx));
|
|
27
27
|
}),
|
|
28
|
-
update:
|
|
28
|
+
update: procedure
|
|
29
29
|
.input(tag_schema_1.tagUpdateSchema)
|
|
30
30
|
.output(tag_dto_1.tagsSelectOutput)
|
|
31
31
|
.mutation(async ({ ctx, input }) => {
|
|
32
|
-
return (0,
|
|
32
|
+
return (0, trpc_1.handleTRPCResult)(await tagService.update(input, ctx));
|
|
33
33
|
}),
|
|
34
|
-
link:
|
|
34
|
+
link: procedure
|
|
35
35
|
.input(tag_schema_1.tagLinkSchema)
|
|
36
36
|
.output(tag_dto_1.taggingsSelectOutput)
|
|
37
37
|
.mutation(async ({ ctx, input }) => {
|
|
38
|
-
return (0,
|
|
38
|
+
return (0, trpc_1.handleTRPCResult)(await tagService.link(input, ctx));
|
|
39
39
|
}),
|
|
40
|
-
unlink:
|
|
40
|
+
unlink: procedure
|
|
41
41
|
.input(tag_schema_1.tagLinkSchema)
|
|
42
42
|
.output(tag_dto_1.tagsSelectOutput)
|
|
43
43
|
.mutation(async ({ ctx, input }) => {
|
|
44
|
-
return (0,
|
|
44
|
+
return (0, trpc_1.handleTRPCResult)(await tagService.unlink(input, ctx));
|
|
45
45
|
}),
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { QueryFilters } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
2
2
|
import type { SQLiteTableWithColumns } from "drizzle-orm/sqlite-core";
|
|
3
|
-
import type { ConditionBuilder } from "
|
|
3
|
+
import type { ConditionBuilder } from "../base/base.repository";
|
|
4
4
|
export declare const getConditionsFromFilters: <T extends SQLiteTableWithColumns<any>>(conditions: ConditionBuilder, filters: QueryFilters | undefined, table: T) => ConditionBuilder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ServerResultAsync } from "
|
|
2
|
-
import { BaseService } from "
|
|
1
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
2
|
+
import { BaseService } from "../base/base.service";
|
|
3
3
|
export declare class VideoService extends BaseService<never, never> {
|
|
4
4
|
cut(file: string, start: number, end: number): ServerResultAsync<string>;
|
|
5
5
|
webmToWav(input: string, hz?: number): ServerResultAsync<string>;
|
|
@@ -9,7 +9,7 @@ const ffmpeg_ffprobe_static_1 = tslib_1.__importDefault(require("ffmpeg-ffprobe-
|
|
|
9
9
|
const fluent_ffmpeg_1 = tslib_1.__importDefault(require("fluent-ffmpeg"));
|
|
10
10
|
const neverthrow_1 = require("neverthrow");
|
|
11
11
|
const uuid_1 = require("uuid");
|
|
12
|
-
const base_service_1 = require("
|
|
12
|
+
const base_service_1 = require("../base/base.service");
|
|
13
13
|
if (!ffmpeg_ffprobe_static_1.default.ffmpegPath || !ffmpeg_ffprobe_static_1.default.ffprobePath) {
|
|
14
14
|
throw new Error("FFmpeg or FFprobe not found");
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webhookSelectSchema = exports.webhookSelectDTO = void 0;
|
|
4
|
-
const base_dto_1 = require("
|
|
4
|
+
const base_dto_1 = require("../base/base.dto");
|
|
5
5
|
const webhook_db_1 = require("./webhook.db");
|
|
6
6
|
exports.webhookSelectDTO = (0, base_dto_1.createSelectDTO)(webhook_db_1.webhook);
|
|
7
7
|
exports.webhookSelectSchema = exports.webhookSelectDTO.schema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
2
|
-
import type { ServerResultAsync } from "
|
|
3
|
-
import { BaseTableRepository } from "
|
|
2
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
3
|
+
import { BaseTableRepository } from "../base/base.repository";
|
|
4
4
|
declare const schema: {
|
|
5
5
|
webhook: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
6
6
|
name: "webhook";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebhookRepository = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const base_repository_1 = require("
|
|
5
|
+
const base_repository_1 = require("../base/base.repository");
|
|
6
6
|
const webhook_constants_1 = require("./webhook.constants");
|
|
7
7
|
const webhook_db_1 = require("./webhook.db");
|
|
8
8
|
const schema = { webhook: webhook_db_1.webhook };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ServerResultAsync } from "
|
|
2
|
-
import { BaseService } from "
|
|
1
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
2
|
+
import { BaseService } from "../base/base.service";
|
|
3
3
|
import type { WebhookRepository } from "./webhook.repository";
|
|
4
4
|
export declare class WebhookService extends BaseService<{
|
|
5
5
|
webhook: WebhookRepository;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WebhookService = void 0;
|
|
4
4
|
const json_1 = require("@m5kdev/commons/utils/json");
|
|
5
5
|
const neverthrow_1 = require("neverthrow");
|
|
6
|
-
const base_service_1 = require("
|
|
6
|
+
const base_service_1 = require("../base/base.service");
|
|
7
7
|
const webhook_constants_1 = require("./webhook.constants");
|
|
8
8
|
class WebhookService extends base_service_1.BaseService {
|
|
9
9
|
async completed(id, payload) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.workflows = void 0;
|
|
4
4
|
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
-
const auth_db_1 = require("
|
|
6
|
+
const auth_db_1 = require("../auth/auth.db");
|
|
7
7
|
exports.workflows = (0, sqlite_core_1.sqliteTable)("workflows", {
|
|
8
8
|
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
9
9
|
userId: (0, sqlite_core_1.text)("user_id").references(() => auth_db_1.users.id, { onDelete: "cascade" }),
|