@powerhousedao/vetra 6.2.3-dev.72 → 6.2.3-dev.74
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/codegen/index.d.ts +4 -1
- package/dist/codegen/index.d.ts.map +1 -1
- package/dist/codegen/index.js +8 -12
- package/dist/codegen/index.js.map +1 -1
- package/dist/codegen/spec.js +1 -1
- package/dist/document-models/app-module/index.d.ts +2 -2
- package/dist/document-models/app-module/index.js +1 -1
- package/dist/document-models/index.d.ts +1 -1
- package/dist/document-models/index.js +1 -1
- package/dist/editors/index.d.ts +2 -2
- package/dist/{factory-B39ZfGtS.js → factory-BLQkEgxk.js} +3 -3
- package/dist/{factory-B39ZfGtS.js.map → factory-BLQkEgxk.js.map} +1 -1
- package/dist/{index-6bE9h_7M.d.ts → index-CKCays-S.d.ts} +2 -2
- package/dist/{index-6bE9h_7M.d.ts.map → index-CKCays-S.d.ts.map} +1 -1
- package/dist/{index-DPG4u1Ym.d.ts → index-mYlWU47F.d.ts} +2 -2
- package/dist/{index-DPG4u1Ym.d.ts.map → index-mYlWU47F.d.ts.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{module-Caxhis1M.js → module-d1-9VDGb.js} +4 -4
- package/dist/module-d1-9VDGb.js.map +1 -0
- package/dist/{processor-Dur7qIEg.js → processor-kRJ48ypM.js} +66 -12
- package/dist/processor-kRJ48ypM.js.map +1 -0
- package/dist/processors/codegen/index.d.ts +11 -2
- package/dist/processors/codegen/index.d.ts.map +1 -1
- package/dist/processors/codegen/index.js +2 -2
- package/dist/processors/index.js +1 -1
- package/dist/{spec-api-BIJ_jsGp.js → spec-api-B01RpZM-.js} +4 -4
- package/dist/{spec-api-BIJ_jsGp.js.map → spec-api-B01RpZM-.js.map} +1 -1
- package/dist/{subgraph-type-lint-BaNSloyH.js → subgraph-type-lint-Dr8Wu0VB.js} +25 -5
- package/dist/subgraph-type-lint-Dr8Wu0VB.js.map +1 -0
- package/dist/{switchboard-ClTRIBIS.js → switchboard-CZ87bHRJ.js} +2 -2
- package/dist/{switchboard-ClTRIBIS.js.map → switchboard-CZ87bHRJ.js.map} +1 -1
- package/package.json +9 -9
- package/dist/module-Caxhis1M.js.map +0 -1
- package/dist/processor-Dur7qIEg.js.map +0 -1
- package/dist/subgraph-type-lint-BaNSloyH.js.map +0 -1
package/dist/codegen/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as AppModuleDocument } from "../index-
|
|
1
|
+
import { $ as AppModuleDocument } from "../index-mYlWU47F.js";
|
|
2
2
|
import { G as DocumentEditorDocument } from "../index-D6Ai0OOc.js";
|
|
3
3
|
import { et as ProcessorModuleDocument } from "../index-B52jv-LY.js";
|
|
4
4
|
import { R as SubgraphModuleDocument } from "../index-DplUuZMT.js";
|
|
@@ -28,6 +28,9 @@ export declare function generateSubgraphFromDocument(doc: SubgraphModuleDocument
|
|
|
28
28
|
export declare function generateAppFromDocument(doc: AppModuleDocument, project: Project): Promise<void>;
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region codegen/subgraph-type-lint.d.ts
|
|
31
|
+
/** Why the server would refuse a new subgraph scaffolded as `name`, if it
|
|
32
|
+
* would; an existing one is left to {@link lintSubgraphTypes}. */
|
|
33
|
+
export declare function findSubgraphNameConflict(projectDir: string, name: string): Promise<string | undefined>;
|
|
31
34
|
/** A warning per model or subgraph the server would refuse or leave out. */
|
|
32
35
|
export declare function lintSubgraphTypes(projectDir: string): Promise<string[]>;
|
|
33
36
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../codegen/extract.ts","../../codegen/generate-from-document.ts","../../codegen/subgraph-type-lint.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../codegen/extract.ts","../../codegen/generate-from-document.ts","../../codegen/subgraph-type-lint.ts"],"mappings":";;;;;;;;wBA6DgB,uBACd,SAAS,UACR;wBA2Ba,oBAAoB,SAAS,UAAU;wBAkBvC,0BACd,SAAS,UACR;wBAsBa,yBACd,SAAS,UACR;wBAYa,8BACd,SAAS,UACR;YAsBS;EACV,gBAAgB;EAChB,SAAS;EACT,MAAM;EACN,YAAY;EACZ,WAAW;;wBAMG,oBAAoB,SAAS,UAAU;;;wBC5IjC,kCACpB,KAAK,uBACL,SAAS,UACR;wBAImB,2BACpB,KAAK,wBACL,SAAS,UACR;wBAemB,8BACpB,KAAK,yBACL,SAAS,UACR;wBA+BmB,6BACpB,KAAK,wBACL,SAAS,UACR;wBAImB,wBACpB,KAAK,mBACL,SAAS,UACR;;;;;wBCbmB,yBACpB,oBACA,eACC;;wBAoBmB,kBAAkB,qBAAqB"}
|
package/dist/codegen/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { t as createAppModuleDocument } from "../ph-factories-CgoFCmG0.js";
|
|
|
2
2
|
import { t as createDocumentEditorDocument } from "../ph-factories-Bgnr3mK3.js";
|
|
3
3
|
import { t as createProcessorModuleDocument } from "../ph-factories-HuC7_vvF.js";
|
|
4
4
|
import { n as createSubgraphModuleDocument } from "../ph-factories-DhLtvC7j.js";
|
|
5
|
-
import { a as getDocument, c as getDocuments, d as getSpecEntry, f as listSpecDocumentTypes, g as stripLeadingDot, h as specPath, i as deleteDocument, l as validateActions, m as specDir, n as addActionsAndSave, o as getDocumentModelSchema, p as saveSpec, r as createDocument, s as getDocumentModels, t as addActions, u as SPECS_DIRNAME } from "../spec-api-
|
|
6
|
-
import {
|
|
5
|
+
import { a as getDocument, c as getDocuments, d as getSpecEntry, f as listSpecDocumentTypes, g as stripLeadingDot, h as specPath, i as deleteDocument, l as validateActions, m as specDir, n as addActionsAndSave, o as getDocumentModelSchema, p as saveSpec, r as createDocument, s as getDocumentModels, t as addActions, u as SPECS_DIRNAME } from "../spec-api-B01RpZM-.js";
|
|
6
|
+
import { n as lintSubgraphTypes, t as findSubgraphNameConflict } from "../subgraph-type-lint-Dr8Wu0VB.js";
|
|
7
7
|
import { documentModelDocumentModelModule } from "document-model";
|
|
8
8
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
9
9
|
import { generateId } from "@powerhousedao/shared/document-model";
|
|
10
|
-
import { getAppMetadata, getEditorMetadata, getOrCreateDirectory, getProcessorMetadata, getSubgraphMetadata, loadDocumentModelInDir } from "@powerhousedao/codegen/utils";
|
|
10
|
+
import { getAppMetadata, getEditorDirNames, getEditorMetadata, getOrCreateDirectory, getProcessorDirNames, getProcessorMetadata, getSubgraphDirNames, getSubgraphMetadata, loadDocumentModelInDir } from "@powerhousedao/codegen/utils";
|
|
11
11
|
import { readdirSync } from "node:fs";
|
|
12
12
|
import { generateApp, generateDocumentModel, generateEditor, generateProcessor, generateSubgraph } from "@powerhousedao/codegen";
|
|
13
13
|
import { kebabCase } from "change-case";
|
|
@@ -24,8 +24,7 @@ import { kebabCase } from "change-case";
|
|
|
24
24
|
*/
|
|
25
25
|
const isDefined = (v) => v != null;
|
|
26
26
|
function extractEditorDocuments(project) {
|
|
27
|
-
|
|
28
|
-
return editorsDir.getDirectories().map((dir) => getEditorMetadata(project, dir.getBaseName())).filter(isDefined).filter(({ documentTypes }) => !documentTypes.includes("powerhouse/document-drive")).map(({ name, documentTypes }) => {
|
|
27
|
+
return getEditorDirNames(project).map((dirName) => getEditorMetadata(project, dirName)).filter(isDefined).filter(({ documentTypes }) => !documentTypes.includes("powerhouse/document-drive")).map(({ name, documentTypes }) => {
|
|
29
28
|
const global = {
|
|
30
29
|
name,
|
|
31
30
|
documentTypes: documentTypes.map((documentType) => ({
|
|
@@ -40,8 +39,7 @@ function extractEditorDocuments(project) {
|
|
|
40
39
|
});
|
|
41
40
|
}
|
|
42
41
|
function extractAppDocuments(project) {
|
|
43
|
-
|
|
44
|
-
return editorsDir.getDirectories().map((dir) => getAppMetadata(project, dir.getBaseName())).filter(isDefined).map(({ name, allowedDocumentTypes, isDragAndDropEnabled }) => {
|
|
42
|
+
return getEditorDirNames(project).map((dirName) => getAppMetadata(project, dirName)).filter(isDefined).map(({ name, allowedDocumentTypes, isDragAndDropEnabled }) => {
|
|
45
43
|
const global = {
|
|
46
44
|
name,
|
|
47
45
|
status: "CONFIRMED",
|
|
@@ -54,8 +52,7 @@ function extractAppDocuments(project) {
|
|
|
54
52
|
});
|
|
55
53
|
}
|
|
56
54
|
function extractProcessorDocuments(project) {
|
|
57
|
-
|
|
58
|
-
return processorsDir.getDirectories().map((dir) => getProcessorMetadata(project, dir.getBaseName())).map(({ processorName, processorApps, processorType, documentTypes }) => {
|
|
55
|
+
return getProcessorDirNames(project).map((dirName) => getProcessorMetadata(project, dirName)).map(({ processorName, processorApps, processorType, documentTypes }) => {
|
|
59
56
|
const global = {
|
|
60
57
|
name: processorName,
|
|
61
58
|
type: processorType === "relationalDb" ? "relational" : processorType,
|
|
@@ -72,8 +69,7 @@ function extractProcessorDocuments(project) {
|
|
|
72
69
|
});
|
|
73
70
|
}
|
|
74
71
|
function extractSubgraphDocuments(project) {
|
|
75
|
-
|
|
76
|
-
return subgraphsDir.getDirectories().map((dir) => getSubgraphMetadata(project, dir.getBaseName()).subgraphName).filter(isDefined).map((name) => {
|
|
72
|
+
return getSubgraphDirNames(project).map((dirName) => getSubgraphMetadata(project, dirName).subgraphName).filter(isDefined).map((name) => {
|
|
77
73
|
const doc = createSubgraphModuleDocument({ global: {
|
|
78
74
|
name,
|
|
79
75
|
status: "CONFIRMED"
|
|
@@ -162,6 +158,6 @@ function isProcessorApps(input) {
|
|
|
162
158
|
return true;
|
|
163
159
|
}
|
|
164
160
|
//#endregion
|
|
165
|
-
export { SPECS_DIRNAME, addActions, addActionsAndSave, createDocument, deleteDocument, extractAllDocuments, extractAppDocuments, extractDocumentModelDocuments, extractEditorDocuments, extractProcessorDocuments, extractSubgraphDocuments, generateAppFromDocument, generateDocumentModelFromDocument, generateEditorFromDocument, generateProcessorFromDocument, generateSubgraphFromDocument, getDocument, getDocumentModelSchema, getDocumentModels, getDocuments, getSpecEntry, lintSubgraphTypes, listSpecDocumentTypes, saveSpec, specDir, specPath, stripLeadingDot, validateActions };
|
|
161
|
+
export { SPECS_DIRNAME, addActions, addActionsAndSave, createDocument, deleteDocument, extractAllDocuments, extractAppDocuments, extractDocumentModelDocuments, extractEditorDocuments, extractProcessorDocuments, extractSubgraphDocuments, findSubgraphNameConflict, generateAppFromDocument, generateDocumentModelFromDocument, generateEditorFromDocument, generateProcessorFromDocument, generateSubgraphFromDocument, getDocument, getDocumentModelSchema, getDocumentModels, getDocuments, getSpecEntry, lintSubgraphTypes, listSpecDocumentTypes, saveSpec, specDir, specPath, stripLeadingDot, validateActions };
|
|
166
162
|
|
|
167
163
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../codegen/extract.ts","../../codegen/generate-from-document.ts"],"sourcesContent":["/**\n * Inverse of the `generate*` functions in `@powerhousedao/codegen`.\n *\n * `generate*` reads source-of-truth documents and writes code into the project.\n * `extract*` reads the project's existing code/files and produces the\n * `powerhouse/*` documents that would have produced that code. Intended as a\n * one-shot migration step toward the documents-as-source-of-truth model: run\n * extraction, save the documents into `specs/`, and from then on regenerate\n * from the specs.\n */\nimport {\n generateId,\n type DocumentModelDocument,\n type DocumentModelGlobalState,\n type DocumentModelPHState,\n} from \"@powerhousedao/shared/document-model\";\nimport {\n getAppMetadata,\n getEditorMetadata,\n getOrCreateDirectory,\n getProcessorMetadata,\n getSubgraphMetadata,\n loadDocumentModelInDir,\n} from \"@powerhousedao/codegen/utils\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nimport { readdirSync } from \"node:fs\";\nimport type { Project } from \"ts-morph\";\n\nconst isDefined = <T>(v: T | undefined | null): v is T => v != null;\n\n/* Import from gen/ directly to bypass the top-level barrel's `hooks.ts`,\n * which pulls in browser-only `@powerhousedao/reactor-browser`. */\nimport {\n createAppModuleDocument,\n type AppModuleDocument,\n type AppModuleGlobalState,\n} from \"../document-models/app-module/v1/gen/index.js\";\nimport {\n createDocumentEditorDocument,\n type DocumentEditorDocument,\n type DocumentEditorGlobalState,\n} from \"../document-models/document-editor/v1/gen/index.js\";\nimport {\n createProcessorModuleDocument,\n type ProcessorModuleDocument,\n type ProcessorModuleGlobalState,\n} from \"../document-models/processor-module/v1/gen/index.js\";\nimport {\n createSubgraphModuleDocument,\n type SubgraphModuleDocument,\n type SubgraphModuleGlobalState,\n} from \"../document-models/subgraph-module/v1/gen/index.js\";\n\n/* Builds a `powerhouse/document-editor` document for each editor in the\n * project's `editors/` directory. Drive editors (powerhouse/document-drive)\n * are excluded — those are handled by `extractAppDocuments`, matching how\n * `generateAllEditors` / `generateAllApps` are split.\n */\nexport function extractEditorDocuments(\n project: Project,\n): DocumentEditorDocument[] {\n const { directory: editorsDir } = getOrCreateDirectory(project, \"editors\");\n return editorsDir\n .getDirectories()\n .map((dir) => getEditorMetadata(project, dir.getBaseName()))\n .filter(isDefined)\n .filter(\n ({ documentTypes }) =>\n !documentTypes.includes(\"powerhouse/document-drive\"),\n )\n .map(({ name, documentTypes }) => {\n const global: DocumentEditorGlobalState = {\n name,\n documentTypes: documentTypes.map((documentType) => ({\n id: generateId(),\n documentType,\n })),\n status: \"CONFIRMED\",\n };\n const doc = createDocumentEditorDocument({ global });\n doc.header.name = name;\n return doc;\n });\n}\n\n/* Builds a `powerhouse/app` document for each drive editor (an editor whose\n * documentTypes include `powerhouse/document-drive`) — same selection\n * predicate used by `generateAllApps`.\n */\nexport function extractAppDocuments(project: Project): AppModuleDocument[] {\n const { directory: editorsDir } = getOrCreateDirectory(project, \"editors\");\n return editorsDir\n .getDirectories()\n .map((dir) => getAppMetadata(project, dir.getBaseName()))\n .filter(isDefined)\n .map(({ name, allowedDocumentTypes, isDragAndDropEnabled }) => {\n const global: AppModuleGlobalState = {\n name,\n status: \"CONFIRMED\",\n allowedDocumentTypes:\n allowedDocumentTypes.length > 0 ? allowedDocumentTypes : null,\n isDragAndDropEnabled: isDragAndDropEnabled ?? true,\n };\n const doc = createAppModuleDocument({ global });\n doc.header.name = name;\n return doc;\n });\n}\n\nexport function extractProcessorDocuments(\n project: Project,\n): ProcessorModuleDocument[] {\n const { directory: processorsDir } = getOrCreateDirectory(\n project,\n \"processors\",\n );\n return processorsDir\n .getDirectories()\n .map((dir) => getProcessorMetadata(project, dir.getBaseName()))\n .map(({ processorName, processorApps, processorType, documentTypes }) => {\n const global: ProcessorModuleGlobalState = {\n name: processorName,\n // Inverse of the mapping in processor-generator.ts: the document\n // model stores `relational`; codegen consumes `relationalDb`.\n type: processorType === \"relationalDb\" ? \"relational\" : processorType,\n documentTypes: documentTypes.map((documentType) => ({\n id: generateId(),\n documentType,\n })),\n status: \"CONFIRMED\",\n processorApps: [...processorApps],\n };\n const doc = createProcessorModuleDocument({ global });\n doc.header.name = processorName;\n return doc;\n });\n}\n\nexport function extractSubgraphDocuments(\n project: Project,\n): SubgraphModuleDocument[] {\n const { directory: subgraphsDir } = getOrCreateDirectory(\n project,\n \"subgraphs\",\n );\n return subgraphsDir\n .getDirectories()\n .map((dir) => getSubgraphMetadata(project, dir.getBaseName()).subgraphName)\n .filter(isDefined)\n .map((name) => {\n const global: SubgraphModuleGlobalState = { name, status: \"CONFIRMED\" };\n const doc = createSubgraphModuleDocument({ global });\n doc.header.name = name;\n return doc;\n });\n}\n\nexport function extractDocumentModelDocuments(\n project: Project,\n): DocumentModelDocument[] {\n const { directory: documentModelsDir } = getOrCreateDirectory(\n project,\n \"document-models\",\n );\n return readdirSync(documentModelsDir.getPath(), { withFileTypes: true })\n .map(loadDocumentModelInDir)\n .filter(isDefined)\n .map(buildDocumentModelDocument);\n}\n\nfunction buildDocumentModelDocument(\n globalState: DocumentModelGlobalState,\n): DocumentModelDocument {\n const state = documentModelDocumentModelModule.utils.createState({\n global: globalState,\n } as Partial<DocumentModelPHState>);\n const doc = documentModelDocumentModelModule.utils.createDocument(state);\n doc.header.name = globalState.name;\n return doc;\n}\n\nexport type ExtractedDocuments = {\n documentModels: DocumentModelDocument[];\n editors: DocumentEditorDocument[];\n apps: AppModuleDocument[];\n processors: ProcessorModuleDocument[];\n subgraphs: SubgraphModuleDocument[];\n};\n\n/* Mirrors `generateAll` — runs every extractor against the project and\n * returns the full set of documents keyed by module type.\n */\nexport function extractAllDocuments(project: Project): ExtractedDocuments {\n return {\n documentModels: extractDocumentModelDocuments(project),\n editors: extractEditorDocuments(project),\n apps: extractAppDocuments(project),\n processors: extractProcessorDocuments(project),\n subgraphs: extractSubgraphDocuments(project),\n };\n}\n","/**\n * Document-driven codegen wrappers. Each function takes a `PHDocument` of the\n * matching vetra type and dispatches to the generic generate* in\n * `@powerhousedao/codegen`. The state→args translation is lifted verbatim from\n * `packages/vetra/processors/codegen/document-handlers/generators/*-generator.ts`\n * so the agent-driven path and the reactor-driven path produce identical\n * output.\n *\n * Callers are responsible for `await project.save()` after one or more\n * `generate*FromDocument` calls — leaving it out here lets a CLI batch\n * multiple specs into a single save.\n */\nimport {\n generateApp,\n generateDocumentModel,\n generateEditor,\n generateProcessor,\n generateSubgraph,\n} from \"@powerhousedao/codegen\";\nimport {\n PROCESSOR_APPS,\n type ProcessorApp,\n type ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport { kebabCase } from \"change-case\";\nimport type { Project } from \"ts-morph\";\n\n/* Import from gen/ directly to bypass the top-level barrel's `hooks.ts`,\n * which pulls in browser-only `@powerhousedao/reactor-browser`. */\nimport type { AppModuleDocument } from \"../document-models/app-module/v1/gen/index.js\";\nimport type {\n DocumentEditorDocument,\n DocumentTypeItem as EditorDocumentTypeItem,\n} from \"../document-models/document-editor/v1/gen/index.js\";\nimport type {\n DocumentTypeItem as ProcessorDocumentTypeItem,\n ProcessorModuleDocument,\n} from \"../document-models/processor-module/v1/gen/index.js\";\nimport type { SubgraphModuleDocument } from \"../document-models/subgraph-module/v1/gen/index.js\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\n\nexport async function generateDocumentModelFromDocument(\n doc: DocumentModelDocument,\n project: Project,\n): Promise<void> {\n await generateDocumentModel(doc.state.global, project);\n}\n\nexport async function generateEditorFromDocument(\n doc: DocumentEditorDocument,\n project: Project,\n): Promise<void> {\n const state = doc.state.global;\n const documentTypes = state.documentTypes.map(\n (dt: EditorDocumentTypeItem) => dt.documentType,\n );\n await generateEditor(\n {\n editorName: state.name,\n documentTypes,\n editorId: kebabCase(state.name),\n },\n project,\n );\n}\n\nexport async function generateProcessorFromDocument(\n doc: ProcessorModuleDocument,\n project: Project,\n): Promise<void> {\n const state = doc.state.global;\n // Mirror processor-generator.ts:99-103: document model stores `relational`,\n // codegen expects `relationalDb`.\n let processorType: \"analytics\" | \"relationalDb\";\n if (state.type === \"analytics\") {\n processorType = \"analytics\";\n } else if (state.type === \"relational\") {\n processorType = \"relationalDb\";\n } else {\n throw new Error(`Unsupported processor type: \"${state.type}\"`);\n }\n\n const documentTypes = state.documentTypes.map(\n (dt: ProcessorDocumentTypeItem) => dt.documentType,\n );\n const processorApps = state.processorApps;\n if (!isProcessorApps(processorApps)) {\n throw new Error(`Unsupported processor apps: ${processorApps.join(\", \")}`);\n }\n await generateProcessor(\n {\n processorName: state.name,\n processorType,\n documentTypes,\n processorApps,\n },\n project,\n );\n}\n\nexport async function generateSubgraphFromDocument(\n doc: SubgraphModuleDocument,\n project: Project,\n): Promise<void> {\n await generateSubgraph(doc.state.global.name, project);\n}\n\nexport async function generateAppFromDocument(\n doc: AppModuleDocument,\n project: Project,\n): Promise<void> {\n const state = doc.state.global;\n await generateApp(\n {\n appName: state.name,\n appId: kebabCase(state.name),\n allowedDocumentTypes: state.allowedDocumentTypes ?? [],\n isDragAndDropEnabled: state.isDragAndDropEnabled,\n },\n project,\n );\n}\n\nfunction isProcessorApps(input: readonly string[]): input is ProcessorApps {\n if (input.length === 0) return false;\n if (new Set(input).size !== input.length) return false;\n if (!input.every((i) => PROCESSOR_APPS.includes(i as ProcessorApp))) {\n return false;\n }\n return true;\n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AO;AACT"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../codegen/extract.ts","../../codegen/generate-from-document.ts"],"sourcesContent":["/**\n * Inverse of the `generate*` functions in `@powerhousedao/codegen`.\n *\n * `generate*` reads source-of-truth documents and writes code into the project.\n * `extract*` reads the project's existing code/files and produces the\n * `powerhouse/*` documents that would have produced that code. Intended as a\n * one-shot migration step toward the documents-as-source-of-truth model: run\n * extraction, save the documents into `specs/`, and from then on regenerate\n * from the specs.\n */\nimport {\n generateId,\n type DocumentModelDocument,\n type DocumentModelGlobalState,\n type DocumentModelPHState,\n} from \"@powerhousedao/shared/document-model\";\nimport {\n getAppMetadata,\n getEditorDirNames,\n getEditorMetadata,\n getOrCreateDirectory,\n getProcessorDirNames,\n getProcessorMetadata,\n getSubgraphDirNames,\n getSubgraphMetadata,\n loadDocumentModelInDir,\n} from \"@powerhousedao/codegen/utils\";\nimport { documentModelDocumentModelModule } from \"document-model\";\nimport { readdirSync } from \"node:fs\";\nimport type { Project } from \"ts-morph\";\n\nconst isDefined = <T>(v: T | undefined | null): v is T => v != null;\n\n/* Import from gen/ directly to bypass the top-level barrel's `hooks.ts`,\n * which pulls in browser-only `@powerhousedao/reactor-browser`. */\nimport {\n createAppModuleDocument,\n type AppModuleDocument,\n type AppModuleGlobalState,\n} from \"../document-models/app-module/v1/gen/index.js\";\nimport {\n createDocumentEditorDocument,\n type DocumentEditorDocument,\n type DocumentEditorGlobalState,\n} from \"../document-models/document-editor/v1/gen/index.js\";\nimport {\n createProcessorModuleDocument,\n type ProcessorModuleDocument,\n type ProcessorModuleGlobalState,\n} from \"../document-models/processor-module/v1/gen/index.js\";\nimport {\n createSubgraphModuleDocument,\n type SubgraphModuleDocument,\n type SubgraphModuleGlobalState,\n} from \"../document-models/subgraph-module/v1/gen/index.js\";\n\n/* Builds a `powerhouse/document-editor` document for each editor in the\n * project's `editors/` directory. Drive editors (powerhouse/document-drive)\n * are excluded — those are handled by `extractAppDocuments`, matching how\n * `generateAllEditors` / `generateAllApps` are split.\n */\nexport function extractEditorDocuments(\n project: Project,\n): DocumentEditorDocument[] {\n return getEditorDirNames(project)\n .map((dirName) => getEditorMetadata(project, dirName))\n .filter(isDefined)\n .filter(\n ({ documentTypes }) =>\n !documentTypes.includes(\"powerhouse/document-drive\"),\n )\n .map(({ name, documentTypes }) => {\n const global: DocumentEditorGlobalState = {\n name,\n documentTypes: documentTypes.map((documentType) => ({\n id: generateId(),\n documentType,\n })),\n status: \"CONFIRMED\",\n };\n const doc = createDocumentEditorDocument({ global });\n doc.header.name = name;\n return doc;\n });\n}\n\n/* Builds a `powerhouse/app` document for each drive editor (an editor whose\n * documentTypes include `powerhouse/document-drive`) — same selection\n * predicate used by `generateAllApps`.\n */\nexport function extractAppDocuments(project: Project): AppModuleDocument[] {\n return getEditorDirNames(project)\n .map((dirName) => getAppMetadata(project, dirName))\n .filter(isDefined)\n .map(({ name, allowedDocumentTypes, isDragAndDropEnabled }) => {\n const global: AppModuleGlobalState = {\n name,\n status: \"CONFIRMED\",\n allowedDocumentTypes:\n allowedDocumentTypes.length > 0 ? allowedDocumentTypes : null,\n isDragAndDropEnabled: isDragAndDropEnabled ?? true,\n };\n const doc = createAppModuleDocument({ global });\n doc.header.name = name;\n return doc;\n });\n}\n\nexport function extractProcessorDocuments(\n project: Project,\n): ProcessorModuleDocument[] {\n return getProcessorDirNames(project)\n .map((dirName) => getProcessorMetadata(project, dirName))\n .map(({ processorName, processorApps, processorType, documentTypes }) => {\n const global: ProcessorModuleGlobalState = {\n name: processorName,\n // Inverse of the mapping in processor-generator.ts: the document\n // model stores `relational`; codegen consumes `relationalDb`.\n type: processorType === \"relationalDb\" ? \"relational\" : processorType,\n documentTypes: documentTypes.map((documentType) => ({\n id: generateId(),\n documentType,\n })),\n status: \"CONFIRMED\",\n processorApps: [...processorApps],\n };\n const doc = createProcessorModuleDocument({ global });\n doc.header.name = processorName;\n return doc;\n });\n}\n\nexport function extractSubgraphDocuments(\n project: Project,\n): SubgraphModuleDocument[] {\n return getSubgraphDirNames(project)\n .map((dirName) => getSubgraphMetadata(project, dirName).subgraphName)\n .filter(isDefined)\n .map((name) => {\n const global: SubgraphModuleGlobalState = { name, status: \"CONFIRMED\" };\n const doc = createSubgraphModuleDocument({ global });\n doc.header.name = name;\n return doc;\n });\n}\n\nexport function extractDocumentModelDocuments(\n project: Project,\n): DocumentModelDocument[] {\n const { directory: documentModelsDir } = getOrCreateDirectory(\n project,\n \"document-models\",\n );\n return readdirSync(documentModelsDir.getPath(), { withFileTypes: true })\n .map(loadDocumentModelInDir)\n .filter(isDefined)\n .map(buildDocumentModelDocument);\n}\n\nfunction buildDocumentModelDocument(\n globalState: DocumentModelGlobalState,\n): DocumentModelDocument {\n const state = documentModelDocumentModelModule.utils.createState({\n global: globalState,\n } as Partial<DocumentModelPHState>);\n const doc = documentModelDocumentModelModule.utils.createDocument(state);\n doc.header.name = globalState.name;\n return doc;\n}\n\nexport type ExtractedDocuments = {\n documentModels: DocumentModelDocument[];\n editors: DocumentEditorDocument[];\n apps: AppModuleDocument[];\n processors: ProcessorModuleDocument[];\n subgraphs: SubgraphModuleDocument[];\n};\n\n/* Mirrors `generateAll` — runs every extractor against the project and\n * returns the full set of documents keyed by module type.\n */\nexport function extractAllDocuments(project: Project): ExtractedDocuments {\n return {\n documentModels: extractDocumentModelDocuments(project),\n editors: extractEditorDocuments(project),\n apps: extractAppDocuments(project),\n processors: extractProcessorDocuments(project),\n subgraphs: extractSubgraphDocuments(project),\n };\n}\n","/**\n * Document-driven codegen wrappers. Each function takes a `PHDocument` of the\n * matching vetra type and dispatches to the generic generate* in\n * `@powerhousedao/codegen`. The state→args translation is lifted verbatim from\n * `packages/vetra/processors/codegen/document-handlers/generators/*-generator.ts`\n * so the agent-driven path and the reactor-driven path produce identical\n * output.\n *\n * Callers are responsible for `await project.save()` after one or more\n * `generate*FromDocument` calls — leaving it out here lets a CLI batch\n * multiple specs into a single save.\n */\nimport {\n generateApp,\n generateDocumentModel,\n generateEditor,\n generateProcessor,\n generateSubgraph,\n} from \"@powerhousedao/codegen\";\nimport {\n PROCESSOR_APPS,\n type ProcessorApp,\n type ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport { kebabCase } from \"change-case\";\nimport type { Project } from \"ts-morph\";\n\n/* Import from gen/ directly to bypass the top-level barrel's `hooks.ts`,\n * which pulls in browser-only `@powerhousedao/reactor-browser`. */\nimport type { AppModuleDocument } from \"../document-models/app-module/v1/gen/index.js\";\nimport type {\n DocumentEditorDocument,\n DocumentTypeItem as EditorDocumentTypeItem,\n} from \"../document-models/document-editor/v1/gen/index.js\";\nimport type {\n DocumentTypeItem as ProcessorDocumentTypeItem,\n ProcessorModuleDocument,\n} from \"../document-models/processor-module/v1/gen/index.js\";\nimport type { SubgraphModuleDocument } from \"../document-models/subgraph-module/v1/gen/index.js\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\n\nexport async function generateDocumentModelFromDocument(\n doc: DocumentModelDocument,\n project: Project,\n): Promise<void> {\n await generateDocumentModel(doc.state.global, project);\n}\n\nexport async function generateEditorFromDocument(\n doc: DocumentEditorDocument,\n project: Project,\n): Promise<void> {\n const state = doc.state.global;\n const documentTypes = state.documentTypes.map(\n (dt: EditorDocumentTypeItem) => dt.documentType,\n );\n await generateEditor(\n {\n editorName: state.name,\n documentTypes,\n editorId: kebabCase(state.name),\n },\n project,\n );\n}\n\nexport async function generateProcessorFromDocument(\n doc: ProcessorModuleDocument,\n project: Project,\n): Promise<void> {\n const state = doc.state.global;\n // Mirror processor-generator.ts:99-103: document model stores `relational`,\n // codegen expects `relationalDb`.\n let processorType: \"analytics\" | \"relationalDb\";\n if (state.type === \"analytics\") {\n processorType = \"analytics\";\n } else if (state.type === \"relational\") {\n processorType = \"relationalDb\";\n } else {\n throw new Error(`Unsupported processor type: \"${state.type}\"`);\n }\n\n const documentTypes = state.documentTypes.map(\n (dt: ProcessorDocumentTypeItem) => dt.documentType,\n );\n const processorApps = state.processorApps;\n if (!isProcessorApps(processorApps)) {\n throw new Error(`Unsupported processor apps: ${processorApps.join(\", \")}`);\n }\n await generateProcessor(\n {\n processorName: state.name,\n processorType,\n documentTypes,\n processorApps,\n },\n project,\n );\n}\n\nexport async function generateSubgraphFromDocument(\n doc: SubgraphModuleDocument,\n project: Project,\n): Promise<void> {\n await generateSubgraph(doc.state.global.name, project);\n}\n\nexport async function generateAppFromDocument(\n doc: AppModuleDocument,\n project: Project,\n): Promise<void> {\n const state = doc.state.global;\n await generateApp(\n {\n appName: state.name,\n appId: kebabCase(state.name),\n allowedDocumentTypes: state.allowedDocumentTypes ?? [],\n isDragAndDropEnabled: state.isDragAndDropEnabled,\n },\n project,\n );\n}\n\nfunction isProcessorApps(input: readonly string[]): input is ProcessorApps {\n if (input.length === 0) return false;\n if (new Set(input).size !== input.length) return false;\n if (!input.every((i) => PROCESSOR_APPS.includes(i as ProcessorApp))) {\n return false;\n }\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,aAAgB,MAAoC,KAAK;AA8B/D,SAAgB,uBACd,SAC0B;CAC1B,OAAO,kBAAkB,OAAO,CAAC,CAC9B,KAAK,YAAY,kBAAkB,SAAS,OAAO,CAAC,CAAC,CACrD,OAAO,SAAS,CAAC,CACjB,QACE,EAAE,oBACD,CAAC,cAAc,SAAS,2BAA2B,CACvD,CAAC,CACA,KAAK,EAAE,MAAM,oBAAoB;EAChC,MAAM,SAAoC;GACxC;GACA,eAAe,cAAc,KAAK,kBAAkB;IAClD,IAAI,WAAW;IACf;GACF,EAAE;GACF,QAAQ;EACV;EACA,MAAM,MAAM,6BAA6B,EAAE,OAAO,CAAC;EACnD,IAAI,OAAO,OAAO;EAClB,OAAO;CACT,CAAC;AACL;AAMA,SAAgB,oBAAoB,SAAuC;CACzE,OAAO,kBAAkB,OAAO,CAAC,CAC9B,KAAK,YAAY,eAAe,SAAS,OAAO,CAAC,CAAC,CAClD,OAAO,SAAS,CAAC,CACjB,KA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;EACE,SAAS,MAAM;EACf,OAAO,UAAU,MAAM,IAAI;EAC3B,sBAAsB,MAAM,wBAAwB,CAAC;EACrD,sBAAsB,MAAM;CAC9B,GACA,OACF;AACF;AAEA,SAAS,gBAAgB,OAAkD;CACzE,IAAI,MAAM,WAAW,GAAG,OAAO;CAC/B,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,SAAS,MAAM,QAAQ,OAAO;CACjD,IAAI,CAAC,MAAM,OAAO,MAAM,eAAe,SAAS,CAAiB,CAAC,GAChE,OAAO;CAET,OAAO;AACT"}
|
package/dist/codegen/spec.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getDocument, c as getDocuments, d as getSpecEntry, f as listSpecDocumentTypes, g as stripLeadingDot, h as specPath, i as deleteDocument, l as validateActions, m as specDir, n as addActionsAndSave, o as getDocumentModelSchema, p as saveSpec, r as createDocument, s as getDocumentModels, t as addActions, u as SPECS_DIRNAME } from "../spec-api-
|
|
1
|
+
import { a as getDocument, c as getDocuments, d as getSpecEntry, f as listSpecDocumentTypes, g as stripLeadingDot, h as specPath, i as deleteDocument, l as validateActions, m as specDir, n as addActionsAndSave, o as getDocumentModelSchema, p as saveSpec, r as createDocument, s as getDocumentModels, t as addActions, u as SPECS_DIRNAME } from "../spec-api-B01RpZM-.js";
|
|
2
2
|
export { SPECS_DIRNAME, addActions, addActionsAndSave, createDocument, deleteDocument, getDocument, getDocumentModelSchema, getDocumentModels, getDocuments, getSpecEntry, listSpecDocumentTypes, saveSpec, specDir, specPath, stripLeadingDot, validateActions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as AppModuleDocument, A as isAppModuleDocument, B as setAppStatus, C as defaultLocalState, D as AppModulePHStateSchema, E as AppModuleDocumentSchema, F as setDragAndDropEnabled, G as AppModuleDndOperationsAction, H as AppModuleController, I as addDocumentType, J as AppModuleBaseOperationsAction, K as SetDragAndDropEnabledAction, L as creators_d_exports, M as documentModel, N as AppModuleDndOperationsOperations, O as assertIsAppModuleDocument, P as creators_d_exports$1, Q as SetDocumentTypesAction, R as removeDocumentType, S as defaultGlobalState, T as AppModuleDocumentHeaderSchema, U as AppModuleBaseOperationsOperations, V as setDocumentTypes, W as AppModuleAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, _ as useAppModuleDocumentsInSelectedDrive, _t as StatusType, a as RemoveDocumentTypeInputSchema, at as Incremental, b as createAppModuleDocument, c as SetDocumentTypesInputSchema, ct as MakeMaybe, d as definedNonNullAnySchema, dt as RemoveDocumentTypeInput, et as AppModuleLocalState, f as isDefinedNonNullAny, ft as Scalars, g as useAppModuleDocumentById, gt as SetDragAndDropEnabledInput, h as AppModule, ht as SetDocumentTypesInput, i as AppModuleStateSchema, it as Exact, j as isAppModuleState, k as assertIsAppModuleState, l as SetDragAndDropEnabledInputSchema, lt as MakeOptional, m as utils, mt as SetAppStatusInput, n as initialLocalState, nt as AddDocumentTypeInput, o as SetAppNameInputSchema, ot as InputMaybe, p as reducer, pt as SetAppNameInput, q as AddDocumentTypeAction, r as AddDocumentTypeInputSchema, rt as AppModuleState, s as SetAppStatusInputSchema, st as MakeEmpty, t as initialGlobalState, tt as AppModulePHState, u as StatusTypeSchema, ut as Maybe, v as useAppModuleDocumentsInSelectedFolder, w as defaultPHState, x as createState, y as useSelectedAppModuleDocument, z as setAppName } from "../../index-
|
|
2
|
-
import { a as appModuleDocumentType, i as actions, n as latestVersion, r as supportedVersions, t as appModuleUpgradeManifest } from "../../index-
|
|
1
|
+
import { $ as AppModuleDocument, A as isAppModuleDocument, B as setAppStatus, C as defaultLocalState, D as AppModulePHStateSchema, E as AppModuleDocumentSchema, F as setDragAndDropEnabled, G as AppModuleDndOperationsAction, H as AppModuleController, I as addDocumentType, J as AppModuleBaseOperationsAction, K as SetDragAndDropEnabledAction, L as creators_d_exports, M as documentModel, N as AppModuleDndOperationsOperations, O as assertIsAppModuleDocument, P as creators_d_exports$1, Q as SetDocumentTypesAction, R as removeDocumentType, S as defaultGlobalState, T as AppModuleDocumentHeaderSchema, U as AppModuleBaseOperationsOperations, V as setDocumentTypes, W as AppModuleAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, _ as useAppModuleDocumentsInSelectedDrive, _t as StatusType, a as RemoveDocumentTypeInputSchema, at as Incremental, b as createAppModuleDocument, c as SetDocumentTypesInputSchema, ct as MakeMaybe, d as definedNonNullAnySchema, dt as RemoveDocumentTypeInput, et as AppModuleLocalState, f as isDefinedNonNullAny, ft as Scalars, g as useAppModuleDocumentById, gt as SetDragAndDropEnabledInput, h as AppModule, ht as SetDocumentTypesInput, i as AppModuleStateSchema, it as Exact, j as isAppModuleState, k as assertIsAppModuleState, l as SetDragAndDropEnabledInputSchema, lt as MakeOptional, m as utils, mt as SetAppStatusInput, n as initialLocalState, nt as AddDocumentTypeInput, o as SetAppNameInputSchema, ot as InputMaybe, p as reducer, pt as SetAppNameInput, q as AddDocumentTypeAction, r as AddDocumentTypeInputSchema, rt as AppModuleState, s as SetAppStatusInputSchema, st as MakeEmpty, t as initialGlobalState, tt as AppModulePHState, u as StatusTypeSchema, ut as Maybe, v as useAppModuleDocumentsInSelectedFolder, w as defaultPHState, x as createState, y as useSelectedAppModuleDocument, z as setAppName } from "../../index-mYlWU47F.js";
|
|
2
|
+
import { a as appModuleDocumentType, i as actions, n as latestVersion, r as supportedVersions, t as appModuleUpgradeManifest } from "../../index-CKCays-S.js";
|
|
3
3
|
export { AddDocumentTypeAction, AddDocumentTypeInput, AddDocumentTypeInputSchema, AppModule, AppModuleAction, AppModuleBaseOperationsAction, AppModuleBaseOperationsOperations, AppModuleController, AppModuleDndOperationsAction, AppModuleDndOperationsOperations, type AppModuleDocument, AppModuleDocumentHeaderSchema, AppModuleDocumentSchema, type AppModuleState as AppModuleGlobalState, AppModuleState, type AppModuleLocalState, type AppModulePHState, AppModulePHStateSchema, AppModuleStateSchema, Exact, Incremental, InputMaybe, MakeEmpty, MakeMaybe, MakeOptional, Maybe, RemoveDocumentTypeAction, RemoveDocumentTypeInput, RemoveDocumentTypeInputSchema, Scalars, SetAppNameAction, SetAppNameInput, SetAppNameInputSchema, SetAppStatusAction, SetAppStatusInput, SetAppStatusInputSchema, SetDocumentTypesAction, SetDocumentTypesInput, SetDocumentTypesInputSchema, SetDragAndDropEnabledAction, SetDragAndDropEnabledInput, SetDragAndDropEnabledInputSchema, StatusType, StatusTypeSchema, actions, addDocumentType, creators_d_exports as appModuleBaseOperationsActions, creators_d_exports$1 as appModuleDndOperationsActions, appModuleDocumentType, appModuleUpgradeManifest, assertIsAppModuleDocument, assertIsAppModuleState, createAppModuleDocument, createState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, documentModel, initialGlobalState, initialLocalState, isAppModuleDocument, isAppModuleState, isDefinedNonNullAny, latestVersion, reducer, removeDocumentType, setAppName, setAppStatus, setDocumentTypes, setDragAndDropEnabled, supportedVersions, useAppModuleDocumentById, useAppModuleDocumentsInSelectedDrive, useAppModuleDocumentsInSelectedFolder, useSelectedAppModuleDocument, utils };
|
|
4
4
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as definedNonNullAnySchema, C as AppModuleStateSchema, D as SetDocumentTypesInputSchema, E as SetAppStatusInputSchema, O as SetDragAndDropEnabledInputSchema, S as AddDocumentTypeInputSchema, T as SetAppNameInputSchema, _ as creators_exports, a as AppModuleDocumentSchema, b as setAppStatus, c as assertIsAppModuleState, d as appModuleDocumentType, f as reducer, g as addDocumentType, h as setDragAndDropEnabled, i as AppModuleDocumentHeaderSchema, j as isDefinedNonNullAny, k as StatusTypeSchema, l as isAppModuleDocument, m as creators_exports$1, n as initialLocalState, o as AppModulePHStateSchema, p as actions, s as assertIsAppModuleDocument, t as initialGlobalState, u as isAppModuleState, v as removeDocumentType, w as RemoveDocumentTypeInputSchema, x as setDocumentTypes, y as setAppName } from "../../utils-COP7hJ-K.js";
|
|
2
|
-
import { n as utils, r as documentModel, t as AppModule } from "../../module-
|
|
2
|
+
import { n as utils, r as documentModel, t as AppModule } from "../../module-d1-9VDGb.js";
|
|
3
3
|
import { a as defaultPHState, i as defaultLocalState, n as createState, r as defaultGlobalState, t as createAppModuleDocument } from "../../ph-factories-CgoFCmG0.js";
|
|
4
4
|
import { n as latestVersion, r as supportedVersions, t as appModuleUpgradeManifest } from "../../upgrade-manifest-DLxSL23q.js";
|
|
5
5
|
import { PHDocumentController } from "document-model";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as AppModule } from "../index-
|
|
1
|
+
import { h as AppModule } from "../index-mYlWU47F.js";
|
|
2
2
|
import { m as DocumentEditor } from "../index-D6Ai0OOc.js";
|
|
3
3
|
import { _ as ProcessorModule } from "../index-B52jv-LY.js";
|
|
4
4
|
import { d as SubgraphModule } from "../index-DplUuZMT.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AppModule } from "../module-
|
|
1
|
+
import { t as AppModule } from "../module-d1-9VDGb.js";
|
|
2
2
|
import { t as DocumentEditor } from "../module-2JZcvfVs.js";
|
|
3
3
|
import { t as ProcessorModule } from "../module-Db8mmgzN.js";
|
|
4
4
|
import { t as SubgraphModule } from "../module-hLzF5tCL.js";
|
package/dist/editors/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as AppModuleDocument, W as AppModuleAction } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { $ as AppModuleDocument, W as AppModuleAction } from "../index-mYlWU47F.js";
|
|
2
|
+
import "../index-CKCays-S.js";
|
|
3
3
|
import { G as DocumentEditorDocument, z as DocumentEditorAction } from "../index-D6Ai0OOc.js";
|
|
4
4
|
import "../index-7hPKQROx.js";
|
|
5
5
|
import { G as ProcessorModuleAction, et as ProcessorModuleDocument } from "../index-B52jv-LY.js";
|
|
@@ -26,12 +26,12 @@ const codegenFactoryBuilder = (module) => {
|
|
|
26
26
|
const [{ buildTsMorphProject }, { getConfig }, { CodegenProcessor }] = await Promise.all([
|
|
27
27
|
import("@powerhousedao/codegen/utils"),
|
|
28
28
|
import("@powerhousedao/config/node"),
|
|
29
|
-
import("./processor-
|
|
29
|
+
import("./processor-kRJ48ypM.js").then((n) => n.n)
|
|
30
30
|
]);
|
|
31
31
|
const config = getConfig();
|
|
32
32
|
const cwd = process.cwd();
|
|
33
33
|
return [{
|
|
34
|
-
processor: new CodegenProcessor(buildTsMorphProject(cwd), config, cwd, vetraConfig?.interactive),
|
|
34
|
+
processor: new CodegenProcessor(buildTsMorphProject(cwd), config, cwd, driveHeader.id, module.client, vetraConfig?.interactive),
|
|
35
35
|
filter: {
|
|
36
36
|
branch: ["main"],
|
|
37
37
|
documentId: ["*"],
|
|
@@ -51,4 +51,4 @@ const codegenFactoryBuilder = (module) => {
|
|
|
51
51
|
//#endregion
|
|
52
52
|
export { codegenFactoryBuilder as t };
|
|
53
53
|
|
|
54
|
-
//# sourceMappingURL=factory-
|
|
54
|
+
//# sourceMappingURL=factory-BLQkEgxk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory-
|
|
1
|
+
{"version":3,"file":"factory-BLQkEgxk.js","names":[],"sources":["../processors/codegen/factory.ts"],"sourcesContent":["import type { VetraProcessorConfigType } from \"@powerhousedao/config\";\nimport { VETRA_PROCESSOR_CONFIG_KEY } from \"@powerhousedao/config\";\nimport type {\n IProcessorHostModule,\n ProcessorFactoryBuilder,\n ProcessorRecord,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHDocumentHeader } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"./logger.js\";\n\n/**\n * Determines if a drive header matches the Vetra drive criteria.\n * @param driveHeader - The drive header to check\n * @param explicitDriveId - Optional explicit drive ID from config (if set, uses exact match)\n * @returns true if the drive is a Vetra drive, false otherwise\n */\nfunction isDriveVetra(\n driveHeader: PHDocumentHeader,\n driveIdFromConfig?: string,\n): boolean {\n // If explicit drive ID is configured, use exact match\n if (driveIdFromConfig) {\n return (\n driveHeader.slug === driveIdFromConfig ||\n driveHeader.id === driveIdFromConfig\n );\n }\n\n // Otherwise, check if slug/id matches Vetra pattern\n // Matches \"vetra\" exactly or IDs starting with \"vetra-\" (case-insensitive)\n const matchesPattern = (identifier: string): boolean => {\n const lower = identifier.toLowerCase();\n return lower === \"vetra\" || lower.startsWith(\"vetra-\");\n };\n\n return matchesPattern(driveHeader.slug) || matchesPattern(driveHeader.id);\n}\n\nexport const codegenFactoryBuilder: ProcessorFactoryBuilder = (\n module: IProcessorHostModule,\n) => {\n return async (driveHeader: PHDocumentHeader): Promise<ProcessorRecord[]> => {\n const processorsConfig = module.config ?? new Map<string, unknown>();\n const vetraConfig = processorsConfig.get(VETRA_PROCESSOR_CONFIG_KEY) as\n | VetraProcessorConfigType\n | undefined;\n\n // Exit early if it's not a vetra drive\n if (!isDriveVetra(driveHeader, vetraConfig?.driveId)) {\n logger.debug(\n `Drive ${driveHeader.slug} is not a Vetra drive, skipping codegen processor`,\n );\n return [];\n }\n\n logger.info(\n `Drive ${driveHeader.slug} is a Vetra drive, using codegen processor`,\n );\n\n // Lazy-load codegen only once a Vetra drive is confirmed.\n const [{ buildTsMorphProject }, { getConfig }, { CodegenProcessor }] =\n await Promise.all([\n import(\"@powerhousedao/codegen/utils\"),\n import(\"@powerhousedao/config/node\"),\n import(\"./processor.js\"),\n ]);\n\n const config = getConfig();\n const cwd = process.cwd();\n\n /* Use one instance of ts-morph project, which handles race conditions */\n const project = buildTsMorphProject(cwd);\n const processor = new CodegenProcessor(\n project,\n config,\n cwd,\n driveHeader.id,\n module.client,\n vetraConfig?.interactive,\n );\n return [\n {\n processor,\n filter: {\n branch: [\"main\"],\n documentId: [\"*\"],\n documentType: [\n \"powerhouse/document-model\",\n \"powerhouse/package\",\n \"powerhouse/document-editor\",\n \"powerhouse/subgraph\",\n \"powerhouse/processor\",\n \"powerhouse/app\",\n ],\n scope: [\"global\"],\n },\n },\n ];\n };\n};\n"],"mappings":";;;;;;;;;AAgBA,SAAS,aACP,aACA,mBACS;CAET,IAAI,mBACF,OACE,YAAY,SAAS,qBACrB,YAAY,OAAO;CAMvB,MAAM,kBAAkB,eAAgC;EACtD,MAAM,QAAQ,WAAW,YAAY;EACrC,OAAO,UAAU,WAAW,MAAM,WAAW,QAAQ;CACvD;CAEA,OAAO,eAAe,YAAY,IAAI,KAAK,eAAe,YAAY,EAAE;AAC1E;AAEA,MAAa,yBACX,WACG;CACH,OAAO,OAAO,gBAA8D;EAE1E,MAAM,eADmB,OAAO,0BAAU,IAAI,IAAqB,EAAA,CAC9B,IAAI,0BAA0B;EAKnE,IAAI,CAAC,aAAa,aAAa,aAAa,OAAO,GAAG;GACpD,OAAO,MACL,SAAS,YAAY,KAAK,kDAC5B;GACA,OAAO,CAAC;EACV;EAEA,OAAO,KACL,SAAS,YAAY,KAAK,2CAC5B;EAGA,MAAM,CAAC,EAAE,uBAAuB,EAAE,aAAa,EAAE,sBAC/C,MAAM,QAAQ,IAAI;GAChB,OAAO;GACP,OAAO;GACP,OAAO,0BAAiB,CAAA,MAAA,MAAA,EAAA,CAAA;EAC1B,CAAC;EAEH,MAAM,SAAS,UAAU;EACzB,MAAM,MAAM,QAAQ,IAAI;EAYxB,OAAO,CACL;GACE,WAAA,IAVkB,iBADN,oBAAoB,GAE5B,GACN,QACA,KACA,YAAY,IACZ,OAAO,QACP,aAAa,WAIH;GACR,QAAQ;IACN,QAAQ,CAAC,MAAM;IACf,YAAY,CAAC,GAAG;IAChB,cAAc;KACZ;KACA;KACA;KACA;KACA;KACA;IACF;IACA,OAAO,CAAC,QAAQ;GAClB;EACF,CACF;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as SetDragAndDropEnabledAction, Q as SetDocumentTypesAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, dt as RemoveDocumentTypeInput, gt as SetDragAndDropEnabledInput, ht as SetDocumentTypesInput, mt as SetAppStatusInput, nt as AddDocumentTypeInput, pt as SetAppNameInput, q as AddDocumentTypeAction } from "./index-
|
|
1
|
+
import { K as SetDragAndDropEnabledAction, Q as SetDocumentTypesAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, dt as RemoveDocumentTypeInput, gt as SetDragAndDropEnabledInput, ht as SetDocumentTypesInput, mt as SetAppStatusInput, nt as AddDocumentTypeInput, pt as SetAppNameInput, q as AddDocumentTypeAction } from "./index-mYlWU47F.js";
|
|
2
2
|
import { UpgradeManifest } from "document-model";
|
|
3
3
|
//#region document-models/app-module/v1/gen/document-type.d.ts
|
|
4
4
|
/**
|
|
@@ -32,4 +32,4 @@ declare const appModuleUpgradeManifest: UpgradeManifest<typeof supportedVersions
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { appModuleDocumentType as a, actions as i, latestVersion as n, supportedVersions as r, appModuleUpgradeManifest as t };
|
|
34
34
|
export {};
|
|
35
|
-
//# sourceMappingURL=index-
|
|
35
|
+
//# sourceMappingURL=index-CKCays-S.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-CKCays-S.d.ts","names":[],"sources":["../document-models/app-module/v1/gen/document-type.ts","../document-models/app-module/v1/actions.ts","../document-models/app-module/upgrades/versions.ts","../document-models/app-module/upgrades/upgrade-manifest.ts"],"mappings":";;;;;;;cAIa;;;;cCQA;;;;;;sBAAA;;;;;;;;;cCZA;cAEA;;;cCKA,0BAA0B,uBAC9B"}
|
|
@@ -154,7 +154,7 @@ type AppModuleState = {
|
|
|
154
154
|
allowedDocumentTypes: Maybe<Array<Scalars["String"]["output"]>>;
|
|
155
155
|
/** Whether the app surface accepts dropped files from the user. Defaults to true. */
|
|
156
156
|
isDragAndDropEnabled: Scalars["Boolean"]["output"];
|
|
157
|
-
/** Display name of the drive app. Also used as the source for the generated folder name under `
|
|
157
|
+
/** Display name of the drive app. Also used as the source for the generated folder name under `editors/`. */
|
|
158
158
|
name: Scalars["String"]["output"];
|
|
159
159
|
/** Lifecycle status. While DRAFT the app definition is editable and codegen is skipped; switching to CONFIRMED triggers app scaffold generation. */
|
|
160
160
|
status: StatusType;
|
|
@@ -385,4 +385,4 @@ declare const initialLocalState: AppModuleLocalState;
|
|
|
385
385
|
//#endregion
|
|
386
386
|
export { AppModuleDocument as $, isAppModuleDocument as A, setAppStatus as B, defaultLocalState as C, AppModulePHStateSchema as D, AppModuleDocumentSchema as E, setDragAndDropEnabled as F, AppModuleDndOperationsAction as G, AppModuleController as H, addDocumentType as I, AppModuleBaseOperationsAction as J, SetDragAndDropEnabledAction as K, creators_d_exports$1 as L, documentModel as M, AppModuleDndOperationsOperations as N, assertIsAppModuleDocument as O, creators_d_exports as P, SetDocumentTypesAction as Q, removeDocumentType as R, defaultGlobalState as S, AppModuleDocumentHeaderSchema as T, AppModuleBaseOperationsOperations as U, setDocumentTypes as V, AppModuleAction as W, SetAppNameAction as X, RemoveDocumentTypeAction as Y, SetAppStatusAction as Z, useAppModuleDocumentsInSelectedDrive as _, StatusType as _t, RemoveDocumentTypeInputSchema as a, Incremental as at, createAppModuleDocument as b, SetDocumentTypesInputSchema as c, MakeMaybe as ct, definedNonNullAnySchema as d, RemoveDocumentTypeInput as dt, AppModuleLocalState as et, isDefinedNonNullAny as f, Scalars as ft, useAppModuleDocumentById as g, SetDragAndDropEnabledInput as gt, AppModule as h, SetDocumentTypesInput as ht, AppModuleStateSchema as i, Exact as it, isAppModuleState as j, assertIsAppModuleState as k, SetDragAndDropEnabledInputSchema as l, MakeOptional as lt, utils as m, SetAppStatusInput as mt, initialLocalState as n, AddDocumentTypeInput as nt, SetAppNameInputSchema as o, InputMaybe as ot, reducer as p, SetAppNameInput as pt, AddDocumentTypeAction as q, AddDocumentTypeInputSchema as r, AppModuleState as rt, SetAppStatusInputSchema as s, MakeEmpty as st, initialGlobalState as t, AppModulePHState as tt, StatusTypeSchema as u, Maybe as ut, useAppModuleDocumentsInSelectedFolder as v, defaultPHState as w, createState$1 as x, useSelectedAppModuleDocument as y, setAppName as z };
|
|
387
387
|
export {};
|
|
388
|
-
//# sourceMappingURL=index-
|
|
388
|
+
//# sourceMappingURL=index-mYlWU47F.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-mYlWU47F.d.ts","names":[],"sources":["../document-models/app-module/v1/gen/schema/types.ts","../document-models/app-module/v1/gen/types.ts","../document-models/app-module/v1/gen/base-operations/actions.ts","../document-models/app-module/v1/gen/dnd-operations/actions.ts","../document-models/app-module/v1/gen/actions.ts","../document-models/app-module/v1/gen/base-operations/operations.ts","../document-models/app-module/v1/gen/controller.ts","../document-models/app-module/v1/gen/base-operations/creators.ts","../document-models/app-module/v1/gen/dnd-operations/creators.ts","../document-models/app-module/v1/gen/dnd-operations/operations.ts","../document-models/app-module/v1/gen/document-model.ts","../document-models/app-module/v1/gen/document-schema.ts","../document-models/app-module/v1/gen/ph-factories.ts","../document-models/app-module/v1/hooks.ts","../document-models/app-module/v1/module.ts","../document-models/app-module/v1/utils.ts","../document-models/app-module/v1/gen/reducer.ts","../document-models/app-module/v1/gen/schema/zod.ts","../document-models/app-module/v1/gen/utils.ts"],"mappings":";;;;;KAAY,MAAM,KAAK;KACX,WAAW,KAAK;KAChB,MAAM;GAAa;QAC5B,WAAW,IAAI,EAAE;KAER,aAAa,GAAG,gBAAgB,KAAK,KAAK,GAAG,QACtD,UAAU,KAAK,MAAM,EAAE;KAEd,UAAU,GAAG,gBAAgB,KAAK,KAAK,GAAG,QACnD,UAAU,IAAI,MAAM,EAAE;KAEb,UACV;GAAa;GACb,gBAAgB,QACX,KAAK;KACA,YAAY,KACpB,OAEG,WAAW,KAAK,4CAA4C,EAAE;;KAGzD;EACV;IAAM;IAAe;;EACrB;IAAU;IAAe;;EACzB;IAAW;IAAgB;;EAC3B;IAAO;IAAe;;EACtB;IAAS;IAAe;;EACxB;IAAW;IAAgC;;EAC3C;IACE;MAAS;MAAe;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A;cAIvB,kBAAgB,IAAA;;;;iBAEb,8BAA8B,IAAE,UAC9C,WAAW;iBAOG,wBAAwB,IAAE,UACxC,WAAW;iBAWG,iCAAiC,IAAE,UACjD,WAAW;iBAOG,yBAAyB,IAAE,UACzC,WAAW;iBAOG,2BAA2B,IAAE,UAC3C,WAAW;iBAOG,+BAA+B,IAAE,UAC/C,WAAW;iBAOG,oCAAoC,IAAE,UACpD,WAAW;;;cCzDA,oBAAoB;cAMpB,mBAAmB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { K as SetDragAndDropEnabledAction, Q as SetDocumentTypesAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, dt as RemoveDocumentTypeInput, gt as SetDragAndDropEnabledInput, ht as SetDocumentTypesInput, mt as SetAppStatusInput, nt as AddDocumentTypeInput, pt as SetAppNameInput, q as AddDocumentTypeAction, tt as AppModulePHState } from "./index-
|
|
1
|
+
import { K as SetDragAndDropEnabledAction, Q as SetDocumentTypesAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, dt as RemoveDocumentTypeInput, gt as SetDragAndDropEnabledInput, ht as SetDocumentTypesInput, mt as SetAppStatusInput, nt as AddDocumentTypeInput, pt as SetAppNameInput, q as AddDocumentTypeAction, tt as AppModulePHState } from "./index-mYlWU47F.js";
|
|
2
2
|
import { B as AddDocumentTypeAction$1, H as RemoveDocumentTypeAction$1, J as AddDocumentTypeInput$1, U as SetEditorNameAction, W as SetEditorStatusAction, it as RemoveDocumentTypeInput$1, ot as SetEditorNameInput, q as DocumentEditorPHState, st as SetEditorStatusInput } from "./index-D6Ai0OOc.js";
|
|
3
3
|
import { $ as SetProcessorTypeAction, K as AddDocumentTypeAction$2, Q as SetProcessorStatusAction, X as RemoveProcessorAppAction, Y as RemoveDocumentTypeAction$2, Z as SetProcessorNameAction, _t as SetProcessorNameInput, ht as RemoveProcessorAppInput, it as AddProcessorAppInput, mt as RemoveDocumentTypeInput$2, nt as ProcessorModulePHState, q as AddProcessorAppAction, rt as AddDocumentTypeInput$2, vt as SetProcessorStatusInput, yt as SetProcessorTypeInput } from "./index-B52jv-LY.js";
|
|
4
4
|
import { B as SubgraphModulePHState, F as SetSubgraphNameAction, I as SetSubgraphStatusAction, X as SetSubgraphStatusInput, Y as SetSubgraphNameInput } from "./index-DplUuZMT.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AppModule } from "./module-
|
|
1
|
+
import { t as AppModule } from "./module-d1-9VDGb.js";
|
|
2
2
|
import { t as DocumentEditor } from "./module-2JZcvfVs.js";
|
|
3
3
|
import { t as ProcessorModule } from "./module-Db8mmgzN.js";
|
|
4
4
|
import { t as SubgraphModule } from "./module-hLzF5tCL.js";
|
|
@@ -10,7 +10,7 @@ const documentModel = {
|
|
|
10
10
|
website: "https://powerhouse.inc"
|
|
11
11
|
},
|
|
12
12
|
extension: ".app",
|
|
13
|
-
description: "Declares a custom Drive App (a drive-level UI surface) shipped by a Vetra Reactor Package. Use one App Module document per drive app: configure which document types it handles, whether it accepts drag-and-drop, and mark it CONFIRMED to trigger codegen of the corresponding app scaffold under `
|
|
13
|
+
description: "Declares a custom Drive App (a drive-level UI surface) shipped by a Vetra Reactor Package. Use one App Module document per drive app: configure which document types it handles, whether it accepts drag-and-drop, and mark it CONFIRMED to trigger codegen of the corresponding app scaffold under `editors/<app-id>/`.",
|
|
14
14
|
specifications: [{
|
|
15
15
|
state: {
|
|
16
16
|
local: {
|
|
@@ -19,7 +19,7 @@ const documentModel = {
|
|
|
19
19
|
initialValue: ""
|
|
20
20
|
},
|
|
21
21
|
global: {
|
|
22
|
-
schema: "\"\"\"\nConfiguration for a Drive App contributed by the package. Drive apps render a\ncustom view at the drive level (instead of, or alongside, the document file\ntree) and can opt into which document types they accept.\n\"\"\"\ntype AppModuleState {\n \"\"\"Display name of the drive app. Also used as the source for the generated folder name under `
|
|
22
|
+
schema: "\"\"\"\nConfiguration for a Drive App contributed by the package. Drive apps render a\ncustom view at the drive level (instead of, or alongside, the document file\ntree) and can opt into which document types they accept.\n\"\"\"\ntype AppModuleState {\n \"\"\"Display name of the drive app. Also used as the source for the generated folder name under `editors/`.\"\"\"\n name: String!\n \"\"\"Lifecycle status. While DRAFT the app definition is editable and codegen is skipped; switching to CONFIRMED triggers app scaffold generation.\"\"\"\n status: StatusType!\n \"\"\"Document type ids this app handles. `null` means the app accepts any document type; an empty list means it accepts none.\"\"\"\n allowedDocumentTypes: [String!]\n \"\"\"Whether the app surface accepts dropped files from the user. Defaults to true.\"\"\"\n isDragAndDropEnabled: Boolean!\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}",
|
|
23
23
|
examples: [],
|
|
24
24
|
initialValue: "{\n \"name\": \"\",\n \"status\": \"DRAFT\",\n \"allowedDocumentTypes\": null,\n \"isDragAndDropEnabled\": true\n}"
|
|
25
25
|
}
|
|
@@ -32,7 +32,7 @@ const documentModel = {
|
|
|
32
32
|
{
|
|
33
33
|
id: "f2ba2ddc-8527-4162-93bd-e045e9932013",
|
|
34
34
|
name: "SET_APP_NAME",
|
|
35
|
-
description: "Set the display name of the drive app. Also determines the generated folder name under `
|
|
35
|
+
description: "Set the display name of the drive app. Also determines the generated folder name under `editors/`.",
|
|
36
36
|
schema: "input SetAppNameInput {\n name: String!\n}",
|
|
37
37
|
template: "",
|
|
38
38
|
reducer: "",
|
|
@@ -128,4 +128,4 @@ const AppModule = {
|
|
|
128
128
|
//#endregion
|
|
129
129
|
export { utils as n, documentModel as r, AppModule as t };
|
|
130
130
|
|
|
131
|
-
//# sourceMappingURL=module-
|
|
131
|
+
//# sourceMappingURL=module-d1-9VDGb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-d1-9VDGb.js","names":["genUtils","customUtils"],"sources":["../document-models/app-module/v1/gen/document-model.ts","../document-models/app-module/v1/src/utils.ts","../document-models/app-module/v1/utils.ts","../document-models/app-module/v1/module.ts"],"sourcesContent":["import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/app\",\n name: \"App Module\",\n author: {\n name: \"Powerhouse\",\n website: \"https://powerhouse.inc\",\n },\n extension: \".app\",\n description:\n \"Declares a custom Drive App (a drive-level UI surface) shipped by a Vetra Reactor Package. Use one App Module document per drive app: configure which document types it handles, whether it accepts drag-and-drop, and mark it CONFIRMED to trigger codegen of the corresponding app scaffold under `editors/<app-id>/`.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n '\"\"\"\\nConfiguration for a Drive App contributed by the package. Drive apps render a\\ncustom view at the drive level (instead of, or alongside, the document file\\ntree) and can opt into which document types they accept.\\n\"\"\"\\ntype AppModuleState {\\n \"\"\"Display name of the drive app. Also used as the source for the generated folder name under `editors/`.\"\"\"\\n name: String!\\n \"\"\"Lifecycle status. While DRAFT the app definition is editable and codegen is skipped; switching to CONFIRMED triggers app scaffold generation.\"\"\"\\n status: StatusType!\\n \"\"\"Document type ids this app handles. `null` means the app accepts any document type; an empty list means it accepts none.\"\"\"\\n allowedDocumentTypes: [String!]\\n \"\"\"Whether the app surface accepts dropped files from the user. Defaults to true.\"\"\"\\n isDragAndDropEnabled: Boolean!\\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 \"status\": \"DRAFT\",\\n \"allowedDocumentTypes\": null,\\n \"isDragAndDropEnabled\": true\\n}',\n },\n },\n modules: [\n {\n id: \"d274599a-ceb5-4f2b-8651-b25787306734\",\n name: \"base_operations\",\n description:\n \"Set the app's identity, lifecycle status, and the document types it handles.\",\n operations: [\n {\n id: \"f2ba2ddc-8527-4162-93bd-e045e9932013\",\n name: \"SET_APP_NAME\",\n description:\n \"Set the display name of the drive app. Also determines the generated folder name under `editors/`.\",\n schema: \"input SetAppNameInput {\\n name: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"c842efa4-154c-4fd9-9d12-42bec51af4e9\",\n name: \"SET_APP_STATUS\",\n description:\n \"Move the app between DRAFT and CONFIRMED. Codegen only runs once the status is CONFIRMED.\",\n schema: \"input SetAppStatusInput {\\n status: StatusType!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"7376f168-695f-4aef-94d0-6e381666358c\",\n name: \"ADD_DOCUMENT_TYPE\",\n description:\n \"Append a document type id to the list of types this app handles. Initializes the list if it was `null` (accept-any).\",\n schema:\n \"input AddDocumentTypeInput {\\n documentType: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"310e4e5b-3f14-4e9a-8e09-5583c7698a65\",\n name: \"REMOVE_DOCUMENT_TYPE\",\n description:\n \"Remove a document type id from the handled list. No-op if the type is not present.\",\n schema:\n \"input RemoveDocumentTypeInput {\\n documentType: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"b365727a-7df3-48f0-a4f8-02362f02ad1d\",\n name: \"SET_DOCUMENT_TYPES\",\n description:\n \"Replace the entire allowed-document-types list in one call. Pass an empty list to accept none.\",\n schema:\n \"input SetDocumentTypesInput {\\n documentTypes: [String!]!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"270faa10-92e9-40d0-b128-2de32704bcb5\",\n name: \"dnd_operations\",\n description:\n \"Toggle drag-and-drop file handling for the app surface.\",\n operations: [\n {\n id: \"077b1ab8-cb32-4b4e-a1fa-76178188c6a1\",\n name: \"SET_DRAG_AND_DROP_ENABLED\",\n description:\n \"Enable or disable drag-and-drop file handling on the app surface.\",\n schema:\n \"input SetDragAndDropEnabledInput {\\n enabled: Boolean!\\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","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 { AppModulePHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the AppModule document model */\nexport const utils: DocumentModelUtils<AppModulePHState> = {\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 { AppModulePHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the AppModule document type */\nexport const AppModule = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<AppModulePHState>;\n"],"mappings":";;;;AAEA,MAAa,gBAA0C;CACrD,IAAI;CACJ,MAAM;CACN,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,WAAW;CACX,aACE;CACF,gBAAgB,CACd;EACE,OAAO;GACL,OAAO;IACL,QAAQ;IACR,UAAU,CAAC;IACX,cAAc;GAChB;GACA,QAAQ;IACN,QACE;IACF,UAAU,CAAC;IACX,cACE;GACJ;EACF;EACA,SAAS,CACP;GACE,IAAI;GACJ,MAAM;GACN,aACE;GACF,YAAY;IACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;GACF;EACF,GACA;GACE,IAAI;GACJ,MAAM;GACN,aACE;GACF,YAAY,CACV;IACE,IAAI;IACJ,MAAM;IACN,aACE;IACF,QACE;IACF,UAAU;IACV,SAAS;IACT,QAAQ,CAAC;IACT,UAAU,CAAC;IACX,OAAO;GACT,CACF;EACF,CACF;EACA,SAAS;EACT,WAAW,CAAC;CACd,CACF;AACF;;;;;;;AEpHA,MAAa,QAA8C;CACzD,GAAGA;CACH,GAAGC;AACL;;;;ACAA,MAAa,YAAY;CACvB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
2
|
+
import { n as lintSubgraphTypes, t as findSubgraphNameConflict } from "./subgraph-type-lint-Dr8Wu0VB.js";
|
|
3
3
|
import { t as logger } from "./logger-BFxMdimR.js";
|
|
4
4
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
5
5
|
import { generateApp, generateDocumentModel, generateEditor, generateProcessor, generateSubgraph, validateDocumentModelState } from "@powerhousedao/codegen";
|
|
@@ -73,6 +73,12 @@ var InteractiveManager = class {
|
|
|
73
73
|
logger.debug(`>>> Queued strand for ${documentKey}, queue size: ${this.strandQueue.size}`);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
+
* Drop the queued strands the predicate matches
|
|
77
|
+
*/
|
|
78
|
+
discardWhere(predicate) {
|
|
79
|
+
for (const [key, queued] of this.strandQueue) if (predicate(queued.strand)) this.strandQueue.delete(key);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
76
82
|
* Get all queued strands
|
|
77
83
|
*/
|
|
78
84
|
getQueuedStrands() {
|
|
@@ -194,12 +200,20 @@ var DocumentCodegenManager = class {
|
|
|
194
200
|
debounceTimers = /* @__PURE__ */ new Map();
|
|
195
201
|
processingQueue = Promise.resolve();
|
|
196
202
|
interactiveManager;
|
|
203
|
+
isInScope = () => Promise.resolve(true);
|
|
197
204
|
constructor(config, project, interactiveMode = false) {
|
|
198
205
|
this.config = config;
|
|
199
206
|
this.project = project;
|
|
200
207
|
this.interactiveManager = new InteractiveManager(interactiveMode);
|
|
201
208
|
}
|
|
202
209
|
/**
|
|
210
|
+
* Limit generation to the documents `isInScope` accepts, checked when the
|
|
211
|
+
* debounce fires
|
|
212
|
+
*/
|
|
213
|
+
setScope(isInScope) {
|
|
214
|
+
this.isInScope = isInScope;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
203
217
|
* Register a generator class for a specific document type
|
|
204
218
|
*/
|
|
205
219
|
registerGenerator(documentType, generatorClass) {
|
|
@@ -254,10 +268,6 @@ var DocumentCodegenManager = class {
|
|
|
254
268
|
logger.warn(`ℹ️ Supported document types: ${this.getRegisteredDocumentTypes().join(", ")}`);
|
|
255
269
|
throw new Error(`Unsupported document type: ${documentType}`);
|
|
256
270
|
}
|
|
257
|
-
if (!generator.shouldProcess(strand)) {
|
|
258
|
-
logger.debug(`>>> Generator validation failed for ${documentType}:${strand.documentId}, skipping processing`);
|
|
259
|
-
return Promise.resolve();
|
|
260
|
-
}
|
|
261
271
|
if (this.interactiveManager.isInteractive()) {
|
|
262
272
|
logger.debug(`>>> Queueing strand for interactive processing: ${documentType}:${strand.documentId}`);
|
|
263
273
|
this.interactiveManager.queueStrand(strand);
|
|
@@ -265,6 +275,9 @@ var DocumentCodegenManager = class {
|
|
|
265
275
|
if (existingTimer) clearTimeout(existingTimer);
|
|
266
276
|
const debounceTimer = setTimeout(async () => {
|
|
267
277
|
try {
|
|
278
|
+
const rejected = /* @__PURE__ */ new Set();
|
|
279
|
+
for (const { strand } of this.interactiveManager.getQueuedStrands()) if (!await this.accepts(strand)) rejected.add(strand);
|
|
280
|
+
this.interactiveManager.discardWhere((queued) => rejected.has(queued));
|
|
268
281
|
await this.interactiveManager.processQueueWithConfirmation(async (queuedStrands) => {
|
|
269
282
|
await this.processQueuedStrands(queuedStrands);
|
|
270
283
|
});
|
|
@@ -281,6 +294,7 @@ var DocumentCodegenManager = class {
|
|
|
281
294
|
if (existingTimer) clearTimeout(existingTimer);
|
|
282
295
|
const debounceTimer = setTimeout(async () => {
|
|
283
296
|
try {
|
|
297
|
+
if (!await this.accepts(strand)) return;
|
|
284
298
|
logger.debug(`🔄 Routing document type "${documentType}" to generator (debounced)`);
|
|
285
299
|
await generator.generate(strand);
|
|
286
300
|
logger.debug(`✅ Successfully generated code for document type: ${documentType}`);
|
|
@@ -294,6 +308,16 @@ var DocumentCodegenManager = class {
|
|
|
294
308
|
}
|
|
295
309
|
return Promise.resolve();
|
|
296
310
|
}
|
|
311
|
+
/** In scope first, so documents out of scope are never validated or logged. */
|
|
312
|
+
async accepts(strand) {
|
|
313
|
+
const generator = this.getGenerator(strand.documentType);
|
|
314
|
+
if (!generator) return false;
|
|
315
|
+
if (!await this.isInScope(strand.documentId)) {
|
|
316
|
+
logger.debug(`Document ${strand.documentId} is not in the Vetra drive, skipping codegen`);
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
return generator.shouldProcess(strand);
|
|
320
|
+
}
|
|
297
321
|
/**
|
|
298
322
|
* Process multiple strands in priority order (document-model types first)
|
|
299
323
|
*/
|
|
@@ -788,6 +812,11 @@ var SubgraphGenerator = class extends BaseDocumentGen {
|
|
|
788
812
|
if (state.name && state.status === "CONFIRMED") {
|
|
789
813
|
logger.info(`🔄 Starting subgraph generation for: ${state.name}`);
|
|
790
814
|
try {
|
|
815
|
+
const conflict = await findSubgraphNameConflict(this.config.CURRENT_WORKING_DIR, state.name);
|
|
816
|
+
if (conflict) {
|
|
817
|
+
logger.error(`❌ Skipping subgraph generation: ${conflict}`);
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
791
820
|
await generateSubgraph(state.name, this.project);
|
|
792
821
|
await this.project.save();
|
|
793
822
|
logger.info(`✅ Subgraph generation completed successfully for: ${state.name}`);
|
|
@@ -861,20 +890,26 @@ var DocumentCodegenFactory = class {
|
|
|
861
890
|
//#region processors/codegen/processor.ts
|
|
862
891
|
var processor_exports = /* @__PURE__ */ __exportAll({ CodegenProcessor: () => CodegenProcessor });
|
|
863
892
|
var CodegenProcessor = class {
|
|
893
|
+
driveId;
|
|
894
|
+
client;
|
|
864
895
|
manager;
|
|
865
|
-
constructor(project, config, cwd, interactiveMode = false) {
|
|
896
|
+
constructor(project, config, cwd, driveId, client, interactiveMode = false) {
|
|
897
|
+
this.driveId = driveId;
|
|
898
|
+
this.client = client;
|
|
866
899
|
this.manager = DocumentCodegenFactory.createManager({
|
|
867
900
|
PH_CONFIG: config,
|
|
868
901
|
CURRENT_WORKING_DIR: cwd
|
|
869
902
|
}, project, interactiveMode);
|
|
903
|
+
this.manager.setScope((documentId) => this.isInDrive(documentId));
|
|
870
904
|
if (interactiveMode) logger.info(`CodegenProcessor initialized with interactive mode enabled`);
|
|
871
905
|
else logger.debug(`CodegenProcessor initialized with interactive mode disabled`);
|
|
872
906
|
}
|
|
873
907
|
async onOperations(operations) {
|
|
874
|
-
logger.
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
908
|
+
logger.debug("CodegenProcessor.onOperations()");
|
|
909
|
+
const latest = /* @__PURE__ */ new Map();
|
|
910
|
+
for (const operation of operations) latest.set(operation.context.documentId, operation);
|
|
911
|
+
for (const { context } of latest.values()) {
|
|
912
|
+
if (!this.manager.getGenerator(context.documentType)) {
|
|
878
913
|
logger.debug(`No generator found for document type: ${context.documentType}`);
|
|
879
914
|
continue;
|
|
880
915
|
}
|
|
@@ -885,7 +920,7 @@ var CodegenProcessor = class {
|
|
|
885
920
|
branch: context.branch,
|
|
886
921
|
state: context.resultingState ? JSON.parse(context.resultingState) : void 0
|
|
887
922
|
};
|
|
888
|
-
|
|
923
|
+
await this.manager.routeAndGenerate(input);
|
|
889
924
|
}
|
|
890
925
|
}
|
|
891
926
|
async onDisconnect() {}
|
|
@@ -898,8 +933,27 @@ var CodegenProcessor = class {
|
|
|
898
933
|
isProcessingInteractive() {
|
|
899
934
|
return this.manager.isProcessingInteractive();
|
|
900
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* The reactor delivers every drive's operations, so membership is checked
|
|
938
|
+
* here: a node of the drive (in any folder, and in drives older than
|
|
939
|
+
* relationship edges), or a child edge from it (a document attached by
|
|
940
|
+
* relationship alone).
|
|
941
|
+
*/
|
|
942
|
+
async isInDrive(documentId) {
|
|
943
|
+
try {
|
|
944
|
+
if ((await this.client.get(this.driveId)).state.global.nodes.some((node) => node.id === documentId)) return true;
|
|
945
|
+
} catch (error) {
|
|
946
|
+
logger.debug(`Could not read the Vetra drive ${this.driveId}:`, error);
|
|
947
|
+
}
|
|
948
|
+
try {
|
|
949
|
+
return (await this.client.getIncomingRelationshipEdges(documentId, "child")).results.some((edge) => edge.sourceId === this.driveId);
|
|
950
|
+
} catch (error) {
|
|
951
|
+
logger.debug(`Could not read the parents of ${documentId}:`, error);
|
|
952
|
+
return false;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
901
955
|
};
|
|
902
956
|
//#endregion
|
|
903
957
|
export { processor_exports as n, CodegenProcessor as t };
|
|
904
958
|
|
|
905
|
-
//# sourceMappingURL=processor-
|
|
959
|
+
//# sourceMappingURL=processor-kRJ48ypM.js.map
|