@middlewr/contracts 0.0.27 → 0.0.29

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.
@@ -73,6 +73,86 @@ export declare const LinkSchema: z.ZodObject<{
73
73
  frame_color: z.ZodString;
74
74
  frame_text_color: z.ZodString;
75
75
  }, z.core.$strip>>;
76
+ link_type: z.ZodDefault<z.ZodEnum<{
77
+ redirect: "redirect";
78
+ rules: "rules";
79
+ }>>;
80
+ rule_graph: z.ZodOptional<z.ZodNullable<z.ZodObject<{
81
+ entry: z.ZodString;
82
+ nodes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
83
+ id: z.ZodString;
84
+ type: z.ZodLiteral<"condition">;
85
+ position: z.ZodObject<{
86
+ x: z.ZodNumber;
87
+ y: z.ZodNumber;
88
+ }, z.core.$strip>;
89
+ field: z.ZodString;
90
+ operator: z.ZodEnum<{
91
+ eq: "eq";
92
+ neq: "neq";
93
+ in: "in";
94
+ not_in: "not_in";
95
+ contains: "contains";
96
+ not_contains: "not_contains";
97
+ gt: "gt";
98
+ lt: "lt";
99
+ gte: "gte";
100
+ lte: "lte";
101
+ regex: "regex";
102
+ }>;
103
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
104
+ outputs: z.ZodObject<{
105
+ true: z.ZodNullable<z.ZodString>;
106
+ false: z.ZodNullable<z.ZodString>;
107
+ }, z.core.$strip>;
108
+ }, z.core.$strip>, z.ZodObject<{
109
+ id: z.ZodString;
110
+ type: z.ZodLiteral<"split">;
111
+ position: z.ZodObject<{
112
+ x: z.ZodNumber;
113
+ y: z.ZodNumber;
114
+ }, z.core.$strip>;
115
+ variants: z.ZodArray<z.ZodObject<{
116
+ weight: z.ZodNumber;
117
+ target: z.ZodNullable<z.ZodString>;
118
+ }, z.core.$strip>>;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ id: z.ZodString;
121
+ type: z.ZodLiteral<"destination">;
122
+ position: z.ZodObject<{
123
+ x: z.ZodNumber;
124
+ y: z.ZodNumber;
125
+ }, z.core.$strip>;
126
+ url: z.ZodString;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ id: z.ZodString;
129
+ type: z.ZodLiteral<"transform">;
130
+ position: z.ZodObject<{
131
+ x: z.ZodNumber;
132
+ y: z.ZodNumber;
133
+ }, z.core.$strip>;
134
+ transforms: z.ZodObject<{
135
+ query_params: z.ZodOptional<z.ZodArray<z.ZodObject<{
136
+ key: z.ZodString;
137
+ value: z.ZodString;
138
+ mode: z.ZodEnum<{
139
+ set: "set";
140
+ append: "append";
141
+ }>;
142
+ }, z.core.$strip>>>;
143
+ redirect_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
144
+ response_headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
145
+ key: z.ZodString;
146
+ value: z.ZodString;
147
+ mode: z.ZodEnum<{
148
+ set: "set";
149
+ append: "append";
150
+ }>;
151
+ }, z.core.$strip>>>;
152
+ }, z.core.$strip>;
153
+ next: z.ZodNullable<z.ZodString>;
154
+ }, z.core.$strip>], "type">>;
155
+ }, z.core.$strip>>>;
76
156
  tags: z.ZodArray<z.ZodObject<{
77
157
  id: z.ZodString;
78
158
  workspace_id: z.ZodString;
@@ -124,6 +204,86 @@ export declare const CreateLinkInputSchema: z.ZodObject<{
124
204
  frame_text_color: z.ZodString;
125
205
  }, z.core.$strip>>>;
126
206
  tag_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
207
+ link_type: z.ZodOptional<z.ZodEnum<{
208
+ redirect: "redirect";
209
+ rules: "rules";
210
+ }>>;
211
+ rule_graph: z.ZodOptional<z.ZodNullable<z.ZodObject<{
212
+ entry: z.ZodString;
213
+ nodes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
214
+ id: z.ZodString;
215
+ type: z.ZodLiteral<"condition">;
216
+ position: z.ZodObject<{
217
+ x: z.ZodNumber;
218
+ y: z.ZodNumber;
219
+ }, z.core.$strip>;
220
+ field: z.ZodString;
221
+ operator: z.ZodEnum<{
222
+ eq: "eq";
223
+ neq: "neq";
224
+ in: "in";
225
+ not_in: "not_in";
226
+ contains: "contains";
227
+ not_contains: "not_contains";
228
+ gt: "gt";
229
+ lt: "lt";
230
+ gte: "gte";
231
+ lte: "lte";
232
+ regex: "regex";
233
+ }>;
234
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
235
+ outputs: z.ZodObject<{
236
+ true: z.ZodNullable<z.ZodString>;
237
+ false: z.ZodNullable<z.ZodString>;
238
+ }, z.core.$strip>;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ id: z.ZodString;
241
+ type: z.ZodLiteral<"split">;
242
+ position: z.ZodObject<{
243
+ x: z.ZodNumber;
244
+ y: z.ZodNumber;
245
+ }, z.core.$strip>;
246
+ variants: z.ZodArray<z.ZodObject<{
247
+ weight: z.ZodNumber;
248
+ target: z.ZodNullable<z.ZodString>;
249
+ }, z.core.$strip>>;
250
+ }, z.core.$strip>, z.ZodObject<{
251
+ id: z.ZodString;
252
+ type: z.ZodLiteral<"destination">;
253
+ position: z.ZodObject<{
254
+ x: z.ZodNumber;
255
+ y: z.ZodNumber;
256
+ }, z.core.$strip>;
257
+ url: z.ZodString;
258
+ }, z.core.$strip>, z.ZodObject<{
259
+ id: z.ZodString;
260
+ type: z.ZodLiteral<"transform">;
261
+ position: z.ZodObject<{
262
+ x: z.ZodNumber;
263
+ y: z.ZodNumber;
264
+ }, z.core.$strip>;
265
+ transforms: z.ZodObject<{
266
+ query_params: z.ZodOptional<z.ZodArray<z.ZodObject<{
267
+ key: z.ZodString;
268
+ value: z.ZodString;
269
+ mode: z.ZodEnum<{
270
+ set: "set";
271
+ append: "append";
272
+ }>;
273
+ }, z.core.$strip>>>;
274
+ redirect_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
275
+ response_headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
276
+ key: z.ZodString;
277
+ value: z.ZodString;
278
+ mode: z.ZodEnum<{
279
+ set: "set";
280
+ append: "append";
281
+ }>;
282
+ }, z.core.$strip>>>;
283
+ }, z.core.$strip>;
284
+ next: z.ZodNullable<z.ZodString>;
285
+ }, z.core.$strip>], "type">>;
286
+ }, z.core.$strip>>>;
127
287
  }, z.core.$strip>;
128
288
  export declare const UpdateLinkInputSchema: z.ZodObject<{
129
289
  original_url: z.ZodOptional<z.ZodString>;
@@ -168,6 +328,86 @@ export declare const UpdateLinkInputSchema: z.ZodObject<{
168
328
  frame_text_color: z.ZodString;
169
329
  }, z.core.$strip>>>;
170
330
  tag_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
331
+ link_type: z.ZodOptional<z.ZodEnum<{
332
+ redirect: "redirect";
333
+ rules: "rules";
334
+ }>>;
335
+ rule_graph: z.ZodOptional<z.ZodNullable<z.ZodObject<{
336
+ entry: z.ZodString;
337
+ nodes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
338
+ id: z.ZodString;
339
+ type: z.ZodLiteral<"condition">;
340
+ position: z.ZodObject<{
341
+ x: z.ZodNumber;
342
+ y: z.ZodNumber;
343
+ }, z.core.$strip>;
344
+ field: z.ZodString;
345
+ operator: z.ZodEnum<{
346
+ eq: "eq";
347
+ neq: "neq";
348
+ in: "in";
349
+ not_in: "not_in";
350
+ contains: "contains";
351
+ not_contains: "not_contains";
352
+ gt: "gt";
353
+ lt: "lt";
354
+ gte: "gte";
355
+ lte: "lte";
356
+ regex: "regex";
357
+ }>;
358
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
359
+ outputs: z.ZodObject<{
360
+ true: z.ZodNullable<z.ZodString>;
361
+ false: z.ZodNullable<z.ZodString>;
362
+ }, z.core.$strip>;
363
+ }, z.core.$strip>, z.ZodObject<{
364
+ id: z.ZodString;
365
+ type: z.ZodLiteral<"split">;
366
+ position: z.ZodObject<{
367
+ x: z.ZodNumber;
368
+ y: z.ZodNumber;
369
+ }, z.core.$strip>;
370
+ variants: z.ZodArray<z.ZodObject<{
371
+ weight: z.ZodNumber;
372
+ target: z.ZodNullable<z.ZodString>;
373
+ }, z.core.$strip>>;
374
+ }, z.core.$strip>, z.ZodObject<{
375
+ id: z.ZodString;
376
+ type: z.ZodLiteral<"destination">;
377
+ position: z.ZodObject<{
378
+ x: z.ZodNumber;
379
+ y: z.ZodNumber;
380
+ }, z.core.$strip>;
381
+ url: z.ZodString;
382
+ }, z.core.$strip>, z.ZodObject<{
383
+ id: z.ZodString;
384
+ type: z.ZodLiteral<"transform">;
385
+ position: z.ZodObject<{
386
+ x: z.ZodNumber;
387
+ y: z.ZodNumber;
388
+ }, z.core.$strip>;
389
+ transforms: z.ZodObject<{
390
+ query_params: z.ZodOptional<z.ZodArray<z.ZodObject<{
391
+ key: z.ZodString;
392
+ value: z.ZodString;
393
+ mode: z.ZodEnum<{
394
+ set: "set";
395
+ append: "append";
396
+ }>;
397
+ }, z.core.$strip>>>;
398
+ redirect_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
399
+ response_headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
400
+ key: z.ZodString;
401
+ value: z.ZodString;
402
+ mode: z.ZodEnum<{
403
+ set: "set";
404
+ append: "append";
405
+ }>;
406
+ }, z.core.$strip>>>;
407
+ }, z.core.$strip>;
408
+ next: z.ZodNullable<z.ZodString>;
409
+ }, z.core.$strip>], "type">>;
410
+ }, z.core.$strip>>>;
171
411
  }, z.core.$strip>;
172
412
  export declare const LinkFiltersSchema: z.ZodObject<{
173
413
  search: z.ZodOptional<z.ZodString>;
@@ -252,6 +492,86 @@ export declare const PaginatedLinksSchema: z.ZodObject<{
252
492
  frame_color: z.ZodString;
253
493
  frame_text_color: z.ZodString;
254
494
  }, z.core.$strip>>;
495
+ link_type: z.ZodDefault<z.ZodEnum<{
496
+ redirect: "redirect";
497
+ rules: "rules";
498
+ }>>;
499
+ rule_graph: z.ZodOptional<z.ZodNullable<z.ZodObject<{
500
+ entry: z.ZodString;
501
+ nodes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
502
+ id: z.ZodString;
503
+ type: z.ZodLiteral<"condition">;
504
+ position: z.ZodObject<{
505
+ x: z.ZodNumber;
506
+ y: z.ZodNumber;
507
+ }, z.core.$strip>;
508
+ field: z.ZodString;
509
+ operator: z.ZodEnum<{
510
+ eq: "eq";
511
+ neq: "neq";
512
+ in: "in";
513
+ not_in: "not_in";
514
+ contains: "contains";
515
+ not_contains: "not_contains";
516
+ gt: "gt";
517
+ lt: "lt";
518
+ gte: "gte";
519
+ lte: "lte";
520
+ regex: "regex";
521
+ }>;
522
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
523
+ outputs: z.ZodObject<{
524
+ true: z.ZodNullable<z.ZodString>;
525
+ false: z.ZodNullable<z.ZodString>;
526
+ }, z.core.$strip>;
527
+ }, z.core.$strip>, z.ZodObject<{
528
+ id: z.ZodString;
529
+ type: z.ZodLiteral<"split">;
530
+ position: z.ZodObject<{
531
+ x: z.ZodNumber;
532
+ y: z.ZodNumber;
533
+ }, z.core.$strip>;
534
+ variants: z.ZodArray<z.ZodObject<{
535
+ weight: z.ZodNumber;
536
+ target: z.ZodNullable<z.ZodString>;
537
+ }, z.core.$strip>>;
538
+ }, z.core.$strip>, z.ZodObject<{
539
+ id: z.ZodString;
540
+ type: z.ZodLiteral<"destination">;
541
+ position: z.ZodObject<{
542
+ x: z.ZodNumber;
543
+ y: z.ZodNumber;
544
+ }, z.core.$strip>;
545
+ url: z.ZodString;
546
+ }, z.core.$strip>, z.ZodObject<{
547
+ id: z.ZodString;
548
+ type: z.ZodLiteral<"transform">;
549
+ position: z.ZodObject<{
550
+ x: z.ZodNumber;
551
+ y: z.ZodNumber;
552
+ }, z.core.$strip>;
553
+ transforms: z.ZodObject<{
554
+ query_params: z.ZodOptional<z.ZodArray<z.ZodObject<{
555
+ key: z.ZodString;
556
+ value: z.ZodString;
557
+ mode: z.ZodEnum<{
558
+ set: "set";
559
+ append: "append";
560
+ }>;
561
+ }, z.core.$strip>>>;
562
+ redirect_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
563
+ response_headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
564
+ key: z.ZodString;
565
+ value: z.ZodString;
566
+ mode: z.ZodEnum<{
567
+ set: "set";
568
+ append: "append";
569
+ }>;
570
+ }, z.core.$strip>>>;
571
+ }, z.core.$strip>;
572
+ next: z.ZodNullable<z.ZodString>;
573
+ }, z.core.$strip>], "type">>;
574
+ }, z.core.$strip>>>;
255
575
  tags: z.ZodArray<z.ZodObject<{
256
576
  id: z.ZodString;
257
577
  workspace_id: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"links.schema.d.ts","sourceRoot":"","sources":["../../src/links.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;iBAU/B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BrB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2BhC,CAAC;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM/B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBAYxB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC"}
1
+ {"version":3,"file":"links.schema.d.ts","sourceRoot":"","sources":["../../src/links.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;iBAU/B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BrB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiC5B,CAAC;AAEP,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkC5B,CAAC;AAMP,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe5B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAM/B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;iBAYxB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { z } from 'zod';
2
+ export declare const RuleGraphNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ id: z.ZodString;
4
+ type: z.ZodLiteral<"condition">;
5
+ position: z.ZodObject<{
6
+ x: z.ZodNumber;
7
+ y: z.ZodNumber;
8
+ }, z.core.$strip>;
9
+ field: z.ZodString;
10
+ operator: z.ZodEnum<{
11
+ eq: "eq";
12
+ neq: "neq";
13
+ in: "in";
14
+ not_in: "not_in";
15
+ contains: "contains";
16
+ not_contains: "not_contains";
17
+ gt: "gt";
18
+ lt: "lt";
19
+ gte: "gte";
20
+ lte: "lte";
21
+ regex: "regex";
22
+ }>;
23
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
24
+ outputs: z.ZodObject<{
25
+ true: z.ZodNullable<z.ZodString>;
26
+ false: z.ZodNullable<z.ZodString>;
27
+ }, z.core.$strip>;
28
+ }, z.core.$strip>, z.ZodObject<{
29
+ id: z.ZodString;
30
+ type: z.ZodLiteral<"split">;
31
+ position: z.ZodObject<{
32
+ x: z.ZodNumber;
33
+ y: z.ZodNumber;
34
+ }, z.core.$strip>;
35
+ variants: z.ZodArray<z.ZodObject<{
36
+ weight: z.ZodNumber;
37
+ target: z.ZodNullable<z.ZodString>;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ id: z.ZodString;
41
+ type: z.ZodLiteral<"destination">;
42
+ position: z.ZodObject<{
43
+ x: z.ZodNumber;
44
+ y: z.ZodNumber;
45
+ }, z.core.$strip>;
46
+ url: z.ZodString;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ id: z.ZodString;
49
+ type: z.ZodLiteral<"transform">;
50
+ position: z.ZodObject<{
51
+ x: z.ZodNumber;
52
+ y: z.ZodNumber;
53
+ }, z.core.$strip>;
54
+ transforms: z.ZodObject<{
55
+ query_params: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ key: z.ZodString;
57
+ value: z.ZodString;
58
+ mode: z.ZodEnum<{
59
+ set: "set";
60
+ append: "append";
61
+ }>;
62
+ }, z.core.$strip>>>;
63
+ redirect_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
64
+ response_headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
+ key: z.ZodString;
66
+ value: z.ZodString;
67
+ mode: z.ZodEnum<{
68
+ set: "set";
69
+ append: "append";
70
+ }>;
71
+ }, z.core.$strip>>>;
72
+ }, z.core.$strip>;
73
+ next: z.ZodNullable<z.ZodString>;
74
+ }, z.core.$strip>], "type">;
75
+ export declare const RuleGraphSchema: z.ZodNullable<z.ZodObject<{
76
+ entry: z.ZodString;
77
+ nodes: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ id: z.ZodString;
79
+ type: z.ZodLiteral<"condition">;
80
+ position: z.ZodObject<{
81
+ x: z.ZodNumber;
82
+ y: z.ZodNumber;
83
+ }, z.core.$strip>;
84
+ field: z.ZodString;
85
+ operator: z.ZodEnum<{
86
+ eq: "eq";
87
+ neq: "neq";
88
+ in: "in";
89
+ not_in: "not_in";
90
+ contains: "contains";
91
+ not_contains: "not_contains";
92
+ gt: "gt";
93
+ lt: "lt";
94
+ gte: "gte";
95
+ lte: "lte";
96
+ regex: "regex";
97
+ }>;
98
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodNumber]>;
99
+ outputs: z.ZodObject<{
100
+ true: z.ZodNullable<z.ZodString>;
101
+ false: z.ZodNullable<z.ZodString>;
102
+ }, z.core.$strip>;
103
+ }, z.core.$strip>, z.ZodObject<{
104
+ id: z.ZodString;
105
+ type: z.ZodLiteral<"split">;
106
+ position: z.ZodObject<{
107
+ x: z.ZodNumber;
108
+ y: z.ZodNumber;
109
+ }, z.core.$strip>;
110
+ variants: z.ZodArray<z.ZodObject<{
111
+ weight: z.ZodNumber;
112
+ target: z.ZodNullable<z.ZodString>;
113
+ }, z.core.$strip>>;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ id: z.ZodString;
116
+ type: z.ZodLiteral<"destination">;
117
+ position: z.ZodObject<{
118
+ x: z.ZodNumber;
119
+ y: z.ZodNumber;
120
+ }, z.core.$strip>;
121
+ url: z.ZodString;
122
+ }, z.core.$strip>, z.ZodObject<{
123
+ id: z.ZodString;
124
+ type: z.ZodLiteral<"transform">;
125
+ position: z.ZodObject<{
126
+ x: z.ZodNumber;
127
+ y: z.ZodNumber;
128
+ }, z.core.$strip>;
129
+ transforms: z.ZodObject<{
130
+ query_params: z.ZodOptional<z.ZodArray<z.ZodObject<{
131
+ key: z.ZodString;
132
+ value: z.ZodString;
133
+ mode: z.ZodEnum<{
134
+ set: "set";
135
+ append: "append";
136
+ }>;
137
+ }, z.core.$strip>>>;
138
+ redirect_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
139
+ response_headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
140
+ key: z.ZodString;
141
+ value: z.ZodString;
142
+ mode: z.ZodEnum<{
143
+ set: "set";
144
+ append: "append";
145
+ }>;
146
+ }, z.core.$strip>>>;
147
+ }, z.core.$strip>;
148
+ next: z.ZodNullable<z.ZodString>;
149
+ }, z.core.$strip>], "type">>;
150
+ }, z.core.$strip>>;
151
+ //# sourceMappingURL=rules.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.schema.d.ts","sourceRoot":"","sources":["../../src/rules.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiFxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAK9B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBASb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middlewr/contracts",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
package/src/index.ts CHANGED
@@ -46,6 +46,7 @@ export * from './billing.schema';
46
46
  export * from './common.schema';
47
47
  export * from './domains.schema';
48
48
  export * from './links.schema';
49
+ export * from './rules.schema';
49
50
  export * from './tags.schema';
50
51
  // Re-export all schemas
51
52
  export * from './users.schema';
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ import { RuleGraphSchema } from './rules.schema';
3
4
  import { TagSchema } from './tags.schema';
4
5
 
5
6
  const DotStyleSchema = z.enum(['square', 'dots', 'rounded', 'classy', 'classy-rounded', 'extra-rounded']);
@@ -43,65 +44,81 @@ export const LinkSchema = z.object({
43
44
  created_at: z.coerce.date(),
44
45
  updated_at: z.coerce.date().nullable(),
45
46
  qr_code_settings: QrCodeSettingsSchema.nullable(),
47
+ link_type: z.enum(['redirect', 'rules']).default('redirect'),
48
+ rule_graph: RuleGraphSchema.optional(),
46
49
  tags: z.array(TagSchema),
47
50
  });
48
51
 
49
- export const CreateLinkInputSchema = z.object({
50
- original_url: z.string().url().max(2048),
51
- domain_id: z.string().uuid().optional(),
52
- short_code: z
53
- .string()
54
- .min(3)
55
- .max(50)
56
- .regex(/^[a-zA-Z0-9-]+$/)
57
- .optional(),
58
- title: z.string().max(255).optional(),
59
- description: z.string().max(2000).optional(),
60
- utm_source: z.string().max(255).optional(),
61
- utm_medium: z.string().max(255).optional(),
62
- utm_campaign: z.string().max(255).optional(),
63
- utm_term: z.string().max(255).optional(),
64
- utm_content: z.string().max(255).optional(),
65
- password: z.string().min(4).max(100).optional(),
66
- starts_at: z.coerce.date().optional(),
67
- expires_at: z.coerce.date().optional(),
68
- fallback_url: z.string().url().max(2048).optional(),
69
- redirect_type: z.coerce
70
- .number()
71
- .refine((v) => [301, 302, 307, 308].includes(v))
72
- .optional(),
73
- qr_code_settings: QrCodeSettingsSchema.nullable().optional(),
74
- tag_ids: z.array(z.string().uuid()).optional(),
75
- });
52
+ export const CreateLinkInputSchema = z
53
+ .object({
54
+ original_url: z.string().url().max(2048),
55
+ domain_id: z.string().uuid().optional(),
56
+ short_code: z
57
+ .string()
58
+ .min(3)
59
+ .max(50)
60
+ .regex(/^[a-zA-Z0-9-]+$/)
61
+ .optional(),
62
+ title: z.string().max(255).optional(),
63
+ description: z.string().max(2000).optional(),
64
+ utm_source: z.string().max(255).optional(),
65
+ utm_medium: z.string().max(255).optional(),
66
+ utm_campaign: z.string().max(255).optional(),
67
+ utm_term: z.string().max(255).optional(),
68
+ utm_content: z.string().max(255).optional(),
69
+ password: z.string().min(4).max(100).optional(),
70
+ starts_at: z.coerce.date().optional(),
71
+ expires_at: z.coerce.date().optional(),
72
+ fallback_url: z.string().url().max(2048).optional(),
73
+ redirect_type: z.coerce
74
+ .number()
75
+ .refine((v) => [301, 302, 307, 308].includes(v))
76
+ .optional(),
77
+ qr_code_settings: QrCodeSettingsSchema.nullable().optional(),
78
+ tag_ids: z.array(z.string().uuid()).optional(),
79
+ link_type: z.enum(['redirect', 'rules']).optional(),
80
+ rule_graph: RuleGraphSchema.optional(),
81
+ })
82
+ .refine((data) => data.link_type !== 'rules' || data.rule_graph != null, {
83
+ message: 'rule_graph is required when link_type is "rules"',
84
+ path: ['rule_graph'],
85
+ });
76
86
 
77
- export const UpdateLinkInputSchema = z.object({
78
- original_url: z.string().url().max(2048).optional(),
79
- domain_id: z.string().uuid().optional(),
80
- short_code: z
81
- .string()
82
- .min(3)
83
- .max(50)
84
- .regex(/^[a-zA-Z0-9-]+$/)
85
- .optional(),
86
- title: z.string().max(255).nullable().optional(),
87
- description: z.string().max(2000).nullable().optional(),
88
- utm_source: z.string().max(255).nullable().optional(),
89
- utm_medium: z.string().max(255).nullable().optional(),
90
- utm_campaign: z.string().max(255).nullable().optional(),
91
- utm_term: z.string().max(255).nullable().optional(),
92
- utm_content: z.string().max(255).nullable().optional(),
93
- password: z.string().min(4).max(100).nullable().optional(),
94
- starts_at: z.coerce.date().nullable().optional(),
95
- expires_at: z.coerce.date().nullable().optional(),
96
- fallback_url: z.string().url().max(2048).nullable().optional(),
97
- is_active: z.boolean().optional(),
98
- redirect_type: z.coerce
99
- .number()
100
- .refine((v) => [301, 302, 307, 308].includes(v))
101
- .optional(),
102
- qr_code_settings: QrCodeSettingsSchema.nullable().optional(),
103
- tag_ids: z.array(z.string().uuid()).optional(),
104
- });
87
+ export const UpdateLinkInputSchema = z
88
+ .object({
89
+ original_url: z.string().url().max(2048).optional(),
90
+ domain_id: z.string().uuid().optional(),
91
+ short_code: z
92
+ .string()
93
+ .min(3)
94
+ .max(50)
95
+ .regex(/^[a-zA-Z0-9-]+$/)
96
+ .optional(),
97
+ title: z.string().max(255).nullable().optional(),
98
+ description: z.string().max(2000).nullable().optional(),
99
+ utm_source: z.string().max(255).nullable().optional(),
100
+ utm_medium: z.string().max(255).nullable().optional(),
101
+ utm_campaign: z.string().max(255).nullable().optional(),
102
+ utm_term: z.string().max(255).nullable().optional(),
103
+ utm_content: z.string().max(255).nullable().optional(),
104
+ password: z.string().min(4).max(100).nullable().optional(),
105
+ starts_at: z.coerce.date().nullable().optional(),
106
+ expires_at: z.coerce.date().nullable().optional(),
107
+ fallback_url: z.string().url().max(2048).nullable().optional(),
108
+ is_active: z.boolean().optional(),
109
+ redirect_type: z.coerce
110
+ .number()
111
+ .refine((v) => [301, 302, 307, 308].includes(v))
112
+ .optional(),
113
+ qr_code_settings: QrCodeSettingsSchema.nullable().optional(),
114
+ tag_ids: z.array(z.string().uuid()).optional(),
115
+ link_type: z.enum(['redirect', 'rules']).optional(),
116
+ rule_graph: RuleGraphSchema.optional(),
117
+ })
118
+ .refine((data) => data.link_type !== 'rules' || data.rule_graph != null, {
119
+ message: 'rule_graph is required when link_type is "rules"',
120
+ path: ['rule_graph'],
121
+ });
105
122
 
106
123
  const stringToBoolean = z
107
124
  .union([z.boolean(), z.enum(['true', 'false'])])