@m5kdev/commons 0.32.9 → 0.33.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.types.d.cts +1 -1
- package/dist/src/modules/ai/ai.types.d.mts +1 -1
- package/dist/src/modules/ai/ai.utils.d.cts +1 -1
- package/dist/src/modules/ai/ai.utils.d.mts +1 -1
- package/dist/src/modules/notification/notification.schema.d.cts +3 -3
- package/dist/src/modules/recurrence/recurrence.schema.d.cts +2 -2
- package/dist/src/modules/recurrence/recurrence.schema.d.mts +2 -2
- package/dist/src/modules/schemas/query.schema.d.cts +9 -9
- package/dist/src/modules/schemas/query.schema.d.mts +9 -9
- package/dist/src/modules/schemas/queryMatch.cjs +58 -0
- package/dist/src/modules/schemas/queryMatch.cjs.map +1 -0
- package/dist/src/modules/schemas/queryMatch.d.cts +83 -0
- package/dist/src/modules/schemas/queryMatch.d.mts +83 -0
- package/dist/src/modules/schemas/queryMatch.mjs +55 -0
- package/dist/src/modules/schemas/queryMatch.mjs.map +1 -0
- package/dist/src/modules/tag/tag.schema.cjs +1 -1
- package/dist/src/modules/tag/tag.schema.cjs.map +1 -1
- package/dist/src/modules/tag/tag.schema.d.cts +5 -5
- package/dist/src/modules/tag/tag.schema.d.mts +5 -5
- package/dist/src/modules/tag/tag.schema.mjs +1 -1
- package/dist/src/modules/tag/tag.schema.mjs.map +1 -1
- package/dist/src/modules/workflow/workflow.schema.d.cts +4 -4
- package/dist/src/modules/workflow/workflow.schema.d.mts +4 -4
- package/package.json +6 -3
|
@@ -4,7 +4,7 @@ interface RankedModel {
|
|
|
4
4
|
inputCost: number;
|
|
5
5
|
outputCost: number;
|
|
6
6
|
quality: Record<Category, number>;
|
|
7
|
-
responseTimeSeconds
|
|
7
|
+
responseTimeSeconds?: number;
|
|
8
8
|
}
|
|
9
9
|
type Category = "structured_output" | "creative" | "research" | "chat" | "tool_use" | "planning" | "classification";
|
|
10
10
|
type SortType = "quality" | "price" | "speed";
|
|
@@ -4,7 +4,7 @@ interface RankedModel {
|
|
|
4
4
|
inputCost: number;
|
|
5
5
|
outputCost: number;
|
|
6
6
|
quality: Record<Category, number>;
|
|
7
|
-
responseTimeSeconds
|
|
7
|
+
responseTimeSeconds?: number;
|
|
8
8
|
}
|
|
9
9
|
type Category = "structured_output" | "creative" | "research" | "chat" | "tool_use" | "planning" | "classification";
|
|
10
10
|
type SortType = "quality" | "price" | "speed";
|
|
@@ -17,7 +17,7 @@ declare function rankModels(models: RankedModel[], profile: TokenProfile, catego
|
|
|
17
17
|
inputCost: number;
|
|
18
18
|
outputCost: number;
|
|
19
19
|
quality: Record<Category, number>;
|
|
20
|
-
responseTimeSeconds
|
|
20
|
+
responseTimeSeconds?: number;
|
|
21
21
|
price: number;
|
|
22
22
|
estimatedCost: number;
|
|
23
23
|
speedScore: number;
|
|
@@ -17,7 +17,7 @@ declare function rankModels(models: RankedModel[], profile: TokenProfile, catego
|
|
|
17
17
|
inputCost: number;
|
|
18
18
|
outputCost: number;
|
|
19
19
|
quality: Record<Category, number>;
|
|
20
|
-
responseTimeSeconds
|
|
20
|
+
responseTimeSeconds?: number;
|
|
21
21
|
price: number;
|
|
22
22
|
estimatedCost: number;
|
|
23
23
|
speedScore: number;
|
|
@@ -12,9 +12,9 @@ declare const notificationProviderSchema: z.ZodEnum<{
|
|
|
12
12
|
fcm: "fcm";
|
|
13
13
|
}>;
|
|
14
14
|
declare const notificationSendStatusSchema: z.ZodEnum<{
|
|
15
|
+
failed: "failed";
|
|
15
16
|
pending: "pending";
|
|
16
17
|
sent: "sent";
|
|
17
|
-
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
/** Web Push `PushSubscriptionJSON` subset we persist and accept from clients. */
|
|
20
20
|
declare const pushSubscriptionJsonSchema: z.ZodObject<{
|
|
@@ -100,9 +100,9 @@ declare const notificationSendLogSelectSchema: z.ZodObject<{
|
|
|
100
100
|
body: z.ZodString;
|
|
101
101
|
data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
102
102
|
status: z.ZodEnum<{
|
|
103
|
+
failed: "failed";
|
|
103
104
|
pending: "pending";
|
|
104
105
|
sent: "sent";
|
|
105
|
-
failed: "failed";
|
|
106
106
|
}>;
|
|
107
107
|
error: z.ZodNullable<z.ZodString>;
|
|
108
108
|
jobId: z.ZodNullable<z.ZodString>;
|
|
@@ -127,9 +127,9 @@ declare const notificationListSendLogsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
127
127
|
body: z.ZodString;
|
|
128
128
|
data: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
129
129
|
status: z.ZodEnum<{
|
|
130
|
+
failed: "failed";
|
|
130
131
|
pending: "pending";
|
|
131
132
|
sent: "sent";
|
|
132
|
-
failed: "failed";
|
|
133
133
|
}>;
|
|
134
134
|
error: z.ZodNullable<z.ZodString>;
|
|
135
135
|
jobId: z.ZodNullable<z.ZodString>;
|
|
@@ -38,6 +38,7 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
+
interval: z.ZodNumber;
|
|
41
42
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
42
43
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
44
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -49,7 +50,6 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
49
50
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
50
51
|
freq: z.ZodNumber;
|
|
51
52
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
-
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,6 +61,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
+
interval: z.ZodNumber;
|
|
64
65
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
65
66
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
67
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -72,7 +73,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
72
73
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
73
74
|
freq: z.ZodNumber;
|
|
74
75
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
-
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -38,6 +38,7 @@ declare const recurrenceRulesSchema: z.ZodObject<{
|
|
|
38
38
|
}, z.core.$strip>;
|
|
39
39
|
declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
40
40
|
id: z.ZodString;
|
|
41
|
+
interval: z.ZodNumber;
|
|
41
42
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
42
43
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
43
44
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -49,7 +50,6 @@ declare const updateRecurrenceRulesSchema: z.ZodObject<{
|
|
|
49
50
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
50
51
|
freq: z.ZodNumber;
|
|
51
52
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
52
|
-
interval: z.ZodNumber;
|
|
53
53
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
54
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
55
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -61,6 +61,7 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
61
61
|
enabled: z.ZodBoolean;
|
|
62
62
|
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
63
63
|
recurrenceRules: z.ZodArray<z.ZodObject<{
|
|
64
|
+
interval: z.ZodNumber;
|
|
64
65
|
bysetpos: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
65
66
|
bymonth: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
66
67
|
bymonthday: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
@@ -72,7 +73,6 @@ declare const createRecurrenceSchema: z.ZodObject<{
|
|
|
72
73
|
bysecond: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
73
74
|
freq: z.ZodNumber;
|
|
74
75
|
dtstart: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
|
-
interval: z.ZodNumber;
|
|
76
76
|
wkst: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
77
|
count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
78
|
until: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
@@ -7,15 +7,15 @@ declare const filterSchema: z.ZodObject<{
|
|
|
7
7
|
string: "string";
|
|
8
8
|
number: "number";
|
|
9
9
|
boolean: "boolean";
|
|
10
|
-
date: "date";
|
|
11
10
|
enum: "enum";
|
|
11
|
+
date: "date";
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
contains: "contains";
|
|
16
|
-
equals: "equals";
|
|
17
15
|
starts_with: "starts_with";
|
|
18
16
|
ends_with: "ends_with";
|
|
17
|
+
contains: "contains";
|
|
18
|
+
equals: "equals";
|
|
19
19
|
greater_than: "greater_than";
|
|
20
20
|
less_than: "less_than";
|
|
21
21
|
on: "on";
|
|
@@ -39,15 +39,15 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
|
|
|
39
39
|
string: "string";
|
|
40
40
|
number: "number";
|
|
41
41
|
boolean: "boolean";
|
|
42
|
-
date: "date";
|
|
43
42
|
enum: "enum";
|
|
43
|
+
date: "date";
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
contains: "contains";
|
|
48
|
-
equals: "equals";
|
|
49
47
|
starts_with: "starts_with";
|
|
50
48
|
ends_with: "ends_with";
|
|
49
|
+
contains: "contains";
|
|
50
|
+
equals: "equals";
|
|
51
51
|
greater_than: "greater_than";
|
|
52
52
|
less_than: "less_than";
|
|
53
53
|
on: "on";
|
|
@@ -79,15 +79,15 @@ declare const querySchema: z.ZodObject<{
|
|
|
79
79
|
string: "string";
|
|
80
80
|
number: "number";
|
|
81
81
|
boolean: "boolean";
|
|
82
|
-
date: "date";
|
|
83
82
|
enum: "enum";
|
|
83
|
+
date: "date";
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
contains: "contains";
|
|
88
|
-
equals: "equals";
|
|
89
87
|
starts_with: "starts_with";
|
|
90
88
|
ends_with: "ends_with";
|
|
89
|
+
contains: "contains";
|
|
90
|
+
equals: "equals";
|
|
91
91
|
greater_than: "greater_than";
|
|
92
92
|
less_than: "less_than";
|
|
93
93
|
on: "on";
|
|
@@ -7,15 +7,15 @@ declare const filterSchema: z.ZodObject<{
|
|
|
7
7
|
string: "string";
|
|
8
8
|
number: "number";
|
|
9
9
|
boolean: "boolean";
|
|
10
|
-
date: "date";
|
|
11
10
|
enum: "enum";
|
|
11
|
+
date: "date";
|
|
12
12
|
jsonArray: "jsonArray";
|
|
13
13
|
}>;
|
|
14
14
|
method: z.ZodEnum<{
|
|
15
|
-
contains: "contains";
|
|
16
|
-
equals: "equals";
|
|
17
15
|
starts_with: "starts_with";
|
|
18
16
|
ends_with: "ends_with";
|
|
17
|
+
contains: "contains";
|
|
18
|
+
equals: "equals";
|
|
19
19
|
greater_than: "greater_than";
|
|
20
20
|
less_than: "less_than";
|
|
21
21
|
on: "on";
|
|
@@ -39,15 +39,15 @@ declare const filtersSchema: z.ZodArray<z.ZodObject<{
|
|
|
39
39
|
string: "string";
|
|
40
40
|
number: "number";
|
|
41
41
|
boolean: "boolean";
|
|
42
|
-
date: "date";
|
|
43
42
|
enum: "enum";
|
|
43
|
+
date: "date";
|
|
44
44
|
jsonArray: "jsonArray";
|
|
45
45
|
}>;
|
|
46
46
|
method: z.ZodEnum<{
|
|
47
|
-
contains: "contains";
|
|
48
|
-
equals: "equals";
|
|
49
47
|
starts_with: "starts_with";
|
|
50
48
|
ends_with: "ends_with";
|
|
49
|
+
contains: "contains";
|
|
50
|
+
equals: "equals";
|
|
51
51
|
greater_than: "greater_than";
|
|
52
52
|
less_than: "less_than";
|
|
53
53
|
on: "on";
|
|
@@ -79,15 +79,15 @@ declare const querySchema: z.ZodObject<{
|
|
|
79
79
|
string: "string";
|
|
80
80
|
number: "number";
|
|
81
81
|
boolean: "boolean";
|
|
82
|
-
date: "date";
|
|
83
82
|
enum: "enum";
|
|
83
|
+
date: "date";
|
|
84
84
|
jsonArray: "jsonArray";
|
|
85
85
|
}>;
|
|
86
86
|
method: z.ZodEnum<{
|
|
87
|
-
contains: "contains";
|
|
88
|
-
equals: "equals";
|
|
89
87
|
starts_with: "starts_with";
|
|
90
88
|
ends_with: "ends_with";
|
|
89
|
+
contains: "contains";
|
|
90
|
+
equals: "equals";
|
|
91
91
|
greater_than: "greater_than";
|
|
92
92
|
less_than: "less_than";
|
|
93
93
|
on: "on";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
//#region src/modules/schemas/queryMatch.ts
|
|
4
|
+
const QUERY_FILTER_METHOD_TO_OP = {
|
|
5
|
+
equals: "$eq",
|
|
6
|
+
contains: "$contains",
|
|
7
|
+
starts_with: "$starts_with",
|
|
8
|
+
ends_with: "$ends_with",
|
|
9
|
+
greater_than: "$greater_than",
|
|
10
|
+
less_than: "$less_than",
|
|
11
|
+
on: "$on",
|
|
12
|
+
between: "$between",
|
|
13
|
+
before: "$before",
|
|
14
|
+
after: "$after",
|
|
15
|
+
oneOf: "$oneOf",
|
|
16
|
+
intersect: "$intersect",
|
|
17
|
+
isEmpty: "$isEmpty",
|
|
18
|
+
isNotEmpty: "$isNotEmpty",
|
|
19
|
+
is_null: "$is_null",
|
|
20
|
+
is_not_null: "$is_not_null"
|
|
21
|
+
};
|
|
22
|
+
const queryMatchSchema = zod.z.lazy(() => zod.z.record(zod.z.string(), zod.z.unknown()));
|
|
23
|
+
const matchQuerySchema = zod.z.object({
|
|
24
|
+
page: zod.z.number().optional(),
|
|
25
|
+
limit: zod.z.number().optional(),
|
|
26
|
+
sort: zod.z.string().optional(),
|
|
27
|
+
order: zod.z.enum(["asc", "desc"]).optional(),
|
|
28
|
+
match: queryMatchSchema.optional(),
|
|
29
|
+
q: zod.z.string().optional()
|
|
30
|
+
});
|
|
31
|
+
function queryFilterToMatch(filter) {
|
|
32
|
+
const op = QUERY_FILTER_METHOD_TO_OP[filter.method];
|
|
33
|
+
switch (filter.method) {
|
|
34
|
+
case "between": return { [filter.columnId]: { $between: [String(filter.value), filter.valueTo ?? ""] } };
|
|
35
|
+
case "intersect": return { [filter.columnId]: { $intersect: {
|
|
36
|
+
endColumnId: filter.endColumnId ?? "",
|
|
37
|
+
from: String(filter.value),
|
|
38
|
+
to: filter.valueTo ?? ""
|
|
39
|
+
} } };
|
|
40
|
+
case "isEmpty":
|
|
41
|
+
case "isNotEmpty":
|
|
42
|
+
case "is_null":
|
|
43
|
+
case "is_not_null": return { [filter.columnId]: { [op]: true } };
|
|
44
|
+
default: return { [filter.columnId]: { [op]: filter.value } };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Rename QueryFilters into a QueryMatch. Does not bake day bounds or gte. */
|
|
48
|
+
function queryFiltersToMatch(filters) {
|
|
49
|
+
if (!filters || filters.length === 0) return {};
|
|
50
|
+
if (filters.length === 1) return queryFilterToMatch(filters[0]);
|
|
51
|
+
return { $and: filters.map(queryFilterToMatch) };
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.matchQuerySchema = matchQuerySchema;
|
|
55
|
+
exports.queryFiltersToMatch = queryFiltersToMatch;
|
|
56
|
+
exports.queryMatchSchema = queryMatchSchema;
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=queryMatch.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryMatch.cjs","names":["z"],"sources":["../../../../src/modules/schemas/queryMatch.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport type { QueryFilter, QueryFilters } from \"./query.schema\";\r\n\r\nconst QUERY_FILTER_METHOD_TO_OP = {\r\n equals: \"$eq\",\r\n contains: \"$contains\",\r\n starts_with: \"$starts_with\",\r\n ends_with: \"$ends_with\",\r\n greater_than: \"$greater_than\",\r\n less_than: \"$less_than\",\r\n on: \"$on\",\r\n between: \"$between\",\r\n before: \"$before\",\r\n after: \"$after\",\r\n oneOf: \"$oneOf\",\r\n intersect: \"$intersect\",\r\n isEmpty: \"$isEmpty\",\r\n isNotEmpty: \"$isNotEmpty\",\r\n is_null: \"$is_null\",\r\n is_not_null: \"$is_not_null\",\r\n} as const;\r\n\r\nexport type QueryMatchOp = (typeof QUERY_FILTER_METHOD_TO_OP)[QueryFilter[\"method\"]];\r\n\r\n/** Scalar or list value in a QueryMatch field / operator payload. */\r\nexport type QueryMatchScalar = string | number | boolean | Date | null;\r\n\r\nexport interface QueryMatchIntersect {\r\n readonly endColumnId: string;\r\n readonly from: string;\r\n readonly to: string;\r\n}\r\n\r\nexport interface QueryMatchOperators {\r\n readonly $eq?: QueryMatchScalar | readonly string[];\r\n readonly $ne?: QueryMatchScalar;\r\n readonly $gt?: QueryMatchScalar;\r\n readonly $gte?: QueryMatchScalar;\r\n readonly $lt?: QueryMatchScalar;\r\n readonly $lte?: QueryMatchScalar;\r\n readonly $in?: readonly QueryMatchScalar[];\r\n readonly $nin?: readonly QueryMatchScalar[];\r\n readonly $exists?: boolean;\r\n readonly $like?: string;\r\n readonly $contains?: QueryMatchScalar;\r\n readonly $starts_with?: QueryMatchScalar;\r\n readonly $ends_with?: QueryMatchScalar;\r\n readonly $greater_than?: QueryMatchScalar;\r\n readonly $less_than?: QueryMatchScalar;\r\n readonly $on?: QueryMatchScalar;\r\n readonly $between?: readonly [QueryMatchScalar, QueryMatchScalar];\r\n readonly $before?: QueryMatchScalar;\r\n readonly $after?: QueryMatchScalar;\r\n readonly $oneOf?: readonly string[];\r\n readonly $intersect?: QueryMatchIntersect;\r\n readonly $isEmpty?: boolean;\r\n readonly $isNotEmpty?: boolean;\r\n readonly $is_null?: boolean;\r\n readonly $is_not_null?: boolean;\r\n readonly $not?: QueryMatchOperators;\r\n}\r\n\r\nexport type QueryMatchFieldValue = QueryMatchScalar | readonly string[] | QueryMatchOperators;\r\n\r\nexport interface QueryMatch {\r\n readonly $and?: readonly QueryMatch[];\r\n readonly $or?: readonly QueryMatch[];\r\n readonly $not?: QueryMatch;\r\n readonly [field: string]:\r\n | QueryMatchFieldValue\r\n | readonly QueryMatch[]\r\n | QueryMatch\r\n | undefined;\r\n}\r\n\r\nexport const queryMatchSchema: z.ZodType<QueryMatch> = z.lazy(() =>\r\n z.record(z.string(), z.unknown())\r\n) as z.ZodType<QueryMatch>;\r\n\r\nexport const matchQuerySchema = z.object({\r\n page: z.number().optional(),\r\n limit: z.number().optional(),\r\n sort: z.string().optional(),\r\n order: z.enum([\"asc\", \"desc\"]).optional(),\r\n match: queryMatchSchema.optional(),\r\n /** Global substring search. Clients should trim; servers treat empty / whitespace-only as no-op. */\r\n q: z.string().optional(),\r\n});\r\n\r\nexport type MatchQueryInput = z.infer<typeof matchQuerySchema>;\r\n\r\nfunction queryFilterToMatch(filter: QueryFilter): QueryMatch {\r\n const op = QUERY_FILTER_METHOD_TO_OP[filter.method];\r\n switch (filter.method) {\r\n case \"between\":\r\n return {\r\n [filter.columnId]: {\r\n $between: [String(filter.value), filter.valueTo ?? \"\"],\r\n },\r\n };\r\n case \"intersect\":\r\n return {\r\n [filter.columnId]: {\r\n $intersect: {\r\n endColumnId: filter.endColumnId ?? \"\",\r\n from: String(filter.value),\r\n to: filter.valueTo ?? \"\",\r\n },\r\n },\r\n };\r\n case \"isEmpty\":\r\n case \"isNotEmpty\":\r\n case \"is_null\":\r\n case \"is_not_null\":\r\n return { [filter.columnId]: { [op]: true } };\r\n default:\r\n return { [filter.columnId]: { [op]: filter.value } };\r\n }\r\n}\r\n\r\n/** Rename QueryFilters into a QueryMatch. Does not bake day bounds or gte. */\r\nexport function queryFiltersToMatch(filters: QueryFilters | undefined): QueryMatch {\r\n if (!filters || filters.length === 0) {\r\n return {};\r\n }\r\n if (filters.length === 1) {\r\n return queryFilterToMatch(filters[0]);\r\n }\r\n return { $and: filters.map(queryFilterToMatch) };\r\n}\r\n"],"mappings":";;;AAGA,MAAM,4BAA4B;CAChC,QAAQ;CACR,UAAU;CACV,aAAa;CACb,WAAW;CACX,cAAc;CACd,WAAW;CACX,IAAI;CACJ,SAAS;CACT,QAAQ;CACR,OAAO;CACP,OAAO;CACP,WAAW;CACX,SAAS;CACT,YAAY;CACZ,SAAS;CACT,aAAa;CACd;AAuDD,MAAa,mBAA0CA,IAAAA,EAAE,WACvDA,IAAAA,EAAE,OAAOA,IAAAA,EAAE,QAAQ,EAAEA,IAAAA,EAAE,SAAS,CAAC,CAClC;AAED,MAAa,mBAAmBA,IAAAA,EAAE,OAAO;CACvC,MAAMA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAOA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC5B,MAAMA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAOA,IAAAA,EAAE,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC,UAAU;CACzC,OAAO,iBAAiB,UAAU;CAElC,GAAGA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACzB,CAAC;AAIF,SAAS,mBAAmB,QAAiC;CAC3D,MAAM,KAAK,0BAA0B,OAAO;AAC5C,SAAQ,OAAO,QAAf;EACE,KAAK,UACH,QAAO,GACJ,OAAO,WAAW,EACjB,UAAU,CAAC,OAAO,OAAO,MAAM,EAAE,OAAO,WAAW,GAAG,EACvD,EACF;EACH,KAAK,YACH,QAAO,GACJ,OAAO,WAAW,EACjB,YAAY;GACV,aAAa,OAAO,eAAe;GACnC,MAAM,OAAO,OAAO,MAAM;GAC1B,IAAI,OAAO,WAAW;GACvB,EACF,EACF;EACH,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,cACH,QAAO,GAAG,OAAO,WAAW,GAAG,KAAK,MAAM,EAAE;EAC9C,QACE,QAAO,GAAG,OAAO,WAAW,GAAG,KAAK,OAAO,OAAO,EAAE;;;;AAK1D,SAAgB,oBAAoB,SAA+C;AACjF,KAAI,CAAC,WAAW,QAAQ,WAAW,EACjC,QAAO,EAAE;AAEX,KAAI,QAAQ,WAAW,EACrB,QAAO,mBAAmB,QAAQ,GAAG;AAEvC,QAAO,EAAE,MAAM,QAAQ,IAAI,mBAAmB,EAAE"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { QueryFilter, QueryFilters } from "./query.schema.cjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/modules/schemas/queryMatch.d.ts
|
|
5
|
+
declare const QUERY_FILTER_METHOD_TO_OP: {
|
|
6
|
+
readonly equals: "$eq";
|
|
7
|
+
readonly contains: "$contains";
|
|
8
|
+
readonly starts_with: "$starts_with";
|
|
9
|
+
readonly ends_with: "$ends_with";
|
|
10
|
+
readonly greater_than: "$greater_than";
|
|
11
|
+
readonly less_than: "$less_than";
|
|
12
|
+
readonly on: "$on";
|
|
13
|
+
readonly between: "$between";
|
|
14
|
+
readonly before: "$before";
|
|
15
|
+
readonly after: "$after";
|
|
16
|
+
readonly oneOf: "$oneOf";
|
|
17
|
+
readonly intersect: "$intersect";
|
|
18
|
+
readonly isEmpty: "$isEmpty";
|
|
19
|
+
readonly isNotEmpty: "$isNotEmpty";
|
|
20
|
+
readonly is_null: "$is_null";
|
|
21
|
+
readonly is_not_null: "$is_not_null";
|
|
22
|
+
};
|
|
23
|
+
type QueryMatchOp = (typeof QUERY_FILTER_METHOD_TO_OP)[QueryFilter["method"]];
|
|
24
|
+
/** Scalar or list value in a QueryMatch field / operator payload. */
|
|
25
|
+
type QueryMatchScalar = string | number | boolean | Date | null;
|
|
26
|
+
interface QueryMatchIntersect {
|
|
27
|
+
readonly endColumnId: string;
|
|
28
|
+
readonly from: string;
|
|
29
|
+
readonly to: string;
|
|
30
|
+
}
|
|
31
|
+
interface QueryMatchOperators {
|
|
32
|
+
readonly $eq?: QueryMatchScalar | readonly string[];
|
|
33
|
+
readonly $ne?: QueryMatchScalar;
|
|
34
|
+
readonly $gt?: QueryMatchScalar;
|
|
35
|
+
readonly $gte?: QueryMatchScalar;
|
|
36
|
+
readonly $lt?: QueryMatchScalar;
|
|
37
|
+
readonly $lte?: QueryMatchScalar;
|
|
38
|
+
readonly $in?: readonly QueryMatchScalar[];
|
|
39
|
+
readonly $nin?: readonly QueryMatchScalar[];
|
|
40
|
+
readonly $exists?: boolean;
|
|
41
|
+
readonly $like?: string;
|
|
42
|
+
readonly $contains?: QueryMatchScalar;
|
|
43
|
+
readonly $starts_with?: QueryMatchScalar;
|
|
44
|
+
readonly $ends_with?: QueryMatchScalar;
|
|
45
|
+
readonly $greater_than?: QueryMatchScalar;
|
|
46
|
+
readonly $less_than?: QueryMatchScalar;
|
|
47
|
+
readonly $on?: QueryMatchScalar;
|
|
48
|
+
readonly $between?: readonly [QueryMatchScalar, QueryMatchScalar];
|
|
49
|
+
readonly $before?: QueryMatchScalar;
|
|
50
|
+
readonly $after?: QueryMatchScalar;
|
|
51
|
+
readonly $oneOf?: readonly string[];
|
|
52
|
+
readonly $intersect?: QueryMatchIntersect;
|
|
53
|
+
readonly $isEmpty?: boolean;
|
|
54
|
+
readonly $isNotEmpty?: boolean;
|
|
55
|
+
readonly $is_null?: boolean;
|
|
56
|
+
readonly $is_not_null?: boolean;
|
|
57
|
+
readonly $not?: QueryMatchOperators;
|
|
58
|
+
}
|
|
59
|
+
type QueryMatchFieldValue = QueryMatchScalar | readonly string[] | QueryMatchOperators;
|
|
60
|
+
interface QueryMatch {
|
|
61
|
+
readonly $and?: readonly QueryMatch[];
|
|
62
|
+
readonly $or?: readonly QueryMatch[];
|
|
63
|
+
readonly $not?: QueryMatch;
|
|
64
|
+
readonly [field: string]: QueryMatchFieldValue | readonly QueryMatch[] | QueryMatch | undefined;
|
|
65
|
+
}
|
|
66
|
+
declare const queryMatchSchema: z.ZodType<QueryMatch>;
|
|
67
|
+
declare const matchQuerySchema: z.ZodObject<{
|
|
68
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
71
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
asc: "asc";
|
|
73
|
+
desc: "desc";
|
|
74
|
+
}>>;
|
|
75
|
+
match: z.ZodOptional<z.ZodType<QueryMatch, unknown, z.core.$ZodTypeInternals<QueryMatch, unknown>>>;
|
|
76
|
+
q: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
type MatchQueryInput = z.infer<typeof matchQuerySchema>;
|
|
79
|
+
/** Rename QueryFilters into a QueryMatch. Does not bake day bounds or gte. */
|
|
80
|
+
declare function queryFiltersToMatch(filters: QueryFilters | undefined): QueryMatch;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { MatchQueryInput, QueryMatch, QueryMatchFieldValue, QueryMatchIntersect, QueryMatchOp, QueryMatchOperators, QueryMatchScalar, matchQuerySchema, queryFiltersToMatch, queryMatchSchema };
|
|
83
|
+
//# sourceMappingURL=queryMatch.d.cts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { QueryFilter, QueryFilters } from "./query.schema.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/modules/schemas/queryMatch.d.ts
|
|
5
|
+
declare const QUERY_FILTER_METHOD_TO_OP: {
|
|
6
|
+
readonly equals: "$eq";
|
|
7
|
+
readonly contains: "$contains";
|
|
8
|
+
readonly starts_with: "$starts_with";
|
|
9
|
+
readonly ends_with: "$ends_with";
|
|
10
|
+
readonly greater_than: "$greater_than";
|
|
11
|
+
readonly less_than: "$less_than";
|
|
12
|
+
readonly on: "$on";
|
|
13
|
+
readonly between: "$between";
|
|
14
|
+
readonly before: "$before";
|
|
15
|
+
readonly after: "$after";
|
|
16
|
+
readonly oneOf: "$oneOf";
|
|
17
|
+
readonly intersect: "$intersect";
|
|
18
|
+
readonly isEmpty: "$isEmpty";
|
|
19
|
+
readonly isNotEmpty: "$isNotEmpty";
|
|
20
|
+
readonly is_null: "$is_null";
|
|
21
|
+
readonly is_not_null: "$is_not_null";
|
|
22
|
+
};
|
|
23
|
+
type QueryMatchOp = (typeof QUERY_FILTER_METHOD_TO_OP)[QueryFilter["method"]];
|
|
24
|
+
/** Scalar or list value in a QueryMatch field / operator payload. */
|
|
25
|
+
type QueryMatchScalar = string | number | boolean | Date | null;
|
|
26
|
+
interface QueryMatchIntersect {
|
|
27
|
+
readonly endColumnId: string;
|
|
28
|
+
readonly from: string;
|
|
29
|
+
readonly to: string;
|
|
30
|
+
}
|
|
31
|
+
interface QueryMatchOperators {
|
|
32
|
+
readonly $eq?: QueryMatchScalar | readonly string[];
|
|
33
|
+
readonly $ne?: QueryMatchScalar;
|
|
34
|
+
readonly $gt?: QueryMatchScalar;
|
|
35
|
+
readonly $gte?: QueryMatchScalar;
|
|
36
|
+
readonly $lt?: QueryMatchScalar;
|
|
37
|
+
readonly $lte?: QueryMatchScalar;
|
|
38
|
+
readonly $in?: readonly QueryMatchScalar[];
|
|
39
|
+
readonly $nin?: readonly QueryMatchScalar[];
|
|
40
|
+
readonly $exists?: boolean;
|
|
41
|
+
readonly $like?: string;
|
|
42
|
+
readonly $contains?: QueryMatchScalar;
|
|
43
|
+
readonly $starts_with?: QueryMatchScalar;
|
|
44
|
+
readonly $ends_with?: QueryMatchScalar;
|
|
45
|
+
readonly $greater_than?: QueryMatchScalar;
|
|
46
|
+
readonly $less_than?: QueryMatchScalar;
|
|
47
|
+
readonly $on?: QueryMatchScalar;
|
|
48
|
+
readonly $between?: readonly [QueryMatchScalar, QueryMatchScalar];
|
|
49
|
+
readonly $before?: QueryMatchScalar;
|
|
50
|
+
readonly $after?: QueryMatchScalar;
|
|
51
|
+
readonly $oneOf?: readonly string[];
|
|
52
|
+
readonly $intersect?: QueryMatchIntersect;
|
|
53
|
+
readonly $isEmpty?: boolean;
|
|
54
|
+
readonly $isNotEmpty?: boolean;
|
|
55
|
+
readonly $is_null?: boolean;
|
|
56
|
+
readonly $is_not_null?: boolean;
|
|
57
|
+
readonly $not?: QueryMatchOperators;
|
|
58
|
+
}
|
|
59
|
+
type QueryMatchFieldValue = QueryMatchScalar | readonly string[] | QueryMatchOperators;
|
|
60
|
+
interface QueryMatch {
|
|
61
|
+
readonly $and?: readonly QueryMatch[];
|
|
62
|
+
readonly $or?: readonly QueryMatch[];
|
|
63
|
+
readonly $not?: QueryMatch;
|
|
64
|
+
readonly [field: string]: QueryMatchFieldValue | readonly QueryMatch[] | QueryMatch | undefined;
|
|
65
|
+
}
|
|
66
|
+
declare const queryMatchSchema: z.ZodType<QueryMatch>;
|
|
67
|
+
declare const matchQuerySchema: z.ZodObject<{
|
|
68
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
71
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
asc: "asc";
|
|
73
|
+
desc: "desc";
|
|
74
|
+
}>>;
|
|
75
|
+
match: z.ZodOptional<z.ZodType<QueryMatch, unknown, z.core.$ZodTypeInternals<QueryMatch, unknown>>>;
|
|
76
|
+
q: z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
type MatchQueryInput = z.infer<typeof matchQuerySchema>;
|
|
79
|
+
/** Rename QueryFilters into a QueryMatch. Does not bake day bounds or gte. */
|
|
80
|
+
declare function queryFiltersToMatch(filters: QueryFilters | undefined): QueryMatch;
|
|
81
|
+
//#endregion
|
|
82
|
+
export { MatchQueryInput, QueryMatch, QueryMatchFieldValue, QueryMatchIntersect, QueryMatchOp, QueryMatchOperators, QueryMatchScalar, matchQuerySchema, queryFiltersToMatch, queryMatchSchema };
|
|
83
|
+
//# sourceMappingURL=queryMatch.d.mts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/modules/schemas/queryMatch.ts
|
|
3
|
+
const QUERY_FILTER_METHOD_TO_OP = {
|
|
4
|
+
equals: "$eq",
|
|
5
|
+
contains: "$contains",
|
|
6
|
+
starts_with: "$starts_with",
|
|
7
|
+
ends_with: "$ends_with",
|
|
8
|
+
greater_than: "$greater_than",
|
|
9
|
+
less_than: "$less_than",
|
|
10
|
+
on: "$on",
|
|
11
|
+
between: "$between",
|
|
12
|
+
before: "$before",
|
|
13
|
+
after: "$after",
|
|
14
|
+
oneOf: "$oneOf",
|
|
15
|
+
intersect: "$intersect",
|
|
16
|
+
isEmpty: "$isEmpty",
|
|
17
|
+
isNotEmpty: "$isNotEmpty",
|
|
18
|
+
is_null: "$is_null",
|
|
19
|
+
is_not_null: "$is_not_null"
|
|
20
|
+
};
|
|
21
|
+
const queryMatchSchema = z.lazy(() => z.record(z.string(), z.unknown()));
|
|
22
|
+
const matchQuerySchema = z.object({
|
|
23
|
+
page: z.number().optional(),
|
|
24
|
+
limit: z.number().optional(),
|
|
25
|
+
sort: z.string().optional(),
|
|
26
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
27
|
+
match: queryMatchSchema.optional(),
|
|
28
|
+
q: z.string().optional()
|
|
29
|
+
});
|
|
30
|
+
function queryFilterToMatch(filter) {
|
|
31
|
+
const op = QUERY_FILTER_METHOD_TO_OP[filter.method];
|
|
32
|
+
switch (filter.method) {
|
|
33
|
+
case "between": return { [filter.columnId]: { $between: [String(filter.value), filter.valueTo ?? ""] } };
|
|
34
|
+
case "intersect": return { [filter.columnId]: { $intersect: {
|
|
35
|
+
endColumnId: filter.endColumnId ?? "",
|
|
36
|
+
from: String(filter.value),
|
|
37
|
+
to: filter.valueTo ?? ""
|
|
38
|
+
} } };
|
|
39
|
+
case "isEmpty":
|
|
40
|
+
case "isNotEmpty":
|
|
41
|
+
case "is_null":
|
|
42
|
+
case "is_not_null": return { [filter.columnId]: { [op]: true } };
|
|
43
|
+
default: return { [filter.columnId]: { [op]: filter.value } };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** Rename QueryFilters into a QueryMatch. Does not bake day bounds or gte. */
|
|
47
|
+
function queryFiltersToMatch(filters) {
|
|
48
|
+
if (!filters || filters.length === 0) return {};
|
|
49
|
+
if (filters.length === 1) return queryFilterToMatch(filters[0]);
|
|
50
|
+
return { $and: filters.map(queryFilterToMatch) };
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { matchQuerySchema, queryFiltersToMatch, queryMatchSchema };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=queryMatch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryMatch.mjs","names":[],"sources":["../../../../src/modules/schemas/queryMatch.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport type { QueryFilter, QueryFilters } from \"./query.schema\";\r\n\r\nconst QUERY_FILTER_METHOD_TO_OP = {\r\n equals: \"$eq\",\r\n contains: \"$contains\",\r\n starts_with: \"$starts_with\",\r\n ends_with: \"$ends_with\",\r\n greater_than: \"$greater_than\",\r\n less_than: \"$less_than\",\r\n on: \"$on\",\r\n between: \"$between\",\r\n before: \"$before\",\r\n after: \"$after\",\r\n oneOf: \"$oneOf\",\r\n intersect: \"$intersect\",\r\n isEmpty: \"$isEmpty\",\r\n isNotEmpty: \"$isNotEmpty\",\r\n is_null: \"$is_null\",\r\n is_not_null: \"$is_not_null\",\r\n} as const;\r\n\r\nexport type QueryMatchOp = (typeof QUERY_FILTER_METHOD_TO_OP)[QueryFilter[\"method\"]];\r\n\r\n/** Scalar or list value in a QueryMatch field / operator payload. */\r\nexport type QueryMatchScalar = string | number | boolean | Date | null;\r\n\r\nexport interface QueryMatchIntersect {\r\n readonly endColumnId: string;\r\n readonly from: string;\r\n readonly to: string;\r\n}\r\n\r\nexport interface QueryMatchOperators {\r\n readonly $eq?: QueryMatchScalar | readonly string[];\r\n readonly $ne?: QueryMatchScalar;\r\n readonly $gt?: QueryMatchScalar;\r\n readonly $gte?: QueryMatchScalar;\r\n readonly $lt?: QueryMatchScalar;\r\n readonly $lte?: QueryMatchScalar;\r\n readonly $in?: readonly QueryMatchScalar[];\r\n readonly $nin?: readonly QueryMatchScalar[];\r\n readonly $exists?: boolean;\r\n readonly $like?: string;\r\n readonly $contains?: QueryMatchScalar;\r\n readonly $starts_with?: QueryMatchScalar;\r\n readonly $ends_with?: QueryMatchScalar;\r\n readonly $greater_than?: QueryMatchScalar;\r\n readonly $less_than?: QueryMatchScalar;\r\n readonly $on?: QueryMatchScalar;\r\n readonly $between?: readonly [QueryMatchScalar, QueryMatchScalar];\r\n readonly $before?: QueryMatchScalar;\r\n readonly $after?: QueryMatchScalar;\r\n readonly $oneOf?: readonly string[];\r\n readonly $intersect?: QueryMatchIntersect;\r\n readonly $isEmpty?: boolean;\r\n readonly $isNotEmpty?: boolean;\r\n readonly $is_null?: boolean;\r\n readonly $is_not_null?: boolean;\r\n readonly $not?: QueryMatchOperators;\r\n}\r\n\r\nexport type QueryMatchFieldValue = QueryMatchScalar | readonly string[] | QueryMatchOperators;\r\n\r\nexport interface QueryMatch {\r\n readonly $and?: readonly QueryMatch[];\r\n readonly $or?: readonly QueryMatch[];\r\n readonly $not?: QueryMatch;\r\n readonly [field: string]:\r\n | QueryMatchFieldValue\r\n | readonly QueryMatch[]\r\n | QueryMatch\r\n | undefined;\r\n}\r\n\r\nexport const queryMatchSchema: z.ZodType<QueryMatch> = z.lazy(() =>\r\n z.record(z.string(), z.unknown())\r\n) as z.ZodType<QueryMatch>;\r\n\r\nexport const matchQuerySchema = z.object({\r\n page: z.number().optional(),\r\n limit: z.number().optional(),\r\n sort: z.string().optional(),\r\n order: z.enum([\"asc\", \"desc\"]).optional(),\r\n match: queryMatchSchema.optional(),\r\n /** Global substring search. Clients should trim; servers treat empty / whitespace-only as no-op. */\r\n q: z.string().optional(),\r\n});\r\n\r\nexport type MatchQueryInput = z.infer<typeof matchQuerySchema>;\r\n\r\nfunction queryFilterToMatch(filter: QueryFilter): QueryMatch {\r\n const op = QUERY_FILTER_METHOD_TO_OP[filter.method];\r\n switch (filter.method) {\r\n case \"between\":\r\n return {\r\n [filter.columnId]: {\r\n $between: [String(filter.value), filter.valueTo ?? \"\"],\r\n },\r\n };\r\n case \"intersect\":\r\n return {\r\n [filter.columnId]: {\r\n $intersect: {\r\n endColumnId: filter.endColumnId ?? \"\",\r\n from: String(filter.value),\r\n to: filter.valueTo ?? \"\",\r\n },\r\n },\r\n };\r\n case \"isEmpty\":\r\n case \"isNotEmpty\":\r\n case \"is_null\":\r\n case \"is_not_null\":\r\n return { [filter.columnId]: { [op]: true } };\r\n default:\r\n return { [filter.columnId]: { [op]: filter.value } };\r\n }\r\n}\r\n\r\n/** Rename QueryFilters into a QueryMatch. Does not bake day bounds or gte. */\r\nexport function queryFiltersToMatch(filters: QueryFilters | undefined): QueryMatch {\r\n if (!filters || filters.length === 0) {\r\n return {};\r\n }\r\n if (filters.length === 1) {\r\n return queryFilterToMatch(filters[0]);\r\n }\r\n return { $and: filters.map(queryFilterToMatch) };\r\n}\r\n"],"mappings":";;AAGA,MAAM,4BAA4B;CAChC,QAAQ;CACR,UAAU;CACV,aAAa;CACb,WAAW;CACX,cAAc;CACd,WAAW;CACX,IAAI;CACJ,SAAS;CACT,QAAQ;CACR,OAAO;CACP,OAAO;CACP,WAAW;CACX,SAAS;CACT,YAAY;CACZ,SAAS;CACT,aAAa;CACd;AAuDD,MAAa,mBAA0C,EAAE,WACvD,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAClC;AAED,MAAa,mBAAmB,EAAE,OAAO;CACvC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAO,EAAE,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC,UAAU;CACzC,OAAO,iBAAiB,UAAU;CAElC,GAAG,EAAE,QAAQ,CAAC,UAAU;CACzB,CAAC;AAIF,SAAS,mBAAmB,QAAiC;CAC3D,MAAM,KAAK,0BAA0B,OAAO;AAC5C,SAAQ,OAAO,QAAf;EACE,KAAK,UACH,QAAO,GACJ,OAAO,WAAW,EACjB,UAAU,CAAC,OAAO,OAAO,MAAM,EAAE,OAAO,WAAW,GAAG,EACvD,EACF;EACH,KAAK,YACH,QAAO,GACJ,OAAO,WAAW,EACjB,YAAY;GACV,aAAa,OAAO,eAAe;GACnC,MAAM,OAAO,OAAO,MAAM;GAC1B,IAAI,OAAO,WAAW;GACvB,EACF,EACF;EACH,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK,cACH,QAAO,GAAG,OAAO,WAAW,GAAG,KAAK,MAAM,EAAE;EAC9C,QACE,QAAO,GAAG,OAAO,WAAW,GAAG,KAAK,OAAO,OAAO,EAAE;;;;AAK1D,SAAgB,oBAAoB,SAA+C;AACjF,KAAI,CAAC,WAAW,QAAQ,WAAW,EACjC,QAAO,EAAE;AAEX,KAAI,QAAQ,WAAW,EACrB,QAAO,mBAAmB,QAAQ,GAAG;AAEvC,QAAO,EAAE,MAAM,QAAQ,IAAI,mBAAmB,EAAE"}
|
|
@@ -9,7 +9,7 @@ const tagSchema = zod.z.object({
|
|
|
9
9
|
createdAt: zod.z.date(),
|
|
10
10
|
updatedAt: zod.z.date().nullish(),
|
|
11
11
|
deletedAt: zod.z.date().nullish(),
|
|
12
|
-
userId: zod.z.string(),
|
|
12
|
+
userId: zod.z.string().nullish(),
|
|
13
13
|
name: zod.z.string(),
|
|
14
14
|
color: zod.z.string().nullish(),
|
|
15
15
|
type: zod.z.string().nullish(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.schema.cjs","names":["z","querySchema"],"sources":["../../../../src/modules/tag/tag.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const tagSchema = z.object({\r\n id: z.string(),\r\n organizationId: z.string().nullish(),\r\n teamId: z.string().nullish(),\r\n createdAt: z.date(),\r\n updatedAt: z.date().nullish(),\r\n deletedAt: z.date().nullish(),\r\n userId: z.string(),\r\n name: z.string(),\r\n color: z.string().nullish(),\r\n type: z.string().nullish(),\r\n isEnabled: z.boolean(),\r\n parentId: z.string().nullish(),\r\n assignableTo: z.string().array().nullish().default([]),\r\n});\r\n\r\nexport const taggingSchema = z.object({\r\n id: z.string(),\r\n createdAt: z.date(),\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagListInputSchema = querySchema;\r\n\r\nexport const tagListOutputSchema = z.object({\r\n rows: z.array(tagSchema),\r\n total: z.number(),\r\n});\r\n\r\nexport const tagListSchema = z.object({\r\n assignableTo: z.string().optional(),\r\n});\r\n\r\nexport const tagCreateSchema = z.object({\r\n organizationId: z.string().optional(),\r\n teamId: z.string().optional(),\r\n name: z.string(),\r\n color: z.string(),\r\n assignableTo: z.string().array().optional().default([]),\r\n resourceType: z.string().optional(),\r\n resourceId: z.string().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagUpdateSchema = z.object({\r\n id: z.string(),\r\n name: z.string().optional(),\r\n color: z.string().optional(),\r\n assignableTo: z.string().array().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagLinkSchema = z.object({\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagDeleteSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport type TagSchema = z.infer<typeof tagSchema>;\r\nexport type TaggingSchema = z.infer<typeof taggingSchema>;\r\nexport type TagListSchema = z.infer<typeof tagListSchema>;\r\nexport type TagCreateSchema = z.infer<typeof tagCreateSchema>;\r\nexport type TagUpdateSchema = z.infer<typeof tagUpdateSchema>;\r\nexport type TagLinkSchema = z.infer<typeof tagLinkSchema>;\r\nexport type TagDeleteSchema = z.infer<typeof tagDeleteSchema>;\r\nexport type TagListOutputSchema = z.infer<typeof tagListOutputSchema>;\r\nexport type TagListInputSchema = z.infer<typeof tagListInputSchema>;\r\n"],"mappings":";;;;AAGA,MAAa,YAAYA,IAAAA,EAAE,OAAO;CAChC,IAAIA,IAAAA,EAAE,QAAQ;CACd,gBAAgBA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CACpC,QAAQA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC5B,WAAWA,IAAAA,EAAE,MAAM;CACnB,WAAWA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC7B,WAAWA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC7B,QAAQA,IAAAA,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"tag.schema.cjs","names":["z","querySchema"],"sources":["../../../../src/modules/tag/tag.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const tagSchema = z.object({\r\n id: z.string(),\r\n organizationId: z.string().nullish(),\r\n teamId: z.string().nullish(),\r\n createdAt: z.date(),\r\n updatedAt: z.date().nullish(),\r\n deletedAt: z.date().nullish(),\r\n userId: z.string().nullish(),\r\n name: z.string(),\r\n color: z.string().nullish(),\r\n type: z.string().nullish(),\r\n isEnabled: z.boolean(),\r\n parentId: z.string().nullish(),\r\n assignableTo: z.string().array().nullish().default([]),\r\n});\r\n\r\nexport const taggingSchema = z.object({\r\n id: z.string(),\r\n createdAt: z.date(),\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagListInputSchema = querySchema;\r\n\r\nexport const tagListOutputSchema = z.object({\r\n rows: z.array(tagSchema),\r\n total: z.number(),\r\n});\r\n\r\nexport const tagListSchema = z.object({\r\n assignableTo: z.string().optional(),\r\n});\r\n\r\nexport const tagCreateSchema = z.object({\r\n organizationId: z.string().optional(),\r\n teamId: z.string().optional(),\r\n name: z.string(),\r\n color: z.string(),\r\n assignableTo: z.string().array().optional().default([]),\r\n resourceType: z.string().optional(),\r\n resourceId: z.string().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagUpdateSchema = z.object({\r\n id: z.string(),\r\n name: z.string().optional(),\r\n color: z.string().optional(),\r\n assignableTo: z.string().array().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagLinkSchema = z.object({\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagDeleteSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport type TagSchema = z.infer<typeof tagSchema>;\r\nexport type TaggingSchema = z.infer<typeof taggingSchema>;\r\nexport type TagListSchema = z.infer<typeof tagListSchema>;\r\nexport type TagCreateSchema = z.infer<typeof tagCreateSchema>;\r\nexport type TagUpdateSchema = z.infer<typeof tagUpdateSchema>;\r\nexport type TagLinkSchema = z.infer<typeof tagLinkSchema>;\r\nexport type TagDeleteSchema = z.infer<typeof tagDeleteSchema>;\r\nexport type TagListOutputSchema = z.infer<typeof tagListOutputSchema>;\r\nexport type TagListInputSchema = z.infer<typeof tagListInputSchema>;\r\n"],"mappings":";;;;AAGA,MAAa,YAAYA,IAAAA,EAAE,OAAO;CAChC,IAAIA,IAAAA,EAAE,QAAQ;CACd,gBAAgBA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CACpC,QAAQA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC5B,WAAWA,IAAAA,EAAE,MAAM;CACnB,WAAWA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC7B,WAAWA,IAAAA,EAAE,MAAM,CAAC,SAAS;CAC7B,QAAQA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC5B,MAAMA,IAAAA,EAAE,QAAQ;CAChB,OAAOA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC3B,MAAMA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC1B,WAAWA,IAAAA,EAAE,SAAS;CACtB,UAAUA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC9B,cAAcA,IAAAA,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;CACvD,CAAC;AAEF,MAAa,gBAAgBA,IAAAA,EAAE,OAAO;CACpC,IAAIA,IAAAA,EAAE,QAAQ;CACd,WAAWA,IAAAA,EAAE,MAAM;CACnB,OAAOA,IAAAA,EAAE,QAAQ;CACjB,cAAcA,IAAAA,EAAE,QAAQ;CACxB,YAAYA,IAAAA,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAa,qBAAqBC,yCAAAA;AAElC,MAAa,sBAAsBD,IAAAA,EAAE,OAAO;CAC1C,MAAMA,IAAAA,EAAE,MAAM,UAAU;CACxB,OAAOA,IAAAA,EAAE,QAAQ;CAClB,CAAC;AAEF,MAAa,gBAAgBA,IAAAA,EAAE,OAAO,EACpC,cAAcA,IAAAA,EAAE,QAAQ,CAAC,UAAU,EACpC,CAAC;AAEF,MAAa,kBAAkBA,IAAAA,EAAE,OAAO;CACtC,gBAAgBA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACrC,QAAQA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC7B,MAAMA,IAAAA,EAAE,QAAQ;CAChB,OAAOA,IAAAA,EAAE,QAAQ;CACjB,cAAcA,IAAAA,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;CACvD,cAAcA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACnC,YAAYA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CACjC,UAAUA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC9B,MAAMA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC3B,CAAC;AAEF,MAAa,kBAAkBA,IAAAA,EAAE,OAAO;CACtC,IAAIA,IAAAA,EAAE,QAAQ;CACd,MAAMA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAOA,IAAAA,EAAE,QAAQ,CAAC,UAAU;CAC5B,cAAcA,IAAAA,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;CAC3C,UAAUA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC9B,MAAMA,IAAAA,EAAE,QAAQ,CAAC,SAAS;CAC3B,CAAC;AAEF,MAAa,gBAAgBA,IAAAA,EAAE,OAAO;CACpC,OAAOA,IAAAA,EAAE,QAAQ;CACjB,cAAcA,IAAAA,EAAE,QAAQ;CACxB,YAAYA,IAAAA,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAa,kBAAkBA,IAAAA,EAAE,OAAO,EACtC,IAAIA,IAAAA,EAAE,QAAQ,EACf,CAAC"}
|
|
@@ -8,7 +8,7 @@ declare const tagSchema: z.ZodObject<{
|
|
|
8
8
|
createdAt: z.ZodDate;
|
|
9
9
|
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
10
10
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
11
|
-
userId: z.ZodString
|
|
11
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
12
|
name: z.ZodString;
|
|
13
13
|
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
14
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -37,15 +37,15 @@ declare const tagListInputSchema: z.ZodObject<{
|
|
|
37
37
|
string: "string";
|
|
38
38
|
number: "number";
|
|
39
39
|
boolean: "boolean";
|
|
40
|
-
date: "date";
|
|
41
40
|
enum: "enum";
|
|
41
|
+
date: "date";
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
contains: "contains";
|
|
46
|
-
equals: "equals";
|
|
47
45
|
starts_with: "starts_with";
|
|
48
46
|
ends_with: "ends_with";
|
|
47
|
+
contains: "contains";
|
|
48
|
+
equals: "equals";
|
|
49
49
|
greater_than: "greater_than";
|
|
50
50
|
less_than: "less_than";
|
|
51
51
|
on: "on";
|
|
@@ -73,7 +73,7 @@ declare const tagListOutputSchema: z.ZodObject<{
|
|
|
73
73
|
createdAt: z.ZodDate;
|
|
74
74
|
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
75
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
76
|
-
userId: z.ZodString
|
|
76
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
77
|
name: z.ZodString;
|
|
78
78
|
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
79
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -8,7 +8,7 @@ declare const tagSchema: z.ZodObject<{
|
|
|
8
8
|
createdAt: z.ZodDate;
|
|
9
9
|
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
10
10
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
11
|
-
userId: z.ZodString
|
|
11
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
12
|
name: z.ZodString;
|
|
13
13
|
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
14
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -37,15 +37,15 @@ declare const tagListInputSchema: z.ZodObject<{
|
|
|
37
37
|
string: "string";
|
|
38
38
|
number: "number";
|
|
39
39
|
boolean: "boolean";
|
|
40
|
-
date: "date";
|
|
41
40
|
enum: "enum";
|
|
41
|
+
date: "date";
|
|
42
42
|
jsonArray: "jsonArray";
|
|
43
43
|
}>;
|
|
44
44
|
method: z.ZodEnum<{
|
|
45
|
-
contains: "contains";
|
|
46
|
-
equals: "equals";
|
|
47
45
|
starts_with: "starts_with";
|
|
48
46
|
ends_with: "ends_with";
|
|
47
|
+
contains: "contains";
|
|
48
|
+
equals: "equals";
|
|
49
49
|
greater_than: "greater_than";
|
|
50
50
|
less_than: "less_than";
|
|
51
51
|
on: "on";
|
|
@@ -73,7 +73,7 @@ declare const tagListOutputSchema: z.ZodObject<{
|
|
|
73
73
|
createdAt: z.ZodDate;
|
|
74
74
|
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
75
75
|
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
76
|
-
userId: z.ZodString
|
|
76
|
+
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
77
|
name: z.ZodString;
|
|
78
78
|
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
79
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.schema.mjs","names":[],"sources":["../../../../src/modules/tag/tag.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const tagSchema = z.object({\r\n id: z.string(),\r\n organizationId: z.string().nullish(),\r\n teamId: z.string().nullish(),\r\n createdAt: z.date(),\r\n updatedAt: z.date().nullish(),\r\n deletedAt: z.date().nullish(),\r\n userId: z.string(),\r\n name: z.string(),\r\n color: z.string().nullish(),\r\n type: z.string().nullish(),\r\n isEnabled: z.boolean(),\r\n parentId: z.string().nullish(),\r\n assignableTo: z.string().array().nullish().default([]),\r\n});\r\n\r\nexport const taggingSchema = z.object({\r\n id: z.string(),\r\n createdAt: z.date(),\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagListInputSchema = querySchema;\r\n\r\nexport const tagListOutputSchema = z.object({\r\n rows: z.array(tagSchema),\r\n total: z.number(),\r\n});\r\n\r\nexport const tagListSchema = z.object({\r\n assignableTo: z.string().optional(),\r\n});\r\n\r\nexport const tagCreateSchema = z.object({\r\n organizationId: z.string().optional(),\r\n teamId: z.string().optional(),\r\n name: z.string(),\r\n color: z.string(),\r\n assignableTo: z.string().array().optional().default([]),\r\n resourceType: z.string().optional(),\r\n resourceId: z.string().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagUpdateSchema = z.object({\r\n id: z.string(),\r\n name: z.string().optional(),\r\n color: z.string().optional(),\r\n assignableTo: z.string().array().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagLinkSchema = z.object({\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagDeleteSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport type TagSchema = z.infer<typeof tagSchema>;\r\nexport type TaggingSchema = z.infer<typeof taggingSchema>;\r\nexport type TagListSchema = z.infer<typeof tagListSchema>;\r\nexport type TagCreateSchema = z.infer<typeof tagCreateSchema>;\r\nexport type TagUpdateSchema = z.infer<typeof tagUpdateSchema>;\r\nexport type TagLinkSchema = z.infer<typeof tagLinkSchema>;\r\nexport type TagDeleteSchema = z.infer<typeof tagDeleteSchema>;\r\nexport type TagListOutputSchema = z.infer<typeof tagListOutputSchema>;\r\nexport type TagListInputSchema = z.infer<typeof tagListInputSchema>;\r\n"],"mappings":";;;AAGA,MAAa,YAAY,EAAE,OAAO;CAChC,IAAI,EAAE,QAAQ;CACd,gBAAgB,EAAE,QAAQ,CAAC,SAAS;CACpC,QAAQ,EAAE,QAAQ,CAAC,SAAS;CAC5B,WAAW,EAAE,MAAM;CACnB,WAAW,EAAE,MAAM,CAAC,SAAS;CAC7B,WAAW,EAAE,MAAM,CAAC,SAAS;CAC7B,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"tag.schema.mjs","names":[],"sources":["../../../../src/modules/tag/tag.schema.ts"],"sourcesContent":["import { z } from \"zod\";\r\nimport { querySchema } from \"../schemas/query.schema\";\r\n\r\nexport const tagSchema = z.object({\r\n id: z.string(),\r\n organizationId: z.string().nullish(),\r\n teamId: z.string().nullish(),\r\n createdAt: z.date(),\r\n updatedAt: z.date().nullish(),\r\n deletedAt: z.date().nullish(),\r\n userId: z.string().nullish(),\r\n name: z.string(),\r\n color: z.string().nullish(),\r\n type: z.string().nullish(),\r\n isEnabled: z.boolean(),\r\n parentId: z.string().nullish(),\r\n assignableTo: z.string().array().nullish().default([]),\r\n});\r\n\r\nexport const taggingSchema = z.object({\r\n id: z.string(),\r\n createdAt: z.date(),\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagListInputSchema = querySchema;\r\n\r\nexport const tagListOutputSchema = z.object({\r\n rows: z.array(tagSchema),\r\n total: z.number(),\r\n});\r\n\r\nexport const tagListSchema = z.object({\r\n assignableTo: z.string().optional(),\r\n});\r\n\r\nexport const tagCreateSchema = z.object({\r\n organizationId: z.string().optional(),\r\n teamId: z.string().optional(),\r\n name: z.string(),\r\n color: z.string(),\r\n assignableTo: z.string().array().optional().default([]),\r\n resourceType: z.string().optional(),\r\n resourceId: z.string().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagUpdateSchema = z.object({\r\n id: z.string(),\r\n name: z.string().optional(),\r\n color: z.string().optional(),\r\n assignableTo: z.string().array().optional(),\r\n parentId: z.string().nullish(),\r\n type: z.string().nullish(),\r\n});\r\n\r\nexport const tagLinkSchema = z.object({\r\n tagId: z.string(),\r\n resourceType: z.string(),\r\n resourceId: z.string(),\r\n});\r\n\r\nexport const tagDeleteSchema = z.object({\r\n id: z.string(),\r\n});\r\n\r\nexport type TagSchema = z.infer<typeof tagSchema>;\r\nexport type TaggingSchema = z.infer<typeof taggingSchema>;\r\nexport type TagListSchema = z.infer<typeof tagListSchema>;\r\nexport type TagCreateSchema = z.infer<typeof tagCreateSchema>;\r\nexport type TagUpdateSchema = z.infer<typeof tagUpdateSchema>;\r\nexport type TagLinkSchema = z.infer<typeof tagLinkSchema>;\r\nexport type TagDeleteSchema = z.infer<typeof tagDeleteSchema>;\r\nexport type TagListOutputSchema = z.infer<typeof tagListOutputSchema>;\r\nexport type TagListInputSchema = z.infer<typeof tagListInputSchema>;\r\n"],"mappings":";;;AAGA,MAAa,YAAY,EAAE,OAAO;CAChC,IAAI,EAAE,QAAQ;CACd,gBAAgB,EAAE,QAAQ,CAAC,SAAS;CACpC,QAAQ,EAAE,QAAQ,CAAC,SAAS;CAC5B,WAAW,EAAE,MAAM;CACnB,WAAW,EAAE,MAAM,CAAC,SAAS;CAC7B,WAAW,EAAE,MAAM,CAAC,SAAS;CAC7B,QAAQ,EAAE,QAAQ,CAAC,SAAS;CAC5B,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ,CAAC,SAAS;CAC3B,MAAM,EAAE,QAAQ,CAAC,SAAS;CAC1B,WAAW,EAAE,SAAS;CACtB,UAAU,EAAE,QAAQ,CAAC,SAAS;CAC9B,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;CACvD,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO;CACpC,IAAI,EAAE,QAAQ;CACd,WAAW,EAAE,MAAM;CACnB,OAAO,EAAE,QAAQ;CACjB,cAAc,EAAE,QAAQ;CACxB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAa,qBAAqB;AAElC,MAAa,sBAAsB,EAAE,OAAO;CAC1C,MAAM,EAAE,MAAM,UAAU;CACxB,OAAO,EAAE,QAAQ;CAClB,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO,EACpC,cAAc,EAAE,QAAQ,CAAC,UAAU,EACpC,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO;CACtC,gBAAgB,EAAE,QAAQ,CAAC,UAAU;CACrC,QAAQ,EAAE,QAAQ,CAAC,UAAU;CAC7B,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ;CACjB,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;CACvD,cAAc,EAAE,QAAQ,CAAC,UAAU;CACnC,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,UAAU,EAAE,QAAQ,CAAC,SAAS;CAC9B,MAAM,EAAE,QAAQ,CAAC,SAAS;CAC3B,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO;CACtC,IAAI,EAAE,QAAQ;CACd,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;CAC3C,UAAU,EAAE,QAAQ,CAAC,SAAS;CAC9B,MAAM,EAAE,QAAQ,CAAC,SAAS;CAC3B,CAAC;AAEF,MAAa,gBAAgB,EAAE,OAAO;CACpC,OAAO,EAAE,QAAQ;CACjB,cAAc,EAAE,QAAQ;CACxB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAa,kBAAkB,EAAE,OAAO,EACtC,IAAI,EAAE,QAAQ,EACf,CAAC"}
|
|
@@ -11,10 +11,10 @@ declare const workflowSelectSchema: z.ZodObject<{
|
|
|
11
11
|
input: z.ZodUnknown;
|
|
12
12
|
output: z.ZodUnknown;
|
|
13
13
|
status: z.ZodEnum<{
|
|
14
|
-
failed: "failed";
|
|
15
14
|
queued: "queued";
|
|
16
15
|
running: "running";
|
|
17
16
|
completed: "completed";
|
|
17
|
+
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
error: z.ZodNullable<z.ZodString>;
|
|
20
20
|
retries: z.ZodNumber;
|
|
@@ -28,10 +28,10 @@ declare const workflowReadInputSchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
declare const workflowListInputSchema: z.ZodObject<{
|
|
30
30
|
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
31
|
-
failed: "failed";
|
|
32
31
|
queued: "queued";
|
|
33
32
|
running: "running";
|
|
34
33
|
completed: "completed";
|
|
34
|
+
failed: "failed";
|
|
35
35
|
}>>>;
|
|
36
36
|
jobName: z.ZodOptional<z.ZodString>;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -51,10 +51,10 @@ declare const workflowReadOutputSchema: z.ZodObject<{
|
|
|
51
51
|
input: z.ZodUnknown;
|
|
52
52
|
output: z.ZodUnknown;
|
|
53
53
|
status: z.ZodEnum<{
|
|
54
|
-
failed: "failed";
|
|
55
54
|
queued: "queued";
|
|
56
55
|
running: "running";
|
|
57
56
|
completed: "completed";
|
|
57
|
+
failed: "failed";
|
|
58
58
|
}>;
|
|
59
59
|
error: z.ZodNullable<z.ZodString>;
|
|
60
60
|
retries: z.ZodNumber;
|
|
@@ -73,10 +73,10 @@ declare const workflowListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
73
73
|
input: z.ZodUnknown;
|
|
74
74
|
output: z.ZodUnknown;
|
|
75
75
|
status: z.ZodEnum<{
|
|
76
|
-
failed: "failed";
|
|
77
76
|
queued: "queued";
|
|
78
77
|
running: "running";
|
|
79
78
|
completed: "completed";
|
|
79
|
+
failed: "failed";
|
|
80
80
|
}>;
|
|
81
81
|
error: z.ZodNullable<z.ZodString>;
|
|
82
82
|
retries: z.ZodNumber;
|
|
@@ -11,10 +11,10 @@ declare const workflowSelectSchema: z.ZodObject<{
|
|
|
11
11
|
input: z.ZodUnknown;
|
|
12
12
|
output: z.ZodUnknown;
|
|
13
13
|
status: z.ZodEnum<{
|
|
14
|
-
failed: "failed";
|
|
15
14
|
queued: "queued";
|
|
16
15
|
running: "running";
|
|
17
16
|
completed: "completed";
|
|
17
|
+
failed: "failed";
|
|
18
18
|
}>;
|
|
19
19
|
error: z.ZodNullable<z.ZodString>;
|
|
20
20
|
retries: z.ZodNumber;
|
|
@@ -28,10 +28,10 @@ declare const workflowReadInputSchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
declare const workflowListInputSchema: z.ZodObject<{
|
|
30
30
|
status: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
31
|
-
failed: "failed";
|
|
32
31
|
queued: "queued";
|
|
33
32
|
running: "running";
|
|
34
33
|
completed: "completed";
|
|
34
|
+
failed: "failed";
|
|
35
35
|
}>>>;
|
|
36
36
|
jobName: z.ZodOptional<z.ZodString>;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -51,10 +51,10 @@ declare const workflowReadOutputSchema: z.ZodObject<{
|
|
|
51
51
|
input: z.ZodUnknown;
|
|
52
52
|
output: z.ZodUnknown;
|
|
53
53
|
status: z.ZodEnum<{
|
|
54
|
-
failed: "failed";
|
|
55
54
|
queued: "queued";
|
|
56
55
|
running: "running";
|
|
57
56
|
completed: "completed";
|
|
57
|
+
failed: "failed";
|
|
58
58
|
}>;
|
|
59
59
|
error: z.ZodNullable<z.ZodString>;
|
|
60
60
|
retries: z.ZodNumber;
|
|
@@ -73,10 +73,10 @@ declare const workflowListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
73
73
|
input: z.ZodUnknown;
|
|
74
74
|
output: z.ZodUnknown;
|
|
75
75
|
status: z.ZodEnum<{
|
|
76
|
-
failed: "failed";
|
|
77
76
|
queued: "queued";
|
|
78
77
|
running: "running";
|
|
79
78
|
completed: "completed";
|
|
79
|
+
failed: "failed";
|
|
80
80
|
}>;
|
|
81
81
|
error: z.ZodNullable<z.ZodString>;
|
|
82
82
|
retries: z.ZodNumber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m5kdev/commons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,13 +12,16 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"devalue": "5.4.2"
|
|
15
|
+
"devalue": "5.4.2"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
16
18
|
"zod": "4.2.1"
|
|
17
19
|
},
|
|
18
20
|
"devDependencies": {
|
|
19
21
|
"tsdown": "0.21.7",
|
|
20
22
|
"typescript": "6.0.3",
|
|
21
|
-
"
|
|
23
|
+
"zod": "4.2.1",
|
|
24
|
+
"@m5kdev/config": "0.33.0"
|
|
22
25
|
},
|
|
23
26
|
"exports": {
|
|
24
27
|
"./utils/*": {
|