document-model 1.0.17 → 1.0.18
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/browser/document-model/gen/header/object.d.ts +2 -2
- package/dist/browser/document-model/gen/module/object.d.ts +2 -2
- package/dist/browser/document-model/gen/object.d.ts +4 -4
- package/dist/browser/document-model/gen/operation/object.d.ts +2 -2
- package/dist/browser/document-model/gen/operation-error/object.d.ts +2 -2
- package/dist/browser/document-model/gen/operation-example/object.d.ts +2 -2
- package/dist/browser/document-model/gen/reducer.d.ts +2 -2
- package/dist/browser/document-model/gen/schema/types.d.ts +1 -1
- package/dist/browser/document-model/gen/state/object.d.ts +2 -2
- package/dist/browser/document-model/gen/types.d.ts +3 -3
- package/dist/browser/document-model/gen/utils.d.ts +4 -2
- package/dist/browser/document-model/gen/versioning/object.d.ts +2 -2
- package/dist/browser/document-model/index.d.ts +9 -9
- package/dist/browser/document-model.cjs +1 -1
- package/dist/browser/document-model.js +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/internal/{index-5f1909ad.js → index-10a12861.js} +21 -20
- package/dist/browser/internal/{index-01030c3f.js → index-ec8cd58f.js} +1 -1
- package/dist/node/document-model/gen/header/object.d.ts +2 -2
- package/dist/node/document-model/gen/module/object.d.ts +2 -2
- package/dist/node/document-model/gen/object.d.ts +4 -4
- package/dist/node/document-model/gen/operation/object.d.ts +2 -2
- package/dist/node/document-model/gen/operation-error/object.d.ts +2 -2
- package/dist/node/document-model/gen/operation-example/object.d.ts +2 -2
- package/dist/node/document-model/gen/reducer.d.ts +2 -2
- package/dist/node/document-model/gen/schema/types.d.ts +1 -1
- package/dist/node/document-model/gen/state/object.d.ts +2 -2
- package/dist/node/document-model/gen/types.d.ts +3 -3
- package/dist/node/document-model/gen/utils.d.ts +4 -2
- package/dist/node/document-model/gen/versioning/object.d.ts +2 -2
- package/dist/node/document-model/index.d.ts +9 -9
- package/dist/node/document-model.cjs +1 -1
- package/dist/node/document-model.js +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +1 -1
- package/dist/node/internal/{index-0db636da.js → index-09364517.js} +21 -20
- package/dist/node/internal/{index-cddc9dfd.js → index-284511b8.js} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { SetModelNameInput, SetModelIdInput, SetModelExtensionInput, SetModelDescriptionInput, SetAuthorNameInput, SetAuthorWebsiteInput, DocumentModelState } from '../types';
|
|
2
|
+
import { SetModelNameInput, SetModelIdInput, SetModelExtensionInput, SetModelDescriptionInput, SetAuthorNameInput, SetAuthorWebsiteInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Header extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Header extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
setModelName(input: SetModelNameInput): this;
|
|
6
6
|
setModelId(input: SetModelIdInput): this;
|
|
7
7
|
setModelExtension(input: SetModelExtensionInput): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddModuleInput, SetModuleNameInput, SetModuleDescriptionInput, DeleteModuleInput, ReorderModulesInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddModuleInput, SetModuleNameInput, SetModuleDescriptionInput, DeleteModuleInput, ReorderModulesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Module extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Module extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addModule(input: AddModuleInput): this;
|
|
6
6
|
setModuleName(input: SetModuleNameInput): this;
|
|
7
7
|
setModuleDescription(input: SetModuleDescriptionInput): this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentModelState } from './types';
|
|
2
|
-
import { ExtendedState, SignalDispatch } from '../../document';
|
|
1
|
+
import { DocumentModelLocalState, DocumentModelState } from './types';
|
|
2
|
+
import { ExtendedState, PartialState, SignalDispatch } from '../../document';
|
|
3
3
|
import { BaseDocument } from '../../document/object';
|
|
4
4
|
import { DocumentModelAction } from './actions';
|
|
5
5
|
import DocumentModel_Header from './header/object';
|
|
@@ -18,9 +18,9 @@ export * from './operation/object';
|
|
|
18
18
|
export * from './state/object';
|
|
19
19
|
interface DocumentModel extends DocumentModel_Header, DocumentModel_Versioning, DocumentModel_Module, DocumentModel_OperationError, DocumentModel_OperationExample, DocumentModel_Operation, DocumentModel_State {
|
|
20
20
|
}
|
|
21
|
-
declare class DocumentModel extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
21
|
+
declare class DocumentModel extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
22
22
|
static fileExtension: string;
|
|
23
|
-
constructor(initialState?: Partial<ExtendedState<
|
|
23
|
+
constructor(initialState?: Partial<ExtendedState<PartialState<DocumentModelState>, PartialState<DocumentModelLocalState>>>, dispatch?: SignalDispatch);
|
|
24
24
|
saveToFile(path: string, name?: string): Promise<string>;
|
|
25
25
|
loadFromFile(path: string): Promise<void>;
|
|
26
26
|
static fromFile(path: string): Promise<DocumentModel>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState, SetOperationScopeInput } from '../types';
|
|
2
|
+
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState, SetOperationScopeInput, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Operation extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Operation extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addOperation(input: AddOperationInput): this;
|
|
6
6
|
setOperationName(input: SetOperationNameInput): this;
|
|
7
7
|
setOperationScope(input: SetOperationScopeInput): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationErrorInput, SetOperationErrorCodeInput, SetOperationErrorNameInput, SetOperationErrorDescriptionInput, SetOperationErrorTemplateInput, DeleteOperationErrorInput, ReorderOperationErrorsInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddOperationErrorInput, SetOperationErrorCodeInput, SetOperationErrorNameInput, SetOperationErrorDescriptionInput, SetOperationErrorTemplateInput, DeleteOperationErrorInput, ReorderOperationErrorsInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_OperationError extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_OperationError extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addOperationError(input: AddOperationErrorInput): this;
|
|
6
6
|
setOperationErrorCode(input: SetOperationErrorCodeInput): this;
|
|
7
7
|
setOperationErrorName(input: SetOperationErrorNameInput): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationExampleInput, UpdateOperationExampleInput, DeleteOperationExampleInput, ReorderOperationExamplesInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddOperationExampleInput, UpdateOperationExampleInput, DeleteOperationExampleInput, ReorderOperationExamplesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_OperationExample extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_OperationExample extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addOperationExample(input: AddOperationExampleInput): this;
|
|
6
6
|
updateOperationExample(input: UpdateOperationExampleInput): this;
|
|
7
7
|
deleteOperationExample(input: DeleteOperationExampleInput): this;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocumentModelState } from './schema';
|
|
1
|
+
import { DocumentModelLocalState, DocumentModelState } from './schema';
|
|
2
2
|
import { DocumentModelAction } from './actions';
|
|
3
|
-
export declare const reducer: import("../../document/types").Reducer<DocumentModelState, DocumentModelAction,
|
|
3
|
+
export declare const reducer: import("../../document/types").Reducer<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
@@ -127,7 +127,7 @@ export type ScopeState = {
|
|
|
127
127
|
global: State;
|
|
128
128
|
local: State;
|
|
129
129
|
};
|
|
130
|
-
export type DocumentModelLocalState =
|
|
130
|
+
export type DocumentModelLocalState = {};
|
|
131
131
|
export type DocumentSpecification = {
|
|
132
132
|
__typename?: 'DocumentSpecification';
|
|
133
133
|
changeLog: Array<Scalars['String']['output']>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { SetStateSchemaInput, SetInitialStateInput, AddStateExampleInput, UpdateStateExampleInput, DeleteStateExampleInput, ReorderStateExamplesInput, DocumentModelState } from '../types';
|
|
2
|
+
import { SetStateSchemaInput, SetInitialStateInput, AddStateExampleInput, UpdateStateExampleInput, DeleteStateExampleInput, ReorderStateExamplesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_State extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_State extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
setStateSchema(input: SetStateSchemaInput): this;
|
|
6
6
|
setInitialState(input: SetInitialStateInput): this;
|
|
7
7
|
addStateExample(input: AddStateExampleInput): this;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Document, ExtendedState } from '../../document/types';
|
|
2
|
-
import type { DocumentModelState } from './schema/types';
|
|
2
|
+
import type { DocumentModelState, DocumentModelLocalState } from './schema/types';
|
|
3
3
|
import type { DocumentModelAction } from './actions';
|
|
4
4
|
export { z } from './schema';
|
|
5
5
|
export type * from './schema/types';
|
|
6
6
|
export type ExtendedDocumentModelState = ExtendedState<DocumentModelState>;
|
|
7
|
-
export type DocumentModelDocument = Document<DocumentModelState, DocumentModelAction>;
|
|
8
|
-
export { DocumentModelState, DocumentModelAction };
|
|
7
|
+
export type DocumentModelDocument = Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
8
|
+
export { DocumentModelState, DocumentModelAction, DocumentModelLocalState };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DocumentModelUtils } from '../../document';
|
|
2
|
-
import { DocumentModelAction, DocumentModelState } from './types';
|
|
3
|
-
declare const
|
|
2
|
+
import { DocumentModelAction, DocumentModelLocalState, DocumentModelState } from './types';
|
|
3
|
+
export declare const initialGlobalState: DocumentModelState;
|
|
4
|
+
export declare const initialLocalState: DocumentModelLocalState;
|
|
5
|
+
declare const utils: DocumentModelUtils<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
4
6
|
export default utils;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddChangeLogItemInput, UpdateChangeLogItemInput, DeleteChangeLogItemInput, ReorderChangeLogItemsInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddChangeLogItemInput, UpdateChangeLogItemInput, DeleteChangeLogItemInput, ReorderChangeLogItemsInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Versioning extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Versioning extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addChangeLogItem(input: AddChangeLogItemInput): this;
|
|
6
6
|
updateChangeLogItem(input: UpdateChangeLogItemInput): this;
|
|
7
7
|
deleteChangeLogItem(input: DeleteChangeLogItemInput): this;
|
|
@@ -6,17 +6,17 @@ import { DocumentModel as _DocumentModel } from '../document';
|
|
|
6
6
|
import { DocumentModel } from './gen';
|
|
7
7
|
import { documentModel } from './gen/document-model';
|
|
8
8
|
import { reducer } from './gen/reducer';
|
|
9
|
-
import { DocumentModelAction, DocumentModelState } from './gen/types';
|
|
9
|
+
import { DocumentModelAction, DocumentModelLocalState, DocumentModelState } from './gen/types';
|
|
10
10
|
declare const Document: typeof DocumentModel;
|
|
11
11
|
declare const utils: {
|
|
12
12
|
fileExtension: string;
|
|
13
|
-
createState: import("../document").CreateState<DocumentModelState,
|
|
14
|
-
createExtendedState: (extendedState?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>,
|
|
15
|
-
createDocument: (document?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>,
|
|
16
|
-
loadFromFile: (path: string) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
17
|
-
loadFromInput: (input: import("../document").FileInput) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
18
|
-
saveToFile: (document: import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
19
|
-
saveToFileHandle: (document: import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
13
|
+
createState: import("../document").CreateState<DocumentModelState, DocumentModelLocalState>;
|
|
14
|
+
createExtendedState: (extendedState?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>, import("../document").PartialState<DocumentModelLocalState>>> | undefined, createState?: import("../document").CreateState<DocumentModelState, DocumentModelLocalState> | undefined) => import("../document").ExtendedState<DocumentModelState, DocumentModelLocalState>;
|
|
15
|
+
createDocument: (document?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>, import("../document").PartialState<DocumentModelLocalState>>> | undefined, createState?: import("../document").CreateState<DocumentModelState, DocumentModelLocalState> | undefined) => import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
16
|
+
loadFromFile: (path: string) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>>;
|
|
17
|
+
loadFromInput: (input: import("../document").FileInput) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>>;
|
|
18
|
+
saveToFile: (document: import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>, path: string, name?: string | undefined) => Promise<string>;
|
|
19
|
+
saveToFileHandle: (document: import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>, input: FileSystemFileHandle) => Promise<void>;
|
|
20
20
|
};
|
|
21
21
|
declare const actions: {
|
|
22
22
|
setModelName: (input: import("./gen").SetModelNameInput) => import("./gen").SetModelNameAction;
|
|
@@ -68,7 +68,7 @@ declare const actions: {
|
|
|
68
68
|
prune: (start?: number | undefined, end?: number | undefined) => import("../document").PruneAction;
|
|
69
69
|
loadState: <S, T>(state: Pick<import("../document").ExtendedState<S, T>, "name" | "state">, operations: number) => import("../document").LoadStateAction;
|
|
70
70
|
};
|
|
71
|
-
export declare const module: _DocumentModel<DocumentModelState, DocumentModelAction,
|
|
71
|
+
export declare const module: _DocumentModel<DocumentModelState, DocumentModelAction, DocumentModelLocalState, DocumentModel>;
|
|
72
72
|
export * from './custom/utils';
|
|
73
73
|
export * from './gen/types';
|
|
74
74
|
export { DocumentModel, Document, reducer, actions, utils, documentModel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-24df9d92.js");require("json-stringify-deterministic");require("immer");require("jszip");const e=require("./internal/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-24df9d92.js");require("json-stringify-deterministic");require("immer");require("jszip");const e=require("./internal/index-ec8cd58f.js");require("zod");exports.Document=e.Document;exports.DocumentModel=e.DocumentModel$1;exports.actions=e.actions;exports.documentModel=e.documentModel;exports.module=e.module;exports.reducer=e.reducer;exports.utils=e.utils;exports.z=e.zod;
|
|
@@ -2,7 +2,7 @@ import "./internal/object-7e8eaff4.js";
|
|
|
2
2
|
import "json-stringify-deterministic";
|
|
3
3
|
import "immer";
|
|
4
4
|
import "jszip";
|
|
5
|
-
import { b as i, a as u, c, d, m as p, r as l, u as n, z as D } from "./internal/index-
|
|
5
|
+
import { b as i, a as u, c, d, m as p, r as l, u as n, z as D } from "./internal/index-10a12861.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
export {
|
|
8
8
|
i as Document,
|
package/dist/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-2aee8ea9.js"),o=require("./internal/index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-2aee8ea9.js"),o=require("./internal/index-ec8cd58f.js");require("./internal/object-24df9d92.js");require("json-stringify-deterministic");require("immer");require("jszip");require("zod");const u={"powerhouse/document":e.Document,"powerhouse/document-model":o.DocumentModel},t={Document:e.Document,DocumentModel:o.DocumentModel};exports.Document=e.Document;exports.DocumentModel=o.DocumentModel;exports.DocumentModels=u;exports.default=t;
|
package/dist/browser/index.js
CHANGED
|
@@ -1486,9 +1486,7 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1486
1486
|
default:
|
|
1487
1487
|
return t;
|
|
1488
1488
|
}
|
|
1489
|
-
}, g = mt(
|
|
1490
|
-
Ct
|
|
1491
|
-
), kt = {
|
|
1489
|
+
}, g = mt(Ct), kt = {
|
|
1492
1490
|
id: "",
|
|
1493
1491
|
name: "",
|
|
1494
1492
|
extension: "",
|
|
@@ -1516,10 +1514,13 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1516
1514
|
modules: []
|
|
1517
1515
|
}
|
|
1518
1516
|
]
|
|
1519
|
-
}, O = {
|
|
1517
|
+
}, yt = {}, O = {
|
|
1520
1518
|
fileExtension: "phdm",
|
|
1521
1519
|
createState(t) {
|
|
1522
|
-
return {
|
|
1520
|
+
return {
|
|
1521
|
+
global: { ...kt, ...t == null ? void 0 : t.global },
|
|
1522
|
+
local: { ...yt, ...t == null ? void 0 : t.local }
|
|
1523
|
+
};
|
|
1523
1524
|
},
|
|
1524
1525
|
createExtendedState(t) {
|
|
1525
1526
|
return ht(
|
|
@@ -1564,7 +1565,7 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1564
1565
|
"SET_AUTHOR_WEBSITE",
|
|
1565
1566
|
{ ...t }
|
|
1566
1567
|
);
|
|
1567
|
-
class
|
|
1568
|
+
class wt extends l {
|
|
1568
1569
|
setModelName(e) {
|
|
1569
1570
|
return this.dispatch(be(e));
|
|
1570
1571
|
}
|
|
@@ -1597,7 +1598,7 @@ const Ae = (t) => s(
|
|
|
1597
1598
|
"REORDER_CHANGE_LOG_ITEMS",
|
|
1598
1599
|
{ ...t }
|
|
1599
1600
|
), Ne = () => s("RELEASE_NEW_VERSION");
|
|
1600
|
-
class
|
|
1601
|
+
class vt extends l {
|
|
1601
1602
|
addChangeLogItem(e) {
|
|
1602
1603
|
return this.dispatch(Ae(e));
|
|
1603
1604
|
}
|
|
@@ -1630,7 +1631,7 @@ const Le = (t) => s(
|
|
|
1630
1631
|
"REORDER_MODULES",
|
|
1631
1632
|
{ ...t }
|
|
1632
1633
|
);
|
|
1633
|
-
class
|
|
1634
|
+
class Ut extends l {
|
|
1634
1635
|
addModule(e) {
|
|
1635
1636
|
return this.dispatch(Le(e));
|
|
1636
1637
|
}
|
|
@@ -1669,7 +1670,7 @@ const ye = (t) => s(
|
|
|
1669
1670
|
"REORDER_OPERATION_ERRORS",
|
|
1670
1671
|
{ ...t }
|
|
1671
1672
|
);
|
|
1672
|
-
class
|
|
1673
|
+
class Vt extends l {
|
|
1673
1674
|
addOperationError(e) {
|
|
1674
1675
|
return this.dispatch(ye(e));
|
|
1675
1676
|
}
|
|
@@ -1705,7 +1706,7 @@ const Xe = (t) => s(
|
|
|
1705
1706
|
"REORDER_OPERATION_EXAMPLES",
|
|
1706
1707
|
{ ...t }
|
|
1707
1708
|
);
|
|
1708
|
-
class
|
|
1709
|
+
class Ft extends l {
|
|
1709
1710
|
addOperationExample(e) {
|
|
1710
1711
|
return this.dispatch(Xe(e));
|
|
1711
1712
|
}
|
|
@@ -1750,7 +1751,7 @@ const ze = (t) => s(
|
|
|
1750
1751
|
"REORDER_MODULE_OPERATIONS",
|
|
1751
1752
|
{ ...t }
|
|
1752
1753
|
);
|
|
1753
|
-
class
|
|
1754
|
+
class Ht extends l {
|
|
1754
1755
|
addOperation(e) {
|
|
1755
1756
|
return this.dispatch(ze(e));
|
|
1756
1757
|
}
|
|
@@ -1801,7 +1802,7 @@ const rt = (t) => s(
|
|
|
1801
1802
|
"REORDER_STATE_EXAMPLES",
|
|
1802
1803
|
{ ...t }
|
|
1803
1804
|
);
|
|
1804
|
-
class
|
|
1805
|
+
class Xt extends l {
|
|
1805
1806
|
setStateSchema(e) {
|
|
1806
1807
|
return this.dispatch(rt(e));
|
|
1807
1808
|
}
|
|
@@ -1838,15 +1839,15 @@ let pe = (m = class extends l {
|
|
|
1838
1839
|
}
|
|
1839
1840
|
}, le(m, "fileExtension", "phdm"), m);
|
|
1840
1841
|
_t(pe, [
|
|
1841
|
-
yt,
|
|
1842
1842
|
wt,
|
|
1843
1843
|
vt,
|
|
1844
1844
|
Ut,
|
|
1845
1845
|
Vt,
|
|
1846
1846
|
Ft,
|
|
1847
|
-
Ht
|
|
1847
|
+
Ht,
|
|
1848
|
+
Xt
|
|
1848
1849
|
]);
|
|
1849
|
-
const
|
|
1850
|
+
const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1850
1851
|
__proto__: null,
|
|
1851
1852
|
addChangeLogItem: Ae,
|
|
1852
1853
|
addModule: Le,
|
|
@@ -1891,30 +1892,30 @@ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1891
1892
|
updateChangeLogItem: xe,
|
|
1892
1893
|
updateOperationExample: Ge,
|
|
1893
1894
|
updateStateExample: it
|
|
1894
|
-
}, Symbol.toStringTag, { value: "Module" })), pt = pe, lt = { ...O, ...Tt }, ct = { ...It, ...
|
|
1895
|
+
}, Symbol.toStringTag, { value: "Module" })), pt = pe, lt = { ...O, ...Tt }, ct = { ...It, ...Gt }, $t = {
|
|
1895
1896
|
Document: pt,
|
|
1896
1897
|
reducer: g,
|
|
1897
1898
|
actions: ct,
|
|
1898
1899
|
utils: lt,
|
|
1899
1900
|
documentModel: ce
|
|
1900
|
-
},
|
|
1901
|
+
}, Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1901
1902
|
__proto__: null,
|
|
1902
1903
|
Document: pt,
|
|
1903
1904
|
DocumentModel: pe,
|
|
1904
1905
|
actions: ct,
|
|
1905
1906
|
documentModel: ce,
|
|
1906
|
-
module:
|
|
1907
|
+
module: $t,
|
|
1907
1908
|
reducer: g,
|
|
1908
1909
|
utils: lt,
|
|
1909
1910
|
z: Dt
|
|
1910
1911
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1911
1912
|
export {
|
|
1912
|
-
|
|
1913
|
+
Qt as D,
|
|
1913
1914
|
pe as a,
|
|
1914
1915
|
pt as b,
|
|
1915
1916
|
ct as c,
|
|
1916
1917
|
ce as d,
|
|
1917
|
-
|
|
1918
|
+
$t as m,
|
|
1918
1919
|
g as r,
|
|
1919
1920
|
lt as u,
|
|
1920
1921
|
Dt as z
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
"modules": []
|
|
20
20
|
}
|
|
21
21
|
]
|
|
22
|
-
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},me=t=>t!=null,ht=r.z.any().refine(t=>me(t));function _(){return r.z.object({__typename:r.z.literal("AddChangeLogItemInput").optional(),content:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullable()})}function z(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),name:r.z.string()})}function A(){return r.z.object({errorCode:r.z.string().nullish(),errorDescription:r.z.string().nullish(),errorName:r.z.string().nullish(),errorTemplate:r.z.string().nullish(),id:r.z.string(),operationId:r.z.string()})}function I(){return r.z.object({example:r.z.string(),id:r.z.string(),operationId:r.z.string()})}function T(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),moduleId:r.z.string(),name:r.z.string(),reducer:r.z.string().nullish(),schema:r.z.string().nullish(),template:r.z.string().nullish(),scope:r.z.literal("local").or(r.z.literal("global")).nullish()})}function R(){return r.z.object({scope:r.z.string(),example:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullish()})}function Ee(){return r.z.object({__typename:r.z.literal("Author").optional(),name:r.z.string(),website:r.z.string().nullable()})}function D(){return r.z.object({__typename:r.z.literal("CodeExample").optional(),id:r.z.string(),value:r.z.string()})}function M(){return r.z.object({__typename:r.z.literal("DeleteChangeLogItemInput").optional(),id:r.z.string()})}function x(){return r.z.object({id:r.z.string()})}function N(){return r.z.object({id:r.z.string()})}function L(){return r.z.object({id:r.z.string()})}function j(){return r.z.object({id:r.z.string()})}function P(){return r.z.object({scope:r.z.string(),id:r.z.string()})}function Ot(){return r.z.union([_(),z(),A(),I(),T(),R(),M(),x(),N(),L(),j(),P(),C(),k(),y(),w(),v(),U(),V(),F(),H(),$(),X(),G(),B(),W(),q(),J(),K(),Q(),Y(),Z(),ee(),te(),re(),oe(),ne(),ie(),se(),ae(),pe()])}function gt(){return r.z.object({__typename:r.z.literal("DocumentModelState").optional(),author:Ee(),description:r.z.string(),extension:r.z.string(),id:r.z.string(),name:r.z.string(),specifications:r.z.array(he())})}function he(){return r.z.object({__typename:r.z.literal("DocumentSpecification").optional(),changeLog:r.z.array(r.z.string()),modules:r.z.array(Oe()),state:fe(),version:r.z.number()})}function Oe(){return r.z.object({__typename:r.z.literal("Module").optional(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string(),operations:r.z.array(ge())})}function C(){return r.z.object({newModuleId:r.z.string(),operationId:r.z.string()})}function ge(){return r.z.object({__typename:r.z.literal("Operation").optional(),description:r.z.string().nullable(),errors:r.z.array(Se()),examples:r.z.array(D()),id:r.z.string(),name:r.z.string().nullable(),reducer:r.z.string().nullable(),schema:r.z.string().nullable(),template:r.z.string().nullable(),scope:r.z.literal("local").or(r.z.literal("global"))})}function Se(){return r.z.object({__typename:r.z.literal("OperationError").optional(),code:r.z.string().nullable(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string().nullable(),template:r.z.string().nullable()})}function k(){return r.z.object({__typename:r.z.literal("ReorderChangeLogItemsInput").optional(),order:r.z.array(r.z.string())})}function y(){return r.z.object({moduleId:r.z.string(),order:r.z.array(r.z.string())})}function w(){return r.z.object({order:r.z.array(r.z.string())})}function v(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function U(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function V(){return r.z.object({scope:r.z.string(),order:r.z.array(r.z.string())})}function F(){return r.z.object({authorName:r.z.string()})}function H(){return r.z.object({authorWebsite:r.z.string()})}function $(){return r.z.object({scope:r.z.string(),initialValue:r.z.string()})}function X(){return r.z.object({description:r.z.string()})}function G(){return r.z.object({extension:r.z.string()})}function B(){return r.z.object({id:r.z.string()})}function W(){return r.z.object({name:r.z.string()})}function q(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function J(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function K(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function Q(){return r.z.object({errorCode:r.z.string().nullish(),id:r.z.string()})}function Y(){return r.z.object({errorDescription:r.z.string().nullish(),id:r.z.string()})}function Z(){return r.z.object({errorName:r.z.string().nullish(),id:r.z.string()})}function ee(){return r.z.object({errorTemplate:r.z.string().nullish(),id:r.z.string()})}function te(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function be(){return r.z.object({id:r.z.string(),scope:r.z.literal("global").or(r.z.literal("local"))})}function re(){return r.z.object({id:r.z.string(),reducer:r.z.string().nullish()})}function oe(){return r.z.object({id:r.z.string(),schema:r.z.string().nullish()})}function ne(){return r.z.object({id:r.z.string(),template:r.z.string().nullish()})}function ie(){return r.z.object({scope:r.z.string(),schema:r.z.string()})}function b(){return r.z.object({__typename:r.z.literal("State").optional(),examples:r.z.array(D()),initialValue:r.z.string(),schema:r.z.string()})}function fe(){return r.z.object({global:b(),local:b()})}function se(){return r.z.object({__typename:r.z.literal("UpdateChangeLogItemInput").optional(),id:r.z.string(),newContent:r.z.string()})}function ae(){return r.z.object({example:r.z.string(),id:r.z.string()})}function pe(){return r.z.object({scope:r.z.string(),id:r.z.string(),newExample:r.z.string()})}const _e=Object.freeze(Object.defineProperty({__proto__:null,AddChangeLogItemInputSchema:_,AddModuleInputSchema:z,AddOperationErrorInputSchema:A,AddOperationExampleInputSchema:I,AddOperationInputSchema:T,AddStateExampleInputSchema:R,AuthorSchema:Ee,CodeExampleSchema:D,DeleteChangeLogItemInputSchema:M,DeleteModuleInputSchema:x,DeleteOperationErrorInputSchema:N,DeleteOperationExampleInputSchema:L,DeleteOperationInputSchema:j,DeleteStateExampleInputSchema:P,DocumentModelInputSchema:Ot,DocumentModelStateSchema:gt,DocumentSpecificationSchema:he,ModuleSchema:Oe,MoveOperationInputSchema:C,OperationErrorSchema:Se,OperationSchema:ge,ReorderChangeLogItemsInputSchema:k,ReorderModuleOperationsInputSchema:y,ReorderModulesInputSchema:w,ReorderOperationErrorsInputSchema:v,ReorderOperationExamplesInputSchema:U,ReorderStateExamplesInputSchema:V,ScopeStateSchema:fe,SetAuthorNameInputSchema:F,SetAuthorWebsiteInputSchema:H,SetInitialStateInputSchema:$,SetModelDescriptionInputSchema:X,SetModelExtensionInputSchema:G,SetModelIdInputSchema:B,SetModelNameInputSchema:W,SetModuleDescriptionInputSchema:q,SetModuleNameInputSchema:J,SetOperationDescriptionInputSchema:K,SetOperationErrorCodeInputSchema:Q,SetOperationErrorDescriptionInputSchema:Y,SetOperationErrorNameInputSchema:Z,SetOperationErrorTemplateInputSchema:ee,SetOperationNameInputSchema:te,SetOperationReducerInputSchema:re,SetOperationSchemaInputSchema:oe,SetOperationScopeInputSchema:be,SetOperationTemplateInputSchema:ne,SetStateSchemaInputSchema:ie,StateSchema:b,UpdateChangeLogItemInputSchema:se,UpdateOperationExampleInputSchema:ae,UpdateStateExampleInputSchema:pe,definedNonNullAnySchema:ht,isDefinedNonNullAny:me},Symbol.toStringTag,{value:"Module"})),c={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},E={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},St=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},h={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const o=t.specifications[t.specifications.length-1];o.modules=o.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(St(e.input.order))}},bt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},l={addOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].errors=o.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.sort(bt(e.input.order))}},ft=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},g={addOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].examples.length;a++)o.modules[n].operations[i].examples[a].id==e.input.id&&(o.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].examples=o.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.sort(ft(e.input.order))}},_t=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},p={addOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const o=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(o.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...o)},deleteOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].operations=o.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.sort(_t(e.input.order))}},zt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},d={setStateSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(!Object.keys(o.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=o.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples=o.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.sort(zt(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},At=(t,e)=>{if(s.isBaseAction(e))return t;switch(e.type){case"SET_MODEL_NAME":W().parse(e.input),c.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":B().parse(e.input),c.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":G().parse(e.input),c.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":X().parse(e.input),c.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":F().parse(e.input),c.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":H().parse(e.input),c.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":_().parse(e.input),E.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":se().parse(e.input),E.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":M().parse(e.input),E.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":k().parse(e.input),E.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");E.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":z().parse(e.input),h.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":J().parse(e.input),h.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":q().parse(e.input),h.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":x().parse(e.input),h.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":w().parse(e.input),h.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":A().parse(e.input),l.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":Q().parse(e.input),l.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":Z().parse(e.input),l.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":Y().parse(e.input),l.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":ee().parse(e.input),l.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":N().parse(e.input),l.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":v().parse(e.input),l.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":I().parse(e.input),g.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":ae().parse(e.input),g.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":L().parse(e.input),g.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":U().parse(e.input),g.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":T().parse(e.input),p.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":te().parse(e.input),p.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":be().parse(e.input),p.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":oe().parse(e.input),p.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":K().parse(e.input),p.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":ne().parse(e.input),p.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":re().parse(e.input),p.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":C().parse(e.input),p.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":j().parse(e.input),p.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":y().parse(e.input),p.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":ie().parse(e.input),d.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":$().parse(e.input),d.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":R().parse(e.input),d.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":pe().parse(e.input),d.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":P().parse(e.input),d.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":V().parse(e.input),d.reorderStateExamplesOperation(t.global,e);break;default:return t}},m=s.createReducer(At),It={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},O={fileExtension:"phdm",createState(t){return{global:{...It,...t},local:{}}},createExtendedState(t){return s.createExtendedState({...t,documentType:"powerhouse/document-model"},O.createState)},createDocument(t){return s.createDocument(O.createExtendedState(t),O.createState)},saveToFile(t,e,o){return s.saveToFile(t,e,"phdm",o)},saveToFileHandle(t,e){return s.saveToFileHandle(t,e)},loadFromFile(t){return s.loadFromFile(t,m)},loadFromInput(t){return s.loadFromInput(t,m)}},ze=t=>s.createAction("SET_MODEL_NAME",{...t}),Ae=t=>s.createAction("SET_MODEL_ID",{...t}),Ie=t=>s.createAction("SET_MODEL_EXTENSION",{...t}),Te=t=>s.createAction("SET_MODEL_DESCRIPTION",{...t}),Re=t=>s.createAction("SET_AUTHOR_NAME",{...t}),De=t=>s.createAction("SET_AUTHOR_WEBSITE",{...t});class Tt extends s.BaseDocument{setModelName(e){return this.dispatch(ze(e))}setModelId(e){return this.dispatch(Ae(e))}setModelExtension(e){return this.dispatch(Ie(e))}setModelDescription(e){return this.dispatch(Te(e))}setAuthorName(e){return this.dispatch(Re(e))}setAuthorWebsite(e){return this.dispatch(De(e))}}const Me=t=>s.createAction("ADD_CHANGE_LOG_ITEM",{...t}),xe=t=>s.createAction("UPDATE_CHANGE_LOG_ITEM",{...t}),Ne=t=>s.createAction("DELETE_CHANGE_LOG_ITEM",{...t}),Le=t=>s.createAction("REORDER_CHANGE_LOG_ITEMS",{...t}),je=()=>s.createAction("RELEASE_NEW_VERSION");class Rt extends s.BaseDocument{addChangeLogItem(e){return this.dispatch(Me(e))}updateChangeLogItem(e){return this.dispatch(xe(e))}deleteChangeLogItem(e){return this.dispatch(Ne(e))}reorderChangeLogItems(e){return this.dispatch(Le(e))}releaseNewVersion(){return this.dispatch(je())}}const Pe=t=>s.createAction("ADD_MODULE",{...t}),Ce=t=>s.createAction("SET_MODULE_NAME",{...t}),ke=t=>s.createAction("SET_MODULE_DESCRIPTION",{...t}),ye=t=>s.createAction("DELETE_MODULE",{...t}),we=t=>s.createAction("REORDER_MODULES",{...t});class Dt extends s.BaseDocument{addModule(e){return this.dispatch(Pe(e))}setModuleName(e){return this.dispatch(Ce(e))}setModuleDescription(e){return this.dispatch(ke(e))}deleteModule(e){return this.dispatch(ye(e))}reorderModules(e){return this.dispatch(we(e))}}const ve=t=>s.createAction("ADD_OPERATION_ERROR",{...t}),Ue=t=>s.createAction("SET_OPERATION_ERROR_CODE",{...t}),Ve=t=>s.createAction("SET_OPERATION_ERROR_NAME",{...t}),Fe=t=>s.createAction("SET_OPERATION_ERROR_DESCRIPTION",{...t}),He=t=>s.createAction("SET_OPERATION_ERROR_TEMPLATE",{...t}),$e=t=>s.createAction("DELETE_OPERATION_ERROR",{...t}),Xe=t=>s.createAction("REORDER_OPERATION_ERRORS",{...t});class Mt extends s.BaseDocument{addOperationError(e){return this.dispatch(ve(e))}setOperationErrorCode(e){return this.dispatch(Ue(e))}setOperationErrorName(e){return this.dispatch(Ve(e))}setOperationErrorDescription(e){return this.dispatch(Fe(e))}setOperationErrorTemplate(e){return this.dispatch(He(e))}deleteOperationError(e){return this.dispatch($e(e))}reorderOperationErrors(e){return this.dispatch(Xe(e))}}const Ge=t=>s.createAction("ADD_OPERATION_EXAMPLE",{...t}),Be=t=>s.createAction("UPDATE_OPERATION_EXAMPLE",{...t}),We=t=>s.createAction("DELETE_OPERATION_EXAMPLE",{...t}),qe=t=>s.createAction("REORDER_OPERATION_EXAMPLES",{...t});class xt extends s.BaseDocument{addOperationExample(e){return this.dispatch(Ge(e))}updateOperationExample(e){return this.dispatch(Be(e))}deleteOperationExample(e){return this.dispatch(We(e))}reorderOperationExamples(e){return this.dispatch(qe(e))}}const Je=t=>s.createAction("ADD_OPERATION",{...t}),Ke=t=>s.createAction("SET_OPERATION_NAME",{...t}),Qe=t=>s.createAction("SET_OPERATION_SCOPE",{...t}),Ye=t=>s.createAction("SET_OPERATION_SCHEMA",{...t}),Ze=t=>s.createAction("SET_OPERATION_DESCRIPTION",{...t}),et=t=>s.createAction("SET_OPERATION_TEMPLATE",{...t}),tt=t=>s.createAction("SET_OPERATION_REDUCER",{...t}),rt=t=>s.createAction("MOVE_OPERATION",{...t}),ot=t=>s.createAction("DELETE_OPERATION",{...t}),nt=t=>s.createAction("REORDER_MODULE_OPERATIONS",{...t});class Nt extends s.BaseDocument{addOperation(e){return this.dispatch(Je(e))}setOperationName(e){return this.dispatch(Ke(e))}setOperationScope(e){return this.dispatch(Qe(e))}setOperationSchema(e){return this.dispatch(Ye(e))}setOperationDescription(e){return this.dispatch(Ze(e))}setOperationTemplate(e){return this.dispatch(et(e))}setOperationReducer(e){return this.dispatch(tt(e))}moveOperation(e){return this.dispatch(rt(e))}deleteOperation(e){return this.dispatch(ot(e))}reorderModuleOperations(e){return this.dispatch(nt(e))}}const it=t=>s.createAction("SET_STATE_SCHEMA",{...t}),st=t=>s.createAction("SET_INITIAL_STATE",{...t}),at=t=>s.createAction("ADD_STATE_EXAMPLE",{...t}),pt=t=>s.createAction("UPDATE_STATE_EXAMPLE",{...t}),lt=t=>s.createAction("DELETE_STATE_EXAMPLE",{...t}),ct=t=>s.createAction("REORDER_STATE_EXAMPLES",{...t});class Lt extends s.BaseDocument{setStateSchema(e){return this.dispatch(it(e))}setInitialState(e){return this.dispatch(st(e))}addStateExample(e){return this.dispatch(at(e))}updateStateExample(e){return this.dispatch(pt(e))}deleteStateExample(e){return this.dispatch(lt(e))}reorderStateExamples(e){return this.dispatch(ct(e))}}var u;let S=(u=class extends s.BaseDocument{constructor(e,o){super(m,O.createDocument(e),o)}saveToFile(e,o){return super.saveToFile(e,u.fileExtension,o)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const o=new this;return await o.loadFromFile(e),o}},ue(u,"fileExtension","phdm"),u);s.applyMixins(S,[Tt,Rt,Dt,Mt,xt,Nt,Lt]);const jt=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:Me,addModule:Pe,addOperation:Je,addOperationError:ve,addOperationExample:Ge,addStateExample:at,deleteChangeLogItem:Ne,deleteModule:ye,deleteOperation:ot,deleteOperationError:$e,deleteOperationExample:We,deleteStateExample:lt,moveOperation:rt,releaseNewVersion:je,reorderChangeLogItems:Le,reorderModuleOperations:nt,reorderModules:we,reorderOperationErrors:Xe,reorderOperationExamples:qe,reorderStateExamples:ct,setAuthorName:Re,setAuthorWebsite:De,setInitialState:st,setModelDescription:Te,setModelExtension:Ie,setModelId:Ae,setModelName:ze,setModuleDescription:ke,setModuleName:Ce,setOperationDescription:Ze,setOperationErrorCode:Ue,setOperationErrorDescription:Fe,setOperationErrorName:Ve,setOperationErrorTemplate:He,setOperationName:Ke,setOperationReducer:tt,setOperationSchema:Ye,setOperationScope:Qe,setOperationTemplate:et,setStateSchema:it,updateChangeLogItem:xe,updateOperationExample:Be,updateStateExample:pt},Symbol.toStringTag,{value:"Module"})),le=S,ce={...O,...Et},de={...s.BaseActions,...jt},dt={Document:le,reducer:m,actions:de,utils:ce,documentModel:f},Pt=Object.freeze(Object.defineProperty({__proto__:null,Document:le,DocumentModel:S,actions:de,documentModel:f,module:dt,reducer:m,utils:ce,z:_e},Symbol.toStringTag,{value:"Module"}));exports.Document=le;exports.DocumentModel=Pt;exports.DocumentModel$1=S;exports.actions=de;exports.documentModel=f;exports.module=dt;exports.reducer=m;exports.utils=ce;exports.zod=_e;
|
|
22
|
+
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},me=t=>t!=null,ht=r.z.any().refine(t=>me(t));function _(){return r.z.object({__typename:r.z.literal("AddChangeLogItemInput").optional(),content:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullable()})}function z(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),name:r.z.string()})}function A(){return r.z.object({errorCode:r.z.string().nullish(),errorDescription:r.z.string().nullish(),errorName:r.z.string().nullish(),errorTemplate:r.z.string().nullish(),id:r.z.string(),operationId:r.z.string()})}function I(){return r.z.object({example:r.z.string(),id:r.z.string(),operationId:r.z.string()})}function T(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),moduleId:r.z.string(),name:r.z.string(),reducer:r.z.string().nullish(),schema:r.z.string().nullish(),template:r.z.string().nullish(),scope:r.z.literal("local").or(r.z.literal("global")).nullish()})}function R(){return r.z.object({scope:r.z.string(),example:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullish()})}function Ee(){return r.z.object({__typename:r.z.literal("Author").optional(),name:r.z.string(),website:r.z.string().nullable()})}function D(){return r.z.object({__typename:r.z.literal("CodeExample").optional(),id:r.z.string(),value:r.z.string()})}function M(){return r.z.object({__typename:r.z.literal("DeleteChangeLogItemInput").optional(),id:r.z.string()})}function x(){return r.z.object({id:r.z.string()})}function N(){return r.z.object({id:r.z.string()})}function L(){return r.z.object({id:r.z.string()})}function j(){return r.z.object({id:r.z.string()})}function P(){return r.z.object({scope:r.z.string(),id:r.z.string()})}function Ot(){return r.z.union([_(),z(),A(),I(),T(),R(),M(),x(),N(),L(),j(),P(),C(),k(),y(),w(),v(),U(),V(),F(),H(),$(),X(),G(),B(),W(),q(),J(),K(),Q(),Y(),Z(),ee(),te(),re(),oe(),ne(),ie(),se(),ae(),pe()])}function gt(){return r.z.object({__typename:r.z.literal("DocumentModelState").optional(),author:Ee(),description:r.z.string(),extension:r.z.string(),id:r.z.string(),name:r.z.string(),specifications:r.z.array(he())})}function he(){return r.z.object({__typename:r.z.literal("DocumentSpecification").optional(),changeLog:r.z.array(r.z.string()),modules:r.z.array(Oe()),state:fe(),version:r.z.number()})}function Oe(){return r.z.object({__typename:r.z.literal("Module").optional(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string(),operations:r.z.array(ge())})}function C(){return r.z.object({newModuleId:r.z.string(),operationId:r.z.string()})}function ge(){return r.z.object({__typename:r.z.literal("Operation").optional(),description:r.z.string().nullable(),errors:r.z.array(Se()),examples:r.z.array(D()),id:r.z.string(),name:r.z.string().nullable(),reducer:r.z.string().nullable(),schema:r.z.string().nullable(),template:r.z.string().nullable(),scope:r.z.literal("local").or(r.z.literal("global"))})}function Se(){return r.z.object({__typename:r.z.literal("OperationError").optional(),code:r.z.string().nullable(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string().nullable(),template:r.z.string().nullable()})}function k(){return r.z.object({__typename:r.z.literal("ReorderChangeLogItemsInput").optional(),order:r.z.array(r.z.string())})}function y(){return r.z.object({moduleId:r.z.string(),order:r.z.array(r.z.string())})}function w(){return r.z.object({order:r.z.array(r.z.string())})}function v(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function U(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function V(){return r.z.object({scope:r.z.string(),order:r.z.array(r.z.string())})}function F(){return r.z.object({authorName:r.z.string()})}function H(){return r.z.object({authorWebsite:r.z.string()})}function $(){return r.z.object({scope:r.z.string(),initialValue:r.z.string()})}function X(){return r.z.object({description:r.z.string()})}function G(){return r.z.object({extension:r.z.string()})}function B(){return r.z.object({id:r.z.string()})}function W(){return r.z.object({name:r.z.string()})}function q(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function J(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function K(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function Q(){return r.z.object({errorCode:r.z.string().nullish(),id:r.z.string()})}function Y(){return r.z.object({errorDescription:r.z.string().nullish(),id:r.z.string()})}function Z(){return r.z.object({errorName:r.z.string().nullish(),id:r.z.string()})}function ee(){return r.z.object({errorTemplate:r.z.string().nullish(),id:r.z.string()})}function te(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function be(){return r.z.object({id:r.z.string(),scope:r.z.literal("global").or(r.z.literal("local"))})}function re(){return r.z.object({id:r.z.string(),reducer:r.z.string().nullish()})}function oe(){return r.z.object({id:r.z.string(),schema:r.z.string().nullish()})}function ne(){return r.z.object({id:r.z.string(),template:r.z.string().nullish()})}function ie(){return r.z.object({scope:r.z.string(),schema:r.z.string()})}function b(){return r.z.object({__typename:r.z.literal("State").optional(),examples:r.z.array(D()),initialValue:r.z.string(),schema:r.z.string()})}function fe(){return r.z.object({global:b(),local:b()})}function se(){return r.z.object({__typename:r.z.literal("UpdateChangeLogItemInput").optional(),id:r.z.string(),newContent:r.z.string()})}function ae(){return r.z.object({example:r.z.string(),id:r.z.string()})}function pe(){return r.z.object({scope:r.z.string(),id:r.z.string(),newExample:r.z.string()})}const _e=Object.freeze(Object.defineProperty({__proto__:null,AddChangeLogItemInputSchema:_,AddModuleInputSchema:z,AddOperationErrorInputSchema:A,AddOperationExampleInputSchema:I,AddOperationInputSchema:T,AddStateExampleInputSchema:R,AuthorSchema:Ee,CodeExampleSchema:D,DeleteChangeLogItemInputSchema:M,DeleteModuleInputSchema:x,DeleteOperationErrorInputSchema:N,DeleteOperationExampleInputSchema:L,DeleteOperationInputSchema:j,DeleteStateExampleInputSchema:P,DocumentModelInputSchema:Ot,DocumentModelStateSchema:gt,DocumentSpecificationSchema:he,ModuleSchema:Oe,MoveOperationInputSchema:C,OperationErrorSchema:Se,OperationSchema:ge,ReorderChangeLogItemsInputSchema:k,ReorderModuleOperationsInputSchema:y,ReorderModulesInputSchema:w,ReorderOperationErrorsInputSchema:v,ReorderOperationExamplesInputSchema:U,ReorderStateExamplesInputSchema:V,ScopeStateSchema:fe,SetAuthorNameInputSchema:F,SetAuthorWebsiteInputSchema:H,SetInitialStateInputSchema:$,SetModelDescriptionInputSchema:X,SetModelExtensionInputSchema:G,SetModelIdInputSchema:B,SetModelNameInputSchema:W,SetModuleDescriptionInputSchema:q,SetModuleNameInputSchema:J,SetOperationDescriptionInputSchema:K,SetOperationErrorCodeInputSchema:Q,SetOperationErrorDescriptionInputSchema:Y,SetOperationErrorNameInputSchema:Z,SetOperationErrorTemplateInputSchema:ee,SetOperationNameInputSchema:te,SetOperationReducerInputSchema:re,SetOperationSchemaInputSchema:oe,SetOperationScopeInputSchema:be,SetOperationTemplateInputSchema:ne,SetStateSchemaInputSchema:ie,StateSchema:b,UpdateChangeLogItemInputSchema:se,UpdateOperationExampleInputSchema:ae,UpdateStateExampleInputSchema:pe,definedNonNullAnySchema:ht,isDefinedNonNullAny:me},Symbol.toStringTag,{value:"Module"})),c={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},E={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},St=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},h={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const o=t.specifications[t.specifications.length-1];o.modules=o.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(St(e.input.order))}},bt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},l={addOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].errors=o.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.sort(bt(e.input.order))}},ft=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},g={addOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].examples.length;a++)o.modules[n].operations[i].examples[a].id==e.input.id&&(o.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].examples=o.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.sort(ft(e.input.order))}},_t=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},p={addOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const o=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(o.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...o)},deleteOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].operations=o.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.sort(_t(e.input.order))}},zt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},d={setStateSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(!Object.keys(o.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=o.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples=o.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.sort(zt(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},At=(t,e)=>{if(s.isBaseAction(e))return t;switch(e.type){case"SET_MODEL_NAME":W().parse(e.input),c.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":B().parse(e.input),c.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":G().parse(e.input),c.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":X().parse(e.input),c.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":F().parse(e.input),c.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":H().parse(e.input),c.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":_().parse(e.input),E.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":se().parse(e.input),E.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":M().parse(e.input),E.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":k().parse(e.input),E.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");E.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":z().parse(e.input),h.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":J().parse(e.input),h.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":q().parse(e.input),h.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":x().parse(e.input),h.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":w().parse(e.input),h.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":A().parse(e.input),l.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":Q().parse(e.input),l.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":Z().parse(e.input),l.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":Y().parse(e.input),l.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":ee().parse(e.input),l.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":N().parse(e.input),l.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":v().parse(e.input),l.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":I().parse(e.input),g.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":ae().parse(e.input),g.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":L().parse(e.input),g.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":U().parse(e.input),g.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":T().parse(e.input),p.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":te().parse(e.input),p.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":be().parse(e.input),p.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":oe().parse(e.input),p.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":K().parse(e.input),p.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":ne().parse(e.input),p.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":re().parse(e.input),p.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":C().parse(e.input),p.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":j().parse(e.input),p.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":y().parse(e.input),p.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":ie().parse(e.input),d.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":$().parse(e.input),d.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":R().parse(e.input),d.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":pe().parse(e.input),d.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":P().parse(e.input),d.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":V().parse(e.input),d.reorderStateExamplesOperation(t.global,e);break;default:return t}},m=s.createReducer(At),It={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},Tt={},O={fileExtension:"phdm",createState(t){return{global:{...It,...t==null?void 0:t.global},local:{...Tt,...t==null?void 0:t.local}}},createExtendedState(t){return s.createExtendedState({...t,documentType:"powerhouse/document-model"},O.createState)},createDocument(t){return s.createDocument(O.createExtendedState(t),O.createState)},saveToFile(t,e,o){return s.saveToFile(t,e,"phdm",o)},saveToFileHandle(t,e){return s.saveToFileHandle(t,e)},loadFromFile(t){return s.loadFromFile(t,m)},loadFromInput(t){return s.loadFromInput(t,m)}},ze=t=>s.createAction("SET_MODEL_NAME",{...t}),Ae=t=>s.createAction("SET_MODEL_ID",{...t}),Ie=t=>s.createAction("SET_MODEL_EXTENSION",{...t}),Te=t=>s.createAction("SET_MODEL_DESCRIPTION",{...t}),Re=t=>s.createAction("SET_AUTHOR_NAME",{...t}),De=t=>s.createAction("SET_AUTHOR_WEBSITE",{...t});class Rt extends s.BaseDocument{setModelName(e){return this.dispatch(ze(e))}setModelId(e){return this.dispatch(Ae(e))}setModelExtension(e){return this.dispatch(Ie(e))}setModelDescription(e){return this.dispatch(Te(e))}setAuthorName(e){return this.dispatch(Re(e))}setAuthorWebsite(e){return this.dispatch(De(e))}}const Me=t=>s.createAction("ADD_CHANGE_LOG_ITEM",{...t}),xe=t=>s.createAction("UPDATE_CHANGE_LOG_ITEM",{...t}),Ne=t=>s.createAction("DELETE_CHANGE_LOG_ITEM",{...t}),Le=t=>s.createAction("REORDER_CHANGE_LOG_ITEMS",{...t}),je=()=>s.createAction("RELEASE_NEW_VERSION");class Dt extends s.BaseDocument{addChangeLogItem(e){return this.dispatch(Me(e))}updateChangeLogItem(e){return this.dispatch(xe(e))}deleteChangeLogItem(e){return this.dispatch(Ne(e))}reorderChangeLogItems(e){return this.dispatch(Le(e))}releaseNewVersion(){return this.dispatch(je())}}const Pe=t=>s.createAction("ADD_MODULE",{...t}),Ce=t=>s.createAction("SET_MODULE_NAME",{...t}),ke=t=>s.createAction("SET_MODULE_DESCRIPTION",{...t}),ye=t=>s.createAction("DELETE_MODULE",{...t}),we=t=>s.createAction("REORDER_MODULES",{...t});class Mt extends s.BaseDocument{addModule(e){return this.dispatch(Pe(e))}setModuleName(e){return this.dispatch(Ce(e))}setModuleDescription(e){return this.dispatch(ke(e))}deleteModule(e){return this.dispatch(ye(e))}reorderModules(e){return this.dispatch(we(e))}}const ve=t=>s.createAction("ADD_OPERATION_ERROR",{...t}),Ue=t=>s.createAction("SET_OPERATION_ERROR_CODE",{...t}),Ve=t=>s.createAction("SET_OPERATION_ERROR_NAME",{...t}),Fe=t=>s.createAction("SET_OPERATION_ERROR_DESCRIPTION",{...t}),He=t=>s.createAction("SET_OPERATION_ERROR_TEMPLATE",{...t}),$e=t=>s.createAction("DELETE_OPERATION_ERROR",{...t}),Xe=t=>s.createAction("REORDER_OPERATION_ERRORS",{...t});class xt extends s.BaseDocument{addOperationError(e){return this.dispatch(ve(e))}setOperationErrorCode(e){return this.dispatch(Ue(e))}setOperationErrorName(e){return this.dispatch(Ve(e))}setOperationErrorDescription(e){return this.dispatch(Fe(e))}setOperationErrorTemplate(e){return this.dispatch(He(e))}deleteOperationError(e){return this.dispatch($e(e))}reorderOperationErrors(e){return this.dispatch(Xe(e))}}const Ge=t=>s.createAction("ADD_OPERATION_EXAMPLE",{...t}),Be=t=>s.createAction("UPDATE_OPERATION_EXAMPLE",{...t}),We=t=>s.createAction("DELETE_OPERATION_EXAMPLE",{...t}),qe=t=>s.createAction("REORDER_OPERATION_EXAMPLES",{...t});class Nt extends s.BaseDocument{addOperationExample(e){return this.dispatch(Ge(e))}updateOperationExample(e){return this.dispatch(Be(e))}deleteOperationExample(e){return this.dispatch(We(e))}reorderOperationExamples(e){return this.dispatch(qe(e))}}const Je=t=>s.createAction("ADD_OPERATION",{...t}),Ke=t=>s.createAction("SET_OPERATION_NAME",{...t}),Qe=t=>s.createAction("SET_OPERATION_SCOPE",{...t}),Ye=t=>s.createAction("SET_OPERATION_SCHEMA",{...t}),Ze=t=>s.createAction("SET_OPERATION_DESCRIPTION",{...t}),et=t=>s.createAction("SET_OPERATION_TEMPLATE",{...t}),tt=t=>s.createAction("SET_OPERATION_REDUCER",{...t}),rt=t=>s.createAction("MOVE_OPERATION",{...t}),ot=t=>s.createAction("DELETE_OPERATION",{...t}),nt=t=>s.createAction("REORDER_MODULE_OPERATIONS",{...t});class Lt extends s.BaseDocument{addOperation(e){return this.dispatch(Je(e))}setOperationName(e){return this.dispatch(Ke(e))}setOperationScope(e){return this.dispatch(Qe(e))}setOperationSchema(e){return this.dispatch(Ye(e))}setOperationDescription(e){return this.dispatch(Ze(e))}setOperationTemplate(e){return this.dispatch(et(e))}setOperationReducer(e){return this.dispatch(tt(e))}moveOperation(e){return this.dispatch(rt(e))}deleteOperation(e){return this.dispatch(ot(e))}reorderModuleOperations(e){return this.dispatch(nt(e))}}const it=t=>s.createAction("SET_STATE_SCHEMA",{...t}),st=t=>s.createAction("SET_INITIAL_STATE",{...t}),at=t=>s.createAction("ADD_STATE_EXAMPLE",{...t}),pt=t=>s.createAction("UPDATE_STATE_EXAMPLE",{...t}),lt=t=>s.createAction("DELETE_STATE_EXAMPLE",{...t}),ct=t=>s.createAction("REORDER_STATE_EXAMPLES",{...t});class jt extends s.BaseDocument{setStateSchema(e){return this.dispatch(it(e))}setInitialState(e){return this.dispatch(st(e))}addStateExample(e){return this.dispatch(at(e))}updateStateExample(e){return this.dispatch(pt(e))}deleteStateExample(e){return this.dispatch(lt(e))}reorderStateExamples(e){return this.dispatch(ct(e))}}var u;let S=(u=class extends s.BaseDocument{constructor(e,o){super(m,O.createDocument(e),o)}saveToFile(e,o){return super.saveToFile(e,u.fileExtension,o)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const o=new this;return await o.loadFromFile(e),o}},ue(u,"fileExtension","phdm"),u);s.applyMixins(S,[Rt,Dt,Mt,xt,Nt,Lt,jt]);const Pt=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:Me,addModule:Pe,addOperation:Je,addOperationError:ve,addOperationExample:Ge,addStateExample:at,deleteChangeLogItem:Ne,deleteModule:ye,deleteOperation:ot,deleteOperationError:$e,deleteOperationExample:We,deleteStateExample:lt,moveOperation:rt,releaseNewVersion:je,reorderChangeLogItems:Le,reorderModuleOperations:nt,reorderModules:we,reorderOperationErrors:Xe,reorderOperationExamples:qe,reorderStateExamples:ct,setAuthorName:Re,setAuthorWebsite:De,setInitialState:st,setModelDescription:Te,setModelExtension:Ie,setModelId:Ae,setModelName:ze,setModuleDescription:ke,setModuleName:Ce,setOperationDescription:Ze,setOperationErrorCode:Ue,setOperationErrorDescription:Fe,setOperationErrorName:Ve,setOperationErrorTemplate:He,setOperationName:Ke,setOperationReducer:tt,setOperationSchema:Ye,setOperationScope:Qe,setOperationTemplate:et,setStateSchema:it,updateChangeLogItem:xe,updateOperationExample:Be,updateStateExample:pt},Symbol.toStringTag,{value:"Module"})),le=S,ce={...O,...Et},de={...s.BaseActions,...Pt},dt={Document:le,reducer:m,actions:de,utils:ce,documentModel:f},Ct=Object.freeze(Object.defineProperty({__proto__:null,Document:le,DocumentModel:S,actions:de,documentModel:f,module:dt,reducer:m,utils:ce,z:_e},Symbol.toStringTag,{value:"Module"}));exports.Document=le;exports.DocumentModel=Ct;exports.DocumentModel$1=S;exports.actions=de;exports.documentModel=f;exports.module=dt;exports.reducer=m;exports.utils=ce;exports.zod=_e;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { SetModelNameInput, SetModelIdInput, SetModelExtensionInput, SetModelDescriptionInput, SetAuthorNameInput, SetAuthorWebsiteInput, DocumentModelState } from '../types';
|
|
2
|
+
import { SetModelNameInput, SetModelIdInput, SetModelExtensionInput, SetModelDescriptionInput, SetAuthorNameInput, SetAuthorWebsiteInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Header extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Header extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
setModelName(input: SetModelNameInput): this;
|
|
6
6
|
setModelId(input: SetModelIdInput): this;
|
|
7
7
|
setModelExtension(input: SetModelExtensionInput): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddModuleInput, SetModuleNameInput, SetModuleDescriptionInput, DeleteModuleInput, ReorderModulesInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddModuleInput, SetModuleNameInput, SetModuleDescriptionInput, DeleteModuleInput, ReorderModulesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Module extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Module extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addModule(input: AddModuleInput): this;
|
|
6
6
|
setModuleName(input: SetModuleNameInput): this;
|
|
7
7
|
setModuleDescription(input: SetModuleDescriptionInput): this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DocumentModelState } from './types';
|
|
2
|
-
import { ExtendedState, SignalDispatch } from '../../document';
|
|
1
|
+
import { DocumentModelLocalState, DocumentModelState } from './types';
|
|
2
|
+
import { ExtendedState, PartialState, SignalDispatch } from '../../document';
|
|
3
3
|
import { BaseDocument } from '../../document/object';
|
|
4
4
|
import { DocumentModelAction } from './actions';
|
|
5
5
|
import DocumentModel_Header from './header/object';
|
|
@@ -18,9 +18,9 @@ export * from './operation/object';
|
|
|
18
18
|
export * from './state/object';
|
|
19
19
|
interface DocumentModel extends DocumentModel_Header, DocumentModel_Versioning, DocumentModel_Module, DocumentModel_OperationError, DocumentModel_OperationExample, DocumentModel_Operation, DocumentModel_State {
|
|
20
20
|
}
|
|
21
|
-
declare class DocumentModel extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
21
|
+
declare class DocumentModel extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
22
22
|
static fileExtension: string;
|
|
23
|
-
constructor(initialState?: Partial<ExtendedState<
|
|
23
|
+
constructor(initialState?: Partial<ExtendedState<PartialState<DocumentModelState>, PartialState<DocumentModelLocalState>>>, dispatch?: SignalDispatch);
|
|
24
24
|
saveToFile(path: string, name?: string): Promise<string>;
|
|
25
25
|
loadFromFile(path: string): Promise<void>;
|
|
26
26
|
static fromFile(path: string): Promise<DocumentModel>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState, SetOperationScopeInput } from '../types';
|
|
2
|
+
import { AddOperationInput, SetOperationNameInput, SetOperationSchemaInput, SetOperationDescriptionInput, SetOperationTemplateInput, SetOperationReducerInput, MoveOperationInput, DeleteOperationInput, ReorderModuleOperationsInput, DocumentModelState, SetOperationScopeInput, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Operation extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Operation extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addOperation(input: AddOperationInput): this;
|
|
6
6
|
setOperationName(input: SetOperationNameInput): this;
|
|
7
7
|
setOperationScope(input: SetOperationScopeInput): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationErrorInput, SetOperationErrorCodeInput, SetOperationErrorNameInput, SetOperationErrorDescriptionInput, SetOperationErrorTemplateInput, DeleteOperationErrorInput, ReorderOperationErrorsInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddOperationErrorInput, SetOperationErrorCodeInput, SetOperationErrorNameInput, SetOperationErrorDescriptionInput, SetOperationErrorTemplateInput, DeleteOperationErrorInput, ReorderOperationErrorsInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_OperationError extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_OperationError extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addOperationError(input: AddOperationErrorInput): this;
|
|
6
6
|
setOperationErrorCode(input: SetOperationErrorCodeInput): this;
|
|
7
7
|
setOperationErrorName(input: SetOperationErrorNameInput): this;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddOperationExampleInput, UpdateOperationExampleInput, DeleteOperationExampleInput, ReorderOperationExamplesInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddOperationExampleInput, UpdateOperationExampleInput, DeleteOperationExampleInput, ReorderOperationExamplesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_OperationExample extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_OperationExample extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addOperationExample(input: AddOperationExampleInput): this;
|
|
6
6
|
updateOperationExample(input: UpdateOperationExampleInput): this;
|
|
7
7
|
deleteOperationExample(input: DeleteOperationExampleInput): this;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DocumentModelState } from './schema';
|
|
1
|
+
import { DocumentModelLocalState, DocumentModelState } from './schema';
|
|
2
2
|
import { DocumentModelAction } from './actions';
|
|
3
|
-
export declare const reducer: import("../../document/types").Reducer<DocumentModelState, DocumentModelAction,
|
|
3
|
+
export declare const reducer: import("../../document/types").Reducer<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
@@ -127,7 +127,7 @@ export type ScopeState = {
|
|
|
127
127
|
global: State;
|
|
128
128
|
local: State;
|
|
129
129
|
};
|
|
130
|
-
export type DocumentModelLocalState =
|
|
130
|
+
export type DocumentModelLocalState = {};
|
|
131
131
|
export type DocumentSpecification = {
|
|
132
132
|
__typename?: 'DocumentSpecification';
|
|
133
133
|
changeLog: Array<Scalars['String']['output']>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { SetStateSchemaInput, SetInitialStateInput, AddStateExampleInput, UpdateStateExampleInput, DeleteStateExampleInput, ReorderStateExamplesInput, DocumentModelState } from '../types';
|
|
2
|
+
import { SetStateSchemaInput, SetInitialStateInput, AddStateExampleInput, UpdateStateExampleInput, DeleteStateExampleInput, ReorderStateExamplesInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_State extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_State extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
setStateSchema(input: SetStateSchemaInput): this;
|
|
6
6
|
setInitialState(input: SetInitialStateInput): this;
|
|
7
7
|
addStateExample(input: AddStateExampleInput): this;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Document, ExtendedState } from '../../document/types';
|
|
2
|
-
import type { DocumentModelState } from './schema/types';
|
|
2
|
+
import type { DocumentModelState, DocumentModelLocalState } from './schema/types';
|
|
3
3
|
import type { DocumentModelAction } from './actions';
|
|
4
4
|
export { z } from './schema';
|
|
5
5
|
export type * from './schema/types';
|
|
6
6
|
export type ExtendedDocumentModelState = ExtendedState<DocumentModelState>;
|
|
7
|
-
export type DocumentModelDocument = Document<DocumentModelState, DocumentModelAction>;
|
|
8
|
-
export { DocumentModelState, DocumentModelAction };
|
|
7
|
+
export type DocumentModelDocument = Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
8
|
+
export { DocumentModelState, DocumentModelAction, DocumentModelLocalState };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DocumentModelUtils } from '../../document';
|
|
2
|
-
import { DocumentModelAction, DocumentModelState } from './types';
|
|
3
|
-
declare const
|
|
2
|
+
import { DocumentModelAction, DocumentModelLocalState, DocumentModelState } from './types';
|
|
3
|
+
export declare const initialGlobalState: DocumentModelState;
|
|
4
|
+
export declare const initialLocalState: DocumentModelLocalState;
|
|
5
|
+
declare const utils: DocumentModelUtils<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
4
6
|
export default utils;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseDocument } from '../../../document/object';
|
|
2
|
-
import { AddChangeLogItemInput, UpdateChangeLogItemInput, DeleteChangeLogItemInput, ReorderChangeLogItemsInput, DocumentModelState } from '../types';
|
|
2
|
+
import { AddChangeLogItemInput, UpdateChangeLogItemInput, DeleteChangeLogItemInput, ReorderChangeLogItemsInput, DocumentModelState, DocumentModelLocalState } from '../types';
|
|
3
3
|
import { DocumentModelAction } from '../actions';
|
|
4
|
-
export default class DocumentModel_Versioning extends BaseDocument<DocumentModelState, DocumentModelAction> {
|
|
4
|
+
export default class DocumentModel_Versioning extends BaseDocument<DocumentModelState, DocumentModelAction, DocumentModelLocalState> {
|
|
5
5
|
addChangeLogItem(input: AddChangeLogItemInput): this;
|
|
6
6
|
updateChangeLogItem(input: UpdateChangeLogItemInput): this;
|
|
7
7
|
deleteChangeLogItem(input: DeleteChangeLogItemInput): this;
|
|
@@ -6,17 +6,17 @@ import { DocumentModel as _DocumentModel } from '../document';
|
|
|
6
6
|
import { DocumentModel } from './gen';
|
|
7
7
|
import { documentModel } from './gen/document-model';
|
|
8
8
|
import { reducer } from './gen/reducer';
|
|
9
|
-
import { DocumentModelAction, DocumentModelState } from './gen/types';
|
|
9
|
+
import { DocumentModelAction, DocumentModelLocalState, DocumentModelState } from './gen/types';
|
|
10
10
|
declare const Document: typeof DocumentModel;
|
|
11
11
|
declare const utils: {
|
|
12
12
|
fileExtension: string;
|
|
13
|
-
createState: import("../document").CreateState<DocumentModelState,
|
|
14
|
-
createExtendedState: (extendedState?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>,
|
|
15
|
-
createDocument: (document?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>,
|
|
16
|
-
loadFromFile: (path: string) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
17
|
-
loadFromInput: (input: import("../document").FileInput) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
18
|
-
saveToFile: (document: import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
19
|
-
saveToFileHandle: (document: import("../document").Document<DocumentModelState, DocumentModelAction,
|
|
13
|
+
createState: import("../document").CreateState<DocumentModelState, DocumentModelLocalState>;
|
|
14
|
+
createExtendedState: (extendedState?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>, import("../document").PartialState<DocumentModelLocalState>>> | undefined, createState?: import("../document").CreateState<DocumentModelState, DocumentModelLocalState> | undefined) => import("../document").ExtendedState<DocumentModelState, DocumentModelLocalState>;
|
|
15
|
+
createDocument: (document?: Partial<import("../document").ExtendedState<import("../document").PartialState<DocumentModelState>, import("../document").PartialState<DocumentModelLocalState>>> | undefined, createState?: import("../document").CreateState<DocumentModelState, DocumentModelLocalState> | undefined) => import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>;
|
|
16
|
+
loadFromFile: (path: string) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>>;
|
|
17
|
+
loadFromInput: (input: import("../document").FileInput) => Promise<import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>>;
|
|
18
|
+
saveToFile: (document: import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>, path: string, name?: string | undefined) => Promise<string>;
|
|
19
|
+
saveToFileHandle: (document: import("../document").Document<DocumentModelState, DocumentModelAction, DocumentModelLocalState>, input: FileSystemFileHandle) => Promise<void>;
|
|
20
20
|
};
|
|
21
21
|
declare const actions: {
|
|
22
22
|
setModelName: (input: import("./gen").SetModelNameInput) => import("./gen").SetModelNameAction;
|
|
@@ -68,7 +68,7 @@ declare const actions: {
|
|
|
68
68
|
prune: (start?: number | undefined, end?: number | undefined) => import("../document").PruneAction;
|
|
69
69
|
loadState: <S, T>(state: Pick<import("../document").ExtendedState<S, T>, "name" | "state">, operations: number) => import("../document").LoadStateAction;
|
|
70
70
|
};
|
|
71
|
-
export declare const module: _DocumentModel<DocumentModelState, DocumentModelAction,
|
|
71
|
+
export declare const module: _DocumentModel<DocumentModelState, DocumentModelAction, DocumentModelLocalState, DocumentModel>;
|
|
72
72
|
export * from './custom/utils';
|
|
73
73
|
export * from './gen/types';
|
|
74
74
|
export { DocumentModel, Document, reducer, actions, utils, documentModel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-21f3d2ee.js");require("json-stringify-deterministic");require("immer");require("crypto");require("fs");require("https");require("path");require("jszip");const e=require("./internal/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-21f3d2ee.js");require("json-stringify-deterministic");require("immer");require("crypto");require("fs");require("https");require("path");require("jszip");const e=require("./internal/index-284511b8.js");require("zod");exports.Document=e.Document;exports.DocumentModel=e.DocumentModel$1;exports.actions=e.actions;exports.documentModel=e.documentModel;exports.module=e.module;exports.reducer=e.reducer;exports.utils=e.utils;exports.z=e.zod;
|
|
@@ -6,7 +6,7 @@ import "fs";
|
|
|
6
6
|
import "https";
|
|
7
7
|
import "path";
|
|
8
8
|
import "jszip";
|
|
9
|
-
import { b as d, a as l, c as n, d as D, m as M, r as b, u as f, z as x } from "./internal/index-
|
|
9
|
+
import { b as d, a as l, c as n, d as D, m as M, r as b, u as f, z as x } from "./internal/index-09364517.js";
|
|
10
10
|
import "zod";
|
|
11
11
|
export {
|
|
12
12
|
d as Document,
|
package/dist/node/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-2d4783d9.js"),o=require("./internal/index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-2d4783d9.js"),o=require("./internal/index-284511b8.js");require("./internal/object-21f3d2ee.js");require("json-stringify-deterministic");require("immer");require("jszip");require("crypto");require("fs");require("https");require("path");require("zod");const u={"powerhouse/document":e.Document,"powerhouse/document-model":o.DocumentModel},r={Document:e.Document,DocumentModel:o.DocumentModel};exports.Document=e.Document;exports.DocumentModel=o.DocumentModel;exports.DocumentModels=u;exports.default=r;
|
package/dist/node/index.js
CHANGED
|
@@ -1490,9 +1490,7 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1490
1490
|
default:
|
|
1491
1491
|
return t;
|
|
1492
1492
|
}
|
|
1493
|
-
}, g = mt(
|
|
1494
|
-
Ct
|
|
1495
|
-
), kt = {
|
|
1493
|
+
}, g = mt(Ct), kt = {
|
|
1496
1494
|
id: "",
|
|
1497
1495
|
name: "",
|
|
1498
1496
|
extension: "",
|
|
@@ -1520,10 +1518,13 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1520
1518
|
modules: []
|
|
1521
1519
|
}
|
|
1522
1520
|
]
|
|
1523
|
-
}, O = {
|
|
1521
|
+
}, yt = {}, O = {
|
|
1524
1522
|
fileExtension: "phdm",
|
|
1525
1523
|
createState(t) {
|
|
1526
|
-
return {
|
|
1524
|
+
return {
|
|
1525
|
+
global: { ...kt, ...t == null ? void 0 : t.global },
|
|
1526
|
+
local: { ...yt, ...t == null ? void 0 : t.local }
|
|
1527
|
+
};
|
|
1527
1528
|
},
|
|
1528
1529
|
createExtendedState(t) {
|
|
1529
1530
|
return ht(
|
|
@@ -1568,7 +1569,7 @@ const Dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1568
1569
|
"SET_AUTHOR_WEBSITE",
|
|
1569
1570
|
{ ...t }
|
|
1570
1571
|
);
|
|
1571
|
-
class
|
|
1572
|
+
class wt extends l {
|
|
1572
1573
|
setModelName(e) {
|
|
1573
1574
|
return this.dispatch(be(e));
|
|
1574
1575
|
}
|
|
@@ -1601,7 +1602,7 @@ const Ae = (t) => s(
|
|
|
1601
1602
|
"REORDER_CHANGE_LOG_ITEMS",
|
|
1602
1603
|
{ ...t }
|
|
1603
1604
|
), Ne = () => s("RELEASE_NEW_VERSION");
|
|
1604
|
-
class
|
|
1605
|
+
class vt extends l {
|
|
1605
1606
|
addChangeLogItem(e) {
|
|
1606
1607
|
return this.dispatch(Ae(e));
|
|
1607
1608
|
}
|
|
@@ -1634,7 +1635,7 @@ const Le = (t) => s(
|
|
|
1634
1635
|
"REORDER_MODULES",
|
|
1635
1636
|
{ ...t }
|
|
1636
1637
|
);
|
|
1637
|
-
class
|
|
1638
|
+
class Ut extends l {
|
|
1638
1639
|
addModule(e) {
|
|
1639
1640
|
return this.dispatch(Le(e));
|
|
1640
1641
|
}
|
|
@@ -1673,7 +1674,7 @@ const ye = (t) => s(
|
|
|
1673
1674
|
"REORDER_OPERATION_ERRORS",
|
|
1674
1675
|
{ ...t }
|
|
1675
1676
|
);
|
|
1676
|
-
class
|
|
1677
|
+
class Vt extends l {
|
|
1677
1678
|
addOperationError(e) {
|
|
1678
1679
|
return this.dispatch(ye(e));
|
|
1679
1680
|
}
|
|
@@ -1709,7 +1710,7 @@ const Xe = (t) => s(
|
|
|
1709
1710
|
"REORDER_OPERATION_EXAMPLES",
|
|
1710
1711
|
{ ...t }
|
|
1711
1712
|
);
|
|
1712
|
-
class
|
|
1713
|
+
class Ft extends l {
|
|
1713
1714
|
addOperationExample(e) {
|
|
1714
1715
|
return this.dispatch(Xe(e));
|
|
1715
1716
|
}
|
|
@@ -1754,7 +1755,7 @@ const ze = (t) => s(
|
|
|
1754
1755
|
"REORDER_MODULE_OPERATIONS",
|
|
1755
1756
|
{ ...t }
|
|
1756
1757
|
);
|
|
1757
|
-
class
|
|
1758
|
+
class Ht extends l {
|
|
1758
1759
|
addOperation(e) {
|
|
1759
1760
|
return this.dispatch(ze(e));
|
|
1760
1761
|
}
|
|
@@ -1805,7 +1806,7 @@ const rt = (t) => s(
|
|
|
1805
1806
|
"REORDER_STATE_EXAMPLES",
|
|
1806
1807
|
{ ...t }
|
|
1807
1808
|
);
|
|
1808
|
-
class
|
|
1809
|
+
class Xt extends l {
|
|
1809
1810
|
setStateSchema(e) {
|
|
1810
1811
|
return this.dispatch(rt(e));
|
|
1811
1812
|
}
|
|
@@ -1842,15 +1843,15 @@ let pe = (m = class extends l {
|
|
|
1842
1843
|
}
|
|
1843
1844
|
}, le(m, "fileExtension", "phdm"), m);
|
|
1844
1845
|
_t(pe, [
|
|
1845
|
-
yt,
|
|
1846
1846
|
wt,
|
|
1847
1847
|
vt,
|
|
1848
1848
|
Ut,
|
|
1849
1849
|
Vt,
|
|
1850
1850
|
Ft,
|
|
1851
|
-
Ht
|
|
1851
|
+
Ht,
|
|
1852
|
+
Xt
|
|
1852
1853
|
]);
|
|
1853
|
-
const
|
|
1854
|
+
const Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1854
1855
|
__proto__: null,
|
|
1855
1856
|
addChangeLogItem: Ae,
|
|
1856
1857
|
addModule: Le,
|
|
@@ -1895,30 +1896,30 @@ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1895
1896
|
updateChangeLogItem: xe,
|
|
1896
1897
|
updateOperationExample: Ge,
|
|
1897
1898
|
updateStateExample: it
|
|
1898
|
-
}, Symbol.toStringTag, { value: "Module" })), pt = pe, lt = { ...O, ...Tt }, ct = { ...It, ...
|
|
1899
|
+
}, Symbol.toStringTag, { value: "Module" })), pt = pe, lt = { ...O, ...Tt }, ct = { ...It, ...Gt }, $t = {
|
|
1899
1900
|
Document: pt,
|
|
1900
1901
|
reducer: g,
|
|
1901
1902
|
actions: ct,
|
|
1902
1903
|
utils: lt,
|
|
1903
1904
|
documentModel: ce
|
|
1904
|
-
},
|
|
1905
|
+
}, tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1905
1906
|
__proto__: null,
|
|
1906
1907
|
Document: pt,
|
|
1907
1908
|
DocumentModel: pe,
|
|
1908
1909
|
actions: ct,
|
|
1909
1910
|
documentModel: ce,
|
|
1910
|
-
module:
|
|
1911
|
+
module: $t,
|
|
1911
1912
|
reducer: g,
|
|
1912
1913
|
utils: lt,
|
|
1913
1914
|
z: Dt
|
|
1914
1915
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1915
1916
|
export {
|
|
1916
|
-
|
|
1917
|
+
tr as D,
|
|
1917
1918
|
pe as a,
|
|
1918
1919
|
pt as b,
|
|
1919
1920
|
ct as c,
|
|
1920
1921
|
ce as d,
|
|
1921
|
-
|
|
1922
|
+
$t as m,
|
|
1922
1923
|
g as r,
|
|
1923
1924
|
lt as u,
|
|
1924
1925
|
Dt as z
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
"modules": []
|
|
20
20
|
}
|
|
21
21
|
]
|
|
22
|
-
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},me=t=>t!=null,ht=r.z.any().refine(t=>me(t));function _(){return r.z.object({__typename:r.z.literal("AddChangeLogItemInput").optional(),content:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullable()})}function z(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),name:r.z.string()})}function A(){return r.z.object({errorCode:r.z.string().nullish(),errorDescription:r.z.string().nullish(),errorName:r.z.string().nullish(),errorTemplate:r.z.string().nullish(),id:r.z.string(),operationId:r.z.string()})}function I(){return r.z.object({example:r.z.string(),id:r.z.string(),operationId:r.z.string()})}function T(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),moduleId:r.z.string(),name:r.z.string(),reducer:r.z.string().nullish(),schema:r.z.string().nullish(),template:r.z.string().nullish(),scope:r.z.literal("local").or(r.z.literal("global")).nullish()})}function R(){return r.z.object({scope:r.z.string(),example:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullish()})}function Ee(){return r.z.object({__typename:r.z.literal("Author").optional(),name:r.z.string(),website:r.z.string().nullable()})}function D(){return r.z.object({__typename:r.z.literal("CodeExample").optional(),id:r.z.string(),value:r.z.string()})}function M(){return r.z.object({__typename:r.z.literal("DeleteChangeLogItemInput").optional(),id:r.z.string()})}function x(){return r.z.object({id:r.z.string()})}function N(){return r.z.object({id:r.z.string()})}function L(){return r.z.object({id:r.z.string()})}function j(){return r.z.object({id:r.z.string()})}function P(){return r.z.object({scope:r.z.string(),id:r.z.string()})}function Ot(){return r.z.union([_(),z(),A(),I(),T(),R(),M(),x(),N(),L(),j(),P(),C(),k(),y(),w(),v(),U(),V(),F(),H(),$(),X(),G(),B(),W(),q(),J(),K(),Q(),Y(),Z(),ee(),te(),re(),oe(),ne(),ie(),se(),ae(),pe()])}function gt(){return r.z.object({__typename:r.z.literal("DocumentModelState").optional(),author:Ee(),description:r.z.string(),extension:r.z.string(),id:r.z.string(),name:r.z.string(),specifications:r.z.array(he())})}function he(){return r.z.object({__typename:r.z.literal("DocumentSpecification").optional(),changeLog:r.z.array(r.z.string()),modules:r.z.array(Oe()),state:fe(),version:r.z.number()})}function Oe(){return r.z.object({__typename:r.z.literal("Module").optional(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string(),operations:r.z.array(ge())})}function C(){return r.z.object({newModuleId:r.z.string(),operationId:r.z.string()})}function ge(){return r.z.object({__typename:r.z.literal("Operation").optional(),description:r.z.string().nullable(),errors:r.z.array(Se()),examples:r.z.array(D()),id:r.z.string(),name:r.z.string().nullable(),reducer:r.z.string().nullable(),schema:r.z.string().nullable(),template:r.z.string().nullable(),scope:r.z.literal("local").or(r.z.literal("global"))})}function Se(){return r.z.object({__typename:r.z.literal("OperationError").optional(),code:r.z.string().nullable(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string().nullable(),template:r.z.string().nullable()})}function k(){return r.z.object({__typename:r.z.literal("ReorderChangeLogItemsInput").optional(),order:r.z.array(r.z.string())})}function y(){return r.z.object({moduleId:r.z.string(),order:r.z.array(r.z.string())})}function w(){return r.z.object({order:r.z.array(r.z.string())})}function v(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function U(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function V(){return r.z.object({scope:r.z.string(),order:r.z.array(r.z.string())})}function F(){return r.z.object({authorName:r.z.string()})}function H(){return r.z.object({authorWebsite:r.z.string()})}function $(){return r.z.object({scope:r.z.string(),initialValue:r.z.string()})}function X(){return r.z.object({description:r.z.string()})}function G(){return r.z.object({extension:r.z.string()})}function B(){return r.z.object({id:r.z.string()})}function W(){return r.z.object({name:r.z.string()})}function q(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function J(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function K(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function Q(){return r.z.object({errorCode:r.z.string().nullish(),id:r.z.string()})}function Y(){return r.z.object({errorDescription:r.z.string().nullish(),id:r.z.string()})}function Z(){return r.z.object({errorName:r.z.string().nullish(),id:r.z.string()})}function ee(){return r.z.object({errorTemplate:r.z.string().nullish(),id:r.z.string()})}function te(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function be(){return r.z.object({id:r.z.string(),scope:r.z.literal("global").or(r.z.literal("local"))})}function re(){return r.z.object({id:r.z.string(),reducer:r.z.string().nullish()})}function oe(){return r.z.object({id:r.z.string(),schema:r.z.string().nullish()})}function ne(){return r.z.object({id:r.z.string(),template:r.z.string().nullish()})}function ie(){return r.z.object({scope:r.z.string(),schema:r.z.string()})}function b(){return r.z.object({__typename:r.z.literal("State").optional(),examples:r.z.array(D()),initialValue:r.z.string(),schema:r.z.string()})}function fe(){return r.z.object({global:b(),local:b()})}function se(){return r.z.object({__typename:r.z.literal("UpdateChangeLogItemInput").optional(),id:r.z.string(),newContent:r.z.string()})}function ae(){return r.z.object({example:r.z.string(),id:r.z.string()})}function pe(){return r.z.object({scope:r.z.string(),id:r.z.string(),newExample:r.z.string()})}const _e=Object.freeze(Object.defineProperty({__proto__:null,AddChangeLogItemInputSchema:_,AddModuleInputSchema:z,AddOperationErrorInputSchema:A,AddOperationExampleInputSchema:I,AddOperationInputSchema:T,AddStateExampleInputSchema:R,AuthorSchema:Ee,CodeExampleSchema:D,DeleteChangeLogItemInputSchema:M,DeleteModuleInputSchema:x,DeleteOperationErrorInputSchema:N,DeleteOperationExampleInputSchema:L,DeleteOperationInputSchema:j,DeleteStateExampleInputSchema:P,DocumentModelInputSchema:Ot,DocumentModelStateSchema:gt,DocumentSpecificationSchema:he,ModuleSchema:Oe,MoveOperationInputSchema:C,OperationErrorSchema:Se,OperationSchema:ge,ReorderChangeLogItemsInputSchema:k,ReorderModuleOperationsInputSchema:y,ReorderModulesInputSchema:w,ReorderOperationErrorsInputSchema:v,ReorderOperationExamplesInputSchema:U,ReorderStateExamplesInputSchema:V,ScopeStateSchema:fe,SetAuthorNameInputSchema:F,SetAuthorWebsiteInputSchema:H,SetInitialStateInputSchema:$,SetModelDescriptionInputSchema:X,SetModelExtensionInputSchema:G,SetModelIdInputSchema:B,SetModelNameInputSchema:W,SetModuleDescriptionInputSchema:q,SetModuleNameInputSchema:J,SetOperationDescriptionInputSchema:K,SetOperationErrorCodeInputSchema:Q,SetOperationErrorDescriptionInputSchema:Y,SetOperationErrorNameInputSchema:Z,SetOperationErrorTemplateInputSchema:ee,SetOperationNameInputSchema:te,SetOperationReducerInputSchema:re,SetOperationSchemaInputSchema:oe,SetOperationScopeInputSchema:be,SetOperationTemplateInputSchema:ne,SetStateSchemaInputSchema:ie,StateSchema:b,UpdateChangeLogItemInputSchema:se,UpdateOperationExampleInputSchema:ae,UpdateStateExampleInputSchema:pe,definedNonNullAnySchema:ht,isDefinedNonNullAny:me},Symbol.toStringTag,{value:"Module"})),c={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},E={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},St=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},h={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const o=t.specifications[t.specifications.length-1];o.modules=o.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(St(e.input.order))}},bt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},l={addOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].errors=o.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.sort(bt(e.input.order))}},ft=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},g={addOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].examples.length;a++)o.modules[n].operations[i].examples[a].id==e.input.id&&(o.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].examples=o.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.sort(ft(e.input.order))}},_t=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},p={addOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const o=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(o.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...o)},deleteOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].operations=o.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.sort(_t(e.input.order))}},zt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},d={setStateSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(!Object.keys(o.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=o.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples=o.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.sort(zt(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},At=(t,e)=>{if(s.isBaseAction(e))return t;switch(e.type){case"SET_MODEL_NAME":W().parse(e.input),c.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":B().parse(e.input),c.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":G().parse(e.input),c.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":X().parse(e.input),c.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":F().parse(e.input),c.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":H().parse(e.input),c.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":_().parse(e.input),E.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":se().parse(e.input),E.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":M().parse(e.input),E.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":k().parse(e.input),E.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");E.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":z().parse(e.input),h.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":J().parse(e.input),h.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":q().parse(e.input),h.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":x().parse(e.input),h.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":w().parse(e.input),h.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":A().parse(e.input),l.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":Q().parse(e.input),l.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":Z().parse(e.input),l.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":Y().parse(e.input),l.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":ee().parse(e.input),l.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":N().parse(e.input),l.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":v().parse(e.input),l.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":I().parse(e.input),g.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":ae().parse(e.input),g.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":L().parse(e.input),g.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":U().parse(e.input),g.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":T().parse(e.input),p.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":te().parse(e.input),p.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":be().parse(e.input),p.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":oe().parse(e.input),p.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":K().parse(e.input),p.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":ne().parse(e.input),p.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":re().parse(e.input),p.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":C().parse(e.input),p.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":j().parse(e.input),p.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":y().parse(e.input),p.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":ie().parse(e.input),d.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":$().parse(e.input),d.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":R().parse(e.input),d.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":pe().parse(e.input),d.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":P().parse(e.input),d.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":V().parse(e.input),d.reorderStateExamplesOperation(t.global,e);break;default:return t}},m=s.createReducer(At),It={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},O={fileExtension:"phdm",createState(t){return{global:{...It,...t},local:{}}},createExtendedState(t){return s.createExtendedState({...t,documentType:"powerhouse/document-model"},O.createState)},createDocument(t){return s.createDocument(O.createExtendedState(t),O.createState)},saveToFile(t,e,o){return s.saveToFile(t,e,"phdm",o)},saveToFileHandle(t,e){return s.saveToFileHandle(t,e)},loadFromFile(t){return s.loadFromFile(t,m)},loadFromInput(t){return s.loadFromInput(t,m)}},ze=t=>s.createAction("SET_MODEL_NAME",{...t}),Ae=t=>s.createAction("SET_MODEL_ID",{...t}),Ie=t=>s.createAction("SET_MODEL_EXTENSION",{...t}),Te=t=>s.createAction("SET_MODEL_DESCRIPTION",{...t}),Re=t=>s.createAction("SET_AUTHOR_NAME",{...t}),De=t=>s.createAction("SET_AUTHOR_WEBSITE",{...t});class Tt extends s.BaseDocument{setModelName(e){return this.dispatch(ze(e))}setModelId(e){return this.dispatch(Ae(e))}setModelExtension(e){return this.dispatch(Ie(e))}setModelDescription(e){return this.dispatch(Te(e))}setAuthorName(e){return this.dispatch(Re(e))}setAuthorWebsite(e){return this.dispatch(De(e))}}const Me=t=>s.createAction("ADD_CHANGE_LOG_ITEM",{...t}),xe=t=>s.createAction("UPDATE_CHANGE_LOG_ITEM",{...t}),Ne=t=>s.createAction("DELETE_CHANGE_LOG_ITEM",{...t}),Le=t=>s.createAction("REORDER_CHANGE_LOG_ITEMS",{...t}),je=()=>s.createAction("RELEASE_NEW_VERSION");class Rt extends s.BaseDocument{addChangeLogItem(e){return this.dispatch(Me(e))}updateChangeLogItem(e){return this.dispatch(xe(e))}deleteChangeLogItem(e){return this.dispatch(Ne(e))}reorderChangeLogItems(e){return this.dispatch(Le(e))}releaseNewVersion(){return this.dispatch(je())}}const Pe=t=>s.createAction("ADD_MODULE",{...t}),Ce=t=>s.createAction("SET_MODULE_NAME",{...t}),ke=t=>s.createAction("SET_MODULE_DESCRIPTION",{...t}),ye=t=>s.createAction("DELETE_MODULE",{...t}),we=t=>s.createAction("REORDER_MODULES",{...t});class Dt extends s.BaseDocument{addModule(e){return this.dispatch(Pe(e))}setModuleName(e){return this.dispatch(Ce(e))}setModuleDescription(e){return this.dispatch(ke(e))}deleteModule(e){return this.dispatch(ye(e))}reorderModules(e){return this.dispatch(we(e))}}const ve=t=>s.createAction("ADD_OPERATION_ERROR",{...t}),Ue=t=>s.createAction("SET_OPERATION_ERROR_CODE",{...t}),Ve=t=>s.createAction("SET_OPERATION_ERROR_NAME",{...t}),Fe=t=>s.createAction("SET_OPERATION_ERROR_DESCRIPTION",{...t}),He=t=>s.createAction("SET_OPERATION_ERROR_TEMPLATE",{...t}),$e=t=>s.createAction("DELETE_OPERATION_ERROR",{...t}),Xe=t=>s.createAction("REORDER_OPERATION_ERRORS",{...t});class Mt extends s.BaseDocument{addOperationError(e){return this.dispatch(ve(e))}setOperationErrorCode(e){return this.dispatch(Ue(e))}setOperationErrorName(e){return this.dispatch(Ve(e))}setOperationErrorDescription(e){return this.dispatch(Fe(e))}setOperationErrorTemplate(e){return this.dispatch(He(e))}deleteOperationError(e){return this.dispatch($e(e))}reorderOperationErrors(e){return this.dispatch(Xe(e))}}const Ge=t=>s.createAction("ADD_OPERATION_EXAMPLE",{...t}),Be=t=>s.createAction("UPDATE_OPERATION_EXAMPLE",{...t}),We=t=>s.createAction("DELETE_OPERATION_EXAMPLE",{...t}),qe=t=>s.createAction("REORDER_OPERATION_EXAMPLES",{...t});class xt extends s.BaseDocument{addOperationExample(e){return this.dispatch(Ge(e))}updateOperationExample(e){return this.dispatch(Be(e))}deleteOperationExample(e){return this.dispatch(We(e))}reorderOperationExamples(e){return this.dispatch(qe(e))}}const Je=t=>s.createAction("ADD_OPERATION",{...t}),Ke=t=>s.createAction("SET_OPERATION_NAME",{...t}),Qe=t=>s.createAction("SET_OPERATION_SCOPE",{...t}),Ye=t=>s.createAction("SET_OPERATION_SCHEMA",{...t}),Ze=t=>s.createAction("SET_OPERATION_DESCRIPTION",{...t}),et=t=>s.createAction("SET_OPERATION_TEMPLATE",{...t}),tt=t=>s.createAction("SET_OPERATION_REDUCER",{...t}),rt=t=>s.createAction("MOVE_OPERATION",{...t}),ot=t=>s.createAction("DELETE_OPERATION",{...t}),nt=t=>s.createAction("REORDER_MODULE_OPERATIONS",{...t});class Nt extends s.BaseDocument{addOperation(e){return this.dispatch(Je(e))}setOperationName(e){return this.dispatch(Ke(e))}setOperationScope(e){return this.dispatch(Qe(e))}setOperationSchema(e){return this.dispatch(Ye(e))}setOperationDescription(e){return this.dispatch(Ze(e))}setOperationTemplate(e){return this.dispatch(et(e))}setOperationReducer(e){return this.dispatch(tt(e))}moveOperation(e){return this.dispatch(rt(e))}deleteOperation(e){return this.dispatch(ot(e))}reorderModuleOperations(e){return this.dispatch(nt(e))}}const it=t=>s.createAction("SET_STATE_SCHEMA",{...t}),st=t=>s.createAction("SET_INITIAL_STATE",{...t}),at=t=>s.createAction("ADD_STATE_EXAMPLE",{...t}),pt=t=>s.createAction("UPDATE_STATE_EXAMPLE",{...t}),lt=t=>s.createAction("DELETE_STATE_EXAMPLE",{...t}),ct=t=>s.createAction("REORDER_STATE_EXAMPLES",{...t});class Lt extends s.BaseDocument{setStateSchema(e){return this.dispatch(it(e))}setInitialState(e){return this.dispatch(st(e))}addStateExample(e){return this.dispatch(at(e))}updateStateExample(e){return this.dispatch(pt(e))}deleteStateExample(e){return this.dispatch(lt(e))}reorderStateExamples(e){return this.dispatch(ct(e))}}var u;let S=(u=class extends s.BaseDocument{constructor(e,o){super(m,O.createDocument(e),o)}saveToFile(e,o){return super.saveToFile(e,u.fileExtension,o)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const o=new this;return await o.loadFromFile(e),o}},ue(u,"fileExtension","phdm"),u);s.applyMixins(S,[Tt,Rt,Dt,Mt,xt,Nt,Lt]);const jt=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:Me,addModule:Pe,addOperation:Je,addOperationError:ve,addOperationExample:Ge,addStateExample:at,deleteChangeLogItem:Ne,deleteModule:ye,deleteOperation:ot,deleteOperationError:$e,deleteOperationExample:We,deleteStateExample:lt,moveOperation:rt,releaseNewVersion:je,reorderChangeLogItems:Le,reorderModuleOperations:nt,reorderModules:we,reorderOperationErrors:Xe,reorderOperationExamples:qe,reorderStateExamples:ct,setAuthorName:Re,setAuthorWebsite:De,setInitialState:st,setModelDescription:Te,setModelExtension:Ie,setModelId:Ae,setModelName:ze,setModuleDescription:ke,setModuleName:Ce,setOperationDescription:Ze,setOperationErrorCode:Ue,setOperationErrorDescription:Fe,setOperationErrorName:Ve,setOperationErrorTemplate:He,setOperationName:Ke,setOperationReducer:tt,setOperationSchema:Ye,setOperationScope:Qe,setOperationTemplate:et,setStateSchema:it,updateChangeLogItem:xe,updateOperationExample:Be,updateStateExample:pt},Symbol.toStringTag,{value:"Module"})),le=S,ce={...O,...Et},de={...s.BaseActions,...jt},dt={Document:le,reducer:m,actions:de,utils:ce,documentModel:f},Pt=Object.freeze(Object.defineProperty({__proto__:null,Document:le,DocumentModel:S,actions:de,documentModel:f,module:dt,reducer:m,utils:ce,z:_e},Symbol.toStringTag,{value:"Module"}));exports.Document=le;exports.DocumentModel=Pt;exports.DocumentModel$1=S;exports.actions=de;exports.documentModel=f;exports.module=dt;exports.reducer=m;exports.utils=ce;exports.zod=_e;
|
|
22
|
+
}`,examples:[]},local:{schema:"",initialValue:"{}",examples:[]}}}]},me=t=>t!=null,ht=r.z.any().refine(t=>me(t));function _(){return r.z.object({__typename:r.z.literal("AddChangeLogItemInput").optional(),content:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullable()})}function z(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),name:r.z.string()})}function A(){return r.z.object({errorCode:r.z.string().nullish(),errorDescription:r.z.string().nullish(),errorName:r.z.string().nullish(),errorTemplate:r.z.string().nullish(),id:r.z.string(),operationId:r.z.string()})}function I(){return r.z.object({example:r.z.string(),id:r.z.string(),operationId:r.z.string()})}function T(){return r.z.object({description:r.z.string().nullish(),id:r.z.string(),moduleId:r.z.string(),name:r.z.string(),reducer:r.z.string().nullish(),schema:r.z.string().nullish(),template:r.z.string().nullish(),scope:r.z.literal("local").or(r.z.literal("global")).nullish()})}function R(){return r.z.object({scope:r.z.string(),example:r.z.string(),id:r.z.string(),insertBefore:r.z.string().nullish()})}function Ee(){return r.z.object({__typename:r.z.literal("Author").optional(),name:r.z.string(),website:r.z.string().nullable()})}function D(){return r.z.object({__typename:r.z.literal("CodeExample").optional(),id:r.z.string(),value:r.z.string()})}function M(){return r.z.object({__typename:r.z.literal("DeleteChangeLogItemInput").optional(),id:r.z.string()})}function x(){return r.z.object({id:r.z.string()})}function N(){return r.z.object({id:r.z.string()})}function L(){return r.z.object({id:r.z.string()})}function j(){return r.z.object({id:r.z.string()})}function P(){return r.z.object({scope:r.z.string(),id:r.z.string()})}function Ot(){return r.z.union([_(),z(),A(),I(),T(),R(),M(),x(),N(),L(),j(),P(),C(),k(),y(),w(),v(),U(),V(),F(),H(),$(),X(),G(),B(),W(),q(),J(),K(),Q(),Y(),Z(),ee(),te(),re(),oe(),ne(),ie(),se(),ae(),pe()])}function gt(){return r.z.object({__typename:r.z.literal("DocumentModelState").optional(),author:Ee(),description:r.z.string(),extension:r.z.string(),id:r.z.string(),name:r.z.string(),specifications:r.z.array(he())})}function he(){return r.z.object({__typename:r.z.literal("DocumentSpecification").optional(),changeLog:r.z.array(r.z.string()),modules:r.z.array(Oe()),state:fe(),version:r.z.number()})}function Oe(){return r.z.object({__typename:r.z.literal("Module").optional(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string(),operations:r.z.array(ge())})}function C(){return r.z.object({newModuleId:r.z.string(),operationId:r.z.string()})}function ge(){return r.z.object({__typename:r.z.literal("Operation").optional(),description:r.z.string().nullable(),errors:r.z.array(Se()),examples:r.z.array(D()),id:r.z.string(),name:r.z.string().nullable(),reducer:r.z.string().nullable(),schema:r.z.string().nullable(),template:r.z.string().nullable(),scope:r.z.literal("local").or(r.z.literal("global"))})}function Se(){return r.z.object({__typename:r.z.literal("OperationError").optional(),code:r.z.string().nullable(),description:r.z.string().nullable(),id:r.z.string(),name:r.z.string().nullable(),template:r.z.string().nullable()})}function k(){return r.z.object({__typename:r.z.literal("ReorderChangeLogItemsInput").optional(),order:r.z.array(r.z.string())})}function y(){return r.z.object({moduleId:r.z.string(),order:r.z.array(r.z.string())})}function w(){return r.z.object({order:r.z.array(r.z.string())})}function v(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function U(){return r.z.object({operationId:r.z.string(),order:r.z.array(r.z.string())})}function V(){return r.z.object({scope:r.z.string(),order:r.z.array(r.z.string())})}function F(){return r.z.object({authorName:r.z.string()})}function H(){return r.z.object({authorWebsite:r.z.string()})}function $(){return r.z.object({scope:r.z.string(),initialValue:r.z.string()})}function X(){return r.z.object({description:r.z.string()})}function G(){return r.z.object({extension:r.z.string()})}function B(){return r.z.object({id:r.z.string()})}function W(){return r.z.object({name:r.z.string()})}function q(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function J(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function K(){return r.z.object({description:r.z.string().nullish(),id:r.z.string()})}function Q(){return r.z.object({errorCode:r.z.string().nullish(),id:r.z.string()})}function Y(){return r.z.object({errorDescription:r.z.string().nullish(),id:r.z.string()})}function Z(){return r.z.object({errorName:r.z.string().nullish(),id:r.z.string()})}function ee(){return r.z.object({errorTemplate:r.z.string().nullish(),id:r.z.string()})}function te(){return r.z.object({id:r.z.string(),name:r.z.string().nullish()})}function be(){return r.z.object({id:r.z.string(),scope:r.z.literal("global").or(r.z.literal("local"))})}function re(){return r.z.object({id:r.z.string(),reducer:r.z.string().nullish()})}function oe(){return r.z.object({id:r.z.string(),schema:r.z.string().nullish()})}function ne(){return r.z.object({id:r.z.string(),template:r.z.string().nullish()})}function ie(){return r.z.object({scope:r.z.string(),schema:r.z.string()})}function b(){return r.z.object({__typename:r.z.literal("State").optional(),examples:r.z.array(D()),initialValue:r.z.string(),schema:r.z.string()})}function fe(){return r.z.object({global:b(),local:b()})}function se(){return r.z.object({__typename:r.z.literal("UpdateChangeLogItemInput").optional(),id:r.z.string(),newContent:r.z.string()})}function ae(){return r.z.object({example:r.z.string(),id:r.z.string()})}function pe(){return r.z.object({scope:r.z.string(),id:r.z.string(),newExample:r.z.string()})}const _e=Object.freeze(Object.defineProperty({__proto__:null,AddChangeLogItemInputSchema:_,AddModuleInputSchema:z,AddOperationErrorInputSchema:A,AddOperationExampleInputSchema:I,AddOperationInputSchema:T,AddStateExampleInputSchema:R,AuthorSchema:Ee,CodeExampleSchema:D,DeleteChangeLogItemInputSchema:M,DeleteModuleInputSchema:x,DeleteOperationErrorInputSchema:N,DeleteOperationExampleInputSchema:L,DeleteOperationInputSchema:j,DeleteStateExampleInputSchema:P,DocumentModelInputSchema:Ot,DocumentModelStateSchema:gt,DocumentSpecificationSchema:he,ModuleSchema:Oe,MoveOperationInputSchema:C,OperationErrorSchema:Se,OperationSchema:ge,ReorderChangeLogItemsInputSchema:k,ReorderModuleOperationsInputSchema:y,ReorderModulesInputSchema:w,ReorderOperationErrorsInputSchema:v,ReorderOperationExamplesInputSchema:U,ReorderStateExamplesInputSchema:V,ScopeStateSchema:fe,SetAuthorNameInputSchema:F,SetAuthorWebsiteInputSchema:H,SetInitialStateInputSchema:$,SetModelDescriptionInputSchema:X,SetModelExtensionInputSchema:G,SetModelIdInputSchema:B,SetModelNameInputSchema:W,SetModuleDescriptionInputSchema:q,SetModuleNameInputSchema:J,SetOperationDescriptionInputSchema:K,SetOperationErrorCodeInputSchema:Q,SetOperationErrorDescriptionInputSchema:Y,SetOperationErrorNameInputSchema:Z,SetOperationErrorTemplateInputSchema:ee,SetOperationNameInputSchema:te,SetOperationReducerInputSchema:re,SetOperationSchemaInputSchema:oe,SetOperationScopeInputSchema:be,SetOperationTemplateInputSchema:ne,SetStateSchemaInputSchema:ie,StateSchema:b,UpdateChangeLogItemInputSchema:se,UpdateOperationExampleInputSchema:ae,UpdateStateExampleInputSchema:pe,definedNonNullAnySchema:ht,isDefinedNonNullAny:me},Symbol.toStringTag,{value:"Module"})),c={setModelNameOperation(t,e){t.name=e.input.name},setModelIdOperation(t,e){t.id=e.input.id},setModelExtensionOperation(t,e){t.extension=e.input.extension},setModelDescriptionOperation(t,e){t.description=e.input.description},setAuthorNameOperation(t,e){t.author=t.author||{name:"",website:null},t.author.name=e.input.authorName},setAuthorWebsiteOperation(t,e){t.author=t.author||{name:"",website:null},t.author.website=e.input.authorWebsite}},E={addChangeLogItemOperation(t,e){throw new Error('Reducer "addChangeLogItemOperation" not yet implemented')},updateChangeLogItemOperation(t,e){throw new Error('Reducer "updateChangeLogItemOperation" not yet implemented')},deleteChangeLogItemOperation(t,e){throw new Error('Reducer "deleteChangeLogItemOperation" not yet implemented')},reorderChangeLogItemsOperation(t,e){throw new Error('Reducer "reorderChangeLogItemsOperation" not yet implemented')},releaseNewVersionOperation(t,e){throw new Error('Reducer "releaseNewVersionOperation" not yet implemented')}},St=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},h={addModuleOperation(t,e){t.specifications[t.specifications.length-1].modules.push({id:e.input.id,name:e.input.name,description:e.input.description||"",operations:[]})},setModuleNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].name=e.input.name||"")},setModuleDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id===e.input.id&&(o.modules[n].description=e.input.description||"")},deleteModuleOperation(t,e){const o=t.specifications[t.specifications.length-1];o.modules=o.modules.filter(n=>n.id!=e.input.id)},reorderModulesOperation(t,e){t.specifications[t.specifications.length-1].modules.sort(St(e.input.order))}},bt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},l={addOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.push({id:e.input.id,name:e.input.errorName||"",code:e.input.errorCode||"",description:e.input.errorDescription||"",template:e.input.errorTemplate||""})},setOperationErrorCodeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].code=e.input.errorCode||"")},setOperationErrorNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].name=e.input.errorName||"")},setOperationErrorDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].description=e.input.errorDescription||"")},setOperationErrorTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].errors.length;a++)o.modules[n].operations[i].errors[a].id==e.input.id&&(o.modules[n].operations[i].errors[a].template=e.input.errorTemplate||"")},deleteOperationErrorOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].errors=o.modules[n].operations[i].errors.filter(a=>a.id!=e.input.id)},reorderOperationErrorsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].errors.sort(bt(e.input.order))}},ft=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},g={addOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.push({id:e.input.id,value:e.input.example})},updateOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)for(let a=0;a<o.modules[n].operations[i].examples.length;a++)o.modules[n].operations[i].examples[a].id==e.input.id&&(o.modules[n].operations[i].examples[a].value=e.input.example)},deleteOperationExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].examples=o.modules[n].operations[i].examples.filter(a=>a.id!=e.input.id)},reorderOperationExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.operationId&&o.modules[n].operations[i].examples.sort(ft(e.input.order))}},_t=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},p={addOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.push({id:e.input.id,name:e.input.name,description:e.input.description||"",schema:e.input.schema||"",template:e.input.template||e.input.description||"",reducer:e.input.reducer||"",errors:[],examples:[],scope:e.input.scope||"global"})},setOperationNameOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].name=e.input.name||"")},setOperationScopeOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].scope=e.input.scope||"global")},setOperationSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].schema=e.input.schema||"")},setOperationDescriptionOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].description=e.input.description||"")},setOperationTemplateOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].template=e.input.template||"")},setOperationReducerOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)for(let i=0;i<o.modules[n].operations.length;i++)o.modules[n].operations[i].id==e.input.id&&(o.modules[n].operations[i].reducer=e.input.reducer||"")},moveOperationOperation(t,e){const o=[],n=t.specifications[t.specifications.length-1];for(let i=0;i<n.modules.length;i++)n.modules[i].operations=n.modules[i].operations.filter(a=>a.id==e.input.operationId?(o.push(a),!1):!0);for(let i=0;i<n.modules.length;i++)n.modules[i].id==e.input.newModuleId&&n.modules[i].operations.push(...o)},deleteOperationOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].operations=o.modules[n].operations.filter(i=>i.id!=e.input.id)},reorderModuleOperationsOperation(t,e){const o=t.specifications[t.specifications.length-1];for(let n=0;n<o.modules.length;n++)o.modules[n].id==e.input.moduleId&&o.modules[n].operations.sort(_t(e.input.order))}},zt=t=>{const e={};return t.forEach((o,n)=>e[o]=n),(o,n)=>(e[n.id]||999999)-(e[o.id]||999999)},d={setStateSchemaOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].schema=e.input.schema;else throw new Error(`Invalid scope: ${e.input.scope}`)},setInitialStateOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].initialValue=e.input.initialValue;else throw new Error(`Invalid scope: ${e.input.scope}`)},addStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.push({id:e.input.id,value:e.input.example});else throw new Error(`Invalid scope: ${e.input.scope}`)},updateStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(!Object.keys(o.state).includes(e.input.scope))throw new Error(`Invalid scope: ${e.input.scope}`);const n=o.state[e.input.scope].examples;for(let i=0;i<n.length;i++)n[i].id==e.input.id&&(n[i].value=e.input.newExample)},deleteStateExampleOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples=o.state[e.input.scope].examples.filter(n=>n.id!=e.input.id);else throw new Error(`Invalid scope: ${e.input.scope}`)},reorderStateExamplesOperation(t,e){const o=t.specifications[t.specifications.length-1];if(Object.keys(o.state).includes(e.input.scope))o.state[e.input.scope].examples.sort(zt(e.input.order));else throw new Error(`Invalid scope: ${e.input.scope}`)}},At=(t,e)=>{if(s.isBaseAction(e))return t;switch(e.type){case"SET_MODEL_NAME":W().parse(e.input),c.setModelNameOperation(t.global,e);break;case"SET_MODEL_ID":B().parse(e.input),c.setModelIdOperation(t.global,e);break;case"SET_MODEL_EXTENSION":G().parse(e.input),c.setModelExtensionOperation(t.global,e);break;case"SET_MODEL_DESCRIPTION":X().parse(e.input),c.setModelDescriptionOperation(t.global,e);break;case"SET_AUTHOR_NAME":F().parse(e.input),c.setAuthorNameOperation(t.global,e);break;case"SET_AUTHOR_WEBSITE":H().parse(e.input),c.setAuthorWebsiteOperation(t.global,e);break;case"ADD_CHANGE_LOG_ITEM":_().parse(e.input),E.addChangeLogItemOperation(t.global,e);break;case"UPDATE_CHANGE_LOG_ITEM":se().parse(e.input),E.updateChangeLogItemOperation(t.global,e);break;case"DELETE_CHANGE_LOG_ITEM":M().parse(e.input),E.deleteChangeLogItemOperation(t.global,e);break;case"REORDER_CHANGE_LOG_ITEMS":k().parse(e.input),E.reorderChangeLogItemsOperation(t.global,e);break;case"RELEASE_NEW_VERSION":if(Object.keys(e.input).length>0)throw new Error("Expected empty input for action RELEASE_NEW_VERSION");E.releaseNewVersionOperation(t.global,e);break;case"ADD_MODULE":z().parse(e.input),h.addModuleOperation(t.global,e);break;case"SET_MODULE_NAME":J().parse(e.input),h.setModuleNameOperation(t.global,e);break;case"SET_MODULE_DESCRIPTION":q().parse(e.input),h.setModuleDescriptionOperation(t.global,e);break;case"DELETE_MODULE":x().parse(e.input),h.deleteModuleOperation(t.global,e);break;case"REORDER_MODULES":w().parse(e.input),h.reorderModulesOperation(t.global,e);break;case"ADD_OPERATION_ERROR":A().parse(e.input),l.addOperationErrorOperation(t.global,e);break;case"SET_OPERATION_ERROR_CODE":Q().parse(e.input),l.setOperationErrorCodeOperation(t.global,e);break;case"SET_OPERATION_ERROR_NAME":Z().parse(e.input),l.setOperationErrorNameOperation(t.global,e);break;case"SET_OPERATION_ERROR_DESCRIPTION":Y().parse(e.input),l.setOperationErrorDescriptionOperation(t.global,e);break;case"SET_OPERATION_ERROR_TEMPLATE":ee().parse(e.input),l.setOperationErrorTemplateOperation(t.global,e);break;case"DELETE_OPERATION_ERROR":N().parse(e.input),l.deleteOperationErrorOperation(t.global,e);break;case"REORDER_OPERATION_ERRORS":v().parse(e.input),l.reorderOperationErrorsOperation(t.global,e);break;case"ADD_OPERATION_EXAMPLE":I().parse(e.input),g.addOperationExampleOperation(t.global,e);break;case"UPDATE_OPERATION_EXAMPLE":ae().parse(e.input),g.updateOperationExampleOperation(t.global,e);break;case"DELETE_OPERATION_EXAMPLE":L().parse(e.input),g.deleteOperationExampleOperation(t.global,e);break;case"REORDER_OPERATION_EXAMPLES":U().parse(e.input),g.reorderOperationExamplesOperation(t.global,e);break;case"ADD_OPERATION":T().parse(e.input),p.addOperationOperation(t.global,e);break;case"SET_OPERATION_NAME":te().parse(e.input),p.setOperationNameOperation(t.global,e);break;case"SET_OPERATION_SCOPE":be().parse(e.input),p.setOperationScopeOperation(t.global,e);break;case"SET_OPERATION_SCHEMA":oe().parse(e.input),p.setOperationSchemaOperation(t.global,e);break;case"SET_OPERATION_DESCRIPTION":K().parse(e.input),p.setOperationDescriptionOperation(t.global,e);break;case"SET_OPERATION_TEMPLATE":ne().parse(e.input),p.setOperationTemplateOperation(t.global,e);break;case"SET_OPERATION_REDUCER":re().parse(e.input),p.setOperationReducerOperation(t.global,e);break;case"MOVE_OPERATION":C().parse(e.input),p.moveOperationOperation(t.global,e);break;case"DELETE_OPERATION":j().parse(e.input),p.deleteOperationOperation(t.global,e);break;case"REORDER_MODULE_OPERATIONS":y().parse(e.input),p.reorderModuleOperationsOperation(t.global,e);break;case"SET_STATE_SCHEMA":ie().parse(e.input),d.setStateSchemaOperation(t.global,e);break;case"SET_INITIAL_STATE":$().parse(e.input),d.setInitialStateOperation(t.global,e);break;case"ADD_STATE_EXAMPLE":R().parse(e.input),d.addStateExampleOperation(t.global,e);break;case"UPDATE_STATE_EXAMPLE":pe().parse(e.input),d.updateStateExampleOperation(t.global,e);break;case"DELETE_STATE_EXAMPLE":P().parse(e.input),d.deleteStateExampleOperation(t.global,e);break;case"REORDER_STATE_EXAMPLES":V().parse(e.input),d.reorderStateExamplesOperation(t.global,e);break;default:return t}},m=s.createReducer(At),It={id:"",name:"",extension:"",description:"",author:{name:"",website:""},specifications:[{version:1,changeLog:[],state:{global:{schema:"",initialValue:"",examples:[]},local:{schema:"",initialValue:"",examples:[]}},modules:[]}]},Tt={},O={fileExtension:"phdm",createState(t){return{global:{...It,...t==null?void 0:t.global},local:{...Tt,...t==null?void 0:t.local}}},createExtendedState(t){return s.createExtendedState({...t,documentType:"powerhouse/document-model"},O.createState)},createDocument(t){return s.createDocument(O.createExtendedState(t),O.createState)},saveToFile(t,e,o){return s.saveToFile(t,e,"phdm",o)},saveToFileHandle(t,e){return s.saveToFileHandle(t,e)},loadFromFile(t){return s.loadFromFile(t,m)},loadFromInput(t){return s.loadFromInput(t,m)}},ze=t=>s.createAction("SET_MODEL_NAME",{...t}),Ae=t=>s.createAction("SET_MODEL_ID",{...t}),Ie=t=>s.createAction("SET_MODEL_EXTENSION",{...t}),Te=t=>s.createAction("SET_MODEL_DESCRIPTION",{...t}),Re=t=>s.createAction("SET_AUTHOR_NAME",{...t}),De=t=>s.createAction("SET_AUTHOR_WEBSITE",{...t});class Rt extends s.BaseDocument{setModelName(e){return this.dispatch(ze(e))}setModelId(e){return this.dispatch(Ae(e))}setModelExtension(e){return this.dispatch(Ie(e))}setModelDescription(e){return this.dispatch(Te(e))}setAuthorName(e){return this.dispatch(Re(e))}setAuthorWebsite(e){return this.dispatch(De(e))}}const Me=t=>s.createAction("ADD_CHANGE_LOG_ITEM",{...t}),xe=t=>s.createAction("UPDATE_CHANGE_LOG_ITEM",{...t}),Ne=t=>s.createAction("DELETE_CHANGE_LOG_ITEM",{...t}),Le=t=>s.createAction("REORDER_CHANGE_LOG_ITEMS",{...t}),je=()=>s.createAction("RELEASE_NEW_VERSION");class Dt extends s.BaseDocument{addChangeLogItem(e){return this.dispatch(Me(e))}updateChangeLogItem(e){return this.dispatch(xe(e))}deleteChangeLogItem(e){return this.dispatch(Ne(e))}reorderChangeLogItems(e){return this.dispatch(Le(e))}releaseNewVersion(){return this.dispatch(je())}}const Pe=t=>s.createAction("ADD_MODULE",{...t}),Ce=t=>s.createAction("SET_MODULE_NAME",{...t}),ke=t=>s.createAction("SET_MODULE_DESCRIPTION",{...t}),ye=t=>s.createAction("DELETE_MODULE",{...t}),we=t=>s.createAction("REORDER_MODULES",{...t});class Mt extends s.BaseDocument{addModule(e){return this.dispatch(Pe(e))}setModuleName(e){return this.dispatch(Ce(e))}setModuleDescription(e){return this.dispatch(ke(e))}deleteModule(e){return this.dispatch(ye(e))}reorderModules(e){return this.dispatch(we(e))}}const ve=t=>s.createAction("ADD_OPERATION_ERROR",{...t}),Ue=t=>s.createAction("SET_OPERATION_ERROR_CODE",{...t}),Ve=t=>s.createAction("SET_OPERATION_ERROR_NAME",{...t}),Fe=t=>s.createAction("SET_OPERATION_ERROR_DESCRIPTION",{...t}),He=t=>s.createAction("SET_OPERATION_ERROR_TEMPLATE",{...t}),$e=t=>s.createAction("DELETE_OPERATION_ERROR",{...t}),Xe=t=>s.createAction("REORDER_OPERATION_ERRORS",{...t});class xt extends s.BaseDocument{addOperationError(e){return this.dispatch(ve(e))}setOperationErrorCode(e){return this.dispatch(Ue(e))}setOperationErrorName(e){return this.dispatch(Ve(e))}setOperationErrorDescription(e){return this.dispatch(Fe(e))}setOperationErrorTemplate(e){return this.dispatch(He(e))}deleteOperationError(e){return this.dispatch($e(e))}reorderOperationErrors(e){return this.dispatch(Xe(e))}}const Ge=t=>s.createAction("ADD_OPERATION_EXAMPLE",{...t}),Be=t=>s.createAction("UPDATE_OPERATION_EXAMPLE",{...t}),We=t=>s.createAction("DELETE_OPERATION_EXAMPLE",{...t}),qe=t=>s.createAction("REORDER_OPERATION_EXAMPLES",{...t});class Nt extends s.BaseDocument{addOperationExample(e){return this.dispatch(Ge(e))}updateOperationExample(e){return this.dispatch(Be(e))}deleteOperationExample(e){return this.dispatch(We(e))}reorderOperationExamples(e){return this.dispatch(qe(e))}}const Je=t=>s.createAction("ADD_OPERATION",{...t}),Ke=t=>s.createAction("SET_OPERATION_NAME",{...t}),Qe=t=>s.createAction("SET_OPERATION_SCOPE",{...t}),Ye=t=>s.createAction("SET_OPERATION_SCHEMA",{...t}),Ze=t=>s.createAction("SET_OPERATION_DESCRIPTION",{...t}),et=t=>s.createAction("SET_OPERATION_TEMPLATE",{...t}),tt=t=>s.createAction("SET_OPERATION_REDUCER",{...t}),rt=t=>s.createAction("MOVE_OPERATION",{...t}),ot=t=>s.createAction("DELETE_OPERATION",{...t}),nt=t=>s.createAction("REORDER_MODULE_OPERATIONS",{...t});class Lt extends s.BaseDocument{addOperation(e){return this.dispatch(Je(e))}setOperationName(e){return this.dispatch(Ke(e))}setOperationScope(e){return this.dispatch(Qe(e))}setOperationSchema(e){return this.dispatch(Ye(e))}setOperationDescription(e){return this.dispatch(Ze(e))}setOperationTemplate(e){return this.dispatch(et(e))}setOperationReducer(e){return this.dispatch(tt(e))}moveOperation(e){return this.dispatch(rt(e))}deleteOperation(e){return this.dispatch(ot(e))}reorderModuleOperations(e){return this.dispatch(nt(e))}}const it=t=>s.createAction("SET_STATE_SCHEMA",{...t}),st=t=>s.createAction("SET_INITIAL_STATE",{...t}),at=t=>s.createAction("ADD_STATE_EXAMPLE",{...t}),pt=t=>s.createAction("UPDATE_STATE_EXAMPLE",{...t}),lt=t=>s.createAction("DELETE_STATE_EXAMPLE",{...t}),ct=t=>s.createAction("REORDER_STATE_EXAMPLES",{...t});class jt extends s.BaseDocument{setStateSchema(e){return this.dispatch(it(e))}setInitialState(e){return this.dispatch(st(e))}addStateExample(e){return this.dispatch(at(e))}updateStateExample(e){return this.dispatch(pt(e))}deleteStateExample(e){return this.dispatch(lt(e))}reorderStateExamples(e){return this.dispatch(ct(e))}}var u;let S=(u=class extends s.BaseDocument{constructor(e,o){super(m,O.createDocument(e),o)}saveToFile(e,o){return super.saveToFile(e,u.fileExtension,o)}loadFromFile(e){return super.loadFromFile(e)}static async fromFile(e){const o=new this;return await o.loadFromFile(e),o}},ue(u,"fileExtension","phdm"),u);s.applyMixins(S,[Rt,Dt,Mt,xt,Nt,Lt,jt]);const Pt=Object.freeze(Object.defineProperty({__proto__:null,addChangeLogItem:Me,addModule:Pe,addOperation:Je,addOperationError:ve,addOperationExample:Ge,addStateExample:at,deleteChangeLogItem:Ne,deleteModule:ye,deleteOperation:ot,deleteOperationError:$e,deleteOperationExample:We,deleteStateExample:lt,moveOperation:rt,releaseNewVersion:je,reorderChangeLogItems:Le,reorderModuleOperations:nt,reorderModules:we,reorderOperationErrors:Xe,reorderOperationExamples:qe,reorderStateExamples:ct,setAuthorName:Re,setAuthorWebsite:De,setInitialState:st,setModelDescription:Te,setModelExtension:Ie,setModelId:Ae,setModelName:ze,setModuleDescription:ke,setModuleName:Ce,setOperationDescription:Ze,setOperationErrorCode:Ue,setOperationErrorDescription:Fe,setOperationErrorName:Ve,setOperationErrorTemplate:He,setOperationName:Ke,setOperationReducer:tt,setOperationSchema:Ye,setOperationScope:Qe,setOperationTemplate:et,setStateSchema:it,updateChangeLogItem:xe,updateOperationExample:Be,updateStateExample:pt},Symbol.toStringTag,{value:"Module"})),le=S,ce={...O,...Et},de={...s.BaseActions,...Pt},dt={Document:le,reducer:m,actions:de,utils:ce,documentModel:f},Ct=Object.freeze(Object.defineProperty({__proto__:null,Document:le,DocumentModel:S,actions:de,documentModel:f,module:dt,reducer:m,utils:ce,z:_e},Symbol.toStringTag,{value:"Module"}));exports.Document=le;exports.DocumentModel=Ct;exports.DocumentModel$1=S;exports.actions=de;exports.documentModel=f;exports.module=dt;exports.reducer=m;exports.utils=ce;exports.zod=_e;
|