@middlewr/contracts 0.0.28 → 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.
- package/dist/cjs/index.d.ts +324 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +32 -1
- package/dist/cjs/links.schema.d.ts +108 -0
- package/dist/cjs/links.schema.d.ts.map +1 -1
- package/dist/cjs/rules.schema.d.ts +54 -0
- package/dist/cjs/rules.schema.d.ts.map +1 -1
- package/dist/esm/index.d.ts +324 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +32 -1
- package/dist/esm/links.schema.d.ts +108 -0
- package/dist/esm/links.schema.d.ts.map +1 -1
- package/dist/esm/rules.schema.d.ts +54 -0
- package/dist/esm/rules.schema.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/rules.schema.ts +41 -1
|
@@ -44,6 +44,33 @@ export declare const RuleGraphNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
44
44
|
y: z.ZodNumber;
|
|
45
45
|
}, z.core.$strip>;
|
|
46
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>;
|
|
47
74
|
}, z.core.$strip>], "type">;
|
|
48
75
|
export declare const RuleGraphSchema: z.ZodNullable<z.ZodObject<{
|
|
49
76
|
entry: z.ZodString;
|
|
@@ -92,6 +119,33 @@ export declare const RuleGraphSchema: z.ZodNullable<z.ZodObject<{
|
|
|
92
119
|
y: z.ZodNumber;
|
|
93
120
|
}, z.core.$strip>;
|
|
94
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>;
|
|
95
149
|
}, z.core.$strip>], "type">>;
|
|
96
150
|
}, z.core.$strip>>;
|
|
97
151
|
//# sourceMappingURL=rules.schema.d.ts.map
|
|
@@ -1 +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;
|
|
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
package/src/rules.schema.ts
CHANGED
|
@@ -44,7 +44,47 @@ const DestinationNodeSchema = z.object({
|
|
|
44
44
|
url: z.string().url(),
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const FORBIDDEN_HEADERS = ['set-cookie', 'authorization', 'host', 'transfer-encoding'];
|
|
48
|
+
|
|
49
|
+
const TransformNodeSchema = z.object({
|
|
50
|
+
id: z.string(),
|
|
51
|
+
type: z.literal('transform'),
|
|
52
|
+
position: PositionSchema,
|
|
53
|
+
transforms: z.object({
|
|
54
|
+
query_params: z
|
|
55
|
+
.array(
|
|
56
|
+
z.object({
|
|
57
|
+
key: z.string().min(1),
|
|
58
|
+
value: z.string(),
|
|
59
|
+
mode: z.enum(['set', 'append']),
|
|
60
|
+
}),
|
|
61
|
+
)
|
|
62
|
+
.optional(),
|
|
63
|
+
redirect_status: z.union([z.literal(301), z.literal(302), z.literal(307), z.literal(308)]).optional(),
|
|
64
|
+
response_headers: z
|
|
65
|
+
.array(
|
|
66
|
+
z.object({
|
|
67
|
+
key: z
|
|
68
|
+
.string()
|
|
69
|
+
.min(1)
|
|
70
|
+
.refine((k) => !FORBIDDEN_HEADERS.includes(k.toLowerCase()), {
|
|
71
|
+
message: 'This header is not allowed',
|
|
72
|
+
}),
|
|
73
|
+
value: z.string().regex(/^[^\r\n]*$/, 'Header value must not contain newlines'),
|
|
74
|
+
mode: z.enum(['set', 'append']),
|
|
75
|
+
}),
|
|
76
|
+
)
|
|
77
|
+
.optional(),
|
|
78
|
+
}),
|
|
79
|
+
next: z.string().nullable(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const RuleGraphNodeSchema = z.discriminatedUnion('type', [
|
|
83
|
+
ConditionNodeSchema,
|
|
84
|
+
SplitNodeSchema,
|
|
85
|
+
DestinationNodeSchema,
|
|
86
|
+
TransformNodeSchema,
|
|
87
|
+
]);
|
|
48
88
|
|
|
49
89
|
export const RuleGraphSchema = z
|
|
50
90
|
.object({
|