document-model 6.0.0-dev.104 → 6.0.0-dev.106
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/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +216 -0
- package/dist/index.js.map +1 -0
- package/dist/{src/core/node.d.ts → node.d.mts} +25 -23
- package/dist/node.d.mts.map +1 -0
- package/dist/node.mjs +151 -0
- package/dist/node.mjs.map +1 -0
- package/package.json +11 -15
- package/dist/src/core/actions.d.ts +0 -87
- package/dist/src/core/actions.d.ts.map +0 -1
- package/dist/src/core/actions.js +0 -187
- package/dist/src/core/actions.js.map +0 -1
- package/dist/src/core/controller.d.ts +0 -30
- package/dist/src/core/controller.d.ts.map +0 -1
- package/dist/src/core/controller.js +0 -60
- package/dist/src/core/controller.js.map +0 -1
- package/dist/src/core/crypto.d.ts +0 -8
- package/dist/src/core/crypto.d.ts.map +0 -1
- package/dist/src/core/crypto.js +0 -68
- package/dist/src/core/crypto.js.map +0 -1
- package/dist/src/core/documents.d.ts +0 -147
- package/dist/src/core/documents.d.ts.map +0 -1
- package/dist/src/core/documents.js +0 -845
- package/dist/src/core/documents.js.map +0 -1
- package/dist/src/core/errors.d.ts +0 -21
- package/dist/src/core/errors.d.ts.map +0 -1
- package/dist/src/core/errors.js +0 -46
- package/dist/src/core/errors.js.map +0 -1
- package/dist/src/core/files.d.ts +0 -27
- package/dist/src/core/files.d.ts.map +0 -1
- package/dist/src/core/files.js +0 -90
- package/dist/src/core/files.js.map +0 -1
- package/dist/src/core/header.d.ts +0 -63
- package/dist/src/core/header.d.ts.map +0 -1
- package/dist/src/core/header.js +0 -173
- package/dist/src/core/header.js.map +0 -1
- package/dist/src/core/index.d.ts +0 -16
- package/dist/src/core/index.d.ts.map +0 -1
- package/dist/src/core/index.js +0 -16
- package/dist/src/core/index.js.map +0 -1
- package/dist/src/core/logger-types.d.ts +0 -12
- package/dist/src/core/logger-types.d.ts.map +0 -1
- package/dist/src/core/logger-types.js +0 -2
- package/dist/src/core/logger-types.js.map +0 -1
- package/dist/src/core/logger.d.ts +0 -27
- package/dist/src/core/logger.d.ts.map +0 -1
- package/dist/src/core/logger.js +0 -127
- package/dist/src/core/logger.js.map +0 -1
- package/dist/src/core/node.d.ts.map +0 -1
- package/dist/src/core/node.js +0 -155
- package/dist/src/core/node.js.map +0 -1
- package/dist/src/core/operations.d.ts +0 -50
- package/dist/src/core/operations.d.ts.map +0 -1
- package/dist/src/core/operations.js +0 -126
- package/dist/src/core/operations.js.map +0 -1
- package/dist/src/core/ph-types.d.ts +0 -2
- package/dist/src/core/ph-types.d.ts.map +0 -1
- package/dist/src/core/ph-types.js +0 -2
- package/dist/src/core/ph-types.js.map +0 -1
- package/dist/src/core/reducer.d.ts +0 -63
- package/dist/src/core/reducer.d.ts.map +0 -1
- package/dist/src/core/reducer.js +0 -446
- package/dist/src/core/reducer.js.map +0 -1
- package/dist/src/core/schemas.d.ts +0 -75
- package/dist/src/core/schemas.d.ts.map +0 -1
- package/dist/src/core/schemas.js +0 -116
- package/dist/src/core/schemas.js.map +0 -1
- package/dist/src/core/state.d.ts +0 -26
- package/dist/src/core/state.d.ts.map +0 -1
- package/dist/src/core/state.js +0 -56
- package/dist/src/core/state.js.map +0 -1
- package/dist/src/core/types.d.ts +0 -2
- package/dist/src/core/types.d.ts.map +0 -1
- package/dist/src/core/types.js +0 -2
- package/dist/src/core/types.js.map +0 -1
- package/dist/src/core/utils.d.ts +0 -6
- package/dist/src/core/utils.d.ts.map +0 -1
- package/dist/src/core/utils.js +0 -15
- package/dist/src/core/utils.js.map +0 -1
- package/dist/src/core/validation.d.ts +0 -4
- package/dist/src/core/validation.d.ts.map +0 -1
- package/dist/src/core/validation.js +0 -27
- package/dist/src/core/validation.js.map +0 -1
- package/dist/src/document-model/actions.d.ts +0 -164
- package/dist/src/document-model/actions.d.ts.map +0 -1
- package/dist/src/document-model/actions.js +0 -111
- package/dist/src/document-model/actions.js.map +0 -1
- package/dist/src/document-model/constants.d.ts +0 -6
- package/dist/src/document-model/constants.d.ts.map +0 -1
- package/dist/src/document-model/constants.js +0 -584
- package/dist/src/document-model/constants.js.map +0 -1
- package/dist/src/document-model/controller.d.ts +0 -5
- package/dist/src/document-model/controller.d.ts.map +0 -1
- package/dist/src/document-model/controller.js +0 -5
- package/dist/src/document-model/controller.js.map +0 -1
- package/dist/src/document-model/document-schema.d.ts +0 -69
- package/dist/src/document-model/document-schema.d.ts.map +0 -1
- package/dist/src/document-model/document-schema.js +0 -43
- package/dist/src/document-model/document-schema.js.map +0 -1
- package/dist/src/document-model/document-type.d.ts +0 -2
- package/dist/src/document-model/document-type.d.ts.map +0 -1
- package/dist/src/document-model/document-type.js +0 -2
- package/dist/src/document-model/document-type.js.map +0 -1
- package/dist/src/document-model/files.d.ts +0 -5
- package/dist/src/document-model/files.d.ts.map +0 -1
- package/dist/src/document-model/files.js +0 -9
- package/dist/src/document-model/files.js.map +0 -1
- package/dist/src/document-model/index.d.ts +0 -12
- package/dist/src/document-model/index.d.ts.map +0 -1
- package/dist/src/document-model/index.js +0 -12
- package/dist/src/document-model/index.js.map +0 -1
- package/dist/src/document-model/module.d.ts +0 -3
- package/dist/src/document-model/module.d.ts.map +0 -1
- package/dist/src/document-model/module.js +0 -24
- package/dist/src/document-model/module.js.map +0 -1
- package/dist/src/document-model/reducers.d.ts +0 -11
- package/dist/src/document-model/reducers.d.ts.map +0 -1
- package/dist/src/document-model/reducers.js +0 -618
- package/dist/src/document-model/reducers.js.map +0 -1
- package/dist/src/document-model/schemas.d.ts +0 -189
- package/dist/src/document-model/schemas.d.ts.map +0 -1
- package/dist/src/document-model/schemas.js +0 -388
- package/dist/src/document-model/schemas.js.map +0 -1
- package/dist/src/document-model/state.d.ts +0 -15
- package/dist/src/document-model/state.d.ts.map +0 -1
- package/dist/src/document-model/state.js +0 -75
- package/dist/src/document-model/state.js.map +0 -1
- package/dist/src/document-model/types.d.ts +0 -584
- package/dist/src/document-model/types.d.ts.map +0 -1
- package/dist/src/document-model/types.js +0 -2
- package/dist/src/document-model/types.js.map +0 -1
- package/dist/src/document-model/validation.d.ts +0 -32
- package/dist/src/document-model/validation.d.ts.map +0 -1
- package/dist/src/document-model/validation.js +0 -166
- package/dist/src/document-model/validation.js.map +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/test/document/crypto.test.d.ts +0 -2
- package/dist/test/document/crypto.test.d.ts.map +0 -1
- package/dist/test/document/crypto.test.js +0 -192
- package/dist/test/document/crypto.test.js.map +0 -1
- package/dist/test/document/event-vs-command.test.d.ts +0 -2
- package/dist/test/document/event-vs-command.test.d.ts.map +0 -1
- package/dist/test/document/event-vs-command.test.js +0 -202
- package/dist/test/document/event-vs-command.test.js.map +0 -1
- package/dist/test/document/local.test.d.ts +0 -2
- package/dist/test/document/local.test.d.ts.map +0 -1
- package/dist/test/document/local.test.js +0 -226
- package/dist/test/document/local.test.js.map +0 -1
- package/dist/test/document/operation-id.test.d.ts +0 -2
- package/dist/test/document/operation-id.test.d.ts.map +0 -1
- package/dist/test/document/operation-id.test.js +0 -118
- package/dist/test/document/operation-id.test.js.map +0 -1
- package/dist/test/document/prune.test.d.ts +0 -2
- package/dist/test/document/prune.test.d.ts.map +0 -1
- package/dist/test/document/prune.test.js +0 -159
- package/dist/test/document/prune.test.js.map +0 -1
- package/dist/test/document/reducer.test.d.ts +0 -2
- package/dist/test/document/reducer.test.d.ts.map +0 -1
- package/dist/test/document/reducer.test.js +0 -284
- package/dist/test/document/reducer.test.js.map +0 -1
- package/dist/test/document/skip-operations.test.d.ts +0 -2
- package/dist/test/document/skip-operations.test.d.ts.map +0 -1
- package/dist/test/document/skip-operations.test.js +0 -495
- package/dist/test/document/skip-operations.test.js.map +0 -1
- package/dist/test/document/undo-redo-v2.test.d.ts +0 -2
- package/dist/test/document/undo-redo-v2.test.d.ts.map +0 -1
- package/dist/test/document/undo-redo-v2.test.js +0 -207
- package/dist/test/document/undo-redo-v2.test.js.map +0 -1
- package/dist/test/document/undo-redo.test.d.ts +0 -2
- package/dist/test/document/undo-redo.test.d.ts.map +0 -1
- package/dist/test/document/undo-redo.test.js +0 -413
- package/dist/test/document/undo-redo.test.js.map +0 -1
- package/dist/test/document/utils.test.d.ts +0 -2
- package/dist/test/document/utils.test.d.ts.map +0 -1
- package/dist/test/document/utils.test.js +0 -172
- package/dist/test/document/utils.test.js.map +0 -1
- package/dist/test/document-helpers/addUndo.test.d.ts +0 -2
- package/dist/test/document-helpers/addUndo.test.d.ts.map +0 -1
- package/dist/test/document-helpers/addUndo.test.js +0 -120
- package/dist/test/document-helpers/addUndo.test.js.map +0 -1
- package/dist/test/document-helpers/attachBranch.test.d.ts +0 -2
- package/dist/test/document-helpers/attachBranch.test.d.ts.map +0 -1
- package/dist/test/document-helpers/attachBranch.test.js +0 -364
- package/dist/test/document-helpers/attachBranch.test.js.map +0 -1
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts +0 -2
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.d.ts.map +0 -1
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js +0 -252
- package/dist/test/document-helpers/checkCleanedOperationsIntegrity.test.js.map +0 -1
- package/dist/test/document-helpers/conflictResolution.test.d.ts +0 -2
- package/dist/test/document-helpers/conflictResolution.test.d.ts.map +0 -1
- package/dist/test/document-helpers/conflictResolution.test.js +0 -109
- package/dist/test/document-helpers/conflictResolution.test.js.map +0 -1
- package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/filterDuplicatedOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/filterDuplicatedOperations.test.js +0 -126
- package/dist/test/document-helpers/filterDuplicatedOperations.test.js.map +0 -1
- package/dist/test/document-helpers/garbageCollect.test.d.ts +0 -2
- package/dist/test/document-helpers/garbageCollect.test.d.ts.map +0 -1
- package/dist/test/document-helpers/garbageCollect.test.js +0 -136
- package/dist/test/document-helpers/garbageCollect.test.js.map +0 -1
- package/dist/test/document-helpers/groupOperationsByScope.test.d.ts +0 -2
- package/dist/test/document-helpers/groupOperationsByScope.test.d.ts.map +0 -1
- package/dist/test/document-helpers/groupOperationsByScope.test.js +0 -102
- package/dist/test/document-helpers/groupOperationsByScope.test.js.map +0 -1
- package/dist/test/document-helpers/headerRevision.test.d.ts +0 -2
- package/dist/test/document-helpers/headerRevision.test.d.ts.map +0 -1
- package/dist/test/document-helpers/headerRevision.test.js +0 -203
- package/dist/test/document-helpers/headerRevision.test.js.map +0 -1
- package/dist/test/document-helpers/merge.test.d.ts +0 -2
- package/dist/test/document-helpers/merge.test.d.ts.map +0 -1
- package/dist/test/document-helpers/merge.test.js +0 -906
- package/dist/test/document-helpers/merge.test.js.map +0 -1
- package/dist/test/document-helpers/nextSkipNumber.test.d.ts +0 -2
- package/dist/test/document-helpers/nextSkipNumber.test.d.ts.map +0 -1
- package/dist/test/document-helpers/nextSkipNumber.test.js +0 -135
- package/dist/test/document-helpers/nextSkipNumber.test.js.map +0 -1
- package/dist/test/document-helpers/prepareOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/prepareOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/prepareOperations.test.js +0 -304
- package/dist/test/document-helpers/prepareOperations.test.js.map +0 -1
- package/dist/test/document-helpers/removeExistingOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/removeExistingOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/removeExistingOperations.test.js +0 -177
- package/dist/test/document-helpers/removeExistingOperations.test.js.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts +0 -2
- package/dist/test/document-helpers/reshuffleByTimestamp.test.d.ts.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestamp.test.js +0 -148
- package/dist/test/document-helpers/reshuffleByTimestamp.test.js.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts +0 -2
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.d.ts.map +0 -1
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js +0 -200
- package/dist/test/document-helpers/reshuffleByTimestampAndIndex.test.js.map +0 -1
- package/dist/test/document-helpers/skipHeaderOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/skipHeaderOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/skipHeaderOperations.test.js +0 -72
- package/dist/test/document-helpers/skipHeaderOperations.test.js.map +0 -1
- package/dist/test/document-helpers/sortOperations.test.d.ts +0 -2
- package/dist/test/document-helpers/sortOperations.test.d.ts.map +0 -1
- package/dist/test/document-helpers/sortOperations.test.js +0 -101
- package/dist/test/document-helpers/sortOperations.test.js.map +0 -1
- package/dist/test/document-helpers/split.test.d.ts +0 -2
- package/dist/test/document-helpers/split.test.d.ts.map +0 -1
- package/dist/test/document-helpers/split.test.js +0 -121
- package/dist/test/document-helpers/split.test.js.map +0 -1
- package/dist/test/document-helpers/utils.d.ts +0 -15
- package/dist/test/document-helpers/utils.d.ts.map +0 -1
- package/dist/test/document-helpers/utils.js +0 -61
- package/dist/test/document-helpers/utils.js.map +0 -1
- package/dist/test/document-model/replay.test.d.ts +0 -2
- package/dist/test/document-model/replay.test.d.ts.map +0 -1
- package/dist/test/document-model/replay.test.js +0 -139
- package/dist/test/document-model/replay.test.js.map +0 -1
- package/dist/test/document-model/skip-operations.test.d.ts +0 -2
- package/dist/test/document-model/skip-operations.test.d.ts.map +0 -1
- package/dist/test/document-model/skip-operations.test.js +0 -214
- package/dist/test/document-model/skip-operations.test.js.map +0 -1
- package/dist/test/document-model/validation.test.d.ts +0 -2
- package/dist/test/document-model/validation.test.d.ts.map +0 -1
- package/dist/test/document-model/validation.test.js +0 -451
- package/dist/test/document-model/validation.test.js.map +0 -1
- package/dist/test/document-model/versioning.test.d.ts +0 -2
- package/dist/test/document-model/versioning.test.d.ts.map +0 -1
- package/dist/test/document-model/versioning.test.js +0 -93
- package/dist/test/document-model/versioning.test.js.map +0 -1
- package/dist/test/document-model/zip.test.d.ts +0 -2
- package/dist/test/document-model/zip.test.d.ts.map +0 -1
- package/dist/test/document-model/zip.test.js +0 -79
- package/dist/test/document-model/zip.test.js.map +0 -1
- package/dist/test/helpers.d.ts +0 -79
- package/dist/test/helpers.d.ts.map +0 -1
- package/dist/test/helpers.js +0 -121
- package/dist/test/helpers.js.map +0 -1
- package/dist/test/index.d.ts +0 -4
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -3
- package/dist/test/index.js.map +0 -1
- package/dist/test/types.d.ts +0 -6
- package/dist/test/types.d.ts.map +0 -1
- package/dist/test/types.js +0 -2
- package/dist/test/types.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -7
- package/dist/vitest.config.js.map +0 -1
|
@@ -1,618 +0,0 @@
|
|
|
1
|
-
import { createReducer, isDocumentAction } from "document-model/core";
|
|
2
|
-
import { AddChangeLogItemInputSchema, AddModuleInputSchema, AddOperationErrorInputSchema, AddOperationExampleInputSchema, AddOperationInputSchema, AddStateExampleInputSchema, DeleteChangeLogItemInputSchema, DeleteModuleInputSchema, DeleteOperationErrorInputSchema, DeleteOperationExampleInputSchema, DeleteOperationInputSchema, DeleteStateExampleInputSchema, MoveOperationInputSchema, ReorderChangeLogItemsInputSchema, ReorderModuleOperationsInputSchema, ReorderModulesInputSchema, ReorderOperationErrorsInputSchema, ReorderOperationExamplesInputSchema, ReorderStateExamplesInputSchema, SetAuthorNameInputSchema, SetAuthorWebsiteInputSchema, SetInitialStateInputSchema, SetModelDescriptionInputSchema, SetModelExtensionInputSchema, SetModelIdInputSchema, SetModelNameInputSchema, SetModuleDescriptionInputSchema, SetModuleNameInputSchema, SetOperationDescriptionInputSchema, SetOperationErrorCodeInputSchema, SetOperationErrorDescriptionInputSchema, SetOperationErrorNameInputSchema, SetOperationErrorTemplateInputSchema, SetOperationNameInputSchema, SetOperationReducerInputSchema, SetOperationSchemaInputSchema, SetOperationScopeInputSchema, SetOperationTemplateInputSchema, SetStateSchemaInputSchema, UpdateChangeLogItemInputSchema, UpdateOperationExampleInputSchema, UpdateStateExampleInputSchema, } from "./schemas.js";
|
|
3
|
-
import { validateOperationName } from "./validation.js";
|
|
4
|
-
function sorter(order) {
|
|
5
|
-
const mapping = {};
|
|
6
|
-
order.forEach((key, index) => (mapping[key] = index));
|
|
7
|
-
return (a, b) => (mapping[b.id] || 999999) - (mapping[a.id] || 999999);
|
|
8
|
-
}
|
|
9
|
-
export const documentModelHeaderReducer = {
|
|
10
|
-
setModelNameOperation(state, action) {
|
|
11
|
-
state.name = action.input.name;
|
|
12
|
-
},
|
|
13
|
-
setModelIdOperation(state, action) {
|
|
14
|
-
state.id = action.input.id;
|
|
15
|
-
},
|
|
16
|
-
setModelExtensionOperation(state, action) {
|
|
17
|
-
state.extension = action.input.extension;
|
|
18
|
-
},
|
|
19
|
-
setModelDescriptionOperation(state, action) {
|
|
20
|
-
state.description = action.input.description;
|
|
21
|
-
},
|
|
22
|
-
setAuthorNameOperation(state, action) {
|
|
23
|
-
state.author = state.author || { name: "", website: null };
|
|
24
|
-
state.author.name = action.input.authorName;
|
|
25
|
-
},
|
|
26
|
-
setAuthorWebsiteOperation(state, action) {
|
|
27
|
-
state.author = state.author || { name: "", website: null };
|
|
28
|
-
state.author.website = action.input.authorWebsite;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
export const documentModelModuleReducer = {
|
|
32
|
-
addModuleOperation(state, action) {
|
|
33
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
34
|
-
latestSpec.modules.push({
|
|
35
|
-
id: action.input.id,
|
|
36
|
-
name: action.input.name,
|
|
37
|
-
description: action.input.description || "",
|
|
38
|
-
operations: [],
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
setModuleNameOperation(state, action) {
|
|
42
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
43
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
44
|
-
if (latestSpec.modules[i].id === action.input.id) {
|
|
45
|
-
latestSpec.modules[i].name = action.input.name || "";
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
setModuleDescriptionOperation(state, action) {
|
|
50
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
51
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
52
|
-
if (latestSpec.modules[i].id === action.input.id) {
|
|
53
|
-
latestSpec.modules[i].description = action.input.description || "";
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
deleteModuleOperation(state, action) {
|
|
58
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
59
|
-
latestSpec.modules = latestSpec.modules.filter((m) => m.id != action.input.id);
|
|
60
|
-
},
|
|
61
|
-
reorderModulesOperation(state, action) {
|
|
62
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
63
|
-
latestSpec.modules.sort(sorter(action.input.order));
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
export const documentModelOperationErrorReducer = {
|
|
67
|
-
addOperationErrorOperation(state, action) {
|
|
68
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
69
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
70
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
71
|
-
if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
|
|
72
|
-
latestSpec.modules[i].operations[j].errors.push({
|
|
73
|
-
id: action.input.id,
|
|
74
|
-
name: action.input.errorName || "",
|
|
75
|
-
code: action.input.errorCode || "",
|
|
76
|
-
description: action.input.errorDescription || "",
|
|
77
|
-
template: action.input.errorTemplate || "",
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
setOperationErrorCodeOperation(state, action) {
|
|
84
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
85
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
86
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
87
|
-
for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
|
|
88
|
-
if (latestSpec.modules[i].operations[j].errors[k].id ==
|
|
89
|
-
action.input.id) {
|
|
90
|
-
latestSpec.modules[i].operations[j].errors[k].code =
|
|
91
|
-
action.input.errorCode || "";
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
setOperationErrorNameOperation(state, action) {
|
|
98
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
99
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
100
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
101
|
-
for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
|
|
102
|
-
if (latestSpec.modules[i].operations[j].errors[k].id ==
|
|
103
|
-
action.input.id) {
|
|
104
|
-
latestSpec.modules[i].operations[j].errors[k].name =
|
|
105
|
-
action.input.errorName || "";
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
setOperationErrorDescriptionOperation(state, action) {
|
|
112
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
113
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
114
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
115
|
-
for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
|
|
116
|
-
if (latestSpec.modules[i].operations[j].errors[k].id ==
|
|
117
|
-
action.input.id) {
|
|
118
|
-
latestSpec.modules[i].operations[j].errors[k].description =
|
|
119
|
-
action.input.errorDescription || "";
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
setOperationErrorTemplateOperation(state, action) {
|
|
126
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
127
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
128
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
129
|
-
for (let k = 0; k < latestSpec.modules[i].operations[j].errors.length; k++) {
|
|
130
|
-
if (latestSpec.modules[i].operations[j].errors[k].id ==
|
|
131
|
-
action.input.id) {
|
|
132
|
-
latestSpec.modules[i].operations[j].errors[k].template =
|
|
133
|
-
action.input.errorTemplate || "";
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
deleteOperationErrorOperation(state, action) {
|
|
140
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
141
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
142
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
143
|
-
latestSpec.modules[i].operations[j].errors = latestSpec.modules[i].operations[j].errors.filter((e) => e.id != action.input.id);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
reorderOperationErrorsOperation(state, action) {
|
|
148
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
149
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
150
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
151
|
-
if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
|
|
152
|
-
latestSpec.modules[i].operations[j].errors.sort(sorter(action.input.order));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
export const documentModelOperationExampleReducer = {
|
|
159
|
-
addOperationExampleOperation(state, action) {
|
|
160
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
161
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
162
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
163
|
-
if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
|
|
164
|
-
latestSpec.modules[i].operations[j].examples.push({
|
|
165
|
-
id: action.input.id,
|
|
166
|
-
value: action.input.example,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
updateOperationExampleOperation(state, action) {
|
|
173
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
174
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
175
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
176
|
-
for (let k = 0; k < latestSpec.modules[i].operations[j].examples.length; k++) {
|
|
177
|
-
if (latestSpec.modules[i].operations[j].examples[k].id ==
|
|
178
|
-
action.input.id) {
|
|
179
|
-
latestSpec.modules[i].operations[j].examples[k].value =
|
|
180
|
-
action.input.example;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
deleteOperationExampleOperation(state, action) {
|
|
187
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
188
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
189
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
190
|
-
latestSpec.modules[i].operations[j].examples = latestSpec.modules[i].operations[j].examples.filter((e) => e.id != action.input.id);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
reorderOperationExamplesOperation(state, action) {
|
|
195
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
196
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
197
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
198
|
-
if (latestSpec.modules[i].operations[j].id == action.input.operationId) {
|
|
199
|
-
latestSpec.modules[i].operations[j].examples.sort(sorter(action.input.order));
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
export const documentModelOperationReducer = {
|
|
206
|
-
addOperationOperation(state, action) {
|
|
207
|
-
validateOperationName(action.input.name, state);
|
|
208
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
209
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
210
|
-
if (latestSpec.modules[i].id == action.input.moduleId) {
|
|
211
|
-
latestSpec.modules[i].operations.push({
|
|
212
|
-
id: action.input.id,
|
|
213
|
-
name: action.input.name,
|
|
214
|
-
description: action.input.description || "",
|
|
215
|
-
schema: action.input.schema || "",
|
|
216
|
-
template: action.input.template || action.input.description || "",
|
|
217
|
-
reducer: action.input.reducer || "",
|
|
218
|
-
errors: [],
|
|
219
|
-
examples: [],
|
|
220
|
-
scope: action.input.scope || "global",
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
setOperationNameOperation(state, action) {
|
|
226
|
-
if (action.input.name) {
|
|
227
|
-
validateOperationName(action.input.name, state, action.input.id);
|
|
228
|
-
}
|
|
229
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
230
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
231
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
232
|
-
if (latestSpec.modules[i].operations[j].id == action.input.id) {
|
|
233
|
-
latestSpec.modules[i].operations[j].name = action.input.name || "";
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
setOperationScopeOperation(state, action) {
|
|
239
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
240
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
241
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
242
|
-
if (latestSpec.modules[i].operations[j].id == action.input.id) {
|
|
243
|
-
latestSpec.modules[i].operations[j].scope =
|
|
244
|
-
action.input.scope || "global";
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
setOperationSchemaOperation(state, action) {
|
|
250
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
251
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
252
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
253
|
-
if (latestSpec.modules[i].operations[j].id == action.input.id) {
|
|
254
|
-
latestSpec.modules[i].operations[j].schema =
|
|
255
|
-
action.input.schema || "";
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
setOperationDescriptionOperation(state, action) {
|
|
261
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
262
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
263
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
264
|
-
if (latestSpec.modules[i].operations[j].id == action.input.id) {
|
|
265
|
-
latestSpec.modules[i].operations[j].description =
|
|
266
|
-
action.input.description || "";
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
setOperationTemplateOperation(state, action) {
|
|
272
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
273
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
274
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
275
|
-
if (latestSpec.modules[i].operations[j].id == action.input.id) {
|
|
276
|
-
latestSpec.modules[i].operations[j].template =
|
|
277
|
-
action.input.template || "";
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
setOperationReducerOperation(state, action) {
|
|
283
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
284
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
285
|
-
for (let j = 0; j < latestSpec.modules[i].operations.length; j++) {
|
|
286
|
-
if (latestSpec.modules[i].operations[j].id == action.input.id) {
|
|
287
|
-
latestSpec.modules[i].operations[j].reducer =
|
|
288
|
-
action.input.reducer || "";
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
moveOperationOperation(state, action) {
|
|
294
|
-
const moveOperations = [];
|
|
295
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
296
|
-
// Filter and collect
|
|
297
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
298
|
-
latestSpec.modules[i].operations = latestSpec.modules[i].operations.filter((operation) => {
|
|
299
|
-
if (operation.id == action.input.operationId) {
|
|
300
|
-
moveOperations.push(operation);
|
|
301
|
-
return false;
|
|
302
|
-
}
|
|
303
|
-
return true;
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
// Inject in target modules
|
|
307
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
308
|
-
if (latestSpec.modules[i].id == action.input.newModuleId) {
|
|
309
|
-
latestSpec.modules[i].operations.push(...moveOperations);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
},
|
|
313
|
-
deleteOperationOperation(state, action) {
|
|
314
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
315
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
316
|
-
latestSpec.modules[i].operations = latestSpec.modules[i].operations.filter((operation) => operation.id != action.input.id);
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
reorderModuleOperationsOperation(state, action) {
|
|
320
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
321
|
-
for (let i = 0; i < latestSpec.modules.length; i++) {
|
|
322
|
-
if (latestSpec.modules[i].id == action.input.moduleId) {
|
|
323
|
-
latestSpec.modules[i].operations.sort(sorter(action.input.order));
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
};
|
|
328
|
-
export const documentModelStateSchemaReducer = {
|
|
329
|
-
setStateSchemaOperation(state, action) {
|
|
330
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
331
|
-
if (Object.keys(latestSpec.state).includes(action.input.scope)) {
|
|
332
|
-
latestSpec.state[action.input.scope].schema =
|
|
333
|
-
action.input.schema;
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
setInitialStateOperation(state, action) {
|
|
340
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
341
|
-
if (Object.keys(latestSpec.state).includes(action.input.scope)) {
|
|
342
|
-
latestSpec.state[action.input.scope].initialValue =
|
|
343
|
-
action.input.initialValue;
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
addStateExampleOperation(state, action) {
|
|
350
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
351
|
-
if (Object.keys(latestSpec.state).includes(action.input.scope)) {
|
|
352
|
-
latestSpec.state[action.input.scope].examples.push({
|
|
353
|
-
id: action.input.id,
|
|
354
|
-
value: action.input.example,
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
updateStateExampleOperation(state, action) {
|
|
362
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
363
|
-
if (!Object.keys(latestSpec.state).includes(action.input.scope)) {
|
|
364
|
-
throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
365
|
-
}
|
|
366
|
-
const examples = latestSpec.state[action.input.scope].examples;
|
|
367
|
-
for (let i = 0; i < examples.length; i++) {
|
|
368
|
-
if (examples[i].id == action.input.id) {
|
|
369
|
-
examples[i].value = action.input.newExample;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
deleteStateExampleOperation(state, action) {
|
|
374
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
375
|
-
if (Object.keys(latestSpec.state).includes(action.input.scope)) {
|
|
376
|
-
latestSpec.state[action.input.scope].examples =
|
|
377
|
-
latestSpec.state[action.input.scope].examples.filter((e) => e.id != action.input.id);
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
reorderStateExamplesOperation(state, action) {
|
|
384
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
385
|
-
if (Object.keys(latestSpec.state).includes(action.input.scope)) {
|
|
386
|
-
latestSpec.state[action.input.scope].examples.sort(sorter(action.input.order));
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
};
|
|
393
|
-
export const documentModelVersioningReducer = {
|
|
394
|
-
addChangeLogItemOperation(state, action) {
|
|
395
|
-
throw new Error('Reducer "addChangeLogItemOperation" not yet implemented');
|
|
396
|
-
},
|
|
397
|
-
updateChangeLogItemOperation(state, action) {
|
|
398
|
-
throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented');
|
|
399
|
-
},
|
|
400
|
-
deleteChangeLogItemOperation(state, action) {
|
|
401
|
-
throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented');
|
|
402
|
-
},
|
|
403
|
-
reorderChangeLogItemsOperation(state, action) {
|
|
404
|
-
throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented');
|
|
405
|
-
},
|
|
406
|
-
releaseNewVersionOperation(state, action) {
|
|
407
|
-
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
408
|
-
const copiedModules = latestSpec.modules.map((module) => ({
|
|
409
|
-
...module,
|
|
410
|
-
operations: module.operations.map((op) => ({
|
|
411
|
-
...op,
|
|
412
|
-
errors: op.errors.map((err) => ({ ...err })),
|
|
413
|
-
examples: op.examples.map((ex) => ({ ...ex })),
|
|
414
|
-
})),
|
|
415
|
-
}));
|
|
416
|
-
const copiedState = {
|
|
417
|
-
global: {
|
|
418
|
-
...latestSpec.state.global,
|
|
419
|
-
examples: latestSpec.state.global.examples.map((ex) => ({ ...ex })),
|
|
420
|
-
},
|
|
421
|
-
local: {
|
|
422
|
-
...latestSpec.state.local,
|
|
423
|
-
examples: latestSpec.state.local.examples.map((ex) => ({ ...ex })),
|
|
424
|
-
},
|
|
425
|
-
};
|
|
426
|
-
const newSpec = {
|
|
427
|
-
version: latestSpec.version + 1,
|
|
428
|
-
changeLog: [],
|
|
429
|
-
state: copiedState,
|
|
430
|
-
modules: copiedModules,
|
|
431
|
-
};
|
|
432
|
-
state.specifications.push(newSpec);
|
|
433
|
-
},
|
|
434
|
-
};
|
|
435
|
-
export const documentModelStateReducer = (state, action) => {
|
|
436
|
-
if (isDocumentAction(action)) {
|
|
437
|
-
return state;
|
|
438
|
-
}
|
|
439
|
-
switch (action.type) {
|
|
440
|
-
case "SET_MODEL_NAME":
|
|
441
|
-
SetModelNameInputSchema().parse(action.input);
|
|
442
|
-
documentModelHeaderReducer.setModelNameOperation(state.global, action);
|
|
443
|
-
break;
|
|
444
|
-
case "SET_MODEL_ID":
|
|
445
|
-
SetModelIdInputSchema().parse(action.input);
|
|
446
|
-
documentModelHeaderReducer.setModelIdOperation(state.global, action);
|
|
447
|
-
break;
|
|
448
|
-
case "SET_MODEL_EXTENSION":
|
|
449
|
-
SetModelExtensionInputSchema().parse(action.input);
|
|
450
|
-
documentModelHeaderReducer.setModelExtensionOperation(state.global, action);
|
|
451
|
-
break;
|
|
452
|
-
case "SET_MODEL_DESCRIPTION":
|
|
453
|
-
SetModelDescriptionInputSchema().parse(action.input);
|
|
454
|
-
documentModelHeaderReducer.setModelDescriptionOperation(state.global, action);
|
|
455
|
-
break;
|
|
456
|
-
case "SET_AUTHOR_NAME":
|
|
457
|
-
SetAuthorNameInputSchema().parse(action.input);
|
|
458
|
-
documentModelHeaderReducer.setAuthorNameOperation(state.global, action);
|
|
459
|
-
break;
|
|
460
|
-
case "SET_AUTHOR_WEBSITE":
|
|
461
|
-
SetAuthorWebsiteInputSchema().parse(action.input);
|
|
462
|
-
documentModelHeaderReducer.setAuthorWebsiteOperation(state.global, action);
|
|
463
|
-
break;
|
|
464
|
-
case "ADD_CHANGE_LOG_ITEM":
|
|
465
|
-
AddChangeLogItemInputSchema().parse(action.input);
|
|
466
|
-
documentModelVersioningReducer.addChangeLogItemOperation(state.global, action);
|
|
467
|
-
break;
|
|
468
|
-
case "UPDATE_CHANGE_LOG_ITEM":
|
|
469
|
-
UpdateChangeLogItemInputSchema().parse(action.input);
|
|
470
|
-
documentModelVersioningReducer.updateChangeLogItemOperation(state.global, action);
|
|
471
|
-
break;
|
|
472
|
-
case "DELETE_CHANGE_LOG_ITEM":
|
|
473
|
-
DeleteChangeLogItemInputSchema().parse(action.input);
|
|
474
|
-
documentModelVersioningReducer.deleteChangeLogItemOperation(state.global, action);
|
|
475
|
-
break;
|
|
476
|
-
case "REORDER_CHANGE_LOG_ITEMS":
|
|
477
|
-
ReorderChangeLogItemsInputSchema().parse(action.input);
|
|
478
|
-
documentModelVersioningReducer.reorderChangeLogItemsOperation(state.global, action);
|
|
479
|
-
break;
|
|
480
|
-
case "RELEASE_NEW_VERSION":
|
|
481
|
-
if (Object.keys(action.input).length > 0)
|
|
482
|
-
throw new Error("Expected empty input for action RELEASE_NEW_VERSION");
|
|
483
|
-
documentModelVersioningReducer.releaseNewVersionOperation(state.global, action);
|
|
484
|
-
break;
|
|
485
|
-
case "ADD_MODULE":
|
|
486
|
-
AddModuleInputSchema().parse(action.input);
|
|
487
|
-
documentModelModuleReducer.addModuleOperation(state.global, action);
|
|
488
|
-
break;
|
|
489
|
-
case "SET_MODULE_NAME":
|
|
490
|
-
SetModuleNameInputSchema().parse(action.input);
|
|
491
|
-
documentModelModuleReducer.setModuleNameOperation(state.global, action);
|
|
492
|
-
break;
|
|
493
|
-
case "SET_MODULE_DESCRIPTION":
|
|
494
|
-
SetModuleDescriptionInputSchema().parse(action.input);
|
|
495
|
-
documentModelModuleReducer.setModuleDescriptionOperation(state.global, action);
|
|
496
|
-
break;
|
|
497
|
-
case "DELETE_MODULE":
|
|
498
|
-
DeleteModuleInputSchema().parse(action.input);
|
|
499
|
-
documentModelModuleReducer.deleteModuleOperation(state.global, action);
|
|
500
|
-
break;
|
|
501
|
-
case "REORDER_MODULES":
|
|
502
|
-
ReorderModulesInputSchema().parse(action.input);
|
|
503
|
-
documentModelModuleReducer.reorderModulesOperation(state.global, action);
|
|
504
|
-
break;
|
|
505
|
-
case "ADD_OPERATION_ERROR":
|
|
506
|
-
AddOperationErrorInputSchema().parse(action.input);
|
|
507
|
-
documentModelOperationErrorReducer.addOperationErrorOperation(state.global, action);
|
|
508
|
-
break;
|
|
509
|
-
case "SET_OPERATION_ERROR_CODE":
|
|
510
|
-
SetOperationErrorCodeInputSchema().parse(action.input);
|
|
511
|
-
documentModelOperationErrorReducer.setOperationErrorCodeOperation(state.global, action);
|
|
512
|
-
break;
|
|
513
|
-
case "SET_OPERATION_ERROR_NAME":
|
|
514
|
-
SetOperationErrorNameInputSchema().parse(action.input);
|
|
515
|
-
documentModelOperationErrorReducer.setOperationErrorNameOperation(state.global, action);
|
|
516
|
-
break;
|
|
517
|
-
case "SET_OPERATION_ERROR_DESCRIPTION":
|
|
518
|
-
SetOperationErrorDescriptionInputSchema().parse(action.input);
|
|
519
|
-
documentModelOperationErrorReducer.setOperationErrorDescriptionOperation(state.global, action);
|
|
520
|
-
break;
|
|
521
|
-
case "SET_OPERATION_ERROR_TEMPLATE":
|
|
522
|
-
SetOperationErrorTemplateInputSchema().parse(action.input);
|
|
523
|
-
documentModelOperationErrorReducer.setOperationErrorTemplateOperation(state.global, action);
|
|
524
|
-
break;
|
|
525
|
-
case "DELETE_OPERATION_ERROR":
|
|
526
|
-
DeleteOperationErrorInputSchema().parse(action.input);
|
|
527
|
-
documentModelOperationErrorReducer.deleteOperationErrorOperation(state.global, action);
|
|
528
|
-
break;
|
|
529
|
-
case "REORDER_OPERATION_ERRORS":
|
|
530
|
-
ReorderOperationErrorsInputSchema().parse(action.input);
|
|
531
|
-
documentModelOperationErrorReducer.reorderOperationErrorsOperation(state.global, action);
|
|
532
|
-
break;
|
|
533
|
-
case "ADD_OPERATION_EXAMPLE":
|
|
534
|
-
AddOperationExampleInputSchema().parse(action.input);
|
|
535
|
-
documentModelOperationExampleReducer.addOperationExampleOperation(state.global, action);
|
|
536
|
-
break;
|
|
537
|
-
case "UPDATE_OPERATION_EXAMPLE":
|
|
538
|
-
UpdateOperationExampleInputSchema().parse(action.input);
|
|
539
|
-
documentModelOperationExampleReducer.updateOperationExampleOperation(state.global, action);
|
|
540
|
-
break;
|
|
541
|
-
case "DELETE_OPERATION_EXAMPLE":
|
|
542
|
-
DeleteOperationExampleInputSchema().parse(action.input);
|
|
543
|
-
documentModelOperationExampleReducer.deleteOperationExampleOperation(state.global, action);
|
|
544
|
-
break;
|
|
545
|
-
case "REORDER_OPERATION_EXAMPLES":
|
|
546
|
-
ReorderOperationExamplesInputSchema().parse(action.input);
|
|
547
|
-
documentModelOperationExampleReducer.reorderOperationExamplesOperation(state.global, action);
|
|
548
|
-
break;
|
|
549
|
-
case "ADD_OPERATION":
|
|
550
|
-
AddOperationInputSchema().parse(action.input);
|
|
551
|
-
documentModelOperationReducer.addOperationOperation(state.global, action);
|
|
552
|
-
break;
|
|
553
|
-
case "SET_OPERATION_NAME":
|
|
554
|
-
SetOperationNameInputSchema().parse(action.input);
|
|
555
|
-
documentModelOperationReducer.setOperationNameOperation(state.global, action);
|
|
556
|
-
break;
|
|
557
|
-
case "SET_OPERATION_SCOPE":
|
|
558
|
-
SetOperationScopeInputSchema().parse(action.input);
|
|
559
|
-
documentModelOperationReducer.setOperationScopeOperation(state.global, action);
|
|
560
|
-
break;
|
|
561
|
-
case "SET_OPERATION_SCHEMA":
|
|
562
|
-
SetOperationSchemaInputSchema().parse(action.input);
|
|
563
|
-
documentModelOperationReducer.setOperationSchemaOperation(state.global, action);
|
|
564
|
-
break;
|
|
565
|
-
case "SET_OPERATION_DESCRIPTION":
|
|
566
|
-
SetOperationDescriptionInputSchema().parse(action.input);
|
|
567
|
-
documentModelOperationReducer.setOperationDescriptionOperation(state.global, action);
|
|
568
|
-
break;
|
|
569
|
-
case "SET_OPERATION_TEMPLATE":
|
|
570
|
-
SetOperationTemplateInputSchema().parse(action.input);
|
|
571
|
-
documentModelOperationReducer.setOperationTemplateOperation(state.global, action);
|
|
572
|
-
break;
|
|
573
|
-
case "SET_OPERATION_REDUCER":
|
|
574
|
-
SetOperationReducerInputSchema().parse(action.input);
|
|
575
|
-
documentModelOperationReducer.setOperationReducerOperation(state.global, action);
|
|
576
|
-
break;
|
|
577
|
-
case "MOVE_OPERATION":
|
|
578
|
-
MoveOperationInputSchema().parse(action.input);
|
|
579
|
-
documentModelOperationReducer.moveOperationOperation(state.global, action);
|
|
580
|
-
break;
|
|
581
|
-
case "DELETE_OPERATION":
|
|
582
|
-
DeleteOperationInputSchema().parse(action.input);
|
|
583
|
-
documentModelOperationReducer.deleteOperationOperation(state.global, action);
|
|
584
|
-
break;
|
|
585
|
-
case "REORDER_MODULE_OPERATIONS":
|
|
586
|
-
ReorderModuleOperationsInputSchema().parse(action.input);
|
|
587
|
-
documentModelOperationReducer.reorderModuleOperationsOperation(state.global, action);
|
|
588
|
-
break;
|
|
589
|
-
case "SET_STATE_SCHEMA":
|
|
590
|
-
SetStateSchemaInputSchema().parse(action.input);
|
|
591
|
-
documentModelStateSchemaReducer.setStateSchemaOperation(state.global, action);
|
|
592
|
-
break;
|
|
593
|
-
case "SET_INITIAL_STATE":
|
|
594
|
-
SetInitialStateInputSchema().parse(action.input);
|
|
595
|
-
documentModelStateSchemaReducer.setInitialStateOperation(state.global, action);
|
|
596
|
-
break;
|
|
597
|
-
case "ADD_STATE_EXAMPLE":
|
|
598
|
-
AddStateExampleInputSchema().parse(action.input);
|
|
599
|
-
documentModelStateSchemaReducer.addStateExampleOperation(state.global, action);
|
|
600
|
-
break;
|
|
601
|
-
case "UPDATE_STATE_EXAMPLE":
|
|
602
|
-
UpdateStateExampleInputSchema().parse(action.input);
|
|
603
|
-
documentModelStateSchemaReducer.updateStateExampleOperation(state.global, action);
|
|
604
|
-
break;
|
|
605
|
-
case "DELETE_STATE_EXAMPLE":
|
|
606
|
-
DeleteStateExampleInputSchema().parse(action.input);
|
|
607
|
-
documentModelStateSchemaReducer.deleteStateExampleOperation(state.global, action);
|
|
608
|
-
break;
|
|
609
|
-
case "REORDER_STATE_EXAMPLES":
|
|
610
|
-
ReorderStateExamplesInputSchema().parse(action.input);
|
|
611
|
-
documentModelStateSchemaReducer.reorderStateExamplesOperation(state.global, action);
|
|
612
|
-
break;
|
|
613
|
-
default:
|
|
614
|
-
return state;
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
export const documentModelReducer = createReducer(documentModelStateReducer);
|
|
618
|
-
//# sourceMappingURL=reducers.js.map
|