@powerhousedao/codegen 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/{file-builders-C1NnoSS9.mjs → file-builders-Cd26sLHR.mjs} +101 -57
- package/dist/file-builders-Cd26sLHR.mjs.map +1 -0
- package/dist/{index-DEK_3FV-.d.mts → index-CIOH-vw2.d.mts} +9 -2
- package/dist/{index-DEK_3FV-.d.mts.map → index-CIOH-vw2.d.mts.map} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +76 -63
- package/dist/index.mjs.map +1 -1
- package/dist/src/file-builders/index.d.mts +2 -2
- package/dist/src/file-builders/index.mjs +2 -2
- package/dist/src/name-builders/index.d.mts +1 -1
- package/dist/src/name-builders/index.mjs +1 -1
- package/dist/src/templates/index.d.mts +2 -2
- package/dist/src/templates/index.mjs +1 -1
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/file-builders-C1NnoSS9.mjs.map +0 -1
|
@@ -5326,7 +5326,9 @@ export default function Editor() {
|
|
|
5326
5326
|
`.raw;
|
|
5327
5327
|
//#endregion
|
|
5328
5328
|
//#region src/templates/document-editor/module.ts
|
|
5329
|
-
const documentEditorModuleFileTemplate = (v) =>
|
|
5329
|
+
const documentEditorModuleFileTemplate = (v) => {
|
|
5330
|
+
const documentTypesLiteral = JSON.stringify(v.documentTypes);
|
|
5331
|
+
return tsx`
|
|
5330
5332
|
/**
|
|
5331
5333
|
* WARNING: DO NOT EDIT
|
|
5332
5334
|
* This file is auto-generated and updated by codegen
|
|
@@ -5334,16 +5336,17 @@ const documentEditorModuleFileTemplate = (v) => tsx`
|
|
|
5334
5336
|
import type { EditorModule } from "document-model";
|
|
5335
5337
|
import { lazy } from "react";
|
|
5336
5338
|
|
|
5337
|
-
/** Document editor module for the "${v.documentTypes}" document type */
|
|
5339
|
+
/** ${v.documentTypes.length === 1 ? `Document editor module for the "${v.documentTypes[0]}" document type` : `Document editor module for document types: ${v.documentTypes.map((t) => `"${t}"`).join(", ")}`} */
|
|
5338
5340
|
export const ${v.pascalCaseEditorName}: EditorModule = {
|
|
5339
5341
|
Component: lazy(() => import("./editor.js")),
|
|
5340
|
-
documentTypes: ${
|
|
5342
|
+
documentTypes: ${documentTypesLiteral},
|
|
5341
5343
|
config: {
|
|
5342
5344
|
id: "${v.editorId}",
|
|
5343
5345
|
name: "${v.editorName}",
|
|
5344
5346
|
},
|
|
5345
5347
|
};
|
|
5346
5348
|
`.raw;
|
|
5349
|
+
};
|
|
5347
5350
|
//#endregion
|
|
5348
5351
|
//#region src/templates/document-model/actions.ts
|
|
5349
5352
|
function buildModuleActionsName(module, camelCaseDocumentType) {
|
|
@@ -7260,7 +7263,7 @@ async function makeEditorModuleFile({ project, editorDirPath, editorName, docume
|
|
|
7260
7263
|
editorName,
|
|
7261
7264
|
editorId,
|
|
7262
7265
|
pascalCaseEditorName: pascalCase(editorName),
|
|
7263
|
-
documentTypes: documentModelId ?
|
|
7266
|
+
documentTypes: documentModelId ? [documentModelId] : legacyMultipleDocumentTypes ?? []
|
|
7264
7267
|
});
|
|
7265
7268
|
sourceFile.replaceWithText(template);
|
|
7266
7269
|
await formatSourceFileWithPrettier(sourceFile);
|
|
@@ -7313,56 +7316,58 @@ async function tsMorphGenerateApp({ project, editorDir, editorName, editorId, al
|
|
|
7313
7316
|
const editorDirPath = path.join(editorsDirPath, editorDir);
|
|
7314
7317
|
const projectDir = editorsDir.getParentOrThrow().getPath();
|
|
7315
7318
|
const editorComponentsDirPath = path.join(editorDirPath, "components");
|
|
7316
|
-
await ensureDirectoriesExist(project, documentModelsDirPath, editorsDirPath, editorDirPath
|
|
7317
|
-
await
|
|
7318
|
-
project,
|
|
7319
|
-
editorComponentsDirPath
|
|
7320
|
-
});
|
|
7321
|
-
await makeCreateDocumentFile({
|
|
7322
|
-
project,
|
|
7323
|
-
editorComponentsDirPath
|
|
7324
|
-
});
|
|
7325
|
-
await makeEmptyStateFile({
|
|
7326
|
-
project,
|
|
7327
|
-
editorComponentsDirPath
|
|
7328
|
-
});
|
|
7329
|
-
await makeFoldersFile({
|
|
7330
|
-
project,
|
|
7331
|
-
editorComponentsDirPath
|
|
7332
|
-
});
|
|
7333
|
-
await makeFolderTreeFile({
|
|
7334
|
-
project,
|
|
7335
|
-
editorComponentsDirPath
|
|
7336
|
-
});
|
|
7337
|
-
await makeFilesFile({
|
|
7338
|
-
project,
|
|
7339
|
-
editorComponentsDirPath
|
|
7340
|
-
});
|
|
7341
|
-
await makeDriveExplorerFile({
|
|
7342
|
-
project,
|
|
7343
|
-
editorComponentsDirPath
|
|
7344
|
-
});
|
|
7345
|
-
await makeDriveContentsFile({
|
|
7319
|
+
await ensureDirectoriesExist(project, documentModelsDirPath, editorsDirPath, editorDirPath);
|
|
7320
|
+
if (!await makeAppComponent({
|
|
7346
7321
|
project,
|
|
7347
|
-
editorComponentsDirPath
|
|
7348
|
-
});
|
|
7349
|
-
await makeAppComponent({
|
|
7350
|
-
project,
|
|
7351
|
-
editorDirPath
|
|
7352
|
-
});
|
|
7353
|
-
await makeAppConfigFile({
|
|
7354
|
-
project,
|
|
7355
|
-
allowedDocumentModelIds,
|
|
7356
|
-
isDragAndDropEnabled,
|
|
7357
7322
|
editorDirPath
|
|
7358
|
-
})
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7323
|
+
})) {
|
|
7324
|
+
await ensureDirectoriesExist(project, editorComponentsDirPath);
|
|
7325
|
+
await makeNavigationBreadcrumbsFile({
|
|
7326
|
+
project,
|
|
7327
|
+
editorComponentsDirPath
|
|
7328
|
+
});
|
|
7329
|
+
await makeCreateDocumentFile({
|
|
7330
|
+
project,
|
|
7331
|
+
editorComponentsDirPath
|
|
7332
|
+
});
|
|
7333
|
+
await makeEmptyStateFile({
|
|
7334
|
+
project,
|
|
7335
|
+
editorComponentsDirPath
|
|
7336
|
+
});
|
|
7337
|
+
await makeFoldersFile({
|
|
7338
|
+
project,
|
|
7339
|
+
editorComponentsDirPath
|
|
7340
|
+
});
|
|
7341
|
+
await makeFolderTreeFile({
|
|
7342
|
+
project,
|
|
7343
|
+
editorComponentsDirPath
|
|
7344
|
+
});
|
|
7345
|
+
await makeFilesFile({
|
|
7346
|
+
project,
|
|
7347
|
+
editorComponentsDirPath
|
|
7348
|
+
});
|
|
7349
|
+
await makeDriveExplorerFile({
|
|
7350
|
+
project,
|
|
7351
|
+
editorComponentsDirPath
|
|
7352
|
+
});
|
|
7353
|
+
await makeDriveContentsFile({
|
|
7354
|
+
project,
|
|
7355
|
+
editorComponentsDirPath
|
|
7356
|
+
});
|
|
7357
|
+
await makeAppConfigFile({
|
|
7358
|
+
project,
|
|
7359
|
+
allowedDocumentModelIds,
|
|
7360
|
+
isDragAndDropEnabled,
|
|
7361
|
+
editorDirPath
|
|
7362
|
+
});
|
|
7363
|
+
await makeEditorModuleFile({
|
|
7364
|
+
project,
|
|
7365
|
+
editorName,
|
|
7366
|
+
editorId,
|
|
7367
|
+
editorDirPath,
|
|
7368
|
+
documentModelId: "powerhouse/document-drive"
|
|
7369
|
+
});
|
|
7370
|
+
}
|
|
7366
7371
|
await makeEditorsFile({
|
|
7367
7372
|
project,
|
|
7368
7373
|
editorsDirPath
|
|
@@ -7383,12 +7388,13 @@ async function makeAppComponent({ project, editorDirPath }) {
|
|
|
7383
7388
|
const editorFunction = sourceFile.getFunction("Editor");
|
|
7384
7389
|
if (editorFunction) {
|
|
7385
7390
|
if (!editorFunction.isDefaultExport()) editorFunction.setIsDefaultExport(true);
|
|
7386
|
-
return;
|
|
7391
|
+
return true;
|
|
7387
7392
|
}
|
|
7388
7393
|
}
|
|
7389
7394
|
const template = appEditorFileTemplate();
|
|
7390
7395
|
sourceFile.replaceWithText(template);
|
|
7391
7396
|
await formatSourceFileWithPrettier(sourceFile);
|
|
7397
|
+
return false;
|
|
7392
7398
|
}
|
|
7393
7399
|
async function makeAppConfigFile({ project, editorDirPath, allowedDocumentModelIds, isDragAndDropEnabled }) {
|
|
7394
7400
|
const { sourceFile } = getOrCreateSourceFile(project, path.join(editorDirPath, "config.ts"));
|
|
@@ -8481,7 +8487,7 @@ function makeModulesIndexFile({ project, modulesDirPath, modules }) {
|
|
|
8481
8487
|
//#endregion
|
|
8482
8488
|
//#region src/file-builders/manifest.ts
|
|
8483
8489
|
async function getOrCreateManifestFile(manifestPath) {
|
|
8484
|
-
if (!await fileExists(manifestPath)) await writeJsonFile(manifestPath, defaultManifest);
|
|
8490
|
+
if (!await fileExists(manifestPath)) await writeJsonFile(manifestPath, defaultManifest, { indent: 2 });
|
|
8485
8491
|
const manifestFile = await loadJsonFile(manifestPath);
|
|
8486
8492
|
return ManifestSchema.parse(manifestFile);
|
|
8487
8493
|
}
|
|
@@ -8491,6 +8497,26 @@ function makeUpdatedModulesList(oldModules = [], newModules = []) {
|
|
|
8491
8497
|
function makeUpdatedConfig(oldConfig = [], newConfig = []) {
|
|
8492
8498
|
return pipe(oldConfig, filter(({ name }) => !isIncludedIn(name, map(newConfig, prop("name")))), concat(newConfig), uniqueBy(prop("name")));
|
|
8493
8499
|
}
|
|
8500
|
+
/**
|
|
8501
|
+
* Removes entries from a manifest module list whose id is not in `validIds`.
|
|
8502
|
+
* Used by `generateAll<X>` to prune entries that no longer correspond to any
|
|
8503
|
+
* directory in the project (e.g. a module that was renamed or deleted). No-op
|
|
8504
|
+
* if the manifest file doesn't exist yet.
|
|
8505
|
+
*/
|
|
8506
|
+
async function pruneManifestSection(projectDir, kind, validIds) {
|
|
8507
|
+
const manifestPath = join(projectDir, "powerhouse.manifest.json");
|
|
8508
|
+
if (!await fileExists(manifestPath)) return;
|
|
8509
|
+
const manifest = await getOrCreateManifestFile(manifestPath);
|
|
8510
|
+
const existing = manifest[kind];
|
|
8511
|
+
if (existing === void 0) return;
|
|
8512
|
+
const validSet = new Set(validIds);
|
|
8513
|
+
const filtered = existing.filter((entry) => validSet.has(entry.id));
|
|
8514
|
+
if (filtered.length === existing.length) return;
|
|
8515
|
+
await writeJsonFile(manifestPath, {
|
|
8516
|
+
...manifest,
|
|
8517
|
+
[kind]: filtered
|
|
8518
|
+
}, { indent: 2 });
|
|
8519
|
+
}
|
|
8494
8520
|
async function createOrUpdateManifest(manifestData, projectDir) {
|
|
8495
8521
|
const manifestPath = join(projectDir, "powerhouse.manifest.json");
|
|
8496
8522
|
const existingManifest = await getOrCreateManifestFile(manifestPath);
|
|
@@ -8505,7 +8531,7 @@ async function createOrUpdateManifest(manifestData, projectDir) {
|
|
|
8505
8531
|
subgraphs: makeUpdatedModulesList(existingManifest.subgraphs, manifestData.subgraphs),
|
|
8506
8532
|
config: makeUpdatedConfig(existingManifest.config, manifestData.config)
|
|
8507
8533
|
};
|
|
8508
|
-
await writeJsonFile(manifestPath, updatedManifest);
|
|
8534
|
+
await writeJsonFile(manifestPath, updatedManifest, { indent: 2 });
|
|
8509
8535
|
return updatedManifest;
|
|
8510
8536
|
}
|
|
8511
8537
|
//#endregion
|
|
@@ -8618,6 +8644,19 @@ async function makeMigrationsFile(v) {
|
|
|
8618
8644
|
}
|
|
8619
8645
|
//#endregion
|
|
8620
8646
|
//#region src/file-builders/processors/processor.ts
|
|
8647
|
+
/**
|
|
8648
|
+
* Detects a hand-customized processor directory using a layout that predates
|
|
8649
|
+
* the current scaffold (class defined in index.ts, no processor.ts). When
|
|
8650
|
+
* present we leave the directory and surrounding wiring (factory-builders
|
|
8651
|
+
* file, manifest) untouched — the user owns it.
|
|
8652
|
+
*/
|
|
8653
|
+
function isCustomizedProcessorDir(processorDir) {
|
|
8654
|
+
if (!processorDir) return false;
|
|
8655
|
+
if (processorDir.getSourceFile("processor.ts")) return false;
|
|
8656
|
+
const indexFile = processorDir.getSourceFile("index.ts");
|
|
8657
|
+
if (!indexFile) return false;
|
|
8658
|
+
return indexFile.getClasses().some((c) => c.isExported());
|
|
8659
|
+
}
|
|
8621
8660
|
async function tsMorphGenerateProcessor(args) {
|
|
8622
8661
|
const { project, processorName, documentTypes, processorType, processorApps } = args;
|
|
8623
8662
|
const kebabCaseName = kebabCase(processorName);
|
|
@@ -8628,6 +8667,11 @@ async function tsMorphGenerateProcessor(args) {
|
|
|
8628
8667
|
const processorsDirPath = processorsDir.getPath();
|
|
8629
8668
|
const dirPath = path.join(processorsDirPath, kebabCaseName);
|
|
8630
8669
|
await ensureDirectoriesExist(project, processorsDirPath, dirPath);
|
|
8670
|
+
if (isCustomizedProcessorDir(project.getDirectory(dirPath))) {
|
|
8671
|
+
const relativePath = path.relative(projectDir, path.join(dirPath, "index.ts"));
|
|
8672
|
+
console.warn(`[codegen] Skipping processor scaffold for "${kebabCaseName}": legacy layout detected "${relativePath}"`);
|
|
8673
|
+
return;
|
|
8674
|
+
}
|
|
8631
8675
|
if (processorType === "analytics") await tsMorphGenerateAnalyticsProcessor({
|
|
8632
8676
|
processorName,
|
|
8633
8677
|
documentTypes,
|
|
@@ -8750,6 +8794,6 @@ async function makeSubgraphsIndexFile(args) {
|
|
|
8750
8794
|
await formatSourceFileWithPrettier(sourceFile);
|
|
8751
8795
|
}
|
|
8752
8796
|
//#endregion
|
|
8753
|
-
export {
|
|
8797
|
+
export { buildStringLiteral as $, cursorMcpTemplate as $n, getModuleExportType as $t, writeModuleFiles as A, pnpmWorkspaceTemplate as An, analyticsFactoryTemplate as At, buildTsMorphProject as B, gitIgnoreTemplate as Bn, documentModelSrcIndexFileTemplate as Bt, writeAllGeneratedProjectFiles as C, subgraphsIndexTemplate as Cn, relationalDbIndexTemplate as Ct, writeGeneratedProcessorsFiles as D, buildPowerhouseConfigTemplate as Dn, factoryBuildersTemplate as Dt, writeGeneratedEditorsFiles as E, ManifestTemplate as En, processorsFactoryTemplate as Et, makeEditorsIndexFile as F, mainTsxTemplate as Fn, makeOperationImportNames as Ft, getObjectLiteral as G, editorsTemplate as Gn, documentModelGenTypesTemplate as Gt, getAllImportModuleSpecifiers as H, geminiSettingsTemplate as Hn, documentModelIndexTemplate as Ht, validateDocumentModelState as I, licenseTemplate as In, makeOperationsImports as It, getStringArrayPropertyElements as J, documentModelsTemplate as Jn, documentModelPhFactoriesFileTemplate as Jt, getObjectProperty as K, upgradeManifestsTemplate as Kn, documentModelSchemaIndexTemplate as Kt, updateVersionedImports as L, indexTsTemplate as Ln, makeTestCaseForOperation as Lt, tsMorphGenerateApp as M, packageJsonTemplate as Mn, upgradeTransitionTemplate as Mt, makeEditorModuleFile as N, npmrcTemplate as Nn, upgradeManifestTemplate as Nt, writeGeneratedProjectRootFiles as O, packageJsonExportsTemplate as On, analyticsProcessorTemplate as Ot, makeEditorsFile as P, mcpTemplate as Pn, documentModelOperationsModuleTestFileTemplate as Pt, buildObjectLiteral as Q, connectEntrypointTemplate as Qn, documentModelOperationModuleActionsFileTemplate as Qt, getInitialStates as R, legacyIndexHtmlTemplate as Rn, documentModelTestFileTemplate as Rt, writeAiConfigFiles as S, tsconfigPathsTemplate as Sn, relationalDbMigrationsTemplate as St, writeGeneratedDocumentModelsFiles as T, readmeTemplate as Tn, processorsIndexTemplate as Tt, getAllImportNames as U, eslintConfigTemplate as Un, documentModelHooksFileTemplate as Ut, getDefaultProjectOptions as V, syncAndPublishWorkflowTemplate as Vn, documentModelModuleFileTemplate as Vt, getBooleanPropertyValue as W, editorsIndexTemplate as Wn, documentModelGenUtilsTemplate as Wt, getVariableDeclarationByTypeName as X, nginxConfTemplate as Xn, documentModelOperationsModuleErrorFileTemplate as Xt, getStringPropertyValue as Y, switchboardEntrypointTemplate as Yn, documentModelOperationsModuleOperationsFileTemplate as Yt, loadDocumentModelInDir as Z, dockerfileTemplate as Zn, documentModelOperationsModuleCreatorsFileTemplate as Zt, getCommandHelpInfo as _, documentEditorModuleFileTemplate as _n, customSubgraphSchemaTemplate as _t, getOrCreateManifestFile as a, getLatestDocumentModelSpecVersionNumber as an, folderTreeFileTemplate as ar, getProcessorMetadata as at, writeCliDocsMarkdownFile as b, vitestConfigTemplate as bn, relationalDbSchemaTemplate as bt, operationHasAttachment as c, getActionType as cn, emptyStateFileTemplate as cr, formatSafe as ct, tsMorphGenerateDocumentModel as d, documentModelDocumentTypeTemplate as dn, createDocumentFileTemplate as dr, getDocumentTypeMetadata as dt, getDocumentModelDirName as en, claudeSettingsLocalTemplate as er, ensureDirectoriesExist as et, generateDocumentModelZodSchemas as f, documentModelDocumentSchemaFileTemplate as fn, documentModelDocumentTypeMetadata as ft, tsMorphGenerateDocumentEditor as g, documentModelRootActionsFileTemplate as gn, customSubgraphResolversTemplate as gt, scalarsValidation as h, documentModelGenActionsFileTemplate as hn, parseConfig as ht, createOrUpdateManifest as i, getLatestDocumentModelSpec as in, driveExplorerNavigationBreadcrumbsFileTemplate as ir, getSubgraphMetadata as it, writeProjectRootFiles as j, exportsTemplate as jn, documentModelUtilsTemplate as jt, writeGeneratedSubgraphsFiles as k, packageJsonScriptsTemplate as kn, analyticsIndexTemplate as kt, operationHasEmptyInput as l, getActionTypeName as ln, driveExplorerFileTemplate as lr, formatSourceFileWithPrettier as lt, scalars as m, documentModelGenControllerFileTemplate as mn, parseArgs as mt, tsMorphGenerateSubgraph as n, getDocumentModelVariableNames as nn, appEditorFileTemplate as nr, getOrCreateSourceFile as nt, pruneManifestSection as o, getActionInputName as on, appFoldersFileTemplate as or, getAppMetadata as ot, generateTypesAndZodSchemasFromGraphql as p, documentModelGenCreatorsFileTemplate as pn, configSpec as pt, getProperyAssignmentByName as q, documentModelsIndexTemplate as qn, documentModelGenReducerFileTemplate as qt, tsMorphGenerateProcessor as r, getEditorVariableNames as rn, appConfigFileTemplate as rr, getPreviousVersionSourceFile as rt, makeModulesIndexFile as s, getActionInputTypeNames as sn, appFilesFileTemplate as sr, getEditorMetadata as st, makeSubgraphsIndexFile as t, getDocumentModelSpecByVersionNumber as tn, agentsTemplate as tr, getOrCreateDirectory as tt, operationHasInput as u, documentModelGenIndexFileTemplate as un, appDriveContentsFileTemplate as ur, runPrettier as ut, getCommandsHelpInfo as v, documentEditorEditorFileTemplate as vn, subgraphLibFileTemplate as vt, writeCIFiles as w, styleTemplate as wn, relationalDbFactoryTemplate as wt, buildBoilerplatePackageJson as x, tsConfigTemplate as xn, relationalDbProcessorTemplate as xt, makeCliDocsFromHelp as y, docsFromCliHelpTemplate as yn, subgraphIndexFileTemplate as yt, DEFAULT_PROJECT_OPTIONS as z, indexHtmlTemplate as zn, documentModelSrcUtilsTemplate as zt };
|
|
8754
8798
|
|
|
8755
|
-
//# sourceMappingURL=file-builders-
|
|
8799
|
+
//# sourceMappingURL=file-builders-Cd26sLHR.mjs.map
|