@m5kdev/backend 0.1.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/LICENSE +621 -0
- package/README.md +22 -0
- package/package.json +205 -0
- package/src/lib/posthog.ts +5 -0
- package/src/lib/sentry.ts +8 -0
- package/src/modules/access/access.repository.ts +36 -0
- package/src/modules/access/access.service.ts +81 -0
- package/src/modules/access/access.test.ts +216 -0
- package/src/modules/access/access.utils.ts +46 -0
- package/src/modules/ai/ai.db.ts +38 -0
- package/src/modules/ai/ai.prompt.ts +47 -0
- package/src/modules/ai/ai.repository.ts +53 -0
- package/src/modules/ai/ai.router.ts +148 -0
- package/src/modules/ai/ai.service.ts +310 -0
- package/src/modules/ai/ai.trpc.ts +22 -0
- package/src/modules/ai/ideogram/ideogram.constants.ts +170 -0
- package/src/modules/ai/ideogram/ideogram.dto.ts +64 -0
- package/src/modules/ai/ideogram/ideogram.prompt.ts +858 -0
- package/src/modules/ai/ideogram/ideogram.repository.ts +39 -0
- package/src/modules/ai/ideogram/ideogram.service.ts +14 -0
- package/src/modules/auth/auth.db.ts +224 -0
- package/src/modules/auth/auth.dto.ts +47 -0
- package/src/modules/auth/auth.lib.ts +349 -0
- package/src/modules/auth/auth.middleware.ts +62 -0
- package/src/modules/auth/auth.repository.ts +672 -0
- package/src/modules/auth/auth.service.ts +261 -0
- package/src/modules/auth/auth.trpc.ts +208 -0
- package/src/modules/auth/auth.utils.ts +117 -0
- package/src/modules/base/base.abstract.ts +62 -0
- package/src/modules/base/base.dto.ts +206 -0
- package/src/modules/base/base.grants.test.ts +861 -0
- package/src/modules/base/base.grants.ts +199 -0
- package/src/modules/base/base.repository.ts +433 -0
- package/src/modules/base/base.service.ts +154 -0
- package/src/modules/base/base.types.ts +7 -0
- package/src/modules/billing/billing.db.ts +27 -0
- package/src/modules/billing/billing.repository.ts +328 -0
- package/src/modules/billing/billing.router.ts +77 -0
- package/src/modules/billing/billing.service.ts +177 -0
- package/src/modules/billing/billing.trpc.ts +17 -0
- package/src/modules/clay/clay.repository.ts +29 -0
- package/src/modules/clay/clay.service.ts +61 -0
- package/src/modules/connect/connect.db.ts +32 -0
- package/src/modules/connect/connect.dto.ts +44 -0
- package/src/modules/connect/connect.linkedin.ts +70 -0
- package/src/modules/connect/connect.oauth.ts +288 -0
- package/src/modules/connect/connect.repository.ts +65 -0
- package/src/modules/connect/connect.router.ts +76 -0
- package/src/modules/connect/connect.service.ts +171 -0
- package/src/modules/connect/connect.trpc.ts +26 -0
- package/src/modules/connect/connect.types.ts +27 -0
- package/src/modules/crypto/crypto.db.ts +15 -0
- package/src/modules/crypto/crypto.repository.ts +13 -0
- package/src/modules/crypto/crypto.service.ts +57 -0
- package/src/modules/email/email.service.ts +222 -0
- package/src/modules/file/file.repository.ts +95 -0
- package/src/modules/file/file.router.ts +108 -0
- package/src/modules/file/file.service.ts +186 -0
- package/src/modules/recurrence/recurrence.db.ts +79 -0
- package/src/modules/recurrence/recurrence.repository.ts +70 -0
- package/src/modules/recurrence/recurrence.service.ts +105 -0
- package/src/modules/recurrence/recurrence.trpc.ts +82 -0
- package/src/modules/social/social.dto.ts +22 -0
- package/src/modules/social/social.linkedin.test.ts +277 -0
- package/src/modules/social/social.linkedin.ts +593 -0
- package/src/modules/social/social.service.ts +112 -0
- package/src/modules/social/social.types.ts +43 -0
- package/src/modules/tag/tag.db.ts +41 -0
- package/src/modules/tag/tag.dto.ts +18 -0
- package/src/modules/tag/tag.repository.ts +222 -0
- package/src/modules/tag/tag.service.ts +48 -0
- package/src/modules/tag/tag.trpc.ts +62 -0
- package/src/modules/uploads/0581796b-8845-420d-bd95-cd7de79f6d37.webm +0 -0
- package/src/modules/uploads/33b1e649-6727-4bd0-94d0-a0b363646865.webm +0 -0
- package/src/modules/uploads/49a8c4c0-54d7-4c94-bef4-c93c029f9ed0.webm +0 -0
- package/src/modules/uploads/50e31e38-a2f0-47ca-8b7d-2d7fcad9267d.webm +0 -0
- package/src/modules/uploads/72ac8cf9-c3a7-4cd8-8a78-6d8e137a4c7e.webm +0 -0
- package/src/modules/uploads/75293649-d966-46cd-a675-67518958ae9c.png +0 -0
- package/src/modules/uploads/88b7b867-ce15-4891-bf73-81305a7de1f7.wav +0 -0
- package/src/modules/uploads/a5d6fee8-6a59-42c6-9d4a-ac8a3c5e7245.webm +0 -0
- package/src/modules/uploads/c13a9785-ca5a-4983-af30-b338ed76d370.webm +0 -0
- package/src/modules/uploads/caa1a5a7-71ba-4381-902d-7e2cafdf6dcb.webm +0 -0
- package/src/modules/uploads/cbeb0b81-374d-445b-914b-40ace7c8e031.webm +0 -0
- package/src/modules/uploads/d626aa82-b10f-493f-aee7-87bfb3361dfc.webm +0 -0
- package/src/modules/uploads/d7de4c16-de0c-495d-9612-e72260a6ecca.png +0 -0
- package/src/modules/uploads/e532e38a-6421-400e-8a5f-8e7bc8ce411b.wav +0 -0
- package/src/modules/uploads/e86ec867-6adf-4c51-84e0-00b0836625e8.webm +0 -0
- package/src/modules/utils/applyPagination.ts +13 -0
- package/src/modules/utils/applySorting.ts +21 -0
- package/src/modules/utils/getConditionsFromFilters.ts +216 -0
- package/src/modules/video/video.service.ts +89 -0
- package/src/modules/webhook/webhook.constants.ts +9 -0
- package/src/modules/webhook/webhook.db.ts +15 -0
- package/src/modules/webhook/webhook.dto.ts +9 -0
- package/src/modules/webhook/webhook.repository.ts +68 -0
- package/src/modules/webhook/webhook.router.ts +29 -0
- package/src/modules/webhook/webhook.service.ts +78 -0
- package/src/modules/workflow/workflow.db.ts +29 -0
- package/src/modules/workflow/workflow.repository.ts +171 -0
- package/src/modules/workflow/workflow.service.ts +56 -0
- package/src/modules/workflow/workflow.trpc.ts +26 -0
- package/src/modules/workflow/workflow.types.ts +30 -0
- package/src/modules/workflow/workflow.utils.ts +259 -0
- package/src/test/stubs/utils.ts +2 -0
- package/src/trpc/context.ts +21 -0
- package/src/trpc/index.ts +3 -0
- package/src/trpc/procedures.ts +43 -0
- package/src/trpc/utils.ts +20 -0
- package/src/types.ts +22 -0
- package/src/utils/errors.ts +148 -0
- package/src/utils/logger.ts +8 -0
- package/src/utils/posthog.ts +43 -0
- package/src/utils/types.ts +5 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
export const ideogramStyleTypes = ["AUTO", "GENERAL", "REALISTIC", "DESIGN", "FICTION"] as const;
|
|
2
|
+
|
|
3
|
+
export const ideogramStylePresets = [
|
|
4
|
+
"80S_ILLUSTRATION",
|
|
5
|
+
"90S_NOSTALGIA",
|
|
6
|
+
"ABSTRACT_ORGANIC",
|
|
7
|
+
"ANALOG_NOSTALGIA",
|
|
8
|
+
"ART_BRUT",
|
|
9
|
+
"ART_DECO",
|
|
10
|
+
"ART_POSTER",
|
|
11
|
+
"AURA",
|
|
12
|
+
"AVANT_GARDE",
|
|
13
|
+
"BAUHAUS",
|
|
14
|
+
"BLUEPRINT",
|
|
15
|
+
"BLURRY_MOTION",
|
|
16
|
+
"BRIGHT_ART",
|
|
17
|
+
"C4D_CARTOON",
|
|
18
|
+
"CHILDRENS_BOOK",
|
|
19
|
+
"COLLAGE",
|
|
20
|
+
"COLORING_BOOK_I",
|
|
21
|
+
"COLORING_BOOK_II",
|
|
22
|
+
"CUBISM",
|
|
23
|
+
"DARK_AURA",
|
|
24
|
+
"DOODLE",
|
|
25
|
+
"DOUBLE_EXPOSURE",
|
|
26
|
+
"DRAMATIC_CINEMA",
|
|
27
|
+
"EDITORIAL",
|
|
28
|
+
"EMOTIONAL_MINIMAL",
|
|
29
|
+
"ETHEREAL_PARTY",
|
|
30
|
+
"EXPIRED_FILM",
|
|
31
|
+
"FLAT_ART",
|
|
32
|
+
"FLAT_VECTOR",
|
|
33
|
+
"FOREST_REVERIE",
|
|
34
|
+
"GEO_MINIMALIST",
|
|
35
|
+
"GLASS_PRISM",
|
|
36
|
+
"GOLDEN_HOUR",
|
|
37
|
+
"GRAFFITI_I",
|
|
38
|
+
"GRAFFITI_II",
|
|
39
|
+
"HALFTONE_PRINT",
|
|
40
|
+
"HIGH_CONTRAST",
|
|
41
|
+
"HIPPIE_ERA",
|
|
42
|
+
"ICONIC",
|
|
43
|
+
"JAPANDI_FUSION",
|
|
44
|
+
"JAZZY",
|
|
45
|
+
"LONG_EXPOSURE",
|
|
46
|
+
"MAGAZINE_EDITORIAL",
|
|
47
|
+
"MINIMAL_ILLUSTRATION",
|
|
48
|
+
"MIXED_MEDIA",
|
|
49
|
+
"MONOCHROME",
|
|
50
|
+
"NIGHTLIFE",
|
|
51
|
+
"OIL_PAINTING",
|
|
52
|
+
"OLD_CARTOONS",
|
|
53
|
+
"PAINT_GESTURE",
|
|
54
|
+
"POP_ART",
|
|
55
|
+
"RETRO_ETCHING",
|
|
56
|
+
"RIVIERA_POP",
|
|
57
|
+
"SPOTLIGHT_80S",
|
|
58
|
+
"STYLIZED_RED",
|
|
59
|
+
"SURREAL_COLLAGE",
|
|
60
|
+
"TRAVEL_POSTER",
|
|
61
|
+
"VINTAGE_GEO",
|
|
62
|
+
"VINTAGE_POSTER",
|
|
63
|
+
] as const;
|
|
64
|
+
|
|
65
|
+
export const ideogramResolutions = [
|
|
66
|
+
"512x1536",
|
|
67
|
+
"576x1408",
|
|
68
|
+
"576x1472",
|
|
69
|
+
"576x1536",
|
|
70
|
+
"640x1344",
|
|
71
|
+
"640x1408",
|
|
72
|
+
"640x1472",
|
|
73
|
+
"640x1536",
|
|
74
|
+
"704x1152",
|
|
75
|
+
"704x1216",
|
|
76
|
+
"704x1280",
|
|
77
|
+
"704x1344",
|
|
78
|
+
"704x1408",
|
|
79
|
+
"704x1472",
|
|
80
|
+
"736x1312",
|
|
81
|
+
"768x1088",
|
|
82
|
+
"768x1216",
|
|
83
|
+
"768x1280",
|
|
84
|
+
"768x1344",
|
|
85
|
+
"800x1280",
|
|
86
|
+
"832x960",
|
|
87
|
+
"832x1024",
|
|
88
|
+
"832x1088",
|
|
89
|
+
"832x1152",
|
|
90
|
+
"832x1216",
|
|
91
|
+
"832x1248",
|
|
92
|
+
"864x1152",
|
|
93
|
+
"896x960",
|
|
94
|
+
"896x1024",
|
|
95
|
+
"896x1088",
|
|
96
|
+
"896x1120",
|
|
97
|
+
"896x1152",
|
|
98
|
+
"960x832",
|
|
99
|
+
"960x896",
|
|
100
|
+
"960x1024",
|
|
101
|
+
"960x1088",
|
|
102
|
+
"960x1120",
|
|
103
|
+
"960x1152",
|
|
104
|
+
"1024x832",
|
|
105
|
+
"1024x896",
|
|
106
|
+
"1024x960",
|
|
107
|
+
"1024x1024",
|
|
108
|
+
"1088x768",
|
|
109
|
+
"1088x832",
|
|
110
|
+
"1088x896",
|
|
111
|
+
"1088x960",
|
|
112
|
+
"1120x896",
|
|
113
|
+
"1152x704",
|
|
114
|
+
"1152x832",
|
|
115
|
+
"1152x864",
|
|
116
|
+
"1152x896",
|
|
117
|
+
"1216x704",
|
|
118
|
+
"1216x768",
|
|
119
|
+
"1216x832",
|
|
120
|
+
"1248x832",
|
|
121
|
+
"1280x704",
|
|
122
|
+
"1280x768",
|
|
123
|
+
"1280x800",
|
|
124
|
+
"1312x736",
|
|
125
|
+
"1344x640",
|
|
126
|
+
"1344x704",
|
|
127
|
+
"1344x768",
|
|
128
|
+
"1408x576",
|
|
129
|
+
"1408x640",
|
|
130
|
+
"1408x704",
|
|
131
|
+
"1472x576",
|
|
132
|
+
"1472x640",
|
|
133
|
+
"1472x704",
|
|
134
|
+
"1536x512",
|
|
135
|
+
"1536x576",
|
|
136
|
+
"1536x640",
|
|
137
|
+
] as const;
|
|
138
|
+
|
|
139
|
+
export const ideogramAspectRatios = [
|
|
140
|
+
"1x3",
|
|
141
|
+
"3x1",
|
|
142
|
+
"1x2",
|
|
143
|
+
"2x1",
|
|
144
|
+
"9x16",
|
|
145
|
+
"16x9",
|
|
146
|
+
"10x16",
|
|
147
|
+
"16x10",
|
|
148
|
+
"2x3",
|
|
149
|
+
"3x2",
|
|
150
|
+
"3x4",
|
|
151
|
+
"4x3",
|
|
152
|
+
"4x5",
|
|
153
|
+
"5x4",
|
|
154
|
+
"1x1",
|
|
155
|
+
] as const;
|
|
156
|
+
|
|
157
|
+
export const ideogramRenderingSpeed = ["FLASH", "TURBO", "DEFAULT", "QUALITY"] as const;
|
|
158
|
+
|
|
159
|
+
export const ideogramMagicPrompt = ["AUTO", "ON", "OFF"] as const;
|
|
160
|
+
|
|
161
|
+
export const ideogramColorPalettePreset = [
|
|
162
|
+
"EMBER",
|
|
163
|
+
"FRESH",
|
|
164
|
+
"JUNGLE",
|
|
165
|
+
"MAGIC",
|
|
166
|
+
"MELON",
|
|
167
|
+
"MOSAIC",
|
|
168
|
+
"PASTEL",
|
|
169
|
+
"ULTRAMARINE",
|
|
170
|
+
] as const;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
ideogramAspectRatios,
|
|
4
|
+
ideogramColorPalettePreset,
|
|
5
|
+
ideogramMagicPrompt,
|
|
6
|
+
ideogramRenderingSpeed,
|
|
7
|
+
ideogramResolutions,
|
|
8
|
+
ideogramStylePresets,
|
|
9
|
+
ideogramStyleTypes,
|
|
10
|
+
} from "#modules/ai/ideogram/ideogram.constants";
|
|
11
|
+
|
|
12
|
+
export const ideogramAISchema = z.object({
|
|
13
|
+
prompt: z.string().describe("Create a prompt for the image generation."),
|
|
14
|
+
style_type: z.enum(ideogramStyleTypes).describe("Choose a style type for the image generation."),
|
|
15
|
+
// style_preset: z
|
|
16
|
+
// .enum(ideogramStylePresets)
|
|
17
|
+
// .describe("Choose a style preset for the image generation."),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const ideogramV3GenerateInputSchema = z.object({
|
|
21
|
+
prompt: z.string(),
|
|
22
|
+
seed: z.number().optional(),
|
|
23
|
+
resolution: z.enum(ideogramResolutions).optional(),
|
|
24
|
+
rendering_speed: z.enum(ideogramRenderingSpeed).optional(),
|
|
25
|
+
magic_prompt: z.enum(ideogramMagicPrompt).optional(),
|
|
26
|
+
negative_prompt: z.string().optional(),
|
|
27
|
+
num_images: z.number().optional(),
|
|
28
|
+
color_palette: z
|
|
29
|
+
.object({
|
|
30
|
+
ColorPaletteWithPresetName: z.object({ name: z.enum(ideogramColorPalettePreset) }).optional(),
|
|
31
|
+
ColorPaletteWithMembers: z
|
|
32
|
+
.object({
|
|
33
|
+
members: z.array(
|
|
34
|
+
z.object({ color_hex: z.string(), color_weight: z.number().min(0.05).max(1) })
|
|
35
|
+
),
|
|
36
|
+
})
|
|
37
|
+
.optional(),
|
|
38
|
+
})
|
|
39
|
+
.optional(),
|
|
40
|
+
style_codes: z.array(z.string()).optional(),
|
|
41
|
+
aspect_ratio: z.enum(ideogramAspectRatios).optional(),
|
|
42
|
+
style_type: z.enum(ideogramStyleTypes).optional(),
|
|
43
|
+
style_preset: z.enum(ideogramStylePresets).optional(),
|
|
44
|
+
style_reference_images: z.array(z.file()).optional(),
|
|
45
|
+
character_reference_images: z.array(z.file()).optional(),
|
|
46
|
+
character_reference_images_mask: z.file().optional(),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const ideogramV3GenerateOutputSchema = z.object({
|
|
50
|
+
created: z.string(),
|
|
51
|
+
data: z.array(
|
|
52
|
+
z.object({
|
|
53
|
+
prompt: z.string(),
|
|
54
|
+
resolution: z.string(),
|
|
55
|
+
is_image_safe: z.boolean(),
|
|
56
|
+
seed: z.number(),
|
|
57
|
+
url: z.url(),
|
|
58
|
+
style_type: z.enum(ideogramStyleTypes),
|
|
59
|
+
})
|
|
60
|
+
),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export type IdeogramV3GenerateInput = z.infer<typeof ideogramV3GenerateInputSchema>;
|
|
64
|
+
export type IdeogramV3GenerateOutput = z.infer<typeof ideogramV3GenerateOutputSchema>;
|