@bleedingdev/modern-js-bff-core 3.5.0-ultramodern.5 → 3.5.0-ultramodern.75
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/adapter-kit/index.js +6 -2
- package/dist/cjs/adapter-kit/parity-scenarios/cross-project-denial.js +55 -0
- package/dist/cjs/adapter-kit/parity-scenarios/envelope.js +128 -0
- package/dist/cjs/adapter-kit/parity-scenarios/operation-context.js +158 -0
- package/dist/cjs/adapter-kit/parity-scenarios/schema.js +109 -0
- package/dist/cjs/adapter-kit/parity-scenarios/shared.js +71 -0
- package/dist/cjs/adapter-kit/parity.js +26 -368
- package/dist/cjs/index.js +29 -48
- package/dist/cjs/operators/http.js +2 -2
- package/dist/cjs/security/crossProjectPolicy.js +123 -62
- package/dist/esm/adapter-kit/index.mjs +6 -2
- package/dist/esm/adapter-kit/parity-scenarios/cross-project-denial.mjs +17 -0
- package/dist/esm/adapter-kit/parity-scenarios/envelope.mjs +90 -0
- package/dist/esm/adapter-kit/parity-scenarios/operation-context.mjs +117 -0
- package/dist/esm/adapter-kit/parity-scenarios/schema.mjs +71 -0
- package/dist/esm/adapter-kit/parity-scenarios/shared.mjs +21 -0
- package/dist/esm/adapter-kit/parity.mjs +19 -361
- package/dist/esm/index.mjs +0 -1
- package/dist/esm/operators/http.mjs +2 -2
- package/dist/esm/security/crossProjectPolicy.mjs +123 -62
- package/dist/esm/security/operationContracts.mjs +2 -2
- package/dist/esm-node/adapter-kit/index.mjs +6 -2
- package/dist/esm-node/adapter-kit/parity-scenarios/cross-project-denial.mjs +18 -0
- package/dist/esm-node/adapter-kit/parity-scenarios/envelope.mjs +91 -0
- package/dist/esm-node/adapter-kit/parity-scenarios/operation-context.mjs +118 -0
- package/dist/esm-node/adapter-kit/parity-scenarios/schema.mjs +72 -0
- package/dist/esm-node/adapter-kit/parity-scenarios/shared.mjs +22 -0
- package/dist/esm-node/adapter-kit/parity.mjs +19 -361
- package/dist/esm-node/index.mjs +0 -1
- package/dist/esm-node/operators/http.mjs +2 -2
- package/dist/esm-node/security/crossProjectPolicy.mjs +123 -62
- package/dist/types/adapter-kit/index.d.ts +2 -2
- package/dist/types/adapter-kit/parity-scenarios/cross-project-denial.d.ts +2 -0
- package/dist/types/adapter-kit/parity-scenarios/envelope.d.ts +2 -0
- package/dist/types/adapter-kit/parity-scenarios/operation-context.d.ts +3 -0
- package/dist/types/adapter-kit/parity-scenarios/schema.d.ts +2 -0
- package/dist/types/adapter-kit/parity-scenarios/shared.d.ts +32 -0
- package/dist/types/adapter-kit/parity.d.ts +12 -71
- package/dist/types/index.d.ts +0 -1
- package/dist/types/operators/http.d.ts +1 -1
- package/dist/types/security/crossProjectPolicy.d.ts +17 -8
- package/package.json +10 -12
- package/dist/cjs/contracts/eventContracts.js +0 -72
- package/dist/esm/contracts/eventContracts.mjs +0 -28
- package/dist/esm-node/contracts/eventContracts.mjs +0 -29
- package/dist/types/contracts/eventContracts.d.ts +0 -22
|
@@ -28,8 +28,8 @@ var __webpack_require__ = {};
|
|
|
28
28
|
var __webpack_exports__ = {};
|
|
29
29
|
__webpack_require__.r(__webpack_exports__);
|
|
30
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
-
PARITY_PRODUCER_REQUEST_ID: ()=>PARITY_PRODUCER_REQUEST_ID,
|
|
32
|
-
PARITY_REQUEST_ID: ()=>PARITY_REQUEST_ID,
|
|
31
|
+
PARITY_PRODUCER_REQUEST_ID: ()=>shared_js_namespaceObject.PARITY_PRODUCER_REQUEST_ID,
|
|
32
|
+
PARITY_REQUEST_ID: ()=>shared_js_namespaceObject.PARITY_REQUEST_ID,
|
|
33
33
|
assertParityResult: ()=>assertParityResult,
|
|
34
34
|
createAdapterParityScenarios: ()=>createAdapterParityScenarios,
|
|
35
35
|
createParityApiHandlerInfos: ()=>createParityApiHandlerInfos,
|
|
@@ -38,8 +38,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
});
|
|
39
39
|
const operationContracts_js_namespaceObject = require("../security/operationContracts.js");
|
|
40
40
|
const external_types_js_namespaceObject = require("../types.js");
|
|
41
|
-
const
|
|
42
|
-
const
|
|
41
|
+
const cross_project_denial_js_namespaceObject = require("./parity-scenarios/cross-project-denial.js");
|
|
42
|
+
const envelope_js_namespaceObject = require("./parity-scenarios/envelope.js");
|
|
43
|
+
const operation_context_js_namespaceObject = require("./parity-scenarios/operation-context.js");
|
|
44
|
+
const schema_js_namespaceObject = require("./parity-scenarios/schema.js");
|
|
45
|
+
const shared_js_namespaceObject = require("./parity-scenarios/shared.js");
|
|
43
46
|
const PARITY_FIXTURE_FILENAME = 'bff-core/adapter-kit/parity-fixture.ts';
|
|
44
47
|
const HANDLER_WITH_SCHEMA = 'HANDLER_WITH_SCHEMA';
|
|
45
48
|
const isRecord = (value)=>Boolean(value) && 'object' == typeof value;
|
|
@@ -129,373 +132,35 @@ const createParityApiHandlerInfos = ()=>[
|
|
|
129
132
|
}
|
|
130
133
|
];
|
|
131
134
|
const createParityBffConfig = ()=>({
|
|
132
|
-
requestId: PARITY_REQUEST_ID,
|
|
135
|
+
requestId: shared_js_namespaceObject.PARITY_REQUEST_ID,
|
|
133
136
|
crossProjectPolicy: {
|
|
134
137
|
enabled: true,
|
|
135
138
|
allowedNamespaces: [
|
|
136
|
-
PARITY_REQUEST_ID
|
|
137
|
-
]
|
|
139
|
+
shared_js_namespaceObject.PARITY_REQUEST_ID
|
|
140
|
+
],
|
|
141
|
+
allowClientAssertedNamespace: true
|
|
138
142
|
}
|
|
139
143
|
});
|
|
140
144
|
const getParityContracts = ()=>(0, operationContracts_js_namespaceObject.buildOperationContractMap)({
|
|
141
145
|
handlers: createParityApiHandlerInfos(),
|
|
142
|
-
requestId: PARITY_REQUEST_ID
|
|
143
|
-
});
|
|
144
|
-
const envelopeHeader = (requestId)=>JSON.stringify(void 0 === requestId ? {} : {
|
|
145
|
-
requestId
|
|
146
|
-
});
|
|
147
|
-
const detailHeader = (details)=>JSON.stringify(details);
|
|
148
|
-
const deniedScenario = (name, reason, headers)=>({
|
|
149
|
-
name,
|
|
150
|
-
policy: true,
|
|
151
|
-
request: {
|
|
152
|
-
method: 'get',
|
|
153
|
-
path: '/hello',
|
|
154
|
-
headers
|
|
155
|
-
},
|
|
156
|
-
expected: {
|
|
157
|
-
kind: 'denied',
|
|
158
|
-
status: 403,
|
|
159
|
-
reason
|
|
160
|
-
}
|
|
146
|
+
requestId: shared_js_namespaceObject.PARITY_REQUEST_ID
|
|
161
147
|
});
|
|
162
148
|
const createAdapterParityScenarios = ()=>{
|
|
163
149
|
const contracts = getParityContracts();
|
|
164
150
|
const helloContract = contracts['GET:/hello'];
|
|
165
|
-
const validEnvelope = envelopeHeader(PARITY_PRODUCER_REQUEST_ID);
|
|
166
|
-
const validOperationId = `${PARITY_PRODUCER_REQUEST_ID}:parity`;
|
|
151
|
+
const validEnvelope = (0, shared_js_namespaceObject.envelopeHeader)(shared_js_namespaceObject.PARITY_PRODUCER_REQUEST_ID);
|
|
152
|
+
const validOperationId = `${shared_js_namespaceObject.PARITY_PRODUCER_REQUEST_ID}:parity`;
|
|
153
|
+
const context = {
|
|
154
|
+
helloContract,
|
|
155
|
+
validEnvelope,
|
|
156
|
+
validOperationId
|
|
157
|
+
};
|
|
167
158
|
return [
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
path: '/hello'
|
|
174
|
-
},
|
|
175
|
-
expected: {
|
|
176
|
-
kind: 'payload',
|
|
177
|
-
status: 200,
|
|
178
|
-
payload: {
|
|
179
|
-
message: 'hello'
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'plain handler returns scalar payload',
|
|
185
|
-
policy: false,
|
|
186
|
-
request: {
|
|
187
|
-
method: 'post',
|
|
188
|
-
path: '/hello'
|
|
189
|
-
},
|
|
190
|
-
expected: {
|
|
191
|
-
kind: 'payload',
|
|
192
|
-
status: 200,
|
|
193
|
-
payload: 'hello'
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: 'plain handler returning undefined (pinned adapter drift)',
|
|
198
|
-
policy: false,
|
|
199
|
-
request: {
|
|
200
|
-
method: 'get',
|
|
201
|
-
path: '/nothing'
|
|
202
|
-
},
|
|
203
|
-
expected: {
|
|
204
|
-
kind: 'perAdapter',
|
|
205
|
-
expectations: {
|
|
206
|
-
express: {
|
|
207
|
-
status: 200,
|
|
208
|
-
payload: void 0
|
|
209
|
-
},
|
|
210
|
-
koa: {
|
|
211
|
-
status: 404,
|
|
212
|
-
payload: 'Not Found'
|
|
213
|
-
},
|
|
214
|
-
hono: {
|
|
215
|
-
status: 404,
|
|
216
|
-
payload: '404 Not Found'
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
name: 'plain handler receives data, query and cookies',
|
|
223
|
-
policy: false,
|
|
224
|
-
request: {
|
|
225
|
-
method: 'post',
|
|
226
|
-
path: '/echo?q=z',
|
|
227
|
-
headers: {
|
|
228
|
-
'content-type': 'application/json',
|
|
229
|
-
cookie: 'id=666'
|
|
230
|
-
},
|
|
231
|
-
body: {
|
|
232
|
-
a: 1
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
expected: {
|
|
236
|
-
kind: 'payload',
|
|
237
|
-
status: 200,
|
|
238
|
-
payload: {
|
|
239
|
-
data: {
|
|
240
|
-
a: 1
|
|
241
|
-
},
|
|
242
|
-
query: {
|
|
243
|
-
q: 'z'
|
|
244
|
-
},
|
|
245
|
-
cookie: 'id=666'
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
name: 'plain handler receives positional route params',
|
|
251
|
-
policy: false,
|
|
252
|
-
request: {
|
|
253
|
-
method: 'get',
|
|
254
|
-
path: '/items/123?q=x'
|
|
255
|
-
},
|
|
256
|
-
expected: {
|
|
257
|
-
kind: 'payload',
|
|
258
|
-
status: 200,
|
|
259
|
-
payload: {
|
|
260
|
-
id: '123',
|
|
261
|
-
query: {
|
|
262
|
-
q: 'x'
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
name: 'schema handler success (pinned adapter drift)',
|
|
269
|
-
policy: false,
|
|
270
|
-
request: {
|
|
271
|
-
method: 'patch',
|
|
272
|
-
path: '/schema',
|
|
273
|
-
headers: {
|
|
274
|
-
'content-type': 'application/json'
|
|
275
|
-
},
|
|
276
|
-
body: {
|
|
277
|
-
id: 777
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
expected: {
|
|
281
|
-
kind: 'perAdapter',
|
|
282
|
-
expectations: {
|
|
283
|
-
express: {
|
|
284
|
-
status: 200,
|
|
285
|
-
payload: {
|
|
286
|
-
id: 777
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
koa: {
|
|
290
|
-
status: 200,
|
|
291
|
-
payload: {
|
|
292
|
-
id: 777
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
hono: {
|
|
296
|
-
status: 200,
|
|
297
|
-
payload: {
|
|
298
|
-
type: 'HandleSuccess',
|
|
299
|
-
value: {
|
|
300
|
-
id: 777
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
name: 'schema handler input validation error (pinned adapter drift)',
|
|
309
|
-
policy: false,
|
|
310
|
-
request: {
|
|
311
|
-
method: 'patch',
|
|
312
|
-
path: '/schema',
|
|
313
|
-
headers: {
|
|
314
|
-
'content-type': 'application/json'
|
|
315
|
-
},
|
|
316
|
-
body: {
|
|
317
|
-
id: 'aaa'
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
expected: {
|
|
321
|
-
kind: 'perAdapter',
|
|
322
|
-
expectations: {
|
|
323
|
-
express: {
|
|
324
|
-
status: 400,
|
|
325
|
-
payload: 'invalid input'
|
|
326
|
-
},
|
|
327
|
-
koa: {
|
|
328
|
-
status: 400,
|
|
329
|
-
payload: 'invalid input'
|
|
330
|
-
},
|
|
331
|
-
hono: {
|
|
332
|
-
status: 200,
|
|
333
|
-
payload: {
|
|
334
|
-
type: 'InputValidationError',
|
|
335
|
-
message: 'invalid input'
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
name: 'schema handler output validation error (pinned adapter drift)',
|
|
343
|
-
policy: false,
|
|
344
|
-
request: {
|
|
345
|
-
method: 'patch',
|
|
346
|
-
path: '/schema',
|
|
347
|
-
headers: {
|
|
348
|
-
'content-type': 'application/json'
|
|
349
|
-
},
|
|
350
|
-
body: {
|
|
351
|
-
id: 'boom'
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
expected: {
|
|
355
|
-
kind: 'perAdapter',
|
|
356
|
-
expectations: {
|
|
357
|
-
express: {
|
|
358
|
-
status: 500,
|
|
359
|
-
payload: 'invalid output'
|
|
360
|
-
},
|
|
361
|
-
koa: {
|
|
362
|
-
status: 500,
|
|
363
|
-
payload: 'invalid output'
|
|
364
|
-
},
|
|
365
|
-
hono: {
|
|
366
|
-
status: 200,
|
|
367
|
-
payload: {
|
|
368
|
-
type: 'OutputValidationError',
|
|
369
|
-
message: 'invalid output'
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
name: 'policy pass with full operation context',
|
|
377
|
-
policy: true,
|
|
378
|
-
request: {
|
|
379
|
-
method: 'get',
|
|
380
|
-
path: '/hello',
|
|
381
|
-
headers: {
|
|
382
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
383
|
-
'x-operation-id': validOperationId,
|
|
384
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
385
|
-
requestId: PARITY_PRODUCER_REQUEST_ID,
|
|
386
|
-
method: 'GET',
|
|
387
|
-
routePath: '/hello',
|
|
388
|
-
schemaHash: helloContract.schemaHash,
|
|
389
|
-
operationVersion: helloContract.operationVersion
|
|
390
|
-
})
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
expected: {
|
|
394
|
-
kind: 'payload',
|
|
395
|
-
status: 200,
|
|
396
|
-
payload: {
|
|
397
|
-
message: 'hello'
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
deniedScenario('policy denies missing envelope', 'missing_envelope', {}),
|
|
402
|
-
deniedScenario('policy denies invalid envelope', 'invalid_envelope', {
|
|
403
|
-
'x-modernjs-bff-envelope': 'not-json'
|
|
404
|
-
}),
|
|
405
|
-
deniedScenario('policy denies envelope that is valid JSON but not an object', 'invalid_envelope', {
|
|
406
|
-
'x-modernjs-bff-envelope': '123'
|
|
407
|
-
}),
|
|
408
|
-
deniedScenario('policy denies missing requestId', 'missing_request_id', {
|
|
409
|
-
'x-modernjs-bff-envelope': envelopeHeader(void 0)
|
|
410
|
-
}),
|
|
411
|
-
deniedScenario('policy denies namespace outside allowlist', 'namespace_not_allowed', {
|
|
412
|
-
'x-modernjs-bff-envelope': envelopeHeader('billing.producer-z')
|
|
413
|
-
}),
|
|
414
|
-
deniedScenario('policy denies missing operation context', 'missing_operation_context', {
|
|
415
|
-
'x-modernjs-bff-envelope': validEnvelope
|
|
416
|
-
}),
|
|
417
|
-
deniedScenario('policy denies operation context mismatch', 'operation_context_mismatch', {
|
|
418
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
419
|
-
'x-operation-id': 'someone-else:parity'
|
|
420
|
-
}),
|
|
421
|
-
deniedScenario('policy denies missing operation context details', 'missing_operation_context_details', {
|
|
422
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
423
|
-
'x-operation-id': validOperationId
|
|
424
|
-
}),
|
|
425
|
-
deniedScenario('policy denies JSON-array operation context details', 'invalid_operation_context_details', {
|
|
426
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
427
|
-
'x-operation-id': validOperationId,
|
|
428
|
-
'x-modernjs-bff-operation-context': '[]'
|
|
429
|
-
}),
|
|
430
|
-
deniedScenario('policy denies invalid operation context details', 'invalid_operation_context_details', {
|
|
431
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
432
|
-
'x-operation-id': validOperationId,
|
|
433
|
-
'x-modernjs-bff-operation-context': 'not-json'
|
|
434
|
-
}),
|
|
435
|
-
deniedScenario('policy denies detail requestId mismatch', 'operation_context_details_request_id_mismatch', {
|
|
436
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
437
|
-
'x-operation-id': validOperationId,
|
|
438
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
439
|
-
requestId: 'crm.producer-b',
|
|
440
|
-
method: 'GET',
|
|
441
|
-
routePath: '/hello',
|
|
442
|
-
schemaHash: helloContract.schemaHash,
|
|
443
|
-
operationVersion: helloContract.operationVersion
|
|
444
|
-
})
|
|
445
|
-
}),
|
|
446
|
-
deniedScenario('policy denies missing operation schema hash', 'missing_operation_schema_hash', {
|
|
447
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
448
|
-
'x-operation-id': validOperationId,
|
|
449
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
450
|
-
requestId: PARITY_PRODUCER_REQUEST_ID,
|
|
451
|
-
method: 'GET',
|
|
452
|
-
routePath: '/hello',
|
|
453
|
-
operationVersion: helloContract.operationVersion
|
|
454
|
-
})
|
|
455
|
-
}),
|
|
456
|
-
deniedScenario('policy denies missing operation version', 'missing_operation_version', {
|
|
457
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
458
|
-
'x-operation-id': validOperationId,
|
|
459
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
460
|
-
requestId: PARITY_PRODUCER_REQUEST_ID,
|
|
461
|
-
method: 'GET',
|
|
462
|
-
routePath: '/hello',
|
|
463
|
-
schemaHash: helloContract.schemaHash
|
|
464
|
-
})
|
|
465
|
-
}),
|
|
466
|
-
deniedScenario('policy denies unknown operation contract', 'unknown_operation_contract', {
|
|
467
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
468
|
-
'x-operation-id': validOperationId,
|
|
469
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
470
|
-
requestId: PARITY_PRODUCER_REQUEST_ID,
|
|
471
|
-
method: 'GET',
|
|
472
|
-
routePath: '/does-not-exist',
|
|
473
|
-
schemaHash: helloContract.schemaHash,
|
|
474
|
-
operationVersion: helloContract.operationVersion
|
|
475
|
-
})
|
|
476
|
-
}),
|
|
477
|
-
deniedScenario('policy denies operation schema hash mismatch', 'operation_schema_hash_mismatch', {
|
|
478
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
479
|
-
'x-operation-id': validOperationId,
|
|
480
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
481
|
-
requestId: PARITY_PRODUCER_REQUEST_ID,
|
|
482
|
-
method: 'GET',
|
|
483
|
-
routePath: '/hello',
|
|
484
|
-
schemaHash: 'deadbeef',
|
|
485
|
-
operationVersion: helloContract.operationVersion
|
|
486
|
-
})
|
|
487
|
-
}),
|
|
488
|
-
deniedScenario('policy denies operation version mismatch', 'operation_version_mismatch', {
|
|
489
|
-
'x-modernjs-bff-envelope': validEnvelope,
|
|
490
|
-
'x-operation-id': validOperationId,
|
|
491
|
-
'x-modernjs-bff-operation-context': detailHeader({
|
|
492
|
-
requestId: PARITY_PRODUCER_REQUEST_ID,
|
|
493
|
-
method: 'GET',
|
|
494
|
-
routePath: '/hello',
|
|
495
|
-
schemaHash: helloContract.schemaHash,
|
|
496
|
-
operationVersion: helloContract.operationVersion + 1
|
|
497
|
-
})
|
|
498
|
-
})
|
|
159
|
+
...(0, envelope_js_namespaceObject.createEnvelopeParityScenarios)(),
|
|
160
|
+
...(0, schema_js_namespaceObject.createSchemaParityScenarios)(),
|
|
161
|
+
...(0, operation_context_js_namespaceObject.createOperationContextSuccessScenarios)(context),
|
|
162
|
+
...(0, cross_project_denial_js_namespaceObject.createCrossProjectDenialScenarios)(),
|
|
163
|
+
...(0, operation_context_js_namespaceObject.createOperationContextDenialScenarios)(context)
|
|
499
164
|
];
|
|
500
165
|
};
|
|
501
166
|
const toParityResult = (res)=>({
|
|
@@ -503,17 +168,10 @@ const toParityResult = (res)=>({
|
|
|
503
168
|
payload: res.type.includes('json') ? res.body : '' === res.text ? void 0 : res.text
|
|
504
169
|
});
|
|
505
170
|
const formatValue = (value)=>JSON.stringify(value);
|
|
506
|
-
const assertParityResult = (scenario, res
|
|
171
|
+
const assertParityResult = (scenario, res)=>{
|
|
507
172
|
const result = toParityResult(res);
|
|
508
173
|
const failures = [];
|
|
509
|
-
|
|
510
|
-
if ('perAdapter' === expected.kind) {
|
|
511
|
-
if (void 0 === adapter) throw new Error(`Adapter parity scenario "${scenario.name}" pins per-adapter drift; pass the adapter id to assertParityResult.`);
|
|
512
|
-
expected = {
|
|
513
|
-
kind: 'payload',
|
|
514
|
-
...expected.expectations[adapter]
|
|
515
|
-
};
|
|
516
|
-
}
|
|
174
|
+
const { expected } = scenario;
|
|
517
175
|
if (result.status !== expected.status) failures.push(`status: expected ${expected.status}, received ${result.status}`);
|
|
518
176
|
if ('payload' === expected.kind) {
|
|
519
177
|
if (formatValue(result.payload) !== formatValue(expected.payload)) failures.push(`payload: expected ${formatValue(expected.payload)}, received ${formatValue(result.payload)}`);
|
package/dist/cjs/index.js
CHANGED
|
@@ -9,9 +9,6 @@ var __webpack_modules__ = {
|
|
|
9
9
|
"./client" (module) {
|
|
10
10
|
module.exports = require("./client/index.js");
|
|
11
11
|
},
|
|
12
|
-
"./contracts/eventContracts" (module) {
|
|
13
|
-
module.exports = require("./contracts/eventContracts.js");
|
|
14
|
-
},
|
|
15
12
|
"./errors/http" (module) {
|
|
16
13
|
module.exports = require("./errors/http.js");
|
|
17
14
|
},
|
|
@@ -117,26 +114,10 @@ var __webpack_exports__ = {};
|
|
|
117
114
|
"Api"
|
|
118
115
|
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_client__rspack_import_2[__rspack_import_key];
|
|
119
116
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
120
|
-
var
|
|
121
|
-
var
|
|
122
|
-
for(const __rspack_import_key in _contracts_eventContracts__rspack_import_3)if ([
|
|
123
|
-
"HttpError",
|
|
124
|
-
"registerPaths",
|
|
125
|
-
"createStorage",
|
|
126
|
-
"isWithMetaHandler",
|
|
127
|
-
"default",
|
|
128
|
-
"HANDLER_WITH_META",
|
|
129
|
-
"ValidationError",
|
|
130
|
-
"getRelativeRuntimePath",
|
|
131
|
-
"INPUT_PARAMS_DECIDER",
|
|
132
|
-
"isInputParamsDeciderHandler",
|
|
133
|
-
"Api"
|
|
134
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_contracts_eventContracts__rspack_import_3[__rspack_import_key];
|
|
135
|
-
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
136
|
-
var _errors_http__rspack_import_4 = __webpack_require__("./errors/http");
|
|
137
|
-
var _operators_http__rspack_import_5 = __webpack_require__("./operators/http");
|
|
117
|
+
var _errors_http__rspack_import_3 = __webpack_require__("./errors/http");
|
|
118
|
+
var _operators_http__rspack_import_4 = __webpack_require__("./operators/http");
|
|
138
119
|
var __rspack_reexport = {};
|
|
139
|
-
for(const __rspack_import_key in
|
|
120
|
+
for(const __rspack_import_key in _operators_http__rspack_import_4)if ([
|
|
140
121
|
"HttpError",
|
|
141
122
|
"registerPaths",
|
|
142
123
|
"createStorage",
|
|
@@ -148,11 +129,11 @@ var __webpack_exports__ = {};
|
|
|
148
129
|
"INPUT_PARAMS_DECIDER",
|
|
149
130
|
"isInputParamsDeciderHandler",
|
|
150
131
|
"Api"
|
|
151
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
132
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_operators_http__rspack_import_4[__rspack_import_key];
|
|
152
133
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
153
|
-
var
|
|
134
|
+
var _router__rspack_import_5 = __webpack_require__("./router");
|
|
154
135
|
var __rspack_reexport = {};
|
|
155
|
-
for(const __rspack_import_key in
|
|
136
|
+
for(const __rspack_import_key in _router__rspack_import_5)if ([
|
|
156
137
|
"HttpError",
|
|
157
138
|
"registerPaths",
|
|
158
139
|
"createStorage",
|
|
@@ -164,11 +145,11 @@ var __webpack_exports__ = {};
|
|
|
164
145
|
"INPUT_PARAMS_DECIDER",
|
|
165
146
|
"isInputParamsDeciderHandler",
|
|
166
147
|
"Api"
|
|
167
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
148
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_router__rspack_import_5[__rspack_import_key];
|
|
168
149
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
169
|
-
var
|
|
150
|
+
var _security_crossProjectPolicy__rspack_import_6 = __webpack_require__("./security/crossProjectPolicy");
|
|
170
151
|
var __rspack_reexport = {};
|
|
171
|
-
for(const __rspack_import_key in
|
|
152
|
+
for(const __rspack_import_key in _security_crossProjectPolicy__rspack_import_6)if ([
|
|
172
153
|
"HttpError",
|
|
173
154
|
"registerPaths",
|
|
174
155
|
"createStorage",
|
|
@@ -180,11 +161,11 @@ var __webpack_exports__ = {};
|
|
|
180
161
|
"INPUT_PARAMS_DECIDER",
|
|
181
162
|
"isInputParamsDeciderHandler",
|
|
182
163
|
"Api"
|
|
183
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
164
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_security_crossProjectPolicy__rspack_import_6[__rspack_import_key];
|
|
184
165
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
185
|
-
var
|
|
166
|
+
var _security_operationContracts__rspack_import_7 = __webpack_require__("./security/operationContracts");
|
|
186
167
|
var __rspack_reexport = {};
|
|
187
|
-
for(const __rspack_import_key in
|
|
168
|
+
for(const __rspack_import_key in _security_operationContracts__rspack_import_7)if ([
|
|
188
169
|
"HttpError",
|
|
189
170
|
"registerPaths",
|
|
190
171
|
"createStorage",
|
|
@@ -196,11 +177,11 @@ var __webpack_exports__ = {};
|
|
|
196
177
|
"INPUT_PARAMS_DECIDER",
|
|
197
178
|
"isInputParamsDeciderHandler",
|
|
198
179
|
"Api"
|
|
199
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
180
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_security_operationContracts__rspack_import_7[__rspack_import_key];
|
|
200
181
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
201
|
-
var
|
|
182
|
+
var _security_resolveCrossProjectPolicy__rspack_import_8 = __webpack_require__("./security/resolveCrossProjectPolicy");
|
|
202
183
|
var __rspack_reexport = {};
|
|
203
|
-
for(const __rspack_import_key in
|
|
184
|
+
for(const __rspack_import_key in _security_resolveCrossProjectPolicy__rspack_import_8)if ([
|
|
204
185
|
"HttpError",
|
|
205
186
|
"registerPaths",
|
|
206
187
|
"createStorage",
|
|
@@ -212,11 +193,11 @@ var __webpack_exports__ = {};
|
|
|
212
193
|
"INPUT_PARAMS_DECIDER",
|
|
213
194
|
"isInputParamsDeciderHandler",
|
|
214
195
|
"Api"
|
|
215
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
196
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_security_resolveCrossProjectPolicy__rspack_import_8[__rspack_import_key];
|
|
216
197
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
217
|
-
var
|
|
198
|
+
var _types__rspack_import_9 = __webpack_require__("./types");
|
|
218
199
|
var __rspack_reexport = {};
|
|
219
|
-
for(const __rspack_import_key in
|
|
200
|
+
for(const __rspack_import_key in _types__rspack_import_9)if ([
|
|
220
201
|
"HttpError",
|
|
221
202
|
"registerPaths",
|
|
222
203
|
"createStorage",
|
|
@@ -228,20 +209,20 @@ var __webpack_exports__ = {};
|
|
|
228
209
|
"INPUT_PARAMS_DECIDER",
|
|
229
210
|
"isInputParamsDeciderHandler",
|
|
230
211
|
"Api"
|
|
231
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
212
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_9[__rspack_import_key];
|
|
232
213
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
233
|
-
var
|
|
214
|
+
var _utils__rspack_import_10 = __webpack_require__("./utils?637c");
|
|
234
215
|
__webpack_require__.d(__webpack_exports__, {
|
|
235
216
|
Api: ()=>_api__rspack_import_1.Api,
|
|
236
|
-
HANDLER_WITH_META: ()=>
|
|
237
|
-
HttpError: ()=>
|
|
238
|
-
INPUT_PARAMS_DECIDER: ()=>
|
|
239
|
-
ValidationError: ()=>
|
|
240
|
-
createStorage: ()=>
|
|
241
|
-
getRelativeRuntimePath: ()=>
|
|
242
|
-
isInputParamsDeciderHandler: ()=>
|
|
243
|
-
isWithMetaHandler: ()=>
|
|
244
|
-
registerPaths: ()=>
|
|
217
|
+
HANDLER_WITH_META: ()=>_utils__rspack_import_10.HANDLER_WITH_META,
|
|
218
|
+
HttpError: ()=>_errors_http__rspack_import_3.HttpError,
|
|
219
|
+
INPUT_PARAMS_DECIDER: ()=>_utils__rspack_import_10.INPUT_PARAMS_DECIDER,
|
|
220
|
+
ValidationError: ()=>_errors_http__rspack_import_3.ValidationError,
|
|
221
|
+
createStorage: ()=>_utils__rspack_import_10.createStorage,
|
|
222
|
+
getRelativeRuntimePath: ()=>_utils__rspack_import_10.getRelativeRuntimePath,
|
|
223
|
+
isInputParamsDeciderHandler: ()=>_utils__rspack_import_10.isInputParamsDeciderHandler,
|
|
224
|
+
isWithMetaHandler: ()=>_utils__rspack_import_10.isWithMetaHandler,
|
|
225
|
+
registerPaths: ()=>_utils__rspack_import_10.registerPaths
|
|
245
226
|
});
|
|
246
227
|
})();
|
|
247
228
|
exports.Api = __webpack_exports__.Api;
|
|
@@ -173,10 +173,10 @@ const Upload = (urlPath, schema)=>({
|
|
|
173
173
|
},
|
|
174
174
|
async validate (helper, next) {
|
|
175
175
|
if (!schema) return next();
|
|
176
|
-
const { inputs: { formData
|
|
176
|
+
const { inputs: { formData } } = helper;
|
|
177
177
|
helper.inputs = {
|
|
178
178
|
...helper.inputs,
|
|
179
|
-
|
|
179
|
+
formData: await validateInput(schema, formData)
|
|
180
180
|
};
|
|
181
181
|
return next();
|
|
182
182
|
}
|