document-model 1.0.17 → 1.0.19
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/utils/base.d.ts +6 -2
- 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 +2 -2
- package/dist/browser/document.cjs +1 -1
- package/dist/browser/document.js +6 -6
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +4 -4
- package/dist/browser/internal/{index-01030c3f.js → index-1ad32a2e.js} +2 -2
- package/dist/browser/internal/index-2551382e.js +34 -0
- package/dist/{node/internal/index-0db636da.js → browser/internal/index-46b68530.js} +22 -25
- package/dist/browser/internal/index-869c5d0d.js +1 -0
- package/dist/browser/internal/object-1fdba77d.js +6 -0
- package/dist/browser/internal/{object-7e8eaff4.js → object-d50f7d2f.js} +744 -715
- package/dist/node/document/utils/base.d.ts +6 -2
- 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 +3 -3
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +5 -5
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +4 -4
- package/dist/node/internal/{index-cddc9dfd.js → index-631ba7bf.js} +2 -2
- package/dist/node/internal/index-6477ee0a.js +1 -0
- package/dist/{browser/internal/index-5f1909ad.js → node/internal/index-8d582c48.js} +26 -21
- package/dist/node/internal/index-f235f9be.js +34 -0
- package/dist/node/internal/object-08bd169a.js +1 -0
- package/dist/node/internal/{object-c32ea0a0.js → object-773231ca.js} +473 -444
- package/package.json +1 -1
- package/dist/browser/internal/index-2aee8ea9.js +0 -1
- package/dist/browser/internal/index-a1282d5c.js +0 -31
- package/dist/browser/internal/object-24df9d92.js +0 -6
- package/dist/node/internal/index-2d4783d9.js +0 -1
- package/dist/node/internal/index-5ef0c6b0.js +0 -31
- package/dist/node/internal/object-21f3d2ee.js +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { baseReducer } from '../reducer';
|
|
2
|
-
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState } from '../types';
|
|
2
|
+
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState, DocumentOperations, DocumentHeader } from '../types';
|
|
3
|
+
import { SignalDispatch } from '../signal';
|
|
3
4
|
export declare function isBaseAction(action: Action): action is BaseAction;
|
|
4
5
|
/**
|
|
5
6
|
* Helper function to be used by action creators.
|
|
@@ -52,6 +53,9 @@ export declare const createExtendedState: <S, L>(initialState?: Partial<Extended
|
|
|
52
53
|
* @returns The new document state.
|
|
53
54
|
*/
|
|
54
55
|
export declare const createDocument: <S, A extends Action, L = unknown>(initialState?: Partial<ExtendedState<PartialState<S>, PartialState<L>>> | undefined, createState?: ((state?: Partial<State<PartialState<S>, PartialState<L>>> | undefined) => State<S, L>) | undefined) => Document<S, A, L>;
|
|
55
|
-
export declare const hashDocument: (document: Document, scope?: OperationScope) => string;
|
|
56
|
+
export declare const hashDocument: (document: Pick<Document, 'state'>, scope?: OperationScope) => string;
|
|
56
57
|
export declare const hashKey: (date?: Date, randomLimit?: number) => string;
|
|
57
58
|
export declare function readOnly<T>(value: T): Immutable<T>;
|
|
59
|
+
export declare function sortOperations<A extends Action>(operations: DocumentOperations<A>): import("../types").Operation<BaseAction | A>[];
|
|
60
|
+
export declare function replayOperations<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: ImmutableStateReducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader, documentReducer?: typeof baseReducer): Document<T, A, L>;
|
|
61
|
+
export declare function replayDocument<T, A extends Action, L>(initialState: ExtendedState<T, L>, operations: DocumentOperations<A>, reducer: Reducer<T, A, L>, dispatch?: SignalDispatch, header?: DocumentHeader): Document<T, A, L>;
|
|
@@ -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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./internal/object-1fdba77d.js");require("json-stringify-deterministic");require("immer");require("jszip");const e=require("./internal/index-1ad32a2e.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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./internal/object-
|
|
1
|
+
import "./internal/object-d50f7d2f.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-46b68530.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
export {
|
|
8
8
|
i as Document,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./internal/object-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./internal/object-1fdba77d.js"),r=require("./internal/index-869c5d0d.js");require("json-stringify-deterministic");require("immer");require("zod");require("jszip");exports.BaseDocument=e.BaseDocument;exports.actions=e.BaseActions;exports.applyMixins=e.applyMixins;exports.baseReducer=e.baseReducer;exports.z=e.zod;exports.utils=r.index;
|
package/dist/browser/document.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { i as x } from "./internal/index-
|
|
1
|
+
import { B as p, h as e, g as m, u, z as c } from "./internal/object-d50f7d2f.js";
|
|
2
|
+
import { i as x } from "./internal/index-2551382e.js";
|
|
3
3
|
import "json-stringify-deterministic";
|
|
4
4
|
import "immer";
|
|
5
|
-
import "jszip";
|
|
6
5
|
import "zod";
|
|
6
|
+
import "jszip";
|
|
7
7
|
export {
|
|
8
|
-
|
|
8
|
+
p as BaseDocument,
|
|
9
9
|
e as actions,
|
|
10
10
|
m as applyMixins,
|
|
11
|
-
|
|
11
|
+
u as baseReducer,
|
|
12
12
|
x as utils,
|
|
13
|
-
|
|
13
|
+
c as z
|
|
14
14
|
};
|
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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./internal/index-869c5d0d.js"),o=require("./internal/index-1ad32a2e.js");require("./internal/object-1fdba77d.js");require("json-stringify-deterministic");require("immer");require("zod");require("jszip");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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { D as o } from "./internal/index-
|
|
2
|
-
import { D as t } from "./internal/index-
|
|
3
|
-
import "./internal/object-
|
|
1
|
+
import { D as o } from "./internal/index-2551382e.js";
|
|
2
|
+
import { D as t } from "./internal/index-46b68530.js";
|
|
3
|
+
import "./internal/object-d50f7d2f.js";
|
|
4
4
|
import "json-stringify-deterministic";
|
|
5
5
|
import "immer";
|
|
6
|
-
import "jszip";
|
|
7
6
|
import "zod";
|
|
7
|
+
import "jszip";
|
|
8
8
|
const u = {
|
|
9
9
|
"powerhouse/document": o,
|
|
10
10
|
"powerhouse/document-model": t
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ut=Object.defineProperty;var mt=(t,e,o)=>e in t?ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var ue=(t,e,o)=>(mt(t,typeof e!="symbol"?e+"":e,o),o);const s=require("./object-
|
|
1
|
+
"use strict";var ut=Object.defineProperty;var mt=(t,e,o)=>e in t?ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var ue=(t,e,o)=>(mt(t,typeof e!="symbol"?e+"":e,o),o);const s=require("./object-1fdba77d.js");require("json-stringify-deterministic");require("immer");require("jszip");const r=require("zod"),Et=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),f={id:"powerhouse/document-model",name:"DocumentModel",extension:"phdm",description:"The Powerhouse Document Model describes the state and operations of a document type.",author:{name:"Powerhouse",website:"https://www.powerhouse.inc/"},specifications:[{version:1,changeLog:[],modules:[{name:"header",operations:[{name:"SetModelName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelId",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelExtension",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModelDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetAuthorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetAuthorWebsite",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"versioning",operations:[{name:"AddChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteChangeLogItem",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderChangeLogItems",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReleaseNewVersion",schema:null,id:"",description:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"module",operations:[{name:"AddModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModuleName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetModuleDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteModule",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderModules",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-error",operations:[{name:"AddOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorCode",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationErrorTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperationError",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderOperationErrors",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation-example",operations:[{name:"AddOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperationExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderOperationExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"operation",operations:[{name:"AddOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationName",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationDescription",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationTemplate",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetOperationReducer",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"MoveOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteOperation",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderModuleOperations",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""},{name:"state",operations:[{name:"SetStateSchema",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"SetInitialState",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"AddStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"UpdateStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"DeleteStateExample",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"},{name:"ReorderStateExamples",id:"",description:"",schema:"",template:"",reducer:"",examples:[],errors:[],scope:"global"}],id:"",description:""}],state:{global:{schema:"",initialValue:`{
|
|
2
2
|
"id": "",
|
|
3
3
|
"name": "",
|
|
4
4
|
"extension": "",
|
|
@@ -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;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { f as e, b as a, a as s, c as t, j as o, k as r, m as n, n as l, o as c, i, l as u, e as d, r as p, p as m, q as y, s as b, d as _, t as g, B as F, h as O, g as f, u as D, z as h } from "./object-d50f7d2f.js";
|
|
2
|
+
const j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3
|
+
__proto__: null,
|
|
4
|
+
createAction: e,
|
|
5
|
+
createDocument: a,
|
|
6
|
+
createExtendedState: s,
|
|
7
|
+
createReducer: t,
|
|
8
|
+
createZip: o,
|
|
9
|
+
getLocalFile: r,
|
|
10
|
+
getRemoteFile: n,
|
|
11
|
+
hashDocument: l,
|
|
12
|
+
hashKey: c,
|
|
13
|
+
isBaseAction: i,
|
|
14
|
+
loadFromFile: u,
|
|
15
|
+
loadFromInput: d,
|
|
16
|
+
readOnly: p,
|
|
17
|
+
replayDocument: m,
|
|
18
|
+
replayOperations: y,
|
|
19
|
+
saveToFile: b,
|
|
20
|
+
saveToFileHandle: _,
|
|
21
|
+
sortOperations: g
|
|
22
|
+
}, Symbol.toStringTag, { value: "Module" })), S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23
|
+
__proto__: null,
|
|
24
|
+
BaseDocument: F,
|
|
25
|
+
actions: O,
|
|
26
|
+
applyMixins: f,
|
|
27
|
+
baseReducer: D,
|
|
28
|
+
utils: j,
|
|
29
|
+
z: h
|
|
30
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
31
|
+
export {
|
|
32
|
+
S as D,
|
|
33
|
+
j as i
|
|
34
|
+
};
|