@m5kdev/commons 0.1.4 → 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.constants.d.ts +0 -1
- package/dist/src/modules/ai/ai.utils.d.ts +0 -1
- package/dist/src/modules/auth/auth.schema.d.ts +0 -1
- package/dist/src/modules/base/base.schema.d.ts +0 -1
- package/dist/src/modules/billing/billing.schema.d.ts +0 -1
- package/dist/src/modules/billing/billing.types.d.ts +0 -1
- package/dist/src/modules/billing/billing.utils.d.ts +0 -1
- package/dist/src/modules/file/file.constants.d.ts +0 -1
- package/dist/src/modules/recurrence/recurrence.schema.d.ts +0 -1
- package/dist/src/modules/schemas/query.schema.d.ts +0 -1
- package/dist/src/modules/table/filter.types.d.ts +0 -1
- package/dist/src/modules/tag/tag.schema.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.constants.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.schema.d.ts +0 -1
- package/dist/src/utils/json.d.ts +0 -1
- package/dist/src/utils/timezones.d.ts +0 -1
- package/dist/src/utils/trpc.d.ts +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -2
- package/.cursor/rules/commons.mdc +0 -27
- package/.turbo/turbo-build.log +0 -5
- package/.turbo/turbo-check-types.log +0 -5
- package/.turbo/turbo-lint$colon$fix.log +0 -6
- package/.turbo/turbo-lint.log +0 -61
- package/CHANGELOG.md +0 -25
- package/dist/src/modules/ai/ai.constants.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.utils.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.schema.d.ts.map +0 -1
- package/dist/src/modules/base/base.schema.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.schema.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.types.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.utils.d.ts.map +0 -1
- package/dist/src/modules/file/file.constants.d.ts.map +0 -1
- package/dist/src/modules/recurrence/recurrence.schema.d.ts.map +0 -1
- package/dist/src/modules/schemas/query.schema.d.ts.map +0 -1
- package/dist/src/modules/table/filter.types.d.ts.map +0 -1
- package/dist/src/modules/tag/tag.schema.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.constants.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.schema.d.ts.map +0 -1
- package/dist/src/utils/json.d.ts.map +0 -1
- package/dist/src/utils/timezones.d.ts.map +0 -1
- package/dist/src/utils/trpc.d.ts.map +0 -1
- package/src/modules/ai/ai.constants.ts +0 -305
- package/src/modules/ai/ai.utils.ts +0 -14
- package/src/modules/auth/auth.schema.ts +0 -22
- package/src/modules/base/base.schema.ts +0 -27
- package/src/modules/billing/billing.schema.ts +0 -24
- package/src/modules/billing/billing.types.ts +0 -18
- package/src/modules/billing/billing.utils.ts +0 -13
- package/src/modules/file/file.constants.ts +0 -14
- package/src/modules/recurrence/recurrence.schema.ts +0 -78
- package/src/modules/schemas/query.schema.ts +0 -44
- package/src/modules/table/filter.types.ts +0 -39
- package/src/modules/tag/tag.schema.ts +0 -68
- package/src/modules/workflow/workflow.constants.ts +0 -2
- package/src/modules/workflow/workflow.schema.ts +0 -48
- package/src/utils/json.ts +0 -9
- package/src/utils/timezones.ts +0 -4380
- package/src/utils/trpc.ts +0 -6
- package/tsconfig.json +0 -10
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const fileTypes: Record<string, { mimetypes: string[]; extensions: string[] }> = {
|
|
2
|
-
image: {
|
|
3
|
-
mimetypes: ["image/jpeg", "image/png", "image/jpg", "image/webp"],
|
|
4
|
-
extensions: ["jpg", "jpeg", "png", "webp"],
|
|
5
|
-
},
|
|
6
|
-
video: {
|
|
7
|
-
mimetypes: ["video/mp4", "video/mov", "video/avi", "video/mkv", "video/webm"],
|
|
8
|
-
extensions: ["mp4", "mov", "avi", "mkv"],
|
|
9
|
-
},
|
|
10
|
-
audio: {
|
|
11
|
-
mimetypes: ["audio/mp3", "audio/wav", "audio/m4a", "audio/webm"],
|
|
12
|
-
extensions: ["mp3", "wav", "m4a", "webm"],
|
|
13
|
-
},
|
|
14
|
-
} as const;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
// Reusable schemas for JSON-by-* fields (number or number[])
|
|
4
|
-
const numberOrNumberArraySchema = z.union([z.number(), z.array(z.number())]).nullish();
|
|
5
|
-
|
|
6
|
-
export const recurrenceMetadataSchema = z.record(z.string(), z.unknown()).nullish();
|
|
7
|
-
|
|
8
|
-
export const recurrenceSchema = z.object({
|
|
9
|
-
id: z.string(),
|
|
10
|
-
userId: z.string().nullish(),
|
|
11
|
-
organizationId: z.string().nullish(),
|
|
12
|
-
teamId: z.string().nullish(),
|
|
13
|
-
name: z.string().nullish(),
|
|
14
|
-
kind: z.string().nullish(),
|
|
15
|
-
enabled: z.boolean(),
|
|
16
|
-
metadata: recurrenceMetadataSchema,
|
|
17
|
-
createdAt: z.date(),
|
|
18
|
-
updatedAt: z.date(),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export const recurrenceRulesSchema = z.object({
|
|
22
|
-
id: z.string(),
|
|
23
|
-
createdAt: z.date(),
|
|
24
|
-
updatedAt: z.date(),
|
|
25
|
-
recurrenceId: z.string().nullish(),
|
|
26
|
-
freq: z.number(),
|
|
27
|
-
dtstart: z.date().nullish(),
|
|
28
|
-
interval: z.number(),
|
|
29
|
-
wkst: z.number().nullish(),
|
|
30
|
-
count: z.number().nullish(),
|
|
31
|
-
until: z.date().nullish(),
|
|
32
|
-
tzid: z.string().nullish(),
|
|
33
|
-
bysetpos: numberOrNumberArraySchema,
|
|
34
|
-
bymonth: numberOrNumberArraySchema,
|
|
35
|
-
bymonthday: numberOrNumberArraySchema,
|
|
36
|
-
byyearday: numberOrNumberArraySchema,
|
|
37
|
-
byweekno: numberOrNumberArraySchema,
|
|
38
|
-
byweekday: numberOrNumberArraySchema,
|
|
39
|
-
byhour: numberOrNumberArraySchema,
|
|
40
|
-
byminute: numberOrNumberArraySchema,
|
|
41
|
-
bysecond: numberOrNumberArraySchema,
|
|
42
|
-
});
|
|
43
|
-
export const updateRecurrenceRulesSchema = recurrenceRulesSchema.omit({
|
|
44
|
-
createdAt: true,
|
|
45
|
-
updatedAt: true,
|
|
46
|
-
recurrenceId: true,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
export const createRecurrenceSchema = z.object({
|
|
50
|
-
name: z.string(),
|
|
51
|
-
kind: z.string(),
|
|
52
|
-
enabled: z.boolean(),
|
|
53
|
-
metadata: recurrenceMetadataSchema,
|
|
54
|
-
recurrenceRules: z.array(updateRecurrenceRulesSchema.omit({ id: true })),
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export const updateRecurrenceSchema = z.object({
|
|
58
|
-
name: z.string().optional(),
|
|
59
|
-
kind: z.string().optional(),
|
|
60
|
-
enabled: z.boolean().optional(),
|
|
61
|
-
metadata: recurrenceMetadataSchema,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export const deleteRecurrenceSchema = z.object({
|
|
65
|
-
id: z.string(),
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
export const deleteRecurrenceRulesSchema = z.object({
|
|
69
|
-
id: z.string(),
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
export type RecurrenceSchema = z.infer<typeof recurrenceSchema>;
|
|
73
|
-
export type RecurrenceRulesSchema = z.infer<typeof recurrenceRulesSchema>;
|
|
74
|
-
export type CreateRecurrenceSchema = z.infer<typeof createRecurrenceSchema>;
|
|
75
|
-
export type UpdateRecurrenceSchema = z.infer<typeof updateRecurrenceSchema>;
|
|
76
|
-
export type UpdateRecurrenceRulesSchema = z.infer<typeof updateRecurrenceRulesSchema>;
|
|
77
|
-
export type DeleteRecurrenceSchema = z.infer<typeof deleteRecurrenceSchema>;
|
|
78
|
-
export type DeleteRecurrenceRulesSchema = z.infer<typeof deleteRecurrenceRulesSchema>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
export const filterSchema = z.object({
|
|
4
|
-
columnId: z.string(),
|
|
5
|
-
type: z.enum(["string", "number", "date", "boolean", "enum"]),
|
|
6
|
-
method: z.enum([
|
|
7
|
-
"contains",
|
|
8
|
-
"equals",
|
|
9
|
-
"starts_with",
|
|
10
|
-
"ends_with",
|
|
11
|
-
"greater_than",
|
|
12
|
-
"less_than",
|
|
13
|
-
"on",
|
|
14
|
-
"between",
|
|
15
|
-
"before",
|
|
16
|
-
"after",
|
|
17
|
-
"oneOf",
|
|
18
|
-
"intersect",
|
|
19
|
-
"isEmpty",
|
|
20
|
-
"isNotEmpty",
|
|
21
|
-
"is_null",
|
|
22
|
-
"is_not_null",
|
|
23
|
-
]),
|
|
24
|
-
value: z.union([z.string(), z.number(), z.boolean(), z.array(z.string())]),
|
|
25
|
-
valueTo: z.string().optional(),
|
|
26
|
-
endColumnId: z.string().optional(),
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const filtersSchema = z.array(filterSchema);
|
|
30
|
-
|
|
31
|
-
export const querySchema = z.object({
|
|
32
|
-
// TODO: Remove default values
|
|
33
|
-
page: z.number().optional(),
|
|
34
|
-
limit: z.number().optional(),
|
|
35
|
-
sort: z.string().optional(),
|
|
36
|
-
order: z.enum(["asc", "desc"]).optional(),
|
|
37
|
-
filters: filtersSchema.optional(),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export type QueryListOutput<T> = { rows: T[]; total: number };
|
|
41
|
-
|
|
42
|
-
export type QueryInput = z.infer<typeof querySchema>;
|
|
43
|
-
export type QueryFilter = z.infer<typeof filterSchema>;
|
|
44
|
-
export type QueryFilters = z.infer<typeof filtersSchema>;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { QueryFilter } from "../schemas/query.schema";
|
|
2
|
-
|
|
3
|
-
export type ColumnDataType = NonNullable<QueryFilter["type"]>;
|
|
4
|
-
|
|
5
|
-
export type ComponentForFilterMethod =
|
|
6
|
-
| "text"
|
|
7
|
-
| "number"
|
|
8
|
-
| "date"
|
|
9
|
-
| "range"
|
|
10
|
-
| "radio"
|
|
11
|
-
| "select"
|
|
12
|
-
| "multiSelect";
|
|
13
|
-
|
|
14
|
-
export type FilterMethodName =
|
|
15
|
-
| "contains"
|
|
16
|
-
| "equals"
|
|
17
|
-
| "starts_with"
|
|
18
|
-
| "ends_with"
|
|
19
|
-
| "greater_than"
|
|
20
|
-
| "less_than"
|
|
21
|
-
| "on"
|
|
22
|
-
| "between"
|
|
23
|
-
| "before"
|
|
24
|
-
| "after"
|
|
25
|
-
| "intersect"
|
|
26
|
-
| "oneOf"
|
|
27
|
-
| "isEmpty"
|
|
28
|
-
| "isNotEmpty";
|
|
29
|
-
|
|
30
|
-
export type FilterMethod = {
|
|
31
|
-
value: FilterMethodName;
|
|
32
|
-
label: string;
|
|
33
|
-
component?: ComponentForFilterMethod | null;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type FilterMethods = {
|
|
37
|
-
[key in ColumnDataType]: FilterMethod[];
|
|
38
|
-
};
|
|
39
|
-
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { querySchema } from "../schemas/query.schema";
|
|
3
|
-
|
|
4
|
-
export const tagSchema = z.object({
|
|
5
|
-
id: z.string(),
|
|
6
|
-
organizationId: z.string().nullish(),
|
|
7
|
-
teamId: z.string().nullish(),
|
|
8
|
-
createdAt: z.date(),
|
|
9
|
-
updatedAt: z.date().nullish(),
|
|
10
|
-
deletedAt: z.date().nullish(),
|
|
11
|
-
userId: z.string(),
|
|
12
|
-
name: z.string(),
|
|
13
|
-
color: z.string().nullish(),
|
|
14
|
-
type: z.string().nullish(),
|
|
15
|
-
isEnabled: z.boolean(),
|
|
16
|
-
parentId: z.string().nullish(),
|
|
17
|
-
assignableTo: z.string().array().nullish().default([]),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const taggingSchema = z.object({
|
|
21
|
-
id: z.string(),
|
|
22
|
-
createdAt: z.date(),
|
|
23
|
-
tagId: z.string(),
|
|
24
|
-
resourceType: z.string(),
|
|
25
|
-
resourceId: z.string(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export const tagListInputSchema = querySchema;
|
|
29
|
-
|
|
30
|
-
export const tagListOutputSchema = z.object({
|
|
31
|
-
rows: z.array(tagSchema),
|
|
32
|
-
total: z.number(),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const tagListSchema = z.object({
|
|
36
|
-
assignableTo: z.string().optional(),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const tagCreateSchema = z.object({
|
|
40
|
-
organizationId: z.string().optional(),
|
|
41
|
-
teamId: z.string().optional(),
|
|
42
|
-
name: z.string(),
|
|
43
|
-
color: z.string(),
|
|
44
|
-
assignableTo: z.string().array().optional().default([]),
|
|
45
|
-
resourceType: z.string().optional(),
|
|
46
|
-
resourceId: z.string().optional(),
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
export const tagUpdateSchema = z.object({
|
|
50
|
-
id: z.string(),
|
|
51
|
-
name: z.string().optional(),
|
|
52
|
-
color: z.string().optional(),
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
export const tagLinkSchema = z.object({
|
|
56
|
-
tagId: z.string(),
|
|
57
|
-
resourceType: z.string(),
|
|
58
|
-
resourceId: z.string(),
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export type TagSchema = z.infer<typeof tagSchema>;
|
|
62
|
-
export type TaggingSchema = z.infer<typeof taggingSchema>;
|
|
63
|
-
export type TagListSchema = z.infer<typeof tagListSchema>;
|
|
64
|
-
export type TagCreateSchema = z.infer<typeof tagCreateSchema>;
|
|
65
|
-
export type TagUpdateSchema = z.infer<typeof tagUpdateSchema>;
|
|
66
|
-
export type TagLinkSchema = z.infer<typeof tagLinkSchema>;
|
|
67
|
-
export type TagListOutputSchema = z.infer<typeof tagListOutputSchema>;
|
|
68
|
-
export type TagListInputSchema = z.infer<typeof tagListInputSchema>;
|
|
@@ -1,48 +0,0 @@
|
|
|
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>;
|
package/src/utils/json.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|