@webstir-io/module-contract 0.1.15 → 0.1.16
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/README.md +149 -3
- package/dist/adapters/ts-rest.d.ts +2 -2
- package/dist/adapters/ts-rest.js +13 -11
- package/dist/index.d.ts +3108 -180
- package/dist/index.js +140 -18
- package/package.json +5 -5
- package/schema/module-manifest.schema.json +261 -18
- package/schema/route-definition.schema.json +230 -16
- package/schema/route-output.schema.json +133 -30
|
@@ -36,6 +36,139 @@
|
|
|
36
36
|
"type": "string"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
+
"interaction": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": [
|
|
42
|
+
"navigation",
|
|
43
|
+
"mutation"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"requestHooks": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {
|
|
51
|
+
"id": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"required": [
|
|
57
|
+
"id"
|
|
58
|
+
],
|
|
59
|
+
"additionalProperties": false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"session": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"mode": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"enum": [
|
|
68
|
+
"optional",
|
|
69
|
+
"required"
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"write": {
|
|
73
|
+
"type": "boolean"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"additionalProperties": false
|
|
77
|
+
},
|
|
78
|
+
"flash": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"properties": {
|
|
81
|
+
"consume": {
|
|
82
|
+
"type": "array",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"minLength": 1
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"publish": {
|
|
89
|
+
"type": "array",
|
|
90
|
+
"items": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"properties": {
|
|
93
|
+
"key": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"minLength": 1
|
|
96
|
+
},
|
|
97
|
+
"level": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"enum": [
|
|
100
|
+
"info",
|
|
101
|
+
"success",
|
|
102
|
+
"warning",
|
|
103
|
+
"error"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"when": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"enum": [
|
|
109
|
+
"always",
|
|
110
|
+
"success",
|
|
111
|
+
"error"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"required": [
|
|
116
|
+
"key"
|
|
117
|
+
],
|
|
118
|
+
"additionalProperties": false
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"additionalProperties": false
|
|
123
|
+
},
|
|
124
|
+
"form": {
|
|
125
|
+
"type": "object",
|
|
126
|
+
"properties": {
|
|
127
|
+
"contentType": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"enum": [
|
|
130
|
+
"application/x-www-form-urlencoded",
|
|
131
|
+
"multipart/form-data",
|
|
132
|
+
"text/plain"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"csrf": {
|
|
136
|
+
"type": "boolean"
|
|
137
|
+
},
|
|
138
|
+
"session": {
|
|
139
|
+
"$ref": "#/definitions/route-definition/properties/session"
|
|
140
|
+
},
|
|
141
|
+
"flash": {
|
|
142
|
+
"$ref": "#/definitions/route-definition/properties/flash"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"additionalProperties": false
|
|
146
|
+
},
|
|
147
|
+
"fragment": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"target": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"minLength": 1
|
|
153
|
+
},
|
|
154
|
+
"selector": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"minLength": 1
|
|
157
|
+
},
|
|
158
|
+
"mode": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"enum": [
|
|
161
|
+
"replace",
|
|
162
|
+
"append",
|
|
163
|
+
"prepend"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"required": [
|
|
168
|
+
"target"
|
|
169
|
+
],
|
|
170
|
+
"additionalProperties": false
|
|
171
|
+
},
|
|
39
172
|
"input": {
|
|
40
173
|
"type": "object",
|
|
41
174
|
"properties": {
|
|
@@ -76,24 +209,105 @@
|
|
|
76
209
|
"additionalProperties": false
|
|
77
210
|
},
|
|
78
211
|
"output": {
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
212
|
+
"anyOf": [
|
|
213
|
+
{
|
|
214
|
+
"anyOf": [
|
|
215
|
+
{
|
|
216
|
+
"type": "object",
|
|
217
|
+
"properties": {
|
|
218
|
+
"status": {
|
|
219
|
+
"type": "integer",
|
|
220
|
+
"minimum": 100,
|
|
221
|
+
"maximum": 599
|
|
222
|
+
},
|
|
223
|
+
"headers": {
|
|
224
|
+
"$ref": "#/definitions/route-definition/properties/input/properties/params"
|
|
225
|
+
},
|
|
226
|
+
"body": {
|
|
227
|
+
"$ref": "#/definitions/route-definition/properties/input/properties/params"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"required": [
|
|
231
|
+
"body"
|
|
232
|
+
],
|
|
233
|
+
"additionalProperties": false
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"type": "object",
|
|
237
|
+
"properties": {
|
|
238
|
+
"status": {
|
|
239
|
+
"$ref": "#/definitions/route-definition/properties/output/anyOf/0/anyOf/0/properties/status"
|
|
240
|
+
},
|
|
241
|
+
"headers": {
|
|
242
|
+
"$ref": "#/definitions/route-definition/properties/output/anyOf/0/anyOf/0/properties/headers"
|
|
243
|
+
},
|
|
244
|
+
"redirect": {
|
|
245
|
+
"type": "object",
|
|
246
|
+
"properties": {
|
|
247
|
+
"status": {
|
|
248
|
+
"type": "number",
|
|
249
|
+
"enum": [
|
|
250
|
+
301,
|
|
251
|
+
302,
|
|
252
|
+
303,
|
|
253
|
+
307,
|
|
254
|
+
308
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
"location": {
|
|
258
|
+
"type": "string",
|
|
259
|
+
"minLength": 1
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"additionalProperties": false
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"required": [
|
|
266
|
+
"redirect"
|
|
267
|
+
],
|
|
268
|
+
"additionalProperties": false
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"type": "object",
|
|
272
|
+
"properties": {
|
|
273
|
+
"status": {
|
|
274
|
+
"$ref": "#/definitions/route-definition/properties/output/anyOf/0/anyOf/0/properties/status"
|
|
275
|
+
},
|
|
276
|
+
"headers": {
|
|
277
|
+
"$ref": "#/definitions/route-definition/properties/output/anyOf/0/anyOf/0/properties/headers"
|
|
278
|
+
},
|
|
279
|
+
"body": {
|
|
280
|
+
"$ref": "#/definitions/route-definition/properties/input/properties/params"
|
|
281
|
+
},
|
|
282
|
+
"fragment": {
|
|
283
|
+
"$ref": "#/definitions/route-definition/properties/fragment"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"required": [
|
|
287
|
+
"body",
|
|
288
|
+
"fragment"
|
|
289
|
+
],
|
|
290
|
+
"additionalProperties": false
|
|
291
|
+
}
|
|
292
|
+
]
|
|
88
293
|
},
|
|
89
|
-
|
|
90
|
-
"
|
|
294
|
+
{
|
|
295
|
+
"type": "object",
|
|
296
|
+
"properties": {
|
|
297
|
+
"responses": {
|
|
298
|
+
"type": "array",
|
|
299
|
+
"items": {
|
|
300
|
+
"$ref": "#/definitions/route-definition/properties/output/anyOf/0"
|
|
301
|
+
},
|
|
302
|
+
"minItems": 1
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"required": [
|
|
306
|
+
"responses"
|
|
307
|
+
],
|
|
308
|
+
"additionalProperties": false
|
|
91
309
|
}
|
|
92
|
-
|
|
93
|
-
"required": [
|
|
94
|
-
"body"
|
|
95
|
-
],
|
|
96
|
-
"additionalProperties": false
|
|
310
|
+
]
|
|
97
311
|
},
|
|
98
312
|
"errors": {
|
|
99
313
|
"type": "array",
|
|
@@ -2,45 +2,148 @@
|
|
|
2
2
|
"$ref": "#/definitions/route-output",
|
|
3
3
|
"definitions": {
|
|
4
4
|
"route-output": {
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
"anyOf": [
|
|
6
|
+
{
|
|
7
|
+
"anyOf": [
|
|
8
|
+
{
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"status": {
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"minimum": 100,
|
|
14
|
+
"maximum": 599
|
|
15
|
+
},
|
|
16
|
+
"headers": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"properties": {
|
|
19
|
+
"kind": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": [
|
|
22
|
+
"zod",
|
|
23
|
+
"json-schema",
|
|
24
|
+
"ts-rest"
|
|
25
|
+
],
|
|
26
|
+
"default": "zod"
|
|
27
|
+
},
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"source": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": [
|
|
36
|
+
"name"
|
|
37
|
+
],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
},
|
|
40
|
+
"body": {
|
|
41
|
+
"$ref": "#/definitions/route-output/anyOf/0/anyOf/0/properties/headers"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"body"
|
|
16
46
|
],
|
|
17
|
-
"
|
|
47
|
+
"additionalProperties": false
|
|
18
48
|
},
|
|
19
|
-
|
|
20
|
-
"type": "
|
|
49
|
+
{
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"status": {
|
|
53
|
+
"$ref": "#/definitions/route-output/anyOf/0/anyOf/0/properties/status"
|
|
54
|
+
},
|
|
55
|
+
"headers": {
|
|
56
|
+
"$ref": "#/definitions/route-output/anyOf/0/anyOf/0/properties/headers"
|
|
57
|
+
},
|
|
58
|
+
"redirect": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"status": {
|
|
62
|
+
"type": "number",
|
|
63
|
+
"enum": [
|
|
64
|
+
301,
|
|
65
|
+
302,
|
|
66
|
+
303,
|
|
67
|
+
307,
|
|
68
|
+
308
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"location": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"minLength": 1
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"additionalProperties": false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"required": [
|
|
80
|
+
"redirect"
|
|
81
|
+
],
|
|
82
|
+
"additionalProperties": false
|
|
21
83
|
},
|
|
22
|
-
|
|
23
|
-
"type": "
|
|
84
|
+
{
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"status": {
|
|
88
|
+
"$ref": "#/definitions/route-output/anyOf/0/anyOf/0/properties/status"
|
|
89
|
+
},
|
|
90
|
+
"headers": {
|
|
91
|
+
"$ref": "#/definitions/route-output/anyOf/0/anyOf/0/properties/headers"
|
|
92
|
+
},
|
|
93
|
+
"body": {
|
|
94
|
+
"$ref": "#/definitions/route-output/anyOf/0/anyOf/0/properties/headers"
|
|
95
|
+
},
|
|
96
|
+
"fragment": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"properties": {
|
|
99
|
+
"target": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
},
|
|
103
|
+
"selector": {
|
|
104
|
+
"type": "string",
|
|
105
|
+
"minLength": 1
|
|
106
|
+
},
|
|
107
|
+
"mode": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"enum": [
|
|
110
|
+
"replace",
|
|
111
|
+
"append",
|
|
112
|
+
"prepend"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"required": [
|
|
117
|
+
"target"
|
|
118
|
+
],
|
|
119
|
+
"additionalProperties": false
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": [
|
|
123
|
+
"body",
|
|
124
|
+
"fragment"
|
|
125
|
+
],
|
|
126
|
+
"additionalProperties": false
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"type": "object",
|
|
132
|
+
"properties": {
|
|
133
|
+
"responses": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": {
|
|
136
|
+
"$ref": "#/definitions/route-output/anyOf/0"
|
|
137
|
+
},
|
|
138
|
+
"minItems": 1
|
|
24
139
|
}
|
|
25
140
|
},
|
|
26
141
|
"required": [
|
|
27
|
-
"
|
|
142
|
+
"responses"
|
|
28
143
|
],
|
|
29
144
|
"additionalProperties": false
|
|
30
|
-
},
|
|
31
|
-
"status": {
|
|
32
|
-
"type": "integer",
|
|
33
|
-
"minimum": 100,
|
|
34
|
-
"maximum": 599
|
|
35
|
-
},
|
|
36
|
-
"headers": {
|
|
37
|
-
"$ref": "#/definitions/route-output/properties/body"
|
|
38
145
|
}
|
|
39
|
-
|
|
40
|
-
"required": [
|
|
41
|
-
"body"
|
|
42
|
-
],
|
|
43
|
-
"additionalProperties": false
|
|
146
|
+
]
|
|
44
147
|
}
|
|
45
148
|
},
|
|
46
149
|
"$schema": "http://json-schema.org/draft-07/schema#"
|