@squiz/dxp-cli-next 5.33.0-develop.1 → 5.33.0-develop.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 +1 -0
- package/bin/dxp.js +6 -1
- package/dist/dxp.js +4480 -0
- package/package.json +36 -30
- package/lib/ApiService.d.ts +0 -39
- package/lib/ApiService.js +0 -120
- package/lib/ApiService.spec.d.ts +0 -1
- package/lib/ApiService.spec.js +0 -182
- package/lib/ApplicationConfig.d.ts +0 -7
- package/lib/ApplicationConfig.js +0 -38
- package/lib/ApplicationConfig.spec.d.ts +0 -1
- package/lib/ApplicationConfig.spec.js +0 -84
- package/lib/ApplicationStore.d.ts +0 -13
- package/lib/ApplicationStore.js +0 -53
- package/lib/__tests__/cmp/dev-mode.spec.d.ts +0 -1
- package/lib/__tests__/cmp/dev-mode.spec.js +0 -54
- package/lib/__tests__/helpers.d.ts +0 -17
- package/lib/__tests__/helpers.js +0 -54
- package/lib/__tests__/integration/main.spec.d.ts +0 -1
- package/lib/__tests__/integration/main.spec.js +0 -45
- package/lib/__tests__/smoke/validate.spec.d.ts +0 -1
- package/lib/__tests__/smoke/validate.spec.js +0 -37
- package/lib/__tests__/unit/cli.d.ts +0 -0
- package/lib/__tests__/unit/cli.js +0 -7
- package/lib/auth/index.d.ts +0 -3
- package/lib/auth/index.js +0 -14
- package/lib/auth/login/login.d.ts +0 -22
- package/lib/auth/login/login.js +0 -268
- package/lib/auth/login/login.spec.d.ts +0 -1
- package/lib/auth/login/login.spec.js +0 -179
- package/lib/auth/logout/logout.d.ts +0 -3
- package/lib/auth/logout/logout.js +0 -115
- package/lib/auth/logout/logout.spec.d.ts +0 -1
- package/lib/auth/logout/logout.spec.js +0 -67
- package/lib/cdp/constants.d.ts +0 -1
- package/lib/cdp/constants.js +0 -4
- package/lib/cdp/index.d.ts +0 -3
- package/lib/cdp/index.js +0 -16
- package/lib/cdp/instance/activate/activate.d.ts +0 -5
- package/lib/cdp/instance/activate/activate.js +0 -107
- package/lib/cdp/instance/activate/activate.spec.d.ts +0 -1
- package/lib/cdp/instance/activate/activate.spec.js +0 -274
- package/lib/cdp/instance/instanceCommand.d.ts +0 -3
- package/lib/cdp/instance/instanceCommand.js +0 -15
- package/lib/cdp/schema/deploy/deploy.const.d.ts +0 -5
- package/lib/cdp/schema/deploy/deploy.const.js +0 -8
- package/lib/cdp/schema/deploy/deploy.d.ts +0 -4
- package/lib/cdp/schema/deploy/deploy.js +0 -107
- package/lib/cdp/schema/deploy/deploy.spec.d.ts +0 -1
- package/lib/cdp/schema/deploy/deploy.spec.js +0 -137
- package/lib/cdp/schema/schemaCommand.d.ts +0 -3
- package/lib/cdp/schema/schemaCommand.js +0 -15
- package/lib/cdp/utils.d.ts +0 -23
- package/lib/cdp/utils.js +0 -133
- package/lib/cmp/deploy.d.ts +0 -3
- package/lib/cmp/deploy.js +0 -124
- package/lib/cmp/dev-mode-ui.d.ts +0 -4
- package/lib/cmp/dev-mode-ui.js +0 -51
- package/lib/cmp/dev-mode.d.ts +0 -4
- package/lib/cmp/dev-mode.js +0 -58
- package/lib/cmp/edge-components/compiler.d.ts +0 -13
- package/lib/cmp/edge-components/compiler.js +0 -55
- package/lib/cmp/index.d.ts +0 -3
- package/lib/cmp/index.js +0 -18
- package/lib/cmp/init.d.ts +0 -3
- package/lib/cmp/init.js +0 -105
- package/lib/cmp/utils/definitions.d.ts +0 -481
- package/lib/cmp/utils/definitions.js +0 -262
- package/lib/cmp/utils/definitions.spec.d.ts +0 -1
- package/lib/cmp/utils/definitions.spec.js +0 -503
- package/lib/constants.d.ts +0 -1
- package/lib/constants.js +0 -4
- package/lib/datastore/blueprint/add/add.d.ts +0 -3
- package/lib/datastore/blueprint/add/add.js +0 -119
- package/lib/datastore/blueprint/add/add.spec.d.ts +0 -1
- package/lib/datastore/blueprint/add/add.spec.js +0 -134
- package/lib/datastore/blueprint/blueprintCommand.d.ts +0 -3
- package/lib/datastore/blueprint/blueprintCommand.js +0 -21
- package/lib/datastore/blueprint/list/list.d.ts +0 -3
- package/lib/datastore/blueprint/list/list.js +0 -76
- package/lib/datastore/blueprint/list/list.spec.d.ts +0 -1
- package/lib/datastore/blueprint/list/list.spec.js +0 -51
- package/lib/datastore/blueprint/rename/rename.d.ts +0 -3
- package/lib/datastore/blueprint/rename/rename.js +0 -93
- package/lib/datastore/blueprint/rename/rename.spec.d.ts +0 -1
- package/lib/datastore/blueprint/rename/rename.spec.js +0 -142
- package/lib/datastore/blueprint/update/update.d.ts +0 -3
- package/lib/datastore/blueprint/update/update.js +0 -89
- package/lib/datastore/blueprint/update/update.spec.d.ts +0 -1
- package/lib/datastore/blueprint/update/update.spec.js +0 -99
- package/lib/datastore/bundle/bundle.d.ts +0 -3
- package/lib/datastore/bundle/bundle.js +0 -176
- package/lib/datastore/bundle/bundle.spec.d.ts +0 -1
- package/lib/datastore/bundle/bundle.spec.js +0 -94
- package/lib/datastore/index.d.ts +0 -3
- package/lib/datastore/index.js +0 -16
- package/lib/datastore/simulator/add/add.d.ts +0 -3
- package/lib/datastore/simulator/add/add.js +0 -125
- package/lib/datastore/simulator/add/add.spec.d.ts +0 -1
- package/lib/datastore/simulator/add/add.spec.js +0 -114
- package/lib/datastore/simulator/clear/clear.d.ts +0 -3
- package/lib/datastore/simulator/clear/clear.js +0 -70
- package/lib/datastore/simulator/clear/clear.spec.d.ts +0 -1
- package/lib/datastore/simulator/clear/clear.spec.js +0 -224
- package/lib/datastore/simulator/list/list.d.ts +0 -3
- package/lib/datastore/simulator/list/list.js +0 -115
- package/lib/datastore/simulator/list/list.spec.d.ts +0 -1
- package/lib/datastore/simulator/list/list.spec.js +0 -95
- package/lib/datastore/simulator/pause/pause.d.ts +0 -3
- package/lib/datastore/simulator/pause/pause.js +0 -84
- package/lib/datastore/simulator/pause/pause.spec.d.ts +0 -1
- package/lib/datastore/simulator/pause/pause.spec.js +0 -90
- package/lib/datastore/simulator/remove/remove.d.ts +0 -3
- package/lib/datastore/simulator/remove/remove.js +0 -68
- package/lib/datastore/simulator/remove/remove.spec.d.ts +0 -1
- package/lib/datastore/simulator/remove/remove.spec.js +0 -224
- package/lib/datastore/simulator/resume/resume.d.ts +0 -3
- package/lib/datastore/simulator/resume/resume.js +0 -84
- package/lib/datastore/simulator/resume/resume.spec.d.ts +0 -1
- package/lib/datastore/simulator/resume/resume.spec.js +0 -90
- package/lib/datastore/simulator/simulatorCommand.d.ts +0 -3
- package/lib/datastore/simulator/simulatorCommand.js +0 -27
- package/lib/datastore/simulator/upgrade/upgrade.d.ts +0 -3
- package/lib/datastore/simulator/upgrade/upgrade.js +0 -157
- package/lib/datastore/simulator/upgrade/upgrade.spec.d.ts +0 -1
- package/lib/datastore/simulator/upgrade/upgrade.spec.js +0 -199
- package/lib/datastore/simulator/utils.d.ts +0 -29
- package/lib/datastore/simulator/utils.js +0 -218
- package/lib/datastore/simulator/utils.spec.d.ts +0 -1
- package/lib/datastore/simulator/utils.spec.js +0 -201
- package/lib/datastore/utils.d.ts +0 -20
- package/lib/datastore/utils.js +0 -241
- package/lib/datastore/utils.spec.d.ts +0 -1
- package/lib/datastore/utils.spec.js +0 -113
- package/lib/dxp.d.ts +0 -1
- package/lib/dxp.js +0 -57
- package/lib/job-runner/index.d.ts +0 -3
- package/lib/job-runner/index.js +0 -22
- package/lib/job-runner/job/listJobs/listJobs.d.ts +0 -3
- package/lib/job-runner/job/listJobs/listJobs.js +0 -66
- package/lib/job-runner/job/listJobs/listJobs.spec.d.ts +0 -1
- package/lib/job-runner/job/listJobs/listJobs.spec.js +0 -42
- package/lib/job-runner/job/uploadJob/uploadJob.d.ts +0 -3
- package/lib/job-runner/job/uploadJob/uploadJob.js +0 -56
- package/lib/job-runner/job/uploadJob/uploadJob.spec.d.ts +0 -1
- package/lib/job-runner/job/uploadJob/uploadJob.spec.js +0 -42
- package/lib/job-runner/jobContext/listJobContexts.d.ts +0 -3
- package/lib/job-runner/jobContext/listJobContexts.js +0 -66
- package/lib/job-runner/jobContext/listJobContexts.spec.d.ts +0 -1
- package/lib/job-runner/jobContext/listJobContexts.spec.js +0 -58
- package/lib/job-runner/jobExecution/beginJob/beginJob.d.ts +0 -3
- package/lib/job-runner/jobExecution/beginJob/beginJob.js +0 -68
- package/lib/job-runner/jobExecution/beginJob/beginJob.spec.d.ts +0 -1
- package/lib/job-runner/jobExecution/beginJob/beginJob.spec.js +0 -62
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.d.ts +0 -3
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.js +0 -67
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.spec.d.ts +0 -1
- package/lib/job-runner/jobExecution/listJobExecutions/listJobExecutions.spec.js +0 -64
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.d.ts +0 -3
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.js +0 -64
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.spec.d.ts +0 -1
- package/lib/job-runner/jobExecution/terminateJob/terminateJob.spec.js +0 -61
- package/lib/job-runner/utils.d.ts +0 -19
- package/lib/job-runner/utils.js +0 -145
- package/lib/job-runner/utils.spec.d.ts +0 -1
- package/lib/job-runner/utils.spec.js +0 -116
- package/lib/migration/create/create.d.ts +0 -3
- package/lib/migration/create/create.js +0 -56
- package/lib/migration/create/create.spec.d.ts +0 -1
- package/lib/migration/create/create.spec.js +0 -280
- package/lib/migration/get/get.d.ts +0 -3
- package/lib/migration/get/get.js +0 -46
- package/lib/migration/get/get.spec.d.ts +0 -1
- package/lib/migration/get/get.spec.js +0 -287
- package/lib/migration/index.d.ts +0 -3
- package/lib/migration/index.js +0 -24
- package/lib/migration/list/list.d.ts +0 -3
- package/lib/migration/list/list.js +0 -45
- package/lib/migration/list/list.spec.d.ts +0 -1
- package/lib/migration/list/list.spec.js +0 -138
- package/lib/migration/next/next.d.ts +0 -3
- package/lib/migration/next/next.js +0 -75
- package/lib/migration/next/next.spec.d.ts +0 -1
- package/lib/migration/next/next.spec.js +0 -253
- package/lib/migration/pre/pre.d.ts +0 -3
- package/lib/migration/pre/pre.js +0 -54
- package/lib/migration/pre/pre.spec.d.ts +0 -1
- package/lib/migration/pre/pre.spec.js +0 -269
- package/lib/migration/revert/revert.d.ts +0 -3
- package/lib/migration/revert/revert.js +0 -47
- package/lib/migration/revert/revert.spec.d.ts +0 -1
- package/lib/migration/revert/revert.spec.js +0 -153
- package/lib/migration/settings/settings.d.ts +0 -3
- package/lib/migration/settings/settings.js +0 -63
- package/lib/migration/settings/settings.spec.d.ts +0 -1
- package/lib/migration/settings/settings.spec.js +0 -339
- package/lib/migration/types/common.types.d.ts +0 -29
- package/lib/migration/types/common.types.js +0 -2
- package/lib/migration/types/createMigration.types.d.ts +0 -10
- package/lib/migration/types/createMigration.types.js +0 -2
- package/lib/migration/types/getMigration.types.d.ts +0 -5
- package/lib/migration/types/getMigration.types.js +0 -2
- package/lib/migration/types/index.d.ts +0 -7
- package/lib/migration/types/index.js +0 -23
- package/lib/migration/types/listMigrations.types.d.ts +0 -2
- package/lib/migration/types/listMigrations.types.js +0 -2
- package/lib/migration/types/nextStage.types.d.ts +0 -10
- package/lib/migration/types/nextStage.types.js +0 -2
- package/lib/migration/types/preMigration.types.d.ts +0 -10
- package/lib/migration/types/preMigration.types.js +0 -2
- package/lib/migration/types/revert.types.d.ts +0 -6
- package/lib/migration/types/revert.types.js +0 -2
- package/lib/migration/types/settings.types.d.ts +0 -15
- package/lib/migration/types/settings.types.js +0 -2
- package/lib/migration/utils/common.d.ts +0 -39
- package/lib/migration/utils/common.js +0 -134
- package/lib/migration/utils/common.spec.d.ts +0 -1
- package/lib/migration/utils/common.spec.js +0 -165
- package/lib/migration/utils/createMigration.d.ts +0 -33
- package/lib/migration/utils/createMigration.js +0 -125
- package/lib/migration/utils/createMigration.spec.d.ts +0 -1
- package/lib/migration/utils/createMigration.spec.js +0 -259
- package/lib/migration/utils/getMigration.d.ts +0 -2
- package/lib/migration/utils/getMigration.js +0 -41
- package/lib/migration/utils/getMigration.spec.d.ts +0 -1
- package/lib/migration/utils/getMigration.spec.js +0 -156
- package/lib/migration/utils/index.d.ts +0 -9
- package/lib/migration/utils/index.js +0 -25
- package/lib/migration/utils/listMigrations.d.ts +0 -3
- package/lib/migration/utils/listMigrations.js +0 -41
- package/lib/migration/utils/listMigrations.spec.d.ts +0 -1
- package/lib/migration/utils/listMigrations.spec.js +0 -108
- package/lib/migration/utils/loadCctIdsFromFile.d.ts +0 -1
- package/lib/migration/utils/loadCctIdsFromFile.js +0 -32
- package/lib/migration/utils/loadCctIdsFromFile.spec.d.ts +0 -1
- package/lib/migration/utils/loadCctIdsFromFile.spec.js +0 -91
- package/lib/migration/utils/loadStageOptionsFromFile.d.ts +0 -1
- package/lib/migration/utils/loadStageOptionsFromFile.js +0 -32
- package/lib/migration/utils/loadStageOptionsFromFile.spec.d.ts +0 -1
- package/lib/migration/utils/loadStageOptionsFromFile.spec.js +0 -77
- package/lib/migration/utils/nextStage.d.ts +0 -2
- package/lib/migration/utils/nextStage.js +0 -45
- package/lib/migration/utils/nextStage.spec.d.ts +0 -1
- package/lib/migration/utils/nextStage.spec.js +0 -151
- package/lib/migration/utils/options.d.ts +0 -15
- package/lib/migration/utils/options.js +0 -106
- package/lib/migration/utils/options.spec.d.ts +0 -1
- package/lib/migration/utils/options.spec.js +0 -115
- package/lib/migration/utils/promptForMorphConfirmation.d.ts +0 -5
- package/lib/migration/utils/promptForMorphConfirmation.js +0 -55
- package/lib/migration/utils/promptForMorphConfirmation.spec.d.ts +0 -1
- package/lib/migration/utils/promptForMorphConfirmation.spec.js +0 -101
- package/lib/migration/utils/revertMigration.d.ts +0 -2
- package/lib/migration/utils/revertMigration.js +0 -38
- package/lib/migration/utils/revertMigration.spec.d.ts +0 -1
- package/lib/migration/utils/revertMigration.spec.js +0 -95
- package/lib/migration/utils/setMigrationSettings.d.ts +0 -2
- package/lib/migration/utils/setMigrationSettings.js +0 -52
- package/lib/migration/utils/setMigrationSettings.spec.d.ts +0 -1
- package/lib/migration/utils/setMigrationSettings.spec.js +0 -163
- package/lib/page/index.d.ts +0 -3
- package/lib/page/index.js +0 -12
- package/lib/page/layouts/deploy/deploy.d.ts +0 -5
- package/lib/page/layouts/deploy/deploy.js +0 -157
- package/lib/page/layouts/deploy/deploy.spec.d.ts +0 -1
- package/lib/page/layouts/deploy/deploy.spec.js +0 -319
- package/lib/page/layouts/dev/dev.d.ts +0 -5
- package/lib/page/layouts/dev/dev.js +0 -84
- package/lib/page/layouts/dev/dev.spec.d.ts +0 -1
- package/lib/page/layouts/dev/dev.spec.js +0 -271
- package/lib/page/layouts/layouts.d.ts +0 -3
- package/lib/page/layouts/layouts.js +0 -17
- package/lib/page/layouts/layouts.spec.d.ts +0 -1
- package/lib/page/layouts/layouts.spec.js +0 -29
- package/lib/page/layouts/validation/index.d.ts +0 -3
- package/lib/page/layouts/validation/index.js +0 -9
- package/lib/page/layouts/validation/property-consistency.d.ts +0 -7
- package/lib/page/layouts/validation/property-consistency.js +0 -92
- package/lib/page/layouts/validation/property-consistency.spec.d.ts +0 -1
- package/lib/page/layouts/validation/property-consistency.spec.js +0 -305
- package/lib/page/layouts/validation/validateLayoutFormat.d.ts +0 -2
- package/lib/page/layouts/validation/validateLayoutFormat.js +0 -27
- package/lib/page/layouts/validation/validateLayoutFormat.spec.d.ts +0 -1
- package/lib/page/layouts/validation/validateLayoutFormat.spec.js +0 -42
- package/lib/page/layouts/validation/zone-consistency.d.ts +0 -7
- package/lib/page/layouts/validation/zone-consistency.js +0 -50
- package/lib/page/layouts/validation/zone-consistency.spec.d.ts +0 -1
- package/lib/page/layouts/validation/zone-consistency.spec.js +0 -99
- package/lib/page/templates/validation.d.ts +0 -11
- package/lib/page/templates/validation.js +0 -30
- package/lib/page/templates/validation.spec.d.ts +0 -1
- package/lib/page/templates/validation.spec.js +0 -89
- package/lib/page/utils/definitions.d.ts +0 -552
- package/lib/page/utils/definitions.js +0 -241
- package/lib/page/utils/definitions.spec.d.ts +0 -1
- package/lib/page/utils/definitions.spec.js +0 -749
- package/lib/page/utils/normalize.d.ts +0 -8
- package/lib/page/utils/normalize.js +0 -54
- package/lib/page/utils/normalize.spec.d.ts +0 -1
- package/lib/page/utils/normalize.spec.js +0 -315
- package/lib/page/utils/parse-args.d.ts +0 -44
- package/lib/page/utils/parse-args.js +0 -119
- package/lib/page/utils/parse-args.spec.d.ts +0 -1
- package/lib/page/utils/parse-args.spec.js +0 -284
- package/lib/page/utils/render.d.ts +0 -51
- package/lib/page/utils/render.js +0 -112
- package/lib/page/utils/render.spec.d.ts +0 -1
- package/lib/page/utils/render.spec.js +0 -134
- package/lib/page/utils/server.d.ts +0 -12
- package/lib/page/utils/server.js +0 -201
- package/lib/page/utils/server.spec.d.ts +0 -1
- package/lib/page/utils/server.spec.js +0 -275
- package/lib/porter/constants.d.ts +0 -11
- package/lib/porter/constants.js +0 -14
- package/lib/porter/index.d.ts +0 -3
- package/lib/porter/index.js +0 -24
- package/lib/porter/port/abort/abort.d.ts +0 -3
- package/lib/porter/port/abort/abort.js +0 -80
- package/lib/porter/port/abort/abort.spec.d.ts +0 -1
- package/lib/porter/port/abort/abort.spec.js +0 -182
- package/lib/porter/port/get/get.d.ts +0 -3
- package/lib/porter/port/get/get.js +0 -96
- package/lib/porter/port/get/get.spec.d.ts +0 -1
- package/lib/porter/port/get/get.spec.js +0 -277
- package/lib/porter/port/start/start.d.ts +0 -3
- package/lib/porter/port/start/start.js +0 -82
- package/lib/porter/port/start/start.spec.d.ts +0 -1
- package/lib/porter/port/start/start.spec.js +0 -198
- package/lib/porter/project/add/add.d.ts +0 -3
- package/lib/porter/project/add/add.js +0 -138
- package/lib/porter/project/add/add.spec.d.ts +0 -1
- package/lib/porter/project/add/add.spec.js +0 -269
- package/lib/porter/project/get/get.d.ts +0 -3
- package/lib/porter/project/get/get.js +0 -65
- package/lib/porter/project/get/get.spec.d.ts +0 -1
- package/lib/porter/project/get/get.spec.js +0 -185
- package/lib/porter/project/remove/remove.d.ts +0 -3
- package/lib/porter/project/remove/remove.js +0 -69
- package/lib/porter/project/remove/remove.spec.d.ts +0 -1
- package/lib/porter/project/remove/remove.spec.js +0 -201
- package/lib/porter/types.d.ts +0 -5
- package/lib/porter/types.js +0 -2
- package/lib/porter/utils/BuildDXPUrl/BuildDXPUrl.d.ts +0 -4
- package/lib/porter/utils/BuildDXPUrl/BuildDXPUrl.js +0 -34
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.d.ts +0 -1
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.js +0 -21
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.spec.d.ts +0 -1
- package/lib/porter/utils/BuildPorterUrl/BuildPorterUrl.spec.js +0 -52
- package/lib/porter/utils/CoreUtils/CoreUtils.d.ts +0 -2
- package/lib/porter/utils/CoreUtils/CoreUtils.js +0 -13
- package/lib/porter/utils/CoreUtils/CoreUtils.spec.d.ts +0 -1
- package/lib/porter/utils/CoreUtils/CoreUtils.spec.js +0 -36
- package/lib/porter/utils/DoesPathExist/DoesPathExist.d.ts +0 -1
- package/lib/porter/utils/DoesPathExist/DoesPathExist.js +0 -27
- package/lib/porter/utils/DoesPathExist/DoesPathExist.spec.d.ts +0 -1
- package/lib/porter/utils/DoesPathExist/DoesPathExist.spec.js +0 -40
- package/lib/porter/utils/ErrorUtils/ErrorUtils.d.ts +0 -4
- package/lib/porter/utils/ErrorUtils/ErrorUtils.js +0 -66
- package/lib/porter/utils/ErrorUtils/ErrorUtils.spec.d.ts +0 -1
- package/lib/porter/utils/ErrorUtils/ErrorUtils.spec.js +0 -176
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.d.ts +0 -2
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.js +0 -33
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.spec.d.ts +0 -1
- package/lib/porter/utils/GetProjectConfig/GetProjectConfig.spec.js +0 -50
- package/lib/porter/utils/GetProjectName/GetProjectName.d.ts +0 -4
- package/lib/porter/utils/GetProjectName/GetProjectName.js +0 -30
- package/lib/porter/utils/GetProjectName/GetProjectName.spec.d.ts +0 -1
- package/lib/porter/utils/GetProjectName/GetProjectName.spec.js +0 -91
- package/lib/porter/utils/index.d.ts +0 -7
- package/lib/porter/utils/index.js +0 -23
|
@@ -1,749 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const fs = __importStar(require("node:fs/promises"));
|
|
36
|
-
const definitions_1 = require("./definitions");
|
|
37
|
-
const validation_1 = require("../templates/validation");
|
|
38
|
-
jest.mock('node:fs/promises');
|
|
39
|
-
describe('loadLayoutDefinition', () => {
|
|
40
|
-
const manifestJson = './some-dir/manifest.json';
|
|
41
|
-
const pageLayoutYaml = './some-dir/page-layout.yaml';
|
|
42
|
-
const jsonContent = JSON.stringify({
|
|
43
|
-
name: 'test-layout',
|
|
44
|
-
displayName: 'Test Layout',
|
|
45
|
-
description: 'A test layout',
|
|
46
|
-
zones: [
|
|
47
|
-
{
|
|
48
|
-
key: 'main',
|
|
49
|
-
displayName: 'Main Zone',
|
|
50
|
-
description: 'Main content area',
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
properties: {
|
|
54
|
-
color: {
|
|
55
|
-
title: 'Color',
|
|
56
|
-
description: 'Color options',
|
|
57
|
-
type: 'string',
|
|
58
|
-
enum: ['red', 'blue'],
|
|
59
|
-
},
|
|
60
|
-
showHeader: {
|
|
61
|
-
title: 'Show Header',
|
|
62
|
-
description: 'Toggle header visibility',
|
|
63
|
-
type: 'boolean',
|
|
64
|
-
},
|
|
65
|
-
customTitle: {
|
|
66
|
-
title: 'Custom Title',
|
|
67
|
-
description: 'Enter a custom title',
|
|
68
|
-
type: 'string',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
entry: 'template.hbs',
|
|
72
|
-
});
|
|
73
|
-
// missing "name" field
|
|
74
|
-
const jsonContentInvalidLayout = JSON.stringify({
|
|
75
|
-
displayName: 'Test Layout',
|
|
76
|
-
description: 'A test layout',
|
|
77
|
-
zones: [
|
|
78
|
-
{
|
|
79
|
-
key: 'main',
|
|
80
|
-
displayName: 'Main Zone',
|
|
81
|
-
description: 'Main content area',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
properties: {
|
|
85
|
-
color: {
|
|
86
|
-
title: 'Color',
|
|
87
|
-
description: 'Color options',
|
|
88
|
-
type: 'string',
|
|
89
|
-
enum: ['red', 'blue'],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
entry: 'template.hbs',
|
|
93
|
-
});
|
|
94
|
-
const yamlContent = `
|
|
95
|
-
name: test-layout
|
|
96
|
-
displayName: Test Layout
|
|
97
|
-
description: A test layout
|
|
98
|
-
zones:
|
|
99
|
-
main:
|
|
100
|
-
displayName: Main Zone
|
|
101
|
-
description: Main content area
|
|
102
|
-
minNodes: 1
|
|
103
|
-
options:
|
|
104
|
-
color:
|
|
105
|
-
displayName: Color
|
|
106
|
-
description: Color options
|
|
107
|
-
values: ['red', 'blue']
|
|
108
|
-
entry: template.hbs
|
|
109
|
-
`;
|
|
110
|
-
// missing "name" field
|
|
111
|
-
const yamlContentInvalidLayout = `
|
|
112
|
-
displayName: Test Layout
|
|
113
|
-
description: A test layout
|
|
114
|
-
zones:
|
|
115
|
-
main:
|
|
116
|
-
displayName: Main Zone
|
|
117
|
-
description: Main content area
|
|
118
|
-
minNodes: 1
|
|
119
|
-
options:
|
|
120
|
-
color:
|
|
121
|
-
displayName: Color
|
|
122
|
-
description: Color options
|
|
123
|
-
values: ['red', 'blue']
|
|
124
|
-
entry: template.hbs
|
|
125
|
-
`;
|
|
126
|
-
const templateContent = '<div>{{content}}</div>';
|
|
127
|
-
beforeEach(() => {
|
|
128
|
-
jest.resetAllMocks();
|
|
129
|
-
});
|
|
130
|
-
it('should load layout definition from manifest JSON file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
131
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
132
|
-
if (filePath.endsWith('manifest.json')) {
|
|
133
|
-
return jsonContent;
|
|
134
|
-
}
|
|
135
|
-
if (filePath.endsWith('template.hbs')) {
|
|
136
|
-
return templateContent;
|
|
137
|
-
}
|
|
138
|
-
throw new Error('File not found');
|
|
139
|
-
});
|
|
140
|
-
const layoutDefinition = yield (0, definitions_1.loadLayoutDefinition)(manifestJson);
|
|
141
|
-
expect(layoutDefinition).toEqual({
|
|
142
|
-
name: 'test-layout',
|
|
143
|
-
displayName: 'Test Layout',
|
|
144
|
-
description: 'A test layout',
|
|
145
|
-
zones: [
|
|
146
|
-
{
|
|
147
|
-
key: 'main',
|
|
148
|
-
displayName: 'Main Zone',
|
|
149
|
-
description: 'Main content area',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
properties: {
|
|
153
|
-
color: {
|
|
154
|
-
title: 'Color',
|
|
155
|
-
description: 'Color options',
|
|
156
|
-
type: 'string',
|
|
157
|
-
enum: ['red', 'blue'],
|
|
158
|
-
},
|
|
159
|
-
showHeader: {
|
|
160
|
-
title: 'Show Header',
|
|
161
|
-
description: 'Toggle header visibility',
|
|
162
|
-
type: 'boolean',
|
|
163
|
-
},
|
|
164
|
-
customTitle: {
|
|
165
|
-
title: 'Custom Title',
|
|
166
|
-
description: 'Enter a custom title',
|
|
167
|
-
type: 'string',
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
template: templateContent,
|
|
171
|
-
});
|
|
172
|
-
}));
|
|
173
|
-
it('should throw validation error if invalid data for manifest JSON', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
174
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
175
|
-
if (filePath.endsWith('manifest.json')) {
|
|
176
|
-
return jsonContentInvalidLayout;
|
|
177
|
-
}
|
|
178
|
-
if (filePath.endsWith('template.hbs')) {
|
|
179
|
-
return templateContent;
|
|
180
|
-
}
|
|
181
|
-
throw new Error('File not found');
|
|
182
|
-
});
|
|
183
|
-
yield expect((0, definitions_1.loadLayoutDefinition)(manifestJson)).rejects
|
|
184
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
185
|
-
"Failed loading layout definition: Failed to parse ./some-dir/manifest.json:
|
|
186
|
-
|
|
187
|
-
Schema validation failed:
|
|
188
|
-
- Required at "name""
|
|
189
|
-
`);
|
|
190
|
-
}));
|
|
191
|
-
it('should throw an error if JSON layout file has invalid manifest JSON', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
192
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
193
|
-
if (filePath.endsWith('manifest.json')) {
|
|
194
|
-
return '{invalid: json';
|
|
195
|
-
}
|
|
196
|
-
if (filePath.endsWith('template.hbs')) {
|
|
197
|
-
return templateContent;
|
|
198
|
-
}
|
|
199
|
-
throw new Error('File not found');
|
|
200
|
-
});
|
|
201
|
-
yield expect((0, definitions_1.loadLayoutDefinition)(manifestJson)).rejects
|
|
202
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
203
|
-
"Failed loading layout definition: Failed to parse ./some-dir/manifest.json: Flow map must end with a } at line 1, column 15:
|
|
204
|
-
|
|
205
|
-
{invalid: json
|
|
206
|
-
^
|
|
207
|
-
"
|
|
208
|
-
`);
|
|
209
|
-
}));
|
|
210
|
-
it('should throw an error if layout file do not have valid extension', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
211
|
-
yield expect((0, definitions_1.loadLayoutDefinition)('/foo/manifest.html')).rejects.toThrow('Layout file must have a valid extension: [yaml|json]');
|
|
212
|
-
}));
|
|
213
|
-
it('should throw an error if template file is not found', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
214
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
215
|
-
if (filePath.endsWith('manifest.json')) {
|
|
216
|
-
return jsonContent;
|
|
217
|
-
}
|
|
218
|
-
throw Error('File not found');
|
|
219
|
-
});
|
|
220
|
-
yield expect((0, definitions_1.loadLayoutDefinition)(manifestJson)).rejects.toThrow('Failed loading layout definition: Failed loading template file "template.hbs": File not found');
|
|
221
|
-
}));
|
|
222
|
-
it('should load layout definition without options and maxNodes from manifest JSON file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
223
|
-
const jsonContentWithoutOptionsAndMaxNodes = JSON.stringify({
|
|
224
|
-
name: 'test-layout',
|
|
225
|
-
displayName: 'Test Layout',
|
|
226
|
-
description: 'A test layout',
|
|
227
|
-
zones: [
|
|
228
|
-
{
|
|
229
|
-
key: 'main',
|
|
230
|
-
displayName: 'Main Zone',
|
|
231
|
-
description: 'Main content area',
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
key: 'sidebar',
|
|
235
|
-
displayName: 'Sidebar Zone',
|
|
236
|
-
description: 'Sidebar content area',
|
|
237
|
-
},
|
|
238
|
-
],
|
|
239
|
-
entry: 'template.hbs',
|
|
240
|
-
});
|
|
241
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
242
|
-
if (filePath.endsWith('manifest.json')) {
|
|
243
|
-
return jsonContentWithoutOptionsAndMaxNodes;
|
|
244
|
-
}
|
|
245
|
-
if (filePath.endsWith('template.hbs')) {
|
|
246
|
-
return templateContent;
|
|
247
|
-
}
|
|
248
|
-
throw new Error('File not found');
|
|
249
|
-
});
|
|
250
|
-
const layoutDefinition = yield (0, definitions_1.loadLayoutDefinition)(manifestJson);
|
|
251
|
-
expect(layoutDefinition).toEqual({
|
|
252
|
-
name: 'test-layout',
|
|
253
|
-
displayName: 'Test Layout',
|
|
254
|
-
description: 'A test layout',
|
|
255
|
-
zones: [
|
|
256
|
-
{
|
|
257
|
-
key: 'main',
|
|
258
|
-
displayName: 'Main Zone',
|
|
259
|
-
description: 'Main content area',
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
key: 'sidebar',
|
|
263
|
-
displayName: 'Sidebar Zone',
|
|
264
|
-
description: 'Sidebar content area',
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
template: templateContent,
|
|
268
|
-
});
|
|
269
|
-
}));
|
|
270
|
-
describe('YAML format (deprecated)', () => {
|
|
271
|
-
it('should load layout definition from YAML file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
272
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
273
|
-
if (filePath.endsWith('page-layout.yaml')) {
|
|
274
|
-
return yamlContent;
|
|
275
|
-
}
|
|
276
|
-
if (filePath.endsWith('template.hbs')) {
|
|
277
|
-
return templateContent;
|
|
278
|
-
}
|
|
279
|
-
throw new Error('File not found');
|
|
280
|
-
});
|
|
281
|
-
const layoutDefinition = yield (0, definitions_1.loadLayoutDefinition)(pageLayoutYaml);
|
|
282
|
-
expect(layoutDefinition).toEqual({
|
|
283
|
-
name: 'test-layout',
|
|
284
|
-
displayName: 'Test Layout',
|
|
285
|
-
description: 'A test layout',
|
|
286
|
-
zones: [
|
|
287
|
-
{
|
|
288
|
-
key: 'main',
|
|
289
|
-
displayName: 'Main Zone',
|
|
290
|
-
description: 'Main content area',
|
|
291
|
-
},
|
|
292
|
-
],
|
|
293
|
-
properties: {
|
|
294
|
-
color: {
|
|
295
|
-
title: 'Color',
|
|
296
|
-
description: 'Color options',
|
|
297
|
-
type: 'string',
|
|
298
|
-
enum: ['red', 'blue'],
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
template: templateContent,
|
|
302
|
-
});
|
|
303
|
-
}));
|
|
304
|
-
it('should throw validation error if invalid data for YAML', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
305
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
306
|
-
if (filePath.endsWith('page-layout.yaml')) {
|
|
307
|
-
return yamlContentInvalidLayout;
|
|
308
|
-
}
|
|
309
|
-
if (filePath.endsWith('template.hbs')) {
|
|
310
|
-
return templateContent;
|
|
311
|
-
}
|
|
312
|
-
throw new Error('File not found');
|
|
313
|
-
});
|
|
314
|
-
yield expect((0, definitions_1.loadLayoutDefinition)(pageLayoutYaml)).rejects
|
|
315
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
316
|
-
"Failed loading layout definition: Failed to parse ./some-dir/page-layout.yaml:
|
|
317
|
-
|
|
318
|
-
Schema validation failed:
|
|
319
|
-
- Required at "name""
|
|
320
|
-
`);
|
|
321
|
-
}));
|
|
322
|
-
it('should throw an error if YAML contains properties (instead of options)', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
323
|
-
const yamlContentWithProperties = `
|
|
324
|
-
name: test-layout
|
|
325
|
-
displayName: Test Layout
|
|
326
|
-
description: A test layout
|
|
327
|
-
zones:
|
|
328
|
-
main:
|
|
329
|
-
displayName: Main Zone
|
|
330
|
-
description: Main content area
|
|
331
|
-
properties:
|
|
332
|
-
color:
|
|
333
|
-
title: Color
|
|
334
|
-
description: Color options
|
|
335
|
-
type: string
|
|
336
|
-
enum: ['red', 'blue']
|
|
337
|
-
entry: template.hbs
|
|
338
|
-
`;
|
|
339
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
340
|
-
if (filePath.endsWith('page-layout.yaml')) {
|
|
341
|
-
return yamlContentWithProperties;
|
|
342
|
-
}
|
|
343
|
-
if (filePath.endsWith('template.hbs')) {
|
|
344
|
-
return templateContent;
|
|
345
|
-
}
|
|
346
|
-
throw new Error('File not found');
|
|
347
|
-
});
|
|
348
|
-
yield expect((0, definitions_1.loadLayoutDefinition)(pageLayoutYaml)).rejects
|
|
349
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
350
|
-
"Failed loading layout definition: Failed to parse ./some-dir/page-layout.yaml:
|
|
351
|
-
|
|
352
|
-
Schema validation failed:
|
|
353
|
-
- Unrecognized key(s) in object: 'properties'"
|
|
354
|
-
`);
|
|
355
|
-
}));
|
|
356
|
-
it('should throw an error if YAML layout file has invalid YAML', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
357
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
358
|
-
if (filePath.endsWith('page-layout.yaml')) {
|
|
359
|
-
return 'name: invalid yaml, entry: template.hbs';
|
|
360
|
-
}
|
|
361
|
-
if (filePath.endsWith('template.hbs')) {
|
|
362
|
-
return templateContent;
|
|
363
|
-
}
|
|
364
|
-
throw new Error('File not found');
|
|
365
|
-
});
|
|
366
|
-
yield expect((0, definitions_1.loadLayoutDefinition)(pageLayoutYaml)).rejects
|
|
367
|
-
.toThrowErrorMatchingInlineSnapshot(`
|
|
368
|
-
"Failed loading layout definition: Failed to parse ./some-dir/page-layout.yaml: Nested mappings are not allowed in compact mappings at line 1, column 7:
|
|
369
|
-
|
|
370
|
-
name: invalid yaml, entry: template.hbs
|
|
371
|
-
^
|
|
372
|
-
"
|
|
373
|
-
`);
|
|
374
|
-
}));
|
|
375
|
-
it('should load layout definition without options field from YAML file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
376
|
-
const yamlContentWithoutOptions = `
|
|
377
|
-
name: test-layout
|
|
378
|
-
displayName: Test Layout
|
|
379
|
-
description: A test layout
|
|
380
|
-
zones:
|
|
381
|
-
main:
|
|
382
|
-
displayName: Main Zone
|
|
383
|
-
description: Main content area
|
|
384
|
-
minNodes: 1
|
|
385
|
-
entry: template.hbs
|
|
386
|
-
`;
|
|
387
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
388
|
-
if (filePath.endsWith('page-layout.yaml')) {
|
|
389
|
-
return yamlContentWithoutOptions;
|
|
390
|
-
}
|
|
391
|
-
if (filePath.endsWith('template.hbs')) {
|
|
392
|
-
return templateContent;
|
|
393
|
-
}
|
|
394
|
-
throw new Error('File not found');
|
|
395
|
-
});
|
|
396
|
-
const layoutDefinition = yield (0, definitions_1.loadLayoutDefinition)(pageLayoutYaml);
|
|
397
|
-
expect(layoutDefinition).toEqual({
|
|
398
|
-
name: 'test-layout',
|
|
399
|
-
displayName: 'Test Layout',
|
|
400
|
-
description: 'A test layout',
|
|
401
|
-
zones: [
|
|
402
|
-
{
|
|
403
|
-
key: 'main',
|
|
404
|
-
displayName: 'Main Zone',
|
|
405
|
-
description: 'Main content area',
|
|
406
|
-
},
|
|
407
|
-
],
|
|
408
|
-
template: templateContent,
|
|
409
|
-
});
|
|
410
|
-
}));
|
|
411
|
-
it('should load layout definition without maxNodes in zones from YAML file', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
412
|
-
const yamlContentWithoutMaxNodes = `
|
|
413
|
-
name: test-layout
|
|
414
|
-
displayName: Test Layout
|
|
415
|
-
description: A test layout
|
|
416
|
-
zones:
|
|
417
|
-
main:
|
|
418
|
-
displayName: Main Zone
|
|
419
|
-
description: Main content area
|
|
420
|
-
minNodes: 1
|
|
421
|
-
sidebar:
|
|
422
|
-
displayName: Sidebar Zone
|
|
423
|
-
description: Sidebar content area
|
|
424
|
-
minNodes: 0
|
|
425
|
-
entry: template.hbs
|
|
426
|
-
`;
|
|
427
|
-
fs.readFile.mockImplementation((filePath) => {
|
|
428
|
-
if (filePath.endsWith('page-layout.yaml')) {
|
|
429
|
-
return yamlContentWithoutMaxNodes;
|
|
430
|
-
}
|
|
431
|
-
if (filePath.endsWith('template.hbs')) {
|
|
432
|
-
return templateContent;
|
|
433
|
-
}
|
|
434
|
-
throw new Error('File not found');
|
|
435
|
-
});
|
|
436
|
-
const layoutDefinition = yield (0, definitions_1.loadLayoutDefinition)(pageLayoutYaml);
|
|
437
|
-
expect(layoutDefinition).toEqual({
|
|
438
|
-
name: 'test-layout',
|
|
439
|
-
displayName: 'Test Layout',
|
|
440
|
-
description: 'A test layout',
|
|
441
|
-
zones: [
|
|
442
|
-
{
|
|
443
|
-
key: 'main',
|
|
444
|
-
displayName: 'Main Zone',
|
|
445
|
-
description: 'Main content area',
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
key: 'sidebar',
|
|
449
|
-
displayName: 'Sidebar Zone',
|
|
450
|
-
description: 'Sidebar content area',
|
|
451
|
-
},
|
|
452
|
-
],
|
|
453
|
-
template: templateContent,
|
|
454
|
-
});
|
|
455
|
-
}));
|
|
456
|
-
});
|
|
457
|
-
});
|
|
458
|
-
describe('LayoutDefinitionParse', () => {
|
|
459
|
-
describe('V1 format - zones objects and options (deprecated)', () => {
|
|
460
|
-
it('should allow zone.minNodes to be undefined', () => {
|
|
461
|
-
const layoutDefinition = definitions_1.InputLayoutDefinitionV1.parse({
|
|
462
|
-
name: 'test-layout',
|
|
463
|
-
displayName: 'Test Layout',
|
|
464
|
-
description: 'A test layout',
|
|
465
|
-
entry: 'template.hbs',
|
|
466
|
-
zones: {
|
|
467
|
-
main: {
|
|
468
|
-
displayName: 'Main Zone',
|
|
469
|
-
description: 'Main content area',
|
|
470
|
-
},
|
|
471
|
-
},
|
|
472
|
-
});
|
|
473
|
-
expect(layoutDefinition.zones.main.minNodes).toBe(0);
|
|
474
|
-
});
|
|
475
|
-
describe('option schema validation', () => {
|
|
476
|
-
it('should accept specified valueTypes', () => {
|
|
477
|
-
var _a, _b, _c;
|
|
478
|
-
const layoutDefinition = definitions_1.InputLayoutDefinitionV1.parse({
|
|
479
|
-
name: 'test-layout',
|
|
480
|
-
displayName: 'Test Layout',
|
|
481
|
-
description: 'A test layout',
|
|
482
|
-
entry: 'template.hbs',
|
|
483
|
-
zones: {
|
|
484
|
-
main: {
|
|
485
|
-
displayName: 'Main Zone',
|
|
486
|
-
description: 'Main content area',
|
|
487
|
-
},
|
|
488
|
-
},
|
|
489
|
-
options: {
|
|
490
|
-
theme: {
|
|
491
|
-
displayName: 'Theme',
|
|
492
|
-
description: 'Color theme',
|
|
493
|
-
valueType: 'string-enum',
|
|
494
|
-
values: ['light', 'dark'],
|
|
495
|
-
},
|
|
496
|
-
showSidebar: {
|
|
497
|
-
displayName: 'Show Sidebar',
|
|
498
|
-
description: 'Toggle sidebar',
|
|
499
|
-
valueType: 'boolean',
|
|
500
|
-
},
|
|
501
|
-
customCss: {
|
|
502
|
-
displayName: 'Custom CSS',
|
|
503
|
-
description: 'Enter custom CSS',
|
|
504
|
-
valueType: 'text',
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
});
|
|
508
|
-
expect((_a = layoutDefinition.options) === null || _a === void 0 ? void 0 : _a.theme.valueType).toBe('string-enum');
|
|
509
|
-
expect((_b = layoutDefinition.options) === null || _b === void 0 ? void 0 : _b.showSidebar.valueType).toBe('boolean');
|
|
510
|
-
expect((_c = layoutDefinition.options) === null || _c === void 0 ? void 0 : _c.customCss.valueType).toBe('text');
|
|
511
|
-
});
|
|
512
|
-
it('should reject invalid valueType', () => {
|
|
513
|
-
expect(() => definitions_1.InputLayoutDefinitionV1.parse({
|
|
514
|
-
name: 'test-layout',
|
|
515
|
-
displayName: 'Test Layout',
|
|
516
|
-
description: 'A test layout',
|
|
517
|
-
entry: 'template.hbs',
|
|
518
|
-
zones: {
|
|
519
|
-
main: {
|
|
520
|
-
displayName: 'Main Zone',
|
|
521
|
-
description: 'Main content area',
|
|
522
|
-
},
|
|
523
|
-
},
|
|
524
|
-
options: {
|
|
525
|
-
badOption: {
|
|
526
|
-
displayName: 'Bad Option',
|
|
527
|
-
description: 'Invalid valueType',
|
|
528
|
-
valueType: 'INVALID_TYPE',
|
|
529
|
-
},
|
|
530
|
-
},
|
|
531
|
-
})).toThrow();
|
|
532
|
-
});
|
|
533
|
-
it('should allow valueType and values to be optional', () => {
|
|
534
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
535
|
-
const layoutDefinition = definitions_1.InputLayoutDefinitionV1.parse({
|
|
536
|
-
name: 'test-layout',
|
|
537
|
-
displayName: 'Test Layout',
|
|
538
|
-
description: 'A test layout',
|
|
539
|
-
entry: 'template.hbs',
|
|
540
|
-
zones: {
|
|
541
|
-
main: {
|
|
542
|
-
displayName: 'Main Zone',
|
|
543
|
-
description: 'Main content area',
|
|
544
|
-
},
|
|
545
|
-
},
|
|
546
|
-
options: {
|
|
547
|
-
withBoth: {
|
|
548
|
-
displayName: 'With Both',
|
|
549
|
-
description: 'Has valueType and values',
|
|
550
|
-
valueType: 'string-enum',
|
|
551
|
-
values: ['option1', 'option2'],
|
|
552
|
-
},
|
|
553
|
-
withValueTypeOnly: {
|
|
554
|
-
displayName: 'With ValueType Only',
|
|
555
|
-
description: 'Has valueType but no values',
|
|
556
|
-
valueType: 'boolean',
|
|
557
|
-
},
|
|
558
|
-
withValuesOnly: {
|
|
559
|
-
displayName: 'With Values Only',
|
|
560
|
-
description: 'Has values but no valueType (legacy)',
|
|
561
|
-
values: ['legacy1', 'legacy2'],
|
|
562
|
-
},
|
|
563
|
-
withNeither: {
|
|
564
|
-
displayName: 'With Neither',
|
|
565
|
-
description: 'Has neither valueType nor values',
|
|
566
|
-
},
|
|
567
|
-
},
|
|
568
|
-
});
|
|
569
|
-
// Schema accepts all combinations - Business logic validation (e.g., boolean/text can't have values) happens on backend and reported in CLI on deploy.
|
|
570
|
-
expect((_a = layoutDefinition.options) === null || _a === void 0 ? void 0 : _a.withBoth.valueType).toBe('string-enum');
|
|
571
|
-
expect((_b = layoutDefinition.options) === null || _b === void 0 ? void 0 : _b.withBoth.values).toEqual([
|
|
572
|
-
'option1',
|
|
573
|
-
'option2',
|
|
574
|
-
]);
|
|
575
|
-
expect((_c = layoutDefinition.options) === null || _c === void 0 ? void 0 : _c.withValueTypeOnly.valueType).toBe('boolean');
|
|
576
|
-
expect((_d = layoutDefinition.options) === null || _d === void 0 ? void 0 : _d.withValueTypeOnly.values).toBeUndefined();
|
|
577
|
-
expect((_e = layoutDefinition.options) === null || _e === void 0 ? void 0 : _e.withValuesOnly.valueType).toBeUndefined();
|
|
578
|
-
expect((_f = layoutDefinition.options) === null || _f === void 0 ? void 0 : _f.withValuesOnly.values).toEqual([
|
|
579
|
-
'legacy1',
|
|
580
|
-
'legacy2',
|
|
581
|
-
]);
|
|
582
|
-
expect((_g = layoutDefinition.options) === null || _g === void 0 ? void 0 : _g.withNeither.valueType).toBeUndefined();
|
|
583
|
-
expect((_h = layoutDefinition.options) === null || _h === void 0 ? void 0 : _h.withNeither.values).toBeUndefined();
|
|
584
|
-
});
|
|
585
|
-
it('should reject properties (instead of options)', () => {
|
|
586
|
-
expect(() => definitions_1.InputLayoutDefinitionV1.parse({
|
|
587
|
-
name: 'test-layout',
|
|
588
|
-
displayName: 'Test Layout',
|
|
589
|
-
description: 'A test layout',
|
|
590
|
-
entry: 'template.hbs',
|
|
591
|
-
zones: {
|
|
592
|
-
main: {
|
|
593
|
-
displayName: 'Main Zone',
|
|
594
|
-
description: 'Main content area',
|
|
595
|
-
},
|
|
596
|
-
},
|
|
597
|
-
properties: {
|
|
598
|
-
color: {
|
|
599
|
-
title: 'Color',
|
|
600
|
-
description: 'Color options',
|
|
601
|
-
type: 'string',
|
|
602
|
-
enum: ['red', 'blue'],
|
|
603
|
-
},
|
|
604
|
-
},
|
|
605
|
-
})).toThrow();
|
|
606
|
-
});
|
|
607
|
-
});
|
|
608
|
-
});
|
|
609
|
-
describe('V2 format - zones arrays and properties', () => {
|
|
610
|
-
it('should not allow minNodes to be defined in a zone', () => {
|
|
611
|
-
expect(() => definitions_1.InputLayoutDefinitionV2.parse({
|
|
612
|
-
name: 'test-layout',
|
|
613
|
-
displayName: 'Test Layout',
|
|
614
|
-
description: 'A test layout',
|
|
615
|
-
entry: 'template.hbs',
|
|
616
|
-
zones: [
|
|
617
|
-
{
|
|
618
|
-
key: 'main',
|
|
619
|
-
displayName: 'Main Zone',
|
|
620
|
-
description: 'Main content area',
|
|
621
|
-
minNodes: 1,
|
|
622
|
-
},
|
|
623
|
-
],
|
|
624
|
-
})).toThrow();
|
|
625
|
-
});
|
|
626
|
-
describe('property schema validation', () => {
|
|
627
|
-
it('should accept specified types', () => {
|
|
628
|
-
var _a, _b, _c;
|
|
629
|
-
const layoutDefinition = definitions_1.InputLayoutDefinitionV2.parse({
|
|
630
|
-
name: 'test-layout',
|
|
631
|
-
displayName: 'Test Layout',
|
|
632
|
-
description: 'A test layout',
|
|
633
|
-
entry: 'template.hbs',
|
|
634
|
-
zones: [
|
|
635
|
-
{
|
|
636
|
-
key: 'main',
|
|
637
|
-
displayName: 'Main Zone',
|
|
638
|
-
description: 'Main content area',
|
|
639
|
-
},
|
|
640
|
-
],
|
|
641
|
-
properties: {
|
|
642
|
-
theme: {
|
|
643
|
-
title: 'Theme',
|
|
644
|
-
description: 'Color theme',
|
|
645
|
-
type: 'string',
|
|
646
|
-
enum: ['light', 'dark'],
|
|
647
|
-
},
|
|
648
|
-
showSidebar: {
|
|
649
|
-
title: 'Show Sidebar',
|
|
650
|
-
description: 'Toggle sidebar',
|
|
651
|
-
type: 'boolean',
|
|
652
|
-
},
|
|
653
|
-
customCss: {
|
|
654
|
-
title: 'Custom CSS',
|
|
655
|
-
description: 'Enter custom CSS',
|
|
656
|
-
type: 'string',
|
|
657
|
-
},
|
|
658
|
-
},
|
|
659
|
-
});
|
|
660
|
-
expect((_a = layoutDefinition.properties) === null || _a === void 0 ? void 0 : _a.theme.type).toBe('string');
|
|
661
|
-
expect((_b = layoutDefinition.properties) === null || _b === void 0 ? void 0 : _b.showSidebar.type).toBe('boolean');
|
|
662
|
-
expect((_c = layoutDefinition.properties) === null || _c === void 0 ? void 0 : _c.customCss.type).toBe('string');
|
|
663
|
-
});
|
|
664
|
-
it('should reject invalid type', () => {
|
|
665
|
-
expect(() => definitions_1.InputLayoutDefinitionV2.parse({
|
|
666
|
-
name: 'test-layout',
|
|
667
|
-
displayName: 'Test Layout',
|
|
668
|
-
description: 'A test layout',
|
|
669
|
-
entry: 'template.hbs',
|
|
670
|
-
zones: [
|
|
671
|
-
{
|
|
672
|
-
key: 'main',
|
|
673
|
-
displayName: 'Main Zone',
|
|
674
|
-
description: 'Main content area',
|
|
675
|
-
},
|
|
676
|
-
],
|
|
677
|
-
properties: {
|
|
678
|
-
badProperty: {
|
|
679
|
-
title: 'Bad Property',
|
|
680
|
-
description: 'Invalid type',
|
|
681
|
-
type: 'INVALID_TYPE',
|
|
682
|
-
},
|
|
683
|
-
},
|
|
684
|
-
})).toThrow();
|
|
685
|
-
});
|
|
686
|
-
});
|
|
687
|
-
});
|
|
688
|
-
});
|
|
689
|
-
describe('validateTemplateFile', () => {
|
|
690
|
-
describe('valid templates', () => {
|
|
691
|
-
it('should validate a simple valid template', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
692
|
-
const template = '<div>{{zones.content}}</div>';
|
|
693
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
694
|
-
expect(errors).toHaveLength(0);
|
|
695
|
-
}));
|
|
696
|
-
it('should validate a complex valid template', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
697
|
-
const template = `
|
|
698
|
-
<div class="layout">
|
|
699
|
-
{{#if zones.header}}
|
|
700
|
-
<header>{{zones.header}}</header>
|
|
701
|
-
{{/if}}
|
|
702
|
-
<main>{{zones.content}}</main>
|
|
703
|
-
{{#each zones.sidebar}}
|
|
704
|
-
<aside>{{this}}</aside>
|
|
705
|
-
{{/each}}
|
|
706
|
-
</div>
|
|
707
|
-
`;
|
|
708
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
709
|
-
expect(errors).toHaveLength(0);
|
|
710
|
-
}));
|
|
711
|
-
it('should validate template with options', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
712
|
-
const template = '<div class="{{options.theme}}">{{zones.content}}</div>';
|
|
713
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
714
|
-
expect(errors).toHaveLength(0);
|
|
715
|
-
}));
|
|
716
|
-
it('should allow empty template', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
717
|
-
const template = '';
|
|
718
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
719
|
-
expect(errors).toHaveLength(0);
|
|
720
|
-
}));
|
|
721
|
-
});
|
|
722
|
-
describe('invalid templates', () => {
|
|
723
|
-
it('should detect top-level HTML tags', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
724
|
-
const template = '<html><body>{{zones.content}}</body></html>';
|
|
725
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
726
|
-
expect(errors.length).toBeGreaterThan(0);
|
|
727
|
-
expect(errors).toEqual(expect.arrayContaining([
|
|
728
|
-
expect.stringContaining('Template should not contain top-level HTML structure tag: <html>'),
|
|
729
|
-
expect.stringContaining('Template should not contain top-level HTML structure tag: <body>'),
|
|
730
|
-
]));
|
|
731
|
-
}));
|
|
732
|
-
it('should detect DOCTYPE declarations', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
733
|
-
const template = '<!DOCTYPE html><div>{{zones.content}}</div>';
|
|
734
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
735
|
-
expect(errors.length).toBeGreaterThan(0);
|
|
736
|
-
expect(errors).toEqual(expect.arrayContaining([
|
|
737
|
-
expect.stringContaining('Template should not contain top-level HTML structure tag: <doctype>'),
|
|
738
|
-
]));
|
|
739
|
-
}));
|
|
740
|
-
});
|
|
741
|
-
describe('error handling', () => {
|
|
742
|
-
it('should handle null template gracefully', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
743
|
-
// Test with a null template
|
|
744
|
-
const template = null;
|
|
745
|
-
const errors = yield (0, validation_1.validateTemplateFile)(template);
|
|
746
|
-
expect(errors).toHaveLength(0);
|
|
747
|
-
}));
|
|
748
|
-
});
|
|
749
|
-
});
|