@furystack/rest-service 9.0.3 → 9.0.5
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/CHANGELOG.md +5 -94
- package/README.md +53 -57
- package/esm/actions/is-authenticated.spec.js.map +1 -1
- package/esm/authorize.d.ts.map +1 -1
- package/esm/authorize.js +3 -4
- package/esm/authorize.js.map +1 -1
- package/esm/authorize.spec.js +3 -7
- package/esm/authorize.spec.js.map +1 -1
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.js +5 -5
- package/esm/endpoint-generators/create-get-collection-endpoint.spec.js.map +1 -1
- package/esm/helpers.spec.js +5 -2
- package/esm/helpers.spec.js.map +1 -1
- package/esm/http-user-context.d.ts +8 -4
- package/esm/http-user-context.d.ts.map +1 -1
- package/esm/http-user-context.js +1 -1
- package/esm/http-user-context.js.map +1 -1
- package/esm/validate.integration.spec.js +1 -1
- package/esm/validate.integration.spec.js.map +1 -1
- package/esm/validate.integration.spec.schema.json +46 -175
- package/package.json +10 -10
- package/src/actions/is-authenticated.spec.ts +1 -1
- package/src/authorize.spec.ts +3 -7
- package/src/authorize.ts +4 -5
- package/src/endpoint-generators/create-get-collection-endpoint.spec.ts +5 -5
- package/src/helpers.spec.ts +7 -2
- package/src/http-user-context.ts +10 -4
- package/src/validate.integration.spec.schema.json +47 -176
- package/src/validate.integration.spec.ts +1 -1
|
@@ -43,7 +43,7 @@ describe('createGetCollectionEndpoint', () => {
|
|
|
43
43
|
|
|
44
44
|
const response = await fetch(`http://127.0.0.1:${port}/api/entities`, { method: 'GET' })
|
|
45
45
|
expect(response.ok).toBe(true)
|
|
46
|
-
const json
|
|
46
|
+
const json = (await response.json()) as GetCollectionResult<MockClass>
|
|
47
47
|
expect(response.status).toBe(200)
|
|
48
48
|
expect(json.count).toBe(count)
|
|
49
49
|
expect(json.entries).toEqual(allEntities)
|
|
@@ -72,7 +72,7 @@ describe('createGetCollectionEndpoint', () => {
|
|
|
72
72
|
method: 'GET',
|
|
73
73
|
})
|
|
74
74
|
expect(response.ok).toBe(true)
|
|
75
|
-
const json
|
|
75
|
+
const json = (await response.json()) as GetCollectionResult<MockClass>
|
|
76
76
|
expect(response.status).toBe(200)
|
|
77
77
|
expect(json.count).toBe(count)
|
|
78
78
|
expect(json.entries).toEqual(orderedEntities)
|
|
@@ -107,7 +107,7 @@ describe('createGetCollectionEndpoint', () => {
|
|
|
107
107
|
method: 'GET',
|
|
108
108
|
})
|
|
109
109
|
expect(response.ok).toBe(true)
|
|
110
|
-
const json
|
|
110
|
+
const json = (await response.json()) as GetCollectionResult<MockClass>
|
|
111
111
|
expect(response.status).toBe(200)
|
|
112
112
|
expect(json.count).toBe(count)
|
|
113
113
|
expect(json.entries).toEqual(filteredEntities)
|
|
@@ -143,7 +143,7 @@ describe('createGetCollectionEndpoint', () => {
|
|
|
143
143
|
})
|
|
144
144
|
|
|
145
145
|
expect(response.ok).toBe(true)
|
|
146
|
-
const json
|
|
146
|
+
const json = (await response.json()) as GetCollectionResult<MockClass>
|
|
147
147
|
expect(response.status).toBe(200)
|
|
148
148
|
expect(json.count).toBe(count)
|
|
149
149
|
expect(json.entries).toEqual(selectedEntities)
|
|
@@ -180,7 +180,7 @@ describe('createGetCollectionEndpoint', () => {
|
|
|
180
180
|
method: 'GET',
|
|
181
181
|
})
|
|
182
182
|
expect(response.status).toBe(200)
|
|
183
|
-
const json
|
|
183
|
+
const json = (await response.json()) as GetCollectionResult<MockClass>
|
|
184
184
|
expect(json.count).toBe(count)
|
|
185
185
|
expect(json.entries).toEqual(topSkipEntities)
|
|
186
186
|
})
|
package/src/helpers.spec.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { HttpAuthenticationSettings } from './http-authentication-settings.js'
|
|
|
5
5
|
import { useHttpAuthentication, useRestService, useStaticFiles } from './helpers.js'
|
|
6
6
|
import { StaticServerManager } from './static-server-manager.js'
|
|
7
7
|
import { describe, it, expect } from 'vitest'
|
|
8
|
+
import { getPort } from '@furystack/core/port-generator'
|
|
8
9
|
|
|
9
10
|
describe('Injector extensions', () => {
|
|
10
11
|
describe('useHttpAuthentication', () => {
|
|
@@ -19,7 +20,9 @@ describe('Injector extensions', () => {
|
|
|
19
20
|
describe('useRestService()', () => {
|
|
20
21
|
it('Should set up a REST service', async () => {
|
|
21
22
|
await usingAsync(new Injector(), async (i) => {
|
|
22
|
-
|
|
23
|
+
const port = getPort()
|
|
24
|
+
|
|
25
|
+
await useRestService({ injector: i, api: {}, root: '/', port })
|
|
23
26
|
expect(i.cachedSingletons.get(ApiManager)).toBeDefined()
|
|
24
27
|
})
|
|
25
28
|
})
|
|
@@ -28,7 +31,9 @@ describe('Injector extensions', () => {
|
|
|
28
31
|
describe('useRestService()', () => {
|
|
29
32
|
it('Should set up a REST service', async () => {
|
|
30
33
|
await usingAsync(new Injector(), async (i) => {
|
|
31
|
-
|
|
34
|
+
const port = getPort()
|
|
35
|
+
|
|
36
|
+
await useStaticFiles({ injector: i, baseUrl: '/', path: '.', port })
|
|
32
37
|
expect(i.cachedSingletons.get(StaticServerManager)).toBeDefined()
|
|
33
38
|
})
|
|
34
39
|
})
|
package/src/http-user-context.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IncomingMessage
|
|
1
|
+
import type { IncomingMessage } from 'http'
|
|
2
2
|
import type { User } from '@furystack/core'
|
|
3
3
|
import { StoreManager } from '@furystack/core'
|
|
4
4
|
import { Injectable, Injected } from '@furystack/inject'
|
|
@@ -139,7 +139,10 @@ export class HttpUserContext {
|
|
|
139
139
|
* @param serverResponse A serverResponse to set the cookie
|
|
140
140
|
* @returns the current User
|
|
141
141
|
*/
|
|
142
|
-
public async cookieLogin(
|
|
142
|
+
public async cookieLogin(
|
|
143
|
+
user: User,
|
|
144
|
+
serverResponse: { setHeader: (header: string, value: string) => void },
|
|
145
|
+
): Promise<User> {
|
|
143
146
|
const sessionId = randomBytes(32).toString('hex')
|
|
144
147
|
await this.getSessionStore().add({ sessionId, username: user.username })
|
|
145
148
|
serverResponse.setHeader('Set-Cookie', `${this.authentication.cookieName}=${sessionId}; Path=/; HttpOnly`)
|
|
@@ -147,7 +150,10 @@ export class HttpUserContext {
|
|
|
147
150
|
return user
|
|
148
151
|
}
|
|
149
152
|
|
|
150
|
-
public async cookieLogout(
|
|
153
|
+
public async cookieLogout(
|
|
154
|
+
request: Pick<IncomingMessage, 'headers'>,
|
|
155
|
+
response: { setHeader: (header: string, value: string) => void },
|
|
156
|
+
) {
|
|
151
157
|
this.user = undefined
|
|
152
158
|
const sessionId = this.getSessionIdFromRequest(request)
|
|
153
159
|
response.setHeader('Set-Cookie', `${this.authentication.cookieName}=; Path=/; HttpOnly`)
|
|
@@ -168,7 +174,7 @@ export class HttpUserContext {
|
|
|
168
174
|
@Injected(PasswordAuthenticator)
|
|
169
175
|
private declare readonly authenticator: PasswordAuthenticator
|
|
170
176
|
|
|
171
|
-
public
|
|
177
|
+
public init() {
|
|
172
178
|
this.getUserStore().addListener('onEntityUpdated', ({ id, change }) => {
|
|
173
179
|
if (this.user?.username === id) {
|
|
174
180
|
this.user = { ...this.user, ...change }
|
|
@@ -16,16 +16,11 @@
|
|
|
16
16
|
"type": "string"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
"required": [
|
|
20
|
-
"id"
|
|
21
|
-
],
|
|
19
|
+
"required": ["id"],
|
|
22
20
|
"type": "object"
|
|
23
21
|
}
|
|
24
22
|
},
|
|
25
|
-
"required": [
|
|
26
|
-
"url",
|
|
27
|
-
"result"
|
|
28
|
-
],
|
|
23
|
+
"required": ["url", "result"],
|
|
29
24
|
"type": "object"
|
|
30
25
|
},
|
|
31
26
|
"FilterType<Mock>": {
|
|
@@ -175,17 +170,11 @@
|
|
|
175
170
|
"description": "Sets up an order by a field and a direction",
|
|
176
171
|
"properties": {
|
|
177
172
|
"id": {
|
|
178
|
-
"enum": [
|
|
179
|
-
"ASC",
|
|
180
|
-
"DESC"
|
|
181
|
-
],
|
|
173
|
+
"enum": ["ASC", "DESC"],
|
|
182
174
|
"type": "string"
|
|
183
175
|
},
|
|
184
176
|
"value": {
|
|
185
|
-
"enum": [
|
|
186
|
-
"ASC",
|
|
187
|
-
"DESC"
|
|
188
|
-
],
|
|
177
|
+
"enum": ["ASC", "DESC"],
|
|
189
178
|
"type": "string"
|
|
190
179
|
}
|
|
191
180
|
},
|
|
@@ -194,10 +183,7 @@
|
|
|
194
183
|
"select": {
|
|
195
184
|
"description": "The result set will be limited to these fields",
|
|
196
185
|
"items": {
|
|
197
|
-
"enum": [
|
|
198
|
-
"id",
|
|
199
|
-
"value"
|
|
200
|
-
],
|
|
186
|
+
"enum": ["id", "value"],
|
|
201
187
|
"type": "string"
|
|
202
188
|
},
|
|
203
189
|
"type": "array"
|
|
@@ -230,10 +216,7 @@
|
|
|
230
216
|
"$ref": "#/definitions/GetCollectionResult%3CMock%3E"
|
|
231
217
|
}
|
|
232
218
|
},
|
|
233
|
-
"required": [
|
|
234
|
-
"query",
|
|
235
|
-
"result"
|
|
236
|
-
],
|
|
219
|
+
"required": ["query", "result"],
|
|
237
220
|
"type": "object"
|
|
238
221
|
},
|
|
239
222
|
"GetCollectionResult<Mock>": {
|
|
@@ -252,10 +235,7 @@
|
|
|
252
235
|
"type": "array"
|
|
253
236
|
}
|
|
254
237
|
},
|
|
255
|
-
"required": [
|
|
256
|
-
"count",
|
|
257
|
-
"entries"
|
|
258
|
-
],
|
|
238
|
+
"required": ["count", "entries"],
|
|
259
239
|
"type": "object"
|
|
260
240
|
},
|
|
261
241
|
"GetEntityEndpoint<Mock,\"id\">": {
|
|
@@ -268,10 +248,7 @@
|
|
|
268
248
|
"select": {
|
|
269
249
|
"description": "The list of fields to select",
|
|
270
250
|
"items": {
|
|
271
|
-
"enum": [
|
|
272
|
-
"id",
|
|
273
|
-
"value"
|
|
274
|
-
],
|
|
251
|
+
"enum": ["id", "value"],
|
|
275
252
|
"type": "string"
|
|
276
253
|
},
|
|
277
254
|
"type": "array"
|
|
@@ -290,17 +267,11 @@
|
|
|
290
267
|
"type": "string"
|
|
291
268
|
}
|
|
292
269
|
},
|
|
293
|
-
"required": [
|
|
294
|
-
"id"
|
|
295
|
-
],
|
|
270
|
+
"required": ["id"],
|
|
296
271
|
"type": "object"
|
|
297
272
|
}
|
|
298
273
|
},
|
|
299
|
-
"required": [
|
|
300
|
-
"query",
|
|
301
|
-
"url",
|
|
302
|
-
"result"
|
|
303
|
-
],
|
|
274
|
+
"required": ["query", "url", "result"],
|
|
304
275
|
"type": "object"
|
|
305
276
|
},
|
|
306
277
|
"Mock": {
|
|
@@ -313,10 +284,7 @@
|
|
|
313
284
|
"type": "string"
|
|
314
285
|
}
|
|
315
286
|
},
|
|
316
|
-
"required": [
|
|
317
|
-
"id",
|
|
318
|
-
"value"
|
|
319
|
-
],
|
|
287
|
+
"required": ["id", "value"],
|
|
320
288
|
"type": "object"
|
|
321
289
|
},
|
|
322
290
|
"PatchEndpoint<Mock,\"id\">": {
|
|
@@ -346,17 +314,11 @@
|
|
|
346
314
|
"type": "string"
|
|
347
315
|
}
|
|
348
316
|
},
|
|
349
|
-
"required": [
|
|
350
|
-
"id"
|
|
351
|
-
],
|
|
317
|
+
"required": ["id"],
|
|
352
318
|
"type": "object"
|
|
353
319
|
}
|
|
354
320
|
},
|
|
355
|
-
"required": [
|
|
356
|
-
"body",
|
|
357
|
-
"url",
|
|
358
|
-
"result"
|
|
359
|
-
],
|
|
321
|
+
"required": ["body", "url", "result"],
|
|
360
322
|
"type": "object"
|
|
361
323
|
},
|
|
362
324
|
"PostEndpoint<Mock,\"id\">": {
|
|
@@ -370,10 +332,7 @@
|
|
|
370
332
|
"$ref": "#/definitions/Mock"
|
|
371
333
|
}
|
|
372
334
|
},
|
|
373
|
-
"required": [
|
|
374
|
-
"body",
|
|
375
|
-
"result"
|
|
376
|
-
],
|
|
335
|
+
"required": ["body", "result"],
|
|
377
336
|
"type": "object"
|
|
378
337
|
},
|
|
379
338
|
"RestApi": {
|
|
@@ -389,9 +348,7 @@
|
|
|
389
348
|
"result": {},
|
|
390
349
|
"url": {}
|
|
391
350
|
},
|
|
392
|
-
"required": [
|
|
393
|
-
"result"
|
|
394
|
-
],
|
|
351
|
+
"required": ["result"],
|
|
395
352
|
"type": "object"
|
|
396
353
|
},
|
|
397
354
|
"type": "object"
|
|
@@ -406,9 +363,7 @@
|
|
|
406
363
|
"result": {},
|
|
407
364
|
"url": {}
|
|
408
365
|
},
|
|
409
|
-
"required": [
|
|
410
|
-
"result"
|
|
411
|
-
],
|
|
366
|
+
"required": ["result"],
|
|
412
367
|
"type": "object"
|
|
413
368
|
},
|
|
414
369
|
"type": "object"
|
|
@@ -423,9 +378,7 @@
|
|
|
423
378
|
"result": {},
|
|
424
379
|
"url": {}
|
|
425
380
|
},
|
|
426
|
-
"required": [
|
|
427
|
-
"result"
|
|
428
|
-
],
|
|
381
|
+
"required": ["result"],
|
|
429
382
|
"type": "object"
|
|
430
383
|
},
|
|
431
384
|
"type": "object"
|
|
@@ -440,9 +393,7 @@
|
|
|
440
393
|
"result": {},
|
|
441
394
|
"url": {}
|
|
442
395
|
},
|
|
443
|
-
"required": [
|
|
444
|
-
"result"
|
|
445
|
-
],
|
|
396
|
+
"required": ["result"],
|
|
446
397
|
"type": "object"
|
|
447
398
|
},
|
|
448
399
|
"type": "object"
|
|
@@ -457,9 +408,7 @@
|
|
|
457
408
|
"result": {},
|
|
458
409
|
"url": {}
|
|
459
410
|
},
|
|
460
|
-
"required": [
|
|
461
|
-
"result"
|
|
462
|
-
],
|
|
411
|
+
"required": ["result"],
|
|
463
412
|
"type": "object"
|
|
464
413
|
},
|
|
465
414
|
"type": "object"
|
|
@@ -474,9 +423,7 @@
|
|
|
474
423
|
"result": {},
|
|
475
424
|
"url": {}
|
|
476
425
|
},
|
|
477
|
-
"required": [
|
|
478
|
-
"result"
|
|
479
|
-
],
|
|
426
|
+
"required": ["result"],
|
|
480
427
|
"type": "object"
|
|
481
428
|
},
|
|
482
429
|
"type": "object"
|
|
@@ -491,9 +438,7 @@
|
|
|
491
438
|
"result": {},
|
|
492
439
|
"url": {}
|
|
493
440
|
},
|
|
494
|
-
"required": [
|
|
495
|
-
"result"
|
|
496
|
-
],
|
|
441
|
+
"required": ["result"],
|
|
497
442
|
"type": "object"
|
|
498
443
|
},
|
|
499
444
|
"type": "object"
|
|
@@ -508,9 +453,7 @@
|
|
|
508
453
|
"result": {},
|
|
509
454
|
"url": {}
|
|
510
455
|
},
|
|
511
|
-
"required": [
|
|
512
|
-
"result"
|
|
513
|
-
],
|
|
456
|
+
"required": ["result"],
|
|
514
457
|
"type": "object"
|
|
515
458
|
},
|
|
516
459
|
"type": "object"
|
|
@@ -525,9 +468,7 @@
|
|
|
525
468
|
"result": {},
|
|
526
469
|
"url": {}
|
|
527
470
|
},
|
|
528
|
-
"required": [
|
|
529
|
-
"result"
|
|
530
|
-
],
|
|
471
|
+
"required": ["result"],
|
|
531
472
|
"type": "object"
|
|
532
473
|
},
|
|
533
474
|
"type": "object"
|
|
@@ -551,11 +492,7 @@
|
|
|
551
492
|
"type": "string"
|
|
552
493
|
}
|
|
553
494
|
},
|
|
554
|
-
"required": [
|
|
555
|
-
"foo",
|
|
556
|
-
"bar",
|
|
557
|
-
"baz"
|
|
558
|
-
],
|
|
495
|
+
"required": ["foo", "bar", "baz"],
|
|
559
496
|
"type": "object"
|
|
560
497
|
},
|
|
561
498
|
"result": {
|
|
@@ -571,18 +508,11 @@
|
|
|
571
508
|
"type": "string"
|
|
572
509
|
}
|
|
573
510
|
},
|
|
574
|
-
"required": [
|
|
575
|
-
"foo",
|
|
576
|
-
"bar",
|
|
577
|
-
"baz"
|
|
578
|
-
],
|
|
511
|
+
"required": ["foo", "bar", "baz"],
|
|
579
512
|
"type": "object"
|
|
580
513
|
}
|
|
581
514
|
},
|
|
582
|
-
"required": [
|
|
583
|
-
"body",
|
|
584
|
-
"result"
|
|
585
|
-
],
|
|
515
|
+
"required": ["body", "result"],
|
|
586
516
|
"type": "object"
|
|
587
517
|
},
|
|
588
518
|
"ValidateHeaders": {
|
|
@@ -601,11 +531,7 @@
|
|
|
601
531
|
"type": "string"
|
|
602
532
|
}
|
|
603
533
|
},
|
|
604
|
-
"required": [
|
|
605
|
-
"foo",
|
|
606
|
-
"bar",
|
|
607
|
-
"baz"
|
|
608
|
-
],
|
|
534
|
+
"required": ["foo", "bar", "baz"],
|
|
609
535
|
"type": "object"
|
|
610
536
|
},
|
|
611
537
|
"result": {
|
|
@@ -621,18 +547,11 @@
|
|
|
621
547
|
"type": "string"
|
|
622
548
|
}
|
|
623
549
|
},
|
|
624
|
-
"required": [
|
|
625
|
-
"foo",
|
|
626
|
-
"bar",
|
|
627
|
-
"baz"
|
|
628
|
-
],
|
|
550
|
+
"required": ["foo", "bar", "baz"],
|
|
629
551
|
"type": "object"
|
|
630
552
|
}
|
|
631
553
|
},
|
|
632
|
-
"required": [
|
|
633
|
-
"headers",
|
|
634
|
-
"result"
|
|
635
|
-
],
|
|
554
|
+
"required": ["headers", "result"],
|
|
636
555
|
"type": "object"
|
|
637
556
|
},
|
|
638
557
|
"ValidateQuery": {
|
|
@@ -651,11 +570,7 @@
|
|
|
651
570
|
"type": "string"
|
|
652
571
|
}
|
|
653
572
|
},
|
|
654
|
-
"required": [
|
|
655
|
-
"foo",
|
|
656
|
-
"bar",
|
|
657
|
-
"baz"
|
|
658
|
-
],
|
|
573
|
+
"required": ["foo", "bar", "baz"],
|
|
659
574
|
"type": "object"
|
|
660
575
|
},
|
|
661
576
|
"result": {
|
|
@@ -671,18 +586,11 @@
|
|
|
671
586
|
"type": "string"
|
|
672
587
|
}
|
|
673
588
|
},
|
|
674
|
-
"required": [
|
|
675
|
-
"foo",
|
|
676
|
-
"bar",
|
|
677
|
-
"baz"
|
|
678
|
-
],
|
|
589
|
+
"required": ["foo", "bar", "baz"],
|
|
679
590
|
"type": "object"
|
|
680
591
|
}
|
|
681
592
|
},
|
|
682
|
-
"required": [
|
|
683
|
-
"query",
|
|
684
|
-
"result"
|
|
685
|
-
],
|
|
593
|
+
"required": ["query", "result"],
|
|
686
594
|
"type": "object"
|
|
687
595
|
},
|
|
688
596
|
"ValidateUrl": {
|
|
@@ -695,9 +603,7 @@
|
|
|
695
603
|
"type": "number"
|
|
696
604
|
}
|
|
697
605
|
},
|
|
698
|
-
"required": [
|
|
699
|
-
"id"
|
|
700
|
-
],
|
|
606
|
+
"required": ["id"],
|
|
701
607
|
"type": "object"
|
|
702
608
|
},
|
|
703
609
|
"url": {
|
|
@@ -707,16 +613,11 @@
|
|
|
707
613
|
"type": "number"
|
|
708
614
|
}
|
|
709
615
|
},
|
|
710
|
-
"required": [
|
|
711
|
-
"id"
|
|
712
|
-
],
|
|
616
|
+
"required": ["id"],
|
|
713
617
|
"type": "object"
|
|
714
618
|
}
|
|
715
619
|
},
|
|
716
|
-
"required": [
|
|
717
|
-
"url",
|
|
718
|
-
"result"
|
|
719
|
-
],
|
|
620
|
+
"required": ["url", "result"],
|
|
720
621
|
"type": "object"
|
|
721
622
|
},
|
|
722
623
|
"ValidationApi": {
|
|
@@ -732,9 +633,7 @@
|
|
|
732
633
|
"result": {},
|
|
733
634
|
"url": {}
|
|
734
635
|
},
|
|
735
|
-
"required": [
|
|
736
|
-
"result"
|
|
737
|
-
],
|
|
636
|
+
"required": ["result"],
|
|
738
637
|
"type": "object"
|
|
739
638
|
},
|
|
740
639
|
"type": "object"
|
|
@@ -746,9 +645,7 @@
|
|
|
746
645
|
"$ref": "#/definitions/DeleteEndpoint%3CMock%2C%22id%22%3E"
|
|
747
646
|
}
|
|
748
647
|
},
|
|
749
|
-
"required": [
|
|
750
|
-
"/mock/:id"
|
|
751
|
-
],
|
|
648
|
+
"required": ["/mock/:id"],
|
|
752
649
|
"type": "object"
|
|
753
650
|
},
|
|
754
651
|
"GET": {
|
|
@@ -770,13 +667,7 @@
|
|
|
770
667
|
"$ref": "#/definitions/ValidateUrl"
|
|
771
668
|
}
|
|
772
669
|
},
|
|
773
|
-
"required": [
|
|
774
|
-
"/validate-query",
|
|
775
|
-
"/validate-url/:id",
|
|
776
|
-
"/validate-headers",
|
|
777
|
-
"/mock",
|
|
778
|
-
"/mock/:id"
|
|
779
|
-
],
|
|
670
|
+
"required": ["/validate-query", "/validate-url/:id", "/validate-headers", "/mock", "/mock/:id"],
|
|
780
671
|
"type": "object"
|
|
781
672
|
},
|
|
782
673
|
"HEAD": {
|
|
@@ -789,9 +680,7 @@
|
|
|
789
680
|
"result": {},
|
|
790
681
|
"url": {}
|
|
791
682
|
},
|
|
792
|
-
"required": [
|
|
793
|
-
"result"
|
|
794
|
-
],
|
|
683
|
+
"required": ["result"],
|
|
795
684
|
"type": "object"
|
|
796
685
|
},
|
|
797
686
|
"type": "object"
|
|
@@ -806,9 +695,7 @@
|
|
|
806
695
|
"result": {},
|
|
807
696
|
"url": {}
|
|
808
697
|
},
|
|
809
|
-
"required": [
|
|
810
|
-
"result"
|
|
811
|
-
],
|
|
698
|
+
"required": ["result"],
|
|
812
699
|
"type": "object"
|
|
813
700
|
},
|
|
814
701
|
"type": "object"
|
|
@@ -820,9 +707,7 @@
|
|
|
820
707
|
"$ref": "#/definitions/PatchEndpoint%3CMock%2C%22id%22%3E"
|
|
821
708
|
}
|
|
822
709
|
},
|
|
823
|
-
"required": [
|
|
824
|
-
"/mock/:id"
|
|
825
|
-
],
|
|
710
|
+
"required": ["/mock/:id"],
|
|
826
711
|
"type": "object"
|
|
827
712
|
},
|
|
828
713
|
"POST": {
|
|
@@ -835,10 +720,7 @@
|
|
|
835
720
|
"$ref": "#/definitions/ValidateBody"
|
|
836
721
|
}
|
|
837
722
|
},
|
|
838
|
-
"required": [
|
|
839
|
-
"/validate-body",
|
|
840
|
-
"/mock"
|
|
841
|
-
],
|
|
723
|
+
"required": ["/validate-body", "/mock"],
|
|
842
724
|
"type": "object"
|
|
843
725
|
},
|
|
844
726
|
"PUT": {
|
|
@@ -851,9 +733,7 @@
|
|
|
851
733
|
"result": {},
|
|
852
734
|
"url": {}
|
|
853
735
|
},
|
|
854
|
-
"required": [
|
|
855
|
-
"result"
|
|
856
|
-
],
|
|
736
|
+
"required": ["result"],
|
|
857
737
|
"type": "object"
|
|
858
738
|
},
|
|
859
739
|
"type": "object"
|
|
@@ -868,20 +748,13 @@
|
|
|
868
748
|
"result": {},
|
|
869
749
|
"url": {}
|
|
870
750
|
},
|
|
871
|
-
"required": [
|
|
872
|
-
"result"
|
|
873
|
-
],
|
|
751
|
+
"required": ["result"],
|
|
874
752
|
"type": "object"
|
|
875
753
|
},
|
|
876
754
|
"type": "object"
|
|
877
755
|
}
|
|
878
756
|
},
|
|
879
|
-
"required": [
|
|
880
|
-
"GET",
|
|
881
|
-
"POST",
|
|
882
|
-
"PATCH",
|
|
883
|
-
"DELETE"
|
|
884
|
-
],
|
|
757
|
+
"required": ["GET", "POST", "PATCH", "DELETE"],
|
|
885
758
|
"type": "object"
|
|
886
759
|
},
|
|
887
760
|
"WithOptionalId<Mock,\"id\">": {
|
|
@@ -894,10 +767,8 @@
|
|
|
894
767
|
"type": "string"
|
|
895
768
|
}
|
|
896
769
|
},
|
|
897
|
-
"required": [
|
|
898
|
-
"value"
|
|
899
|
-
],
|
|
770
|
+
"required": ["value"],
|
|
900
771
|
"type": "object"
|
|
901
772
|
}
|
|
902
773
|
}
|
|
903
|
-
}
|
|
774
|
+
}
|
|
@@ -3,7 +3,7 @@ import { createClient, ResponseError } from '@furystack/rest-client-fetch'
|
|
|
3
3
|
import { usingAsync } from '@furystack/utils'
|
|
4
4
|
import { JsonResult } from './request-action-implementation.js'
|
|
5
5
|
import { Validate } from './validate.js'
|
|
6
|
-
import schema from './validate.integration.spec.schema.json'
|
|
6
|
+
import schema from './validate.integration.spec.schema.json' with { type: 'json' }
|
|
7
7
|
import type { ValidationApi } from './validate.integration.schema.js'
|
|
8
8
|
import { useRestService } from './helpers.js'
|
|
9
9
|
import { describe, it, expect } from 'vitest'
|