@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,417 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runRecipePush = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const cli_tasks_1 = require("../../shared/cli-tasks");
|
|
9
|
+
const errors_1 = require("../../shared/errors");
|
|
10
|
+
const auth_1 = require("../api/auth");
|
|
11
|
+
const sites_client_1 = require("../api/sites-client");
|
|
12
|
+
const cache_1 = require("../cache");
|
|
13
|
+
const compile_1 = require("../compile");
|
|
14
|
+
const guids_1 = require("../guids");
|
|
15
|
+
const io_1 = require("../io");
|
|
16
|
+
const execute_1 = require("../execute");
|
|
17
|
+
const placeholder_allow_1 = require("./placeholder-allow");
|
|
18
|
+
const shared_1 = require("./shared");
|
|
19
|
+
const DEFAULT_PLAN_CONCURRENCY = 4;
|
|
20
|
+
/**
|
|
21
|
+
* Collect every Sitecore content-tree path the executor MIGHT need to
|
|
22
|
+
* read up-front, given a set of compiled IRs and the cross-recipe ref
|
|
23
|
+
* map. Used to fan a single batched `getItemsByPaths` call out before
|
|
24
|
+
* the per-op plan loop runs.
|
|
25
|
+
*
|
|
26
|
+
* Sources:
|
|
27
|
+
* - Every CreateItem op's target path
|
|
28
|
+
* - Every CreateItem op's ref-path parent path (e.g. configured
|
|
29
|
+
* templatesRoot/renderingsRoot for top-level items)
|
|
30
|
+
* - Every cross-recipe ref's expectedPath
|
|
31
|
+
* - Every SetField/AppendToMultiList op's optional `latePath`
|
|
32
|
+
*
|
|
33
|
+
* De-duplicates within and across IRs — a single root path shared by
|
|
34
|
+
* 5 components ends up as one prefetch entry, not 5.
|
|
35
|
+
*/
|
|
36
|
+
const collectPrefetchPaths = (irs, crossRecipeRefs) => {
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
const out = [];
|
|
39
|
+
const add = (p) => {
|
|
40
|
+
if (!p)
|
|
41
|
+
return;
|
|
42
|
+
if (seen.has(p))
|
|
43
|
+
return;
|
|
44
|
+
seen.add(p);
|
|
45
|
+
out.push(p);
|
|
46
|
+
};
|
|
47
|
+
for (const ir of irs) {
|
|
48
|
+
for (const op of ir.operations) {
|
|
49
|
+
if (op.op === "CreateItem") {
|
|
50
|
+
add(op.path);
|
|
51
|
+
if (op.parent.kind === "ref-path")
|
|
52
|
+
add(op.parent.value);
|
|
53
|
+
}
|
|
54
|
+
else if (op.op === "SetField" || op.op === "AppendToMultiList") {
|
|
55
|
+
add(op.latePath);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const expectedPath of crossRecipeRefs.values()) {
|
|
60
|
+
add(expectedPath);
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* `scai recipe push` — apply recipes to a tenant.
|
|
66
|
+
*
|
|
67
|
+
* Input resolution:
|
|
68
|
+
* - `--input <file>` — single recipe (`.recipe.ts/.recipe.json`) or IR
|
|
69
|
+
* (`.ir.json`). The file extension picks the path: recipes are
|
|
70
|
+
* compiled in-memory, IRs are loaded directly.
|
|
71
|
+
* - default: expand the config `recipes` glob and push each match in
|
|
72
|
+
* turn (one IR per recipe; per-recipe events).
|
|
73
|
+
*
|
|
74
|
+
* Honors `--what-if` (becomes plan-only) and `--allow-write` (the
|
|
75
|
+
* scai-wide safety gate). Streams progress as `task-progress`-style
|
|
76
|
+
* events in JSON mode; renders a per-op summary in human mode.
|
|
77
|
+
*/
|
|
78
|
+
const runRecipePush = async (options) => {
|
|
79
|
+
const logger = (0, shared_1.toLogger)(options);
|
|
80
|
+
// Workspace-wide path → itemId cache. Shared between the AuthoringApiClient
|
|
81
|
+
// (for `ensurePathExists` fast-path) and the executor (for ref-path
|
|
82
|
+
// parent resolution and cross-recipe refs). Lifetime = one push.
|
|
83
|
+
const pathItemIdCache = new Map();
|
|
84
|
+
// Workspace-wide path → RemoteItem snapshot cache. Pre-populated by the
|
|
85
|
+
// bulk prefetch (single batched `getItemsByPaths` call across every
|
|
86
|
+
// CreateItem path); consulted by `buildAction` for plan-time reads.
|
|
87
|
+
const pathSnapshotCache = new Map();
|
|
88
|
+
const tenant = (0, shared_1.resolveTenant)(options, { pathItemIdCache });
|
|
89
|
+
const isDryRun = Boolean(options.whatIf);
|
|
90
|
+
if (!isDryRun) {
|
|
91
|
+
(0, shared_1.ensureAllowWrite)(tenant.root, tenant.envName, options.allowWrite);
|
|
92
|
+
}
|
|
93
|
+
const { templatesRoot, renderingsRoot } = (0, shared_1.resolveRecipeRoots)(options, tenant.environment, tenant.envName);
|
|
94
|
+
// Phase 2 per-site folder layout roots — optional at the envProfile
|
|
95
|
+
// level. When unset the compiler falls back to `templatesRoot` for
|
|
96
|
+
// both, which means section-aware components nest under templatesRoot
|
|
97
|
+
// (mid-migration fallback) and content templates land mixed in with
|
|
98
|
+
// components. The orchestrator's ephemeral CLI config sets both.
|
|
99
|
+
const componentsRoot = options.componentsRoot ?? tenant.environment.componentsRoot;
|
|
100
|
+
const contentModelsRoot = options.contentModelsRoot ?? tenant.environment.contentModelsRoot;
|
|
101
|
+
// Phase 4 composition roots — optional at the envProfile level. The
|
|
102
|
+
// per-recipe compile fns throw with their own clear messages if a
|
|
103
|
+
// partial-design / page-design / content-item recipe is in the set
|
|
104
|
+
// but the corresponding root is unset. CLI flag overrides match the
|
|
105
|
+
// templatesRoot / renderingsRoot pattern.
|
|
106
|
+
const partialDesignsRoot = options.partialDesignsRoot ?? tenant.environment.partialDesignsRoot;
|
|
107
|
+
const pageDesignsRoot = options.pageDesignsRoot ?? tenant.environment.pageDesignsRoot;
|
|
108
|
+
const contentItemsRoot = options.contentItemsRoot ?? tenant.environment.contentItemsRoot;
|
|
109
|
+
// SXA Headless variants root — required when any recipe in the set
|
|
110
|
+
// declares variants. Compiler throws INPUT_INVALID with a clear hint
|
|
111
|
+
// if a recipe asks for variants but this root is unset; if no
|
|
112
|
+
// recipe in the set has variants, this stays unset and the
|
|
113
|
+
// compiler skips the check.
|
|
114
|
+
const headlessVariantsRoot = options.headlessVariantsRoot ?? tenant.environment.headlessVariantsRoot;
|
|
115
|
+
// SXA Available Renderings root — when set, compileRecipeSet emits
|
|
116
|
+
// a synthetic IR with one Available Renderings section per
|
|
117
|
+
// `recipe.section`, listing every rendering in that section.
|
|
118
|
+
const availableRenderingsRoot = options.availableRenderingsRoot ?? tenant.environment.availableRenderingsRoot;
|
|
119
|
+
// Per-site enumerations bucket — required for EnumerationRecipe
|
|
120
|
+
// compilation and for any field carrying `sitecore.enumHandle`.
|
|
121
|
+
const enumerationsRoot = options.enumerationsRoot ?? tenant.environment.enumerationsRoot;
|
|
122
|
+
const { files, source } = await (0, shared_1.resolveRecipeInputs)(options, tenant.root);
|
|
123
|
+
const results = [];
|
|
124
|
+
const allEvents = [];
|
|
125
|
+
// Pre-compile every recipe so we can build a workspace-wide
|
|
126
|
+
// refKey → expectedPath map. The executor uses this to seed
|
|
127
|
+
// capturedItemIds with cross-recipe references the current recipe's
|
|
128
|
+
// own ops don't produce (e.g. accordion-block's
|
|
129
|
+
// `insertOptions: ["accordion-item@1"]` references accordion-item's
|
|
130
|
+
// template, which lives in a different recipe's IR).
|
|
131
|
+
//
|
|
132
|
+
// Phase 4: recipe-source files compile through `compileRecipeSet` so
|
|
133
|
+
// cross-recipe `TemplatesMapping` contributions (every PageDesignRecipe
|
|
134
|
+
// contributes one entry per `appliesTo` template) aggregate into a
|
|
135
|
+
// single synthetic IR. Pre-compiled `.ir.json` inputs load directly —
|
|
136
|
+
// the aggregate-IR opportunity is gone for those, but the executor
|
|
137
|
+
// still applies whatever's there.
|
|
138
|
+
const recipeFiles = [];
|
|
139
|
+
const irFiles = [];
|
|
140
|
+
for (const file of files) {
|
|
141
|
+
const ext = node_path_1.default.extname(file).toLowerCase();
|
|
142
|
+
if (ext === ".json" && file.endsWith(".ir.json")) {
|
|
143
|
+
irFiles.push(file);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
recipeFiles.push(file);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const recipes = await (0, cli_tasks_1.mapWithConcurrency)(recipeFiles, (f) => (0, io_1.loadRecipe)(f));
|
|
150
|
+
const compiled = (0, compile_1.compileRecipeSet)(recipes, {
|
|
151
|
+
templatesRoot,
|
|
152
|
+
renderingsRoot,
|
|
153
|
+
componentsRoot,
|
|
154
|
+
contentModelsRoot,
|
|
155
|
+
partialDesignsRoot,
|
|
156
|
+
pageDesignsRoot,
|
|
157
|
+
contentItemsRoot,
|
|
158
|
+
headlessVariantsRoot,
|
|
159
|
+
availableRenderingsRoot,
|
|
160
|
+
enumerationsRoot,
|
|
161
|
+
});
|
|
162
|
+
const loadedIrs = await (0, cli_tasks_1.mapWithConcurrency)(irFiles, (f) => (0, io_1.loadIr)(f));
|
|
163
|
+
const irs = [
|
|
164
|
+
...compiled.map((ir) => ({ ir })),
|
|
165
|
+
...loadedIrs.map((ir) => ({ ir })),
|
|
166
|
+
];
|
|
167
|
+
const crossRecipeRefs = new Map();
|
|
168
|
+
for (const { ir } of irs) {
|
|
169
|
+
for (const op of ir.operations) {
|
|
170
|
+
if (op.op === "CreateItem")
|
|
171
|
+
crossRecipeRefs.set(op.id, op.path);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// Seed the synthetic Page Designs root refKey so the cross-recipe
|
|
175
|
+
// `TemplatesMapping` aggregate op (emitted by `compileRecipeSet` when
|
|
176
|
+
// any page design declares `appliesTo`) resolves its target. The
|
|
177
|
+
// executor walks the path and stores the captured itemId in
|
|
178
|
+
// `capturedItemIds` before applying the SetField op. Skip the seed
|
|
179
|
+
// when `pageDesignsRoot` isn't set — without page designs in the
|
|
180
|
+
// set, the aggregate IR isn't emitted and the seed wouldn't be used
|
|
181
|
+
// anyway.
|
|
182
|
+
if (pageDesignsRoot) {
|
|
183
|
+
crossRecipeRefs.set(guids_1.PAGE_DESIGNS_ROOT_REF_KEY, pageDesignsRoot);
|
|
184
|
+
}
|
|
185
|
+
// Lazy-build a SitesApiClient only when an IR in the set needs one
|
|
186
|
+
// (i.e. carries a CreateSiteFromTemplate op). Component / partial /
|
|
187
|
+
// page-design / content-item recipes never reach Sites API — keep
|
|
188
|
+
// their push paths free of unnecessary token mints.
|
|
189
|
+
let sitesClient;
|
|
190
|
+
const hasSiteOp = irs.some(({ ir }) => ir.operations.some((op) => op.op === "CreateSiteFromTemplate"));
|
|
191
|
+
if (hasSiteOp) {
|
|
192
|
+
const accessToken = await (0, auth_1.getAccessToken)(tenant.environment);
|
|
193
|
+
if (!accessToken) {
|
|
194
|
+
throw (0, errors_1.createCliError)(`Failed to mint a Sites API access token for environment '${tenant.envName}'. Run 'scai login' or set client credentials, then retry.`, "AUTH_REQUIRED");
|
|
195
|
+
}
|
|
196
|
+
sitesClient = (0, sites_client_1.createSitesApiClient)({ accessToken });
|
|
197
|
+
}
|
|
198
|
+
// Recipe-source files (vs pre-compiled `.ir.json`) are kept in scope
|
|
199
|
+
// for the post-IR placeholder-allow phase. Pre-compiled IRs lose
|
|
200
|
+
// their source-recipe handle/section/name → can't drive placeholder
|
|
201
|
+
// resolution; for those, callers should run `scai deploy placeholders`
|
|
202
|
+
// separately if needed.
|
|
203
|
+
const sourceRecipes = recipes;
|
|
204
|
+
// ─── Optional recipe-hash skip ────────────────────────────────────────
|
|
205
|
+
// When `--skip-unchanged-recipes` is on, compare each compiled IR's
|
|
206
|
+
// digest against the persisted cache. Cache hits short-circuit the
|
|
207
|
+
// recipe entirely (zero plan-time reads, zero mutations); cache
|
|
208
|
+
// misses fall through to the normal execute path.
|
|
209
|
+
const configDir = node_path_1.default.dirname(tenant.root.physicalPath);
|
|
210
|
+
const recipeCache = options.skipUnchangedRecipes ? await (0, cache_1.loadRecipeCache)(configDir) : null;
|
|
211
|
+
const rootsHash = (0, cache_1.hashRoots)({
|
|
212
|
+
templatesRoot,
|
|
213
|
+
renderingsRoot,
|
|
214
|
+
componentsRoot,
|
|
215
|
+
contentModelsRoot,
|
|
216
|
+
partialDesignsRoot,
|
|
217
|
+
pageDesignsRoot,
|
|
218
|
+
contentItemsRoot,
|
|
219
|
+
headlessVariantsRoot,
|
|
220
|
+
availableRenderingsRoot,
|
|
221
|
+
enumerationsRoot,
|
|
222
|
+
});
|
|
223
|
+
const irsToExecute = [];
|
|
224
|
+
const cachedSkips = [];
|
|
225
|
+
for (const { ir } of irs) {
|
|
226
|
+
const irHash = (0, cache_1.hashIr)(ir);
|
|
227
|
+
const cached = recipeCache && (0, cache_1.cachedSkipFor)(recipeCache, tenant.envName, rootsHash, ir.recipeHandle, irHash);
|
|
228
|
+
if (cached) {
|
|
229
|
+
cachedSkips.push({ ir, irHash, entry: cached });
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
irsToExecute.push({ ir, irHash, cached: false });
|
|
233
|
+
}
|
|
234
|
+
// Surface cache-skips as zero-effect ExecutionResults so downstream
|
|
235
|
+
// callers (orchestrator, JSON consumers) see a uniform shape across
|
|
236
|
+
// skipped + executed recipes.
|
|
237
|
+
for (const { ir, entry } of cachedSkips) {
|
|
238
|
+
const skipSummary = { create: 0, update: 0, skip: ir.operations.length, error: 0 };
|
|
239
|
+
results.push({
|
|
240
|
+
plan: {
|
|
241
|
+
schemaVersion: "1",
|
|
242
|
+
recipeHandle: ir.recipeHandle,
|
|
243
|
+
actions: [],
|
|
244
|
+
summary: skipSummary,
|
|
245
|
+
},
|
|
246
|
+
summary: skipSummary,
|
|
247
|
+
aborted: false,
|
|
248
|
+
});
|
|
249
|
+
if (!logger.isJson()) {
|
|
250
|
+
logger.info(`Skipping ${ir.recipeHandle} on ${tenant.envName} (unchanged since ${entry?.lastApplied ?? "previous push"})`, "green");
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// ─── Workspace prefetch ────────────────────────────────────────────────
|
|
254
|
+
// One batched `getItemsByPaths` call covering every path the executor
|
|
255
|
+
// would otherwise read sequentially. On a re-push of an existing
|
|
256
|
+
// recipe set this collapses N×ops sequential reads into ~ceil(N/25)
|
|
257
|
+
// parallel batches, then the per-op plan loop hits the cache for
|
|
258
|
+
// every read. On a first push, missing paths are cached as `null`
|
|
259
|
+
// — buildAction sees that as "checked, missing → CreateItem applies".
|
|
260
|
+
const prefetchPaths = collectPrefetchPaths(irsToExecute.map((e) => e.ir), crossRecipeRefs);
|
|
261
|
+
if (prefetchPaths.length > 0) {
|
|
262
|
+
const fetched = await tenant.client.getItemsByPaths(prefetchPaths);
|
|
263
|
+
for (const [p, item] of fetched) {
|
|
264
|
+
pathSnapshotCache.set(p, item);
|
|
265
|
+
if (item)
|
|
266
|
+
pathItemIdCache.set(p, item.itemId);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
// ─── Plan or apply ────────────────────────────────────────────────────
|
|
270
|
+
// Plan-mode reads are pure and have no cross-recipe ordering
|
|
271
|
+
// requirements once `crossRecipeRefs` + the prefetch have populated
|
|
272
|
+
// the workspace caches — so plan-mode IRs run concurrently. Apply
|
|
273
|
+
// mode stays sequential per-IR; mutations within and across recipes
|
|
274
|
+
// can have ordering dependencies that the topological IR encoding
|
|
275
|
+
// already respects in a serial walk.
|
|
276
|
+
const planConcurrency = options.planConcurrency ?? DEFAULT_PLAN_CONCURRENCY;
|
|
277
|
+
const runOne = async (ir) => (0, execute_1.executeIr)(ir, tenant.client, {
|
|
278
|
+
mode: isDryRun ? "plan" : "apply",
|
|
279
|
+
emit: (event) => allEvents.push({ recipe: ir.recipeHandle, event }),
|
|
280
|
+
crossRecipeRefs,
|
|
281
|
+
sitesClient,
|
|
282
|
+
pathItemIdCache,
|
|
283
|
+
pathSnapshotCache,
|
|
284
|
+
});
|
|
285
|
+
const renderResult = (ir, result) => {
|
|
286
|
+
if (logger.isJson())
|
|
287
|
+
return;
|
|
288
|
+
logger.info(`${isDryRun ? "Dry-run" : "Applying"} ${ir.recipeHandle} on ${tenant.envName}`, "cyan");
|
|
289
|
+
for (const action of result.plan.actions) {
|
|
290
|
+
logger.info(` ${formatActionTag(action.status)} ${action.operation.label}${action.reason ? ` — ${action.reason}` : ""}`);
|
|
291
|
+
}
|
|
292
|
+
if (result.aborted && result.rollback) {
|
|
293
|
+
logger.warn(` Push aborted at op ${result.plan.actions[result.plan.actions.length - 1]?.index ?? "?"}; rolled back ${result.rollback.rolledBack} of ${result.plan.actions.filter((a) => a.mutation).length} applied.`);
|
|
294
|
+
for (const err of result.rollback.errors) {
|
|
295
|
+
logger.warn(` ! rollback failed at ${err.label}: ${err.error}`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
logger.info(` Summary: ${result.summary.create} create / ${result.summary.update} update / ${result.summary.skip} skip${result.summary.error ? ` / ${result.summary.error} error` : ""}`, result.summary.error || result.aborted ? "yellow" : "green");
|
|
299
|
+
};
|
|
300
|
+
if (isDryRun) {
|
|
301
|
+
const planResults = await (0, cli_tasks_1.mapWithConcurrency)(irsToExecute, ({ ir }) => runOne(ir), planConcurrency);
|
|
302
|
+
for (let i = 0; i < irsToExecute.length; i += 1) {
|
|
303
|
+
const { ir } = irsToExecute[i];
|
|
304
|
+
const result = planResults[i];
|
|
305
|
+
results.push(result);
|
|
306
|
+
renderResult(ir, result);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
for (const { ir } of irsToExecute) {
|
|
311
|
+
const result = await runOne(ir);
|
|
312
|
+
results.push(result);
|
|
313
|
+
renderResult(ir, result);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// ─── Persist hash cache ────────────────────────────────────────────────
|
|
317
|
+
// Only after a successful (non-aborted, non-error) apply. Plan-mode
|
|
318
|
+
// (dry-run) doesn't update the cache — it can't validate that the
|
|
319
|
+
// tenant matches what the cache implies.
|
|
320
|
+
if (!isDryRun && options.skipUnchangedRecipes && recipeCache) {
|
|
321
|
+
for (const { ir, irHash } of irsToExecute) {
|
|
322
|
+
const result = results.find((r) => r.plan.recipeHandle === ir.recipeHandle);
|
|
323
|
+
if (!result || result.aborted || result.summary.error > 0)
|
|
324
|
+
continue;
|
|
325
|
+
(0, cache_1.recordCacheEntry)(recipeCache, tenant.envName, rootsHash, ir.recipeHandle, {
|
|
326
|
+
irHash,
|
|
327
|
+
lastApplied: new Date().toISOString(),
|
|
328
|
+
summary: {
|
|
329
|
+
create: result.summary.create,
|
|
330
|
+
update: result.summary.update,
|
|
331
|
+
skip: result.summary.skip,
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
await (0, cache_1.saveRecipeCache)(configDir, recipeCache);
|
|
336
|
+
}
|
|
337
|
+
// Post-IR phase: register each component-template recipe's
|
|
338
|
+
// rendering with the placeholder slots it declares compatibility
|
|
339
|
+
// with (`recipe.placedIn: string[]`). Runs only on apply mode
|
|
340
|
+
// and only when at least one IR succeeded (a fully-aborted push
|
|
341
|
+
// shouldn't dirty unrelated placeholders). Skipped when the env
|
|
342
|
+
// profile doesn't configure `placeholderSettingsRoots` — empty list
|
|
343
|
+
// means no slots to walk.
|
|
344
|
+
const placeholderRoots = tenant.environment.placeholderSettingsRoots ?? [];
|
|
345
|
+
const anyComponentRecipeDeclaresPlaceholders = sourceRecipes.some((r) => r.kind === "component-template" && Array.isArray(r.placedIn) && r.placedIn.length > 0);
|
|
346
|
+
let placeholderAllowSummary = null;
|
|
347
|
+
if (!isDryRun &&
|
|
348
|
+
anyComponentRecipeDeclaresPlaceholders &&
|
|
349
|
+
placeholderRoots.length > 0 &&
|
|
350
|
+
results.some((r) => !r.aborted)) {
|
|
351
|
+
placeholderAllowSummary = await (0, placeholder_allow_1.applyPlaceholderAllowControls)({
|
|
352
|
+
client: tenant.client,
|
|
353
|
+
recipes: sourceRecipes,
|
|
354
|
+
renderingsRoot,
|
|
355
|
+
placeholderSettingsRoots: placeholderRoots,
|
|
356
|
+
apply: true,
|
|
357
|
+
onUpdate: (placeholderPath, added) => {
|
|
358
|
+
if (!logger.isJson()) {
|
|
359
|
+
logger.info(` Placeholder ${placeholderPath} ← +${added} rendering(s)`, "cyan");
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
if (!logger.isJson()) {
|
|
364
|
+
logger.info(`Placeholder allow-controls: ${placeholderAllowSummary.patched} placeholder(s) patched, ${placeholderAllowSummary.totalAdded} entry(ies) added`, placeholderAllowSummary.unmatchedPlaceholderKeys.length > 0 ? "yellow" : "green");
|
|
365
|
+
if (placeholderAllowSummary.unmatchedPlaceholderKeys.length > 0) {
|
|
366
|
+
logger.warn(` Unmatched placeholder keys (no Placeholder Settings item with that key under any configured root): ${placeholderAllowSummary.unmatchedPlaceholderKeys.join(", ")}`);
|
|
367
|
+
}
|
|
368
|
+
if (placeholderAllowSummary.unresolvedRecipeHandles.length > 0) {
|
|
369
|
+
logger.warn(` Recipes whose rendering item couldn't be resolved (skipped from placeholder registration): ${placeholderAllowSummary.unresolvedRecipeHandles.join(", ")}`);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (logger.isJson()) {
|
|
374
|
+
logger.json({
|
|
375
|
+
command: "recipe.push",
|
|
376
|
+
environment: tenant.envName,
|
|
377
|
+
source,
|
|
378
|
+
whatIf: isDryRun,
|
|
379
|
+
placeholderAllowControls: placeholderAllowSummary ?? undefined,
|
|
380
|
+
results: results.map((r) => ({
|
|
381
|
+
recipeHandle: r.plan.recipeHandle,
|
|
382
|
+
summary: r.summary,
|
|
383
|
+
aborted: r.aborted,
|
|
384
|
+
rollback: r.rollback ?? null,
|
|
385
|
+
})),
|
|
386
|
+
events: allEvents.map(({ recipe, event }) => ({
|
|
387
|
+
recipe,
|
|
388
|
+
kind: event.kind,
|
|
389
|
+
index: "index" in event ? event.index : "action" in event ? event.action.index : undefined,
|
|
390
|
+
label: "operation" in event
|
|
391
|
+
? event.operation.label
|
|
392
|
+
: "action" in event
|
|
393
|
+
? event.action.operation.label
|
|
394
|
+
: undefined,
|
|
395
|
+
status: "action" in event ? event.action.status : undefined,
|
|
396
|
+
reason: "action" in event ? event.action.reason : undefined,
|
|
397
|
+
diff: "action" in event ? event.action.diff : undefined,
|
|
398
|
+
mutation: "action" in event ? event.action.mutation : undefined,
|
|
399
|
+
error: "error" in event ? event.error : undefined,
|
|
400
|
+
})),
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return results;
|
|
404
|
+
};
|
|
405
|
+
exports.runRecipePush = runRecipePush;
|
|
406
|
+
const formatActionTag = (status) => {
|
|
407
|
+
switch (status) {
|
|
408
|
+
case "create":
|
|
409
|
+
return "[+]";
|
|
410
|
+
case "update":
|
|
411
|
+
return "[~]";
|
|
412
|
+
case "skip":
|
|
413
|
+
return "[ ]";
|
|
414
|
+
case "error":
|
|
415
|
+
return "[!]";
|
|
416
|
+
}
|
|
417
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Logger } from "../../shared/logger";
|
|
2
|
+
import { type EnvironmentConfiguration, type RootConfiguration } from "../../config";
|
|
3
|
+
import type { AuthoringApiClient } from "../api/client";
|
|
4
|
+
/**
|
|
5
|
+
* Shared option shapes for the three `scai recipe` tasks.
|
|
6
|
+
*
|
|
7
|
+
* All three honor the standard verbosity options (`--quiet`, `--json`,
|
|
8
|
+
* `--log-file`). Plan and push additionally need an environment to talk
|
|
9
|
+
* to a tenant; compile is pure-logic and doesn't.
|
|
10
|
+
*/
|
|
11
|
+
export interface RecipeCommonOptions {
|
|
12
|
+
config?: string;
|
|
13
|
+
verbose?: boolean;
|
|
14
|
+
trace?: boolean;
|
|
15
|
+
quiet?: boolean;
|
|
16
|
+
json?: boolean;
|
|
17
|
+
logFile?: string;
|
|
18
|
+
nonInteractive?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface RecipeCompileOptions extends RecipeCommonOptions {
|
|
21
|
+
/** Single recipe file path. Defaults to the config `recipes` glob. */
|
|
22
|
+
input?: string;
|
|
23
|
+
output?: string;
|
|
24
|
+
/** Override `templatesRoot` from the env profile. */
|
|
25
|
+
templatesRoot?: string;
|
|
26
|
+
/** Override `renderingsRoot` from the env profile. */
|
|
27
|
+
renderingsRoot?: string;
|
|
28
|
+
/** Override `componentsRoot` from the env profile (Phase 2 layout). */
|
|
29
|
+
componentsRoot?: string;
|
|
30
|
+
/** Override `contentModelsRoot` from the env profile (Phase 2 layout). */
|
|
31
|
+
contentModelsRoot?: string;
|
|
32
|
+
/** Override `partialDesignsRoot` from the env profile (Phase 4). */
|
|
33
|
+
partialDesignsRoot?: string;
|
|
34
|
+
/** Override `pageDesignsRoot` from the env profile (Phase 4). */
|
|
35
|
+
pageDesignsRoot?: string;
|
|
36
|
+
/** Override `contentItemsRoot` from the env profile (Phase 4). */
|
|
37
|
+
contentItemsRoot?: string;
|
|
38
|
+
/** Override `headlessVariantsRoot` from the env profile. */
|
|
39
|
+
headlessVariantsRoot?: string;
|
|
40
|
+
/** Override `availableRenderingsRoot` from the env profile. */
|
|
41
|
+
availableRenderingsRoot?: string;
|
|
42
|
+
/** Override `enumerationsRoot` from the env profile. */
|
|
43
|
+
enumerationsRoot?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Active env profile to source `templatesRoot` / `renderingsRoot`
|
|
46
|
+
* defaults from when the flags are not passed. Required for compile
|
|
47
|
+
* since compile is otherwise environment-agnostic.
|
|
48
|
+
*/
|
|
49
|
+
environmentName?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface RecipeTenantOptions extends RecipeCommonOptions {
|
|
52
|
+
environmentName?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface RecipePlanOptions extends RecipeTenantOptions {
|
|
55
|
+
/** Single IR file path. Defaults to the config `recipes` glob (compiled in-memory). */
|
|
56
|
+
input?: string;
|
|
57
|
+
output?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface RecipePushOptions extends RecipeTenantOptions {
|
|
60
|
+
/** Single recipe file path. Defaults to the config `recipes` glob. */
|
|
61
|
+
input?: string;
|
|
62
|
+
/** Override `templatesRoot` from the env profile. */
|
|
63
|
+
templatesRoot?: string;
|
|
64
|
+
/** Override `renderingsRoot` from the env profile. */
|
|
65
|
+
renderingsRoot?: string;
|
|
66
|
+
/** Override `componentsRoot` from the env profile (Phase 2 layout). */
|
|
67
|
+
componentsRoot?: string;
|
|
68
|
+
/** Override `contentModelsRoot` from the env profile (Phase 2 layout). */
|
|
69
|
+
contentModelsRoot?: string;
|
|
70
|
+
/** Override `partialDesignsRoot` from the env profile (Phase 4). */
|
|
71
|
+
partialDesignsRoot?: string;
|
|
72
|
+
/** Override `pageDesignsRoot` from the env profile (Phase 4). */
|
|
73
|
+
pageDesignsRoot?: string;
|
|
74
|
+
/** Override `contentItemsRoot` from the env profile (Phase 4). */
|
|
75
|
+
contentItemsRoot?: string;
|
|
76
|
+
/** Override `headlessVariantsRoot` from the env profile. */
|
|
77
|
+
headlessVariantsRoot?: string;
|
|
78
|
+
/** Override `availableRenderingsRoot` from the env profile. */
|
|
79
|
+
availableRenderingsRoot?: string;
|
|
80
|
+
/** Override `enumerationsRoot` from the env profile. */
|
|
81
|
+
enumerationsRoot?: string;
|
|
82
|
+
whatIf?: boolean;
|
|
83
|
+
allowWrite?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* When true, skip recipes whose compiled IR digest + env-profile roots
|
|
86
|
+
* digest both match the persisted `.scai/recipe-cache.json` entry from
|
|
87
|
+
* the previous successful push. Speedups re-pushes of an unchanged
|
|
88
|
+
* recipe set on warm tenants. Off by default — out-of-band CMS edits
|
|
89
|
+
* to recipe-owned items aren't auto-redetected until either the recipe
|
|
90
|
+
* source changes or the cache is invalidated.
|
|
91
|
+
*/
|
|
92
|
+
skipUnchangedRecipes?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Plan-mode parallelism across recipes. Plan reads are pure (no
|
|
95
|
+
* mutations, no shared mutable refs across recipes), so plan-mode
|
|
96
|
+
* IRs can run concurrently. Defaults to 4. Apply-mode always runs
|
|
97
|
+
* sequentially — within a push, mutations land in topological order.
|
|
98
|
+
*/
|
|
99
|
+
planConcurrency?: number;
|
|
100
|
+
}
|
|
101
|
+
export declare const toLogger: (options: RecipeCommonOptions) => Logger;
|
|
102
|
+
export interface ResolvedTenant {
|
|
103
|
+
envName: string;
|
|
104
|
+
environment: EnvironmentConfiguration;
|
|
105
|
+
root: RootConfiguration;
|
|
106
|
+
client: AuthoringApiClient;
|
|
107
|
+
}
|
|
108
|
+
export declare const resolveTenant: (options: RecipeTenantOptions, clientOptions?: {
|
|
109
|
+
pathItemIdCache?: Map<string, string>;
|
|
110
|
+
}) => ResolvedTenant;
|
|
111
|
+
/**
|
|
112
|
+
* Resolve the recipe parent paths that the compiler will use for top-level
|
|
113
|
+
* template + rendering items.
|
|
114
|
+
*
|
|
115
|
+
* Lookup order:
|
|
116
|
+
* 1. `--templates-root` / `--renderings-root` CLI flags
|
|
117
|
+
* 2. `envProfiles[<name>].templatesRoot` / `.renderingsRoot` from
|
|
118
|
+
* sitecoreai.cli.json (env-overrides via
|
|
119
|
+
* `SITECOREAI_ENV_<NAME>_TEMPLATES_ROOT` / `_RENDERINGS_ROOT` apply
|
|
120
|
+
* at config-load time before this helper runs)
|
|
121
|
+
* 3. Throws `INPUT_INVALID` with a hint pointing at the envProfile shape
|
|
122
|
+
*
|
|
123
|
+
* Tenant-specific because each site has its own
|
|
124
|
+
* `/sitecore/templates/Project/<site>/Components` location. Putting roots
|
|
125
|
+
* in config keeps the orchestrator's `recipe push` invocation
|
|
126
|
+
* config-driven (no plan-schema fields, no extra arg plumbing).
|
|
127
|
+
*/
|
|
128
|
+
export declare const resolveRecipeRoots: (options: {
|
|
129
|
+
templatesRoot?: string;
|
|
130
|
+
renderingsRoot?: string;
|
|
131
|
+
}, environment: EnvironmentConfiguration | undefined, envName: string) => {
|
|
132
|
+
templatesRoot: string;
|
|
133
|
+
renderingsRoot: string;
|
|
134
|
+
};
|
|
135
|
+
export interface RecipeInputResolution {
|
|
136
|
+
files: string[];
|
|
137
|
+
source: "input-flag" | "config-glob";
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Resolve the recipe files a task should operate on. Precedence:
|
|
141
|
+
* 1. `--input <file>` if provided (single file).
|
|
142
|
+
* 2. `recipes` globs from sitecoreai.cli.json (zero, one, or many files).
|
|
143
|
+
*
|
|
144
|
+
* Returns absolute paths. Throws `INPUT_INVALID` when neither path resolves
|
|
145
|
+
* to any files — telling the user how to fix it.
|
|
146
|
+
*/
|
|
147
|
+
export declare const resolveRecipeInputs: (options: {
|
|
148
|
+
input?: string;
|
|
149
|
+
config?: string;
|
|
150
|
+
}, root: RootConfiguration) => Promise<RecipeInputResolution>;
|
|
151
|
+
export declare const ensureAllowWrite: (root: RootConfiguration, envName: string, override?: boolean) => void;
|
|
152
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/recipe/tasks/shared.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ensureAllowWrite = exports.resolveRecipeInputs = exports.resolveRecipeRoots = exports.resolveTenant = exports.toLogger = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
9
|
+
const logger_1 = require("../../shared/logger");
|
|
10
|
+
const errors_1 = require("../../shared/errors");
|
|
11
|
+
const env_1 = require("../../shared/env");
|
|
12
|
+
const authoring_client_1 = require("../api/authoring-client");
|
|
13
|
+
const toLogger = (options) => new logger_1.Logger(Boolean(options.verbose), Boolean(options.trace), Boolean(options.json), Boolean(options.quiet), options.logFile ?? process.env.SITECOREAI_LOG_FILE);
|
|
14
|
+
exports.toLogger = toLogger;
|
|
15
|
+
const resolveTenant = (options, clientOptions) => {
|
|
16
|
+
const { envName, environment, root, timeoutMs } = (0, env_1.resolveEnvironment)(options);
|
|
17
|
+
const client = (0, authoring_client_1.createAuthoringClient)({
|
|
18
|
+
environment,
|
|
19
|
+
request: { timeoutMs },
|
|
20
|
+
...(clientOptions?.pathItemIdCache && { pathItemIdCache: clientOptions.pathItemIdCache }),
|
|
21
|
+
});
|
|
22
|
+
return { envName, environment, root, client };
|
|
23
|
+
};
|
|
24
|
+
exports.resolveTenant = resolveTenant;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the recipe parent paths that the compiler will use for top-level
|
|
27
|
+
* template + rendering items.
|
|
28
|
+
*
|
|
29
|
+
* Lookup order:
|
|
30
|
+
* 1. `--templates-root` / `--renderings-root` CLI flags
|
|
31
|
+
* 2. `envProfiles[<name>].templatesRoot` / `.renderingsRoot` from
|
|
32
|
+
* sitecoreai.cli.json (env-overrides via
|
|
33
|
+
* `SITECOREAI_ENV_<NAME>_TEMPLATES_ROOT` / `_RENDERINGS_ROOT` apply
|
|
34
|
+
* at config-load time before this helper runs)
|
|
35
|
+
* 3. Throws `INPUT_INVALID` with a hint pointing at the envProfile shape
|
|
36
|
+
*
|
|
37
|
+
* Tenant-specific because each site has its own
|
|
38
|
+
* `/sitecore/templates/Project/<site>/Components` location. Putting roots
|
|
39
|
+
* in config keeps the orchestrator's `recipe push` invocation
|
|
40
|
+
* config-driven (no plan-schema fields, no extra arg plumbing).
|
|
41
|
+
*/
|
|
42
|
+
const resolveRecipeRoots = (options, environment, envName) => {
|
|
43
|
+
const templatesRoot = options.templatesRoot ?? environment?.templatesRoot;
|
|
44
|
+
const renderingsRoot = options.renderingsRoot ?? environment?.renderingsRoot;
|
|
45
|
+
if (!templatesRoot || !renderingsRoot) {
|
|
46
|
+
const missing = !templatesRoot && !renderingsRoot
|
|
47
|
+
? "both roots"
|
|
48
|
+
: !templatesRoot
|
|
49
|
+
? "templatesRoot"
|
|
50
|
+
: "renderingsRoot";
|
|
51
|
+
throw (0, errors_1.createCliError)(`Recipe parent path missing: ${missing} not configured for environment '${envName}'.`, "INPUT_INVALID", {
|
|
52
|
+
hint: `Add 'templatesRoot' and 'renderingsRoot' to envProfiles.${envName} in sitecoreai.cli.json (or pass --templates-root / --renderings-root).`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return { templatesRoot, renderingsRoot };
|
|
56
|
+
};
|
|
57
|
+
exports.resolveRecipeRoots = resolveRecipeRoots;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the recipe files a task should operate on. Precedence:
|
|
60
|
+
* 1. `--input <file>` if provided (single file).
|
|
61
|
+
* 2. `recipes` globs from sitecoreai.cli.json (zero, one, or many files).
|
|
62
|
+
*
|
|
63
|
+
* Returns absolute paths. Throws `INPUT_INVALID` when neither path resolves
|
|
64
|
+
* to any files — telling the user how to fix it.
|
|
65
|
+
*/
|
|
66
|
+
const resolveRecipeInputs = async (options, root) => {
|
|
67
|
+
if (options.input) {
|
|
68
|
+
return { files: [node_path_1.default.resolve(options.input)], source: "input-flag" };
|
|
69
|
+
}
|
|
70
|
+
const configDir = node_path_1.default.dirname(root.physicalPath);
|
|
71
|
+
const matched = await (0, fast_glob_1.default)(root.recipes, { cwd: configDir, absolute: true });
|
|
72
|
+
if (matched.length === 0) {
|
|
73
|
+
throw (0, errors_1.createCliError)(`No recipe files matched the config glob: ${root.recipes.join(", ")}.`, "INPUT_INVALID", {
|
|
74
|
+
hint: "Pass --input <recipe-file>, or update the `recipes` glob in sitecoreai.cli.json.",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return { files: matched.sort(), source: "config-glob" };
|
|
78
|
+
};
|
|
79
|
+
exports.resolveRecipeInputs = resolveRecipeInputs;
|
|
80
|
+
const ensureAllowWrite = (root, envName, override) => {
|
|
81
|
+
const environment = root.environments[envName];
|
|
82
|
+
if (override || environment?.allowWrite) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const envKey = envName
|
|
86
|
+
.trim()
|
|
87
|
+
.toUpperCase()
|
|
88
|
+
.replace(/[^A-Z0-9]+/g, "_")
|
|
89
|
+
.replace(/^_+|_+$/g, "");
|
|
90
|
+
throw (0, errors_1.createCliError)(`Environment ${envName} is not configured to allow writing data.`, "INPUT_INVALID", {
|
|
91
|
+
hint: `Set allowWrite in sitecoreai.cli.json, set SITECOREAI_ENV_${envKey}_ALLOW_WRITE=true, or pass --allow-write.`,
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
exports.ensureAllowWrite = ensureAllowWrite;
|