@powerhousedao/codegen 5.0.0-staging.9 → 5.0.1-staging.10
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/README.md +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js +8 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/resolvers.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/schema.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/actions.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/creators.esm.t +3 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/customUtils.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-models.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-schema.esm.t +56 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/document-type.esm.t +6 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModel.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/documentModelTest.esm.t +110 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/hooks.esm.t +49 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.esm.t +12 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js +128 -54
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.esm.t +4 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/module.esm.t +22 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/ph-factories.esm.t +29 -32
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/reducer.esm.t +18 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/root-utils.esm.t +11 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootActions.esm.t +13 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/rootIndex.esm.t +6 -25
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/schema.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/src-index.esm.t +5 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/types.esm.t +21 -11
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/utils.esm.t +59 -52
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/creators.esm.t +11 -6
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/customTest.esm.t +13 -18
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js +67 -39
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js +117 -21
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/resolvers.esm.t +23 -12
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/schema.esm.t +5 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/CreateDocument.esm.t +33 -39
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveContents.esm.t +23 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/DriveExplorer.esm.t +10 -279
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EmptyState.esm.t +19 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Files.esm.t +29 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/FolderTree.esm.t +92 -87
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/Folders.esm.t +28 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/NavigationBreadcrumbs.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/config.esm.t +11 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editor.esm.t +10 -35
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/editors.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js +29 -11
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/lib.esm.t +4 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/module.esm.t +15 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/edit-name.esm.t +78 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editor.esm.t +9 -21
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/editors.esm.t +14 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js +97 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/lib.esm.t +4 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/module.esm.t +16 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js +8 -10
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/factory.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.esm.t +3 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js +11 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.root.inject.esm.t +12 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/lib.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/factory.esm.t +2 -2
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.esm.t +3 -4
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js +11 -15
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.root.inject.esm.t +12 -0
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/lib.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/migrations.esm.t +1 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.esm.t +3 -3
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js +9 -11
- package/dist/src/codegen/.hygen/templates/powerhouse/utils.js +43 -0
- package/dist/src/codegen/__tests__/config.d.ts +2 -0
- package/dist/src/codegen/__tests__/config.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/config.js +2 -0
- package/dist/src/codegen/__tests__/config.js.map +1 -0
- package/dist/src/codegen/__tests__/constants.d.ts +16 -0
- package/dist/src/codegen/__tests__/constants.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/constants.js +16 -0
- package/dist/src/codegen/__tests__/constants.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts +2 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js +9 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content-v3.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts +3 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js +33 -0
- package/dist/src/codegen/__tests__/fixtures/expected-reducer-content.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts +2 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js +23 -0
- package/dist/src/codegen/__tests__/fixtures/run-generated-tests.js.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts +2 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.js +23 -0
- package/dist/src/codegen/__tests__/fixtures/typecheck.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.js +206 -0
- package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.js +153 -0
- package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-editor.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-editor.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-editor.test.js +94 -0
- package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.js +192 -0
- package/dist/src/codegen/__tests__/generate-manifest.test.js.map +1 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.js +143 -0
- package/dist/src/codegen/__tests__/generate-schemas.test.js.map +1 -0
- package/dist/src/codegen/__tests__/global-setup.d.ts +2 -0
- package/dist/src/codegen/__tests__/global-setup.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/global-setup.js +21 -0
- package/dist/src/codegen/__tests__/global-setup.js.map +1 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts +2 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.js +72 -0
- package/dist/src/codegen/__tests__/ts-morph-generator.test.js.map +1 -0
- package/dist/src/codegen/__tests__/utils.d.ts +7 -0
- package/dist/src/codegen/__tests__/utils.d.ts.map +1 -0
- package/dist/src/codegen/__tests__/utils.js +52 -0
- package/dist/src/codegen/__tests__/utils.js.map +1 -0
- package/dist/src/codegen/generate.d.ts +33 -0
- package/dist/src/codegen/generate.d.ts.map +1 -0
- package/dist/src/codegen/generate.js +205 -0
- package/dist/src/codegen/generate.js.map +1 -0
- package/dist/src/codegen/graphql.d.ts +2 -2
- package/dist/src/codegen/graphql.d.ts.map +1 -1
- package/dist/src/codegen/graphql.js.map +1 -1
- package/dist/src/codegen/hygen.d.ts +15 -12
- package/dist/src/codegen/hygen.d.ts.map +1 -1
- package/dist/src/codegen/hygen.js +72 -27
- package/dist/src/codegen/hygen.js.map +1 -1
- package/dist/src/codegen/index.d.ts +6 -34
- package/dist/src/codegen/index.d.ts.map +1 -1
- package/dist/src/codegen/index.js +6 -249
- package/dist/src/codegen/index.js.map +1 -1
- package/dist/src/codegen/types.d.ts +9 -0
- package/dist/src/codegen/types.d.ts.map +1 -0
- package/dist/src/codegen/types.js +2 -0
- package/dist/src/codegen/types.js.map +1 -0
- package/dist/src/codegen/utils.d.ts +5 -2
- package/dist/src/codegen/utils.d.ts.map +1 -1
- package/dist/src/codegen/utils.js +42 -4
- package/dist/src/codegen/utils.js.map +1 -1
- package/dist/src/create-lib/checkout-project.d.ts +13 -0
- package/dist/src/create-lib/checkout-project.d.ts.map +1 -0
- package/dist/src/create-lib/checkout-project.js +47 -0
- package/dist/src/create-lib/checkout-project.js.map +1 -0
- package/dist/src/create-lib/create-project.d.ts +9 -5
- package/dist/src/create-lib/create-project.d.ts.map +1 -1
- package/dist/src/create-lib/create-project.js +37 -30
- package/dist/src/create-lib/create-project.js.map +1 -1
- package/dist/src/create-lib/feature-flags.d.ts +4 -0
- package/dist/src/create-lib/feature-flags.d.ts.map +1 -0
- package/dist/src/create-lib/feature-flags.js +4 -0
- package/dist/src/create-lib/feature-flags.js.map +1 -0
- package/dist/src/create-lib/index.d.ts +1 -0
- package/dist/src/create-lib/index.d.ts.map +1 -1
- package/dist/src/create-lib/index.js +1 -0
- package/dist/src/create-lib/index.js.map +1 -1
- package/dist/src/{utils/package-manager.d.ts → create-lib/utils.d.ts} +3 -1
- package/dist/src/create-lib/utils.d.ts.map +1 -0
- package/dist/src/{utils/package-manager.js → create-lib/utils.js} +12 -1
- package/dist/src/create-lib/utils.js.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts +2 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.d.ts.map +1 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js +491 -0
- package/dist/src/ts-morph-generator/__tests__/ReducerGenerator.test.js.map +1 -0
- package/dist/src/ts-morph-generator/core/FileGenerator.d.ts +5 -4
- package/dist/src/ts-morph-generator/core/FileGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/FileGenerator.js +3 -1
- package/dist/src/ts-morph-generator/core/FileGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts +18 -9
- package/dist/src/ts-morph-generator/core/GenerationContext.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/{file-generators → core}/ReducerGenerator.d.ts +2 -2
- package/dist/src/ts-morph-generator/core/ReducerGenerator.d.ts.map +1 -0
- package/dist/src/ts-morph-generator/{file-generators → core}/ReducerGenerator.js +17 -10
- package/dist/src/ts-morph-generator/core/ReducerGenerator.js.map +1 -0
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts +4 -3
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js +9 -3
- package/dist/src/ts-morph-generator/core/TSMorphCodeGenerator.js.map +1 -1
- package/dist/src/ts-morph-generator/index.d.ts +2 -2
- package/dist/src/ts-morph-generator/index.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/index.js +2 -2
- package/dist/src/ts-morph-generator/index.js.map +1 -1
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts +5 -0
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.d.ts.map +1 -0
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.js +10 -0
- package/dist/src/ts-morph-generator/utilities/DeclarationManager.js.map +1 -0
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts +2 -2
- package/dist/src/ts-morph-generator/utilities/DirectoryManager.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts +2 -1
- package/dist/src/ts-morph-generator/utilities/ImportManager.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/ImportManager.js +13 -3
- package/dist/src/ts-morph-generator/utilities/ImportManager.js.map +1 -1
- package/dist/src/ts-morph-generator/utilities/index.d.ts +1 -0
- package/dist/src/ts-morph-generator/utilities/index.d.ts.map +1 -1
- package/dist/src/ts-morph-generator/utilities/index.js +1 -0
- package/dist/src/ts-morph-generator/utilities/index.js.map +1 -1
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +0 -1
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/validation.d.ts +6 -6
- package/dist/src/utils/validation.d.ts.map +1 -1
- package/dist/src/utils/validation.js +5 -6
- package/dist/src/utils/validation.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +16 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +27 -35
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.d.ts +0 -14
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-custom-subgraph/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.d.ts +0 -25
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/lib.inject_export.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model/object.esm.t +0 -49
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts +0 -27
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-module/object.esm.t +0 -32
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.d.ts +0 -22
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-document-model-subgraph/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/components/EditorContainer.esm.t +0 -103
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.d.ts +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.esm.t +0 -19
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/lib.inject_export.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-drive-editor/types/css.d.esm.t +0 -8
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.d.ts +0 -22
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.esm.t +0 -19
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-editor/lib.inject_export.esm.t +0 -7
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.d.ts +0 -14
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-import-script/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.d.ts +0 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-analytics/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.d.ts +0 -20
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-processor-relationalDb/index.js.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.d.ts +0 -16
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.d.ts.map +0 -1
- package/dist/src/codegen/.hygen/templates/powerhouse/generate-subgraph/index.js.map +0 -1
- package/dist/src/ts-morph-generator/core/index.d.ts +0 -4
- package/dist/src/ts-morph-generator/core/index.d.ts.map +0 -1
- package/dist/src/ts-morph-generator/core/index.js +0 -4
- package/dist/src/ts-morph-generator/core/index.js.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.d.ts.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/ReducerGenerator.js.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/index.d.ts +0 -2
- package/dist/src/ts-morph-generator/file-generators/index.d.ts.map +0 -1
- package/dist/src/ts-morph-generator/file-generators/index.js +0 -2
- package/dist/src/ts-morph-generator/file-generators/index.js.map +0 -1
- package/dist/src/utils/package-manager.d.ts.map +0 -1
- package/dist/src/utils/package-manager.js.map +0 -1
- package/dist/tsconfig.hygen.tsbuildinfo +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const TEST_PACKAGE_NAME = "test";
|
|
2
|
+
export declare const TEST_OUTPUT_DIR = ".test-output";
|
|
3
|
+
export declare const TEST_DATA_DIR = "data";
|
|
4
|
+
export declare const GENERATE_DOC_MODEL_TEST_OUTPUT_DIR = "generate-doc-model";
|
|
5
|
+
export declare const GENERATE_EDITOR_TEST_OUTPUT_DIR = "generate-editor";
|
|
6
|
+
export declare const GENERATE_DRIVE_EDITOR_TEST_OUTPUT_DIR = "generate-drive-editor";
|
|
7
|
+
export declare const TS_MORPH_GENERATOR_TEST_OUTPUT_DIR = "ts-morph-generator";
|
|
8
|
+
export declare const GENERATE_SCHEMAS_TEST_OUTPUT_DIR = "generate-schemas";
|
|
9
|
+
export declare const GENERATE_MANIFEST_TEST_OUTPUT_DIR = "generate-manifest";
|
|
10
|
+
export declare const DOCUMENT_MODELS_TEST_PROJECT = "document-models-test-project";
|
|
11
|
+
export declare const EDITORS_TEST_PROJECT = "editors-test-project";
|
|
12
|
+
export declare const EDITORS_TEST_PROJECT_WITH_EXISTING_EDITOR = "editors-test-project-with-existing-editor";
|
|
13
|
+
export declare const MANIFEST_TEST_PROJECT = "manifest-test-project";
|
|
14
|
+
export declare const MANIFEST_TEST_PROJECT_WITH_EXISTING_MANIFEST = "manifest-test-project-with-existing-manifest";
|
|
15
|
+
export declare const SCHEMAS_TEST_PROJECT = "schemas-test-project";
|
|
16
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/codegen/__tests__/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAC9C,eAAO,MAAM,aAAa,SAAS,CAAC;AACpC,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,eAAO,MAAM,+BAA+B,oBAAoB,CAAC;AACjE,eAAO,MAAM,qCAAqC,0BAA0B,CAAC;AAC7E,eAAO,MAAM,kCAAkC,uBAAuB,CAAC;AACvE,eAAO,MAAM,gCAAgC,qBAAqB,CAAC;AACnE,eAAO,MAAM,iCAAiC,sBAAsB,CAAC;AACrE,eAAO,MAAM,4BAA4B,iCAAiC,CAAC;AAC3E,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,eAAO,MAAM,yCAAyC,8CACT,CAAC;AAC9C,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,eAAO,MAAM,4CAA4C,iDACT,CAAC;AACjD,eAAO,MAAM,oBAAoB,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const TEST_PACKAGE_NAME = "test";
|
|
2
|
+
export const TEST_OUTPUT_DIR = ".test-output";
|
|
3
|
+
export const TEST_DATA_DIR = "data";
|
|
4
|
+
export const GENERATE_DOC_MODEL_TEST_OUTPUT_DIR = "generate-doc-model";
|
|
5
|
+
export const GENERATE_EDITOR_TEST_OUTPUT_DIR = "generate-editor";
|
|
6
|
+
export const GENERATE_DRIVE_EDITOR_TEST_OUTPUT_DIR = "generate-drive-editor";
|
|
7
|
+
export const TS_MORPH_GENERATOR_TEST_OUTPUT_DIR = "ts-morph-generator";
|
|
8
|
+
export const GENERATE_SCHEMAS_TEST_OUTPUT_DIR = "generate-schemas";
|
|
9
|
+
export const GENERATE_MANIFEST_TEST_OUTPUT_DIR = "generate-manifest";
|
|
10
|
+
export const DOCUMENT_MODELS_TEST_PROJECT = "document-models-test-project";
|
|
11
|
+
export const EDITORS_TEST_PROJECT = "editors-test-project";
|
|
12
|
+
export const EDITORS_TEST_PROJECT_WITH_EXISTING_EDITOR = "editors-test-project-with-existing-editor";
|
|
13
|
+
export const MANIFEST_TEST_PROJECT = "manifest-test-project";
|
|
14
|
+
export const MANIFEST_TEST_PROJECT_WITH_EXISTING_MANIFEST = "manifest-test-project-with-existing-manifest";
|
|
15
|
+
export const SCHEMAS_TEST_PROJECT = "schemas-test-project";
|
|
16
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/codegen/__tests__/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AACpC,MAAM,CAAC,MAAM,kCAAkC,GAAG,oBAAoB,CAAC;AACvE,MAAM,CAAC,MAAM,+BAA+B,GAAG,iBAAiB,CAAC;AACjE,MAAM,CAAC,MAAM,qCAAqC,GAAG,uBAAuB,CAAC;AAC7E,MAAM,CAAC,MAAM,kCAAkC,GAAG,oBAAoB,CAAC;AACvE,MAAM,CAAC,MAAM,gCAAgC,GAAG,kBAAkB,CAAC;AACnE,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAAC;AACrE,MAAM,CAAC,MAAM,4BAA4B,GAAG,8BAA8B,CAAC;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,yCAAyC,GACpD,2CAA2C,CAAC;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,4CAA4C,GACvD,8CAA8C,CAAC;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const expectedProOperationsV3Content = "import type { TestDocProOperationsOperations } from \"test/document-models/test-doc\";\n\nexport const testDocProOperationsOperations: TestDocProOperationsOperations = {\n setNameAndValueOperation(state, action) {\n // TODO: Implement \"setNameAndValueOperation\" reducer\n throw new Error('Reducer \"setNameAndValueOperation\" not yet implemented');\n }\n};";
|
|
2
|
+
//# sourceMappingURL=expected-reducer-content-v3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-reducer-content-v3.d.ts","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/expected-reducer-content-v3.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,+XAOxC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const expectedProOperationsV3Content = `import type { TestDocProOperationsOperations } from "test/document-models/test-doc";
|
|
2
|
+
|
|
3
|
+
export const testDocProOperationsOperations: TestDocProOperationsOperations = {
|
|
4
|
+
setNameAndValueOperation(state, action) {
|
|
5
|
+
// TODO: Implement "setNameAndValueOperation" reducer
|
|
6
|
+
throw new Error('Reducer "setNameAndValueOperation" not yet implemented');
|
|
7
|
+
}
|
|
8
|
+
};`;
|
|
9
|
+
//# sourceMappingURL=expected-reducer-content-v3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-reducer-content-v3.js","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/expected-reducer-content-v3.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;GAO3C,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const expectedBaseOperationsContent = "import type { TestDocBaseOperationsOperations } from \"test/document-models/test-doc\";\n\nexport const testDocBaseOperationsOperations: TestDocBaseOperationsOperations = {\n setTestIdOperation(state, action) {\n // TODO: Implement \"setTestIdOperation\" reducer\n throw new Error('Reducer \"setTestIdOperation\" not yet implemented');\n },\n setTestNameOperation(state, action) {\n // TODO: Implement \"setTestNameOperation\" reducer\n throw new Error('Reducer \"setTestNameOperation\" not yet implemented');\n },\n setTestDescriptionOperation(state, action) {\n // TODO: Implement \"setTestDescriptionOperation\" reducer\n throw new Error('Reducer \"setTestDescriptionOperation\" not yet implemented');\n },\n setTestValueOperation(state, action) {\n // TODO: Implement \"setTestValueOperation\" reducer\n throw new Error('Reducer \"setTestValueOperation\" not yet implemented');\n }\n};";
|
|
2
|
+
export declare const expectedProOperationsContent = "import type { TestDocProOperationsOperations } from \"test/document-models/test-doc\";\n\nexport const testDocProOperationsOperations: TestDocProOperationsOperations = {\n setNameAndValueOperation(state, action) {\n // TODO: Implement \"setNameAndValueOperation\" reducer\n throw new Error('Reducer \"setNameAndValueOperation\" not yet implemented');\n },\n setIdAndDescriptionOperation(state, action) {\n // TODO: Implement \"setIdAndDescriptionOperation\" reducer\n throw new Error('Reducer \"setIdAndDescriptionOperation\" not yet implemented');\n }\n};";
|
|
3
|
+
//# sourceMappingURL=expected-reducer-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-reducer-content.d.ts","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/expected-reducer-content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,88BAmBvC,CAAC;AAEJ,eAAO,MAAM,4BAA4B,ylBAWtC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const expectedBaseOperationsContent = `import type { TestDocBaseOperationsOperations } from "test/document-models/test-doc";
|
|
2
|
+
|
|
3
|
+
export const testDocBaseOperationsOperations: TestDocBaseOperationsOperations = {
|
|
4
|
+
setTestIdOperation(state, action) {
|
|
5
|
+
// TODO: Implement "setTestIdOperation" reducer
|
|
6
|
+
throw new Error('Reducer "setTestIdOperation" not yet implemented');
|
|
7
|
+
},
|
|
8
|
+
setTestNameOperation(state, action) {
|
|
9
|
+
// TODO: Implement "setTestNameOperation" reducer
|
|
10
|
+
throw new Error('Reducer "setTestNameOperation" not yet implemented');
|
|
11
|
+
},
|
|
12
|
+
setTestDescriptionOperation(state, action) {
|
|
13
|
+
// TODO: Implement "setTestDescriptionOperation" reducer
|
|
14
|
+
throw new Error('Reducer "setTestDescriptionOperation" not yet implemented');
|
|
15
|
+
},
|
|
16
|
+
setTestValueOperation(state, action) {
|
|
17
|
+
// TODO: Implement "setTestValueOperation" reducer
|
|
18
|
+
throw new Error('Reducer "setTestValueOperation" not yet implemented');
|
|
19
|
+
}
|
|
20
|
+
};`;
|
|
21
|
+
export const expectedProOperationsContent = `import type { TestDocProOperationsOperations } from "test/document-models/test-doc";
|
|
22
|
+
|
|
23
|
+
export const testDocProOperationsOperations: TestDocProOperationsOperations = {
|
|
24
|
+
setNameAndValueOperation(state, action) {
|
|
25
|
+
// TODO: Implement "setNameAndValueOperation" reducer
|
|
26
|
+
throw new Error('Reducer "setNameAndValueOperation" not yet implemented');
|
|
27
|
+
},
|
|
28
|
+
setIdAndDescriptionOperation(state, action) {
|
|
29
|
+
// TODO: Implement "setIdAndDescriptionOperation" reducer
|
|
30
|
+
throw new Error('Reducer "setIdAndDescriptionOperation" not yet implemented');
|
|
31
|
+
}
|
|
32
|
+
};`;
|
|
33
|
+
//# sourceMappingURL=expected-reducer-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-reducer-content.js","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/expected-reducer-content.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;;;GAmB1C,CAAC;AAEJ,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;GAWzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-generated-tests.d.ts","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/run-generated-tests.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAI,gBAAgB,MAAM,qBAwBpD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
export const runGeneratedTests = (testOutDirPath) => new Promise((resolve, reject) => {
|
|
3
|
+
const output = {
|
|
4
|
+
stdout: [],
|
|
5
|
+
stderr: [],
|
|
6
|
+
};
|
|
7
|
+
const child = exec(`npx vitest run`, { cwd: testOutDirPath });
|
|
8
|
+
child.stdout?.on("data", (data) => {
|
|
9
|
+
output.stdout.push(data);
|
|
10
|
+
});
|
|
11
|
+
child.stderr?.on("data", (data) => {
|
|
12
|
+
output.stderr.push(data);
|
|
13
|
+
});
|
|
14
|
+
child.on("close", (code) => {
|
|
15
|
+
if (code === 0) {
|
|
16
|
+
resolve(true);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
reject(new Error(`tsc failed with code ${code}:\n${output.stdout.join("")}\n${output.stderr.join("")}`));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=run-generated-tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-generated-tests.js","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/run-generated-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,cAAsB,EAAE,EAAE,CAC1D,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,MAAM,GAA2C;QACrD,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;KACX,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC;IAC9D,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,MAAM,CACJ,IAAI,KAAK,CACP,wBAAwB,IAAI,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CACtF,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/typecheck.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,qBAwBnC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { exec } from "node:child_process";
|
|
2
|
+
export const compile = (testDir) => new Promise((resolve, reject) => {
|
|
3
|
+
const output = {
|
|
4
|
+
stdout: [],
|
|
5
|
+
stderr: [],
|
|
6
|
+
};
|
|
7
|
+
const child = exec(`npm install && npx tsc`, { cwd: testDir });
|
|
8
|
+
child.stdout?.on("data", (data) => {
|
|
9
|
+
output.stdout.push(data);
|
|
10
|
+
});
|
|
11
|
+
child.stderr?.on("data", (data) => {
|
|
12
|
+
output.stderr.push(data);
|
|
13
|
+
});
|
|
14
|
+
child.on("close", (code) => {
|
|
15
|
+
if (code === 0) {
|
|
16
|
+
resolve(true);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
reject(new Error(`tsc failed with code ${code}:\n${output.stdout.join("")}\n${output.stderr.join("")}`));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=typecheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typecheck.js","sourceRoot":"","sources":["../../../../../src/codegen/__tests__/fixtures/typecheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,EAAE,CACzC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,MAAM,GAA2C;QACrD,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;KACX,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,CAAC,wBAAwB,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/D,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;QACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,MAAM,CACJ,IAAI,KAAK,CACP,wBAAwB,IAAI,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CACtF,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-doc-model.test.d.ts","sourceRoot":"","sources":["../../../../src/codegen/__tests__/generate-doc-model.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { generateSchemas, hygenGenerateDocumentModel, hygenGenerateProcessor, loadDocumentModel, } from "@powerhousedao/codegen";
|
|
2
|
+
import { readFileSync, rmSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, it, } from "vitest";
|
|
5
|
+
import { DOCUMENT_MODELS_TEST_PROJECT, GENERATE_DOC_MODEL_TEST_OUTPUT_DIR, TEST_PACKAGE_NAME, } from "./constants.js";
|
|
6
|
+
import { runGeneratedTests } from "./fixtures/run-generated-tests.js";
|
|
7
|
+
import { compile } from "./fixtures/typecheck.js";
|
|
8
|
+
import { copyAllFiles, getTestDataDir, getTestOutDirPath, getTestOutputDir, purgeDirAfterTest, resetDirForTest, } from "./utils.js";
|
|
9
|
+
describe("document model", () => {
|
|
10
|
+
const testDir = import.meta.dirname;
|
|
11
|
+
const outDirName = getTestOutputDir(testDir, GENERATE_DOC_MODEL_TEST_OUTPUT_DIR);
|
|
12
|
+
const testDataDir = getTestDataDir(testDir, DOCUMENT_MODELS_TEST_PROJECT);
|
|
13
|
+
let testOutDirPath = getTestOutDirPath("initial", outDirName);
|
|
14
|
+
const documentModelsSrcPath = path.join(testDir, "data", "document-models");
|
|
15
|
+
let documentModelsDirName = path.join(testOutDirPath, "document-models");
|
|
16
|
+
let processorsDirName = path.join(testOutDirPath, "processors");
|
|
17
|
+
async function setupTest(context) {
|
|
18
|
+
testOutDirPath = getTestOutDirPath(context.task.name, outDirName);
|
|
19
|
+
await copyAllFiles(testDataDir, testOutDirPath);
|
|
20
|
+
documentModelsDirName = path.join(testOutDirPath, "document-models");
|
|
21
|
+
processorsDirName = path.join(testOutDirPath, "processors");
|
|
22
|
+
}
|
|
23
|
+
beforeEach(async (context) => {
|
|
24
|
+
await setupTest(context);
|
|
25
|
+
});
|
|
26
|
+
beforeAll(() => {
|
|
27
|
+
resetDirForTest(outDirName);
|
|
28
|
+
});
|
|
29
|
+
afterAll(() => {
|
|
30
|
+
purgeDirAfterTest(outDirName);
|
|
31
|
+
});
|
|
32
|
+
const generate = async () => {
|
|
33
|
+
await generateSchemas(documentModelsSrcPath, {
|
|
34
|
+
skipFormat: true,
|
|
35
|
+
outDir: documentModelsDirName,
|
|
36
|
+
});
|
|
37
|
+
const billingStatementDocumentModel = await loadDocumentModel(path.join(documentModelsSrcPath, "billing-statement", "billing-statement.json"));
|
|
38
|
+
await hygenGenerateDocumentModel(billingStatementDocumentModel, documentModelsDirName, TEST_PACKAGE_NAME, { skipFormat: true });
|
|
39
|
+
const testDocDocumentModel = await loadDocumentModel(path.join(documentModelsSrcPath, "test-doc", "test-doc.json"));
|
|
40
|
+
await hygenGenerateDocumentModel(testDocDocumentModel, documentModelsDirName, TEST_PACKAGE_NAME, { skipFormat: true });
|
|
41
|
+
};
|
|
42
|
+
it("should generate a document model", {
|
|
43
|
+
timeout: 30000,
|
|
44
|
+
}, async () => {
|
|
45
|
+
await generate();
|
|
46
|
+
await compile(testOutDirPath);
|
|
47
|
+
await runGeneratedTests(testOutDirPath);
|
|
48
|
+
});
|
|
49
|
+
it("should generate an analytics processor and factory", {
|
|
50
|
+
timeout: 10000,
|
|
51
|
+
}, async () => {
|
|
52
|
+
await generate();
|
|
53
|
+
await hygenGenerateProcessor("test-analytics-processor", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "analytics", {
|
|
54
|
+
skipFormat: true,
|
|
55
|
+
});
|
|
56
|
+
await compile(testOutDirPath);
|
|
57
|
+
});
|
|
58
|
+
it("should generate multiple analytics processors with composable factories", {
|
|
59
|
+
timeout: 10000,
|
|
60
|
+
}, async () => {
|
|
61
|
+
await generate();
|
|
62
|
+
await hygenGenerateProcessor("test1", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "analytics", {
|
|
63
|
+
skipFormat: true,
|
|
64
|
+
});
|
|
65
|
+
await hygenGenerateProcessor("test2", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "analytics", {
|
|
66
|
+
skipFormat: true,
|
|
67
|
+
});
|
|
68
|
+
await hygenGenerateProcessor("test3", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "analytics", {
|
|
69
|
+
skipFormat: true,
|
|
70
|
+
});
|
|
71
|
+
await compile(testOutDirPath);
|
|
72
|
+
});
|
|
73
|
+
it("should generate a relational db processor and factory", {
|
|
74
|
+
timeout: 10000,
|
|
75
|
+
}, async () => {
|
|
76
|
+
await generate();
|
|
77
|
+
await hygenGenerateProcessor("test-relational-processor", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "relationalDb", {
|
|
78
|
+
skipFormat: true,
|
|
79
|
+
});
|
|
80
|
+
await compile(testOutDirPath);
|
|
81
|
+
});
|
|
82
|
+
it("should generate multiple relational db processors with composable factories", {
|
|
83
|
+
timeout: 10000,
|
|
84
|
+
}, async () => {
|
|
85
|
+
await generate();
|
|
86
|
+
await hygenGenerateProcessor("test1", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "relationalDb", {
|
|
87
|
+
skipFormat: true,
|
|
88
|
+
});
|
|
89
|
+
await hygenGenerateProcessor("test2", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "relationalDb", {
|
|
90
|
+
skipFormat: true,
|
|
91
|
+
});
|
|
92
|
+
await hygenGenerateProcessor("test3", ["billing-statement"], path.join(testOutDirPath, processorsDirName), "relationalDb", {
|
|
93
|
+
skipFormat: true,
|
|
94
|
+
});
|
|
95
|
+
await compile(testOutDirPath);
|
|
96
|
+
});
|
|
97
|
+
it("should create the document-models.ts file if it does not exist", {
|
|
98
|
+
timeout: 15000,
|
|
99
|
+
}, async () => {
|
|
100
|
+
const documentModelsFilePath = path.join(documentModelsDirName, "document-models.ts");
|
|
101
|
+
rmSync(documentModelsFilePath, { force: true });
|
|
102
|
+
await generate();
|
|
103
|
+
await compile(testOutDirPath);
|
|
104
|
+
const documentModelsContent = readFileSync(documentModelsFilePath, "utf-8");
|
|
105
|
+
// Check that both models are exported
|
|
106
|
+
expect(documentModelsContent).toContain(`import { BillingStatement } from "./billing-statement/module.js";`);
|
|
107
|
+
expect(documentModelsContent).toContain(`import { TestDoc } from "./test-doc/module.js";`);
|
|
108
|
+
expect(documentModelsContent).toContain("export const documentModels: DocumentModelModule<any>[] = [");
|
|
109
|
+
expect(documentModelsContent).toContain("BillingStatement,");
|
|
110
|
+
expect(documentModelsContent).toContain("TestDoc,");
|
|
111
|
+
expect(documentModelsContent).toContain("]");
|
|
112
|
+
});
|
|
113
|
+
it("should generate multiple document models and export both in document-models.ts", {
|
|
114
|
+
timeout: 15000,
|
|
115
|
+
}, async () => {
|
|
116
|
+
await generate();
|
|
117
|
+
await compile(testOutDirPath);
|
|
118
|
+
const documentModelsFilePath = path.join(documentModelsDirName, "document-models.ts");
|
|
119
|
+
const documentModelsContent = readFileSync(documentModelsFilePath, "utf-8");
|
|
120
|
+
// Check that both models are exported
|
|
121
|
+
expect(documentModelsContent).toContain(`import { BillingStatement } from "./billing-statement/module.js";`);
|
|
122
|
+
expect(documentModelsContent).toContain(`import { TestDoc } from "./test-doc/module.js";`);
|
|
123
|
+
expect(documentModelsContent).toContain("export const documentModels: DocumentModelModule<any>[] = [");
|
|
124
|
+
expect(documentModelsContent).toContain("BillingStatement,");
|
|
125
|
+
expect(documentModelsContent).toContain("TestDoc,");
|
|
126
|
+
expect(documentModelsContent).toContain("]");
|
|
127
|
+
});
|
|
128
|
+
it("should generate an updated version of test-doc", { timeout: 10000 }, async () => {
|
|
129
|
+
await generate();
|
|
130
|
+
await compile(testOutDirPath);
|
|
131
|
+
const testDocDocumentModelV2 = await loadDocumentModel(path.join(documentModelsSrcPath, "..", "test-doc-versions", "test-doc-v2", "test-doc.json"));
|
|
132
|
+
// TODO: this is a hack to get the test to pass, we should be able to update the reducer file once is generated
|
|
133
|
+
// remove .out/document-model/test-doc/src/reducers/base-operations.ts file
|
|
134
|
+
rmSync(path.join(documentModelsDirName, "test-doc", "src", "reducers", "base-operations.ts"), { force: true });
|
|
135
|
+
await hygenGenerateDocumentModel(testDocDocumentModelV2, documentModelsDirName, TEST_PACKAGE_NAME, { skipFormat: true });
|
|
136
|
+
// expect .out/document-model/test-doc/src/reducers/base-operations.ts to contain setTestIdOperation, setTestNameOperation, setTestDescriptionOperation and setTestValueOperation
|
|
137
|
+
const baseOperationsPath = path.join(documentModelsDirName, "test-doc", "src", "reducers", "base-operations.ts");
|
|
138
|
+
const baseOperationsContent = readFileSync(baseOperationsPath, "utf-8");
|
|
139
|
+
expect(baseOperationsContent).toContain("setTestIdOperation");
|
|
140
|
+
expect(baseOperationsContent).toContain("setTestNameOperation");
|
|
141
|
+
expect(baseOperationsContent).toContain("setTestDescriptionOperation");
|
|
142
|
+
expect(baseOperationsContent).toContain("setTestValueOperation");
|
|
143
|
+
});
|
|
144
|
+
it("should generate error classes and types from billing statement errors", { timeout: 10000 }, async () => {
|
|
145
|
+
await generate();
|
|
146
|
+
await compile(testOutDirPath);
|
|
147
|
+
// Check general module errors
|
|
148
|
+
const generalErrorPath = path.join(documentModelsDirName, "billing-statement", "gen", "general", "error.ts");
|
|
149
|
+
const generalErrorContent = readFileSync(generalErrorPath, "utf-8");
|
|
150
|
+
// Check that InvalidStatusTransition error is generated
|
|
151
|
+
expect(generalErrorContent).toContain("export type ErrorCode =");
|
|
152
|
+
expect(generalErrorContent).toContain("'InvalidStatusTransition'");
|
|
153
|
+
expect(generalErrorContent).toContain("export class InvalidStatusTransition extends Error implements ReducerError");
|
|
154
|
+
expect(generalErrorContent).toContain("errorCode = 'InvalidStatusTransition' as ErrorCode");
|
|
155
|
+
// Check line_items module errors
|
|
156
|
+
const lineItemsErrorPath = path.join(documentModelsDirName, "billing-statement", "gen", "line-items", "error.ts");
|
|
157
|
+
const lineItemsErrorContent = readFileSync(lineItemsErrorPath, "utf-8");
|
|
158
|
+
// Check that both DuplicateLineItem and InvalidStatusTransition errors are generated (but deduplicated)
|
|
159
|
+
expect(lineItemsErrorContent).toContain("export type ErrorCode =");
|
|
160
|
+
expect(lineItemsErrorContent).toContain("'DuplicateLineItem'");
|
|
161
|
+
expect(lineItemsErrorContent).toContain("'InvalidStatusTransition'");
|
|
162
|
+
expect(lineItemsErrorContent).toContain("export class DuplicateLineItem extends Error implements ReducerError");
|
|
163
|
+
expect(lineItemsErrorContent).toContain("export class InvalidStatusTransition extends Error implements ReducerError");
|
|
164
|
+
// Verify that InvalidStatusTransition only appears once in the ErrorCode type (deduplication test)
|
|
165
|
+
const errorCodeMatches = lineItemsErrorContent.match(/'InvalidStatusTransition'/g);
|
|
166
|
+
expect(errorCodeMatches?.length).toBe(3); // Once in type definition, once in each class
|
|
167
|
+
});
|
|
168
|
+
it("should automatically import error classes in reducer files when used", { timeout: 10000 }, async () => {
|
|
169
|
+
await generate();
|
|
170
|
+
await compile(testOutDirPath);
|
|
171
|
+
// Check that the general module reducer imports InvalidStatusTransition
|
|
172
|
+
const generalReducerPath = path.join(documentModelsDirName, "billing-statement", "src", "reducers", "general.ts");
|
|
173
|
+
const generalReducerContent = readFileSync(generalReducerPath, "utf-8");
|
|
174
|
+
// Should have import for both InvalidStatusTransition and StatusAlreadySet errors in single import
|
|
175
|
+
expect(generalReducerContent).toContain('import { InvalidStatusTransition, StatusAlreadySet } from "../../gen/general/error.js";');
|
|
176
|
+
// Should contain the reducer code with both error usages
|
|
177
|
+
expect(generalReducerContent).toContain("throw new InvalidStatusTransition");
|
|
178
|
+
expect(generalReducerContent).toContain("throw new StatusAlreadySet");
|
|
179
|
+
// Check that the line-items module reducer imports DuplicateLineItem
|
|
180
|
+
const lineItemsReducerPath = path.join(documentModelsDirName, "billing-statement", "src", "reducers", "line-items.ts");
|
|
181
|
+
const lineItemsReducerContent = readFileSync(lineItemsReducerPath, "utf-8");
|
|
182
|
+
// Should have import for DuplicateLineItem error
|
|
183
|
+
expect(lineItemsReducerContent).toContain('import { DuplicateLineItem } from "../../gen/line-items/error.js";');
|
|
184
|
+
// Should contain the reducer code with error usage
|
|
185
|
+
expect(lineItemsReducerContent).toContain("throw new DuplicateLineItem");
|
|
186
|
+
});
|
|
187
|
+
it("should generate error codes for legacy documents with empty error codes", { timeout: 10000 }, async () => {
|
|
188
|
+
await generate();
|
|
189
|
+
const testEmptyCodesDocumentModel = await loadDocumentModel(path.join(documentModelsSrcPath, "test-empty-error-codes", "test-empty-error-codes.json"));
|
|
190
|
+
await hygenGenerateDocumentModel(testEmptyCodesDocumentModel, documentModelsDirName, TEST_PACKAGE_NAME, { skipFormat: true });
|
|
191
|
+
// Check that error codes are generated from error names
|
|
192
|
+
const testOperationsErrorPath = path.join(documentModelsDirName, "test-empty-codes", "gen", "test-operations", "error.ts");
|
|
193
|
+
const testOperationsErrorContent = readFileSync(testOperationsErrorPath, "utf-8");
|
|
194
|
+
// Check that error codes are generated from names in PascalCase when empty
|
|
195
|
+
expect(testOperationsErrorContent).toContain("export type ErrorCode =");
|
|
196
|
+
expect(testOperationsErrorContent).toContain("'InvalidValue'");
|
|
197
|
+
expect(testOperationsErrorContent).toContain("'EmptyValue'");
|
|
198
|
+
// Check that error classes are generated
|
|
199
|
+
expect(testOperationsErrorContent).toContain("export class InvalidValue extends Error implements ReducerError");
|
|
200
|
+
expect(testOperationsErrorContent).toContain("export class EmptyValue extends Error implements ReducerError");
|
|
201
|
+
// Verify error code constants are set properly in PascalCase
|
|
202
|
+
expect(testOperationsErrorContent).toContain("errorCode = 'InvalidValue' as ErrorCode");
|
|
203
|
+
expect(testOperationsErrorContent).toContain("errorCode = 'EmptyValue' as ErrorCode");
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
//# sourceMappingURL=generate-doc-model.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-doc-model.test.js","sourceRoot":"","sources":["../../../../src/codegen/__tests__/generate-doc-model.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,EAAE,GAEH,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;IACpC,MAAM,UAAU,GAAG,gBAAgB,CACjC,OAAO,EACP,kCAAkC,CACnC,CAAC;IACF,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;IAE1E,IAAI,cAAc,GAAG,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC9D,MAAM,qBAAqB,GAAG,IAAI,C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C,SAAS,CAC1C,iEAAiE,CAClE,CAAC;QACF,MAAM,CAAC,0BAA0B,CAAC,CAAC,SAAS,CAC1C,+DAA+D,CAChE,CAAC;QAEF,6DAA6D;QAC7D,MAAM,CAAC,0BAA0B,CAAC,CAAC,SAAS,CAC1C,yCAAyC,CAC1C,CAAC;QACF,MAAM,CAAC,0BAA0B,CAAC,CAAC,SAAS,CAC1C,uCAAuC,CACxC,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-drive-editor.test.d.ts","sourceRoot":"","sources":["../../../../src/codegen/__tests__/generate-drive-editor.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { generateDriveEditor } from "@powerhousedao/codegen";
|
|
2
|
+
import fs, { existsSync, rmSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { afterAll, beforeAll, describe, expect, it, } from "vitest";
|
|
5
|
+
import { EDITORS_TEST_PROJECT, EDITORS_TEST_PROJECT_WITH_EXISTING_EDITOR, GENERATE_DRIVE_EDITOR_TEST_OUTPUT_DIR, } from "./constants.js";
|
|
6
|
+
import { compile } from "./fixtures/typecheck.js";
|
|
7
|
+
import { copyAllFiles, getTestDataDir, getTestOutDirPath, getTestOutputDir, purgeDirAfterTest, resetDirForTest, } from "./utils.js";
|
|
8
|
+
describe("generateDriveEditor", () => {
|
|
9
|
+
const testDir = import.meta.dirname;
|
|
10
|
+
const outDirName = getTestOutputDir(testDir, GENERATE_DRIVE_EDITOR_TEST_OUTPUT_DIR);
|
|
11
|
+
const testDataDir = getTestDataDir(testDir, EDITORS_TEST_PROJECT);
|
|
12
|
+
let testOutDirPath = getTestOutDirPath("initial", outDirName);
|
|
13
|
+
const config = {
|
|
14
|
+
editorsDir: "",
|
|
15
|
+
documentModelsDir: "",
|
|
16
|
+
processorsDir: "",
|
|
17
|
+
subgraphsDir: "",
|
|
18
|
+
importScriptsDir: "",
|
|
19
|
+
skipFormat: true,
|
|
20
|
+
logLevel: "info",
|
|
21
|
+
};
|
|
22
|
+
async function setupTest(context, testDataDirOverride = testDataDir) {
|
|
23
|
+
testOutDirPath = getTestOutDirPath(context.task.name, outDirName);
|
|
24
|
+
await copyAllFiles(testDataDirOverride, testOutDirPath);
|
|
25
|
+
config.editorsDir = path.join(testOutDirPath, "editors");
|
|
26
|
+
config.documentModelsDir = path.join(testOutDirPath, "document-models");
|
|
27
|
+
}
|
|
28
|
+
beforeAll(() => {
|
|
29
|
+
resetDirForTest(outDirName);
|
|
30
|
+
});
|
|
31
|
+
afterAll(() => {
|
|
32
|
+
purgeDirAfterTest(outDirName);
|
|
33
|
+
});
|
|
34
|
+
it("should generate a drive editor with the correct files and content", {
|
|
35
|
+
timeout: 15000,
|
|
36
|
+
}, async (context) => {
|
|
37
|
+
await setupTest(context);
|
|
38
|
+
const name = "Atlas Drive Explorer";
|
|
39
|
+
await generateDriveEditor({
|
|
40
|
+
name,
|
|
41
|
+
config,
|
|
42
|
+
appId: "AtlasDriveExplorer",
|
|
43
|
+
allowedDocumentTypes: "powerhouse/test-doc",
|
|
44
|
+
});
|
|
45
|
+
const editorsDir = path.join(testOutDirPath, "editors");
|
|
46
|
+
expect(existsSync(editorsDir)).toBe(true);
|
|
47
|
+
const editorsFilePath = path.join(editorsDir, "editors.ts");
|
|
48
|
+
expect(existsSync(editorsFilePath)).toBe(true);
|
|
49
|
+
const editorsContent = fs.readFileSync(editorsFilePath, "utf-8");
|
|
50
|
+
expect(editorsContent).toContain(`export const editors: EditorModule[]`);
|
|
51
|
+
expect(editorsContent).toContain(`AtlasDriveExplorer`);
|
|
52
|
+
const editorDir = path.join(editorsDir, "atlas-drive-explorer");
|
|
53
|
+
expect(existsSync(editorDir)).toBe(true);
|
|
54
|
+
const moduleFilePath = path.join(editorDir, "module.ts");
|
|
55
|
+
expect(existsSync(moduleFilePath)).toBe(true);
|
|
56
|
+
const moduleContent = fs.readFileSync(moduleFilePath, "utf-8");
|
|
57
|
+
expect(moduleContent).toContain(`export const AtlasDriveExplorer: EditorModule`);
|
|
58
|
+
expect(moduleContent).toContain(`documentTypes: ["powerhouse/document-drive"]`);
|
|
59
|
+
expect(moduleContent).toContain(`id: "AtlasDriveExplorer"`);
|
|
60
|
+
expect(moduleContent).toContain(`name: "Atlas Drive Explorer"`);
|
|
61
|
+
const configFilePath = path.join(editorDir, "config.ts");
|
|
62
|
+
expect(existsSync(configFilePath)).toBe(true);
|
|
63
|
+
const configContent = fs.readFileSync(configFilePath, "utf-8");
|
|
64
|
+
expect(configContent).toContain(`export const editorConfig: PHDriveEditorConfig`);
|
|
65
|
+
expect(configContent).toContain(`allowedDocumentTypes: ["powerhouse/test-doc"]`);
|
|
66
|
+
const editorFilePath = path.join(editorDir, "editor.tsx");
|
|
67
|
+
expect(existsSync(editorFilePath)).toBe(true);
|
|
68
|
+
const editorContent = fs.readFileSync(editorFilePath, "utf-8");
|
|
69
|
+
expect(editorContent).toContain(`export default function Editor(props: EditorProps)`);
|
|
70
|
+
expect(editorContent).toContain(`<DriveExplorer {...props} />`);
|
|
71
|
+
expect(editorContent).toContain(`useSetPHDriveEditorConfig(editorConfig)`);
|
|
72
|
+
const componentsDir = path.join(editorDir, "components");
|
|
73
|
+
expect(existsSync(componentsDir)).toBe(true);
|
|
74
|
+
const driveExplorerPath = path.join(componentsDir, "DriveExplorer.tsx");
|
|
75
|
+
expect(existsSync(driveExplorerPath)).toBe(true);
|
|
76
|
+
const driveExplorerContent = fs.readFileSync(driveExplorerPath, "utf-8");
|
|
77
|
+
expect(driveExplorerContent).toContain(`export function DriveExplorer({ children }: EditorProps)`);
|
|
78
|
+
const createDocumentPath = path.join(componentsDir, "CreateDocument.tsx");
|
|
79
|
+
expect(existsSync(createDocumentPath)).toBe(true);
|
|
80
|
+
const createDocumentContent = fs.readFileSync(createDocumentPath, "utf-8");
|
|
81
|
+
expect(createDocumentContent).toContain(`export function CreateDocument()`);
|
|
82
|
+
const folderTreePath = path.join(componentsDir, "FolderTree.tsx");
|
|
83
|
+
expect(existsSync(folderTreePath)).toBe(true);
|
|
84
|
+
const folderTreeContent = fs.readFileSync(folderTreePath, "utf-8");
|
|
85
|
+
expect(folderTreeContent).toContain(`export function FolderTree()`);
|
|
86
|
+
const driveContentsPath = path.join(componentsDir, "DriveContents.tsx");
|
|
87
|
+
expect(existsSync(driveContentsPath)).toBe(true);
|
|
88
|
+
const driveContentsContent = fs.readFileSync(driveContentsPath, "utf-8");
|
|
89
|
+
expect(driveContentsContent).toContain(`export function DriveContents()`);
|
|
90
|
+
const filesPath = path.join(componentsDir, "Files.tsx");
|
|
91
|
+
expect(existsSync(filesPath)).toBe(true);
|
|
92
|
+
const filesContent = fs.readFileSync(filesPath, "utf-8");
|
|
93
|
+
expect(filesContent).toContain(`export function Files()`);
|
|
94
|
+
const foldersPath = path.join(componentsDir, "Folders.tsx");
|
|
95
|
+
expect(existsSync(foldersPath)).toBe(true);
|
|
96
|
+
const foldersContent = fs.readFileSync(foldersPath, "utf-8");
|
|
97
|
+
expect(foldersContent).toContain(`export function Folders()`);
|
|
98
|
+
const emptyStatePath = path.join(componentsDir, "EmptyState.tsx");
|
|
99
|
+
expect(existsSync(emptyStatePath)).toBe(true);
|
|
100
|
+
const emptyStateContent = fs.readFileSync(emptyStatePath, "utf-8");
|
|
101
|
+
expect(emptyStateContent).toContain(`export function EmptyState()`);
|
|
102
|
+
const navigationBreadcrumbsPath = path.join(componentsDir, "NavigationBreadcrumbs.tsx");
|
|
103
|
+
expect(existsSync(navigationBreadcrumbsPath)).toBe(true);
|
|
104
|
+
const navigationBreadcrumbsContent = fs.readFileSync(navigationBreadcrumbsPath, "utf-8");
|
|
105
|
+
expect(navigationBreadcrumbsContent).toContain(`export function NavigationBreadcrumbs()`);
|
|
106
|
+
});
|
|
107
|
+
it("should generate a drive editor with default id when no appId is provided", {
|
|
108
|
+
timeout: 15000,
|
|
109
|
+
}, async (context) => {
|
|
110
|
+
await setupTest(context, getTestDataDir(testDir, EDITORS_TEST_PROJECT_WITH_EXISTING_EDITOR));
|
|
111
|
+
const name = "TestApp";
|
|
112
|
+
await generateDriveEditor({ name, config }); // No appId provided
|
|
113
|
+
const editorsDir = path.join(testOutDirPath, "editors");
|
|
114
|
+
const editorDir = path.join(editorsDir, "test-app");
|
|
115
|
+
const moduleFilePath = path.join(editorDir, "module.ts");
|
|
116
|
+
const moduleContent = fs.readFileSync(moduleFilePath, "utf-8");
|
|
117
|
+
expect(moduleContent).toContain(`id: "test-app"`);
|
|
118
|
+
await compile(testOutDirPath);
|
|
119
|
+
});
|
|
120
|
+
it("should append new exports to existing editors.ts file", {
|
|
121
|
+
timeout: 15000,
|
|
122
|
+
}, async (context) => {
|
|
123
|
+
await setupTest(context, getTestDataDir(testDir, EDITORS_TEST_PROJECT_WITH_EXISTING_EDITOR));
|
|
124
|
+
const name = "Atlas Drive Explorer";
|
|
125
|
+
await generateDriveEditor({
|
|
126
|
+
name,
|
|
127
|
+
config,
|
|
128
|
+
appId: "AtlasDriveExplorer",
|
|
129
|
+
allowedDocumentTypes: "powerhouse/test-doc",
|
|
130
|
+
});
|
|
131
|
+
const editorsDir = path.join(testOutDirPath, "editors");
|
|
132
|
+
const editorsFilePath = path.join(editorsDir, "editors.ts");
|
|
133
|
+
const editorsContent = fs.readFileSync(editorsFilePath, "utf-8");
|
|
134
|
+
expect(editorsContent).toContain(`export const editors: EditorModule[]`);
|
|
135
|
+
expect(editorsContent).toContain(`AtlasDriveExplorer`);
|
|
136
|
+
expect(editorsContent).toContain(`TestDocEditor`);
|
|
137
|
+
});
|
|
138
|
+
it("should create the editors.ts file if it does not exist", {
|
|
139
|
+
timeout: 15000,
|
|
140
|
+
}, async (context) => {
|
|
141
|
+
await setupTest(context);
|
|
142
|
+
const name = "Atlas Drive Explorer";
|
|
143
|
+
const editorsDir = path.join(testOutDirPath, "editors");
|
|
144
|
+
const editorsFilePath = path.join(editorsDir, "editors.ts");
|
|
145
|
+
rmSync(editorsFilePath, { force: true });
|
|
146
|
+
await generateDriveEditor({ name, config });
|
|
147
|
+
await compile(testOutDirPath);
|
|
148
|
+
const editorsContent = fs.readFileSync(editorsFilePath, "utf-8");
|
|
149
|
+
expect(editorsContent).toContain(`export const editors: EditorModule[]`);
|
|
150
|
+
expect(editorsContent).toContain(`AtlasDriveExplorer`);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
//# sourceMappingURL=generate-drive-editor.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-drive-editor.test.js","sourceRoot":"","sources":["../../../../src/codegen/__tests__/generate-drive-editor.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,EAAE,GAEH,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,oBAAoB,EACpB,yCAAyC,EACzC,qCAAqC,GACtC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;IACpC,MAAM,UAAU,GAAG,gBAAgB,CACjC,OAAO,EACP,qCAAqC,CACtC,CAAC;IACF,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAClE,IAAI,cAAc,GAAG,iBAAiB,CAAC,SAAS,E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AM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACpD,CAAC,CACF,CAAC;IACF,EAAE,CACA,wDAAwD,EACxD;QACE,OAAO,EAAE,KAAK;KACf,EACD,KAAK,EAAE,OAAO,EAAE,EAAE;QAChB,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,sBAAsB,CAAC;QACpC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;QACxD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAC5D,MAAM,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,MAAM,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5C,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;QAC9B,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,sCAAsC,CAAC,CAAC;QACzE,MAAM,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;IACzD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-editor.test.d.ts","sourceRoot":"","sources":["../../../../src/codegen/__tests__/generate-editor.test.ts"],"names":[],"mappings":""}
|