document-model 1.0.16 → 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/schema/zod.d.ts +24 -0
- package/dist/browser/document/types.d.ts +8 -7
- package/dist/browser/document/utils/base.d.ts +4 -4
- 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 +12 -5
- package/dist/browser/document-model/gen/schema/zod.d.ts +20 -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 +2 -2
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +3 -3
- package/dist/browser/internal/{index-37753e74.js → index-10a12861.js} +520 -441
- package/dist/{node/internal/index-0e7af6c6.js → browser/internal/index-2aee8ea9.js} +1 -1
- package/dist/{node/internal/index-124bda95.js → browser/internal/index-a1282d5c.js} +1 -1
- package/dist/browser/internal/index-ec8cd58f.js +22 -0
- package/dist/browser/internal/object-24df9d92.js +6 -0
- package/dist/browser/internal/{object-17aee7a9.js → object-7e8eaff4.js} +377 -365
- package/dist/node/document/schema/zod.d.ts +24 -0
- package/dist/node/document/types.d.ts +8 -7
- package/dist/node/document/utils/base.d.ts +4 -4
- 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 +12 -5
- package/dist/node/document-model/gen/schema/zod.d.ts +20 -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 +2 -2
- package/dist/node/document.cjs +1 -1
- package/dist/node/document.js +2 -2
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/internal/{index-9037f83a.js → index-09364517.js} +520 -441
- package/dist/node/internal/index-284511b8.js +22 -0
- package/dist/{browser/internal/index-f5587600.js → node/internal/index-2d4783d9.js} +1 -1
- package/dist/{browser/internal/index-9b4d67fc.js → node/internal/index-5ef0c6b0.js} +1 -1
- package/dist/node/internal/object-21f3d2ee.js +1 -0
- package/dist/node/internal/{object-f7cd4777.js → object-c32ea0a0.js} +154 -142
- package/package.json +1 -1
- package/dist/browser/internal/index-a5150e7e.js +0 -22
- package/dist/browser/internal/object-28a1a8bf.js +0 -6
- package/dist/node/internal/index-417115f1.js +0 -22
- package/dist/node/internal/object-f3dd289e.js +0 -1
|
@@ -80,8 +80,32 @@ export declare function LoadStateActionStateInputSchema(): z.ZodObject<Propertie
|
|
|
80
80
|
export declare function OperationSchema(): z.ZodObject<Properties<Operation>>;
|
|
81
81
|
export declare function PruneActionSchema(): z.ZodObject<Properties<PruneAction>>;
|
|
82
82
|
export declare function PruneActionInputSchema(): z.ZodObject<Properties<PruneActionInput>>;
|
|
83
|
+
export declare const RedoActionInputSchema: (params?: ({
|
|
84
|
+
errorMap?: z.ZodErrorMap | undefined;
|
|
85
|
+
invalid_type_error?: string | undefined;
|
|
86
|
+
required_error?: string | undefined;
|
|
87
|
+
description?: string | undefined;
|
|
88
|
+
} & {
|
|
89
|
+
coerce?: boolean | undefined;
|
|
90
|
+
}) | undefined) => z.ZodNumber;
|
|
83
91
|
export declare function RedoActionSchema(): z.ZodObject<Properties<RedoAction>>;
|
|
92
|
+
export declare const SetNameActionInputSchema: (params?: ({
|
|
93
|
+
errorMap?: z.ZodErrorMap | undefined;
|
|
94
|
+
invalid_type_error?: string | undefined;
|
|
95
|
+
required_error?: string | undefined;
|
|
96
|
+
description?: string | undefined;
|
|
97
|
+
} & {
|
|
98
|
+
coerce?: true | undefined;
|
|
99
|
+
}) | undefined) => z.ZodString;
|
|
84
100
|
export declare function SetNameActionSchema(): z.ZodObject<Properties<SetNameAction>>;
|
|
85
101
|
export declare function SetNameOperationSchema(): z.ZodObject<Properties<SetNameOperation>>;
|
|
102
|
+
export declare const UndoActionInputSchema: (params?: ({
|
|
103
|
+
errorMap?: z.ZodErrorMap | undefined;
|
|
104
|
+
invalid_type_error?: string | undefined;
|
|
105
|
+
required_error?: string | undefined;
|
|
106
|
+
description?: string | undefined;
|
|
107
|
+
} & {
|
|
108
|
+
coerce?: boolean | undefined;
|
|
109
|
+
}) | undefined) => z.ZodNumber;
|
|
86
110
|
export declare function UndoActionSchema(): z.ZodObject<Properties<UndoAction>>;
|
|
87
111
|
export {};
|
|
@@ -14,17 +14,17 @@ export type { Immutable } from 'immer';
|
|
|
14
14
|
*
|
|
15
15
|
* @typeParam T - The name of the action type. A `string` type by default.
|
|
16
16
|
*/
|
|
17
|
-
export type Action<T extends string = string, I = unknown> = {
|
|
17
|
+
export type Action<T extends string = string, I = unknown, S extends OperationScope = OperationScope> = {
|
|
18
18
|
/** The name of the action. */
|
|
19
19
|
type: T;
|
|
20
20
|
/** The payload of the action. */
|
|
21
21
|
input: I;
|
|
22
|
+
/** The scope of the action, can either be 'global' or 'local' */
|
|
23
|
+
scope: S;
|
|
22
24
|
/** The attachments included in the action. */
|
|
23
25
|
attachments?: AttachmentInput[] | undefined;
|
|
24
|
-
/** The scope of the action, can either be 'global' or 'local'. Defaults to 'global' */
|
|
25
|
-
scope?: OperationScope;
|
|
26
26
|
};
|
|
27
|
-
export type ActionWithAttachment<T extends string = string, I = unknown> = Action<T, I> & {
|
|
27
|
+
export type ActionWithAttachment<T extends string = string, I = unknown, S extends OperationScope = OperationScope> = Action<T, I, S> & {
|
|
28
28
|
attachments: AttachmentInput[];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -115,7 +115,8 @@ export type State<GlobalState, LocalState> = {
|
|
|
115
115
|
global: GlobalState;
|
|
116
116
|
local: LocalState;
|
|
117
117
|
};
|
|
118
|
-
export type
|
|
118
|
+
export type PartialState<S> = S | Partial<S>;
|
|
119
|
+
export type CreateState<S, L> = (state?: Partial<State<PartialState<S>, PartialState<L>>>) => State<S, L>;
|
|
119
120
|
export type ExtendedState<GlobalState, LocalState = unknown> = DocumentHeader & {
|
|
120
121
|
/** The document model specific state. */
|
|
121
122
|
state: State<GlobalState, LocalState>;
|
|
@@ -158,8 +159,8 @@ export interface DocumentClass<S, A extends Action = Action, L = unknown, C exte
|
|
|
158
159
|
export type DocumentModelUtils<S = unknown, A extends Action = Action, L = unknown> = {
|
|
159
160
|
fileExtension: string;
|
|
160
161
|
createState: CreateState<S, L>;
|
|
161
|
-
createExtendedState: (extendedState?: Partial<ExtendedState<
|
|
162
|
-
createDocument: (document?: Partial<ExtendedState<
|
|
162
|
+
createExtendedState: (extendedState?: Partial<ExtendedState<PartialState<S>, PartialState<L>>>, createState?: CreateState<S, L>) => ExtendedState<S, L>;
|
|
163
|
+
createDocument: (document?: Partial<ExtendedState<PartialState<S>, PartialState<L>>>, createState?: CreateState<S, L>) => Document<S, A, L>;
|
|
163
164
|
loadFromFile: (path: string) => Promise<Document<S, A, L>>;
|
|
164
165
|
loadFromInput: (input: FileInput) => Promise<Document<S, A, L>>;
|
|
165
166
|
saveToFile: (document: Document<S, A, L>, path: string, name?: string) => Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { baseReducer } from '../reducer';
|
|
2
|
-
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState } from '../types';
|
|
2
|
+
import { Action, BaseAction, Document, ExtendedState, ImmutableStateReducer, Reducer, Immutable, OperationScope, State, CreateState, PartialState } from '../types';
|
|
3
3
|
export declare function isBaseAction(action: Action): action is BaseAction;
|
|
4
4
|
/**
|
|
5
5
|
* Helper function to be used by action creators.
|
|
@@ -18,7 +18,7 @@ export declare function isBaseAction(action: Action): action is BaseAction;
|
|
|
18
18
|
* @returns The new action.
|
|
19
19
|
*/
|
|
20
20
|
export declare function createAction<A extends Action>(type: A['type'], input?: A['input'], attachments?: Action['attachments'], validator?: () => {
|
|
21
|
-
parse(v: unknown): A;
|
|
21
|
+
parse(v: unknown): A['input'];
|
|
22
22
|
}, scope?: OperationScope): A;
|
|
23
23
|
/**
|
|
24
24
|
* Helper function to create a document model reducer.
|
|
@@ -39,7 +39,7 @@ export declare function createAction<A extends Action>(type: A['type'], input?:
|
|
|
39
39
|
* @returns The new reducer.
|
|
40
40
|
*/
|
|
41
41
|
export declare function createReducer<S = unknown, A extends Action = Action, L = unknown>(reducer: ImmutableStateReducer<S, A, L>, documentReducer?: typeof baseReducer): Reducer<S, A, L>;
|
|
42
|
-
export declare const createExtendedState: <S, L>(initialState?: Partial<ExtendedState<
|
|
42
|
+
export declare const createExtendedState: <S, L>(initialState?: Partial<ExtendedState<PartialState<S>, PartialState<L>>> | undefined, createState?: CreateState<S, L> | undefined) => ExtendedState<S, L>;
|
|
43
43
|
/**
|
|
44
44
|
* Builds the initial document state from the provided data.
|
|
45
45
|
*
|
|
@@ -51,7 +51,7 @@ export declare const createExtendedState: <S, L>(initialState?: Partial<Extended
|
|
|
51
51
|
*
|
|
52
52
|
* @returns The new document state.
|
|
53
53
|
*/
|
|
54
|
-
export declare const createDocument: <S, A extends Action, L = unknown>(initialState?: Partial<ExtendedState<
|
|
54
|
+
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
55
|
export declare const hashDocument: (document: Document, scope?: OperationScope) => string;
|
|
56
56
|
export declare const hashKey: (date?: Date, randomLimit?: number) => string;
|
|
57
57
|
export declare function readOnly<T>(value: T): Immutable<T>;
|
|
@@ -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>;
|
|
@@ -78,6 +78,7 @@ export type AddOperationInput = {
|
|
|
78
78
|
scope?: InputMaybe<OperationScope>;
|
|
79
79
|
};
|
|
80
80
|
export type AddStateExampleInput = {
|
|
81
|
+
scope: Scalars['String']['input'];
|
|
81
82
|
example: Scalars['String']['input'];
|
|
82
83
|
id: Scalars['ID']['input'];
|
|
83
84
|
insertBefore?: InputMaybe<Scalars['ID']['input']>;
|
|
@@ -109,6 +110,7 @@ export type DeleteOperationInput = {
|
|
|
109
110
|
id: Scalars['ID']['input'];
|
|
110
111
|
};
|
|
111
112
|
export type DeleteStateExampleInput = {
|
|
113
|
+
scope: Scalars['String']['input'];
|
|
112
114
|
id: Scalars['ID']['input'];
|
|
113
115
|
};
|
|
114
116
|
export type DocumentModelInput = AddChangeLogItemInput | AddModuleInput | AddOperationErrorInput | AddOperationExampleInput | AddOperationInput | AddStateExampleInput | DeleteChangeLogItemInput | DeleteModuleInput | DeleteOperationErrorInput | DeleteOperationExampleInput | DeleteOperationInput | DeleteStateExampleInput | MoveOperationInput | ReorderChangeLogItemsInput | ReorderModuleOperationsInput | ReorderModulesInput | ReorderOperationErrorsInput | ReorderOperationExamplesInput | ReorderStateExamplesInput | SetAuthorNameInput | SetAuthorWebsiteInput | SetInitialStateInput | SetModelDescriptionInput | SetModelExtensionInput | SetModelIdInput | SetModelNameInput | SetModuleDescriptionInput | SetModuleNameInput | SetOperationDescriptionInput | SetOperationErrorCodeInput | SetOperationErrorDescriptionInput | SetOperationErrorNameInput | SetOperationErrorTemplateInput | SetOperationNameInput | SetOperationReducerInput | SetOperationSchemaInput | SetOperationTemplateInput | SetStateSchemaInput | UpdateChangeLogItemInput | UpdateOperationExampleInput | UpdateStateExampleInput;
|
|
@@ -121,15 +123,16 @@ export type DocumentModelState = {
|
|
|
121
123
|
name: Scalars['String']['output'];
|
|
122
124
|
specifications: Array<DocumentSpecification>;
|
|
123
125
|
};
|
|
124
|
-
export type
|
|
126
|
+
export type ScopeState = {
|
|
127
|
+
global: State;
|
|
128
|
+
local: State;
|
|
129
|
+
};
|
|
130
|
+
export type DocumentModelLocalState = {};
|
|
125
131
|
export type DocumentSpecification = {
|
|
126
132
|
__typename?: 'DocumentSpecification';
|
|
127
133
|
changeLog: Array<Scalars['String']['output']>;
|
|
128
134
|
modules: Array<Module>;
|
|
129
|
-
state:
|
|
130
|
-
global: State;
|
|
131
|
-
local: State;
|
|
132
|
-
};
|
|
135
|
+
state: ScopeState;
|
|
133
136
|
version: Scalars['Int']['output'];
|
|
134
137
|
};
|
|
135
138
|
export type Module = {
|
|
@@ -351,6 +354,7 @@ export type ReorderOperationExamplesInput = {
|
|
|
351
354
|
order: Array<Scalars['ID']['input']>;
|
|
352
355
|
};
|
|
353
356
|
export type ReorderStateExamplesInput = {
|
|
357
|
+
scope: Scalars['String']['input'];
|
|
354
358
|
order: Array<Scalars['ID']['input']>;
|
|
355
359
|
};
|
|
356
360
|
export type SetAuthorNameInput = {
|
|
@@ -360,6 +364,7 @@ export type SetAuthorWebsiteInput = {
|
|
|
360
364
|
authorWebsite: Scalars['String']['input'];
|
|
361
365
|
};
|
|
362
366
|
export type SetInitialStateInput = {
|
|
367
|
+
scope: Scalars['String']['input'];
|
|
363
368
|
initialValue: Scalars['String']['input'];
|
|
364
369
|
};
|
|
365
370
|
export type SetModelDescriptionInput = {
|
|
@@ -423,6 +428,7 @@ export type SetOperationTemplateInput = {
|
|
|
423
428
|
template?: InputMaybe<Scalars['String']['input']>;
|
|
424
429
|
};
|
|
425
430
|
export type SetStateSchemaInput = {
|
|
431
|
+
scope: Scalars['String']['input'];
|
|
426
432
|
schema: Scalars['String']['input'];
|
|
427
433
|
};
|
|
428
434
|
export type State = {
|
|
@@ -441,6 +447,7 @@ export type UpdateOperationExampleInput = {
|
|
|
441
447
|
id: Scalars['ID']['input'];
|
|
442
448
|
};
|
|
443
449
|
export type UpdateStateExampleInput = {
|
|
450
|
+
scope: Scalars['String']['input'];
|
|
444
451
|
id: Scalars['ID']['input'];
|
|
445
452
|
newExample: Scalars['String']['input'];
|
|
446
453
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { AddChangeLogItemInput, AddModuleInput, AddOperationErrorInput, AddOperationExampleInput, AddOperationInput, AddStateExampleInput, Author, CodeExample, DeleteChangeLogItemInput, DeleteModuleInput, DeleteOperationErrorInput, DeleteOperationExampleInput, DeleteOperationInput, DeleteStateExampleInput, DocumentModelState, DocumentSpecification, Module, MoveOperationInput, Operation, OperationError, ReorderChangeLogItemsInput, ReorderModuleOperationsInput, ReorderModulesInput, ReorderOperationErrorsInput, ReorderOperationExamplesInput, ReorderStateExamplesInput, SetAuthorNameInput, SetAuthorWebsiteInput, SetInitialStateInput, SetModelDescriptionInput, SetModelExtensionInput, SetModelIdInput, SetModelNameInput, SetModuleDescriptionInput, SetModuleNameInput, SetOperationDescriptionInput, SetOperationErrorCodeInput, SetOperationErrorDescriptionInput, SetOperationErrorNameInput, SetOperationErrorTemplateInput, SetOperationNameInput, SetOperationReducerInput, SetOperationSchemaInput, SetOperationScopeInput, SetOperationTemplateInput, SetStateSchemaInput, State, UpdateChangeLogItemInput, UpdateOperationExampleInput, UpdateStateExampleInput } from '.';
|
|
2
|
+
import { AddChangeLogItemInput, AddModuleInput, AddOperationErrorInput, AddOperationExampleInput, AddOperationInput, AddStateExampleInput, Author, CodeExample, DeleteChangeLogItemInput, DeleteModuleInput, DeleteOperationErrorInput, DeleteOperationExampleInput, DeleteOperationInput, DeleteStateExampleInput, DocumentModelState, DocumentSpecification, Module, MoveOperationInput, Operation, OperationError, ReorderChangeLogItemsInput, ReorderModuleOperationsInput, ReorderModulesInput, ReorderOperationErrorsInput, ReorderOperationExamplesInput, ReorderStateExamplesInput, ScopeState, SetAuthorNameInput, SetAuthorWebsiteInput, SetInitialStateInput, SetModelDescriptionInput, SetModelExtensionInput, SetModelIdInput, SetModelNameInput, SetModuleDescriptionInput, SetModuleNameInput, SetOperationDescriptionInput, SetOperationErrorCodeInput, SetOperationErrorDescriptionInput, SetOperationErrorNameInput, SetOperationErrorTemplateInput, SetOperationNameInput, SetOperationReducerInput, SetOperationSchemaInput, SetOperationScopeInput, SetOperationTemplateInput, SetStateSchemaInput, State, UpdateChangeLogItemInput, UpdateOperationExampleInput, UpdateStateExampleInput } from '.';
|
|
3
3
|
type Properties<T> = Required<{
|
|
4
4
|
[K in keyof T]: z.ZodType<T[K], any, T[K]>;
|
|
5
5
|
}>;
|
|
@@ -108,16 +108,19 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
108
108
|
template?: import("./types").InputMaybe<string>;
|
|
109
109
|
scope?: import("./types").InputMaybe<import("../../../document").OperationScope>;
|
|
110
110
|
}>, z.ZodObject<Required<{
|
|
111
|
+
scope: z.ZodType<string, any, string>;
|
|
111
112
|
example: z.ZodType<string, any, string>;
|
|
112
113
|
id: z.ZodType<string, any, string>;
|
|
113
114
|
insertBefore?: z.ZodType<import("./types").InputMaybe<string>, any, import("./types").InputMaybe<string>> | undefined;
|
|
114
115
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
115
116
|
id: string;
|
|
116
117
|
example: string;
|
|
118
|
+
scope: string;
|
|
117
119
|
insertBefore?: import("./types").InputMaybe<string>;
|
|
118
120
|
}, {
|
|
119
121
|
id: string;
|
|
120
122
|
example: string;
|
|
123
|
+
scope: string;
|
|
121
124
|
insertBefore?: import("./types").InputMaybe<string>;
|
|
122
125
|
}>, z.ZodObject<Required<{
|
|
123
126
|
__typename?: z.ZodType<"DeleteChangeLogItemInput" | undefined, any, "DeleteChangeLogItemInput" | undefined> | undefined;
|
|
@@ -153,11 +156,14 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
153
156
|
}, {
|
|
154
157
|
id: string;
|
|
155
158
|
}>, z.ZodObject<Required<{
|
|
159
|
+
scope: z.ZodType<string, any, string>;
|
|
156
160
|
id: z.ZodType<string, any, string>;
|
|
157
161
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
158
162
|
id: string;
|
|
163
|
+
scope: string;
|
|
159
164
|
}, {
|
|
160
165
|
id: string;
|
|
166
|
+
scope: string;
|
|
161
167
|
}>, z.ZodObject<Required<{
|
|
162
168
|
newModuleId: z.ZodType<string, any, string>;
|
|
163
169
|
operationId: z.ZodType<string, any, string>;
|
|
@@ -210,10 +216,13 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
210
216
|
operationId: string;
|
|
211
217
|
order: string[];
|
|
212
218
|
}>, z.ZodObject<Required<{
|
|
219
|
+
scope: z.ZodType<string, any, string>;
|
|
213
220
|
order: z.ZodType<string[], any, string[]>;
|
|
214
221
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
222
|
+
scope: string;
|
|
215
223
|
order: string[];
|
|
216
224
|
}, {
|
|
225
|
+
scope: string;
|
|
217
226
|
order: string[];
|
|
218
227
|
}>, z.ZodObject<Required<{
|
|
219
228
|
authorName: z.ZodType<string, any, string>;
|
|
@@ -228,10 +237,13 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
228
237
|
}, {
|
|
229
238
|
authorWebsite: string;
|
|
230
239
|
}>, z.ZodObject<Required<{
|
|
240
|
+
scope: z.ZodType<string, any, string>;
|
|
231
241
|
initialValue: z.ZodType<string, any, string>;
|
|
232
242
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
243
|
+
scope: string;
|
|
233
244
|
initialValue: string;
|
|
234
245
|
}, {
|
|
246
|
+
scope: string;
|
|
235
247
|
initialValue: string;
|
|
236
248
|
}>, z.ZodObject<Required<{
|
|
237
249
|
description: z.ZodType<string, any, string>;
|
|
@@ -357,11 +369,14 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
357
369
|
id: string;
|
|
358
370
|
template?: import("./types").InputMaybe<string>;
|
|
359
371
|
}>, z.ZodObject<Required<{
|
|
372
|
+
scope: z.ZodType<string, any, string>;
|
|
360
373
|
schema: z.ZodType<string, any, string>;
|
|
361
374
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
362
375
|
schema: string;
|
|
376
|
+
scope: string;
|
|
363
377
|
}, {
|
|
364
378
|
schema: string;
|
|
379
|
+
scope: string;
|
|
365
380
|
}>, z.ZodObject<Required<{
|
|
366
381
|
__typename?: z.ZodType<"UpdateChangeLogItemInput" | undefined, any, "UpdateChangeLogItemInput" | undefined> | undefined;
|
|
367
382
|
id: z.ZodType<string, any, string>;
|
|
@@ -384,13 +399,16 @@ export declare function DocumentModelInputSchema(): z.ZodUnion<[z.ZodObject<Requ
|
|
|
384
399
|
id: string;
|
|
385
400
|
example: string;
|
|
386
401
|
}>, z.ZodObject<Required<{
|
|
402
|
+
scope: z.ZodType<string, any, string>;
|
|
387
403
|
id: z.ZodType<string, any, string>;
|
|
388
404
|
newExample: z.ZodType<string, any, string>;
|
|
389
405
|
}>, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
390
406
|
id: string;
|
|
407
|
+
scope: string;
|
|
391
408
|
newExample: string;
|
|
392
409
|
}, {
|
|
393
410
|
id: string;
|
|
411
|
+
scope: string;
|
|
394
412
|
newExample: string;
|
|
395
413
|
}>]>;
|
|
396
414
|
export declare function DocumentModelStateSchema(): z.ZodObject<Properties<DocumentModelState>>;
|
|
@@ -426,6 +444,7 @@ export declare function SetOperationSchemaInputSchema(): z.ZodObject<Properties<
|
|
|
426
444
|
export declare function SetOperationTemplateInputSchema(): z.ZodObject<Properties<SetOperationTemplateInput>>;
|
|
427
445
|
export declare function SetStateSchemaInputSchema(): z.ZodObject<Properties<SetStateSchemaInput>>;
|
|
428
446
|
export declare function StateSchema(): z.ZodObject<Properties<State>>;
|
|
447
|
+
export declare function ScopeStateSchema(): z.ZodObject<Properties<ScopeState>>;
|
|
429
448
|
export declare function UpdateChangeLogItemInputSchema(): z.ZodObject<Properties<UpdateChangeLogItemInput>>;
|
|
430
449
|
export declare function UpdateOperationExampleInputSchema(): z.ZodObject<Properties<UpdateOperationExampleInput>>;
|
|
431
450
|
export declare function UpdateStateExampleInputSchema(): z.ZodObject<Properties<UpdateStateExampleInput>>;
|
|
@@ -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<
|
|
15
|
-
createDocument: (document?: Partial<import("../document").ExtendedState<
|
|
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, DocumentModel>;
|
|
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-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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./internal/object-
|
|
1
|
+
import "./internal/object-c32ea0a0.js";
|
|
2
2
|
import "json-stringify-deterministic";
|
|
3
3
|
import "immer";
|
|
4
4
|
import "crypto";
|
|
@@ -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/document.cjs
CHANGED
|
@@ -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-21f3d2ee.js"),r=require("./internal/index-2d4783d9.js");require("json-stringify-deterministic");require("immer");require("jszip");require("crypto");require("fs");require("https");require("path");require("zod");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/node/document.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as n, h as u, g as x, p as f, z as l } from "./internal/object-
|
|
2
|
-
import { i as b } from "./internal/index-
|
|
1
|
+
import { B as n, h as u, g as x, p as f, z as l } from "./internal/object-c32ea0a0.js";
|
|
2
|
+
import { i as b } from "./internal/index-5ef0c6b0.js";
|
|
3
3
|
import "json-stringify-deterministic";
|
|
4
4
|
import "immer";
|
|
5
5
|
import "jszip";
|
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-
|
|
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
|
@@ -1,6 +1,6 @@
|
|
|
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-5ef0c6b0.js";
|
|
2
|
+
import { D as t } from "./internal/index-09364517.js";
|
|
3
|
+
import "./internal/object-c32ea0a0.js";
|
|
4
4
|
import "json-stringify-deterministic";
|
|
5
5
|
import "immer";
|
|
6
6
|
import "jszip";
|