@m5kdev/commons 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/.cursor/rules/commons.mdc +27 -0
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-check-types.log +5 -0
- package/.turbo/turbo-lint$colon$fix.log +6 -0
- package/.turbo/turbo-lint.log +61 -0
- package/LICENSE +621 -0
- package/dist/src/modules/ai/ai.constants.d.ts +55 -0
- package/dist/src/modules/ai/ai.constants.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.constants.js +287 -0
- package/dist/src/modules/ai/ai.utils.d.ts +2 -0
- package/dist/src/modules/ai/ai.utils.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.utils.js +10 -0
- package/dist/src/modules/auth/auth.schema.d.ts +21 -0
- package/dist/src/modules/auth/auth.schema.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.schema.js +22 -0
- package/dist/src/modules/base/base.schema.d.ts +26 -0
- package/dist/src/modules/base/base.schema.d.ts.map +1 -0
- package/dist/src/modules/base/base.schema.js +18 -0
- package/dist/src/modules/billing/billing.schema.d.ts +23 -0
- package/dist/src/modules/billing/billing.schema.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.schema.js +24 -0
- package/dist/src/modules/billing/billing.types.d.ts +18 -0
- package/dist/src/modules/billing/billing.types.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.types.js +2 -0
- package/dist/src/modules/billing/billing.utils.d.ts +6 -0
- package/dist/src/modules/billing/billing.utils.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.utils.js +12 -0
- package/dist/src/modules/file/file.constants.d.ts +5 -0
- package/dist/src/modules/file/file.constants.d.ts.map +1 -0
- package/dist/src/modules/file/file.constants.js +17 -0
- package/dist/src/modules/recurrence/recurrence.schema.d.ts +99 -0
- package/dist/src/modules/recurrence/recurrence.schema.d.ts.map +1 -0
- package/dist/src/modules/recurrence/recurrence.schema.js +65 -0
- package/dist/src/modules/schemas/query.schema.d.ts +111 -0
- package/dist/src/modules/schemas/query.schema.d.ts.map +1 -0
- package/dist/src/modules/schemas/query.schema.js +38 -0
- package/dist/src/modules/table/filter.types.d.ts +13 -0
- package/dist/src/modules/table/filter.types.d.ts.map +1 -0
- package/dist/src/modules/table/filter.types.js +2 -0
- package/dist/src/modules/tag/tag.schema.d.ts +112 -0
- package/dist/src/modules/tag/tag.schema.d.ts.map +1 -0
- package/dist/src/modules/tag/tag.schema.js +54 -0
- package/dist/src/modules/workflow/workflow.constants.d.ts +3 -0
- package/dist/src/modules/workflow/workflow.constants.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.constants.js +4 -0
- package/dist/src/modules/workflow/workflow.schema.d.ts +93 -0
- package/dist/src/modules/workflow/workflow.schema.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.schema.js +37 -0
- package/dist/src/utils/json.d.ts +3 -0
- package/dist/src/utils/json.d.ts.map +1 -0
- package/dist/src/utils/json.js +11 -0
- package/dist/src/utils/timezones.d.ts +15 -0
- package/dist/src/utils/timezones.d.ts.map +1 -0
- package/dist/src/utils/timezones.js +4362 -0
- package/dist/src/utils/trpc.d.ts +5 -0
- package/dist/src/utils/trpc.d.ts.map +1 -0
- package/dist/src/utils/trpc.js +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +75 -0
- package/src/modules/ai/ai.constants.ts +305 -0
- package/src/modules/ai/ai.utils.ts +14 -0
- package/src/modules/auth/auth.schema.ts +22 -0
- package/src/modules/base/base.schema.ts +27 -0
- package/src/modules/billing/billing.schema.ts +24 -0
- package/src/modules/billing/billing.types.ts +18 -0
- package/src/modules/billing/billing.utils.ts +13 -0
- package/src/modules/file/file.constants.ts +14 -0
- package/src/modules/recurrence/recurrence.schema.ts +78 -0
- package/src/modules/schemas/query.schema.ts +44 -0
- package/src/modules/table/filter.types.ts +39 -0
- package/src/modules/tag/tag.schema.ts +68 -0
- package/src/modules/workflow/workflow.constants.ts +2 -0
- package/src/modules/workflow/workflow.schema.ts +48 -0
- package/src/utils/json.ts +9 -0
- package/src/utils/timezones.ts +4380 -0
- package/src/utils/trpc.ts +6 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WORFLOW_STATUSES } from "./workflow.constants";
|
|
3
|
+
|
|
4
|
+
export const workflowSelectSchema = z.object({
|
|
5
|
+
id: z.uuid(),
|
|
6
|
+
userId: z.string().nullable(),
|
|
7
|
+
jobId: z.string(),
|
|
8
|
+
jobName: z.string(),
|
|
9
|
+
queueName: z.string(),
|
|
10
|
+
tags: z.array(z.string()).nullable(),
|
|
11
|
+
input: z.unknown(),
|
|
12
|
+
output: z.unknown(),
|
|
13
|
+
status: z.enum(WORFLOW_STATUSES),
|
|
14
|
+
error: z.string().nullable(),
|
|
15
|
+
retries: z.number(),
|
|
16
|
+
finishedAt: z.date().nullable(),
|
|
17
|
+
processedAt: z.date().nullable(),
|
|
18
|
+
createdAt: z.date(),
|
|
19
|
+
updatedAt: z.date(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const workflowReadInputSchema = z.object({
|
|
23
|
+
jobId: z.string(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const workflowListInputSchema = z.object({
|
|
27
|
+
status: z.enum(WORFLOW_STATUSES).array().optional(),
|
|
28
|
+
jobName: z.string().optional(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const workflowTriggerOutputSchema = z.object({
|
|
32
|
+
jobId: z.string(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const workflowTriggerManyOutputSchema = z.object({
|
|
36
|
+
jobIds: z.array(z.string()),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const workflowReadOutputSchema = workflowSelectSchema;
|
|
40
|
+
export const workflowListOutputSchema = workflowSelectSchema.array();
|
|
41
|
+
|
|
42
|
+
export type WorkflowSelectSchema = z.infer<typeof workflowSelectSchema>;
|
|
43
|
+
export type WorkflowReadInputSchema = z.infer<typeof workflowReadInputSchema>;
|
|
44
|
+
export type WorkflowListInputSchema = z.infer<typeof workflowListInputSchema>;
|
|
45
|
+
export type WorkflowReadOutputSchema = z.infer<typeof workflowReadOutputSchema>;
|
|
46
|
+
export type WorkflowListOutputSchema = z.infer<typeof workflowListOutputSchema>;
|
|
47
|
+
export type WorkflowTriggerOutputSchema = z.infer<typeof workflowTriggerOutputSchema>;
|
|
48
|
+
export type WorkflowTriggerManyOutputSchema = z.infer<typeof workflowTriggerManyOutputSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function safeParseJson<T>(json: string, fallback: T): T;
|
|
2
|
+
export function safeParseJson<T>(json: string): T | undefined;
|
|
3
|
+
export function safeParseJson<T>(json: string, fallback?: T): T | undefined {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(json);
|
|
6
|
+
} catch {
|
|
7
|
+
return fallback;
|
|
8
|
+
}
|
|
9
|
+
}
|