@jfdevelops/multi-step-form-core 1.0.0-alpha.22 → 1.0.0-alpha.24
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/_internals.cjs +0 -4
- package/dist/_internals.d.cts +2 -3
- package/dist/_internals.d.mts +2 -3
- package/dist/_internals.mjs +1 -2
- package/dist/index.cjs +17 -17
- package/dist/index.d.cts +12 -11
- package/dist/index.d.mts +12 -11
- package/dist/index.mjs +8 -10
- package/dist/internals/step-schema.cjs +120 -71
- package/dist/internals/step-schema.cjs.map +1 -1
- package/dist/internals/step-schema.d.cts +47 -29
- package/dist/internals/step-schema.d.cts.map +1 -1
- package/dist/internals/step-schema.d.mts +47 -29
- package/dist/internals/step-schema.d.mts.map +1 -1
- package/dist/internals/step-schema.mjs +120 -71
- package/dist/internals/step-schema.mjs.map +1 -1
- package/dist/schema.cjs +14 -10
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +11 -13
- package/dist/schema.d.cts.map +1 -1
- package/dist/schema.d.mts +11 -13
- package/dist/schema.d.mts.map +1 -1
- package/dist/schema.mjs +14 -10
- package/dist/schema.mjs.map +1 -1
- package/dist/steps/fields.cjs +80 -0
- package/dist/steps/fields.cjs.map +1 -1
- package/dist/steps/fields.d.cts +117 -9
- package/dist/steps/fields.d.cts.map +1 -1
- package/dist/steps/fields.d.mts +117 -9
- package/dist/steps/fields.d.mts.map +1 -1
- package/dist/steps/fields.mjs +80 -0
- package/dist/steps/fields.mjs.map +1 -1
- package/dist/steps/fn-utils/helper-fn/index.cjs +81 -0
- package/dist/steps/fn-utils/helper-fn/index.cjs.map +1 -0
- package/dist/steps/fn-utils/helper-fn/index.d.cts +146 -0
- package/dist/steps/fn-utils/helper-fn/index.d.cts.map +1 -0
- package/dist/steps/fn-utils/helper-fn/index.d.mts +146 -0
- package/dist/steps/fn-utils/helper-fn/index.d.mts.map +1 -0
- package/dist/steps/fn-utils/helper-fn/index.mjs +75 -0
- package/dist/steps/fn-utils/helper-fn/index.mjs.map +1 -0
- package/dist/steps/fn-utils/helper-fn/utils.d.cts +81 -0
- package/dist/steps/fn-utils/helper-fn/utils.d.cts.map +1 -0
- package/dist/steps/fn-utils/helper-fn/utils.d.mts +81 -0
- package/dist/steps/fn-utils/helper-fn/utils.d.mts.map +1 -0
- package/dist/steps/fn-utils/index.cjs +1 -0
- package/dist/steps/fn-utils/index.mjs +3 -0
- package/dist/steps/fn-utils/reset-fn.d.cts +30 -0
- package/dist/steps/fn-utils/reset-fn.d.cts.map +1 -0
- package/dist/steps/fn-utils/reset-fn.d.mts +30 -0
- package/dist/steps/fn-utils/reset-fn.d.mts.map +1 -0
- package/dist/steps/fn-utils/update-fn.d.cts +121 -0
- package/dist/steps/fn-utils/update-fn.d.cts.map +1 -0
- package/dist/steps/fn-utils/update-fn.d.mts +121 -0
- package/dist/steps/fn-utils/update-fn.d.mts.map +1 -0
- package/dist/steps/index.cjs +4 -2
- package/dist/steps/index.mjs +5 -3
- package/dist/steps/schema.cjs +61 -84
- package/dist/steps/schema.cjs.map +1 -1
- package/dist/steps/schema.d.cts +66 -67
- package/dist/steps/schema.d.cts.map +1 -1
- package/dist/steps/schema.d.mts +66 -67
- package/dist/steps/schema.d.mts.map +1 -1
- package/dist/steps/schema.mjs +62 -86
- package/dist/steps/schema.mjs.map +1 -1
- package/dist/steps/steps.cjs +83 -0
- package/dist/steps/steps.cjs.map +1 -0
- package/dist/steps/steps.d.cts +81 -0
- package/dist/steps/steps.d.cts.map +1 -0
- package/dist/steps/steps.d.mts +81 -0
- package/dist/steps/steps.d.mts.map +1 -0
- package/dist/steps/steps.mjs +76 -0
- package/dist/steps/steps.mjs.map +1 -0
- package/dist/steps/utils.cjs +40 -30
- package/dist/steps/utils.cjs.map +1 -1
- package/dist/steps/utils.d.cts +8 -5
- package/dist/steps/utils.d.cts.map +1 -1
- package/dist/steps/utils.d.mts +8 -5
- package/dist/steps/utils.d.mts.map +1 -1
- package/dist/steps/utils.mjs +40 -31
- package/dist/steps/utils.mjs.map +1 -1
- package/dist/storage.cjs +1 -1
- package/dist/storage.cjs.map +1 -1
- package/dist/storage.d.cts +9 -7
- package/dist/storage.d.cts.map +1 -1
- package/dist/storage.d.mts +9 -7
- package/dist/storage.d.mts.map +1 -1
- package/dist/storage.mjs +1 -1
- package/dist/storage.mjs.map +1 -1
- package/dist/utils/casing.cjs +1 -1
- package/dist/utils/casing.cjs.map +1 -1
- package/dist/utils/casing.d.cts +27 -11
- package/dist/utils/casing.d.cts.map +1 -1
- package/dist/utils/casing.d.mts +27 -11
- package/dist/utils/casing.d.mts.map +1 -1
- package/dist/utils/casing.mjs +1 -1
- package/dist/utils/casing.mjs.map +1 -1
- package/dist/utils/helpers.cjs +8 -0
- package/dist/utils/helpers.cjs.map +1 -1
- package/dist/utils/helpers.mjs +7 -1
- package/dist/utils/helpers.mjs.map +1 -1
- package/dist/utils/index.cjs +3 -0
- package/dist/utils/index.mjs +5 -0
- package/dist/utils/invariant.cjs +28 -8
- package/dist/utils/invariant.cjs.map +1 -1
- package/dist/utils/invariant.d.cts +12 -2
- package/dist/utils/invariant.d.cts.map +1 -1
- package/dist/utils/invariant.d.mts +12 -2
- package/dist/utils/invariant.d.mts.map +1 -1
- package/dist/utils/invariant.mjs +28 -9
- package/dist/utils/invariant.mjs.map +1 -1
- package/dist/utils/types.d.cts +15 -3
- package/dist/utils/types.d.cts.map +1 -1
- package/dist/utils/types.d.mts +15 -3
- package/dist/utils/types.d.mts.map +1 -1
- package/dist/utils/validator.d.cts.map +1 -1
- package/dist/utils/validator.d.mts.map +1 -1
- package/package.json +1 -1
- package/dist/internals/utils.cjs +0 -94
- package/dist/internals/utils.cjs.map +0 -1
- package/dist/internals/utils.d.cts +0 -33
- package/dist/internals/utils.d.cts.map +0 -1
- package/dist/internals/utils.d.mts +0 -33
- package/dist/internals/utils.d.mts.map +0 -1
- package/dist/internals/utils.mjs +0 -91
- package/dist/internals/utils.mjs.map +0 -1
- package/dist/observable.cjs +0 -44
- package/dist/observable.cjs.map +0 -1
- package/dist/observable.d.cts +0 -26
- package/dist/observable.d.cts.map +0 -1
- package/dist/observable.d.mts +0 -26
- package/dist/observable.d.mts.map +0 -1
- package/dist/observable.mjs +0 -44
- package/dist/observable.mjs.map +0 -1
- package/dist/steps/types.cjs +0 -33
- package/dist/steps/types.cjs.map +0 -1
- package/dist/steps/types.d.cts +0 -354
- package/dist/steps/types.d.cts.map +0 -1
- package/dist/steps/types.d.mts +0 -354
- package/dist/steps/types.d.mts.map +0 -1
- package/dist/steps/types.mjs +0 -27
- package/dist/steps/types.mjs.map +0 -1
- package/dist/utils/field-types.cjs +0 -23
- package/dist/utils/field-types.cjs.map +0 -1
- package/dist/utils/field-types.d.cts +0 -39
- package/dist/utils/field-types.d.cts.map +0 -1
- package/dist/utils/field-types.d.mts +0 -39
- package/dist/utils/field-types.d.mts.map +0 -1
- package/dist/utils/field-types.mjs +0 -20
- package/dist/utils/field-types.mjs.map +0 -1
package/dist/_internals.cjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
const require_path = require('./utils/path.cjs');
|
|
2
|
-
const require_utils = require('./internals/utils.cjs');
|
|
3
2
|
const require_step_schema = require('./internals/step-schema.cjs');
|
|
4
3
|
|
|
5
4
|
exports.MultiStepFormStepSchemaInternal = require_step_schema.MultiStepFormStepSchemaInternal;
|
|
6
|
-
exports.VALIDATED_STEP_REGEX = require_utils.VALIDATED_STEP_REGEX;
|
|
7
|
-
exports.createStep = require_utils.createStep;
|
|
8
|
-
exports.isValidStepKey = require_utils.isValidStepKey;
|
|
9
5
|
Object.defineProperty(exports, 'path', {
|
|
10
6
|
enumerable: true,
|
|
11
7
|
get: function () {
|
package/dist/_internals.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { path } from "./utils/path.cjs";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { InternalOptions, MultiStepFormStepSchemaInternal, VALIDATED_STEP_REGEX, createStep, isValidStepKey, path };
|
|
2
|
+
import { MultiStepFormStepSchemaInternal, StepSchema } from "./internals/step-schema.cjs";
|
|
3
|
+
export { MultiStepFormStepSchemaInternal, StepSchema, path };
|
package/dist/_internals.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { path } from "./utils/path.mjs";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { InternalOptions, MultiStepFormStepSchemaInternal, VALIDATED_STEP_REGEX, createStep, isValidStepKey, path };
|
|
2
|
+
import { MultiStepFormStepSchemaInternal, StepSchema } from "./internals/step-schema.mjs";
|
|
3
|
+
export { MultiStepFormStepSchemaInternal, StepSchema, path };
|
package/dist/_internals.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { path } from "./utils/path.mjs";
|
|
2
|
-
import { VALIDATED_STEP_REGEX, createStep, isValidStepKey } from "./internals/utils.mjs";
|
|
3
2
|
import { MultiStepFormStepSchemaInternal } from "./internals/step-schema.mjs";
|
|
4
3
|
|
|
5
|
-
export { MultiStepFormStepSchemaInternal,
|
|
4
|
+
export { MultiStepFormStepSchemaInternal, path };
|
package/dist/index.cjs
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_utils = require('./steps/utils.cjs');
|
|
1
|
+
const require_index = require('./steps/fn-utils/helper-fn/index.cjs');
|
|
3
2
|
const require_casing = require('./utils/casing.cjs');
|
|
4
|
-
const require_field_types = require('./utils/field-types.cjs');
|
|
5
3
|
const require_logger = require('./utils/logger.cjs');
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
require('./_internals.cjs');
|
|
4
|
+
const require_invariant = require('./utils/invariant.cjs');
|
|
5
|
+
require('./utils/index.cjs');
|
|
9
6
|
const require_fields = require('./steps/fields.cjs');
|
|
7
|
+
const require_steps = require('./steps/steps.cjs');
|
|
8
|
+
const require_utils = require('./steps/utils.cjs');
|
|
9
|
+
const require_storage = require('./storage.cjs');
|
|
10
10
|
const require_schema = require('./steps/schema.cjs');
|
|
11
|
-
const require_types = require('./steps/types.cjs');
|
|
12
11
|
require('./steps/index.cjs');
|
|
13
12
|
const require_schema$1 = require('./schema.cjs');
|
|
14
|
-
const require_observable = require('./observable.cjs');
|
|
15
13
|
|
|
16
14
|
exports.CASING_TYPES = require_casing.CASING_TYPES;
|
|
17
15
|
exports.DEFAULT_CASING = require_casing.DEFAULT_CASING;
|
|
18
|
-
exports.DEFAULT_FIELD_TYPE = require_field_types.DEFAULT_FIELD_TYPE;
|
|
19
16
|
exports.DEFAULT_LOGGER_PREFIX = require_logger.DEFAULT_LOGGER_PREFIX;
|
|
20
17
|
exports.DEFAULT_STORAGE_KEY = require_storage.DEFAULT_STORAGE_KEY;
|
|
21
|
-
exports.FIELD_TYPES = require_field_types.FIELD_TYPES;
|
|
22
18
|
Object.defineProperty(exports, 'HelperFnChosenSteps', {
|
|
23
19
|
enumerable: true,
|
|
24
20
|
get: function () {
|
|
25
|
-
return
|
|
21
|
+
return require_index.HelperFnChosenSteps;
|
|
26
22
|
}
|
|
27
23
|
});
|
|
28
24
|
exports.MultiStepFormLogger = require_logger.MultiStepFormLogger;
|
|
29
|
-
exports.MultiStepFormObserver = require_observable.MultiStepFormObserver;
|
|
30
25
|
exports.MultiStepFormSchema = require_schema$1.MultiStepFormSchema;
|
|
31
26
|
exports.MultiStepFormStepSchema = require_schema.MultiStepFormStepSchema;
|
|
32
27
|
exports.MultiStepFormStorage = require_storage.MultiStepFormStorage;
|
|
33
|
-
exports.VALIDATED_STEP_REGEX =
|
|
28
|
+
exports.VALIDATED_STEP_REGEX = require_steps.VALIDATED_STEP_REGEX;
|
|
34
29
|
exports.changeCasing = require_casing.changeCasing;
|
|
35
30
|
exports.createCtx = require_utils.createCtx;
|
|
31
|
+
exports.createInvariant = require_invariant.createInvariant;
|
|
32
|
+
exports.createIsValidStepFn = require_schema.createIsValidStepFn;
|
|
36
33
|
exports.createMultiStepFormSchema = require_schema$1.createMultiStepFormSchema;
|
|
37
|
-
exports.createStep = require_utils$1.createStep;
|
|
38
34
|
Object.defineProperty(exports, 'fields', {
|
|
39
35
|
enumerable: true,
|
|
40
36
|
get: function () {
|
|
@@ -43,7 +39,11 @@ Object.defineProperty(exports, 'fields', {
|
|
|
43
39
|
});
|
|
44
40
|
exports.invariant = require_invariant.invariant;
|
|
45
41
|
exports.isCasingValid = require_casing.isCasingValid;
|
|
46
|
-
exports.isFieldType = require_field_types.isFieldType;
|
|
47
|
-
exports.isValidStepKey = require_utils$1.isValidStepKey;
|
|
48
42
|
exports.quote = require_casing.quote;
|
|
49
|
-
exports.setCasingType = require_casing.setCasingType;
|
|
43
|
+
exports.setCasingType = require_casing.setCasingType;
|
|
44
|
+
Object.defineProperty(exports, 'steps', {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return require_steps.steps;
|
|
48
|
+
}
|
|
49
|
+
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Constrain, DeepKeys, DeepPartial, DeepValue, Expand, Join, Override, SetDefaultString, Split, objectHelpers, unionHelpers } from "./utils/types.cjs";
|
|
2
|
-
import { CASING_TYPES,
|
|
3
|
-
import { DEFAULT_FIELD_TYPE, DefaultFieldType, DefaultFieldTypeMap, FIELD_TYPES, FieldType, GetInferredFieldType, ResolvedFieldTypeMap, isFieldType } from "./utils/field-types.cjs";
|
|
1
|
+
import { Constrain, DeepKeys, DeepPartial, DeepValue, Expand, IsString, Join, Override, Relaxed, RemoveReadonly, RequireAtLeastOne, SetDefaultString, Show, Split, UnionToTuple, Updater, WidenSpecial, inferUpdaterReturn, objectHelpers, stripFunctions, unionHelpers } from "./utils/types.cjs";
|
|
2
|
+
import { CASING_TYPES, CasingType, ChangeCasing, ChangeObjectCasing, DEFAULT_CASING, DefaultCasing, changeCasing, isCasingValid, quote, setCasingType } from "./utils/casing.cjs";
|
|
4
3
|
import { DEFAULT_LOGGER_PREFIX, MultiStepFormLogger, MultiStepFormLoggerOptions } from "./utils/logger.cjs";
|
|
5
|
-
import { invariant } from "./utils/invariant.cjs";
|
|
6
|
-
import { AnyResolvedStep, AnyStep, AnyStepField, AnyStepFieldOption, ClampTo0to10, CreateHelperFunctionOptionsBase, CreateHelperFunctionOptionsWithCustomCtxOptions, CreateHelperFunctionOptionsWithValidator, CreateHelperFunctionOptionsWithoutValidator, CreateStepHelperFn, CreatedHelperFnInput, CreatedHelperFnWithInput, CreatedHelperFnWithoutInput, CtxDataSelector, CurrentStepHelperFnCtx, ExtractStepFromKey, FirstStep, GeneralHelperFn, GetCurrentStep, GetDefaultCasingTransformation, GetFieldsForStep, GreaterThan, HelperFn, HelperFnChosenSteps, HelperFnCtx, HelperFnInputBase, HelperFnInputWithValidator, HelperFnInputWithoutValidator, HelperFnResetFn, HelperFnUpdateFn, HelperFnWithValidator, HelperFnWithoutValidator, InferStepOptions, LastStep, Max, Min, MultiStepFormSchemaStepConfig, NameTransformCasingOptions, Range, Relaxed, RequireAtLeastOne, ResetFn, ResolvedFields, ResolvedStep, ResolvedStepBuilder, SetDefault, Step, StepData, StepFieldOptions, StepNumbers, StepOptions, StepSpecificHelperFn, StepSpecificHelperFns, StrippedResolvedStep, Tuple, UnionToTuple, UpdateFn, Updater, ValidStepKey, helperFnResetFn, helperFnUpdateFn } from "./steps/types.cjs";
|
|
7
|
-
import { DEFAULT_STORAGE_KEY, DefaultStorageKey, MultiStepFormStorage, StorageConfig } from "./storage.cjs";
|
|
8
|
-
import { VALIDATED_STEP_REGEX, createStep, isValidStepKey } from "./internals/utils.cjs";
|
|
4
|
+
import { Invariant, createInvariant, invariant } from "./utils/invariant.cjs";
|
|
9
5
|
import { fields } from "./steps/fields.cjs";
|
|
6
|
+
import { UpdateFn } from "./steps/fn-utils/update-fn.cjs";
|
|
7
|
+
import { ResetFn } from "./steps/fn-utils/reset-fn.cjs";
|
|
8
|
+
import { GeneralHelperFn, HelperFnInput, HelperFnOptions, HelperFnOutput, StepSpecificHelperFn } from "./steps/fn-utils/helper-fn/utils.cjs";
|
|
9
|
+
import { VALIDATED_STEP_REGEX, steps } from "./steps/steps.cjs";
|
|
10
|
+
import { HelperFn, HelperFnChosenSteps, createStepSpecificHelperFn } from "./steps/fn-utils/helper-fn/index.cjs";
|
|
11
|
+
import { BaseStorageConfig, DEFAULT_STORAGE_KEY, DefaultStorageKey, MultiStepFormStorage, StorageConfig } from "./storage.cjs";
|
|
10
12
|
import { createCtx } from "./steps/utils.cjs";
|
|
11
|
-
import { AsFunction, AsFunctionReturn, AsType, AsTypeMap, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions,
|
|
12
|
-
import { MultiStepFormSchema,
|
|
13
|
-
|
|
14
|
-
export { AnyResolvedStep, AnyStep, AnyStepField, AnyStepFieldOption, AsFunction, AsFunctionReturn, AsType, AsTypeMap, CASING_TYPES, CapitalizeWord, CasingType, ChangeCasing, ChangeObjectCasing, ClampTo0to10, Constrain, CreateHelperFunctionOptionsBase, CreateHelperFunctionOptionsWithCustomCtxOptions, CreateHelperFunctionOptionsWithValidator, CreateHelperFunctionOptionsWithoutValidator, CreateStepHelperFn, CreatedHelperFnInput, CreatedHelperFnWithInput, CreatedHelperFnWithoutInput, CtxDataSelector, CurrentStepHelperFnCtx, DEFAULT_CASING, DEFAULT_FIELD_TYPE, DEFAULT_LOGGER_PREFIX, DEFAULT_STORAGE_KEY, DeepKeys, DeepPartial, DeepValue, DefaultCasing, DefaultFieldType, DefaultFieldTypeMap, DefaultStorageKey, Expand, ExtractStepFromKey, FIELD_TYPES, FieldType, FirstStep, GeneralHelperFn, GetCurrentStep, GetDefaultCasingTransformation, GetFieldsForStep, GetInferredFieldType, GreaterThan, HelperFn, HelperFnChosenSteps, HelperFnCtx, HelperFnInputBase, HelperFnInputWithValidator, HelperFnInputWithoutValidator, HelperFnResetFn, HelperFnUpdateFn, HelperFnWithValidator, HelperFnWithoutValidator, InferStepOptions, Join, LastStep, Max, Min, MultiStepFormLogger, MultiStepFormLoggerOptions, MultiStepFormObserver, MultiStepFormSchema, MultiStepFormSchemaListener, MultiStepFormSchemaOptions, MultiStepFormSchemaStepConfig, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepSchemaListener, MultiStepFormStepStepsConfig, MultiStepFormStorage, NameTransformCasingOptions, ObserverListener, ObserverOptions, Override, Range, Relaxed, RequireAtLeastOne, ResetFn, ResolvedFieldTypeMap, ResolvedFields, ResolvedStep, ResolvedStepBuilder, SetDefault, SetDefaultString, Split, Step, StepData, StepFieldOptions, StepNumbers, StepOptions, StepSpecificHelperFn, StepSpecificHelperFns, StorageConfig, StrippedResolvedStep, ToLower, Tuple, UnionToTuple, UpdateFn, Updater, VALIDATED_STEP_REGEX, ValidStepKey, changeCasing, createCtx, createMultiStepFormSchema, createStep, fields, helperFnResetFn, helperFnUpdateFn, invariant, isCasingValid, isFieldType, isValidStepKey, objectHelpers, quote, setCasingType, unionHelpers };
|
|
13
|
+
import { AsFunction, AsFunctionReturn, AsType, AsTypeMap, IsValidStepFn, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepStepsConfig, createIsValidStepFn } from "./steps/schema.cjs";
|
|
14
|
+
import { MultiStepFormSchema, createMultiStepFormSchema } from "./schema.cjs";
|
|
15
|
+
export { AsFunction, AsFunctionReturn, AsType, AsTypeMap, BaseStorageConfig, CASING_TYPES, CasingType, ChangeCasing, ChangeObjectCasing, Constrain, DEFAULT_CASING, DEFAULT_LOGGER_PREFIX, DEFAULT_STORAGE_KEY, DeepKeys, DeepPartial, DeepValue, DefaultCasing, DefaultStorageKey, Expand, GeneralHelperFn, HelperFn, HelperFnChosenSteps, HelperFnInput, HelperFnOptions, HelperFnOutput, Invariant, IsString, IsValidStepFn, Join, MultiStepFormLogger, MultiStepFormLoggerOptions, MultiStepFormSchema, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepStepsConfig, MultiStepFormStorage, Override, Relaxed, RemoveReadonly, RequireAtLeastOne, ResetFn, SetDefaultString, Show, Split, StepSpecificHelperFn, StorageConfig, UnionToTuple, UpdateFn, Updater, VALIDATED_STEP_REGEX, WidenSpecial, changeCasing, createCtx, createInvariant, createIsValidStepFn, createMultiStepFormSchema, createStepSpecificHelperFn, fields, inferUpdaterReturn, invariant, isCasingValid, objectHelpers, quote, setCasingType, steps, stripFunctions, unionHelpers };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { Constrain, DeepKeys, DeepPartial, DeepValue, Expand, Join, Override, SetDefaultString, Split, objectHelpers, unionHelpers } from "./utils/types.mjs";
|
|
2
|
-
import { CASING_TYPES,
|
|
3
|
-
import { DEFAULT_FIELD_TYPE, DefaultFieldType, DefaultFieldTypeMap, FIELD_TYPES, FieldType, GetInferredFieldType, ResolvedFieldTypeMap, isFieldType } from "./utils/field-types.mjs";
|
|
1
|
+
import { Constrain, DeepKeys, DeepPartial, DeepValue, Expand, IsString, Join, Override, Relaxed, RemoveReadonly, RequireAtLeastOne, SetDefaultString, Show, Split, UnionToTuple, Updater, WidenSpecial, inferUpdaterReturn, objectHelpers, stripFunctions, unionHelpers } from "./utils/types.mjs";
|
|
2
|
+
import { CASING_TYPES, CasingType, ChangeCasing, ChangeObjectCasing, DEFAULT_CASING, DefaultCasing, changeCasing, isCasingValid, quote, setCasingType } from "./utils/casing.mjs";
|
|
4
3
|
import { DEFAULT_LOGGER_PREFIX, MultiStepFormLogger, MultiStepFormLoggerOptions } from "./utils/logger.mjs";
|
|
5
|
-
import { invariant } from "./utils/invariant.mjs";
|
|
6
|
-
import { AnyResolvedStep, AnyStep, AnyStepField, AnyStepFieldOption, ClampTo0to10, CreateHelperFunctionOptionsBase, CreateHelperFunctionOptionsWithCustomCtxOptions, CreateHelperFunctionOptionsWithValidator, CreateHelperFunctionOptionsWithoutValidator, CreateStepHelperFn, CreatedHelperFnInput, CreatedHelperFnWithInput, CreatedHelperFnWithoutInput, CtxDataSelector, CurrentStepHelperFnCtx, ExtractStepFromKey, FirstStep, GeneralHelperFn, GetCurrentStep, GetDefaultCasingTransformation, GetFieldsForStep, GreaterThan, HelperFn, HelperFnChosenSteps, HelperFnCtx, HelperFnInputBase, HelperFnInputWithValidator, HelperFnInputWithoutValidator, HelperFnResetFn, HelperFnUpdateFn, HelperFnWithValidator, HelperFnWithoutValidator, InferStepOptions, LastStep, Max, Min, MultiStepFormSchemaStepConfig, NameTransformCasingOptions, Range, Relaxed, RequireAtLeastOne, ResetFn, ResolvedFields, ResolvedStep, ResolvedStepBuilder, SetDefault, Step, StepData, StepFieldOptions, StepNumbers, StepOptions, StepSpecificHelperFn, StepSpecificHelperFns, StrippedResolvedStep, Tuple, UnionToTuple, UpdateFn, Updater, ValidStepKey, helperFnResetFn, helperFnUpdateFn } from "./steps/types.mjs";
|
|
7
|
-
import { DEFAULT_STORAGE_KEY, DefaultStorageKey, MultiStepFormStorage, StorageConfig } from "./storage.mjs";
|
|
8
|
-
import { VALIDATED_STEP_REGEX, createStep, isValidStepKey } from "./internals/utils.mjs";
|
|
4
|
+
import { Invariant, createInvariant, invariant } from "./utils/invariant.mjs";
|
|
9
5
|
import { fields } from "./steps/fields.mjs";
|
|
6
|
+
import { UpdateFn } from "./steps/fn-utils/update-fn.mjs";
|
|
7
|
+
import { ResetFn } from "./steps/fn-utils/reset-fn.mjs";
|
|
8
|
+
import { GeneralHelperFn, HelperFnInput, HelperFnOptions, HelperFnOutput, StepSpecificHelperFn } from "./steps/fn-utils/helper-fn/utils.mjs";
|
|
9
|
+
import { VALIDATED_STEP_REGEX, steps } from "./steps/steps.mjs";
|
|
10
|
+
import { HelperFn, HelperFnChosenSteps, createStepSpecificHelperFn } from "./steps/fn-utils/helper-fn/index.mjs";
|
|
11
|
+
import { BaseStorageConfig, DEFAULT_STORAGE_KEY, DefaultStorageKey, MultiStepFormStorage, StorageConfig } from "./storage.mjs";
|
|
10
12
|
import { createCtx } from "./steps/utils.mjs";
|
|
11
|
-
import { AsFunction, AsFunctionReturn, AsType, AsTypeMap, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions,
|
|
12
|
-
import { MultiStepFormSchema,
|
|
13
|
-
|
|
14
|
-
export { AnyResolvedStep, AnyStep, AnyStepField, AnyStepFieldOption, AsFunction, AsFunctionReturn, AsType, AsTypeMap, CASING_TYPES, CapitalizeWord, CasingType, ChangeCasing, ChangeObjectCasing, ClampTo0to10, Constrain, CreateHelperFunctionOptionsBase, CreateHelperFunctionOptionsWithCustomCtxOptions, CreateHelperFunctionOptionsWithValidator, CreateHelperFunctionOptionsWithoutValidator, CreateStepHelperFn, CreatedHelperFnInput, CreatedHelperFnWithInput, CreatedHelperFnWithoutInput, CtxDataSelector, CurrentStepHelperFnCtx, DEFAULT_CASING, DEFAULT_FIELD_TYPE, DEFAULT_LOGGER_PREFIX, DEFAULT_STORAGE_KEY, DeepKeys, DeepPartial, DeepValue, DefaultCasing, DefaultFieldType, DefaultFieldTypeMap, DefaultStorageKey, Expand, ExtractStepFromKey, FIELD_TYPES, FieldType, FirstStep, GeneralHelperFn, GetCurrentStep, GetDefaultCasingTransformation, GetFieldsForStep, GetInferredFieldType, GreaterThan, HelperFn, HelperFnChosenSteps, HelperFnCtx, HelperFnInputBase, HelperFnInputWithValidator, HelperFnInputWithoutValidator, HelperFnResetFn, HelperFnUpdateFn, HelperFnWithValidator, HelperFnWithoutValidator, InferStepOptions, Join, LastStep, Max, Min, MultiStepFormLogger, MultiStepFormLoggerOptions, MultiStepFormObserver, MultiStepFormSchema, MultiStepFormSchemaListener, MultiStepFormSchemaOptions, MultiStepFormSchemaStepConfig, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepSchemaListener, MultiStepFormStepStepsConfig, MultiStepFormStorage, NameTransformCasingOptions, ObserverListener, ObserverOptions, Override, Range, Relaxed, RequireAtLeastOne, ResetFn, ResolvedFieldTypeMap, ResolvedFields, ResolvedStep, ResolvedStepBuilder, SetDefault, SetDefaultString, Split, Step, StepData, StepFieldOptions, StepNumbers, StepOptions, StepSpecificHelperFn, StepSpecificHelperFns, StorageConfig, StrippedResolvedStep, ToLower, Tuple, UnionToTuple, UpdateFn, Updater, VALIDATED_STEP_REGEX, ValidStepKey, changeCasing, createCtx, createMultiStepFormSchema, createStep, fields, helperFnResetFn, helperFnUpdateFn, invariant, isCasingValid, isFieldType, isValidStepKey, objectHelpers, quote, setCasingType, unionHelpers };
|
|
13
|
+
import { AsFunction, AsFunctionReturn, AsType, AsTypeMap, IsValidStepFn, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepStepsConfig, createIsValidStepFn } from "./steps/schema.mjs";
|
|
14
|
+
import { MultiStepFormSchema, createMultiStepFormSchema } from "./schema.mjs";
|
|
15
|
+
export { AsFunction, AsFunctionReturn, AsType, AsTypeMap, BaseStorageConfig, CASING_TYPES, CasingType, ChangeCasing, ChangeObjectCasing, Constrain, DEFAULT_CASING, DEFAULT_LOGGER_PREFIX, DEFAULT_STORAGE_KEY, DeepKeys, DeepPartial, DeepValue, DefaultCasing, DefaultStorageKey, Expand, GeneralHelperFn, HelperFn, HelperFnChosenSteps, HelperFnInput, HelperFnOptions, HelperFnOutput, Invariant, IsString, IsValidStepFn, Join, MultiStepFormLogger, MultiStepFormLoggerOptions, MultiStepFormSchema, MultiStepFormStepSchema, MultiStepFormStepSchemaFunctions, MultiStepFormStepStepsConfig, MultiStepFormStorage, Override, Relaxed, RemoveReadonly, RequireAtLeastOne, ResetFn, SetDefaultString, Show, Split, StepSpecificHelperFn, StorageConfig, UnionToTuple, UpdateFn, Updater, VALIDATED_STEP_REGEX, WidenSpecial, changeCasing, createCtx, createInvariant, createIsValidStepFn, createMultiStepFormSchema, createStepSpecificHelperFn, fields, inferUpdaterReturn, invariant, isCasingValid, objectHelpers, quote, setCasingType, steps, stripFunctions, unionHelpers };
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createCtx } from "./steps/utils.mjs";
|
|
1
|
+
import { HelperFnChosenSteps } from "./steps/fn-utils/helper-fn/index.mjs";
|
|
3
2
|
import { CASING_TYPES, DEFAULT_CASING, changeCasing, isCasingValid, quote, setCasingType } from "./utils/casing.mjs";
|
|
4
|
-
import { DEFAULT_FIELD_TYPE, FIELD_TYPES, isFieldType } from "./utils/field-types.mjs";
|
|
5
3
|
import { DEFAULT_LOGGER_PREFIX, MultiStepFormLogger } from "./utils/logger.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "./_internals.mjs";
|
|
4
|
+
import { createInvariant, invariant } from "./utils/invariant.mjs";
|
|
5
|
+
import "./utils/index.mjs";
|
|
9
6
|
import { fields } from "./steps/fields.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { VALIDATED_STEP_REGEX, steps } from "./steps/steps.mjs";
|
|
8
|
+
import { createCtx } from "./steps/utils.mjs";
|
|
9
|
+
import { DEFAULT_STORAGE_KEY, MultiStepFormStorage } from "./storage.mjs";
|
|
10
|
+
import { MultiStepFormStepSchema, createIsValidStepFn } from "./steps/schema.mjs";
|
|
12
11
|
import "./steps/index.mjs";
|
|
13
12
|
import { MultiStepFormSchema, createMultiStepFormSchema } from "./schema.mjs";
|
|
14
|
-
import { MultiStepFormObserver } from "./observable.mjs";
|
|
15
13
|
|
|
16
|
-
export { CASING_TYPES, DEFAULT_CASING,
|
|
14
|
+
export { CASING_TYPES, DEFAULT_CASING, DEFAULT_LOGGER_PREFIX, DEFAULT_STORAGE_KEY, HelperFnChosenSteps, MultiStepFormLogger, MultiStepFormSchema, MultiStepFormStepSchema, MultiStepFormStorage, VALIDATED_STEP_REGEX, changeCasing, createCtx, createInvariant, createIsValidStepFn, createMultiStepFormSchema, fields, invariant, isCasingValid, quote, setCasingType, steps };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_invariant = require('../utils/invariant.cjs');
|
|
3
|
-
const require_utils = require('../steps/utils.cjs');
|
|
1
|
+
const require_index = require('../steps/fn-utils/helper-fn/index.cjs');
|
|
4
2
|
const require_logger = require('../utils/logger.cjs');
|
|
3
|
+
const require_invariant = require('../utils/invariant.cjs');
|
|
4
|
+
require('../utils/index.cjs');
|
|
5
5
|
const require_path = require('../utils/path.cjs');
|
|
6
6
|
const require_validator = require('../utils/validator.cjs');
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const require_steps = require('../steps/steps.cjs');
|
|
8
|
+
const require_helpers = require('../utils/helpers.cjs');
|
|
9
|
+
const require_utils = require('../steps/utils.cjs');
|
|
9
10
|
require('../steps/index.cjs');
|
|
10
11
|
|
|
11
12
|
//#region src/internals/step-schema.ts
|
|
@@ -62,7 +63,7 @@ var MultiStepFormStepSchemaInternal = class {
|
|
|
62
63
|
prefix: (value) => `${value}:update${targetStep}`
|
|
63
64
|
});
|
|
64
65
|
logger.info(`${targetStep} will be updated`);
|
|
65
|
-
require_invariant.invariant(
|
|
66
|
+
require_invariant.invariant(targetStep in this.value, `[update]: The target step ${targetStep} isn't a valid step. Please select a valid step`);
|
|
66
67
|
const { [targetStep]: currentStep, ...values } = this.value;
|
|
67
68
|
require_invariant.invariant("updater" in options, "[update]: No \"updater\" was found. Please provide a value to the \"updater\" property");
|
|
68
69
|
const updater = options.updater;
|
|
@@ -241,8 +242,7 @@ var MultiStepFormStepSchemaInternal = class {
|
|
|
241
242
|
debug,
|
|
242
243
|
prefix: (value) => `${value}:reset${targetStep}`
|
|
243
244
|
});
|
|
244
|
-
|
|
245
|
-
const originalValues = require_utils$1.createStep(this.#originalValue);
|
|
245
|
+
const originalValues = require_steps.steps.instantiate({ steps: this.#originalValue });
|
|
246
246
|
const enrichedOriginalValues = this.enrichValues(originalValues, this.#additionalEnrichedProps);
|
|
247
247
|
if (fields === "all") {
|
|
248
248
|
logger.info(`Resetting all fields for ${targetStep}`);
|
|
@@ -256,7 +256,7 @@ var MultiStepFormStepSchemaInternal = class {
|
|
|
256
256
|
updatedValues,
|
|
257
257
|
values: enrichedOriginalValues
|
|
258
258
|
});
|
|
259
|
-
if (
|
|
259
|
+
if (require_index.HelperFnChosenSteps.isTuple(fields)) reset(fields);
|
|
260
260
|
if (typeof fields === "object" && Object.keys(fields).length > 0) reset(require_path.path.createDeep(fields));
|
|
261
261
|
}
|
|
262
262
|
createStepResetterFn(targetStep) {
|
|
@@ -272,54 +272,64 @@ var MultiStepFormStepSchemaInternal = class {
|
|
|
272
272
|
this.createStepResetterFnImpl(options);
|
|
273
273
|
}
|
|
274
274
|
createHelperFnInputUpdate(chosenSteps) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
275
|
+
return require_index.HelperFnChosenSteps.match({
|
|
276
|
+
meta: { value: this.value },
|
|
277
|
+
validValues: ({ meta }) => Object.keys(meta.value),
|
|
278
|
+
all: ({ meta }) => {
|
|
279
|
+
const stepSpecificUpdateFn = require_helpers.typedObjectKeys(meta.value).reduce((acc, key) => {
|
|
280
|
+
acc[key] = this.createStepUpdaterFn(key);
|
|
281
|
+
return acc;
|
|
282
|
+
}, {});
|
|
283
|
+
return Object.assign(this.update, stepSpecificUpdateFn);
|
|
284
|
+
},
|
|
285
|
+
object: ({ chosenSteps: chosenSteps$1 }) => {
|
|
286
|
+
const stepSpecificUpdateFn = Object.keys(chosenSteps$1).reduce((acc, key) => {
|
|
287
|
+
acc[key] = this.createStepUpdaterFn(key);
|
|
288
|
+
return acc;
|
|
289
|
+
}, {});
|
|
290
|
+
return Object.assign(this.update, stepSpecificUpdateFn);
|
|
291
|
+
},
|
|
292
|
+
tuple: () => {
|
|
293
|
+
const stepSpecificUpdateFn = chosenSteps.reduce((acc, step) => {
|
|
294
|
+
acc[step] = this.createStepUpdaterFn(step);
|
|
295
|
+
return acc;
|
|
296
|
+
}, {});
|
|
297
|
+
return Object.assign(this.update, stepSpecificUpdateFn);
|
|
298
|
+
},
|
|
299
|
+
default: ({ errorMessage }) => {
|
|
300
|
+
throw new TypeError(`[update]: ${errorMessage}`);
|
|
301
|
+
}
|
|
302
|
+
})(chosenSteps);
|
|
298
303
|
}
|
|
299
304
|
createHelperFnInputReset(chosenSteps) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
305
|
+
return require_index.HelperFnChosenSteps.match({
|
|
306
|
+
meta: { value: this.value },
|
|
307
|
+
validValues: ({ meta }) => Object.keys(meta.value),
|
|
308
|
+
all: () => {
|
|
309
|
+
const stepSpecificUpdateFn = require_helpers.typedObjectKeys(this.value).reduce((acc, key) => {
|
|
310
|
+
acc[key] = this.createStepResetterFn(key);
|
|
311
|
+
return acc;
|
|
312
|
+
}, {});
|
|
313
|
+
return Object.assign(this.reset, stepSpecificUpdateFn);
|
|
314
|
+
},
|
|
315
|
+
tuple: () => {
|
|
316
|
+
const stepSpecificUpdateFn = chosenSteps.reduce((acc, step) => {
|
|
317
|
+
acc[step] = this.createStepResetterFn(step);
|
|
318
|
+
return acc;
|
|
319
|
+
}, {});
|
|
320
|
+
return Object.assign(this.reset, stepSpecificUpdateFn);
|
|
321
|
+
},
|
|
322
|
+
object: ({ chosenSteps: chosenSteps$1 }) => {
|
|
323
|
+
const stepSpecificUpdateFn = Object.keys(chosenSteps$1).reduce((acc, key) => {
|
|
324
|
+
acc[key] = this.createStepResetterFn(key);
|
|
325
|
+
return acc;
|
|
326
|
+
}, {});
|
|
327
|
+
return Object.assign(this.reset, stepSpecificUpdateFn);
|
|
328
|
+
},
|
|
329
|
+
default: ({ errorMessage }) => {
|
|
330
|
+
throw new TypeError(`[reset]: ${errorMessage}`);
|
|
331
|
+
}
|
|
332
|
+
})(chosenSteps);
|
|
323
333
|
}
|
|
324
334
|
createStepHelperFn(stepData) {
|
|
325
335
|
return (optionsOrFunction, fn) => {
|
|
@@ -334,21 +344,62 @@ var MultiStepFormStepSchemaInternal = class {
|
|
|
334
344
|
});
|
|
335
345
|
};
|
|
336
346
|
if (typeof optionsOrFunction === "object") return (input) => {
|
|
337
|
-
|
|
347
|
+
let ctx = require_utils.createCtx(this.value, stepData);
|
|
338
348
|
if ("validator" in optionsOrFunction) {
|
|
339
349
|
require_invariant.invariant(typeof input === "object", "An input is expected since you provided a validator");
|
|
340
350
|
require_validator.runStandardValidation(optionsOrFunction.validator, input.data);
|
|
341
|
-
let resolvedCtx = ctx;
|
|
342
351
|
if (optionsOrFunction.ctxData) {
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
352
|
+
const ctxData = optionsOrFunction.ctxData;
|
|
353
|
+
require_invariant.invariant(typeof ctxData === "function", "Option \"ctxData\" must be a function");
|
|
354
|
+
const logger = new require_logger.MultiStepFormLogger({
|
|
355
|
+
debug: false,
|
|
356
|
+
prefix: (value) => `${value}:ctxData`
|
|
357
|
+
});
|
|
358
|
+
const additionalCtx = require_index.HelperFnChosenSteps.match({
|
|
359
|
+
meta: {
|
|
360
|
+
value: this.value,
|
|
361
|
+
stepData,
|
|
362
|
+
ctxData,
|
|
363
|
+
logger
|
|
364
|
+
},
|
|
365
|
+
validValues: ({ meta }) => Object.keys(meta.value),
|
|
366
|
+
all: ({ meta }) => {
|
|
367
|
+
const { value, ctxData: ctxData$1, logger: logger$1 } = meta;
|
|
368
|
+
return this.buildCtxData({
|
|
369
|
+
ctxData: ctxData$1,
|
|
370
|
+
values: value,
|
|
371
|
+
logger: logger$1
|
|
372
|
+
});
|
|
373
|
+
},
|
|
374
|
+
tuple: ({ meta }) => {
|
|
375
|
+
const { value, stepData: stepData$1, ctxData: ctxData$1, logger: logger$1 } = meta;
|
|
376
|
+
const values = require_utils.omit(value, require_index.HelperFnChosenSteps.createTupleNotation(...stepData$1));
|
|
377
|
+
return this.buildCtxData({
|
|
378
|
+
ctxData: ctxData$1,
|
|
379
|
+
values,
|
|
380
|
+
logger: logger$1
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
object: ({ meta }) => {
|
|
384
|
+
const { value, stepData: stepData$1, ctxData: ctxData$1, logger: logger$1 } = meta;
|
|
385
|
+
const values = require_utils.omit(value, Object.keys(stepData$1));
|
|
386
|
+
return this.buildCtxData({
|
|
387
|
+
ctxData: ctxData$1,
|
|
388
|
+
values,
|
|
389
|
+
logger: logger$1
|
|
390
|
+
});
|
|
391
|
+
},
|
|
392
|
+
default: ({ errorMessage }) => {
|
|
393
|
+
throw new TypeError(`[ctxData]: ${errorMessage}`);
|
|
394
|
+
}
|
|
395
|
+
})(stepData);
|
|
396
|
+
ctx = {
|
|
397
|
+
...ctx,
|
|
398
|
+
...additionalCtx
|
|
348
399
|
};
|
|
349
400
|
}
|
|
350
401
|
return fn({
|
|
351
|
-
ctx
|
|
402
|
+
ctx,
|
|
352
403
|
...functions,
|
|
353
404
|
...input
|
|
354
405
|
});
|
|
@@ -361,17 +412,15 @@ var MultiStepFormStepSchemaInternal = class {
|
|
|
361
412
|
throw new Error(`The first argument must be a function or an object, (was ${typeof optionsOrFunction})`);
|
|
362
413
|
};
|
|
363
414
|
}
|
|
364
|
-
extractStepFromKey(key) {
|
|
365
|
-
const [targetStep] = [key];
|
|
366
|
-
return {
|
|
367
|
-
targetStep,
|
|
368
|
-
step: Number.parseInt(targetStep.replace("step", ""))
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
415
|
enrichValues(values, additionalProps) {
|
|
416
|
+
const invariant$1 = require_invariant.createInvariant("[enrichValues]");
|
|
417
|
+
invariant$1(typeof values === "object" && values !== null, "The values must be an object");
|
|
418
|
+
if (additionalProps) invariant$1(typeof additionalProps === "function", "The additional props must be a function");
|
|
372
419
|
let enriched = { ...values };
|
|
373
420
|
for (const [key, stepValue] of Object.entries(enriched)) {
|
|
374
|
-
const
|
|
421
|
+
const targetStep = key;
|
|
422
|
+
const step = Number.parseInt(targetStep.replace("step", ""));
|
|
423
|
+
invariant$1(typeof stepValue === "object" && stepValue !== null, `The value for ${key} must be an object`);
|
|
375
424
|
enriched[targetStep] = {
|
|
376
425
|
...stepValue,
|
|
377
426
|
update: this.createStepUpdaterFn(targetStep),
|