@kineticdata/react 5.0.16 → 5.1.0
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/lib/apis/core/attributeDefinitions.js +3 -2
- package/lib/apis/core/authentication.js +13 -5
- package/lib/apis/core/backgroundJobs.js +22 -39
- package/lib/apis/core/fileResources.js +36 -0
- package/lib/apis/core/filestores.js +40 -0
- package/lib/apis/core/forms.js +21 -36
- package/lib/apis/core/forms.test.js +51 -278
- package/lib/apis/core/securityPolicyDefinitions.test.js +4 -4
- package/lib/apis/core/submissions.js +46 -30
- package/lib/apis/core/webhooks.js +1 -2
- package/lib/apis/discussions/index.js +2 -1
- package/lib/apis/http.js +28 -13
- package/lib/apis/http.test.js +13 -15
- package/lib/apis/index.js +2 -0
- package/lib/apis/system/index.js +86 -1
- package/lib/apis/task/index.js +22 -14
- package/lib/components/agent/filestore/FilestoreForm.js +132 -0
- package/lib/components/agent/filestore/FilestoreTable.js +53 -0
- package/lib/components/common/BridgeSelect.js +2 -1
- package/lib/components/common/FormSelect.js +2 -1
- package/lib/components/common/Scroller.js +6 -6
- package/lib/components/common/TableInput.js +74 -29
- package/lib/components/common/TeamSelect.js +2 -1
- package/lib/components/common/Typeahead.js +7 -4
- package/lib/components/common/UserSelect.js +2 -1
- package/lib/components/common/authentication/AuthenticationContainer.js +50 -27
- package/lib/components/common/code_input/languageHelpers.test.js +1 -1
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +1 -1
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +1 -1
- package/lib/components/core/core_form/CoreForm.js +10 -10
- package/lib/components/core/field_definition/FieldDefinitionForm.js +130 -0
- package/lib/components/core/field_definition/FieldDefinitionTable.js +86 -0
- package/lib/components/core/file_resource/FileResourceForm.js +180 -0
- package/lib/components/core/file_resource/FileResourceTable.js +71 -0
- package/lib/components/core/form/FormForm.js +12 -17
- package/lib/components/core/form/FormTable.js +3 -8
- package/lib/components/core/i18n/I18n.js +15 -15
- package/lib/components/core/index_definition/IndexDefinitionForm.js +32 -19
- package/lib/components/core/index_definition/IndexDefinitionTable.js +15 -24
- package/lib/components/core/index_job/IndexJobTable.js +12 -9
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +1 -1
- package/lib/components/core/space/SpaceForm.js +59 -10
- package/lib/components/core/submission/DatastoreSubmissionTable.js +31 -1
- package/lib/components/core/submission/FormSubmissionFilters.js +378 -0
- package/lib/components/core/submission/FormSubmissionTable.js +116 -0
- package/lib/components/core/submission/KappSubmissionTable.js +250 -0
- package/lib/components/core/submission/SubmissionForm.js +124 -0
- package/lib/components/core/submission/SubmissionTable.js +35 -249
- package/lib/components/core/submission/helpers.js +95 -0
- package/lib/components/core/submission/helpers.test.js +96 -0
- package/lib/components/core/translation/ContextTable.js +1 -1
- package/lib/components/core/user/UserForm.js +2 -2
- package/lib/components/core/webapi/WebApiForm.js +111 -126
- package/lib/components/core/webhook/WebhookForm.js +1 -1
- package/lib/components/form/Form.helpers.js +1 -1
- package/lib/components/form/Form.js +200 -144
- package/lib/components/index.js +16 -6
- package/lib/components/system/SystemBackgroundTasksTable.js +83 -0
- package/lib/components/system/SystemSecurityForm.js +69 -0
- package/lib/components/system/helpers.js +20 -6
- package/lib/components/system/spaces/SystemSpaceForm.js +44 -16
- package/lib/components/system/spaces/SystemTenantForm.js +15 -9
- package/lib/components/system/spaces/SystemTenantTable.js +21 -16
- package/lib/components/table/Table.js +37 -10
- package/lib/components/table/Table.redux.js +228 -57
- package/lib/components/table/Table.redux.test.js +73 -2
- package/lib/components/task/builder/Connector.js +21 -10
- package/lib/components/task/builder/ConnectorForm.js +1 -1
- package/lib/components/task/builder/Node.js +10 -3
- package/lib/components/task/builder/NodeForm.js +54 -22
- package/lib/components/task/builder/NodeParametersForm.js +5 -2
- package/lib/components/task/builder/SvgCanvas.js +13 -4
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +113 -0
- package/lib/components/task/builder/TreeBuilder.js +27 -9
- package/lib/components/task/builder/builder.redux.js +159 -52
- package/lib/components/task/builder/helpers.js +5 -3
- package/lib/components/task/builder/models.js +84 -12
- package/lib/components/task/errors/RunErrorTable.js +1 -1
- package/lib/components/task/runs/CreateManualTriggerForm.js +15 -24
- package/lib/components/task/runs/RunTable.js +5 -3
- package/lib/components/task/triggers/TriggerTable.js +3 -2
- package/lib/components/task/workflows/WorkflowForm.js +67 -85
- package/lib/helpers/index.js +19 -2
- package/lib/index.js +1 -0
- package/lib/models/discussions.js +18 -2
- package/lib/models/index.js +1 -1
- package/package.json +3 -3
- package/proxyhelper.js +19 -6
|
@@ -217,125 +217,12 @@ describe('forms api', function () {
|
|
|
217
217
|
}
|
|
218
218
|
}, _callee);
|
|
219
219
|
})));
|
|
220
|
-
test('datastore form', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
221
|
-
var _yield$createForm2, form, error, errors, serverError;
|
|
222
|
-
|
|
223
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
224
|
-
while (1) {
|
|
225
|
-
switch (_context2.prev = _context2.next) {
|
|
226
|
-
case 0:
|
|
227
|
-
axios.post.mockResolvedValue({
|
|
228
|
-
status: 200,
|
|
229
|
-
data: {
|
|
230
|
-
form: {
|
|
231
|
-
name: 'Test Datastore Form',
|
|
232
|
-
attributes: [{
|
|
233
|
-
name: 'Icon',
|
|
234
|
-
values: ['fa-gear']
|
|
235
|
-
}]
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
_context2.next = 3;
|
|
240
|
-
return createForm({
|
|
241
|
-
datastore: true,
|
|
242
|
-
form: {
|
|
243
|
-
name: 'Test Datastore Form',
|
|
244
|
-
attributes: [{
|
|
245
|
-
name: 'Icon',
|
|
246
|
-
values: ['fa-gear']
|
|
247
|
-
}]
|
|
248
|
-
},
|
|
249
|
-
include: 'attributes,pages'
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
case 3:
|
|
253
|
-
_yield$createForm2 = _context2.sent;
|
|
254
|
-
form = _yield$createForm2.form;
|
|
255
|
-
error = _yield$createForm2.error;
|
|
256
|
-
errors = _yield$createForm2.errors;
|
|
257
|
-
serverError = _yield$createForm2.serverError;
|
|
258
|
-
expect(axios.post.mock.calls).toEqual([['form/app/api/v1/datastore/forms', {
|
|
259
|
-
name: 'Test Datastore Form',
|
|
260
|
-
attributes: [{
|
|
261
|
-
name: 'Icon',
|
|
262
|
-
values: ['fa-gear']
|
|
263
|
-
}]
|
|
264
|
-
}, {
|
|
265
|
-
params: {
|
|
266
|
-
include: 'attributes,pages'
|
|
267
|
-
},
|
|
268
|
-
headers: {
|
|
269
|
-
'X-Kinetic-AuthAssumed': 'true'
|
|
270
|
-
}
|
|
271
|
-
}]]);
|
|
272
|
-
expect(form).toEqual({
|
|
273
|
-
name: 'Test Datastore Form',
|
|
274
|
-
attributes: [{
|
|
275
|
-
name: 'Icon',
|
|
276
|
-
values: ['fa-gear']
|
|
277
|
-
}]
|
|
278
|
-
});
|
|
279
|
-
expect(error).toBeUndefined();
|
|
280
|
-
expect(errors).toBeUndefined();
|
|
281
|
-
expect(serverError).toBeUndefined();
|
|
282
|
-
|
|
283
|
-
case 13:
|
|
284
|
-
case "end":
|
|
285
|
-
return _context2.stop();
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}, _callee2);
|
|
289
|
-
})));
|
|
290
|
-
test('defaults to bundle.kappSlug() when no kappSlug provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
291
|
-
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
292
|
-
while (1) {
|
|
293
|
-
switch (_context3.prev = _context3.next) {
|
|
294
|
-
case 0:
|
|
295
|
-
axios.post.mockResolvedValue({
|
|
296
|
-
status: 200,
|
|
297
|
-
data: {}
|
|
298
|
-
});
|
|
299
|
-
_context3.next = 3;
|
|
300
|
-
return createForm({
|
|
301
|
-
form: {
|
|
302
|
-
name: 'Test'
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
case 3:
|
|
307
|
-
expect(axios.post.mock.calls).toEqual([['form/app/api/v1/kapps/mock-kapp/forms', {
|
|
308
|
-
name: 'Test'
|
|
309
|
-
}, {
|
|
310
|
-
params: {},
|
|
311
|
-
headers: {
|
|
312
|
-
'X-Kinetic-AuthAssumed': 'true'
|
|
313
|
-
}
|
|
314
|
-
}]]);
|
|
315
|
-
|
|
316
|
-
case 4:
|
|
317
|
-
case "end":
|
|
318
|
-
return _context3.stop();
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}, _callee3);
|
|
322
|
-
})));
|
|
323
220
|
test('missing form', function () {
|
|
324
221
|
expect(function () {
|
|
325
222
|
createForm({});
|
|
326
223
|
}).toThrow('createForm failed! The option "form" is required.');
|
|
327
224
|
});
|
|
328
|
-
test('missing kappSlug', function () {
|
|
329
|
-
// Note that we need to set it to null becuse by default if kappSlug is
|
|
330
|
-
// not passed (undefined) it checks the 'bundle' helper.
|
|
331
|
-
expect(function () {
|
|
332
|
-
createForm({
|
|
333
|
-
form: {},
|
|
334
|
-
kappSlug: null
|
|
335
|
-
});
|
|
336
|
-
}).toThrow('createForm failed! The option "kappSlug" is required.');
|
|
337
|
-
});
|
|
338
|
-
test('missing kappSlug allowed when datastore is true', function () {
|
|
225
|
+
test('missing kappSlug allowed for space forms', function () {
|
|
339
226
|
axios.post.mockResolvedValue({
|
|
340
227
|
status: 200,
|
|
341
228
|
data: {}
|
|
@@ -343,17 +230,16 @@ describe('forms api', function () {
|
|
|
343
230
|
expect(function () {
|
|
344
231
|
createForm({
|
|
345
232
|
form: {},
|
|
346
|
-
kappSlug: null
|
|
347
|
-
datastore: true
|
|
233
|
+
kappSlug: null
|
|
348
234
|
});
|
|
349
235
|
}).not.toThrowError();
|
|
350
236
|
});
|
|
351
|
-
test('bad request', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
352
|
-
var _yield$
|
|
237
|
+
test('bad request', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
238
|
+
var _yield$createForm2, form, error;
|
|
353
239
|
|
|
354
|
-
return _regeneratorRuntime.wrap(function
|
|
240
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
355
241
|
while (1) {
|
|
356
|
-
switch (
|
|
242
|
+
switch (_context2.prev = _context2.next) {
|
|
357
243
|
case 0:
|
|
358
244
|
axios.post.mockRejectedValue(createError('Request failed with status code 400', null, 400, null, {
|
|
359
245
|
status: 400,
|
|
@@ -362,7 +248,7 @@ describe('forms api', function () {
|
|
|
362
248
|
error: 'Invalid form'
|
|
363
249
|
}
|
|
364
250
|
}));
|
|
365
|
-
|
|
251
|
+
_context2.next = 3;
|
|
366
252
|
return createForm({
|
|
367
253
|
form: {
|
|
368
254
|
name: null
|
|
@@ -370,9 +256,9 @@ describe('forms api', function () {
|
|
|
370
256
|
});
|
|
371
257
|
|
|
372
258
|
case 3:
|
|
373
|
-
_yield$
|
|
374
|
-
form = _yield$
|
|
375
|
-
error = _yield$
|
|
259
|
+
_yield$createForm2 = _context2.sent;
|
|
260
|
+
form = _yield$createForm2.form;
|
|
261
|
+
error = _yield$createForm2.error;
|
|
376
262
|
expect(form).toBeUndefined();
|
|
377
263
|
expect(error).toEqual({
|
|
378
264
|
badRequest: true,
|
|
@@ -383,24 +269,24 @@ describe('forms api', function () {
|
|
|
383
269
|
|
|
384
270
|
case 8:
|
|
385
271
|
case "end":
|
|
386
|
-
return
|
|
272
|
+
return _context2.stop();
|
|
387
273
|
}
|
|
388
274
|
}
|
|
389
|
-
},
|
|
275
|
+
}, _callee2);
|
|
390
276
|
})));
|
|
391
|
-
test('forbidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
392
|
-
var _yield$
|
|
277
|
+
test('forbidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
278
|
+
var _yield$createForm3, form, error;
|
|
393
279
|
|
|
394
|
-
return _regeneratorRuntime.wrap(function
|
|
280
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
395
281
|
while (1) {
|
|
396
|
-
switch (
|
|
282
|
+
switch (_context3.prev = _context3.next) {
|
|
397
283
|
case 0:
|
|
398
284
|
axios.post.mockRejectedValue(createError('Request failed with status code 403', null, 403, null, {
|
|
399
285
|
status: 403,
|
|
400
286
|
statusText: 'Forbidden',
|
|
401
287
|
data: {}
|
|
402
288
|
}));
|
|
403
|
-
|
|
289
|
+
_context3.next = 3;
|
|
404
290
|
return createForm({
|
|
405
291
|
form: {
|
|
406
292
|
name: 'Test'
|
|
@@ -408,9 +294,9 @@ describe('forms api', function () {
|
|
|
408
294
|
});
|
|
409
295
|
|
|
410
296
|
case 3:
|
|
411
|
-
_yield$
|
|
412
|
-
form = _yield$
|
|
413
|
-
error = _yield$
|
|
297
|
+
_yield$createForm3 = _context3.sent;
|
|
298
|
+
form = _yield$createForm3.form;
|
|
299
|
+
error = _yield$createForm3.error;
|
|
414
300
|
expect(form).toBeUndefined();
|
|
415
301
|
expect(error).toEqual({
|
|
416
302
|
statusCode: 403,
|
|
@@ -421,22 +307,22 @@ describe('forms api', function () {
|
|
|
421
307
|
|
|
422
308
|
case 8:
|
|
423
309
|
case "end":
|
|
424
|
-
return
|
|
310
|
+
return _context3.stop();
|
|
425
311
|
}
|
|
426
312
|
}
|
|
427
|
-
},
|
|
313
|
+
}, _callee3);
|
|
428
314
|
})));
|
|
429
315
|
});
|
|
430
316
|
describe('updateForm', function () {
|
|
431
317
|
beforeEach(function () {
|
|
432
318
|
axios.put.mockReset();
|
|
433
319
|
});
|
|
434
|
-
test('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
320
|
+
test('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
435
321
|
var _yield$updateForm, form, error;
|
|
436
322
|
|
|
437
|
-
return _regeneratorRuntime.wrap(function
|
|
323
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
438
324
|
while (1) {
|
|
439
|
-
switch (
|
|
325
|
+
switch (_context4.prev = _context4.next) {
|
|
440
326
|
case 0:
|
|
441
327
|
axios.put.mockResolvedValue({
|
|
442
328
|
status: 200,
|
|
@@ -450,7 +336,7 @@ describe('forms api', function () {
|
|
|
450
336
|
}
|
|
451
337
|
}
|
|
452
338
|
});
|
|
453
|
-
|
|
339
|
+
_context4.next = 3;
|
|
454
340
|
return updateForm({
|
|
455
341
|
kappSlug: 'catalog',
|
|
456
342
|
formSlug: 'test-form',
|
|
@@ -465,7 +351,7 @@ describe('forms api', function () {
|
|
|
465
351
|
});
|
|
466
352
|
|
|
467
353
|
case 3:
|
|
468
|
-
_yield$updateForm =
|
|
354
|
+
_yield$updateForm = _context4.sent;
|
|
469
355
|
form = _yield$updateForm.form;
|
|
470
356
|
error = _yield$updateForm.error;
|
|
471
357
|
expect(axios.put.mock.calls).toEqual([['form/app/api/v1/kapps/catalog/forms/test-form', {
|
|
@@ -493,111 +379,10 @@ describe('forms api', function () {
|
|
|
493
379
|
|
|
494
380
|
case 9:
|
|
495
381
|
case "end":
|
|
496
|
-
return
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}, _callee6);
|
|
500
|
-
})));
|
|
501
|
-
test('datastore form', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
502
|
-
var _yield$updateForm2, form, error;
|
|
503
|
-
|
|
504
|
-
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
505
|
-
while (1) {
|
|
506
|
-
switch (_context7.prev = _context7.next) {
|
|
507
|
-
case 0:
|
|
508
|
-
axios.put.mockResolvedValue({
|
|
509
|
-
status: 200,
|
|
510
|
-
data: {
|
|
511
|
-
form: {
|
|
512
|
-
name: 'Test Datastore Form',
|
|
513
|
-
attributes: [{
|
|
514
|
-
name: 'Icon',
|
|
515
|
-
values: ['fa-gear']
|
|
516
|
-
}]
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
_context7.next = 3;
|
|
521
|
-
return updateForm({
|
|
522
|
-
formSlug: 'test-form',
|
|
523
|
-
datastore: true,
|
|
524
|
-
form: {
|
|
525
|
-
name: 'Test Datastore Form',
|
|
526
|
-
attributes: [{
|
|
527
|
-
name: 'Icon',
|
|
528
|
-
values: ['fa-gear']
|
|
529
|
-
}]
|
|
530
|
-
},
|
|
531
|
-
include: 'attributes,pages'
|
|
532
|
-
});
|
|
533
|
-
|
|
534
|
-
case 3:
|
|
535
|
-
_yield$updateForm2 = _context7.sent;
|
|
536
|
-
form = _yield$updateForm2.form;
|
|
537
|
-
error = _yield$updateForm2.error;
|
|
538
|
-
expect(axios.put.mock.calls).toEqual([['form/app/api/v1/datastore/forms/test-form', {
|
|
539
|
-
name: 'Test Datastore Form',
|
|
540
|
-
attributes: [{
|
|
541
|
-
name: 'Icon',
|
|
542
|
-
values: ['fa-gear']
|
|
543
|
-
}]
|
|
544
|
-
}, {
|
|
545
|
-
params: {
|
|
546
|
-
include: 'attributes,pages'
|
|
547
|
-
},
|
|
548
|
-
headers: {
|
|
549
|
-
'X-Kinetic-AuthAssumed': 'true'
|
|
550
|
-
}
|
|
551
|
-
}]]);
|
|
552
|
-
expect(form).toEqual({
|
|
553
|
-
name: 'Test Datastore Form',
|
|
554
|
-
attributes: [{
|
|
555
|
-
name: 'Icon',
|
|
556
|
-
values: ['fa-gear']
|
|
557
|
-
}]
|
|
558
|
-
});
|
|
559
|
-
expect(error).toBeUndefined();
|
|
560
|
-
|
|
561
|
-
case 9:
|
|
562
|
-
case "end":
|
|
563
|
-
return _context7.stop();
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}, _callee7);
|
|
567
|
-
})));
|
|
568
|
-
test('defaults to bundle.kappSlug() when no kappSlug provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
569
|
-
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
570
|
-
while (1) {
|
|
571
|
-
switch (_context8.prev = _context8.next) {
|
|
572
|
-
case 0:
|
|
573
|
-
axios.put.mockResolvedValue({
|
|
574
|
-
status: 200,
|
|
575
|
-
data: {}
|
|
576
|
-
});
|
|
577
|
-
_context8.next = 3;
|
|
578
|
-
return updateForm({
|
|
579
|
-
form: {
|
|
580
|
-
name: 'Test'
|
|
581
|
-
},
|
|
582
|
-
formSlug: 'test'
|
|
583
|
-
});
|
|
584
|
-
|
|
585
|
-
case 3:
|
|
586
|
-
expect(axios.put.mock.calls).toEqual([['form/app/api/v1/kapps/mock-kapp/forms/test', {
|
|
587
|
-
name: 'Test'
|
|
588
|
-
}, {
|
|
589
|
-
params: {},
|
|
590
|
-
headers: {
|
|
591
|
-
'X-Kinetic-AuthAssumed': 'true'
|
|
592
|
-
}
|
|
593
|
-
}]]);
|
|
594
|
-
|
|
595
|
-
case 4:
|
|
596
|
-
case "end":
|
|
597
|
-
return _context8.stop();
|
|
382
|
+
return _context4.stop();
|
|
598
383
|
}
|
|
599
384
|
}
|
|
600
|
-
},
|
|
385
|
+
}, _callee4);
|
|
601
386
|
})));
|
|
602
387
|
test('missing form', function () {
|
|
603
388
|
expect(function () {
|
|
@@ -606,18 +391,7 @@ describe('forms api', function () {
|
|
|
606
391
|
});
|
|
607
392
|
}).toThrow('updateForm failed! The option "form" is required.');
|
|
608
393
|
});
|
|
609
|
-
test('missing kappSlug', function () {
|
|
610
|
-
// Note that we need to set it to null becuse by default if kappSlug is
|
|
611
|
-
// not passed (undefined) it checks the 'bundle' helper.
|
|
612
|
-
expect(function () {
|
|
613
|
-
updateForm({
|
|
614
|
-
formSlug: 'test',
|
|
615
|
-
form: {},
|
|
616
|
-
kappSlug: null
|
|
617
|
-
});
|
|
618
|
-
}).toThrow('updateForm failed! The option "kappSlug" is required.');
|
|
619
|
-
});
|
|
620
|
-
test('missing kappSlug allowed when datastore is true', function () {
|
|
394
|
+
test('missing kappSlug allowed for space forms', function () {
|
|
621
395
|
axios.put.mockResolvedValue({
|
|
622
396
|
status: 200,
|
|
623
397
|
data: {}
|
|
@@ -626,8 +400,7 @@ describe('forms api', function () {
|
|
|
626
400
|
updateForm({
|
|
627
401
|
formSlug: 'test',
|
|
628
402
|
form: {},
|
|
629
|
-
kappSlug: null
|
|
630
|
-
datastore: true
|
|
403
|
+
kappSlug: null
|
|
631
404
|
});
|
|
632
405
|
}).not.toThrowError();
|
|
633
406
|
});
|
|
@@ -638,12 +411,12 @@ describe('forms api', function () {
|
|
|
638
411
|
});
|
|
639
412
|
}).toThrow('updateForm failed! The option "formSlug" is required.');
|
|
640
413
|
});
|
|
641
|
-
test('bad request', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
642
|
-
var _yield$
|
|
414
|
+
test('bad request', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
415
|
+
var _yield$updateForm2, form, error;
|
|
643
416
|
|
|
644
|
-
return _regeneratorRuntime.wrap(function
|
|
417
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
645
418
|
while (1) {
|
|
646
|
-
switch (
|
|
419
|
+
switch (_context5.prev = _context5.next) {
|
|
647
420
|
case 0:
|
|
648
421
|
axios.put.mockRejectedValue(createError('Request failed with status code 400', null, 400, null, {
|
|
649
422
|
status: 400,
|
|
@@ -652,7 +425,7 @@ describe('forms api', function () {
|
|
|
652
425
|
error: 'Invalid form'
|
|
653
426
|
}
|
|
654
427
|
}));
|
|
655
|
-
|
|
428
|
+
_context5.next = 3;
|
|
656
429
|
return updateForm({
|
|
657
430
|
formSlug: 'test',
|
|
658
431
|
form: {
|
|
@@ -661,9 +434,9 @@ describe('forms api', function () {
|
|
|
661
434
|
});
|
|
662
435
|
|
|
663
436
|
case 3:
|
|
664
|
-
_yield$
|
|
665
|
-
form = _yield$
|
|
666
|
-
error = _yield$
|
|
437
|
+
_yield$updateForm2 = _context5.sent;
|
|
438
|
+
form = _yield$updateForm2.form;
|
|
439
|
+
error = _yield$updateForm2.error;
|
|
667
440
|
expect(form).toBeUndefined();
|
|
668
441
|
expect(error).toEqual({
|
|
669
442
|
badRequest: true,
|
|
@@ -674,24 +447,24 @@ describe('forms api', function () {
|
|
|
674
447
|
|
|
675
448
|
case 8:
|
|
676
449
|
case "end":
|
|
677
|
-
return
|
|
450
|
+
return _context5.stop();
|
|
678
451
|
}
|
|
679
452
|
}
|
|
680
|
-
},
|
|
453
|
+
}, _callee5);
|
|
681
454
|
})));
|
|
682
|
-
test('serverError', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
683
|
-
var _yield$
|
|
455
|
+
test('serverError', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
456
|
+
var _yield$updateForm3, form, error;
|
|
684
457
|
|
|
685
|
-
return _regeneratorRuntime.wrap(function
|
|
458
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
686
459
|
while (1) {
|
|
687
|
-
switch (
|
|
460
|
+
switch (_context6.prev = _context6.next) {
|
|
688
461
|
case 0:
|
|
689
462
|
axios.put.mockRejectedValue(createError('Request failed with status code 403', null, 403, null, {
|
|
690
463
|
status: 403,
|
|
691
464
|
statusText: 'Forbidden',
|
|
692
465
|
data: {}
|
|
693
466
|
}));
|
|
694
|
-
|
|
467
|
+
_context6.next = 3;
|
|
695
468
|
return updateForm({
|
|
696
469
|
formSlug: 'test',
|
|
697
470
|
form: {
|
|
@@ -700,9 +473,9 @@ describe('forms api', function () {
|
|
|
700
473
|
});
|
|
701
474
|
|
|
702
475
|
case 3:
|
|
703
|
-
_yield$
|
|
704
|
-
form = _yield$
|
|
705
|
-
error = _yield$
|
|
476
|
+
_yield$updateForm3 = _context6.sent;
|
|
477
|
+
form = _yield$updateForm3.form;
|
|
478
|
+
error = _yield$updateForm3.error;
|
|
706
479
|
expect(form).toBeUndefined();
|
|
707
480
|
expect(error).toEqual({
|
|
708
481
|
forbidden: true,
|
|
@@ -713,10 +486,10 @@ describe('forms api', function () {
|
|
|
713
486
|
|
|
714
487
|
case 8:
|
|
715
488
|
case "end":
|
|
716
|
-
return
|
|
489
|
+
return _context6.stop();
|
|
717
490
|
}
|
|
718
491
|
}
|
|
719
|
-
},
|
|
492
|
+
}, _callee6);
|
|
720
493
|
})));
|
|
721
494
|
});
|
|
722
495
|
});
|
|
@@ -31,7 +31,7 @@ describe('securityPolicyDefinitions api', function () {
|
|
|
31
31
|
securityPolicyDefinitions: [{
|
|
32
32
|
message: 'Must be an administrator.',
|
|
33
33
|
name: 'Admins',
|
|
34
|
-
rule: "/* \n * Space admins are allowed access regardless of the
|
|
34
|
+
rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
|
|
35
35
|
type: 'Space'
|
|
36
36
|
}, {
|
|
37
37
|
message: 'Must be authenticated.',
|
|
@@ -61,7 +61,7 @@ describe('securityPolicyDefinitions api', function () {
|
|
|
61
61
|
securityPolicyDefinitions: [{
|
|
62
62
|
message: 'Must be an administrator.',
|
|
63
63
|
name: 'Admins',
|
|
64
|
-
rule: "/* \n * Space admins are allowed access regardless of the
|
|
64
|
+
rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
|
|
65
65
|
type: 'Space'
|
|
66
66
|
}, {
|
|
67
67
|
message: 'Must be authenticated.',
|
|
@@ -95,7 +95,7 @@ describe('securityPolicyDefinitions api', function () {
|
|
|
95
95
|
securityPolicyDefinitions: [{
|
|
96
96
|
message: 'Must be an administrator.',
|
|
97
97
|
name: 'Admins',
|
|
98
|
-
rule: "/* \n * Space admins are allowed access regardless of the
|
|
98
|
+
rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
|
|
99
99
|
type: 'Kapp'
|
|
100
100
|
}, {
|
|
101
101
|
message: 'Must be authenticated.',
|
|
@@ -132,7 +132,7 @@ describe('securityPolicyDefinitions api', function () {
|
|
|
132
132
|
securityPolicyDefinitions: [{
|
|
133
133
|
message: 'Must be an administrator.',
|
|
134
134
|
name: 'Admins',
|
|
135
|
-
rule: "/* \n * Space admins are allowed access regardless of the
|
|
135
|
+
rule: "/* \n * Space admins are allowed access regardless of the result of security \n * policies. Returning 'false' denies anyone but a space access. \n */\nfalse",
|
|
136
136
|
type: 'Kapp'
|
|
137
137
|
}, {
|
|
138
138
|
message: 'Must be authenticated.',
|
|
@@ -5,7 +5,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import qs from 'qs';
|
|
7
7
|
import { bundle } from '../../helpers';
|
|
8
|
-
import { handleErrors, headerBuilder, paramBuilder } from '../http';
|
|
8
|
+
import { handleErrors, headerBuilder, paramBuilder } from '../http'; // TODO: datastore is deprecated, remove datastore routes from paths.
|
|
9
|
+
|
|
9
10
|
export var VALID_TIMELINES = ['closedAt', 'createdAt', 'submittedAt', 'updatedAt'];
|
|
10
11
|
export var VALID_KAPP_CORE_STATES = ['Draft', 'Submitted', 'Closed'];
|
|
11
12
|
export var VALID_DS_CORE_STATES = ['Draft', 'Submitted'];
|
|
@@ -298,9 +299,7 @@ export var SubmissionSearch = /*#__PURE__*/function () {
|
|
|
298
299
|
}, {
|
|
299
300
|
key: "includes",
|
|
300
301
|
value: function includes(_includes) {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
this.searchMeta.include = newIncludes; // _.uniq(_.concat(this.searchMeta.include, includes));
|
|
302
|
+
this.searchMeta.include = _toConsumableArray(new Set([].concat(_toConsumableArray(this.searchMeta.include), _toConsumableArray(_includes)))); // _.uniq(_.concat(this.searchMeta.include, includes));
|
|
304
303
|
|
|
305
304
|
return this;
|
|
306
305
|
}
|
|
@@ -413,16 +412,8 @@ export var SubmissionSearch = /*#__PURE__*/function () {
|
|
|
413
412
|
export var searchSubmissions = function searchSubmissions(options) {
|
|
414
413
|
var kapp = options.kapp,
|
|
415
414
|
form = options.form,
|
|
416
|
-
search = options.search
|
|
417
|
-
|
|
418
|
-
datastore = _options$datastore === void 0 ? false : _options$datastore;
|
|
419
|
-
var kappSlug = datastore ? null : kapp ? kapp : bundle.kappSlug();
|
|
420
|
-
|
|
421
|
-
if (datastore && !form) {
|
|
422
|
-
throw new Error('Datastore searches must be scoped to a form.');
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
var path = datastore ? "".concat(bundle.apiLocation(), "/datastore/forms/").concat(form, "/submissions") : form ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/forms/").concat(form, "/submissions") : "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/submissions");
|
|
415
|
+
search = options.search;
|
|
416
|
+
var path = kapp ? form ? "".concat(bundle.apiLocation(), "/kapps/").concat(kapp, "/forms/").concat(form, "/submissions") : "".concat(bundle.apiLocation(), "/kapps/").concat(kapp, "/submissions") : form ? "".concat(bundle.apiLocation(), "/datastore/forms/").concat(form, "/submissions") : "".concat(bundle.apiLocation(), "/submissions");
|
|
426
417
|
|
|
427
418
|
var meta = _objectSpread({}, search); // Format includes.
|
|
428
419
|
|
|
@@ -461,14 +452,13 @@ export var searchSubmissions = function searchSubmissions(options) {
|
|
|
461
452
|
return promise;
|
|
462
453
|
};
|
|
463
454
|
export var fetchSubmission = function fetchSubmission(options) {
|
|
464
|
-
var id = options.id
|
|
465
|
-
datastore = options.datastore;
|
|
455
|
+
var id = options.id;
|
|
466
456
|
|
|
467
457
|
if (!id) {
|
|
468
458
|
throw new Error('fetchSubmission failed! The option "id" is required.');
|
|
469
459
|
}
|
|
470
460
|
|
|
471
|
-
var path = datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
461
|
+
var path = options.datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
472
462
|
return axios.get(path, {
|
|
473
463
|
params: paramBuilder(options),
|
|
474
464
|
headers: headerBuilder(options)
|
|
@@ -486,10 +476,10 @@ export var createSubmission = function createSubmission(options) {
|
|
|
486
476
|
kappSlug = _options$kappSlug === void 0 ? bundle.kappSlug() : _options$kappSlug,
|
|
487
477
|
formSlug = options.formSlug,
|
|
488
478
|
values = options.values,
|
|
489
|
-
_options$datastore2 = options.datastore,
|
|
490
|
-
datastore = _options$datastore2 === void 0 ? false : _options$datastore2,
|
|
491
479
|
_options$completed = options.completed,
|
|
492
|
-
completed = _options$completed === void 0 ? true : _options$completed
|
|
480
|
+
completed = _options$completed === void 0 ? true : _options$completed,
|
|
481
|
+
coreState = options.coreState,
|
|
482
|
+
parent = options.parent;
|
|
493
483
|
|
|
494
484
|
if (!formSlug) {
|
|
495
485
|
throw new Error('createSubmission failed! The option "formSlug" is required.');
|
|
@@ -497,10 +487,12 @@ export var createSubmission = function createSubmission(options) {
|
|
|
497
487
|
throw new Error('createSubmission failed! The option "values" is required.');
|
|
498
488
|
}
|
|
499
489
|
|
|
500
|
-
var path =
|
|
490
|
+
var path = kappSlug ? "".concat(bundle.apiLocation(), "/kapps/").concat(kappSlug, "/forms/").concat(formSlug, "/submissions") : "".concat(bundle.apiLocation(), "/datastore/forms/").concat(formSlug, "/submissions");
|
|
501
491
|
|
|
502
492
|
var params = _objectSpread(_objectSpread({}, paramBuilder(options)), {}, {
|
|
503
|
-
completed: completed
|
|
493
|
+
completed: completed,
|
|
494
|
+
coreState: coreState,
|
|
495
|
+
parent: parent
|
|
504
496
|
});
|
|
505
497
|
|
|
506
498
|
return axios.post(path, {
|
|
@@ -519,10 +511,8 @@ export var createSubmission = function createSubmission(options) {
|
|
|
519
511
|
};
|
|
520
512
|
export var updateSubmission = function updateSubmission(options) {
|
|
521
513
|
var id = options.id,
|
|
522
|
-
values = options.values
|
|
523
|
-
|
|
524
|
-
datastore = _options$datastore3 === void 0 ? false : _options$datastore3;
|
|
525
|
-
var path = datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
514
|
+
values = options.values;
|
|
515
|
+
var path = options.datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
526
516
|
|
|
527
517
|
var params = _objectSpread({}, paramBuilder(options));
|
|
528
518
|
|
|
@@ -540,16 +530,42 @@ export var updateSubmission = function updateSubmission(options) {
|
|
|
540
530
|
// cleans up any errors.
|
|
541
531
|
["catch"](handleErrors);
|
|
542
532
|
};
|
|
543
|
-
export var
|
|
533
|
+
export var submitSubmission = function submitSubmission(options) {
|
|
544
534
|
var id = options.id,
|
|
545
|
-
|
|
546
|
-
|
|
535
|
+
values = options.values,
|
|
536
|
+
page = options.page,
|
|
537
|
+
staged = options.staged,
|
|
538
|
+
defer = options.defer;
|
|
539
|
+
var path = options.datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
540
|
+
|
|
541
|
+
var params = _objectSpread(_objectSpread({}, paramBuilder(options)), {}, {
|
|
542
|
+
page: page,
|
|
543
|
+
staged: staged,
|
|
544
|
+
defer: defer
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
return axios.post(path, {
|
|
548
|
+
values: values
|
|
549
|
+
}, {
|
|
550
|
+
params: params,
|
|
551
|
+
headers: headerBuilder(options)
|
|
552
|
+
}) // Remove the response envelop and leave us with the submission one.
|
|
553
|
+
.then(function (response) {
|
|
554
|
+
return {
|
|
555
|
+
submission: response.data.submission
|
|
556
|
+
};
|
|
557
|
+
}) // Clean up any errors we receive. Make sure this the last thing so that it
|
|
558
|
+
// cleans up any errors.
|
|
559
|
+
["catch"](handleErrors);
|
|
560
|
+
};
|
|
561
|
+
export var deleteSubmission = function deleteSubmission(options) {
|
|
562
|
+
var id = options.id;
|
|
547
563
|
|
|
548
564
|
if (!id) {
|
|
549
565
|
throw new Error('deleteSubmission failed! The option "id" is required.');
|
|
550
566
|
}
|
|
551
567
|
|
|
552
|
-
var path = datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
568
|
+
var path = options.datastore ? "".concat(bundle.apiLocation(), "/datastore/submissions/").concat(id) : "".concat(bundle.apiLocation(), "/submissions/").concat(id);
|
|
553
569
|
return axios["delete"](path, {
|
|
554
570
|
params: paramBuilder(options),
|
|
555
571
|
headers: headerBuilder(options)
|