@sitecoreai-labs/sitecoreai-cli 0.0.4
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/AGENTS.md +67 -0
- package/LICENSE +21 -0
- package/README.md +357 -0
- package/bin/sitecoreai-cli +3 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +358 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +27 -0
- package/dist/commands/deploy/deployments.d.ts +3 -0
- package/dist/commands/deploy/deployments.d.ts.map +1 -0
- package/dist/commands/deploy/deployments.js +58 -0
- package/dist/commands/deploy/editing-host.d.ts +3 -0
- package/dist/commands/deploy/editing-host.d.ts.map +1 -0
- package/dist/commands/deploy/editing-host.js +49 -0
- package/dist/commands/deploy/environments/deployments.d.ts +3 -0
- package/dist/commands/deploy/environments/deployments.d.ts.map +1 -0
- package/dist/commands/deploy/environments/deployments.js +28 -0
- package/dist/commands/deploy/environments/index.d.ts +3 -0
- package/dist/commands/deploy/environments/index.d.ts.map +1 -0
- package/dist/commands/deploy/environments/index.js +29 -0
- package/dist/commands/deploy/environments/mutations.d.ts +9 -0
- package/dist/commands/deploy/environments/mutations.d.ts.map +1 -0
- package/dist/commands/deploy/environments/mutations.js +103 -0
- package/dist/commands/deploy/environments/queries.d.ts +7 -0
- package/dist/commands/deploy/environments/queries.d.ts.map +1 -0
- package/dist/commands/deploy/environments/queries.js +56 -0
- package/dist/commands/deploy/environments/variables.d.ts +3 -0
- package/dist/commands/deploy/environments/variables.d.ts.map +1 -0
- package/dist/commands/deploy/environments/variables.js +40 -0
- package/dist/commands/deploy/environments.d.ts +2 -0
- package/dist/commands/deploy/environments.d.ts.map +1 -0
- package/dist/commands/deploy/environments.js +17 -0
- package/dist/commands/deploy/index.d.ts +3 -0
- package/dist/commands/deploy/index.d.ts.map +1 -0
- package/dist/commands/deploy/index.js +26 -0
- package/dist/commands/deploy/logs.d.ts +3 -0
- package/dist/commands/deploy/logs.d.ts.map +1 -0
- package/dist/commands/deploy/logs.js +39 -0
- package/dist/commands/deploy/organizations.d.ts +3 -0
- package/dist/commands/deploy/organizations.d.ts.map +1 -0
- package/dist/commands/deploy/organizations.js +29 -0
- package/dist/commands/deploy/projects.d.ts +3 -0
- package/dist/commands/deploy/projects.d.ts.map +1 -0
- package/dist/commands/deploy/projects.js +74 -0
- package/dist/commands/deploy/shared.d.ts +3 -0
- package/dist/commands/deploy/shared.d.ts.map +1 -0
- package/dist/commands/deploy/shared.js +12 -0
- package/dist/commands/deploy/site.d.ts +10 -0
- package/dist/commands/deploy/site.d.ts.map +1 -0
- package/dist/commands/deploy/site.js +36 -0
- package/dist/commands/deploy/source-control.d.ts +3 -0
- package/dist/commands/deploy/source-control.d.ts.map +1 -0
- package/dist/commands/deploy/source-control.js +89 -0
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +5 -0
- package/dist/commands/history.d.ts +3 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +88 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +32 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +21 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +18 -0
- package/dist/commands/recipe/index.d.ts +3 -0
- package/dist/commands/recipe/index.d.ts.map +1 -0
- package/dist/commands/recipe/index.js +158 -0
- package/dist/commands/serialization/index.d.ts +3 -0
- package/dist/commands/serialization/index.d.ts.map +1 -0
- package/dist/commands/serialization/index.js +89 -0
- package/dist/commands/serialization/package.d.ts +3 -0
- package/dist/commands/serialization/package.d.ts.map +1 -0
- package/dist/commands/serialization/package.js +36 -0
- package/dist/commands/shared.d.ts +21 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +82 -0
- package/dist/commands/shell.d.ts +10 -0
- package/dist/commands/shell.d.ts.map +1 -0
- package/dist/commands/shell.js +155 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +15 -0
- package/dist/commands/telemetry.d.ts +3 -0
- package/dist/commands/telemetry.d.ts.map +1 -0
- package/dist/commands/telemetry.js +28 -0
- package/dist/config/env-overrides.d.ts +4 -0
- package/dist/config/env-overrides.d.ts.map +1 -0
- package/dist/config/env-overrides.js +199 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +13 -0
- package/dist/config/modules.d.ts +4 -0
- package/dist/config/modules.d.ts.map +1 -0
- package/dist/config/modules.js +152 -0
- package/dist/config/paths.d.ts +2 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +39 -0
- package/dist/config/root-config.d.ts +10 -0
- package/dist/config/root-config.d.ts.map +1 -0
- package/dist/config/root-config.js +159 -0
- package/dist/config/schema.json +278 -0
- package/dist/config/serialization-module.schema.json +127 -0
- package/dist/config/telemetry.schema.json +21 -0
- package/dist/config/types.d.ts +245 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +19 -0
- package/dist/config/validation.d.ts +10 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +43 -0
- package/dist/deploy/api/common/headers.d.ts +2 -0
- package/dist/deploy/api/common/headers.d.ts.map +1 -0
- package/dist/deploy/api/common/headers.js +10 -0
- package/dist/deploy/api/common/index.d.ts +4 -0
- package/dist/deploy/api/common/index.d.ts.map +1 -0
- package/dist/deploy/api/common/index.js +19 -0
- package/dist/deploy/api/common/request.d.ts +9 -0
- package/dist/deploy/api/common/request.d.ts.map +1 -0
- package/dist/deploy/api/common/request.js +253 -0
- package/dist/deploy/api/common/types.d.ts +44 -0
- package/dist/deploy/api/common/types.d.ts.map +1 -0
- package/dist/deploy/api/common/types.js +5 -0
- package/dist/deploy/api/common.d.ts +2 -0
- package/dist/deploy/api/common.d.ts.map +1 -0
- package/dist/deploy/api/common.js +17 -0
- package/dist/deploy/api/deployment-logs.d.ts +2 -0
- package/dist/deploy/api/deployment-logs.d.ts.map +1 -0
- package/dist/deploy/api/deployment-logs.js +23 -0
- package/dist/deploy/api/deployments.d.ts +9 -0
- package/dist/deploy/api/deployments.d.ts.map +1 -0
- package/dist/deploy/api/deployments.js +61 -0
- package/dist/deploy/api/environments.d.ts +21 -0
- package/dist/deploy/api/environments.d.ts.map +1 -0
- package/dist/deploy/api/environments.js +67 -0
- package/dist/deploy/api/index.d.ts +9 -0
- package/dist/deploy/api/index.d.ts.map +1 -0
- package/dist/deploy/api/index.js +24 -0
- package/dist/deploy/api/logs.d.ts +8 -0
- package/dist/deploy/api/logs.d.ts.map +1 -0
- package/dist/deploy/api/logs.js +29 -0
- package/dist/deploy/api/organizations.d.ts +6 -0
- package/dist/deploy/api/organizations.d.ts.map +1 -0
- package/dist/deploy/api/organizations.js +18 -0
- package/dist/deploy/api/projects.d.ts +13 -0
- package/dist/deploy/api/projects.d.ts.map +1 -0
- package/dist/deploy/api/projects.js +42 -0
- package/dist/deploy/api/source-control.d.ts +15 -0
- package/dist/deploy/api/source-control.d.ts.map +1 -0
- package/dist/deploy/api/source-control.js +71 -0
- package/dist/deploy/api.d.ts +2 -0
- package/dist/deploy/api.d.ts.map +1 -0
- package/dist/deploy/api.js +17 -0
- package/dist/deploy/tasks/deployment-result.d.ts +6 -0
- package/dist/deploy/tasks/deployment-result.d.ts.map +1 -0
- package/dist/deploy/tasks/deployment-result.js +36 -0
- package/dist/deploy/tasks/deployments.d.ts +10 -0
- package/dist/deploy/tasks/deployments.d.ts.map +1 -0
- package/dist/deploy/tasks/deployments.js +201 -0
- package/dist/deploy/tasks/editing-host.d.ts +28 -0
- package/dist/deploy/tasks/editing-host.d.ts.map +1 -0
- package/dist/deploy/tasks/editing-host.js +216 -0
- package/dist/deploy/tasks/environments.d.ts +20 -0
- package/dist/deploy/tasks/environments.d.ts.map +1 -0
- package/dist/deploy/tasks/environments.js +364 -0
- package/dist/deploy/tasks/index.d.ts +10 -0
- package/dist/deploy/tasks/index.d.ts.map +1 -0
- package/dist/deploy/tasks/index.js +25 -0
- package/dist/deploy/tasks/logs.d.ts +5 -0
- package/dist/deploy/tasks/logs.d.ts.map +1 -0
- package/dist/deploy/tasks/logs.js +56 -0
- package/dist/deploy/tasks/organizations.d.ts +6 -0
- package/dist/deploy/tasks/organizations.d.ts.map +1 -0
- package/dist/deploy/tasks/organizations.js +51 -0
- package/dist/deploy/tasks/projects.d.ts +11 -0
- package/dist/deploy/tasks/projects.d.ts.map +1 -0
- package/dist/deploy/tasks/projects.js +246 -0
- package/dist/deploy/tasks/shared.d.ts +63 -0
- package/dist/deploy/tasks/shared.d.ts.map +1 -0
- package/dist/deploy/tasks/shared.js +261 -0
- package/dist/deploy/tasks/site-bind.d.ts +21 -0
- package/dist/deploy/tasks/site-bind.d.ts.map +1 -0
- package/dist/deploy/tasks/site-bind.js +142 -0
- package/dist/deploy/tasks/site.d.ts +14 -0
- package/dist/deploy/tasks/site.d.ts.map +1 -0
- package/dist/deploy/tasks/site.js +29 -0
- package/dist/deploy/tasks/source-control.d.ts +14 -0
- package/dist/deploy/tasks/source-control.d.ts.map +1 -0
- package/dist/deploy/tasks/source-control.js +173 -0
- package/dist/deploy/tasks/types.d.ts +204 -0
- package/dist/deploy/tasks/types.d.ts.map +1 -0
- package/dist/deploy/tasks/types.js +7 -0
- package/dist/deploy/tasks.d.ts +3 -0
- package/dist/deploy/tasks.d.ts.map +1 -0
- package/dist/deploy/tasks.js +18 -0
- package/dist/recipe/api/auth.d.ts +9 -0
- package/dist/recipe/api/auth.d.ts.map +1 -0
- package/dist/recipe/api/auth.js +12 -0
- package/dist/recipe/api/authoring-client.d.ts +37 -0
- package/dist/recipe/api/authoring-client.d.ts.map +1 -0
- package/dist/recipe/api/authoring-client.js +495 -0
- package/dist/recipe/api/client.d.ts +99 -0
- package/dist/recipe/api/client.d.ts.map +1 -0
- package/dist/recipe/api/client.js +17 -0
- package/dist/recipe/api/graphql.d.ts +15 -0
- package/dist/recipe/api/graphql.d.ts.map +1 -0
- package/dist/recipe/api/graphql.js +38 -0
- package/dist/recipe/api/ref-encoding.d.ts +38 -0
- package/dist/recipe/api/ref-encoding.d.ts.map +1 -0
- package/dist/recipe/api/ref-encoding.js +160 -0
- package/dist/recipe/api/site-discovery.d.ts +49 -0
- package/dist/recipe/api/site-discovery.d.ts.map +1 -0
- package/dist/recipe/api/site-discovery.js +127 -0
- package/dist/recipe/api/sites-client.d.ts +48 -0
- package/dist/recipe/api/sites-client.d.ts.map +1 -0
- package/dist/recipe/api/sites-client.js +19 -0
- package/dist/recipe/cache.d.ts +36 -0
- package/dist/recipe/cache.d.ts.map +1 -0
- package/dist/recipe/cache.js +114 -0
- package/dist/recipe/compile/component-section.d.ts +46 -0
- package/dist/recipe/compile/component-section.d.ts.map +1 -0
- package/dist/recipe/compile/component-section.js +143 -0
- package/dist/recipe/compile/component-template.d.ts +34 -0
- package/dist/recipe/compile/component-template.d.ts.map +1 -0
- package/dist/recipe/compile/component-template.js +709 -0
- package/dist/recipe/compile/content-item.d.ts +31 -0
- package/dist/recipe/compile/content-item.d.ts.map +1 -0
- package/dist/recipe/compile/content-item.js +189 -0
- package/dist/recipe/compile/content-template.d.ts +18 -0
- package/dist/recipe/compile/content-template.d.ts.map +1 -0
- package/dist/recipe/compile/content-template.js +52 -0
- package/dist/recipe/compile/enumeration.d.ts +59 -0
- package/dist/recipe/compile/enumeration.d.ts.map +1 -0
- package/dist/recipe/compile/enumeration.js +236 -0
- package/dist/recipe/compile/page-design.d.ts +22 -0
- package/dist/recipe/compile/page-design.d.ts.map +1 -0
- package/dist/recipe/compile/page-design.js +93 -0
- package/dist/recipe/compile/parameters-template.d.ts +14 -0
- package/dist/recipe/compile/parameters-template.d.ts.map +1 -0
- package/dist/recipe/compile/parameters-template.js +92 -0
- package/dist/recipe/compile/partial-design.d.ts +18 -0
- package/dist/recipe/compile/partial-design.d.ts.map +1 -0
- package/dist/recipe/compile/partial-design.js +76 -0
- package/dist/recipe/compile/section-definition.d.ts +18 -0
- package/dist/recipe/compile/section-definition.d.ts.map +1 -0
- package/dist/recipe/compile/section-definition.js +26 -0
- package/dist/recipe/compile/shared.d.ts +442 -0
- package/dist/recipe/compile/shared.d.ts.map +1 -0
- package/dist/recipe/compile/shared.js +843 -0
- package/dist/recipe/compile/site-template.d.ts +52 -0
- package/dist/recipe/compile/site-template.d.ts.map +1 -0
- package/dist/recipe/compile/site-template.js +140 -0
- package/dist/recipe/compile/site.d.ts +44 -0
- package/dist/recipe/compile/site.d.ts.map +1 -0
- package/dist/recipe/compile/site.js +127 -0
- package/dist/recipe/compile.d.ts +93 -0
- package/dist/recipe/compile.d.ts.map +1 -0
- package/dist/recipe/compile.js +741 -0
- package/dist/recipe/execute.d.ts +119 -0
- package/dist/recipe/execute.d.ts.map +1 -0
- package/dist/recipe/execute.js +273 -0
- package/dist/recipe/guids.d.ts +400 -0
- package/dist/recipe/guids.d.ts.map +1 -0
- package/dist/recipe/guids.js +488 -0
- package/dist/recipe/index.d.ts +32 -0
- package/dist/recipe/index.d.ts.map +1 -0
- package/dist/recipe/index.js +156 -0
- package/dist/recipe/io.d.ts +21 -0
- package/dist/recipe/io.d.ts.map +1 -0
- package/dist/recipe/io.js +147 -0
- package/dist/recipe/ir/operations.d.ts +692 -0
- package/dist/recipe/ir/operations.d.ts.map +1 -0
- package/dist/recipe/ir/operations.js +347 -0
- package/dist/recipe/ir/sitecore-templates.d.ts +455 -0
- package/dist/recipe/ir/sitecore-templates.d.ts.map +1 -0
- package/dist/recipe/ir/sitecore-templates.js +465 -0
- package/dist/recipe/layout/emit.d.ts +101 -0
- package/dist/recipe/layout/emit.d.ts.map +1 -0
- package/dist/recipe/layout/emit.js +127 -0
- package/dist/recipe/layout/templates-mapping.d.ts +28 -0
- package/dist/recipe/layout/templates-mapping.d.ts.map +1 -0
- package/dist/recipe/layout/templates-mapping.js +29 -0
- package/dist/recipe/plan.d.ts +134 -0
- package/dist/recipe/plan.d.ts.map +1 -0
- package/dist/recipe/plan.js +565 -0
- package/dist/recipe/policy.d.ts +43 -0
- package/dist/recipe/policy.d.ts.map +1 -0
- package/dist/recipe/policy.js +75 -0
- package/dist/recipe/rollback.d.ts +72 -0
- package/dist/recipe/rollback.d.ts.map +1 -0
- package/dist/recipe/rollback.js +130 -0
- package/dist/recipe/schema/field-types.d.ts +72 -0
- package/dist/recipe/schema/field-types.d.ts.map +1 -0
- package/dist/recipe/schema/field-types.js +118 -0
- package/dist/recipe/schema/recipe.d.ts +1545 -0
- package/dist/recipe/schema/recipe.d.ts.map +1 -0
- package/dist/recipe/schema/recipe.js +1175 -0
- package/dist/recipe/schema/source-fields.d.ts +48 -0
- package/dist/recipe/schema/source-fields.d.ts.map +1 -0
- package/dist/recipe/schema/source-fields.js +79 -0
- package/dist/recipe/tasks/compile.d.ts +14 -0
- package/dist/recipe/tasks/compile.d.ts.map +1 -0
- package/dist/recipe/tasks/compile.js +89 -0
- package/dist/recipe/tasks/diff.d.ts +17 -0
- package/dist/recipe/tasks/diff.d.ts.map +1 -0
- package/dist/recipe/tasks/diff.js +6 -0
- package/dist/recipe/tasks/index.d.ts +9 -0
- package/dist/recipe/tasks/index.d.ts.map +1 -0
- package/dist/recipe/tasks/index.js +13 -0
- package/dist/recipe/tasks/placeholder-allow.d.ts +53 -0
- package/dist/recipe/tasks/placeholder-allow.d.ts.map +1 -0
- package/dist/recipe/tasks/placeholder-allow.js +218 -0
- package/dist/recipe/tasks/plan.d.ts +11 -0
- package/dist/recipe/tasks/plan.d.ts.map +1 -0
- package/dist/recipe/tasks/plan.js +72 -0
- package/dist/recipe/tasks/prune-defaults.d.ts +90 -0
- package/dist/recipe/tasks/prune-defaults.d.ts.map +1 -0
- package/dist/recipe/tasks/prune-defaults.js +184 -0
- package/dist/recipe/tasks/push.d.ts +18 -0
- package/dist/recipe/tasks/push.d.ts.map +1 -0
- package/dist/recipe/tasks/push.js +417 -0
- package/dist/recipe/tasks/shared.d.ts +152 -0
- package/dist/recipe/tasks/shared.d.ts.map +1 -0
- package/dist/recipe/tasks/shared.js +94 -0
- package/dist/recipe/validate.d.ts +103 -0
- package/dist/recipe/validate.d.ts.map +1 -0
- package/dist/recipe/validate.js +297 -0
- package/dist/serialization/commands.d.ts +48 -0
- package/dist/serialization/commands.d.ts.map +1 -0
- package/dist/serialization/commands.js +175 -0
- package/dist/serialization/compare.d.ts +29 -0
- package/dist/serialization/compare.d.ts.map +1 -0
- package/dist/serialization/compare.js +124 -0
- package/dist/serialization/field-filter.d.ts +7 -0
- package/dist/serialization/field-filter.d.ts.map +1 -0
- package/dist/serialization/field-filter.js +20 -0
- package/dist/serialization/filesystem-store/constants.d.ts +3 -0
- package/dist/serialization/filesystem-store/constants.d.ts.map +1 -0
- package/dist/serialization/filesystem-store/constants.js +5 -0
- package/dist/serialization/filesystem-store/index.d.ts +4 -0
- package/dist/serialization/filesystem-store/index.d.ts.map +1 -0
- package/dist/serialization/filesystem-store/index.js +15 -0
- package/dist/serialization/filesystem-store/items.d.ts +10 -0
- package/dist/serialization/filesystem-store/items.d.ts.map +1 -0
- package/dist/serialization/filesystem-store/items.js +64 -0
- package/dist/serialization/filesystem-store/roles.d.ts +6 -0
- package/dist/serialization/filesystem-store/roles.d.ts.map +1 -0
- package/dist/serialization/filesystem-store/roles.js +46 -0
- package/dist/serialization/filesystem-store/users.d.ts +6 -0
- package/dist/serialization/filesystem-store/users.d.ts.map +1 -0
- package/dist/serialization/filesystem-store/users.js +46 -0
- package/dist/serialization/filesystem-store/utils.d.ts +2 -0
- package/dist/serialization/filesystem-store/utils.d.ts.map +1 -0
- package/dist/serialization/filesystem-store/utils.js +17 -0
- package/dist/serialization/filesystem-store.d.ts +2 -0
- package/dist/serialization/filesystem-store.d.ts.map +1 -0
- package/dist/serialization/filesystem-store.js +17 -0
- package/dist/serialization/item-path.d.ts +32 -0
- package/dist/serialization/item-path.d.ts.map +1 -0
- package/dist/serialization/item-path.js +123 -0
- package/dist/serialization/path-provider.d.ts +12 -0
- package/dist/serialization/path-provider.d.ts.map +1 -0
- package/dist/serialization/path-provider.js +271 -0
- package/dist/serialization/signature.d.ts +4 -0
- package/dist/serialization/signature.d.ts.map +1 -0
- package/dist/serialization/signature.js +71 -0
- package/dist/serialization/sitecore-api/auth.d.ts +31 -0
- package/dist/serialization/sitecore-api/auth.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/auth.js +319 -0
- package/dist/serialization/sitecore-api/graphql.d.ts +12 -0
- package/dist/serialization/sitecore-api/graphql.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/graphql.js +20 -0
- package/dist/serialization/sitecore-api/history.d.ts +9 -0
- package/dist/serialization/sitecore-api/history.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/history.js +36 -0
- package/dist/serialization/sitecore-api/index.d.ts +7 -0
- package/dist/serialization/sitecore-api/index.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/index.js +22 -0
- package/dist/serialization/sitecore-api/items.d.ts +8 -0
- package/dist/serialization/sitecore-api/items.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/items.js +132 -0
- package/dist/serialization/sitecore-api/publish.d.ts +14 -0
- package/dist/serialization/sitecore-api/publish.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/publish.js +43 -0
- package/dist/serialization/sitecore-api/roles.d.ts +9 -0
- package/dist/serialization/sitecore-api/roles.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/roles.js +42 -0
- package/dist/serialization/sitecore-api/users.d.ts +9 -0
- package/dist/serialization/sitecore-api/users.d.ts.map +1 -0
- package/dist/serialization/sitecore-api/users.js +62 -0
- package/dist/serialization/sitecore-api.d.ts +2 -0
- package/dist/serialization/sitecore-api.d.ts.map +1 -0
- package/dist/serialization/sitecore-api.js +17 -0
- package/dist/serialization/tasks/diff.d.ts +3 -0
- package/dist/serialization/tasks/diff.d.ts.map +1 -0
- package/dist/serialization/tasks/diff.js +109 -0
- package/dist/serialization/tasks/env/constants.d.ts +2 -0
- package/dist/serialization/tasks/env/constants.d.ts.map +1 -0
- package/dist/serialization/tasks/env/constants.js +4 -0
- package/dist/serialization/tasks/env/deploy-token.d.ts +3 -0
- package/dist/serialization/tasks/env/deploy-token.d.ts.map +1 -0
- package/dist/serialization/tasks/env/deploy-token.js +128 -0
- package/dist/serialization/tasks/env/index.d.ts +5 -0
- package/dist/serialization/tasks/env/index.d.ts.map +1 -0
- package/dist/serialization/tasks/env/index.js +11 -0
- package/dist/serialization/tasks/env/init/auth.d.ts +24 -0
- package/dist/serialization/tasks/env/init/auth.d.ts.map +1 -0
- package/dist/serialization/tasks/env/init/auth.js +122 -0
- package/dist/serialization/tasks/env/init/deploy-lookup.d.ts +22 -0
- package/dist/serialization/tasks/env/init/deploy-lookup.d.ts.map +1 -0
- package/dist/serialization/tasks/env/init/deploy-lookup.js +244 -0
- package/dist/serialization/tasks/env/init.d.ts +3 -0
- package/dist/serialization/tasks/env/init.d.ts.map +1 -0
- package/dist/serialization/tasks/env/init.js +253 -0
- package/dist/serialization/tasks/env/logout.d.ts +3 -0
- package/dist/serialization/tasks/env/logout.d.ts.map +1 -0
- package/dist/serialization/tasks/env/logout.js +61 -0
- package/dist/serialization/tasks/env/status.d.ts +3 -0
- package/dist/serialization/tasks/env/status.d.ts.map +1 -0
- package/dist/serialization/tasks/env/status.js +149 -0
- package/dist/serialization/tasks/env.d.ts +2 -0
- package/dist/serialization/tasks/env.d.ts.map +1 -0
- package/dist/serialization/tasks/env.js +17 -0
- package/dist/serialization/tasks/helpers/collect.d.ts +8 -0
- package/dist/serialization/tasks/helpers/collect.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers/collect.js +29 -0
- package/dist/serialization/tasks/helpers/commands.d.ts +5 -0
- package/dist/serialization/tasks/helpers/commands.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers/commands.js +14 -0
- package/dist/serialization/tasks/helpers/filesystem.d.ts +6 -0
- package/dist/serialization/tasks/helpers/filesystem.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers/filesystem.js +27 -0
- package/dist/serialization/tasks/helpers/index.d.ts +6 -0
- package/dist/serialization/tasks/helpers/index.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers/index.js +13 -0
- package/dist/serialization/tasks/helpers/items.d.ts +3 -0
- package/dist/serialization/tasks/helpers/items.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers/items.js +5 -0
- package/dist/serialization/tasks/helpers/sitecore.d.ts +5 -0
- package/dist/serialization/tasks/helpers/sitecore.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers/sitecore.js +109 -0
- package/dist/serialization/tasks/helpers.d.ts +2 -0
- package/dist/serialization/tasks/helpers.d.ts.map +1 -0
- package/dist/serialization/tasks/helpers.js +17 -0
- package/dist/serialization/tasks/index.d.ts +8 -0
- package/dist/serialization/tasks/index.d.ts.map +1 -0
- package/dist/serialization/tasks/index.js +19 -0
- package/dist/serialization/tasks/info.d.ts +4 -0
- package/dist/serialization/tasks/info.d.ts.map +1 -0
- package/dist/serialization/tasks/info.js +82 -0
- package/dist/serialization/tasks/package.d.ts +4 -0
- package/dist/serialization/tasks/package.d.ts.map +1 -0
- package/dist/serialization/tasks/package.js +171 -0
- package/dist/serialization/tasks/pull.d.ts +3 -0
- package/dist/serialization/tasks/pull.d.ts.map +1 -0
- package/dist/serialization/tasks/pull.js +82 -0
- package/dist/serialization/tasks/push.d.ts +3 -0
- package/dist/serialization/tasks/push.d.ts.map +1 -0
- package/dist/serialization/tasks/push.js +101 -0
- package/dist/serialization/tasks/roles.d.ts +6 -0
- package/dist/serialization/tasks/roles.d.ts.map +1 -0
- package/dist/serialization/tasks/roles.js +103 -0
- package/dist/serialization/tasks/shared.d.ts +19 -0
- package/dist/serialization/tasks/shared.d.ts.map +1 -0
- package/dist/serialization/tasks/shared.js +59 -0
- package/dist/serialization/tasks/types.d.ts +73 -0
- package/dist/serialization/tasks/types.d.ts.map +1 -0
- package/dist/serialization/tasks/types.js +8 -0
- package/dist/serialization/tasks/users.d.ts +5 -0
- package/dist/serialization/tasks/users.d.ts.map +1 -0
- package/dist/serialization/tasks/users.js +90 -0
- package/dist/serialization/tasks/validate.d.ts +5 -0
- package/dist/serialization/tasks/validate.d.ts.map +1 -0
- package/dist/serialization/tasks/validate.js +50 -0
- package/dist/serialization/tasks/watch.d.ts +3 -0
- package/dist/serialization/tasks/watch.d.ts.map +1 -0
- package/dist/serialization/tasks/watch.js +75 -0
- package/dist/serialization/tasks.d.ts +4 -0
- package/dist/serialization/tasks.d.ts.map +1 -0
- package/dist/serialization/tasks.js +19 -0
- package/dist/serialization/tree-spec.d.ts +51 -0
- package/dist/serialization/tree-spec.d.ts.map +1 -0
- package/dist/serialization/tree-spec.js +241 -0
- package/dist/serialization/types.d.ts +75 -0
- package/dist/serialization/types.d.ts.map +1 -0
- package/dist/serialization/types.js +2 -0
- package/dist/serialization/wildcard.d.ts +3 -0
- package/dist/serialization/wildcard.d.ts.map +1 -0
- package/dist/serialization/wildcard.js +24 -0
- package/dist/serialization/yaml.d.ts +9 -0
- package/dist/serialization/yaml.d.ts.map +1 -0
- package/dist/serialization/yaml.js +307 -0
- package/dist/shared/browser.d.ts +2 -0
- package/dist/shared/browser.d.ts.map +1 -0
- package/dist/shared/browser.js +36 -0
- package/dist/shared/cli-options.d.ts +17 -0
- package/dist/shared/cli-options.d.ts.map +1 -0
- package/dist/shared/cli-options.js +8 -0
- package/dist/shared/cli-tasks.d.ts +38 -0
- package/dist/shared/cli-tasks.d.ts.map +1 -0
- package/dist/shared/cli-tasks.js +108 -0
- package/dist/shared/config-template.d.ts +23 -0
- package/dist/shared/config-template.d.ts.map +1 -0
- package/dist/shared/config-template.js +38 -0
- package/dist/shared/env.d.ts +28 -0
- package/dist/shared/env.d.ts.map +1 -0
- package/dist/shared/env.js +38 -0
- package/dist/shared/errors.d.ts +21 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +59 -0
- package/dist/shared/graphql.d.ts +76 -0
- package/dist/shared/graphql.d.ts.map +1 -0
- package/dist/shared/graphql.js +222 -0
- package/dist/shared/history.d.ts +12 -0
- package/dist/shared/history.d.ts.map +1 -0
- package/dist/shared/history.js +62 -0
- package/dist/shared/keychain.d.ts +15 -0
- package/dist/shared/keychain.d.ts.map +1 -0
- package/dist/shared/keychain.js +177 -0
- package/dist/shared/logger.d.ts +24 -0
- package/dist/shared/logger.d.ts.map +1 -0
- package/dist/shared/logger.js +157 -0
- package/dist/shared/output.d.ts +7 -0
- package/dist/shared/output.d.ts.map +1 -0
- package/dist/shared/output.js +21 -0
- package/dist/shared/prompt.d.ts +5 -0
- package/dist/shared/prompt.d.ts.map +1 -0
- package/dist/shared/prompt.js +87 -0
- package/dist/shared/redact.d.ts +3 -0
- package/dist/shared/redact.d.ts.map +1 -0
- package/dist/shared/redact.js +47 -0
- package/dist/shared/spinner.d.ts +5 -0
- package/dist/shared/spinner.d.ts.map +1 -0
- package/dist/shared/spinner.js +89 -0
- package/dist/shared/style.d.ts +2 -0
- package/dist/shared/style.d.ts.map +1 -0
- package/dist/shared/style.js +61 -0
- package/dist/shared/telemetry.d.ts +21 -0
- package/dist/shared/telemetry.d.ts.map +1 -0
- package/dist/shared/telemetry.js +226 -0
- package/dist/shared/validate.d.ts +3 -0
- package/dist/shared/validate.d.ts.map +1 -0
- package/dist/shared/validate.js +32 -0
- package/dist/sites/api/collections.d.ts +25 -0
- package/dist/sites/api/collections.d.ts.map +1 -0
- package/dist/sites/api/collections.js +21 -0
- package/dist/sites/api/index.d.ts +26 -0
- package/dist/sites/api/index.d.ts.map +1 -0
- package/dist/sites/api/index.js +55 -0
- package/dist/sites/api/jobs.d.ts +31 -0
- package/dist/sites/api/jobs.d.ts.map +1 -0
- package/dist/sites/api/jobs.js +10 -0
- package/dist/sites/api/languages.d.ts +22 -0
- package/dist/sites/api/languages.d.ts.map +1 -0
- package/dist/sites/api/languages.js +18 -0
- package/dist/sites/api/request.d.ts +24 -0
- package/dist/sites/api/request.d.ts.map +1 -0
- package/dist/sites/api/request.js +99 -0
- package/dist/sites/api/sites.d.ts +53 -0
- package/dist/sites/api/sites.d.ts.map +1 -0
- package/dist/sites/api/sites.js +41 -0
- package/dist/sites/api/types.d.ts +29 -0
- package/dist/sites/api/types.d.ts.map +1 -0
- package/dist/sites/api/types.js +4 -0
- package/package.json +109 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Recipe } from "./schema/recipe";
|
|
2
|
+
/**
|
|
3
|
+
* Cross-recipe validation: walks every handle reference in a recipe set
|
|
4
|
+
* and verifies it resolves to an extant recipe of the right kind.
|
|
5
|
+
*
|
|
6
|
+
* `compileRecipe` operates on one recipe at a time and can't see the
|
|
7
|
+
* surrounding set; this module is the seam that catches dangling or
|
|
8
|
+
* mistyped references before the planner / executor swallows them.
|
|
9
|
+
*
|
|
10
|
+
* Reference inventory checked:
|
|
11
|
+
*
|
|
12
|
+
* ComponentTemplateRecipe / ContentTemplateRecipe
|
|
13
|
+
* fields[*].sitecore.sourceTypes[*] → any template-bearing recipe
|
|
14
|
+
* params[*].sitecore.sourceTypes[*] → any template-bearing recipe
|
|
15
|
+
* insertOptions[*] → any template-bearing recipe
|
|
16
|
+
*
|
|
17
|
+
* ContentItemRecipe
|
|
18
|
+
* templateType → any template-bearing recipe
|
|
19
|
+
* fields[*].link-internal.ref → any recipe
|
|
20
|
+
* fields[*].reference.refs[*] → any recipe
|
|
21
|
+
*
|
|
22
|
+
* PartialDesignRecipe
|
|
23
|
+
* layout.placeholders[*][*].componentHandle → ComponentTemplateRecipe
|
|
24
|
+
* layout.placeholders[*][*].datasourceRef.handle → ContentItemRecipe
|
|
25
|
+
*
|
|
26
|
+
* PageDesignRecipe
|
|
27
|
+
* appliesTo[*] → ContentTemplateRecipe (page templates)
|
|
28
|
+
* partials[*] → PartialDesignRecipe
|
|
29
|
+
* layout.placeholders[*][*].componentHandle → ComponentTemplateRecipe
|
|
30
|
+
* layout.placeholders[*][*].datasourceRef.handle → ContentItemRecipe
|
|
31
|
+
*
|
|
32
|
+
* Cycle detection covers `insertOptions` chains
|
|
33
|
+
* (`ComponentTemplate.insertOptions → ContentTemplate.insertOptions → …`)
|
|
34
|
+
* — the only place the current schema permits transitive recipe-to-recipe
|
|
35
|
+
* references that could loop. Partial-to-partial cycles aren't possible
|
|
36
|
+
* today (`PartialDesignRecipe` doesn't reference other partials); when
|
|
37
|
+
* sub-partial composition lands (Phase 5+), extend the DFS below.
|
|
38
|
+
*/
|
|
39
|
+
export type RecipeKind = Recipe["kind"];
|
|
40
|
+
/** A handle reference that doesn't resolve, or resolves to the wrong kind. */
|
|
41
|
+
export interface UnresolvedHandle {
|
|
42
|
+
/** Handle of the recipe that contains the bad reference. */
|
|
43
|
+
fromRecipe: string;
|
|
44
|
+
/** Dotted path inside the recipe — `layout.placeholders./header.0.componentHandle`. */
|
|
45
|
+
fromField: string;
|
|
46
|
+
/** The reference value that didn't resolve. */
|
|
47
|
+
handle: string;
|
|
48
|
+
/** Which recipe kinds would be valid resolutions. */
|
|
49
|
+
expectedKinds: readonly RecipeKind[];
|
|
50
|
+
/** The kind that was found (or undefined if no recipe with that handle exists). */
|
|
51
|
+
actualKind: RecipeKind | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** A handle that appears more than once in the recipe set. */
|
|
54
|
+
export interface DuplicateHandle {
|
|
55
|
+
handle: string;
|
|
56
|
+
count: number;
|
|
57
|
+
}
|
|
58
|
+
/** A cyclic chain of `insertOptions` references. */
|
|
59
|
+
export interface CyclicReference {
|
|
60
|
+
/** First handle in the cycle. */
|
|
61
|
+
startHandle: string;
|
|
62
|
+
/** Ordered handles that form the cycle (last entry = startHandle, closing the loop). */
|
|
63
|
+
cycle: readonly string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A field-shape constraint that Zod can't enforce. Today this is the
|
|
67
|
+
* `SiteRecipe` collectionId XOR collectionName presence check — the
|
|
68
|
+
* Zod schema can't carry a `.refine()` because `RecipeSchema` is a
|
|
69
|
+
* discriminated union, and discriminated unions reject `ZodEffects`
|
|
70
|
+
* members. Cross-field constraints land here instead.
|
|
71
|
+
*/
|
|
72
|
+
export interface FieldShapeError {
|
|
73
|
+
/** Handle of the recipe with the bad shape. */
|
|
74
|
+
fromRecipe: string;
|
|
75
|
+
/** Dotted path to the field(s) involved. */
|
|
76
|
+
fromField: string;
|
|
77
|
+
/** Operator-readable explanation. */
|
|
78
|
+
message: string;
|
|
79
|
+
}
|
|
80
|
+
export interface ValidationResult {
|
|
81
|
+
unresolvedHandles: UnresolvedHandle[];
|
|
82
|
+
duplicateHandles: DuplicateHandle[];
|
|
83
|
+
cycles: CyclicReference[];
|
|
84
|
+
fieldShapeErrors: FieldShapeError[];
|
|
85
|
+
}
|
|
86
|
+
export declare const isValid: (result: ValidationResult) => boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Render a `ValidationResult` as a multi-line, human-readable error
|
|
89
|
+
* report. Use `validateRecipeSetOrThrow` if you just want exceptions.
|
|
90
|
+
*/
|
|
91
|
+
export declare function formatValidationErrors(result: ValidationResult): string;
|
|
92
|
+
/**
|
|
93
|
+
* Validate cross-recipe references in a recipe set. Returns a result
|
|
94
|
+
* with all detected problems — caller decides whether to throw, log,
|
|
95
|
+
* or surface them in CLI output.
|
|
96
|
+
*/
|
|
97
|
+
export declare function validateRecipeSet(recipes: readonly Recipe[]): ValidationResult;
|
|
98
|
+
/**
|
|
99
|
+
* Convenience: validate and throw on any error. Use in pipelines that
|
|
100
|
+
* should hard-stop before compilation when the recipe set is malformed.
|
|
101
|
+
*/
|
|
102
|
+
export declare function validateRecipeSetOrThrow(recipes: readonly Recipe[]): void;
|
|
103
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/recipe/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAqBxC,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,aAAa,EAAE,SAAS,UAAU,EAAE,CAAC;IACrC,mFAAmF;IACnF,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC;AAED,8DAA8D;AAC9D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,gBAAgB,EAAE,eAAe,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,OAAO,GAAI,QAAQ,gBAAgB,KAAG,OAIb,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBvE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAyQ9E;AAyDD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAQzE"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValid = void 0;
|
|
4
|
+
exports.formatValidationErrors = formatValidationErrors;
|
|
5
|
+
exports.validateRecipeSet = validateRecipeSet;
|
|
6
|
+
exports.validateRecipeSetOrThrow = validateRecipeSetOrThrow;
|
|
7
|
+
const errors_1 = require("../shared/errors");
|
|
8
|
+
const TEMPLATE_KINDS = ["component-template", "content-template"];
|
|
9
|
+
const COMPONENT_TEMPLATE_KINDS = ["component-template"];
|
|
10
|
+
const CONTENT_TEMPLATE_KINDS = ["content-template"];
|
|
11
|
+
const CONTENT_ITEM_KINDS = ["content-item"];
|
|
12
|
+
const PARAMETERS_TEMPLATE_KINDS = ["parameters-template"];
|
|
13
|
+
const SECTION_DEFINITION_KINDS = ["section-definition"];
|
|
14
|
+
const PARTIAL_DESIGN_KINDS = ["partial-design"];
|
|
15
|
+
const PAGE_DESIGN_KINDS = ["page-design"];
|
|
16
|
+
const SITE_TEMPLATE_KINDS = ["site-template"];
|
|
17
|
+
const ANY_KINDS = [
|
|
18
|
+
"component-template",
|
|
19
|
+
"content-template",
|
|
20
|
+
"content-item",
|
|
21
|
+
"parameters-template",
|
|
22
|
+
"section-definition",
|
|
23
|
+
"partial-design",
|
|
24
|
+
"page-design",
|
|
25
|
+
];
|
|
26
|
+
const isValid = (result) => result.unresolvedHandles.length === 0 &&
|
|
27
|
+
result.duplicateHandles.length === 0 &&
|
|
28
|
+
result.cycles.length === 0 &&
|
|
29
|
+
result.fieldShapeErrors.length === 0;
|
|
30
|
+
exports.isValid = isValid;
|
|
31
|
+
/**
|
|
32
|
+
* Render a `ValidationResult` as a multi-line, human-readable error
|
|
33
|
+
* report. Use `validateRecipeSetOrThrow` if you just want exceptions.
|
|
34
|
+
*/
|
|
35
|
+
function formatValidationErrors(result) {
|
|
36
|
+
const lines = [];
|
|
37
|
+
for (const dup of result.duplicateHandles) {
|
|
38
|
+
lines.push(`Duplicate handle '${dup.handle}' (appears ${dup.count} times in the recipe set).`);
|
|
39
|
+
}
|
|
40
|
+
for (const cycle of result.cycles) {
|
|
41
|
+
lines.push(`Cyclic insertOptions chain: ${cycle.cycle.join(" → ")}.`);
|
|
42
|
+
}
|
|
43
|
+
for (const err of result.unresolvedHandles) {
|
|
44
|
+
const found = err.actualKind === undefined
|
|
45
|
+
? "no recipe with that handle in the set"
|
|
46
|
+
: `found a ${err.actualKind} recipe`;
|
|
47
|
+
lines.push(`${err.fromRecipe} → ${err.fromField}: '${err.handle}' is invalid (${found}; expected one of: ${err.expectedKinds.join(", ")}).`);
|
|
48
|
+
}
|
|
49
|
+
for (const err of result.fieldShapeErrors) {
|
|
50
|
+
lines.push(`${err.fromRecipe} → ${err.fromField}: ${err.message}`);
|
|
51
|
+
}
|
|
52
|
+
return lines.join("\n");
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validate cross-recipe references in a recipe set. Returns a result
|
|
56
|
+
* with all detected problems — caller decides whether to throw, log,
|
|
57
|
+
* or surface them in CLI output.
|
|
58
|
+
*/
|
|
59
|
+
function validateRecipeSet(recipes) {
|
|
60
|
+
const index = new Map();
|
|
61
|
+
const counts = new Map();
|
|
62
|
+
for (const recipe of recipes) {
|
|
63
|
+
counts.set(recipe.handle, (counts.get(recipe.handle) ?? 0) + 1);
|
|
64
|
+
if (!index.has(recipe.handle)) {
|
|
65
|
+
index.set(recipe.handle, recipe);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const duplicateHandles = [];
|
|
69
|
+
for (const [handle, count] of counts) {
|
|
70
|
+
if (count > 1)
|
|
71
|
+
duplicateHandles.push({ handle, count });
|
|
72
|
+
}
|
|
73
|
+
const unresolved = [];
|
|
74
|
+
const fieldShapeErrors = [];
|
|
75
|
+
const checkRef = (fromRecipe, fromField, handle, expectedKinds) => {
|
|
76
|
+
const target = index.get(handle);
|
|
77
|
+
if (target === undefined) {
|
|
78
|
+
unresolved.push({
|
|
79
|
+
fromRecipe,
|
|
80
|
+
fromField,
|
|
81
|
+
handle,
|
|
82
|
+
expectedKinds,
|
|
83
|
+
actualKind: undefined,
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!expectedKinds.includes(target.kind)) {
|
|
88
|
+
unresolved.push({
|
|
89
|
+
fromRecipe,
|
|
90
|
+
fromField,
|
|
91
|
+
handle,
|
|
92
|
+
expectedKinds,
|
|
93
|
+
actualKind: target.kind,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
for (const recipe of recipes) {
|
|
98
|
+
switch (recipe.kind) {
|
|
99
|
+
case "component-template":
|
|
100
|
+
recipe.fields.forEach((field, idx) => {
|
|
101
|
+
field.sitecore?.sourceTypes?.forEach((handle, sIdx) => {
|
|
102
|
+
checkRef(recipe.handle, `fields.${idx}.sitecore.sourceTypes.${sIdx}`, handle, TEMPLATE_KINDS);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
recipe.params.forEach((param, idx) => {
|
|
106
|
+
param.sitecore?.sourceTypes?.forEach((handle, sIdx) => {
|
|
107
|
+
checkRef(recipe.handle, `params.${idx}.sitecore.sourceTypes.${sIdx}`, handle, TEMPLATE_KINDS);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
recipe.insertOptions?.forEach((handle, idx) => {
|
|
111
|
+
checkRef(recipe.handle, `insertOptions.${idx}`, handle, TEMPLATE_KINDS);
|
|
112
|
+
});
|
|
113
|
+
if (recipe.datasource?.template) {
|
|
114
|
+
checkRef(recipe.handle, "datasource.template.handle", recipe.datasource.template.handle, CONTENT_TEMPLATE_KINDS);
|
|
115
|
+
}
|
|
116
|
+
if (recipe.parameters) {
|
|
117
|
+
checkRef(recipe.handle, "parameters.handle", recipe.parameters.handle, PARAMETERS_TEMPLATE_KINDS);
|
|
118
|
+
}
|
|
119
|
+
recipe.children?.allowedHandles.forEach((handle, idx) => {
|
|
120
|
+
checkRef(recipe.handle, `children.allowedHandles.${idx}`, handle, TEMPLATE_KINDS);
|
|
121
|
+
});
|
|
122
|
+
recipe.availableIn?.forEach((handle, idx) => {
|
|
123
|
+
checkRef(recipe.handle, `availableIn.${idx}`, handle, SECTION_DEFINITION_KINDS);
|
|
124
|
+
});
|
|
125
|
+
break;
|
|
126
|
+
case "parameters-template":
|
|
127
|
+
recipe.params.forEach((param, idx) => {
|
|
128
|
+
param.sitecore?.sourceTypes?.forEach((handle, sIdx) => {
|
|
129
|
+
checkRef(recipe.handle, `params.${idx}.sitecore.sourceTypes.${sIdx}`, handle, TEMPLATE_KINDS);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
break;
|
|
133
|
+
case "section-definition":
|
|
134
|
+
// Section definitions don't carry cross-recipe references — they
|
|
135
|
+
// ARE the resolution target for `availableIn`.
|
|
136
|
+
break;
|
|
137
|
+
case "content-template":
|
|
138
|
+
recipe.fields.forEach((field, idx) => {
|
|
139
|
+
field.sitecore?.sourceTypes?.forEach((handle, sIdx) => {
|
|
140
|
+
checkRef(recipe.handle, `fields.${idx}.sitecore.sourceTypes.${sIdx}`, handle, TEMPLATE_KINDS);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
recipe.insertOptions?.forEach((handle, idx) => {
|
|
144
|
+
checkRef(recipe.handle, `insertOptions.${idx}`, handle, TEMPLATE_KINDS);
|
|
145
|
+
});
|
|
146
|
+
break;
|
|
147
|
+
case "content-item":
|
|
148
|
+
checkRef(recipe.handle, "templateType", recipe.templateType, TEMPLATE_KINDS);
|
|
149
|
+
for (const [fieldName, value] of Object.entries(recipe.fields)) {
|
|
150
|
+
if (value.shape === "link-internal") {
|
|
151
|
+
checkRef(recipe.handle, `fields.${fieldName}.ref`, value.ref, ANY_KINDS);
|
|
152
|
+
}
|
|
153
|
+
else if (value.shape === "reference") {
|
|
154
|
+
value.refs.forEach((handle, idx) => {
|
|
155
|
+
checkRef(recipe.handle, `fields.${fieldName}.refs.${idx}`, handle, ANY_KINDS);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case "partial-design":
|
|
161
|
+
for (const [phKey, placements] of Object.entries(recipe.layout.placeholders)) {
|
|
162
|
+
placements.forEach((placement, idx) => {
|
|
163
|
+
checkRef(recipe.handle, `layout.placeholders.${phKey}.${idx}.componentHandle`, placement.componentHandle, COMPONENT_TEMPLATE_KINDS);
|
|
164
|
+
if (placement.datasourceRef?.kind === "shared") {
|
|
165
|
+
checkRef(recipe.handle, `layout.placeholders.${phKey}.${idx}.datasourceRef.handle`, placement.datasourceRef.handle, CONTENT_ITEM_KINDS);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
break;
|
|
170
|
+
case "page-design":
|
|
171
|
+
recipe.appliesTo.forEach((handle, idx) => {
|
|
172
|
+
checkRef(recipe.handle, `appliesTo.${idx}`, handle, CONTENT_TEMPLATE_KINDS);
|
|
173
|
+
});
|
|
174
|
+
recipe.partials.forEach((handle, idx) => {
|
|
175
|
+
checkRef(recipe.handle, `partials.${idx}`, handle, PARTIAL_DESIGN_KINDS);
|
|
176
|
+
});
|
|
177
|
+
if (recipe.layout) {
|
|
178
|
+
for (const [phKey, placements] of Object.entries(recipe.layout.placeholders)) {
|
|
179
|
+
placements.forEach((placement, idx) => {
|
|
180
|
+
checkRef(recipe.handle, `layout.placeholders.${phKey}.${idx}.componentHandle`, placement.componentHandle, COMPONENT_TEMPLATE_KINDS);
|
|
181
|
+
if (placement.datasourceRef?.kind === "shared") {
|
|
182
|
+
checkRef(recipe.handle, `layout.placeholders.${phKey}.${idx}.datasourceRef.handle`, placement.datasourceRef.handle, CONTENT_ITEM_KINDS);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
break;
|
|
188
|
+
case "site-template":
|
|
189
|
+
recipe.pageTemplates.forEach((handle, idx) => {
|
|
190
|
+
checkRef(recipe.handle, `pageTemplates.${idx}`, handle, CONTENT_TEMPLATE_KINDS);
|
|
191
|
+
});
|
|
192
|
+
recipe.pageDesigns.forEach((handle, idx) => {
|
|
193
|
+
checkRef(recipe.handle, `pageDesigns.${idx}`, handle, PAGE_DESIGN_KINDS);
|
|
194
|
+
});
|
|
195
|
+
if (recipe.insertOptionsMatrix) {
|
|
196
|
+
for (const [parentHandle, allowedChildren] of Object.entries(recipe.insertOptionsMatrix)) {
|
|
197
|
+
// The KEY is itself a page-template handle. Validate it too —
|
|
198
|
+
// a typo in the key would silently never apply at apply time.
|
|
199
|
+
checkRef(recipe.handle, `insertOptionsMatrix.${parentHandle}`, parentHandle, CONTENT_TEMPLATE_KINDS);
|
|
200
|
+
allowedChildren.forEach((childHandle, idx) => {
|
|
201
|
+
checkRef(recipe.handle, `insertOptionsMatrix.${parentHandle}.${idx}`, childHandle, CONTENT_TEMPLATE_KINDS);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (recipe.templatesToDesigns) {
|
|
206
|
+
for (const [templateHandle, designHandle] of Object.entries(recipe.templatesToDesigns)) {
|
|
207
|
+
checkRef(recipe.handle, `templatesToDesigns.${templateHandle} (key)`, templateHandle, CONTENT_TEMPLATE_KINDS);
|
|
208
|
+
checkRef(recipe.handle, `templatesToDesigns.${templateHandle}`, designHandle, PAGE_DESIGN_KINDS);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
case "site":
|
|
213
|
+
checkRef(recipe.handle, "siteTemplate", recipe.siteTemplate, SITE_TEMPLATE_KINDS);
|
|
214
|
+
if (recipe.initialHome !== undefined) {
|
|
215
|
+
// PageRecipe doesn't exist yet — accept any kind. When
|
|
216
|
+
// PageRecipe lands, narrow this to PAGE_RECIPE_KINDS.
|
|
217
|
+
checkRef(recipe.handle, "initialHome", recipe.initialHome, ANY_KINDS);
|
|
218
|
+
}
|
|
219
|
+
// Cross-field shape: SiteRecipe must specify exactly one of
|
|
220
|
+
// collectionId or collectionName. The Zod schema can't enforce
|
|
221
|
+
// it (discriminated union members can't carry refines), so the
|
|
222
|
+
// constraint lives here.
|
|
223
|
+
if (recipe.collectionId && recipe.collectionName) {
|
|
224
|
+
fieldShapeErrors.push({
|
|
225
|
+
fromRecipe: recipe.handle,
|
|
226
|
+
fromField: "collectionId, collectionName",
|
|
227
|
+
message: "collectionId and collectionName are mutually exclusive — provide one, not both",
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (!recipe.collectionId && !recipe.collectionName) {
|
|
231
|
+
fieldShapeErrors.push({
|
|
232
|
+
fromRecipe: recipe.handle,
|
|
233
|
+
fromField: "collectionId, collectionName",
|
|
234
|
+
message: "either collectionId (existing) or collectionName (new) must be provided",
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const cycles = detectInsertOptionsCycles(index, recipes);
|
|
241
|
+
return { unresolvedHandles: unresolved, duplicateHandles, cycles, fieldShapeErrors };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* DFS over `insertOptions` edges. Each unique cycle is reported once,
|
|
245
|
+
* normalized to start at the alphabetically-smallest handle so re-runs
|
|
246
|
+
* over the same input produce stable output regardless of iteration
|
|
247
|
+
* order.
|
|
248
|
+
*/
|
|
249
|
+
function detectInsertOptionsCycles(index, recipes) {
|
|
250
|
+
const cycles = new Map();
|
|
251
|
+
const visited = new Set();
|
|
252
|
+
const stack = [];
|
|
253
|
+
const inStack = new Set();
|
|
254
|
+
const dfs = (handle) => {
|
|
255
|
+
if (inStack.has(handle)) {
|
|
256
|
+
const cycleStart = stack.indexOf(handle);
|
|
257
|
+
const ring = stack.slice(cycleStart);
|
|
258
|
+
const minIdx = ring.reduce((acc, h, i) => (h < ring[acc] ? i : acc), 0);
|
|
259
|
+
const normalized = [...ring.slice(minIdx), ...ring.slice(0, minIdx), ring[minIdx]];
|
|
260
|
+
const key = normalized.join("→");
|
|
261
|
+
if (!cycles.has(key)) {
|
|
262
|
+
cycles.set(key, { startHandle: normalized[0], cycle: normalized });
|
|
263
|
+
}
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
if (visited.has(handle))
|
|
267
|
+
return;
|
|
268
|
+
visited.add(handle);
|
|
269
|
+
inStack.add(handle);
|
|
270
|
+
stack.push(handle);
|
|
271
|
+
const recipe = index.get(handle);
|
|
272
|
+
if (recipe !== undefined &&
|
|
273
|
+
(recipe.kind === "component-template" || recipe.kind === "content-template") &&
|
|
274
|
+
recipe.insertOptions !== undefined) {
|
|
275
|
+
for (const child of recipe.insertOptions) {
|
|
276
|
+
dfs(child);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
stack.pop();
|
|
280
|
+
inStack.delete(handle);
|
|
281
|
+
};
|
|
282
|
+
for (const recipe of recipes) {
|
|
283
|
+
if (!visited.has(recipe.handle))
|
|
284
|
+
dfs(recipe.handle);
|
|
285
|
+
}
|
|
286
|
+
return [...cycles.values()];
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Convenience: validate and throw on any error. Use in pipelines that
|
|
290
|
+
* should hard-stop before compilation when the recipe set is malformed.
|
|
291
|
+
*/
|
|
292
|
+
function validateRecipeSetOrThrow(recipes) {
|
|
293
|
+
const result = validateRecipeSet(recipes);
|
|
294
|
+
if (!(0, exports.isValid)(result)) {
|
|
295
|
+
throw (0, errors_1.createCliError)(`Recipe set validation failed:\n${formatValidationErrors(result)}`, "INPUT_INVALID");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ItemData, ItemMetadata } from "./types";
|
|
2
|
+
import { FilesystemTreeSpec } from "./tree-spec";
|
|
3
|
+
import { ItemComparisonResult } from "./compare";
|
|
4
|
+
export type ItemCommandType = "create" | "update" | "move" | "rename" | "recycle";
|
|
5
|
+
export type UpdateCommandData = {
|
|
6
|
+
command: "CHANGE_TEMPLATE";
|
|
7
|
+
data: string;
|
|
8
|
+
} | {
|
|
9
|
+
command: "UPDATE";
|
|
10
|
+
data: {
|
|
11
|
+
fieldId: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
version?: number;
|
|
14
|
+
value: string;
|
|
15
|
+
blobId?: string | null;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
command: "RESET_FIELD";
|
|
19
|
+
data: {
|
|
20
|
+
fieldId: string;
|
|
21
|
+
language?: string;
|
|
22
|
+
version?: number;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
command: "REMOVE_VERSION";
|
|
26
|
+
data: {
|
|
27
|
+
language: string;
|
|
28
|
+
version: number;
|
|
29
|
+
};
|
|
30
|
+
} | {
|
|
31
|
+
command: "ADD_VERSION";
|
|
32
|
+
data: {
|
|
33
|
+
language: string;
|
|
34
|
+
version: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export type ItemCommand = {
|
|
38
|
+
type: ItemCommandType;
|
|
39
|
+
source: ItemMetadata;
|
|
40
|
+
destination?: ItemMetadata;
|
|
41
|
+
sourceData?: ItemData;
|
|
42
|
+
updateCommands?: UpdateCommandData[];
|
|
43
|
+
};
|
|
44
|
+
export declare const buildCommandsForSubtree: (subtree: FilesystemTreeSpec, sourceItems: ItemMetadata[], destinationItems: ItemMetadata[], applyAllowedPushOperations: boolean) => ItemCommand[];
|
|
45
|
+
export declare const buildUpdateCommandData: (comparison: ItemComparisonResult, push: boolean) => UpdateCommandData[];
|
|
46
|
+
export declare const enrichUpdateCommands: (commands: ItemCommand[], sourceData: Map<string, ItemData>, destinationData: Map<string, ItemData>, push: boolean) => void;
|
|
47
|
+
export declare const enrichCreateCommands: (commands: ItemCommand[], sourceData: Map<string, ItemData>) => void;
|
|
48
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/serialization/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAyB,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAgB,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElF,MAAM,MAAM,iBAAiB,GACzB;IAAE,OAAO,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5C;IACE,OAAO,EAAE,QAAQ,CAAC;IAClB,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,CAAC;CACH,GACD;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC1F;IAAE,OAAO,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAC1E;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAE5E,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,UAAU,CAAC,EAAE,QAAQ,CAAC;IACtB,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACtC,CAAC;AAYF,eAAO,MAAM,uBAAuB,GAClC,SAAS,kBAAkB,EAC3B,aAAa,YAAY,EAAE,EAC3B,kBAAkB,YAAY,EAAE,EAChC,4BAA4B,OAAO,KAClC,WAAW,EA2Cb,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,YAAY,oBAAoB,EAChC,MAAM,OAAO,KACZ,iBAAiB,EA6FnB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,UAAU,WAAW,EAAE,EACvB,YAAY,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EACjC,iBAAiB,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,EACtC,MAAM,OAAO,KACZ,IAgBF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,UAAU,WAAW,EAAE,EACvB,YAAY,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,KAChC,IAOF,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.enrichCreateCommands = exports.enrichUpdateCommands = exports.buildUpdateCommandData = exports.buildCommandsForSubtree = void 0;
|
|
4
|
+
const tree_spec_1 = require("./tree-spec");
|
|
5
|
+
const compare_1 = require("./compare");
|
|
6
|
+
const restrictedTemplateId = "AB86861A-6030-46C5-B394-E8F99E8B87DB";
|
|
7
|
+
const restrictedFieldId = "8CDC337E-A112-42FB-BBB4-4143751E123F";
|
|
8
|
+
const fieldResetAllowed = (item, fieldId) => {
|
|
9
|
+
return (item.templateId.toUpperCase() !== restrictedTemplateId ||
|
|
10
|
+
fieldId.toUpperCase() !== restrictedFieldId);
|
|
11
|
+
};
|
|
12
|
+
const buildCommandsForSubtree = (subtree, sourceItems, destinationItems, applyAllowedPushOperations) => {
|
|
13
|
+
const commands = [];
|
|
14
|
+
const sourceMap = new Map(sourceItems.map((item) => [item.id, item]));
|
|
15
|
+
const destinationMap = new Map(destinationItems.map((item) => [item.id, item]));
|
|
16
|
+
for (const item of sourceItems) {
|
|
17
|
+
const dest = destinationMap.get(item.id);
|
|
18
|
+
const allowed = applyAllowedPushOperations
|
|
19
|
+
? subtree.getAllowedPushOperationsForItem(item.path)
|
|
20
|
+
: tree_spec_1.AllowedPushOperations.CreateUpdateAndDelete;
|
|
21
|
+
if (!dest) {
|
|
22
|
+
commands.push({ type: "create", source: item });
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (allowed !== tree_spec_1.AllowedPushOperations.CreateOnly) {
|
|
26
|
+
if (item.parentId !== dest.parentId) {
|
|
27
|
+
commands.push({ type: "move", source: item, destination: dest });
|
|
28
|
+
}
|
|
29
|
+
if (item.path.itemName !== dest.path.itemName) {
|
|
30
|
+
commands.push({ type: "rename", source: item, destination: dest });
|
|
31
|
+
}
|
|
32
|
+
if (!item.dataSignature || !dest.dataSignature || item.dataSignature !== dest.dataSignature) {
|
|
33
|
+
commands.push({ type: "update", source: item, destination: dest });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
for (const dest of destinationItems) {
|
|
38
|
+
if (sourceMap.has(dest.id)) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const allowed = applyAllowedPushOperations
|
|
42
|
+
? subtree.getAllowedPushOperationsForItem(dest.path)
|
|
43
|
+
: tree_spec_1.AllowedPushOperations.CreateUpdateAndDelete;
|
|
44
|
+
if (allowed === tree_spec_1.AllowedPushOperations.CreateUpdateAndDelete) {
|
|
45
|
+
commands.push({ type: "recycle", source: dest });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return orderCommands(commands);
|
|
49
|
+
};
|
|
50
|
+
exports.buildCommandsForSubtree = buildCommandsForSubtree;
|
|
51
|
+
const buildUpdateCommandData = (comparison, push) => {
|
|
52
|
+
const updates = [];
|
|
53
|
+
if (comparison.isTemplateChanged) {
|
|
54
|
+
updates.push({ command: "CHANGE_TEMPLATE", data: comparison.leftItem.templateId });
|
|
55
|
+
}
|
|
56
|
+
for (const version of comparison.changedVersions) {
|
|
57
|
+
if (version.leftVersion && !version.rightVersion) {
|
|
58
|
+
updates.push({
|
|
59
|
+
command: "ADD_VERSION",
|
|
60
|
+
data: { language: version.leftVersion.language, version: version.leftVersion.version },
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if (version.rightVersion && !version.leftVersion) {
|
|
64
|
+
updates.push({
|
|
65
|
+
command: "REMOVE_VERSION",
|
|
66
|
+
data: { language: version.rightVersion.language, version: version.rightVersion.version },
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
for (const field of version.changedFields) {
|
|
71
|
+
if (field.leftField) {
|
|
72
|
+
updates.push({
|
|
73
|
+
command: "UPDATE",
|
|
74
|
+
data: {
|
|
75
|
+
fieldId: field.leftField.fieldId,
|
|
76
|
+
language: version.language,
|
|
77
|
+
version: version.versionNumber,
|
|
78
|
+
value: field.leftField.value ?? "",
|
|
79
|
+
blobId: field.leftField.blobId ?? null,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else if (field.rightField &&
|
|
84
|
+
(!push || fieldResetAllowed(comparison.rightItem, field.rightField.fieldId))) {
|
|
85
|
+
updates.push({
|
|
86
|
+
command: "RESET_FIELD",
|
|
87
|
+
data: {
|
|
88
|
+
fieldId: field.rightField.fieldId,
|
|
89
|
+
language: version.language,
|
|
90
|
+
version: version.versionNumber,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const language of comparison.changedUnversionedFields) {
|
|
97
|
+
for (const field of language.changedFields) {
|
|
98
|
+
if (field.leftField) {
|
|
99
|
+
updates.push({
|
|
100
|
+
command: "UPDATE",
|
|
101
|
+
data: {
|
|
102
|
+
fieldId: field.leftField.fieldId,
|
|
103
|
+
language: language.language.language,
|
|
104
|
+
value: field.leftField.value ?? "",
|
|
105
|
+
blobId: field.leftField.blobId ?? null,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else if (field.rightField) {
|
|
110
|
+
updates.push({
|
|
111
|
+
command: "RESET_FIELD",
|
|
112
|
+
data: {
|
|
113
|
+
fieldId: field.rightField.fieldId,
|
|
114
|
+
language: language.language.language,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
for (const field of comparison.changedSharedFields) {
|
|
121
|
+
if (field.leftField) {
|
|
122
|
+
updates.push({
|
|
123
|
+
command: "UPDATE",
|
|
124
|
+
data: {
|
|
125
|
+
fieldId: field.leftField.fieldId,
|
|
126
|
+
value: field.leftField.value ?? "",
|
|
127
|
+
blobId: field.leftField.blobId ?? null,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else if (field.rightField) {
|
|
132
|
+
updates.push({
|
|
133
|
+
command: "RESET_FIELD",
|
|
134
|
+
data: { fieldId: field.rightField.fieldId },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return updates;
|
|
139
|
+
};
|
|
140
|
+
exports.buildUpdateCommandData = buildUpdateCommandData;
|
|
141
|
+
const enrichUpdateCommands = (commands, sourceData, destinationData, push) => {
|
|
142
|
+
for (const command of commands) {
|
|
143
|
+
if (command.type !== "update") {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const source = sourceData.get(command.source.id);
|
|
147
|
+
const dest = destinationData.get(command.source.id);
|
|
148
|
+
if (!source || !dest) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const comparison = (0, compare_1.compareItems)(source, dest);
|
|
152
|
+
command.sourceData = source;
|
|
153
|
+
command.updateCommands = (0, exports.buildUpdateCommandData)(comparison, push);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
exports.enrichUpdateCommands = enrichUpdateCommands;
|
|
157
|
+
const enrichCreateCommands = (commands, sourceData) => {
|
|
158
|
+
for (const command of commands) {
|
|
159
|
+
if (command.type !== "create") {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
command.sourceData = sourceData.get(command.source.id);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
exports.enrichCreateCommands = enrichCreateCommands;
|
|
166
|
+
const orderCommands = (commands) => {
|
|
167
|
+
const depth = (item) => item.path.count;
|
|
168
|
+
const createUpdateMoveRename = commands.filter((cmd) => cmd.type !== "recycle");
|
|
169
|
+
const recycle = commands.filter((cmd) => cmd.type === "recycle");
|
|
170
|
+
createUpdateMoveRename.sort((a, b) => depth(a.source) - depth(b.source));
|
|
171
|
+
recycle.sort((a, b) => depth(b.source) - depth(a.source));
|
|
172
|
+
const standardValues = createUpdateMoveRename.filter((command) => command.type === "create" && command.source.path.toPathString().includes("__Standard Values"));
|
|
173
|
+
const rest = createUpdateMoveRename.filter((command) => !standardValues.includes(command));
|
|
174
|
+
return [...rest, ...standardValues, ...recycle];
|
|
175
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ItemData, ItemFieldValue, ItemLanguage, ItemVersion } from "./types";
|
|
2
|
+
export type FieldComparisonResult = {
|
|
3
|
+
leftField: ItemFieldValue | null;
|
|
4
|
+
rightField: ItemFieldValue | null;
|
|
5
|
+
};
|
|
6
|
+
export type ItemLanguageComparisonResult = {
|
|
7
|
+
language: ItemLanguage;
|
|
8
|
+
changedFields: FieldComparisonResult[];
|
|
9
|
+
};
|
|
10
|
+
export type ItemVersionComparisonResult = {
|
|
11
|
+
leftVersion: ItemVersion | null;
|
|
12
|
+
rightVersion: ItemVersion | null;
|
|
13
|
+
changedFields: FieldComparisonResult[];
|
|
14
|
+
versionNumber: number;
|
|
15
|
+
language: string;
|
|
16
|
+
};
|
|
17
|
+
export type ItemComparisonResult = {
|
|
18
|
+
leftItem: ItemData;
|
|
19
|
+
rightItem: ItemData;
|
|
20
|
+
isRenamed: boolean;
|
|
21
|
+
isMoved: boolean;
|
|
22
|
+
isTemplateChanged: boolean;
|
|
23
|
+
isBranchChanged: boolean;
|
|
24
|
+
changedSharedFields: FieldComparisonResult[];
|
|
25
|
+
changedUnversionedFields: ItemLanguageComparisonResult[];
|
|
26
|
+
changedVersions: ItemVersionComparisonResult[];
|
|
27
|
+
};
|
|
28
|
+
export declare const compareItems: (left: ItemData, right: ItemData) => ItemComparisonResult;
|
|
29
|
+
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../src/serialization/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,UAAU,EAAE,cAAc,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,qBAAqB,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,aAAa,EAAE,qBAAqB,EAAE,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,QAAQ,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IAC7C,wBAAwB,EAAE,4BAA4B,EAAE,CAAC;IACzD,eAAe,EAAE,2BAA2B,EAAE,CAAC;CAChD,CAAC;AAkJF,eAAO,MAAM,YAAY,GAAI,MAAM,QAAQ,EAAE,OAAO,QAAQ,KAAG,oBAY9D,CAAC"}
|