@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,119 @@
|
|
|
1
|
+
import type { AuthoringApiClient, RemoteItem } from "./api/client";
|
|
2
|
+
import type { SitesApiClient } from "./api/sites-client";
|
|
3
|
+
import type { OperationIr } from "./ir/operations";
|
|
4
|
+
import { type Plan, type PlanEvent, type PlannedAction, type PlanSummary } from "./plan";
|
|
5
|
+
import { type RollbackError, type RollbackEvent, type RollbackResult } from "./rollback";
|
|
6
|
+
/**
|
|
7
|
+
* `scai recipe push` and `scai recipe plan` share the same per-op
|
|
8
|
+
* read-then-diff loop. Apply mode interleaves plan-and-apply: each op's
|
|
9
|
+
* plan sees the cascading effect of earlier ops' applies — required for
|
|
10
|
+
* idempotency.
|
|
11
|
+
*
|
|
12
|
+
* **Captured-itemId map.** Sitecore's Authoring API server-assigns
|
|
13
|
+
* itemIds on `createItem`. The IR uses recipe-internal uuidv5 refKeys
|
|
14
|
+
* for cross-references (parents, datasource template, params template,
|
|
15
|
+
* insertOptions, etc.). Each push maintains a `capturedItemIds: Map<refKey,
|
|
16
|
+
* sitecoreItemId>`:
|
|
17
|
+
* - Populated from `getItem(by path)` when the planner finds an
|
|
18
|
+
* existing item.
|
|
19
|
+
* - Populated from `createItem` responses when the executor creates
|
|
20
|
+
* a new item.
|
|
21
|
+
* - Read by `resolveRecipeRefs` to substitute ref-recipe values into
|
|
22
|
+
* concrete GUID strings before mutations dispatch.
|
|
23
|
+
*
|
|
24
|
+
* On apply error: forward execution stops and `rollback` runs over the
|
|
25
|
+
* already-applied actions in LIFO order. Snapshots captured at plan time
|
|
26
|
+
* drive the inverse mutations.
|
|
27
|
+
*/
|
|
28
|
+
export type ExecutionMode = "plan" | "apply";
|
|
29
|
+
export interface ExecutionFailedEvent {
|
|
30
|
+
kind: "failed";
|
|
31
|
+
failedAt: number;
|
|
32
|
+
applied: number;
|
|
33
|
+
rolledBack: number;
|
|
34
|
+
rollbackErrors: RollbackError[];
|
|
35
|
+
/** The planning or apply error that triggered the rollback. */
|
|
36
|
+
error: string;
|
|
37
|
+
}
|
|
38
|
+
export type ExecutionEvent = PlanEvent | RollbackEvent | {
|
|
39
|
+
kind: "apply-start";
|
|
40
|
+
action: PlannedAction;
|
|
41
|
+
} | {
|
|
42
|
+
kind: "apply-success";
|
|
43
|
+
action: PlannedAction;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "apply-error";
|
|
46
|
+
action: PlannedAction;
|
|
47
|
+
error: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Emitted on each Sites API job poll while waiting for an async op
|
|
51
|
+
* (createSite, deleteSite). Lets operators and orchestrators see
|
|
52
|
+
* progress on long-running jobs (cold tenants can take >30s) instead
|
|
53
|
+
* of staring at a silent CLI.
|
|
54
|
+
*/
|
|
55
|
+
| {
|
|
56
|
+
kind: "site-job-poll";
|
|
57
|
+
jobHandle: string;
|
|
58
|
+
/** Normalized phase string read from `Job.state ?? Job.status`. */
|
|
59
|
+
phase: string;
|
|
60
|
+
/** Milliseconds elapsed since polling began. */
|
|
61
|
+
elapsedMs: number;
|
|
62
|
+
} | ExecutionFailedEvent;
|
|
63
|
+
export interface ExecutionResult {
|
|
64
|
+
plan: Plan;
|
|
65
|
+
summary: PlanSummary;
|
|
66
|
+
/** True when push aborted before all ops were dispatched. */
|
|
67
|
+
aborted: boolean;
|
|
68
|
+
/** Present only when the apply phase aborted; tracks the rollback outcome. */
|
|
69
|
+
rollback?: RollbackResult;
|
|
70
|
+
}
|
|
71
|
+
export interface ExecuteOptions {
|
|
72
|
+
mode: ExecutionMode;
|
|
73
|
+
emit?: (event: ExecutionEvent) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Cross-recipe ref pre-seed: `refKey → expectedPath` for items
|
|
76
|
+
* produced by OTHER recipes in the same workspace. The executor
|
|
77
|
+
* walks this map at start, calls `getItem({path})` for each entry,
|
|
78
|
+
* and if found seeds `capturedItemIds` so the planner can resolve
|
|
79
|
+
* `ref-recipe` / `ref-recipe-list` / `ref-source-fields` values
|
|
80
|
+
* pointing at items the current recipe doesn't itself produce
|
|
81
|
+
* (e.g. accordion-block's `insertOptions: ["accordion-item@1"]`).
|
|
82
|
+
*
|
|
83
|
+
* Entries whose path doesn't yet exist on the tenant are silently
|
|
84
|
+
* skipped — those are first-push cross-recipe refs that need the
|
|
85
|
+
* producer recipe to land first. Push a second time once producers
|
|
86
|
+
* land, or order recipes topologically.
|
|
87
|
+
*/
|
|
88
|
+
crossRecipeRefs?: ReadonlyMap<string, string>;
|
|
89
|
+
/**
|
|
90
|
+
* Sites API client — required when the IR contains
|
|
91
|
+
* `CreateSiteFromTemplate` ops. Recipe sets without SiteRecipes can
|
|
92
|
+
* pass undefined; site ops without a client produce an `error`
|
|
93
|
+
* action at plan time and don't dispatch.
|
|
94
|
+
*/
|
|
95
|
+
sitesClient?: SitesApiClient;
|
|
96
|
+
/**
|
|
97
|
+
* Workspace-wide path → itemId cache. When provided, the executor
|
|
98
|
+
* threads it into the planner so `getItem({ path })` short-circuits
|
|
99
|
+
* to a captured itemId when the path was already resolved (by an
|
|
100
|
+
* earlier recipe's create, by `seedCrossRecipeRefs`, or by a
|
|
101
|
+
* pre-execution prefetch). The same map is shared with the
|
|
102
|
+
* `AuthoringApiClient`'s `pathItemIdCache` (see
|
|
103
|
+
* `createAuthoringClient`) so `ensurePathExists` consults the same
|
|
104
|
+
* resolutions and skips redundant tree walks.
|
|
105
|
+
*/
|
|
106
|
+
pathItemIdCache?: Map<string, string>;
|
|
107
|
+
/**
|
|
108
|
+
* Workspace-wide path → RemoteItem snapshot cache. Pre-populated by
|
|
109
|
+
* the workspace prefetch in `push.ts` (a single batched
|
|
110
|
+
* `getItemsByPaths` call covering every CreateItem path across every
|
|
111
|
+
* IR). The planner's per-op `getItem({ path })` reads consult this
|
|
112
|
+
* cache first; on a hit, no wire call. `null` values mean "checked
|
|
113
|
+
* and missing on the tenant" — also a cache hit, just one that
|
|
114
|
+
* indicates a CreateItem is needed.
|
|
115
|
+
*/
|
|
116
|
+
pathSnapshotCache?: Map<string, RemoteItem | null>;
|
|
117
|
+
}
|
|
118
|
+
export declare const executeIr: (ir: OperationIr, client: AuthoringApiClient, options: ExecuteOptions) => Promise<ExecutionResult>;
|
|
119
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/recipe/execute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAGL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7C,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,aAAa,GACb;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC/D;;;;;GAKG;GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB,GACD,oBAAoB,CAAC;AAEzB,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,WAAW,CAAC;IACrB,6DAA6D;IAC7D,OAAO,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACvC;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC;CACpD;AA+PD,eAAO,MAAM,SAAS,GACpB,IAAI,WAAW,EACf,QAAQ,kBAAkB,EAC1B,SAAS,cAAc,KACtB,OAAO,CAAC,eAAe,CA+GzB,CAAC"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeIr = void 0;
|
|
4
|
+
const errors_1 = require("../shared/errors");
|
|
5
|
+
const ref_encoding_1 = require("./api/ref-encoding");
|
|
6
|
+
const plan_1 = require("./plan");
|
|
7
|
+
const rollback_1 = require("./rollback");
|
|
8
|
+
/**
|
|
9
|
+
* Wait for an async Sites API job (createSite, deleteSite, etc.) to
|
|
10
|
+
* reach a terminal state. The Sites API's `getJobStatus` returns
|
|
11
|
+
* a Job whose `state` field carries the lifecycle ("Initial",
|
|
12
|
+
* "Running", "Done", "Failed"). Poll with linear backoff until
|
|
13
|
+
* terminal or until we exceed a generous wall-clock budget.
|
|
14
|
+
*
|
|
15
|
+
* Site creation is typically a few seconds on warm tenants, but cold
|
|
16
|
+
* tenants and content-tree-heavy SiteTemplates can take significantly
|
|
17
|
+
* longer. The 90s budget covers worst-case sandbox cold-starts; in
|
|
18
|
+
* production we'd surface a slow-job event so operators see progress.
|
|
19
|
+
*/
|
|
20
|
+
const SITES_JOB_POLL_BUDGET_MS = 90000;
|
|
21
|
+
const SITES_JOB_POLL_INTERVAL_MS = 1000;
|
|
22
|
+
const awaitSitesJob = async (sitesClient, jobHandle, emit) => {
|
|
23
|
+
const start = Date.now();
|
|
24
|
+
const deadline = start + SITES_JOB_POLL_BUDGET_MS;
|
|
25
|
+
while (Date.now() < deadline) {
|
|
26
|
+
const job = await sitesClient.getJobStatus(jobHandle);
|
|
27
|
+
// Sites API deployments return either `state` (runtime) or `status`
|
|
28
|
+
// (OpenAPI-spec) — accept either. See `Job` type in src/sites/api/jobs.ts.
|
|
29
|
+
const phase = job.state ?? job.status ?? "";
|
|
30
|
+
emit?.({ kind: "site-job-poll", jobHandle, phase, elapsedMs: Date.now() - start });
|
|
31
|
+
if (phase === "Done" || phase === "Completed" || phase === "Succeeded") {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (phase === "Failed" || phase === "Errored") {
|
|
35
|
+
throw (0, errors_1.createCliError)(`Sites API job ${jobHandle} reported terminal state '${phase}'.`, "SITES_API_FAILED");
|
|
36
|
+
}
|
|
37
|
+
await new Promise((resolve) => setTimeout(resolve, SITES_JOB_POLL_INTERVAL_MS));
|
|
38
|
+
}
|
|
39
|
+
throw (0, errors_1.createCliError)(`Sites API job ${jobHandle} did not finish within ${SITES_JOB_POLL_BUDGET_MS}ms.`, "SITES_API_FAILED");
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Build a `RemoteItem` snapshot from a just-applied `createItem` so
|
|
43
|
+
* subsequent reads of the same path within the push hit the cache
|
|
44
|
+
* instead of querying Sitecore.
|
|
45
|
+
*
|
|
46
|
+
* Sitecore's Authoring API has a known read-after-write lag for
|
|
47
|
+
* path-keyed lookups: `createItem` returns a 200 + assigned itemId
|
|
48
|
+
* synchronously, but `getItem({ path })` for the new path can return
|
|
49
|
+
* null for a few seconds while the path index propagates. Within a
|
|
50
|
+
* single push, two recipes sharing a CreateOnly folder path (e.g.
|
|
51
|
+
* `<enumerationsRoot>/Layout`, `<componentsRoot>/<sectionName>`) both
|
|
52
|
+
* plan-then-apply against that path; without this synthetic snapshot,
|
|
53
|
+
* the second recipe's planner reads stale-null, plans another create,
|
|
54
|
+
* and Sitecore rejects with "name already defined on this level".
|
|
55
|
+
*
|
|
56
|
+
* The synthetic carries the input fields the executor just wrote, so
|
|
57
|
+
* `computeFieldDrift` against it returns no drift — both CreateOnly
|
|
58
|
+
* (skip) and CreateAndUpdate (also skip — same fields) yield correct
|
|
59
|
+
* idempotent behavior. Real-tenant snapshots replace the synthetic on
|
|
60
|
+
* the NEXT push (when the prefetch overrides it via `getItemsByPaths`).
|
|
61
|
+
*/
|
|
62
|
+
const synthesizeCreateSnapshot = (itemId, parentItemId, templateId, name, path, fields) => {
|
|
63
|
+
const remoteFields = fields.map((f) => ({
|
|
64
|
+
fieldId: f.fieldId,
|
|
65
|
+
...(f.fieldName !== undefined && { name: f.fieldName }),
|
|
66
|
+
value: (0, ref_encoding_1.renderRefValue)(f.value),
|
|
67
|
+
...(f.language !== undefined && { language: f.language }),
|
|
68
|
+
...(f.version !== undefined && { version: f.version }),
|
|
69
|
+
}));
|
|
70
|
+
return { itemId, parentId: parentItemId, templateId, name, path, fields: remoteFields };
|
|
71
|
+
};
|
|
72
|
+
const dispatchMutation = async (client, sitesClient, action, capturedItemIds, pathItemIdCache, pathSnapshotCache, emit) => {
|
|
73
|
+
if (!action.mutation)
|
|
74
|
+
return;
|
|
75
|
+
if (action.mutation.kind === "createItem") {
|
|
76
|
+
const result = await client.createItem(action.mutation.input);
|
|
77
|
+
if (action.operation.op === "CreateItem") {
|
|
78
|
+
capturedItemIds.set(action.operation.id, result.itemId);
|
|
79
|
+
pathItemIdCache?.set(action.operation.path, result.itemId);
|
|
80
|
+
// Replace the prefetch's null/stale entry with a synthetic snapshot
|
|
81
|
+
// built from the input we just wrote. Subsequent reads of this
|
|
82
|
+
// path within the push see "exists" via the cache, dodging
|
|
83
|
+
// Sitecore's path-index propagation lag.
|
|
84
|
+
pathSnapshotCache?.set(action.operation.path, synthesizeCreateSnapshot(result.itemId, action.mutation.input.parent, action.mutation.input.templateId, action.mutation.input.name, action.operation.path, action.mutation.input.fields));
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (action.mutation.kind === "updateItem") {
|
|
89
|
+
await client.updateItem(action.mutation.input);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// createSite: dispatch through Sites API, await the async job, then
|
|
93
|
+
// look up the materialised site by name to capture its itemId so
|
|
94
|
+
// subsequent SetField overrides (dictionary, taxonomy) targeting
|
|
95
|
+
// items under the site can resolve via late-path seeding.
|
|
96
|
+
if (!sitesClient) {
|
|
97
|
+
throw (0, errors_1.createCliError)("createSite mutation requires a SitesApiClient — none threaded into the executor.", "UNKNOWN");
|
|
98
|
+
}
|
|
99
|
+
const { input, siteRefKey } = action.mutation;
|
|
100
|
+
const jobResponse = await sitesClient.createSite(input);
|
|
101
|
+
const jobHandle = jobResponse.handle ?? jobResponse.jobHandle;
|
|
102
|
+
if (!jobHandle) {
|
|
103
|
+
throw (0, errors_1.createCliError)(`createSite for '${input.siteName}' returned a JobResponse with no handle: ${JSON.stringify(jobResponse)}`, "SITES_API_FAILED");
|
|
104
|
+
}
|
|
105
|
+
await awaitSitesJob(sitesClient, jobHandle, emit);
|
|
106
|
+
// Re-list and capture the new site's itemId. The Sites API doesn't
|
|
107
|
+
// return the materialised site object from createSite directly —
|
|
108
|
+
// listSites is the canonical way to get the assigned id.
|
|
109
|
+
const sites = await sitesClient.listSites();
|
|
110
|
+
const created = sites.find((s) => s.name === input.siteName);
|
|
111
|
+
if (created?.id) {
|
|
112
|
+
capturedItemIds.set(siteRefKey, created.id);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
throw (0, errors_1.createCliError)(`createSite for '${input.siteName}' completed but the site is not present in listSites — cannot capture itemId.`, "SITES_API_FAILED");
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const buildResult = (ir, actions, summary, aborted, rollbackResult) => ({
|
|
119
|
+
plan: { schemaVersion: "1", recipeHandle: ir.recipeHandle, actions, summary },
|
|
120
|
+
summary,
|
|
121
|
+
aborted,
|
|
122
|
+
rollback: rollbackResult,
|
|
123
|
+
});
|
|
124
|
+
const runRollback = async (applied, client, capturedItemIds, options) => (0, rollback_1.rollback)(applied, client, capturedItemIds, { emit: options.emit });
|
|
125
|
+
const emitFailed = (options, failedAt, applied, rollbackResult, error) => {
|
|
126
|
+
options.emit?.({
|
|
127
|
+
kind: "failed",
|
|
128
|
+
failedAt,
|
|
129
|
+
applied: applied.length,
|
|
130
|
+
rolledBack: rollbackResult.rolledBack,
|
|
131
|
+
rollbackErrors: rollbackResult.errors,
|
|
132
|
+
error,
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Look up each cross-recipe ref's expected path on the tenant; capture
|
|
137
|
+
* any that exist. Skips refs the current IR produces (those land via
|
|
138
|
+
* dispatchMutation as the current recipe applies). Best-effort: a
|
|
139
|
+
* missing item is fine — that ref won't resolve, the dependent op will
|
|
140
|
+
* skip with a clear "refKey ... not in captured map" error.
|
|
141
|
+
*
|
|
142
|
+
* When a `pathSnapshotCache` is provided (workspace prefetch already
|
|
143
|
+
* ran), this short-circuits to in-memory lookups for every ref whose
|
|
144
|
+
* path is already cached — zero wire calls. Refs not yet cached fall
|
|
145
|
+
* through to a single batched `getItemsByPaths` round trip rather than
|
|
146
|
+
* the per-ref sequential `getItem` loop the original implementation
|
|
147
|
+
* used.
|
|
148
|
+
*/
|
|
149
|
+
const seedCrossRecipeRefs = async (ir, client, refs, capturedItemIds, pathSnapshotCache) => {
|
|
150
|
+
const ownRefs = new Set();
|
|
151
|
+
for (const op of ir.operations) {
|
|
152
|
+
if (op.op === "CreateItem")
|
|
153
|
+
ownRefs.add(op.id);
|
|
154
|
+
}
|
|
155
|
+
const pathsToFetch = [];
|
|
156
|
+
const refByPath = new Map();
|
|
157
|
+
for (const [refKey, expectedPath] of refs) {
|
|
158
|
+
if (ownRefs.has(refKey))
|
|
159
|
+
continue;
|
|
160
|
+
if (capturedItemIds.has(refKey))
|
|
161
|
+
continue;
|
|
162
|
+
// Cache hit on a previous prefetch / sibling-recipe seed — resolve
|
|
163
|
+
// without a wire call.
|
|
164
|
+
const snapshot = pathSnapshotCache?.get(expectedPath);
|
|
165
|
+
if (snapshot !== undefined) {
|
|
166
|
+
if (snapshot)
|
|
167
|
+
capturedItemIds.set(refKey, snapshot.itemId);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
pathsToFetch.push(expectedPath);
|
|
171
|
+
const bucket = refByPath.get(expectedPath);
|
|
172
|
+
if (bucket)
|
|
173
|
+
bucket.push(refKey);
|
|
174
|
+
else
|
|
175
|
+
refByPath.set(expectedPath, [refKey]);
|
|
176
|
+
}
|
|
177
|
+
if (pathsToFetch.length === 0)
|
|
178
|
+
return;
|
|
179
|
+
const fetched = await client.getItemsByPaths(pathsToFetch);
|
|
180
|
+
for (const [path, item] of fetched) {
|
|
181
|
+
pathSnapshotCache?.set(path, item);
|
|
182
|
+
if (!item)
|
|
183
|
+
continue;
|
|
184
|
+
const refKeys = refByPath.get(path) ?? [];
|
|
185
|
+
for (const refKey of refKeys) {
|
|
186
|
+
capturedItemIds.set(refKey, item.itemId);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const executeIr = async (ir, client, options) => {
|
|
191
|
+
if (options.mode === "plan") {
|
|
192
|
+
const capturedItemIds = new Map();
|
|
193
|
+
// Pre-seed path-keyed entries from the workspace path-itemId cache
|
|
194
|
+
// (populated by the workspace prefetch in push.ts). The planner's
|
|
195
|
+
// ref-path parent resolution checks `capturedItemIds.get(path)` —
|
|
196
|
+
// a hit avoids the per-op `getItem({ path: parent })` round trip.
|
|
197
|
+
if (options.pathItemIdCache) {
|
|
198
|
+
for (const [path, itemId] of options.pathItemIdCache) {
|
|
199
|
+
if (!capturedItemIds.has(path))
|
|
200
|
+
capturedItemIds.set(path, itemId);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (options.crossRecipeRefs) {
|
|
204
|
+
await seedCrossRecipeRefs(ir, client, options.crossRecipeRefs, capturedItemIds, options.pathSnapshotCache);
|
|
205
|
+
}
|
|
206
|
+
const plan = await (0, plan_1.buildPlan)(ir, client, {
|
|
207
|
+
emit: options.emit,
|
|
208
|
+
capturedItemIds,
|
|
209
|
+
sitesClient: options.sitesClient,
|
|
210
|
+
pathItemIdCache: options.pathItemIdCache,
|
|
211
|
+
pathSnapshotCache: options.pathSnapshotCache,
|
|
212
|
+
});
|
|
213
|
+
return { plan, summary: plan.summary, aborted: false };
|
|
214
|
+
}
|
|
215
|
+
const actions = [];
|
|
216
|
+
const applied = [];
|
|
217
|
+
const summary = { create: 0, update: 0, skip: 0, error: 0 };
|
|
218
|
+
const capturedItemIds = new Map();
|
|
219
|
+
if (options.pathItemIdCache) {
|
|
220
|
+
for (const [path, itemId] of options.pathItemIdCache) {
|
|
221
|
+
if (!capturedItemIds.has(path))
|
|
222
|
+
capturedItemIds.set(path, itemId);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (options.crossRecipeRefs) {
|
|
226
|
+
await seedCrossRecipeRefs(ir, client, options.crossRecipeRefs, capturedItemIds, options.pathSnapshotCache);
|
|
227
|
+
}
|
|
228
|
+
for (let index = 0; index < ir.operations.length; index += 1) {
|
|
229
|
+
const op = ir.operations[index];
|
|
230
|
+
options.emit?.({ kind: "op-start", index, operation: op });
|
|
231
|
+
let action;
|
|
232
|
+
try {
|
|
233
|
+
action = await (0, plan_1.buildAction)(index, op, client, capturedItemIds, options.sitesClient, options.pathSnapshotCache);
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
237
|
+
action = { index, operation: op, status: "error", reason: message };
|
|
238
|
+
options.emit?.({ kind: "op-error", index, operation: op, error: message });
|
|
239
|
+
summary.error += 1;
|
|
240
|
+
actions.push(action);
|
|
241
|
+
const rollbackResult = await runRollback(applied, client, capturedItemIds, options);
|
|
242
|
+
emitFailed(options, index, applied, rollbackResult, message);
|
|
243
|
+
return buildResult(ir, actions, summary, true, rollbackResult);
|
|
244
|
+
}
|
|
245
|
+
summary[action.status] += 1;
|
|
246
|
+
actions.push(action);
|
|
247
|
+
options.emit?.({ kind: "op-result", action });
|
|
248
|
+
if (!action.mutation)
|
|
249
|
+
continue;
|
|
250
|
+
options.emit?.({ kind: "apply-start", action });
|
|
251
|
+
try {
|
|
252
|
+
await dispatchMutation(client, options.sitesClient, action, capturedItemIds, options.pathItemIdCache, options.pathSnapshotCache, options.emit);
|
|
253
|
+
applied.push(action);
|
|
254
|
+
options.emit?.({ kind: "apply-success", action });
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
258
|
+
// Attach the apply-time error to the action so the top-level
|
|
259
|
+
// command summary surfaces the actual server message in
|
|
260
|
+
// `details[]`. The planner only sets `reason` for plan-time
|
|
261
|
+
// outcomes (skip/error during plan); apply-time errors emitted
|
|
262
|
+
// via `apply-error` were previously only on the event stream.
|
|
263
|
+
action.status = "error";
|
|
264
|
+
action.reason = message;
|
|
265
|
+
options.emit?.({ kind: "apply-error", action, error: message });
|
|
266
|
+
const rollbackResult = await runRollback(applied, client, capturedItemIds, options);
|
|
267
|
+
emitFailed(options, index, applied, rollbackResult, message);
|
|
268
|
+
return buildResult(ir, actions, summary, true, rollbackResult);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return buildResult(ir, actions, summary, false);
|
|
272
|
+
};
|
|
273
|
+
exports.executeIr = executeIr;
|