@powerhousedao/vetra 6.0.0-dev.249 → 6.0.0-dev.250
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/app-module-Bbj7PI-S.js +94 -0
- package/dist/app-module-Bbj7PI-S.js.map +1 -0
- package/dist/connect-CTIucT0o.js +6 -0
- package/dist/connect-CTIucT0o.js.map +1 -0
- package/dist/document-editor-DS-bZMKx.js +93 -0
- package/dist/document-editor-DS-bZMKx.js.map +1 -0
- package/dist/document-models/app-module/index.d.ts +349 -2
- package/dist/document-models/app-module/index.d.ts.map +1 -0
- package/dist/document-models/app-module/index.js +3 -2
- package/dist/document-models/document-editor/index.d.ts +325 -2
- package/dist/document-models/document-editor/index.d.ts.map +1 -0
- package/dist/document-models/document-editor/index.js +3 -2
- package/dist/document-models/index.d.ts +6 -29
- package/dist/document-models/index.js +6 -2
- package/dist/document-models/processor-module/index.d.ts +357 -2
- package/dist/document-models/processor-module/index.d.ts.map +1 -0
- package/dist/document-models/processor-module/index.js +3 -2
- package/dist/document-models/subgraph-module/index.d.ts +296 -2
- package/dist/document-models/subgraph-module/index.d.ts.map +1 -0
- package/dist/document-models/subgraph-module/index.js +3 -2
- package/dist/document-models/vetra-package/index.d.ts +386 -2
- package/dist/document-models/vetra-package/index.d.ts.map +1 -0
- package/dist/document-models/vetra-package/index.js +3 -2
- package/dist/{editor-DqkJ0B4G.js → editor-BSQfwcdz.js} +5 -4
- package/dist/{editor-DqkJ0B4G.js.map → editor-BSQfwcdz.js.map} +1 -1
- package/dist/{editor-CGNcK2z0.js → editor-Bku8e2dr.js} +5 -5
- package/dist/{editor-CGNcK2z0.js.map → editor-Bku8e2dr.js.map} +1 -1
- package/dist/{editor-ddcGG42r.js → editor-CbtrPBTP.js} +5 -4
- package/dist/{editor-ddcGG42r.js.map → editor-CbtrPBTP.js.map} +1 -1
- package/dist/{editor-D4FHn5u4.js → editor-D70FYIwV.js} +2 -2
- package/dist/{editor-D4FHn5u4.js.map → editor-D70FYIwV.js.map} +1 -1
- package/dist/{editor-CdzYJozI.js → editor-Dtg8STyT.js} +5 -5
- package/dist/{editor-CdzYJozI.js.map → editor-Dtg8STyT.js.map} +1 -1
- package/dist/{editor-CgkzQJ4g.js → editor-SfVorwsP.js} +6 -6
- package/dist/{editor-CgkzQJ4g.js.map → editor-SfVorwsP.js.map} +1 -1
- package/dist/editors/hooks/index.js +1 -1
- package/dist/editors/index.d.ts +13 -12
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +2 -2
- package/dist/{codegen-PnsnCMkw.js → factory-CweZppg6.js} +51 -3
- package/dist/factory-CweZppg6.js.map +1 -0
- package/dist/factory-D8ZDOMP3.js +79 -0
- package/dist/factory-D8ZDOMP3.js.map +1 -0
- package/dist/{hooks-Vx4YtE1e.js → hooks-Xexr33XS.js} +1 -1
- package/dist/{hooks-Vx4YtE1e.js.map → hooks-Xexr33XS.js.map} +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/{processor-module-CkuQiq7B.js → module-BWlCj_0C.js} +159 -204
- package/dist/module-BWlCj_0C.js.map +1 -0
- package/dist/{subgraph-module-CU_-umq2.js → module-BoGgbKmO.js} +111 -153
- package/dist/module-BoGgbKmO.js.map +1 -0
- package/dist/module-BoX1rWiq.d.ts +6 -0
- package/dist/module-BoX1rWiq.d.ts.map +1 -0
- package/dist/module-CG6K37P8.d.ts +6 -0
- package/dist/module-CG6K37P8.d.ts.map +1 -0
- package/dist/{app-module-BbhoykB5.js → module-CTPfENDU.js} +149 -189
- package/dist/module-CTPfENDU.js.map +1 -0
- package/dist/{module-BW12i5H3.js → module-CXIFrq-R.js} +15 -11
- package/dist/module-CXIFrq-R.js.map +1 -0
- package/dist/{vetra-package-VqptqKzx.js → module-CZLiUtDI.js} +186 -236
- package/dist/module-CZLiUtDI.js.map +1 -0
- package/dist/module-Cr-9knz_.d.ts +6 -0
- package/dist/module-Cr-9knz_.d.ts.map +1 -0
- package/dist/{document-editor-CHM7Pu4m.js → module-D0SK3Nds.js} +137 -180
- package/dist/module-D0SK3Nds.js.map +1 -0
- package/dist/module-DhhQLYnQ.d.ts +6 -0
- package/dist/module-DhhQLYnQ.d.ts.map +1 -0
- package/dist/module-J-kGIl1E.d.ts +6 -0
- package/dist/module-J-kGIl1E.d.ts.map +1 -0
- package/dist/powerhouse.manifest.d.ts +8 -5
- package/dist/powerhouse.manifest.d.ts.map +1 -1
- package/dist/powerhouse.manifest.js +19 -12
- package/dist/processor-module-D0lRrrpW.js +95 -0
- package/dist/processor-module-D0lRrrpW.js.map +1 -0
- package/dist/processors/codegen/index.d.ts +21322 -2
- package/dist/processors/codegen/index.d.ts.map +1 -0
- package/dist/processors/codegen/index.js +2 -2
- package/dist/processors/index.d.ts +4 -15
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +8 -81
- package/dist/processors/index.js.map +1 -1
- package/dist/processors/vetra-read-model/index.d.ts +18599 -2
- package/dist/processors/vetra-read-model/index.d.ts.map +1 -0
- package/dist/processors/vetra-read-model/index.js +2 -54
- package/dist/subgraph-module-B3ipwOza.js +92 -0
- package/dist/subgraph-module-B3ipwOza.js.map +1 -0
- package/dist/switchboard-JOTFVXuj.js +8 -0
- package/dist/switchboard-JOTFVXuj.js.map +1 -0
- package/dist/{useVetraDocument-DF0teXXM.js → useVetraDocument-DoAwvHVi.js} +1 -1
- package/dist/{useVetraDocument-DF0teXXM.js.map → useVetraDocument-DoAwvHVi.js.map} +1 -1
- package/dist/vetra-package-YNLxEA-U.js +100 -0
- package/dist/vetra-package-YNLxEA-U.js.map +1 -0
- package/package.json +9 -8
- package/dist/app-module-BbhoykB5.js.map +0 -1
- package/dist/codegen-PnsnCMkw.js.map +0 -1
- package/dist/document-editor-CHM7Pu4m.js.map +0 -1
- package/dist/document-models/index.d.ts.map +0 -1
- package/dist/editor-Bsu4yikl.js +0 -2
- package/dist/index-CHfOF-Et.d.ts +0 -363
- package/dist/index-CHfOF-Et.d.ts.map +0 -1
- package/dist/index-CL_CHW_Z.d.ts +0 -330
- package/dist/index-CL_CHW_Z.d.ts.map +0 -1
- package/dist/index-C_kUPMNf.d.ts +0 -298
- package/dist/index-C_kUPMNf.d.ts.map +0 -1
- package/dist/index-CxWUNzph.d.ts +0 -21319
- package/dist/index-CxWUNzph.d.ts.map +0 -1
- package/dist/index-Ofk3NYAC.d.ts +0 -18596
- package/dist/index-Ofk3NYAC.d.ts.map +0 -1
- package/dist/index-Qr_rU6VS.d.ts +0 -271
- package/dist/index-Qr_rU6VS.d.ts.map +0 -1
- package/dist/index-cBMMID-w.d.ts +0 -323
- package/dist/index-cBMMID-w.d.ts.map +0 -1
- package/dist/module-BW12i5H3.js.map +0 -1
- package/dist/module-XCoMwFat.js +0 -59
- package/dist/module-XCoMwFat.js.map +0 -1
- package/dist/processor-module-CkuQiq7B.js.map +0 -1
- package/dist/processors/vetra-read-model/index.js.map +0 -1
- package/dist/subgraph-module-CU_-umq2.js.map +0 -1
- package/dist/vetra-package-VqptqKzx.js.map +0 -1
|
@@ -1,42 +1,101 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-pbuEa-1d.js";
|
|
2
|
-
import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInput, baseSaveToFileHandle, createAction,
|
|
2
|
+
import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInput, baseSaveToFileHandle, createAction, createReducer, createState, defaultBaseState, generateId, isDocumentAction } from "document-model";
|
|
3
3
|
import * as z$1 from "zod";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
//#region document-models/document-editor/v1/gen/schema/zod.ts
|
|
6
|
+
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
7
|
+
const definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));
|
|
8
|
+
const StatusTypeSchema = z$1.enum(["CONFIRMED", "DRAFT"]);
|
|
9
|
+
function AddDocumentTypeInputSchema() {
|
|
10
|
+
return z$1.object({
|
|
11
|
+
documentType: z$1.string(),
|
|
12
|
+
id: z$1.string()
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function DocumentEditorStateSchema() {
|
|
16
|
+
return z$1.object({
|
|
17
|
+
__typename: z$1.literal("DocumentEditorState").optional(),
|
|
18
|
+
documentTypes: z$1.array(z$1.lazy(() => DocumentTypeItemSchema())),
|
|
19
|
+
name: z$1.string(),
|
|
20
|
+
status: StatusTypeSchema
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function DocumentTypeItemSchema() {
|
|
24
|
+
return z$1.object({
|
|
25
|
+
__typename: z$1.literal("DocumentTypeItem").optional(),
|
|
26
|
+
documentType: z$1.string(),
|
|
27
|
+
id: z$1.string()
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function RemoveDocumentTypeInputSchema() {
|
|
31
|
+
return z$1.object({ id: z$1.string() });
|
|
32
|
+
}
|
|
33
|
+
function SetEditorNameInputSchema() {
|
|
34
|
+
return z$1.object({ name: z$1.string() });
|
|
35
|
+
}
|
|
36
|
+
function SetEditorStatusInputSchema() {
|
|
37
|
+
return z$1.object({ status: StatusTypeSchema });
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region document-models/document-editor/v1/gen/base-operations/creators.ts
|
|
41
|
+
/**
|
|
42
|
+
* WARNING: DO NOT EDIT
|
|
43
|
+
* This file is auto-generated and updated by codegen
|
|
44
|
+
*/
|
|
45
|
+
var creators_exports = /* @__PURE__ */ __exportAll({
|
|
46
|
+
addDocumentType: () => addDocumentType,
|
|
47
|
+
removeDocumentType: () => removeDocumentType,
|
|
48
|
+
setEditorName: () => setEditorName,
|
|
49
|
+
setEditorStatus: () => setEditorStatus
|
|
50
|
+
});
|
|
51
|
+
const setEditorName = (input) => createAction("SET_EDITOR_NAME", { ...input }, void 0, SetEditorNameInputSchema, "global");
|
|
52
|
+
const addDocumentType = (input) => createAction("ADD_DOCUMENT_TYPE", { ...input }, void 0, AddDocumentTypeInputSchema, "global");
|
|
53
|
+
const removeDocumentType = (input) => createAction("REMOVE_DOCUMENT_TYPE", { ...input }, void 0, RemoveDocumentTypeInputSchema, "global");
|
|
54
|
+
const setEditorStatus = (input) => createAction("SET_EDITOR_STATUS", { ...input }, void 0, SetEditorStatusInputSchema, "global");
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region document-models/document-editor/v1/actions.ts
|
|
57
|
+
/**
|
|
58
|
+
* WARNING: DO NOT EDIT
|
|
59
|
+
* This file is auto-generated and updated by codegen
|
|
60
|
+
*/
|
|
61
|
+
/** Actions for the DocumentEditor document model */
|
|
62
|
+
const actions = {
|
|
63
|
+
...baseActions,
|
|
64
|
+
...creators_exports
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region document-models/document-editor/v1/gen/document-model.ts
|
|
7
68
|
const documentModel = {
|
|
8
69
|
id: "powerhouse/document-editor",
|
|
9
70
|
name: "Document Editor",
|
|
10
|
-
extension: ".phdm",
|
|
11
|
-
description: "",
|
|
12
71
|
author: {
|
|
13
72
|
name: "Powerhouse",
|
|
14
73
|
website: "https://powerhouse.inc"
|
|
15
74
|
},
|
|
75
|
+
extension: ".editor",
|
|
76
|
+
description: "Declares a document editor (a React UI for editing instances of one or more document models) shipped by a Vetra Reactor Package. Create one Document Editor document per editor, list the document types it can edit, then mark it CONFIRMED to trigger codegen of the editor scaffold under `editors/`. The boilerplate it produces is what you then customize.",
|
|
16
77
|
specifications: [{
|
|
17
|
-
version: 1,
|
|
18
|
-
changeLog: [],
|
|
19
78
|
state: {
|
|
20
|
-
global: {
|
|
21
|
-
schema: "type DocumentEditorState {\n name: String!\n documentTypes: [DocumentTypeItem!]!\n status: StatusType!\n}\n\ntype DocumentTypeItem {\n id: OID!\n documentType: String!\n}\n\nenum StatusType {\n DRAFT\n CONFIRMED\n}",
|
|
22
|
-
initialValue: "{\n \"name\": \"\",\n \"documentTypes\": [],\n \"status\": \"DRAFT\"\n}",
|
|
23
|
-
examples: []
|
|
24
|
-
},
|
|
25
79
|
local: {
|
|
26
80
|
schema: "",
|
|
27
|
-
|
|
28
|
-
|
|
81
|
+
examples: [],
|
|
82
|
+
initialValue: ""
|
|
83
|
+
},
|
|
84
|
+
global: {
|
|
85
|
+
schema: "\"\"\"\nConfiguration for a document editor contributed by the package. The editor is\nregistered against every document type listed in `documentTypes`; Connect picks\nthe first matching editor when opening a document.\n\"\"\"\ntype DocumentEditorState {\n \"\"\"Display name of the editor. Also determines the generated folder name under `editors/`.\"\"\"\n name: String!\n \"\"\"Document types this editor can edit. Each entry has a stable id so it can be removed individually.\"\"\"\n documentTypes: [DocumentTypeItem!]!\n \"\"\"Lifecycle status. While DRAFT the editor definition is editable and codegen is skipped; switching to CONFIRMED triggers scaffold generation.\"\"\"\n status: StatusType!\n}\n\n\"\"\"A document type id (e.g. 'powerhouse/document-drive') attached to the editor with a stable entry id.\"\"\"\ntype DocumentTypeItem {\n \"\"\"Stable identifier for the entry; used to remove it.\"\"\"\n id: OID!\n \"\"\"Document type id this editor handles (e.g. 'my-org/invoice').\"\"\"\n documentType: String!\n}\n\n\"\"\"\nLifecycle status of a module definition.\n- DRAFT: still being edited; codegen does not run.\n- CONFIRMED: locked in; codegen produces the corresponding scaffold.\n\"\"\"\nenum StatusType {\n DRAFT\n CONFIRMED\n}",
|
|
86
|
+
examples: [],
|
|
87
|
+
initialValue: "{\n \"name\": \"\",\n \"documentTypes\": [],\n \"status\": \"DRAFT\"\n}"
|
|
29
88
|
}
|
|
30
89
|
},
|
|
31
90
|
modules: [{
|
|
32
91
|
id: "73f6d103-47cb-4074-a736-a3eaf5d079bf",
|
|
33
92
|
name: "base_operations",
|
|
34
|
-
description: "",
|
|
93
|
+
description: "Set the editor's identity, lifecycle status, and the document types it handles.",
|
|
35
94
|
operations: [
|
|
36
95
|
{
|
|
37
96
|
id: "50a16f00-d25a-4c97-9632-4ce3b951a402",
|
|
38
97
|
name: "SET_EDITOR_NAME",
|
|
39
|
-
description: "",
|
|
98
|
+
description: "Set the display name of the editor. Also determines the generated folder name under `editors/`.",
|
|
40
99
|
schema: "input SetEditorNameInput {\n name: String!\n}",
|
|
41
100
|
template: "",
|
|
42
101
|
reducer: "",
|
|
@@ -47,7 +106,7 @@ const documentModel = {
|
|
|
47
106
|
{
|
|
48
107
|
id: "acee4272-f29e-4a19-aaf9-bae2cb6652ab",
|
|
49
108
|
name: "ADD_DOCUMENT_TYPE",
|
|
50
|
-
description: "",
|
|
109
|
+
description: "Register a document type this editor can edit. Caller supplies a stable id so the entry can be removed later.",
|
|
51
110
|
schema: "input AddDocumentTypeInput {\n id: OID!\n documentType: String!\n}",
|
|
52
111
|
template: "",
|
|
53
112
|
reducer: "",
|
|
@@ -58,7 +117,7 @@ const documentModel = {
|
|
|
58
117
|
{
|
|
59
118
|
id: "6c549776-0fc3-4632-a6c7-8721fa6ee41c",
|
|
60
119
|
name: "REMOVE_DOCUMENT_TYPE",
|
|
61
|
-
description: "",
|
|
120
|
+
description: "Remove a registered document type entry by its id.",
|
|
62
121
|
schema: "input RemoveDocumentTypeInput {\n id: OID!\n}",
|
|
63
122
|
template: "",
|
|
64
123
|
reducer: "",
|
|
@@ -69,7 +128,7 @@ const documentModel = {
|
|
|
69
128
|
{
|
|
70
129
|
id: "e9aa7f08-553b-452f-a494-126ace6b15f7",
|
|
71
130
|
name: "SET_EDITOR_STATUS",
|
|
72
|
-
description: "",
|
|
131
|
+
description: "Move the editor between DRAFT and CONFIRMED. Codegen only runs once the status is CONFIRMED — leaving it DRAFT means no editor files are produced.",
|
|
73
132
|
schema: "input SetEditorStatusInput {\n status: StatusType!\n}",
|
|
74
133
|
template: "",
|
|
75
134
|
reducer: "",
|
|
@@ -78,88 +137,13 @@ const documentModel = {
|
|
|
78
137
|
scope: "global"
|
|
79
138
|
}
|
|
80
139
|
]
|
|
81
|
-
}]
|
|
140
|
+
}],
|
|
141
|
+
version: 1,
|
|
142
|
+
changeLog: []
|
|
82
143
|
}]
|
|
83
144
|
};
|
|
84
145
|
//#endregion
|
|
85
|
-
//#region document-models/document-editor/
|
|
86
|
-
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
87
|
-
const definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));
|
|
88
|
-
const StatusTypeSchema = z$1.enum(["CONFIRMED", "DRAFT"]);
|
|
89
|
-
function AddDocumentTypeInputSchema() {
|
|
90
|
-
return z$1.object({
|
|
91
|
-
documentType: z$1.string(),
|
|
92
|
-
id: z$1.string()
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function DocumentEditorStateSchema() {
|
|
96
|
-
return z$1.object({
|
|
97
|
-
__typename: z$1.literal("DocumentEditorState").optional(),
|
|
98
|
-
documentTypes: z$1.array(z$1.lazy(() => DocumentTypeItemSchema())),
|
|
99
|
-
name: z$1.string(),
|
|
100
|
-
status: StatusTypeSchema
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function DocumentTypeItemSchema() {
|
|
104
|
-
return z$1.object({
|
|
105
|
-
__typename: z$1.literal("DocumentTypeItem").optional(),
|
|
106
|
-
documentType: z$1.string(),
|
|
107
|
-
id: z$1.string()
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
function RemoveDocumentTypeInputSchema() {
|
|
111
|
-
return z$1.object({ id: z$1.string() });
|
|
112
|
-
}
|
|
113
|
-
function SetEditorNameInputSchema() {
|
|
114
|
-
return z$1.object({ name: z$1.string() });
|
|
115
|
-
}
|
|
116
|
-
function SetEditorStatusInputSchema() {
|
|
117
|
-
return z$1.object({ status: StatusTypeSchema });
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region document-models/document-editor/gen/base-operations/creators.ts
|
|
121
|
-
var creators_exports = /* @__PURE__ */ __exportAll({
|
|
122
|
-
addDocumentType: () => addDocumentType,
|
|
123
|
-
removeDocumentType: () => removeDocumentType,
|
|
124
|
-
setEditorName: () => setEditorName,
|
|
125
|
-
setEditorStatus: () => setEditorStatus
|
|
126
|
-
});
|
|
127
|
-
const setEditorName = (input) => createAction("SET_EDITOR_NAME", { ...input }, void 0, SetEditorNameInputSchema, "global");
|
|
128
|
-
const addDocumentType = (input) => createAction("ADD_DOCUMENT_TYPE", { ...input }, void 0, AddDocumentTypeInputSchema, "global");
|
|
129
|
-
const removeDocumentType = (input) => createAction("REMOVE_DOCUMENT_TYPE", { ...input }, void 0, RemoveDocumentTypeInputSchema, "global");
|
|
130
|
-
const setEditorStatus = (input) => createAction("SET_EDITOR_STATUS", { ...input }, void 0, SetEditorStatusInputSchema, "global");
|
|
131
|
-
//#endregion
|
|
132
|
-
//#region document-models/document-editor/gen/document-type.ts
|
|
133
|
-
const documentEditorDocumentType = "powerhouse/document-editor";
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region document-models/document-editor/gen/document-schema.ts
|
|
136
|
-
/** Schema for validating the header object of a DocumentEditor document */
|
|
137
|
-
const DocumentEditorDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: z.literal(documentEditorDocumentType) });
|
|
138
|
-
/** Schema for validating the state object of a DocumentEditor document */
|
|
139
|
-
const DocumentEditorPHStateSchema = BaseDocumentStateSchema.extend({ global: DocumentEditorStateSchema() });
|
|
140
|
-
const DocumentEditorDocumentSchema = z.object({
|
|
141
|
-
header: DocumentEditorDocumentHeaderSchema,
|
|
142
|
-
state: DocumentEditorPHStateSchema,
|
|
143
|
-
initialState: DocumentEditorPHStateSchema
|
|
144
|
-
});
|
|
145
|
-
/** Simple helper function to check if a state object is a DocumentEditor document state object */
|
|
146
|
-
function isDocumentEditorState(state) {
|
|
147
|
-
return DocumentEditorPHStateSchema.safeParse(state).success;
|
|
148
|
-
}
|
|
149
|
-
/** Simple helper function to assert that a document state object is a DocumentEditor document state object */
|
|
150
|
-
function assertIsDocumentEditorState(state) {
|
|
151
|
-
DocumentEditorPHStateSchema.parse(state);
|
|
152
|
-
}
|
|
153
|
-
/** Simple helper function to check if a document is a DocumentEditor document */
|
|
154
|
-
function isDocumentEditorDocument(document) {
|
|
155
|
-
return DocumentEditorDocumentSchema.safeParse(document).success;
|
|
156
|
-
}
|
|
157
|
-
/** Simple helper function to assert that a document is a DocumentEditor document */
|
|
158
|
-
function assertIsDocumentEditorDocument(document) {
|
|
159
|
-
DocumentEditorDocumentSchema.parse(document);
|
|
160
|
-
}
|
|
161
|
-
//#endregion
|
|
162
|
-
//#region document-models/document-editor/src/reducers/base-operations.ts
|
|
146
|
+
//#region document-models/document-editor/v1/src/reducers/base-operations.ts
|
|
163
147
|
const documentEditorBaseOperationsOperations = {
|
|
164
148
|
setEditorNameOperation(state, action, dispatch) {
|
|
165
149
|
const trimmedName = action.input.name.trim();
|
|
@@ -181,7 +165,7 @@ const documentEditorBaseOperationsOperations = {
|
|
|
181
165
|
}
|
|
182
166
|
};
|
|
183
167
|
//#endregion
|
|
184
|
-
//#region document-models/document-editor/gen/reducer.ts
|
|
168
|
+
//#region document-models/document-editor/v1/gen/reducer.ts
|
|
185
169
|
const stateReducer = (state, action, dispatch) => {
|
|
186
170
|
if (isDocumentAction(action)) return state;
|
|
187
171
|
switch (action.type) {
|
|
@@ -206,7 +190,45 @@ const stateReducer = (state, action, dispatch) => {
|
|
|
206
190
|
};
|
|
207
191
|
const reducer = createReducer(stateReducer);
|
|
208
192
|
//#endregion
|
|
209
|
-
//#region document-models/document-editor/gen/
|
|
193
|
+
//#region document-models/document-editor/v1/gen/document-type.ts
|
|
194
|
+
/**
|
|
195
|
+
* WARNING: DO NOT EDIT
|
|
196
|
+
* This file is auto-generated and updated by codegen
|
|
197
|
+
*/
|
|
198
|
+
const documentEditorDocumentType = "powerhouse/document-editor";
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region document-models/document-editor/v1/gen/document-schema.ts
|
|
201
|
+
/**
|
|
202
|
+
* WARNING: DO NOT EDIT
|
|
203
|
+
* This file is auto-generated and updated by codegen
|
|
204
|
+
*/
|
|
205
|
+
/** Schema for validating the header object of a DocumentEditor document */
|
|
206
|
+
const DocumentEditorDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: z.literal(documentEditorDocumentType) });
|
|
207
|
+
/** Schema for validating the state object of a DocumentEditor document */
|
|
208
|
+
const DocumentEditorPHStateSchema = BaseDocumentStateSchema.extend({ global: DocumentEditorStateSchema() });
|
|
209
|
+
const DocumentEditorDocumentSchema = z.object({
|
|
210
|
+
header: DocumentEditorDocumentHeaderSchema,
|
|
211
|
+
state: DocumentEditorPHStateSchema,
|
|
212
|
+
initialState: DocumentEditorPHStateSchema
|
|
213
|
+
});
|
|
214
|
+
/** Simple helper function to check if a state object is a DocumentEditor document state object */
|
|
215
|
+
function isDocumentEditorState(state) {
|
|
216
|
+
return DocumentEditorPHStateSchema.safeParse(state).success;
|
|
217
|
+
}
|
|
218
|
+
/** Simple helper function to assert that a document state object is a DocumentEditor document state object */
|
|
219
|
+
function assertIsDocumentEditorState(state) {
|
|
220
|
+
DocumentEditorPHStateSchema.parse(state);
|
|
221
|
+
}
|
|
222
|
+
/** Simple helper function to check if a document is a DocumentEditor document */
|
|
223
|
+
function isDocumentEditorDocument(document) {
|
|
224
|
+
return DocumentEditorDocumentSchema.safeParse(document).success;
|
|
225
|
+
}
|
|
226
|
+
/** Simple helper function to assert that a document is a DocumentEditor document */
|
|
227
|
+
function assertIsDocumentEditorDocument(document) {
|
|
228
|
+
DocumentEditorDocumentSchema.parse(document);
|
|
229
|
+
}
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region document-models/document-editor/v1/gen/utils.ts
|
|
210
232
|
const initialGlobalState = {
|
|
211
233
|
name: "",
|
|
212
234
|
documentTypes: [],
|
|
@@ -214,7 +236,7 @@ const initialGlobalState = {
|
|
|
214
236
|
};
|
|
215
237
|
const initialLocalState = {};
|
|
216
238
|
const utils$1 = {
|
|
217
|
-
fileExtension: ".
|
|
239
|
+
fileExtension: ".editor",
|
|
218
240
|
createState(state) {
|
|
219
241
|
return {
|
|
220
242
|
...defaultBaseState(),
|
|
@@ -254,91 +276,26 @@ const utils$1 = {
|
|
|
254
276
|
}
|
|
255
277
|
};
|
|
256
278
|
//#endregion
|
|
257
|
-
//#region document-models/document-editor/
|
|
258
|
-
function defaultGlobalState() {
|
|
259
|
-
return {
|
|
260
|
-
name: "",
|
|
261
|
-
documentTypes: [],
|
|
262
|
-
status: "DRAFT"
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
function defaultLocalState() {
|
|
266
|
-
return {};
|
|
267
|
-
}
|
|
268
|
-
function defaultPHState() {
|
|
269
|
-
return {
|
|
270
|
-
...defaultBaseState(),
|
|
271
|
-
global: defaultGlobalState(),
|
|
272
|
-
local: defaultLocalState()
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
function createGlobalState(state) {
|
|
276
|
-
return {
|
|
277
|
-
...defaultGlobalState(),
|
|
278
|
-
...state || {}
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
function createLocalState(state) {
|
|
282
|
-
return {
|
|
283
|
-
...defaultLocalState(),
|
|
284
|
-
...state || {}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function createState$1(baseState, globalState, localState) {
|
|
288
|
-
return {
|
|
289
|
-
...createBaseState(baseState?.auth, baseState?.document),
|
|
290
|
-
global: createGlobalState(globalState),
|
|
291
|
-
local: createLocalState(localState)
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Creates a DocumentEditorDocument with custom global and local state
|
|
296
|
-
* This properly handles the PHBaseState requirements while allowing
|
|
297
|
-
* document-specific state to be set.
|
|
298
|
-
*/
|
|
299
|
-
function createDocumentEditorDocument(state) {
|
|
300
|
-
return utils$1.createDocument(state ? createState$1(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
|
|
301
|
-
}
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region document-models/document-editor/src/utils.ts
|
|
279
|
+
//#region document-models/document-editor/v1/src/utils.ts
|
|
304
280
|
var utils_exports = /* @__PURE__ */ __exportAll({});
|
|
305
281
|
//#endregion
|
|
306
|
-
//#region document-models/document-editor/
|
|
307
|
-
/** Hook to get a DocumentEditor document by its id */
|
|
308
|
-
function useDocumentEditorDocumentById(documentId) {
|
|
309
|
-
const [document, dispatch] = useDocumentById(documentId);
|
|
310
|
-
if (!isDocumentEditorDocument(document)) return [void 0, void 0];
|
|
311
|
-
return [document, dispatch];
|
|
312
|
-
}
|
|
313
|
-
/** Hook to get the selected DocumentEditor document */
|
|
314
|
-
function useSelectedDocumentEditorDocument() {
|
|
315
|
-
const [document, dispatch] = useSelectedDocument();
|
|
316
|
-
assertIsDocumentEditorDocument(document);
|
|
317
|
-
return [document, dispatch];
|
|
318
|
-
}
|
|
319
|
-
/** Hook to get all DocumentEditor documents in the selected drive */
|
|
320
|
-
function useDocumentEditorDocumentsInSelectedDrive() {
|
|
321
|
-
return useDocumentsInSelectedDrive()?.filter(isDocumentEditorDocument);
|
|
322
|
-
}
|
|
323
|
-
/** Hook to get all DocumentEditor documents in the selected folder */
|
|
324
|
-
function useDocumentEditorDocumentsInSelectedFolder() {
|
|
325
|
-
return useDocumentsInSelectedFolder()?.filter(isDocumentEditorDocument);
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region document-models/document-editor/actions.ts
|
|
329
|
-
/** Actions for the DocumentEditor document model */
|
|
330
|
-
const actions = {
|
|
331
|
-
...baseActions,
|
|
332
|
-
...creators_exports
|
|
333
|
-
};
|
|
334
|
-
//#endregion
|
|
335
|
-
//#region document-models/document-editor/utils.ts
|
|
282
|
+
//#region document-models/document-editor/v1/utils.ts
|
|
336
283
|
/** Utils for the DocumentEditor document model */
|
|
337
284
|
const utils = {
|
|
338
285
|
...utils$1,
|
|
339
286
|
...utils_exports
|
|
340
287
|
};
|
|
341
288
|
//#endregion
|
|
342
|
-
|
|
289
|
+
//#region document-models/document-editor/v1/module.ts
|
|
290
|
+
/** Document model module for the DocumentEditor document type */
|
|
291
|
+
const DocumentEditor = {
|
|
292
|
+
version: 1,
|
|
293
|
+
reducer,
|
|
294
|
+
actions,
|
|
295
|
+
utils,
|
|
296
|
+
documentModel: createState(defaultBaseState(), documentModel)
|
|
297
|
+
};
|
|
298
|
+
//#endregion
|
|
299
|
+
export { isDefinedNonNullAny as A, DocumentEditorStateSchema as C, SetEditorStatusInputSchema as D, SetEditorNameInputSchema as E, StatusTypeSchema as O, AddDocumentTypeInputSchema as S, RemoveDocumentTypeInputSchema as T, addDocumentType as _, utils$1 as a, setEditorName as b, DocumentEditorPHStateSchema as c, isDocumentEditorDocument as d, isDocumentEditorState as f, actions as g, documentModel as h, initialLocalState as i, definedNonNullAnySchema as k, assertIsDocumentEditorDocument as l, reducer as m, utils as n, DocumentEditorDocumentHeaderSchema as o, documentEditorDocumentType as p, initialGlobalState as r, DocumentEditorDocumentSchema as s, DocumentEditor as t, assertIsDocumentEditorState as u, creators_exports as v, DocumentTypeItemSchema as w, setEditorStatus as x, removeDocumentType as y };
|
|
343
300
|
|
|
344
|
-
//# sourceMappingURL=
|
|
301
|
+
//# sourceMappingURL=module-D0SK3Nds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-D0SK3Nds.js","names":["z","documentEditorBaseOperationsActions","utils","genUtils","customUtils"],"sources":["../document-models/document-editor/v1/gen/schema/zod.ts","../document-models/document-editor/v1/gen/base-operations/creators.ts","../document-models/document-editor/v1/actions.ts","../document-models/document-editor/v1/gen/document-model.ts","../document-models/document-editor/v1/src/reducers/base-operations.ts","../document-models/document-editor/v1/gen/reducer.ts","../document-models/document-editor/v1/gen/document-type.ts","../document-models/document-editor/v1/gen/document-schema.ts","../document-models/document-editor/v1/gen/utils.ts","../document-models/document-editor/v1/src/utils.ts","../document-models/document-editor/v1/utils.ts","../document-models/document-editor/v1/module.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n DocumentEditorState,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function DocumentEditorStateSchema(): z.ZodObject<\n Properties<DocumentEditorState>\n> {\n return z.object({\n __typename: z.literal(\"DocumentEditorState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n\nexport function DocumentTypeItemSchema(): z.ZodObject<\n Properties<DocumentTypeItem>\n> {\n return z.object({\n __typename: z.literal(\"DocumentTypeItem\").optional(),\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SetEditorNameInputSchema(): z.ZodObject<\n Properties<SetEditorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetEditorStatusInputSchema(): z.ZodObject<\n Properties<SetEditorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetEditorNameAction,\n SetEditorStatusAction,\n} from \"./actions.js\";\n\nexport const setEditorName = (input: SetEditorNameInput) =>\n createAction<SetEditorNameAction>(\n \"SET_EDITOR_NAME\",\n { ...input },\n undefined,\n SetEditorNameInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const setEditorStatus = (input: SetEditorStatusInput) =>\n createAction<SetEditorStatusAction>(\n \"SET_EDITOR_STATUS\",\n { ...input },\n undefined,\n SetEditorStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { documentEditorBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the DocumentEditor document model */\n\nexport const actions = {\n ...baseActions,\n ...documentEditorBaseOperationsActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/document-editor\",\n name: \"Document Editor\",\n author: {\n name: \"Powerhouse\",\n website: \"https://powerhouse.inc\",\n },\n extension: \".editor\",\n description:\n \"Declares a document editor (a React UI for editing instances of one or more document models) shipped by a Vetra Reactor Package. Create one Document Editor document per editor, list the document types it can edit, then mark it CONFIRMED to trigger codegen of the editor scaffold under `editors/`. The boilerplate it produces is what you then customize.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n '\"\"\"\\nConfiguration for a document editor contributed by the package. The editor is\\nregistered against every document type listed in `documentTypes`; Connect picks\\nthe first matching editor when opening a document.\\n\"\"\"\\ntype DocumentEditorState {\\n \"\"\"Display name of the editor. Also determines the generated folder name under `editors/`.\"\"\"\\n name: String!\\n \"\"\"Document types this editor can edit. Each entry has a stable id so it can be removed individually.\"\"\"\\n documentTypes: [DocumentTypeItem!]!\\n \"\"\"Lifecycle status. While DRAFT the editor definition is editable and codegen is skipped; switching to CONFIRMED triggers scaffold generation.\"\"\"\\n status: StatusType!\\n}\\n\\n\"\"\"A document type id (e.g. \\'powerhouse/document-drive\\') attached to the editor with a stable entry id.\"\"\"\\ntype DocumentTypeItem {\\n \"\"\"Stable identifier for the entry; used to remove it.\"\"\"\\n id: OID!\\n \"\"\"Document type id this editor handles (e.g. \\'my-org/invoice\\').\"\"\"\\n documentType: String!\\n}\\n\\n\"\"\"\\nLifecycle status of a module definition.\\n- DRAFT: still being edited; codegen does not run.\\n- CONFIRMED: locked in; codegen produces the corresponding scaffold.\\n\"\"\"\\nenum StatusType {\\n DRAFT\\n CONFIRMED\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"documentTypes\": [],\\n \"status\": \"DRAFT\"\\n}',\n },\n },\n modules: [\n {\n id: \"73f6d103-47cb-4074-a736-a3eaf5d079bf\",\n name: \"base_operations\",\n description:\n \"Set the editor's identity, lifecycle status, and the document types it handles.\",\n operations: [\n {\n id: \"50a16f00-d25a-4c97-9632-4ce3b951a402\",\n name: \"SET_EDITOR_NAME\",\n description:\n \"Set the display name of the editor. Also determines the generated folder name under `editors/`.\",\n schema: \"input SetEditorNameInput {\\n name: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"acee4272-f29e-4a19-aaf9-bae2cb6652ab\",\n name: \"ADD_DOCUMENT_TYPE\",\n description:\n \"Register a document type this editor can edit. Caller supplies a stable id so the entry can be removed later.\",\n schema:\n \"input AddDocumentTypeInput {\\n id: OID!\\n documentType: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"6c549776-0fc3-4632-a6c7-8721fa6ee41c\",\n name: \"REMOVE_DOCUMENT_TYPE\",\n description: \"Remove a registered document type entry by its id.\",\n schema: \"input RemoveDocumentTypeInput {\\n id: OID!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"e9aa7f08-553b-452f-a494-126ace6b15f7\",\n name: \"SET_EDITOR_STATUS\",\n description:\n \"Move the editor between DRAFT and CONFIRMED. Codegen only runs once the status is CONFIRMED \\u2014 leaving it DRAFT means no editor files are produced.\",\n schema: \"input SetEditorStatusInput {\\n status: StatusType!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","import type { DocumentEditorBaseOperationsOperations } from \"document-models/document-editor/v1\";\n\nexport const documentEditorBaseOperationsOperations: DocumentEditorBaseOperationsOperations =\n {\n setEditorNameOperation(state, action, dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Editor name cannot be empty\");\n }\n state.name = trimmedName;\n },\n addDocumentTypeOperation(state, action, dispatch) {\n // Check for duplicate ID\n const existingId = state.documentTypes.find(\n (dt) => dt.id === action.input.id,\n );\n if (existingId) {\n throw new Error(\n `Document type with id \"${action.input.id}\" already exists`,\n );\n }\n\n state.documentTypes.push({\n id: action.input.id,\n documentType: action.input.documentType,\n });\n },\n removeDocumentTypeOperation(state, action, dispatch) {\n state.documentTypes = state.documentTypes.filter(\n (documentType) => documentType.id !== action.input.id,\n );\n },\n setEditorStatusOperation(state, action, dispatch) {\n state.status = action.input.status;\n },\n };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { DocumentEditorPHState } from \"document-models/document-editor/v1\";\n\nimport { documentEditorBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<DocumentEditorPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_EDITOR_NAME\": {\n SetEditorNameInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_EDITOR_STATUS\": {\n SetEditorStatusInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<DocumentEditorPHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const documentEditorDocumentType = \"powerhouse/document-editor\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { DocumentEditorStateSchema } from \"./schema/zod.js\";\nimport type { DocumentEditorDocument, DocumentEditorPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a DocumentEditor document */\nexport const DocumentEditorDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(documentEditorDocumentType),\n });\n\n/** Schema for validating the state object of a DocumentEditor document */\nexport const DocumentEditorPHStateSchema = BaseDocumentStateSchema.extend({\n global: DocumentEditorStateSchema(),\n});\n\nexport const DocumentEditorDocumentSchema = z.object({\n header: DocumentEditorDocumentHeaderSchema,\n state: DocumentEditorPHStateSchema,\n initialState: DocumentEditorPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a DocumentEditor document state object */\nexport function isDocumentEditorState(\n state: unknown,\n): state is DocumentEditorPHState {\n return DocumentEditorPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a DocumentEditor document state object */\nexport function assertIsDocumentEditorState(\n state: unknown,\n): asserts state is DocumentEditorPHState {\n DocumentEditorPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a DocumentEditor document */\nexport function isDocumentEditorDocument(\n document: unknown,\n): document is DocumentEditorDocument {\n return DocumentEditorDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a DocumentEditor document */\nexport function assertIsDocumentEditorDocument(\n document: unknown,\n): asserts document is DocumentEditorDocument {\n DocumentEditorDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n generateId,\n} from \"document-model\";\nimport {\n assertIsDocumentEditorDocument,\n assertIsDocumentEditorState,\n isDocumentEditorDocument,\n isDocumentEditorState,\n} from \"./document-schema.js\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n DocumentEditorGlobalState,\n DocumentEditorLocalState,\n DocumentEditorPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: DocumentEditorGlobalState = {\n name: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n};\nexport const initialLocalState: DocumentEditorLocalState = {};\n\nexport const utils: DocumentModelUtils<DocumentEditorPHState> = {\n fileExtension: \".editor\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n const document = baseCreateDocument(utils.createState, state);\n\n document.header.documentType = documentEditorDocumentType;\n\n // for backwards compatibility, but this is NOT a valid signed document id\n document.header.id = generateId();\n\n return document;\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isDocumentEditorState(state);\n },\n assertIsStateOfType(state) {\n return assertIsDocumentEditorState(state);\n },\n isDocumentOfType(document) {\n return isDocumentEditorDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsDocumentEditorDocument(document);\n },\n};\n","export {};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport type { DocumentEditorPHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the DocumentEditor document model */\nexport const utils: DocumentModelUtils<DocumentEditorPHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from \"document-model\";\nimport { createState, defaultBaseState } from \"document-model\";\nimport { actions } from \"./actions.js\";\nimport { documentModel } from \"./gen/document-model.js\";\nimport { reducer } from \"./gen/reducer.js\";\nimport type { DocumentEditorPHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the DocumentEditor document type */\nexport const DocumentEditor = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<DocumentEditorPHState>;\n"],"mappings":";;;;;AAmBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO;EACd,cAAcA,IAAE,QAAQ;EACxB,IAAIA,IAAE,QAAQ;EACf,CAAC;;AAGJ,SAAgB,4BAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,sBAAsB,CAAC,UAAU;EACvD,eAAeA,IAAE,MAAMA,IAAE,WAAW,wBAAwB,CAAC,CAAC;EAC9D,MAAMA,IAAE,QAAQ;EAChB,QAAQ;EACT,CAAC;;AAGJ,SAAgB,yBAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,mBAAmB,CAAC,UAAU;EACpD,cAAcA,IAAE,QAAQ;EACxB,IAAIA,IAAE,QAAQ;EACf,CAAC;;AAGJ,SAAgB,gCAEd;AACA,QAAOA,IAAE,OAAO,EACd,IAAIA,IAAE,QAAQ,EACf,CAAC;;AAGJ,SAAgB,2BAEd;AACA,QAAOA,IAAE,OAAO,EACd,MAAMA,IAAE,QAAQ,EACjB,CAAC;;AAGJ,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,QAAQ,kBACT,CAAC;;;;;;;;;;;;;;ACvDJ,MAAa,iBAAiB,UAC5B,aACE,mBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,0BACA,SACD;AAEH,MA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AAe,YAAY,kBAAkB,EAAE,cAAc;CAC9D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region document-models/processor-module/v1/module.d.ts
|
|
2
|
+
/** Document model module for the ProcessorModule document type */
|
|
3
|
+
declare const ProcessorModule: DocumentModelModule<any>;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { ProcessorModule as t };
|
|
6
|
+
//# sourceMappingURL=module-DhhQLYnQ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-DhhQLYnQ.d.ts","names":[],"sources":["../document-models/processor-module/v1/module.ts"],"mappings":";;cAaa,eAAA,EAAe,mBAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region document-models/vetra-package/v1/module.d.ts
|
|
2
|
+
/** Document model module for the VetraPackage document type */
|
|
3
|
+
declare const VetraPackage: DocumentModelModule<any>;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { VetraPackage as t };
|
|
6
|
+
//# sourceMappingURL=module-J-kGIl1E.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-J-kGIl1E.d.ts","names":[],"sources":["../document-models/vetra-package/v1/module.ts"],"mappings":";;cAaa,YAAA,EAAY,mBAAA"}
|
|
@@ -11,21 +11,24 @@ declare let documentModels: {
|
|
|
11
11
|
id: string;
|
|
12
12
|
name: string;
|
|
13
13
|
}[];
|
|
14
|
+
declare let apps: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}[];
|
|
14
18
|
declare let editors: {
|
|
15
19
|
id: string;
|
|
16
20
|
name: string;
|
|
17
21
|
documentTypes: string[];
|
|
18
22
|
}[];
|
|
19
|
-
declare let
|
|
23
|
+
declare let processors: {
|
|
20
24
|
id: string;
|
|
21
25
|
name: string;
|
|
22
|
-
app: string;
|
|
23
26
|
}[];
|
|
24
27
|
declare let subgraphs: never[];
|
|
25
|
-
declare let
|
|
28
|
+
declare let config: never[];
|
|
26
29
|
declare namespace __json_default_export {
|
|
27
|
-
export { name, description, category, publisher, documentModels, editors,
|
|
30
|
+
export { name, description, category, publisher, documentModels, apps, editors, processors, subgraphs, config };
|
|
28
31
|
}
|
|
29
32
|
//#endregion
|
|
30
|
-
export { apps, category, __json_default_export as default, description, documentModels, editors,
|
|
33
|
+
export { apps, category, config, __json_default_export as default, description, documentModels, editors, name, processors, publisher, subgraphs };
|
|
31
34
|
//# sourceMappingURL=powerhouse.manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerhouse.manifest.d.ts","names":["name","description","category","publisher","name_1","url","documentModels","id","
|
|
1
|
+
{"version":3,"file":"powerhouse.manifest.d.ts","names":["name","description","category","publisher","name_1","url","documentModels","id","apps","editors","documentTypes","processors","subgraphs","config","__json_default_export","default"],"sources":["../powerhouse.manifest.json.d.ts"],"mappings":";YAAWA,IAAAA;AAAAA,YACAC,WAAAA;AAAAA,YACAC,QAAAA;AAAAA,kBACMC,SAAAA;EAAAA,IACTC,MAAAA;EAAAA,SACKA,MAAAA,IAAUJ,IAAAA;EAAAA,WACRK,GAAAA;AAAAA;AAAAA,YAEJC,cAAAA;EACPC,EAAAA;EACAP,IAAAA;AAAAA;AAAAA,YAEOQ,IAAAA;EACPD,EAAAA;EACAP,IAAAA;AAAAA;AAAAA,YAEOS,OAAAA;EACPF,EAAAA;EACAP,IAAAA;EACAU,aAAAA;AAAAA;AAAAA,YAEOC,UAAAA;EACPJ,EAAAA;EACAP,IAAAA;AAAAA;AAAAA,YAEOY,SAAAA;AAAAA,YACAC,MAAAA;AAAAA,kBAEOC,qBAAAA;EAAAA,SACPd,IAAAA,EAAMC,WAAAA,EAAaC,QAAAA,EAAUC,SAAAA,EAAWG,cAAAA,EAAgBE,IAAAA,EAAMC,OAAAA,EAASE,UAAAA,EAAYC,SAAAA,EAAWC,MAAAA;AAAAA"}
|
|
@@ -16,7 +16,7 @@ var documentModels = [
|
|
|
16
16
|
"name": "Document Editor"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
"id": "powerhouse/subgraph
|
|
19
|
+
"id": "powerhouse/subgraph",
|
|
20
20
|
"name": "Subgraph Module"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
@@ -28,6 +28,10 @@ var documentModels = [
|
|
|
28
28
|
"name": "App Module"
|
|
29
29
|
}
|
|
30
30
|
];
|
|
31
|
+
var apps = [{
|
|
32
|
+
"id": "vetra-drive-app",
|
|
33
|
+
"name": "Vetra Drive App"
|
|
34
|
+
}];
|
|
31
35
|
var editors = [
|
|
32
36
|
{
|
|
33
37
|
"id": "vetra-package-editor",
|
|
@@ -42,7 +46,7 @@ var editors = [
|
|
|
42
46
|
{
|
|
43
47
|
"id": "subgraph-module-editor",
|
|
44
48
|
"name": "Subgraph Module Editor",
|
|
45
|
-
"documentTypes": ["powerhouse/subgraph
|
|
49
|
+
"documentTypes": ["powerhouse/subgraph"]
|
|
46
50
|
},
|
|
47
51
|
{
|
|
48
52
|
"id": "processor-module-editor",
|
|
@@ -50,30 +54,33 @@ var editors = [
|
|
|
50
54
|
"documentTypes": ["powerhouse/processor"]
|
|
51
55
|
},
|
|
52
56
|
{
|
|
53
|
-
"id": "app-
|
|
54
|
-
"name": "App
|
|
57
|
+
"id": "app-editor",
|
|
58
|
+
"name": "App Editor",
|
|
55
59
|
"documentTypes": ["powerhouse/app"]
|
|
56
60
|
}
|
|
57
61
|
];
|
|
58
|
-
var
|
|
59
|
-
"id": "
|
|
60
|
-
"name": "
|
|
61
|
-
|
|
62
|
+
var processors = [{
|
|
63
|
+
"id": "codegen",
|
|
64
|
+
"name": "codegen"
|
|
65
|
+
}, {
|
|
66
|
+
"id": "vetra-read-model",
|
|
67
|
+
"name": "vetra-read-model"
|
|
62
68
|
}];
|
|
63
69
|
var subgraphs = [];
|
|
64
|
-
var
|
|
70
|
+
var config = [];
|
|
65
71
|
var powerhouse_manifest_default = {
|
|
66
72
|
name,
|
|
67
73
|
description,
|
|
68
74
|
category,
|
|
69
75
|
publisher,
|
|
70
76
|
documentModels,
|
|
71
|
-
editors,
|
|
72
77
|
apps,
|
|
78
|
+
editors,
|
|
79
|
+
processors,
|
|
73
80
|
subgraphs,
|
|
74
|
-
|
|
81
|
+
config
|
|
75
82
|
};
|
|
76
83
|
//#endregion
|
|
77
|
-
export { apps, category, powerhouse_manifest_default as default, description, documentModels, editors,
|
|
84
|
+
export { apps, category, config, powerhouse_manifest_default as default, description, documentModels, editors, name, processors, publisher, subgraphs };
|
|
78
85
|
|
|
79
86
|
//# sourceMappingURL=powerhouse.manifest.js.map
|