@conform-to/dom 0.6.3 → 0.7.0-pre.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/{module/_virtual/_rollupPluginBabelHelpers.js → _virtual/_rollupPluginBabelHelpers.cjs} +8 -1
- package/_virtual/_rollupPluginBabelHelpers.js +1 -8
- package/{module/dom.js → dom.cjs} +15 -1
- package/dom.js +1 -15
- package/{module/formdata.js → formdata.cjs} +11 -1
- package/formdata.js +1 -11
- package/index.cjs +36 -0
- package/index.js +4 -36
- package/{module/intent.js → intent.cjs} +16 -4
- package/intent.js +4 -16
- package/package.json +14 -3
- package/parse.cjs +37 -0
- package/parse.js +10 -14
- package/module/index.js +0 -4
- package/module/parse.js +0 -33
package/{module/_virtual/_rollupPluginBabelHelpers.js → _virtual/_rollupPluginBabelHelpers.cjs}
RENAMED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
1
5
|
function ownKeys(object, enumerableOnly) {
|
|
2
6
|
var keys = Object.keys(object);
|
|
3
7
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -48,4 +52,7 @@ function _toPropertyKey(arg) {
|
|
|
48
52
|
return typeof key === "symbol" ? key : String(key);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
|
|
55
|
+
exports.defineProperty = _defineProperty;
|
|
56
|
+
exports.objectSpread2 = _objectSpread2;
|
|
57
|
+
exports.toPrimitive = _toPrimitive;
|
|
58
|
+
exports.toPropertyKey = _toPropertyKey;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
1
|
function ownKeys(object, enumerableOnly) {
|
|
6
2
|
var keys = Object.keys(object);
|
|
7
3
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -52,7 +48,4 @@ function _toPropertyKey(arg) {
|
|
|
52
48
|
return typeof key === "symbol" ? key : String(key);
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
exports.objectSpread2 = _objectSpread2;
|
|
57
|
-
exports.toPrimitive = _toPrimitive;
|
|
58
|
-
exports.toPropertyKey = _toPropertyKey;
|
|
51
|
+
export { _defineProperty as defineProperty, _objectSpread2 as objectSpread2, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* A type guard to check if the provided reference is a form control element, including
|
|
3
7
|
* `input`, `select`, `textarea` or `button`
|
|
@@ -152,4 +156,14 @@ function focusFormControl(form, name) {
|
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
|
|
159
|
+
exports.createSubmitter = createSubmitter;
|
|
160
|
+
exports.focusFirstInvalidControl = focusFirstInvalidControl;
|
|
161
|
+
exports.focusFormControl = focusFormControl;
|
|
162
|
+
exports.getFormAction = getFormAction;
|
|
163
|
+
exports.getFormControls = getFormControls;
|
|
164
|
+
exports.getFormElement = getFormElement;
|
|
165
|
+
exports.getFormEncType = getFormEncType;
|
|
166
|
+
exports.getFormMethod = getFormMethod;
|
|
167
|
+
exports.isFocusableFormControl = isFocusableFormControl;
|
|
168
|
+
exports.isFormControl = isFormControl;
|
|
169
|
+
exports.requestSubmit = requestSubmit;
|
package/dom.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
2
|
* A type guard to check if the provided reference is a form control element, including
|
|
7
3
|
* `input`, `select`, `textarea` or `button`
|
|
@@ -156,14 +152,4 @@ function focusFormControl(form, name) {
|
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
154
|
|
|
159
|
-
|
|
160
|
-
exports.focusFirstInvalidControl = focusFirstInvalidControl;
|
|
161
|
-
exports.focusFormControl = focusFormControl;
|
|
162
|
-
exports.getFormAction = getFormAction;
|
|
163
|
-
exports.getFormControls = getFormControls;
|
|
164
|
-
exports.getFormElement = getFormElement;
|
|
165
|
-
exports.getFormEncType = getFormEncType;
|
|
166
|
-
exports.getFormMethod = getFormMethod;
|
|
167
|
-
exports.isFocusableFormControl = isFocusableFormControl;
|
|
168
|
-
exports.isFormControl = isFormControl;
|
|
169
|
-
exports.requestSubmit = requestSubmit;
|
|
155
|
+
export { createSubmitter, focusFirstInvalidControl, focusFormControl, getFormAction, getFormControls, getFormElement, getFormEncType, getFormMethod, isFocusableFormControl, isFormControl, requestSubmit };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* A ponyfill-like helper to get the form data with the submitter value.
|
|
3
7
|
* It does not respect the tree order nor handles the image input.
|
|
@@ -114,4 +118,10 @@ function getErrors(validationMessage) {
|
|
|
114
118
|
return validationMessage.split(String.fromCharCode(31));
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
exports.formatPaths = formatPaths;
|
|
122
|
+
exports.getErrors = getErrors;
|
|
123
|
+
exports.getFormData = getFormData;
|
|
124
|
+
exports.getPaths = getPaths;
|
|
125
|
+
exports.getValidationMessage = getValidationMessage;
|
|
126
|
+
exports.resolve = resolve;
|
|
127
|
+
exports.setValue = setValue;
|
package/formdata.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
2
|
* A ponyfill-like helper to get the form data with the submitter value.
|
|
7
3
|
* It does not respect the tree order nor handles the image input.
|
|
@@ -118,10 +114,4 @@ function getErrors(validationMessage) {
|
|
|
118
114
|
return validationMessage.split(String.fromCharCode(31));
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
exports.getErrors = getErrors;
|
|
123
|
-
exports.getFormData = getFormData;
|
|
124
|
-
exports.getPaths = getPaths;
|
|
125
|
-
exports.getValidationMessage = getValidationMessage;
|
|
126
|
-
exports.resolve = resolve;
|
|
127
|
-
exports.setValue = setValue;
|
|
117
|
+
export { formatPaths, getErrors, getFormData, getPaths, getValidationMessage, resolve, setValue };
|
package/index.cjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dom = require('./dom.cjs');
|
|
6
|
+
var formdata = require('./formdata.cjs');
|
|
7
|
+
var intent = require('./intent.cjs');
|
|
8
|
+
var parse = require('./parse.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.createSubmitter = dom.createSubmitter;
|
|
13
|
+
exports.focusFirstInvalidControl = dom.focusFirstInvalidControl;
|
|
14
|
+
exports.focusFormControl = dom.focusFormControl;
|
|
15
|
+
exports.getFormAction = dom.getFormAction;
|
|
16
|
+
exports.getFormControls = dom.getFormControls;
|
|
17
|
+
exports.getFormElement = dom.getFormElement;
|
|
18
|
+
exports.getFormEncType = dom.getFormEncType;
|
|
19
|
+
exports.getFormMethod = dom.getFormMethod;
|
|
20
|
+
exports.isFieldElement = dom.isFormControl;
|
|
21
|
+
exports.isFocusableFormControl = dom.isFocusableFormControl;
|
|
22
|
+
exports.requestSubmit = dom.requestSubmit;
|
|
23
|
+
exports.getErrors = formdata.getErrors;
|
|
24
|
+
exports.getFormData = formdata.getFormData;
|
|
25
|
+
exports.getName = formdata.formatPaths;
|
|
26
|
+
exports.getPaths = formdata.getPaths;
|
|
27
|
+
exports.getValidationMessage = formdata.getValidationMessage;
|
|
28
|
+
exports.INTENT = intent.INTENT;
|
|
29
|
+
exports.getScope = intent.getScope;
|
|
30
|
+
exports.isSubmitting = intent.isSubmitting;
|
|
31
|
+
exports.list = intent.list;
|
|
32
|
+
exports.parseListCommand = intent.parseListCommand;
|
|
33
|
+
exports.requestIntent = intent.requestIntent;
|
|
34
|
+
exports.updateList = intent.updateList;
|
|
35
|
+
exports.validate = intent.validate;
|
|
36
|
+
exports.parse = parse.parse;
|
package/index.js
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var dom = require('./dom.js');
|
|
6
|
-
var formdata = require('./formdata.js');
|
|
7
|
-
var intent = require('./intent.js');
|
|
8
|
-
var parse = require('./parse.js');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.createSubmitter = dom.createSubmitter;
|
|
13
|
-
exports.focusFirstInvalidControl = dom.focusFirstInvalidControl;
|
|
14
|
-
exports.focusFormControl = dom.focusFormControl;
|
|
15
|
-
exports.getFormAction = dom.getFormAction;
|
|
16
|
-
exports.getFormControls = dom.getFormControls;
|
|
17
|
-
exports.getFormElement = dom.getFormElement;
|
|
18
|
-
exports.getFormEncType = dom.getFormEncType;
|
|
19
|
-
exports.getFormMethod = dom.getFormMethod;
|
|
20
|
-
exports.isFieldElement = dom.isFormControl;
|
|
21
|
-
exports.isFocusableFormControl = dom.isFocusableFormControl;
|
|
22
|
-
exports.requestSubmit = dom.requestSubmit;
|
|
23
|
-
exports.getErrors = formdata.getErrors;
|
|
24
|
-
exports.getFormData = formdata.getFormData;
|
|
25
|
-
exports.getName = formdata.formatPaths;
|
|
26
|
-
exports.getPaths = formdata.getPaths;
|
|
27
|
-
exports.getValidationMessage = formdata.getValidationMessage;
|
|
28
|
-
exports.INTENT = intent.INTENT;
|
|
29
|
-
exports.getScope = intent.getScope;
|
|
30
|
-
exports.isSubmitting = intent.isSubmitting;
|
|
31
|
-
exports.list = intent.list;
|
|
32
|
-
exports.parseListCommand = intent.parseListCommand;
|
|
33
|
-
exports.requestIntent = intent.requestIntent;
|
|
34
|
-
exports.updateList = intent.updateList;
|
|
35
|
-
exports.validate = intent.validate;
|
|
36
|
-
exports.parse = parse.parse;
|
|
1
|
+
export { createSubmitter, focusFirstInvalidControl, focusFormControl, getFormAction, getFormControls, getFormElement, getFormEncType, getFormMethod, isFormControl as isFieldElement, isFocusableFormControl, requestSubmit } from './dom.js';
|
|
2
|
+
export { getErrors, getFormData, formatPaths as getName, getPaths, getValidationMessage } from './formdata.js';
|
|
3
|
+
export { INTENT, getScope, isSubmitting, list, parseListCommand, requestIntent, updateList, validate } from './intent.js';
|
|
4
|
+
export { parse } from './parse.js';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var dom = require('./dom.cjs');
|
|
2
6
|
|
|
3
7
|
var INTENT = '__intent__';
|
|
4
8
|
|
|
@@ -36,13 +40,13 @@ function requestIntent(form, buttonProps) {
|
|
|
36
40
|
console.warn('No form element is provided');
|
|
37
41
|
return;
|
|
38
42
|
}
|
|
39
|
-
var submitter = createSubmitter({
|
|
43
|
+
var submitter = dom.createSubmitter({
|
|
40
44
|
name: INTENT,
|
|
41
45
|
value: buttonProps.value,
|
|
42
46
|
hidden: true,
|
|
43
47
|
formNoValidate: buttonProps.formNoValidate
|
|
44
48
|
});
|
|
45
|
-
requestSubmit(form, submitter);
|
|
49
|
+
dom.requestSubmit(form, submitter);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
/**
|
|
@@ -118,4 +122,12 @@ function updateList(list, command) {
|
|
|
118
122
|
return list;
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
exports.INTENT = INTENT;
|
|
126
|
+
exports.getIntent = getIntent;
|
|
127
|
+
exports.getScope = getScope;
|
|
128
|
+
exports.isSubmitting = isSubmitting;
|
|
129
|
+
exports.list = list;
|
|
130
|
+
exports.parseListCommand = parseListCommand;
|
|
131
|
+
exports.requestIntent = requestIntent;
|
|
132
|
+
exports.updateList = updateList;
|
|
133
|
+
exports.validate = validate;
|
package/intent.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var dom = require('./dom.js');
|
|
1
|
+
import { createSubmitter, requestSubmit } from './dom.js';
|
|
6
2
|
|
|
7
3
|
var INTENT = '__intent__';
|
|
8
4
|
|
|
@@ -40,13 +36,13 @@ function requestIntent(form, buttonProps) {
|
|
|
40
36
|
console.warn('No form element is provided');
|
|
41
37
|
return;
|
|
42
38
|
}
|
|
43
|
-
var submitter =
|
|
39
|
+
var submitter = createSubmitter({
|
|
44
40
|
name: INTENT,
|
|
45
41
|
value: buttonProps.value,
|
|
46
42
|
hidden: true,
|
|
47
43
|
formNoValidate: buttonProps.formNoValidate
|
|
48
44
|
});
|
|
49
|
-
|
|
45
|
+
requestSubmit(form, submitter);
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
/**
|
|
@@ -122,12 +118,4 @@ function updateList(list, command) {
|
|
|
122
118
|
return list;
|
|
123
119
|
}
|
|
124
120
|
|
|
125
|
-
|
|
126
|
-
exports.getIntent = getIntent;
|
|
127
|
-
exports.getScope = getScope;
|
|
128
|
-
exports.isSubmitting = isSubmitting;
|
|
129
|
-
exports.list = list;
|
|
130
|
-
exports.parseListCommand = parseListCommand;
|
|
131
|
-
exports.requestIntent = requestIntent;
|
|
132
|
-
exports.updateList = updateList;
|
|
133
|
-
exports.validate = validate;
|
|
121
|
+
export { INTENT, getIntent, getScope, isSubmitting, list, parseListCommand, requestIntent, updateList, validate };
|
package/package.json
CHANGED
|
@@ -3,9 +3,20 @@
|
|
|
3
3
|
"description": "A set of opinionated helpers built on top of the Constraint Validation API",
|
|
4
4
|
"homepage": "https://conform.guide",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
7
|
-
"
|
|
8
|
-
"
|
|
6
|
+
"version": "0.7.0-pre.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "index.cjs",
|
|
9
|
+
"module": "index.js",
|
|
10
|
+
"types": "index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"module": "./index.js",
|
|
15
|
+
"import": "./index.js",
|
|
16
|
+
"require": "./index.cjs",
|
|
17
|
+
"default": "./index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
9
20
|
"repository": {
|
|
10
21
|
"type": "git",
|
|
11
22
|
"url": "https://github.com/edmundhung/conform",
|
package/parse.cjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.cjs');
|
|
6
|
+
var formdata = require('./formdata.cjs');
|
|
7
|
+
var intent = require('./intent.cjs');
|
|
8
|
+
|
|
9
|
+
function parse(payload, options) {
|
|
10
|
+
var submission = {
|
|
11
|
+
intent: intent.getIntent(payload),
|
|
12
|
+
payload: formdata.resolve(payload),
|
|
13
|
+
error: {}
|
|
14
|
+
};
|
|
15
|
+
var command = intent.parseListCommand(submission.intent);
|
|
16
|
+
if (command) {
|
|
17
|
+
formdata.setValue(submission.payload, command.scope, list => {
|
|
18
|
+
if (typeof list !== 'undefined' && !Array.isArray(list)) {
|
|
19
|
+
throw new Error('The list command can only be applied to a list');
|
|
20
|
+
}
|
|
21
|
+
return intent.updateList(list !== null && list !== void 0 ? list : [], command);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.resolve) === 'undefined') {
|
|
25
|
+
return submission;
|
|
26
|
+
}
|
|
27
|
+
var result = options.resolve(submission.payload, submission.intent);
|
|
28
|
+
var mergeResolveResult = resolved => {
|
|
29
|
+
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, submission), resolved);
|
|
30
|
+
};
|
|
31
|
+
if (result instanceof Promise) {
|
|
32
|
+
return result.then(mergeResolveResult);
|
|
33
|
+
}
|
|
34
|
+
return mergeResolveResult(result);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
exports.parse = parse;
|
package/parse.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
|
|
6
|
-
var formdata = require('./formdata.js');
|
|
7
|
-
var intent = require('./intent.js');
|
|
1
|
+
import { objectSpread2 as _objectSpread2 } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { resolve, setValue } from './formdata.js';
|
|
3
|
+
import { getIntent, parseListCommand, updateList } from './intent.js';
|
|
8
4
|
|
|
9
5
|
function parse(payload, options) {
|
|
10
6
|
var submission = {
|
|
11
|
-
intent:
|
|
12
|
-
payload:
|
|
7
|
+
intent: getIntent(payload),
|
|
8
|
+
payload: resolve(payload),
|
|
13
9
|
error: {}
|
|
14
10
|
};
|
|
15
|
-
var command =
|
|
11
|
+
var command = parseListCommand(submission.intent);
|
|
16
12
|
if (command) {
|
|
17
|
-
|
|
13
|
+
setValue(submission.payload, command.scope, list => {
|
|
18
14
|
if (typeof list !== 'undefined' && !Array.isArray(list)) {
|
|
19
15
|
throw new Error('The list command can only be applied to a list');
|
|
20
16
|
}
|
|
21
|
-
return
|
|
17
|
+
return updateList(list !== null && list !== void 0 ? list : [], command);
|
|
22
18
|
});
|
|
23
19
|
}
|
|
24
20
|
if (typeof (options === null || options === void 0 ? void 0 : options.resolve) === 'undefined') {
|
|
@@ -26,7 +22,7 @@ function parse(payload, options) {
|
|
|
26
22
|
}
|
|
27
23
|
var result = options.resolve(submission.payload, submission.intent);
|
|
28
24
|
var mergeResolveResult = resolved => {
|
|
29
|
-
return
|
|
25
|
+
return _objectSpread2(_objectSpread2({}, submission), resolved);
|
|
30
26
|
};
|
|
31
27
|
if (result instanceof Promise) {
|
|
32
28
|
return result.then(mergeResolveResult);
|
|
@@ -34,4 +30,4 @@ function parse(payload, options) {
|
|
|
34
30
|
return mergeResolveResult(result);
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
export { parse };
|
package/module/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { createSubmitter, focusFirstInvalidControl, focusFormControl, getFormAction, getFormControls, getFormElement, getFormEncType, getFormMethod, isFormControl as isFieldElement, isFocusableFormControl, requestSubmit } from './dom.js';
|
|
2
|
-
export { getErrors, getFormData, formatPaths as getName, getPaths, getValidationMessage } from './formdata.js';
|
|
3
|
-
export { INTENT, getScope, isSubmitting, list, parseListCommand, requestIntent, updateList, validate } from './intent.js';
|
|
4
|
-
export { parse } from './parse.js';
|
package/module/parse.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { objectSpread2 as _objectSpread2 } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { resolve, setValue } from './formdata.js';
|
|
3
|
-
import { getIntent, parseListCommand, updateList } from './intent.js';
|
|
4
|
-
|
|
5
|
-
function parse(payload, options) {
|
|
6
|
-
var submission = {
|
|
7
|
-
intent: getIntent(payload),
|
|
8
|
-
payload: resolve(payload),
|
|
9
|
-
error: {}
|
|
10
|
-
};
|
|
11
|
-
var command = parseListCommand(submission.intent);
|
|
12
|
-
if (command) {
|
|
13
|
-
setValue(submission.payload, command.scope, list => {
|
|
14
|
-
if (typeof list !== 'undefined' && !Array.isArray(list)) {
|
|
15
|
-
throw new Error('The list command can only be applied to a list');
|
|
16
|
-
}
|
|
17
|
-
return updateList(list !== null && list !== void 0 ? list : [], command);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.resolve) === 'undefined') {
|
|
21
|
-
return submission;
|
|
22
|
-
}
|
|
23
|
-
var result = options.resolve(submission.payload, submission.intent);
|
|
24
|
-
var mergeResolveResult = resolved => {
|
|
25
|
-
return _objectSpread2(_objectSpread2({}, submission), resolved);
|
|
26
|
-
};
|
|
27
|
-
if (result instanceof Promise) {
|
|
28
|
-
return result.then(mergeResolveResult);
|
|
29
|
-
}
|
|
30
|
-
return mergeResolveResult(result);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { parse };
|