@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,709 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileComponentTemplateRecipe = compileComponentTemplateRecipe;
|
|
4
|
+
const guids_1 = require("../guids");
|
|
5
|
+
const operations_1 = require("../ir/operations");
|
|
6
|
+
const policy_1 = require("../policy");
|
|
7
|
+
const errors_1 = require("../../shared/errors");
|
|
8
|
+
const sitecore_templates_1 = require("../ir/sitecore-templates");
|
|
9
|
+
const recipe_1 = require("../schema/recipe");
|
|
10
|
+
const component_section_1 = require("./component-section");
|
|
11
|
+
const shared_1 = require("./shared");
|
|
12
|
+
/**
|
|
13
|
+
* SXA Section Definition's "Available Renderings" multi-list field —
|
|
14
|
+
* the lookup key the executor uses to read/append values when
|
|
15
|
+
* applying `AppendToMultiList` ops emitted from `availableIn`.
|
|
16
|
+
*
|
|
17
|
+
* The GUID is a placeholder until sandbox introspection lands; the
|
|
18
|
+
* executor matches by `fieldName` when the IR carries one (recipe-
|
|
19
|
+
* authored fields share this property), so the placeholder is
|
|
20
|
+
* tolerated for now.
|
|
21
|
+
*/
|
|
22
|
+
const AVAILABLE_RENDERINGS_FIELD_ID = sitecore_templates_1.SECTION_DEFINITION_FIELDS.AVAILABLE_RENDERINGS;
|
|
23
|
+
const AVAILABLE_RENDERINGS_FIELD_NAME = "Available Renderings";
|
|
24
|
+
/**
|
|
25
|
+
* Resolve `recipe.section?.handle` to the section's `name` via the
|
|
26
|
+
* cross-recipe `sectionsByHandle` map on `CompileContext`. Returns
|
|
27
|
+
* `undefined` when the recipe has no section (legacy flat layout);
|
|
28
|
+
* throws INPUT_INVALID when the recipe references a section handle
|
|
29
|
+
* that no `ComponentSectionRecipe` in the set provides.
|
|
30
|
+
*/
|
|
31
|
+
const resolveSectionName = (recipe, context) => {
|
|
32
|
+
if (!recipe.section)
|
|
33
|
+
return undefined;
|
|
34
|
+
return (0, component_section_1.resolveSectionRecipe)(recipe.handle, recipe.section.handle, context.sectionsByHandle).name;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Compile a `ComponentTemplateRecipe` to an Operation IR.
|
|
38
|
+
*
|
|
39
|
+
* Pure: same recipe + same context → identical IR forever. The Authoring
|
|
40
|
+
* API server-assigns itemIds on `createItem`, so the IR carries Sitecore
|
|
41
|
+
* `path` fields for lookups + recipe-internal `refKey` GUIDs (uuidv5)
|
|
42
|
+
* which the executor uses as the key into a per-run captured-itemId map.
|
|
43
|
+
*
|
|
44
|
+
* Layout (per `plans/recipe-site-folder-layout.md`):
|
|
45
|
+
*
|
|
46
|
+
* With `section: "ui"`:
|
|
47
|
+
* - Section folder (CreateOnly) at `<componentsRoot>/ui`
|
|
48
|
+
* - Template at `<componentsRoot>/ui/<Component>`
|
|
49
|
+
* - When recipe declares `children:`, a Component Folder template at
|
|
50
|
+
* `<componentsRoot>/ui/Component Folders/<Component> Folder`
|
|
51
|
+
* - Inline `params:` (or `parameters: { handle }`) → Parameters
|
|
52
|
+
* template at `<componentsRoot>/ui/Presentation Parameters/<name>`
|
|
53
|
+
* - Renderings-side section folder (CreateOnly) at
|
|
54
|
+
* `<renderingsRoot>/ui`, then rendering at
|
|
55
|
+
* `<renderingsRoot>/ui/<Component>`
|
|
56
|
+
* - For each handle in `availableIn`, an `AppendToMultiList` op
|
|
57
|
+
* against the section definition's Available Renderings field
|
|
58
|
+
*
|
|
59
|
+
* Without `section` (legacy back-compat):
|
|
60
|
+
* - Flat layout — template at `<templatesRoot>/<Component>`,
|
|
61
|
+
* parameters at `<templatesRoot>/<Component> Parameters`,
|
|
62
|
+
* rendering at `<renderingsRoot>/<Component>`. No section folder
|
|
63
|
+
* creation, no Component Folder generation.
|
|
64
|
+
*/
|
|
65
|
+
function compileComponentTemplateRecipe(input, context, emittedFolders = new Set()) {
|
|
66
|
+
const recipe = recipe_1.ComponentTemplateRecipeSchema.parse(input);
|
|
67
|
+
const operations = [];
|
|
68
|
+
const policy = (0, policy_1.defaultPolicyForRecipe)(recipe.kind);
|
|
69
|
+
const icon = sitecore_templates_1.DEFAULT_ICON;
|
|
70
|
+
const sectionName = resolveSectionName(recipe, context);
|
|
71
|
+
if (sectionName) {
|
|
72
|
+
(0, shared_1.ensureSectionFolder)(operations, context, sectionName, emittedFolders);
|
|
73
|
+
}
|
|
74
|
+
(0, shared_1.emitDatasourceTemplate)(operations, {
|
|
75
|
+
handle: recipe.handle,
|
|
76
|
+
name: recipe.name,
|
|
77
|
+
displayName: recipe.displayName,
|
|
78
|
+
fields: recipe.fields,
|
|
79
|
+
insertOptions: recipe.insertOptions,
|
|
80
|
+
// Component templates always sit at the section root (or
|
|
81
|
+
// templatesRoot, for legacy callers).
|
|
82
|
+
parentPath: (0, shared_1.resolveComponentTemplateParent)(context, sectionName),
|
|
83
|
+
// SXA Foundation bases (`_PerSiteStandardValues`,
|
|
84
|
+
// `_HorizonDatasourceGrouping`, `_PublishingGroupingTemplate`) —
|
|
85
|
+
// verified against live tenants on 2026-05-02. Without these the
|
|
86
|
+
// SXA editor doesn't recognise the item as a component and
|
|
87
|
+
// fields/standard-values won't surface in the Pages editor.
|
|
88
|
+
additionalBaseTemplates: sitecore_templates_1.SXA_COMPONENT_BASE_TEMPLATES,
|
|
89
|
+
}, context, icon, policy);
|
|
90
|
+
if (recipe.children) {
|
|
91
|
+
emitComponentFolderTemplate(operations, recipe, context, icon, emittedFolders);
|
|
92
|
+
}
|
|
93
|
+
// Emit the per-component Data Folder template once per recipe-handle
|
|
94
|
+
// when at least one site-scoped datasource location declares a
|
|
95
|
+
// subfolder. The folder ITEMs at `<contentItemsRoot>/<subfolder>`
|
|
96
|
+
// (emitted later inside `emitRendering`) conform to this template so
|
|
97
|
+
// their `__Standard Values`'s Insert Options restrict right-click →
|
|
98
|
+
// Insert to this component's datasource type.
|
|
99
|
+
const hasSiteScopedSubfolder = (recipe.datasource?.locations ?? []).some((location) => location.scope === "site" && !!location.subfolder);
|
|
100
|
+
if (hasSiteScopedSubfolder) {
|
|
101
|
+
emitSiteDataFolderTemplate(operations, recipe, context, icon, emittedFolders);
|
|
102
|
+
}
|
|
103
|
+
// Parameter template emission:
|
|
104
|
+
// - If `recipe.parameters` is set, the rendering points at that
|
|
105
|
+
// external parameters template (no synthesis here).
|
|
106
|
+
// - Else if inline `params:` non-empty, synthesise an anonymous
|
|
107
|
+
// parameters template at the section-local Presentation
|
|
108
|
+
// Parameters bucket (or templatesRoot for legacy).
|
|
109
|
+
const hasInlineParams = recipe.params.length > 0 && !recipe.parameters;
|
|
110
|
+
if (hasInlineParams) {
|
|
111
|
+
emitParamsTemplate(operations, recipe, context, icon, policy, emittedFolders);
|
|
112
|
+
}
|
|
113
|
+
if (sectionName) {
|
|
114
|
+
(0, shared_1.ensureRenderingsSectionFolder)(operations, context, sectionName, emittedFolders);
|
|
115
|
+
}
|
|
116
|
+
emitRendering(operations, recipe, context, icon, hasInlineParams || recipe.parameters !== undefined, policy, emittedFolders);
|
|
117
|
+
if (recipe.variants.length > 0) {
|
|
118
|
+
emitVariants(operations, recipe, context, icon, policy, emittedFolders);
|
|
119
|
+
}
|
|
120
|
+
if (recipe.availableIn && recipe.availableIn.length > 0) {
|
|
121
|
+
emitAvailableInBindings(operations, recipe, policy, (0, shared_1.siteOf)(context));
|
|
122
|
+
}
|
|
123
|
+
return operations_1.OperationIrSchema.parse({
|
|
124
|
+
schemaVersion: "1",
|
|
125
|
+
recipeHandle: recipe.handle,
|
|
126
|
+
operations,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Emit `AppendToMultiList` ops binding this rendering's GUID into the
|
|
131
|
+
* `Available Renderings` field of each section definition listed in
|
|
132
|
+
* `recipe.availableIn`. Idempotent under `merge-unique` policy.
|
|
133
|
+
*/
|
|
134
|
+
function emitAvailableInBindings(operations, recipe, policy, site) {
|
|
135
|
+
const availableIn = recipe.availableIn ?? [];
|
|
136
|
+
for (const sectionDefinitionHandle of availableIn) {
|
|
137
|
+
operations.push({
|
|
138
|
+
op: "AppendToMultiList",
|
|
139
|
+
policy,
|
|
140
|
+
label: `available-in:${recipe.handle}->${sectionDefinitionHandle}`,
|
|
141
|
+
itemRefKey: (0, guids_1.sectionDefinitionId)(sectionDefinitionHandle),
|
|
142
|
+
fieldId: AVAILABLE_RENDERINGS_FIELD_ID,
|
|
143
|
+
fieldName: AVAILABLE_RENDERINGS_FIELD_NAME,
|
|
144
|
+
values: [{ kind: "ref-recipe", refKey: (0, guids_1.renderingId)(site, recipe.handle) }],
|
|
145
|
+
appendPolicy: "merge-unique",
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Emit the `<Component> Folder` template under
|
|
151
|
+
* `<componentsRoot>/<section>/Component Folders/`. Creates the
|
|
152
|
+
* companion section folders idempotently. The folder template's
|
|
153
|
+
* `__Standard Values` carries the Insert Options multi-list of allowed
|
|
154
|
+
* child handles.
|
|
155
|
+
*/
|
|
156
|
+
function emitComponentFolderTemplate(operations, recipe, context, icon, emittedFolders) {
|
|
157
|
+
const sectionName = resolveSectionName(recipe, context);
|
|
158
|
+
if (!sectionName) {
|
|
159
|
+
// Without a section we can't pick a sensible parent folder; skip
|
|
160
|
+
// emission and let the validator surface the missing section.
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (!recipe.children)
|
|
164
|
+
return;
|
|
165
|
+
const policy = (0, policy_1.defaultPolicyForRecipe)(recipe.kind);
|
|
166
|
+
const site = (0, shared_1.siteOf)(context);
|
|
167
|
+
const bucketRefKey = (0, shared_1.ensureComponentFoldersBucket)(operations, context, sectionName, emittedFolders);
|
|
168
|
+
const folderName = `${recipe.name} Folder`;
|
|
169
|
+
const folderTplRefKey = (0, guids_1.componentFolderTemplateId)(site, recipe.handle);
|
|
170
|
+
const folderTplPath = (0, shared_1.joinPath)((0, shared_1.resolveComponentFoldersBucketPath)(context, sectionName), folderName);
|
|
171
|
+
operations.push({
|
|
172
|
+
op: "CreateItem",
|
|
173
|
+
policy,
|
|
174
|
+
label: `component-folder-template:${recipe.handle}`,
|
|
175
|
+
id: folderTplRefKey,
|
|
176
|
+
path: folderTplPath,
|
|
177
|
+
parent: { kind: "ref-recipe", refKey: bucketRefKey },
|
|
178
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE,
|
|
179
|
+
name: folderName,
|
|
180
|
+
fields: [
|
|
181
|
+
(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: icon }),
|
|
182
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, {
|
|
183
|
+
kind: "string",
|
|
184
|
+
value: `${recipe.displayName} Folder`,
|
|
185
|
+
}),
|
|
186
|
+
],
|
|
187
|
+
});
|
|
188
|
+
// Folder templates inherit Standard Template (no custom fields).
|
|
189
|
+
operations.push({
|
|
190
|
+
op: "SetBaseTemplates",
|
|
191
|
+
policy,
|
|
192
|
+
label: `component-folder-base-templates:${recipe.handle}`,
|
|
193
|
+
itemRefKey: folderTplRefKey,
|
|
194
|
+
baseTemplates: [sitecore_templates_1.STANDARD_TEMPLATE_ID],
|
|
195
|
+
});
|
|
196
|
+
// Standard Values item — the Insert Options field we set below lives
|
|
197
|
+
// here, not on the template item itself.
|
|
198
|
+
const svRefKey = (0, guids_1.componentFolderStandardValuesId)(site, recipe.handle);
|
|
199
|
+
const svPath = (0, shared_1.joinPath)(folderTplPath, "__Standard Values");
|
|
200
|
+
operations.push({
|
|
201
|
+
op: "CreateItem",
|
|
202
|
+
policy,
|
|
203
|
+
label: `component-folder-standard-values:${recipe.handle}`,
|
|
204
|
+
id: svRefKey,
|
|
205
|
+
path: svPath,
|
|
206
|
+
parent: { kind: "ref-recipe", refKey: folderTplRefKey },
|
|
207
|
+
templateOf: folderTplRefKey,
|
|
208
|
+
name: "__Standard Values",
|
|
209
|
+
fields: [],
|
|
210
|
+
});
|
|
211
|
+
operations.push({
|
|
212
|
+
op: "SetStandardValues",
|
|
213
|
+
policy,
|
|
214
|
+
label: `link-component-folder-standard-values:${recipe.handle}`,
|
|
215
|
+
templateRefKey: folderTplRefKey,
|
|
216
|
+
standardValuesRefKey: svRefKey,
|
|
217
|
+
});
|
|
218
|
+
operations.push({
|
|
219
|
+
op: "SetField",
|
|
220
|
+
policy,
|
|
221
|
+
label: `component-folder-insert-options:${recipe.handle}`,
|
|
222
|
+
itemRefKey: svRefKey,
|
|
223
|
+
fieldId: sitecore_templates_1.SYSTEM_FIELDS.INSERT_OPTIONS,
|
|
224
|
+
value: {
|
|
225
|
+
kind: "ref-recipe-list",
|
|
226
|
+
refKeys: recipe.children.allowedHandles.map((handle) => (0, guids_1.templateId)(site, handle)),
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Emit the `<Component> Data Folder` template under
|
|
232
|
+
* `Components/<section>/Component Folders/`. Co-located with the
|
|
233
|
+
* `<Component> Folder` template emitted by
|
|
234
|
+
* `emitComponentFolderTemplate` (different seed → distinct template
|
|
235
|
+
* GUID; both share the same Component Folders bucket).
|
|
236
|
+
*
|
|
237
|
+
* The template's `__Standard Values` carries an Insert Options multi-
|
|
238
|
+
* list referencing the recipe's own datasource template, so the
|
|
239
|
+
* `<contentItemsRoot>/<subfolder>` folder ITEM(s) — which conform to
|
|
240
|
+
* this template — restrict CMS authors' right-click → Insert UX to
|
|
241
|
+
* inserting only the recipe's datasource items.
|
|
242
|
+
*
|
|
243
|
+
* Idempotent on the template's refKey via `emittedFolders`: a recipe
|
|
244
|
+
* declaring multiple site-scoped subfolders emits this template once.
|
|
245
|
+
*
|
|
246
|
+
* Shared-subfolder interaction: when `context.sharedSubfolders` is set
|
|
247
|
+
* and EVERY site-scoped subfolder declared by this recipe is in the
|
|
248
|
+
* shared set, this function early-returns without emitting anything —
|
|
249
|
+
* the cross-recipe coalescer in `compileRecipeSet` emits a single
|
|
250
|
+
* SHARED template (`sharedDataFolderTemplateId(site, subfolder)`) with
|
|
251
|
+
* the union of contributing recipes' Insert Options instead. A recipe
|
|
252
|
+
* with a MIX of shared + singleton subfolders still emits its
|
|
253
|
+
* per-recipe template (the singleton folder item needs it).
|
|
254
|
+
*/
|
|
255
|
+
function emitSiteDataFolderTemplate(operations, recipe, context, icon, emittedFolders) {
|
|
256
|
+
const sectionName = resolveSectionName(recipe, context);
|
|
257
|
+
if (!sectionName) {
|
|
258
|
+
// Without a section we can't pick a sensible parent folder; skip
|
|
259
|
+
// emission and let the validator surface the missing section.
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
// Skip per-recipe template entirely when every site-scoped subfolder
|
|
263
|
+
// this recipe targets has been promoted to the shared coalescer (≥2
|
|
264
|
+
// recipes pointing at it). The coalescer-emitted shared template
|
|
265
|
+
// owns Insert Options for those folders. Mixed cases (some shared,
|
|
266
|
+
// some singleton) keep emitting — singleton folder items still
|
|
267
|
+
// reference this per-recipe template via templateOf.
|
|
268
|
+
const siteLocations = (recipe.datasource?.locations ?? []).filter((l) => l.scope === "site" && !!l.subfolder);
|
|
269
|
+
if (siteLocations.length === 0)
|
|
270
|
+
return;
|
|
271
|
+
const allShared = context.sharedSubfolders !== undefined &&
|
|
272
|
+
siteLocations.every((l) => context.sharedSubfolders.has(l.subfolder));
|
|
273
|
+
if (allShared)
|
|
274
|
+
return;
|
|
275
|
+
const policy = (0, policy_1.defaultPolicyForRecipe)(recipe.kind);
|
|
276
|
+
const site = (0, shared_1.siteOf)(context);
|
|
277
|
+
const folderTplRefKey = (0, guids_1.siteDataFolderTemplateId)(site, recipe.handle);
|
|
278
|
+
if (emittedFolders.has(folderTplRefKey))
|
|
279
|
+
return;
|
|
280
|
+
emittedFolders.add(folderTplRefKey);
|
|
281
|
+
const bucketRefKey = (0, shared_1.ensureComponentFoldersBucket)(operations, context, sectionName, emittedFolders);
|
|
282
|
+
const folderName = `${recipe.name} Data Folder`;
|
|
283
|
+
const folderTplPath = (0, shared_1.joinPath)((0, shared_1.resolveComponentFoldersBucketPath)(context, sectionName), folderName);
|
|
284
|
+
operations.push({
|
|
285
|
+
op: "CreateItem",
|
|
286
|
+
policy,
|
|
287
|
+
label: `site-data-folder-template:${recipe.handle}`,
|
|
288
|
+
id: folderTplRefKey,
|
|
289
|
+
path: folderTplPath,
|
|
290
|
+
parent: { kind: "ref-recipe", refKey: bucketRefKey },
|
|
291
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE,
|
|
292
|
+
name: folderName,
|
|
293
|
+
fields: [
|
|
294
|
+
(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: icon }),
|
|
295
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, {
|
|
296
|
+
kind: "string",
|
|
297
|
+
value: `${recipe.displayName} Data Folder`,
|
|
298
|
+
}),
|
|
299
|
+
],
|
|
300
|
+
});
|
|
301
|
+
// Folder templates inherit Standard Template (no custom fields).
|
|
302
|
+
operations.push({
|
|
303
|
+
op: "SetBaseTemplates",
|
|
304
|
+
policy,
|
|
305
|
+
label: `site-data-folder-base-templates:${recipe.handle}`,
|
|
306
|
+
itemRefKey: folderTplRefKey,
|
|
307
|
+
baseTemplates: [sitecore_templates_1.STANDARD_TEMPLATE_ID],
|
|
308
|
+
});
|
|
309
|
+
const svRefKey = (0, guids_1.siteDataFolderStandardValuesId)(site, recipe.handle);
|
|
310
|
+
const svPath = (0, shared_1.joinPath)(folderTplPath, "__Standard Values");
|
|
311
|
+
operations.push({
|
|
312
|
+
op: "CreateItem",
|
|
313
|
+
policy,
|
|
314
|
+
label: `site-data-folder-standard-values:${recipe.handle}`,
|
|
315
|
+
id: svRefKey,
|
|
316
|
+
path: svPath,
|
|
317
|
+
parent: { kind: "ref-recipe", refKey: folderTplRefKey },
|
|
318
|
+
templateOf: folderTplRefKey,
|
|
319
|
+
name: "__Standard Values",
|
|
320
|
+
fields: [],
|
|
321
|
+
});
|
|
322
|
+
operations.push({
|
|
323
|
+
op: "SetStandardValues",
|
|
324
|
+
policy,
|
|
325
|
+
label: `link-site-data-folder-standard-values:${recipe.handle}`,
|
|
326
|
+
templateRefKey: folderTplRefKey,
|
|
327
|
+
standardValuesRefKey: svRefKey,
|
|
328
|
+
});
|
|
329
|
+
// Single-template Insert Options for now (the recipe's own
|
|
330
|
+
// datasource template). Future-extensible to a list when the
|
|
331
|
+
// shared-subfolder coalescer lands.
|
|
332
|
+
operations.push({
|
|
333
|
+
op: "SetField",
|
|
334
|
+
policy,
|
|
335
|
+
label: `site-data-folder-insert-options:${recipe.handle}`,
|
|
336
|
+
itemRefKey: svRefKey,
|
|
337
|
+
fieldId: sitecore_templates_1.SYSTEM_FIELDS.INSERT_OPTIONS,
|
|
338
|
+
value: {
|
|
339
|
+
kind: "ref-recipe-list",
|
|
340
|
+
refKeys: [(0, guids_1.templateId)(site, recipe.handle)],
|
|
341
|
+
},
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function emitParamsTemplate(operations, recipe, context, icon, policy, emittedFolders) {
|
|
345
|
+
const site = (0, shared_1.siteOf)(context);
|
|
346
|
+
const paramsTplRefKey = (0, guids_1.paramsTemplateId)(site, recipe.handle);
|
|
347
|
+
const paramsName = `${recipe.name} Parameters`;
|
|
348
|
+
const paramsDisplayName = `${recipe.displayName} Parameters`;
|
|
349
|
+
const sectionName = resolveSectionName(recipe, context);
|
|
350
|
+
let paramsParent;
|
|
351
|
+
let paramsParentPath;
|
|
352
|
+
if (sectionName) {
|
|
353
|
+
const bucketRefKey = (0, shared_1.ensurePresentationParametersBucket)(operations, context, sectionName, emittedFolders);
|
|
354
|
+
paramsParent = { kind: "ref-recipe", refKey: bucketRefKey };
|
|
355
|
+
paramsParentPath = (0, shared_1.resolvePresentationParametersBucketPath)(context, sectionName);
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
paramsParent = { kind: "ref-path", value: context.templatesRoot };
|
|
359
|
+
paramsParentPath = context.templatesRoot;
|
|
360
|
+
}
|
|
361
|
+
const paramsTplPath = (0, shared_1.joinPath)(paramsParentPath, paramsName);
|
|
362
|
+
operations.push({
|
|
363
|
+
op: "CreateItem",
|
|
364
|
+
policy,
|
|
365
|
+
label: `params-template:${recipe.handle}`,
|
|
366
|
+
id: paramsTplRefKey,
|
|
367
|
+
path: paramsTplPath,
|
|
368
|
+
parent: paramsParent,
|
|
369
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE,
|
|
370
|
+
name: paramsName,
|
|
371
|
+
fields: [
|
|
372
|
+
(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: icon }),
|
|
373
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: paramsDisplayName }),
|
|
374
|
+
],
|
|
375
|
+
});
|
|
376
|
+
operations.push({
|
|
377
|
+
op: "SetBaseTemplates",
|
|
378
|
+
policy,
|
|
379
|
+
label: `params-base-templates:${recipe.handle}`,
|
|
380
|
+
itemRefKey: paramsTplRefKey,
|
|
381
|
+
// Inherits the SXA Headless params bases (BaseRenderingParameters,
|
|
382
|
+
// _PerSiteStandardValues, and the additional Headless marker)
|
|
383
|
+
// verified by tenant introspection of a working SXA Headless
|
|
384
|
+
// component (LinkList) — without these the params dialog stays
|
|
385
|
+
// empty in Pages even though the template + fields exist.
|
|
386
|
+
baseTemplates: [...sitecore_templates_1.SXA_HEADLESS_PARAMS_BASE_TEMPLATES],
|
|
387
|
+
});
|
|
388
|
+
const paramsSecRefKey = (0, guids_1.paramsSectionId)(site, recipe.handle, shared_1.PARAMS_SECTION_NAME);
|
|
389
|
+
const paramsSecPath = (0, shared_1.joinPath)(paramsTplPath, shared_1.PARAMS_SECTION_NAME);
|
|
390
|
+
operations.push({
|
|
391
|
+
op: "CreateItem",
|
|
392
|
+
policy,
|
|
393
|
+
label: `params-section:${recipe.handle}/${shared_1.PARAMS_SECTION_NAME}`,
|
|
394
|
+
id: paramsSecRefKey,
|
|
395
|
+
path: paramsSecPath,
|
|
396
|
+
parent: { kind: "ref-recipe", refKey: paramsTplRefKey },
|
|
397
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_SECTION,
|
|
398
|
+
name: shared_1.PARAMS_SECTION_NAME,
|
|
399
|
+
fields: [],
|
|
400
|
+
});
|
|
401
|
+
recipe.params.forEach((param, index) => {
|
|
402
|
+
operations.push(...(0, shared_1.buildFieldOp)({
|
|
403
|
+
recipeHandle: recipe.handle,
|
|
404
|
+
fieldRefKey: (0, guids_1.paramsFieldId)(site, recipe.handle, param.name),
|
|
405
|
+
fieldPath: (0, shared_1.joinPath)(paramsSecPath, param.name),
|
|
406
|
+
parentRefKey: paramsSecRefKey,
|
|
407
|
+
labelPrefix: `params-field:${recipe.handle}`,
|
|
408
|
+
field: param,
|
|
409
|
+
zeroBasedIndex: index,
|
|
410
|
+
policy,
|
|
411
|
+
site,
|
|
412
|
+
context,
|
|
413
|
+
}));
|
|
414
|
+
});
|
|
415
|
+
// Standard Values for the params template — pre-fills rendering
|
|
416
|
+
// parameter defaults so authors see expected values in the parameters
|
|
417
|
+
// dialog when first dropping the rendering. Only emitted when at
|
|
418
|
+
// least one param declares a `default` / `sitecore.defaultValue`;
|
|
419
|
+
// empty SV items are noise and would still resolve identical GUIDs
|
|
420
|
+
// across pushes if added later.
|
|
421
|
+
const paramsSvFieldEntries = (0, shared_1.buildStandardValuesFieldEntries)(site, recipe.handle, recipe.params, guids_1.paramsFieldId);
|
|
422
|
+
if (paramsSvFieldEntries.length > 0) {
|
|
423
|
+
const paramsSvRefKey = (0, guids_1.paramsStandardValuesId)(site, recipe.handle);
|
|
424
|
+
const paramsSvPath = (0, shared_1.joinPath)(paramsTplPath, "__Standard Values");
|
|
425
|
+
operations.push({
|
|
426
|
+
op: "CreateItem",
|
|
427
|
+
policy,
|
|
428
|
+
label: `params-standard-values:${recipe.handle}`,
|
|
429
|
+
id: paramsSvRefKey,
|
|
430
|
+
path: paramsSvPath,
|
|
431
|
+
parent: { kind: "ref-recipe", refKey: paramsTplRefKey },
|
|
432
|
+
templateOf: paramsTplRefKey,
|
|
433
|
+
name: "__Standard Values",
|
|
434
|
+
fields: paramsSvFieldEntries,
|
|
435
|
+
});
|
|
436
|
+
operations.push({
|
|
437
|
+
op: "SetStandardValues",
|
|
438
|
+
policy,
|
|
439
|
+
label: `link-params-standard-values:${recipe.handle}`,
|
|
440
|
+
templateRefKey: paramsTplRefKey,
|
|
441
|
+
standardValuesRefKey: paramsSvRefKey,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function emitRendering(operations, recipe, context, icon, hasParams, policy, emittedFolders) {
|
|
446
|
+
const site = (0, shared_1.siteOf)(context);
|
|
447
|
+
const renderingRefKey = (0, guids_1.renderingId)(site, recipe.handle);
|
|
448
|
+
const sectionName = resolveSectionName(recipe, context);
|
|
449
|
+
const renderingParentPath = (0, shared_1.resolveRenderingParent)(context, sectionName);
|
|
450
|
+
const renderingPath = (0, shared_1.joinPath)(renderingParentPath, recipe.name);
|
|
451
|
+
// Datasource template ref: prefer the explicit `datasource.template`
|
|
452
|
+
// ref when present (separate ContentTemplateRecipe under Content
|
|
453
|
+
// Models/); otherwise the component template itself is the datasource
|
|
454
|
+
// template (inline `fields:` pattern).
|
|
455
|
+
const datasourceRefKey = recipe.datasource?.template
|
|
456
|
+
? (0, guids_1.templateId)(site, recipe.datasource.template.handle)
|
|
457
|
+
: (0, guids_1.templateId)(site, recipe.handle);
|
|
458
|
+
const fields = [
|
|
459
|
+
(0, shared_1.sharedField)(sitecore_templates_1.RENDERING_FIELDS.COMPONENT_NAME, { kind: "string", value: recipe.name }),
|
|
460
|
+
(0, shared_1.sharedField)(sitecore_templates_1.RENDERING_FIELDS.DATASOURCE_TEMPLATE, {
|
|
461
|
+
kind: "ref-recipe",
|
|
462
|
+
refKey: datasourceRefKey,
|
|
463
|
+
}),
|
|
464
|
+
(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: icon }),
|
|
465
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: recipe.displayName }),
|
|
466
|
+
];
|
|
467
|
+
if (hasParams) {
|
|
468
|
+
// Prefer the explicit `parameters: { handle }` reference when set,
|
|
469
|
+
// else point at the synthesised inline params template (whose
|
|
470
|
+
// refKey is `paramsTemplateId(site, recipe.handle)`).
|
|
471
|
+
const paramsRefKey = recipe.parameters
|
|
472
|
+
? (0, guids_1.paramsTemplateId)(site, recipe.parameters.handle)
|
|
473
|
+
: (0, guids_1.paramsTemplateId)(site, recipe.handle);
|
|
474
|
+
fields.push((0, shared_1.sharedField)(sitecore_templates_1.RENDERING_FIELDS.PARAMETERS_TEMPLATE, {
|
|
475
|
+
kind: "ref-recipe",
|
|
476
|
+
refKey: paramsRefKey,
|
|
477
|
+
}));
|
|
478
|
+
}
|
|
479
|
+
// Datasource: build the rendering's `Datasource Location`,
|
|
480
|
+
// `Open Properties After Add`, and `OtherProperties` fields from the
|
|
481
|
+
// top-level `recipe.datasource` block. The block is optional — a
|
|
482
|
+
// static rendering (no author-pickable datasource) just omits it,
|
|
483
|
+
// and only `OtherProperties` gets written (so `dynamicPlaceholders`
|
|
484
|
+
// and free-form `recipe.otherProperties` still take effect).
|
|
485
|
+
const ds = recipe.datasource;
|
|
486
|
+
if (ds) {
|
|
487
|
+
const segments = [];
|
|
488
|
+
for (const location of ds.locations) {
|
|
489
|
+
if (location.scope === "page") {
|
|
490
|
+
segments.push(location.subfolder ? `./Data/${location.subfolder}` : "./Data");
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
// location.scope === "site"
|
|
494
|
+
if (!context.contentItemsRoot) {
|
|
495
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' declares a site-scoped datasource location but no contentItemsRoot is configured.`, "INPUT_INVALID", {
|
|
496
|
+
hint: "Set `contentItemsRoot` on the active envProfile in sitecoreai.cli.json (e.g. `/sitecore/content/<siteCollection>/<site>/Data`).",
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
const base = context.contentItemsRoot;
|
|
500
|
+
segments.push(location.subfolder ? (0, shared_1.joinPath)(base, location.subfolder) : base);
|
|
501
|
+
// For site+subfolder: emit a CreateOnly folder item so the
|
|
502
|
+
// shared pool exists before any rendering tries to read from
|
|
503
|
+
// it. Dedupe across recipes via `emittedFolders` keyed on the
|
|
504
|
+
// refKey, mirroring section-folder emission.
|
|
505
|
+
//
|
|
506
|
+
// Multi-segment subfolders (e.g. `"ui/badges"`) emit only the
|
|
507
|
+
// LEAF folder explicitly — the executor's path-walker
|
|
508
|
+
// auto-creates intermediate segments (`ui`) when it materialises
|
|
509
|
+
// the leaf, so we don't need (and shouldn't try) to track them
|
|
510
|
+
// via deterministic refKeys. Sitecore's `createItem` rejects
|
|
511
|
+
// names with `/`, so the op's `name` is always the leaf segment;
|
|
512
|
+
// `parent` points at the intermediate path so the walker fills
|
|
513
|
+
// in any missing segments before parenting.
|
|
514
|
+
if (location.subfolder) {
|
|
515
|
+
const folderRefKey = (0, guids_1.siteDataFolderId)(site, location.subfolder);
|
|
516
|
+
if (!emittedFolders.has(folderRefKey)) {
|
|
517
|
+
emittedFolders.add(folderRefKey);
|
|
518
|
+
const subfolderSegments = location.subfolder
|
|
519
|
+
.split("/")
|
|
520
|
+
.map((s) => s.trim())
|
|
521
|
+
.filter(Boolean);
|
|
522
|
+
if (subfolderSegments.length === 0) {
|
|
523
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' declares a site-scoped datasource subfolder that is empty after trimming.`, "INPUT_INVALID", {
|
|
524
|
+
hint: "Use a non-empty subfolder string like 'Badges' or 'ui/badges'.",
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
const leafName = subfolderSegments[subfolderSegments.length - 1];
|
|
528
|
+
const intermediateSegments = subfolderSegments.slice(0, -1);
|
|
529
|
+
const parentPath = intermediateSegments.length > 0
|
|
530
|
+
? (0, shared_1.joinPath)(base, intermediateSegments.join("/"))
|
|
531
|
+
: base;
|
|
532
|
+
const folderPath = (0, shared_1.joinPath)(base, subfolderSegments.join("/"));
|
|
533
|
+
// Shared-subfolder coalescer signal: when this subfolder is
|
|
534
|
+
// populated by ≥2 recipes in the set, the folder ITEM
|
|
535
|
+
// conforms to the SHARED template (whose Insert Options is
|
|
536
|
+
// the union of all contributing recipes' datasource
|
|
537
|
+
// templates). Singletons keep using the per-recipe template.
|
|
538
|
+
const isShared = context.sharedSubfolders?.has(location.subfolder) === true;
|
|
539
|
+
const folderTemplateOf = isShared
|
|
540
|
+
? (0, guids_1.sharedDataFolderTemplateId)(site, location.subfolder)
|
|
541
|
+
: (0, guids_1.siteDataFolderTemplateId)(site, recipe.handle);
|
|
542
|
+
operations.push({
|
|
543
|
+
op: "CreateItem",
|
|
544
|
+
policy: "CreateOnly",
|
|
545
|
+
label: `site-data-folder:${site}:${location.subfolder}`,
|
|
546
|
+
id: folderRefKey,
|
|
547
|
+
path: folderPath,
|
|
548
|
+
parent: { kind: "ref-path", value: parentPath },
|
|
549
|
+
// Conform to the per-component Data Folder template (emitted
|
|
550
|
+
// by `emitSiteDataFolderTemplate`) so the SV's Insert
|
|
551
|
+
// Options restrict right-click → Insert to this recipe's
|
|
552
|
+
// own datasource template. For multi-segment subfolders
|
|
553
|
+
// (e.g. `ui/badges`), only the LEAF folder gets this
|
|
554
|
+
// template; intermediate segments stay as auto-created
|
|
555
|
+
// plain folders via the executor's path-walker.
|
|
556
|
+
templateOf: folderTemplateOf,
|
|
557
|
+
name: leafName,
|
|
558
|
+
fields: [
|
|
559
|
+
(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: "office/16x16/folder.png" }),
|
|
560
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, {
|
|
561
|
+
kind: "string",
|
|
562
|
+
value: leafName,
|
|
563
|
+
}),
|
|
564
|
+
],
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
// Raw query/source segments are appended verbatim. Each entry is a
|
|
570
|
+
// complete Sitecore Source segment (e.g. `query:$site/...` or
|
|
571
|
+
// `fast:/sitecore/content//*[@@templatename='Foo']`).
|
|
572
|
+
for (const raw of ds.query) {
|
|
573
|
+
segments.push(raw);
|
|
574
|
+
}
|
|
575
|
+
fields.push((0, shared_1.sharedField)(sitecore_templates_1.RENDERING_FIELDS.DATASOURCE_LOCATION, {
|
|
576
|
+
kind: "string",
|
|
577
|
+
value: segments.join("|"),
|
|
578
|
+
}));
|
|
579
|
+
fields.push((0, shared_1.sharedField)(sitecore_templates_1.RENDERING_FIELDS.OPEN_PROPERTIES_AFTER_ADD, {
|
|
580
|
+
kind: "bool",
|
|
581
|
+
value: ds.openPropertiesAfterAdd,
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
// OtherProperties is always emitted — `dynamicPlaceholders` and the
|
|
585
|
+
// free-form `recipe.otherProperties` apply regardless of whether the
|
|
586
|
+
// rendering has a datasource block. Authors' explicit keys override
|
|
587
|
+
// the auto-set values.
|
|
588
|
+
const otherProperties = {};
|
|
589
|
+
if (ds?.autoCreate) {
|
|
590
|
+
otherProperties.IsAutoDatasourceRendering = "true";
|
|
591
|
+
}
|
|
592
|
+
if (recipe.dynamicPlaceholders) {
|
|
593
|
+
otherProperties.IsRenderingsWithDynamicPlaceholders = "true";
|
|
594
|
+
}
|
|
595
|
+
Object.assign(otherProperties, recipe.otherProperties ?? {});
|
|
596
|
+
fields.push((0, shared_1.sharedField)(sitecore_templates_1.RENDERING_FIELDS.OTHER_PROPERTIES, {
|
|
597
|
+
kind: "url-string-map",
|
|
598
|
+
entries: otherProperties,
|
|
599
|
+
}));
|
|
600
|
+
operations.push({
|
|
601
|
+
op: "CreateItem",
|
|
602
|
+
policy,
|
|
603
|
+
label: `rendering:${recipe.handle}`,
|
|
604
|
+
id: renderingRefKey,
|
|
605
|
+
path: renderingPath,
|
|
606
|
+
parent: { kind: "ref-path", value: renderingParentPath },
|
|
607
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.RENDERING,
|
|
608
|
+
name: recipe.name,
|
|
609
|
+
fields,
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Emit ops to materialise SXA Headless rendering variants for a
|
|
614
|
+
* component-template recipe.
|
|
615
|
+
*
|
|
616
|
+
* Pre-2026 layout (DEPRECATED): variants lived at
|
|
617
|
+
* `<rendering>/Variants/<Variant>` under generic `Folder` items. SXA
|
|
618
|
+
* Headless doesn't recognise that location — the editor treats those
|
|
619
|
+
* items as plain folders, not rendering variants, and the Pages
|
|
620
|
+
* editor's "Variant" picker doesn't see them.
|
|
621
|
+
*
|
|
622
|
+
* Current layout (verified against live tenant 2026-05-02):
|
|
623
|
+
*
|
|
624
|
+
* <headlessVariantsRoot>/
|
|
625
|
+
* └── <section>/ ← HeadlessVariantsGrouping
|
|
626
|
+
* └── <RenderingName>/ ← HeadlessVariants
|
|
627
|
+
* ├── default ← Variant Definition
|
|
628
|
+
* ├── outline ← Variant Definition
|
|
629
|
+
* └── …
|
|
630
|
+
*
|
|
631
|
+
* Recipes without `section` land directly at
|
|
632
|
+
* `<headlessVariantsRoot>/<RenderingName>/<Variant>`.
|
|
633
|
+
*
|
|
634
|
+
* `headlessVariantsRoot` is required when any recipe declares variants
|
|
635
|
+
* — without it the compiler throws INPUT_INVALID before emitting any
|
|
636
|
+
* variant op. The orchestrator's ephemeral-cli-config sets this from
|
|
637
|
+
* `/sitecore/content/<siteCollection>/<site>/Presentation/Headless Variants`.
|
|
638
|
+
*/
|
|
639
|
+
function emitVariants(operations, recipe, context, icon, policy, emittedFolders) {
|
|
640
|
+
if (!context.headlessVariantsRoot) {
|
|
641
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' declares ${recipe.variants.length} variants but no headlessVariantsRoot is configured.`, "INPUT_INVALID", {
|
|
642
|
+
hint: "Set `headlessVariantsRoot` on the active envProfile in sitecoreai.cli.json (e.g. `/sitecore/content/<siteCollection>/<site>/Presentation/Headless Variants`).",
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
const root = context.headlessVariantsRoot;
|
|
646
|
+
const site = (0, shared_1.siteOf)(context);
|
|
647
|
+
// Section grouping under the Headless Variants root. Idempotent —
|
|
648
|
+
// multiple recipes sharing the same section emit one folder. Distinct
|
|
649
|
+
// dedup key from the templates-side / renderings-side section folders
|
|
650
|
+
// (different tree, different identity).
|
|
651
|
+
let perRenderingParentPath;
|
|
652
|
+
let perRenderingParentRef;
|
|
653
|
+
const sectionName = resolveSectionName(recipe, context);
|
|
654
|
+
if (sectionName) {
|
|
655
|
+
const sectionRefKey = (0, guids_1.headlessVariantsSectionFolderId)(site, sectionName);
|
|
656
|
+
const sectionPath = (0, shared_1.joinPath)(root, sectionName);
|
|
657
|
+
if (!emittedFolders.has(sectionRefKey)) {
|
|
658
|
+
emittedFolders.add(sectionRefKey);
|
|
659
|
+
operations.push({
|
|
660
|
+
op: "CreateItem",
|
|
661
|
+
policy: "CreateOnly",
|
|
662
|
+
label: `headless-variants-section-folder:${site}:${sectionName}`,
|
|
663
|
+
id: sectionRefKey,
|
|
664
|
+
path: sectionPath,
|
|
665
|
+
parent: { kind: "ref-path", value: root },
|
|
666
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.HEADLESS_VARIANTS_GROUPING,
|
|
667
|
+
name: sectionName,
|
|
668
|
+
fields: [(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.FOLDER_ICON })],
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
perRenderingParentPath = sectionPath;
|
|
672
|
+
perRenderingParentRef = { kind: "ref-recipe", refKey: sectionRefKey };
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
perRenderingParentPath = root;
|
|
676
|
+
perRenderingParentRef = { kind: "ref-path", value: root };
|
|
677
|
+
}
|
|
678
|
+
// Per-rendering grouping — one folder per recipe under the section
|
|
679
|
+
// (or under the root, when section-less). Always unique per recipe;
|
|
680
|
+
// no cross-recipe dedup needed.
|
|
681
|
+
const folderRefKey = (0, guids_1.variantsFolderId)(site, recipe.handle);
|
|
682
|
+
const folderPath = (0, shared_1.joinPath)(perRenderingParentPath, recipe.name);
|
|
683
|
+
operations.push({
|
|
684
|
+
op: "CreateItem",
|
|
685
|
+
policy,
|
|
686
|
+
label: `variants-folder:${recipe.handle}`,
|
|
687
|
+
id: folderRefKey,
|
|
688
|
+
path: folderPath,
|
|
689
|
+
parent: perRenderingParentRef,
|
|
690
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.HEADLESS_VARIANTS,
|
|
691
|
+
name: recipe.name,
|
|
692
|
+
fields: [],
|
|
693
|
+
});
|
|
694
|
+
for (const variant of recipe.variants) {
|
|
695
|
+
operations.push({
|
|
696
|
+
op: "CreateItem",
|
|
697
|
+
policy,
|
|
698
|
+
label: `variant:${recipe.handle}/${variant.name}`,
|
|
699
|
+
id: (0, guids_1.variantId)(site, recipe.handle, variant.name),
|
|
700
|
+
path: (0, shared_1.joinPath)(folderPath, variant.name),
|
|
701
|
+
parent: { kind: "ref-recipe", refKey: folderRefKey },
|
|
702
|
+
templateOf: sitecore_templates_1.SITECORE_TEMPLATES.VARIANT_DEFINITION,
|
|
703
|
+
name: variant.name,
|
|
704
|
+
fields: [
|
|
705
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: variant.name }),
|
|
706
|
+
],
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
}
|