@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,31 @@
|
|
|
1
|
+
import { type OperationIr } from "../ir/operations";
|
|
2
|
+
import { type ContentItemRecipe } from "../schema/recipe";
|
|
3
|
+
import { type CompileContext } from "./shared";
|
|
4
|
+
/**
|
|
5
|
+
* Compile a `ContentItemRecipe` to an Operation IR.
|
|
6
|
+
*
|
|
7
|
+
* Emits one `CreateItem` for the content item plus one `SetField` per
|
|
8
|
+
* field value. The item's `templateOf` resolves via `templateId(templateType)`
|
|
9
|
+
* — the corresponding `ContentTemplateRecipe` (or `ComponentTemplateRecipe`)
|
|
10
|
+
* must ship in the same set so the executor's captured-itemId map carries
|
|
11
|
+
* its server-assigned GUID at apply time. The cross-recipe validator
|
|
12
|
+
* (`validateRecipeSet`) catches missing template references before push.
|
|
13
|
+
*
|
|
14
|
+
* Field values dispatch on `shape` to one of the encoders below. Most
|
|
15
|
+
* shapes encode at compile time to a `kind: "string"` value (Sitecore's
|
|
16
|
+
* stored representation is always a string); `reference` shapes emit
|
|
17
|
+
* `kind: "ref-recipe-list"` so the executor substitutes captured itemIds
|
|
18
|
+
* at apply time.
|
|
19
|
+
*
|
|
20
|
+
* Phase 4 v1 limitations:
|
|
21
|
+
* - `link-internal` is deferred — the wire format is XML wrapping a
|
|
22
|
+
* refKey-resolved GUID, which requires a new RefValue kind. Authors
|
|
23
|
+
* should use `reference` (with a single-element `refs` array) for
|
|
24
|
+
* Droplink/Reference fields, or `link-external` for external URLs.
|
|
25
|
+
* - `image.mediaPath` is treated as an opaque path — no media-item
|
|
26
|
+
* upload. Sitecore renders the field if a media library item exists
|
|
27
|
+
* at that path; otherwise the field is empty until media seeding
|
|
28
|
+
* lands in Phase 5+.
|
|
29
|
+
*/
|
|
30
|
+
export declare function compileContentItemRecipe(input: ContentItemRecipe, context: CompileContext): OperationIr;
|
|
31
|
+
//# sourceMappingURL=content-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-item.d.ts","sourceRoot":"","sources":["../../../src/recipe/compile/content-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE9F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,cAAc,GACtB,WAAW,CAgEb"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileContentItemRecipe = compileContentItemRecipe;
|
|
4
|
+
const errors_1 = require("../../shared/errors");
|
|
5
|
+
const guids_1 = require("../guids");
|
|
6
|
+
const operations_1 = require("../ir/operations");
|
|
7
|
+
const policy_1 = require("../policy");
|
|
8
|
+
const sitecore_templates_1 = require("../ir/sitecore-templates");
|
|
9
|
+
const recipe_1 = require("../schema/recipe");
|
|
10
|
+
const shared_1 = require("./shared");
|
|
11
|
+
/**
|
|
12
|
+
* Compile a `ContentItemRecipe` to an Operation IR.
|
|
13
|
+
*
|
|
14
|
+
* Emits one `CreateItem` for the content item plus one `SetField` per
|
|
15
|
+
* field value. The item's `templateOf` resolves via `templateId(templateType)`
|
|
16
|
+
* — the corresponding `ContentTemplateRecipe` (or `ComponentTemplateRecipe`)
|
|
17
|
+
* must ship in the same set so the executor's captured-itemId map carries
|
|
18
|
+
* its server-assigned GUID at apply time. The cross-recipe validator
|
|
19
|
+
* (`validateRecipeSet`) catches missing template references before push.
|
|
20
|
+
*
|
|
21
|
+
* Field values dispatch on `shape` to one of the encoders below. Most
|
|
22
|
+
* shapes encode at compile time to a `kind: "string"` value (Sitecore's
|
|
23
|
+
* stored representation is always a string); `reference` shapes emit
|
|
24
|
+
* `kind: "ref-recipe-list"` so the executor substitutes captured itemIds
|
|
25
|
+
* at apply time.
|
|
26
|
+
*
|
|
27
|
+
* Phase 4 v1 limitations:
|
|
28
|
+
* - `link-internal` is deferred — the wire format is XML wrapping a
|
|
29
|
+
* refKey-resolved GUID, which requires a new RefValue kind. Authors
|
|
30
|
+
* should use `reference` (with a single-element `refs` array) for
|
|
31
|
+
* Droplink/Reference fields, or `link-external` for external URLs.
|
|
32
|
+
* - `image.mediaPath` is treated as an opaque path — no media-item
|
|
33
|
+
* upload. Sitecore renders the field if a media library item exists
|
|
34
|
+
* at that path; otherwise the field is empty until media seeding
|
|
35
|
+
* lands in Phase 5+.
|
|
36
|
+
*/
|
|
37
|
+
function compileContentItemRecipe(input, context) {
|
|
38
|
+
const recipe = recipe_1.ContentItemRecipeSchema.parse(input);
|
|
39
|
+
if (!context.contentItemsRoot) {
|
|
40
|
+
throw (0, errors_1.createCliError)(`compileContentItemRecipe requires context.contentItemsRoot; tenant-side path missing for recipe ${recipe.handle}`, "INPUT_INVALID");
|
|
41
|
+
}
|
|
42
|
+
const operations = [];
|
|
43
|
+
const policy = (0, policy_1.defaultPolicyForRecipe)(recipe.kind);
|
|
44
|
+
const site = (0, shared_1.siteOf)(context);
|
|
45
|
+
const itemRefKey = (0, guids_1.contentItemId)(site, recipe.handle);
|
|
46
|
+
const itemPath = (0, shared_1.joinPath)(context.contentItemsRoot, recipe.name);
|
|
47
|
+
const templateRefKey = (0, guids_1.templateId)(site, recipe.templateType);
|
|
48
|
+
operations.push({
|
|
49
|
+
op: "CreateItem",
|
|
50
|
+
policy,
|
|
51
|
+
label: `content-item:${recipe.handle}`,
|
|
52
|
+
id: itemRefKey,
|
|
53
|
+
path: itemPath,
|
|
54
|
+
parent: { kind: "ref-path", value: context.contentItemsRoot },
|
|
55
|
+
// String GUID — the executor treats this as a refKey when it matches a
|
|
56
|
+
// captured-itemId entry (the ContentTemplateRecipe / ComponentTemplateRecipe
|
|
57
|
+
// for `recipe.templateType` registers `templateId(handle)` at apply
|
|
58
|
+
// time), else as a literal Sitecore template GUID.
|
|
59
|
+
templateOf: templateRefKey,
|
|
60
|
+
name: recipe.name,
|
|
61
|
+
fields: [
|
|
62
|
+
(0, shared_1.sharedField)(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.DEFAULT_ICON }),
|
|
63
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: recipe.displayName }),
|
|
64
|
+
],
|
|
65
|
+
});
|
|
66
|
+
for (const [fieldName, fieldValue] of Object.entries(recipe.fields)) {
|
|
67
|
+
const value = encodeContentFieldValue(fieldValue, recipe.handle, site);
|
|
68
|
+
if (value === null)
|
|
69
|
+
continue;
|
|
70
|
+
const fieldGuid = (0, guids_1.fieldId)(site, recipe.templateType, fieldName);
|
|
71
|
+
operations.push({
|
|
72
|
+
op: "SetField",
|
|
73
|
+
policy,
|
|
74
|
+
label: `content-item-field:${recipe.handle}:${fieldName}`,
|
|
75
|
+
itemRefKey,
|
|
76
|
+
fieldId: fieldGuid,
|
|
77
|
+
// Recipe-created field — Sitecore assigns its own GUID to the
|
|
78
|
+
// Template Field item, so fieldGuid is only an IR-internal refKey.
|
|
79
|
+
// The mutation needs the human-readable name; planner uses it for
|
|
80
|
+
// diff matching against the remote item's field-by-name.
|
|
81
|
+
fieldName,
|
|
82
|
+
// Versioned: content-item field values are language/version-scoped.
|
|
83
|
+
// Default language/version are filled in by versionedField helper —
|
|
84
|
+
// duplicating its shape here so the SetField op carries them.
|
|
85
|
+
language: sitecore_templates_1.DEFAULT_LANGUAGE,
|
|
86
|
+
version: sitecore_templates_1.DEFAULT_VERSION,
|
|
87
|
+
value,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return operations_1.OperationIrSchema.parse({
|
|
91
|
+
schemaVersion: "1",
|
|
92
|
+
recipeHandle: recipe.handle,
|
|
93
|
+
operations,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Format a recipe `date` (ISO `YYYY-MM-DD`) or `datetime` (ISO 8601 with
|
|
98
|
+
* timezone) into Sitecore's stored format `yyyyMMddTHHmmssZ`.
|
|
99
|
+
*/
|
|
100
|
+
const toSitecoreDate = (iso, kind) => {
|
|
101
|
+
const parsed = new Date(iso);
|
|
102
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
103
|
+
throw (0, errors_1.createCliError)(`ContentFieldValue ${kind}: '${iso}' is not a valid ISO date`, "INPUT_INVALID");
|
|
104
|
+
}
|
|
105
|
+
if (kind === "date") {
|
|
106
|
+
// Date-only — pin to UTC midnight to keep the output deterministic
|
|
107
|
+
// regardless of host timezone.
|
|
108
|
+
const isoDateOnly = iso.includes("T") ? iso.slice(0, 10) : iso;
|
|
109
|
+
return `${isoDateOnly.replace(/-/g, "")}T000000Z`;
|
|
110
|
+
}
|
|
111
|
+
// Datetime: yyyyMMddTHHmmssZ in UTC.
|
|
112
|
+
const yyyy = parsed.getUTCFullYear().toString().padStart(4, "0");
|
|
113
|
+
const MM = (parsed.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
114
|
+
const dd = parsed.getUTCDate().toString().padStart(2, "0");
|
|
115
|
+
const HH = parsed.getUTCHours().toString().padStart(2, "0");
|
|
116
|
+
const mm = parsed.getUTCMinutes().toString().padStart(2, "0");
|
|
117
|
+
const ss = parsed.getUTCSeconds().toString().padStart(2, "0");
|
|
118
|
+
return `${yyyy}${MM}${dd}T${HH}${mm}${ss}Z`;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Sitecore image-field XML. Phase 4 v1 emits `mediapath` only — see
|
|
122
|
+
* `compileContentItemRecipe` JSDoc for the media-item upload caveat.
|
|
123
|
+
*/
|
|
124
|
+
const encodeImageXml = (img) => {
|
|
125
|
+
const attrs = [`mediapath="${escapeXmlAttr(img.mediaPath)}"`];
|
|
126
|
+
if (img.alt !== undefined)
|
|
127
|
+
attrs.push(`alt="${escapeXmlAttr(img.alt)}"`);
|
|
128
|
+
if (img.width !== undefined)
|
|
129
|
+
attrs.push(`width="${img.width}"`);
|
|
130
|
+
if (img.height !== undefined)
|
|
131
|
+
attrs.push(`height="${img.height}"`);
|
|
132
|
+
return `<image ${attrs.join(" ")} />`;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Sitecore General Link XML for an external URL (`linktype="external"`).
|
|
136
|
+
*/
|
|
137
|
+
const encodeExternalLinkXml = (link) => {
|
|
138
|
+
const attrs = [`linktype="external"`, `url="${escapeXmlAttr(link.href)}"`];
|
|
139
|
+
if (link.text !== undefined)
|
|
140
|
+
attrs.push(`text="${escapeXmlAttr(link.text)}"`);
|
|
141
|
+
if (link.target !== undefined)
|
|
142
|
+
attrs.push(`target="${escapeXmlAttr(link.target)}"`);
|
|
143
|
+
if (link.title !== undefined)
|
|
144
|
+
attrs.push(`title="${escapeXmlAttr(link.title)}"`);
|
|
145
|
+
return `<link ${attrs.join(" ")} />`;
|
|
146
|
+
};
|
|
147
|
+
const escapeXmlAttr = (s) => s
|
|
148
|
+
.replace(/&/g, "&")
|
|
149
|
+
.replace(/</g, "<")
|
|
150
|
+
.replace(/>/g, ">")
|
|
151
|
+
.replace(/"/g, """)
|
|
152
|
+
.replace(/'/g, "'");
|
|
153
|
+
/**
|
|
154
|
+
* Encode one ContentFieldValue to a RefValue. Returns null when the
|
|
155
|
+
* shape is deferred (e.g. `link-internal` in Phase 4 v1) — the caller
|
|
156
|
+
* skips emitting a SetField op for it. Throws on truly invalid input.
|
|
157
|
+
*/
|
|
158
|
+
const encodeContentFieldValue = (value, recipeHandle, site) => {
|
|
159
|
+
switch (value.shape) {
|
|
160
|
+
case "text":
|
|
161
|
+
case "richText":
|
|
162
|
+
case "enum":
|
|
163
|
+
return { kind: "string", value: value.value };
|
|
164
|
+
case "boolean":
|
|
165
|
+
return { kind: "bool", value: value.value };
|
|
166
|
+
case "number":
|
|
167
|
+
case "integer":
|
|
168
|
+
return { kind: "number", value: value.value };
|
|
169
|
+
case "date":
|
|
170
|
+
case "datetime":
|
|
171
|
+
return { kind: "string", value: toSitecoreDate(value.value, value.shape) };
|
|
172
|
+
case "image":
|
|
173
|
+
return { kind: "string", value: encodeImageXml(value) };
|
|
174
|
+
case "link-external":
|
|
175
|
+
return { kind: "string", value: encodeExternalLinkXml(value) };
|
|
176
|
+
case "link-internal":
|
|
177
|
+
// Deferred: General Link XML wrapping a refKey-resolved GUID needs
|
|
178
|
+
// a new RefValue kind. Recipe authors targeting Phase 4 should use
|
|
179
|
+
// `reference` (single-element refs[]) for Droplink-shaped fields.
|
|
180
|
+
throw (0, errors_1.createCliError)(`ContentItemRecipe '${recipeHandle}': link-internal is deferred to Phase 5. ` +
|
|
181
|
+
`Use 'reference' shape with a single-element refs[] for Droplink/Reference fields, ` +
|
|
182
|
+
`or 'link-external' with an absolute URL for now.`, "INPUT_INVALID");
|
|
183
|
+
case "reference":
|
|
184
|
+
return {
|
|
185
|
+
kind: "ref-recipe-list",
|
|
186
|
+
refKeys: value.refs.map((handle) => (0, guids_1.contentItemId)(site, handle)),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type OperationIr } from "../ir/operations";
|
|
2
|
+
import { type ContentTemplateRecipe } from "../schema/recipe";
|
|
3
|
+
import { type CompileContext } from "./shared";
|
|
4
|
+
/**
|
|
5
|
+
* Compile a `ContentTemplateRecipe` to an Operation IR.
|
|
6
|
+
*
|
|
7
|
+
* Content templates are data-only: a Sitecore template + sections + fields
|
|
8
|
+
* + standard values + back-fill. No rendering, no params, no variants.
|
|
9
|
+
*
|
|
10
|
+
* Path resolution:
|
|
11
|
+
* - With `contentModelsRoot` and `meta.tax.group` set →
|
|
12
|
+
* `<contentModelsRoot>/<group>/<name>` (group folder created
|
|
13
|
+
* idempotently as a CreateOnly op).
|
|
14
|
+
* - With `contentModelsRoot` and no group → `<contentModelsRoot>/<name>`.
|
|
15
|
+
* - Without `contentModelsRoot` → legacy `<templatesRoot>/<name>`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function compileContentTemplateRecipe(input: ContentTemplateRecipe, context: CompileContext, emittedFolders?: Set<string>): OperationIr;
|
|
18
|
+
//# sourceMappingURL=content-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-template.d.ts","sourceRoot":"","sources":["../../../src/recipe/compile/content-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,WAAW,EAAqB,MAAM,kBAAkB,CAAC;AAGvF,OAAO,EAAE,KAAK,qBAAqB,EAA+B,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,qBAAqB,EAC5B,OAAO,EAAE,cAAc,EACvB,cAAc,GAAE,GAAG,CAAC,MAAM,CAAa,GACtC,WAAW,CA2Cb"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileContentTemplateRecipe = compileContentTemplateRecipe;
|
|
4
|
+
const operations_1 = require("../ir/operations");
|
|
5
|
+
const policy_1 = require("../policy");
|
|
6
|
+
const sitecore_templates_1 = require("../ir/sitecore-templates");
|
|
7
|
+
const recipe_1 = require("../schema/recipe");
|
|
8
|
+
const shared_1 = require("./shared");
|
|
9
|
+
/**
|
|
10
|
+
* Compile a `ContentTemplateRecipe` to an Operation IR.
|
|
11
|
+
*
|
|
12
|
+
* Content templates are data-only: a Sitecore template + sections + fields
|
|
13
|
+
* + standard values + back-fill. No rendering, no params, no variants.
|
|
14
|
+
*
|
|
15
|
+
* Path resolution:
|
|
16
|
+
* - With `contentModelsRoot` and `meta.tax.group` set →
|
|
17
|
+
* `<contentModelsRoot>/<group>/<name>` (group folder created
|
|
18
|
+
* idempotently as a CreateOnly op).
|
|
19
|
+
* - With `contentModelsRoot` and no group → `<contentModelsRoot>/<name>`.
|
|
20
|
+
* - Without `contentModelsRoot` → legacy `<templatesRoot>/<name>`.
|
|
21
|
+
*/
|
|
22
|
+
function compileContentTemplateRecipe(input, context, emittedFolders = new Set()) {
|
|
23
|
+
const recipe = recipe_1.ContentTemplateRecipeSchema.parse(input);
|
|
24
|
+
const operations = [];
|
|
25
|
+
const group = recipe.meta?.tax?.group;
|
|
26
|
+
let parentPath;
|
|
27
|
+
let parentRefKey;
|
|
28
|
+
if (context.contentModelsRoot) {
|
|
29
|
+
if (group) {
|
|
30
|
+
const groupRefKey = (0, shared_1.ensureContentModelsGroupFolder)(operations, context, group, emittedFolders);
|
|
31
|
+
parentPath = (0, shared_1.joinPath)(context.contentModelsRoot, group);
|
|
32
|
+
parentRefKey = groupRefKey;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
parentPath = context.contentModelsRoot;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
(0, shared_1.emitDatasourceTemplate)(operations, {
|
|
39
|
+
handle: recipe.handle,
|
|
40
|
+
name: recipe.name,
|
|
41
|
+
displayName: recipe.displayName,
|
|
42
|
+
fields: recipe.fields,
|
|
43
|
+
insertOptions: recipe.insertOptions,
|
|
44
|
+
...(parentPath !== undefined && { parentPath }),
|
|
45
|
+
...(parentRefKey !== undefined && { parentRefKey }),
|
|
46
|
+
}, context, sitecore_templates_1.DEFAULT_ICON, (0, policy_1.defaultPolicyForRecipe)(recipe.kind));
|
|
47
|
+
return operations_1.OperationIrSchema.parse({
|
|
48
|
+
schemaVersion: "1",
|
|
49
|
+
recipeHandle: recipe.handle,
|
|
50
|
+
operations,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type OperationIr } from "../ir/operations";
|
|
2
|
+
import { type EnumerationRecipe } from "../schema/recipe";
|
|
3
|
+
import { type CompileContext } from "./shared";
|
|
4
|
+
/**
|
|
5
|
+
* Compile an `EnumerationRecipe` to an Operation IR.
|
|
6
|
+
*
|
|
7
|
+
* Emits the per-site `Enumerations Folder` + `Enumeration` +
|
|
8
|
+
* `Enumeration Value` template trio (idempotent across the recipe set
|
|
9
|
+
* via the shared `emittedFolders` sentinel), an optional grouping
|
|
10
|
+
* folder under `<enumerationsRoot>` driven by `recipe.location.folder`
|
|
11
|
+
* (also idempotent), one CreateItem op for the per-enum container item,
|
|
12
|
+
* and one CreateItem op per declared value parented under that
|
|
13
|
+
* container.
|
|
14
|
+
*
|
|
15
|
+
* Path resolution:
|
|
16
|
+
* - With `recipe.location.folder` set →
|
|
17
|
+
* `<enumerationsRoot>/<folder>/<EnumName>/<ValueName>`. The leaf
|
|
18
|
+
* folder lands as a `CreateOnly` item conforming to the per-site
|
|
19
|
+
* `Enumerations Folder` template; multiple recipes naming the same
|
|
20
|
+
* folder path share it via the `emittedFolders` sentinel.
|
|
21
|
+
* - Without `recipe.location` (or `recipe.location.folder`) →
|
|
22
|
+
* `<enumerationsRoot>/<EnumName>/<ValueName>` (flat layout).
|
|
23
|
+
*
|
|
24
|
+
* Template assignment (each item conforms to a different template —
|
|
25
|
+
* roles are NOT collapsed):
|
|
26
|
+
* - Grouping folders → `Enumerations Folder` template
|
|
27
|
+
* - Per-enum container → `Enumeration` template
|
|
28
|
+
* - Leaf value items → `Enumeration Value` template
|
|
29
|
+
*
|
|
30
|
+
* All three templates inherit Standard Template and stamp the
|
|
31
|
+
* `keyboard_key_e.png` icon via template-level inheritance, so the SXA
|
|
32
|
+
* editor shows enum items with the enum icon without per-item overrides.
|
|
33
|
+
*
|
|
34
|
+
* Each value item also writes its `value.name` to the `Value` shared
|
|
35
|
+
* field defined on the `Enumeration Value` template's inner
|
|
36
|
+
* `Enumeration` section. Without this the value items would have no
|
|
37
|
+
* payload — the Droplink picker would still enumerate them, but
|
|
38
|
+
* consumers reading the picked item's `Value` field (the canonical SXA
|
|
39
|
+
* pattern) would find it empty.
|
|
40
|
+
*
|
|
41
|
+
* Refkeys:
|
|
42
|
+
* - Grouping folder: `enumerationsGroupingFolderId(site, folder)` —
|
|
43
|
+
* site + cumulative path keyed so two recipes naming the same
|
|
44
|
+
* folder reuse one item rather than colliding.
|
|
45
|
+
* - Per-enum container: `enumerationFolderId(site, recipe.handle)` —
|
|
46
|
+
* site-scoped so cross-site pushes don't collide. (Function name is
|
|
47
|
+
* legacy; the item it identifies is the per-enum container, not a
|
|
48
|
+
* folder.)
|
|
49
|
+
* - Values: `enumValueId(folderRefKey, value.name)` — value-name keyed
|
|
50
|
+
* under the container. Renaming a value (`primary` → `accent`) emits
|
|
51
|
+
* a different GUID; consuming fields whose default referenced the
|
|
52
|
+
* old name end up orphaned. Author error.
|
|
53
|
+
*
|
|
54
|
+
* Throws `INPUT_INVALID` when `context.enumerationsRoot` is unset, or
|
|
55
|
+
* when `recipe.location.scope` is `"siteCollection"` (reserved for
|
|
56
|
+
* shared-vocabulary use; not yet implemented).
|
|
57
|
+
*/
|
|
58
|
+
export declare function compileEnumerationRecipe(input: EnumerationRecipe, context: CompileContext, emittedFolders?: Set<string>): OperationIr;
|
|
59
|
+
//# sourceMappingURL=enumeration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumeration.d.ts","sourceRoot":"","sources":["../../../src/recipe/compile/enumeration.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,cAAc,EACvB,cAAc,GAAE,GAAG,CAAC,MAAM,CAAa,GACtC,WAAW,CA0Mb"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileEnumerationRecipe = compileEnumerationRecipe;
|
|
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 shared_1 = require("./shared");
|
|
11
|
+
/**
|
|
12
|
+
* Compile an `EnumerationRecipe` to an Operation IR.
|
|
13
|
+
*
|
|
14
|
+
* Emits the per-site `Enumerations Folder` + `Enumeration` +
|
|
15
|
+
* `Enumeration Value` template trio (idempotent across the recipe set
|
|
16
|
+
* via the shared `emittedFolders` sentinel), an optional grouping
|
|
17
|
+
* folder under `<enumerationsRoot>` driven by `recipe.location.folder`
|
|
18
|
+
* (also idempotent), one CreateItem op for the per-enum container item,
|
|
19
|
+
* and one CreateItem op per declared value parented under that
|
|
20
|
+
* container.
|
|
21
|
+
*
|
|
22
|
+
* Path resolution:
|
|
23
|
+
* - With `recipe.location.folder` set →
|
|
24
|
+
* `<enumerationsRoot>/<folder>/<EnumName>/<ValueName>`. The leaf
|
|
25
|
+
* folder lands as a `CreateOnly` item conforming to the per-site
|
|
26
|
+
* `Enumerations Folder` template; multiple recipes naming the same
|
|
27
|
+
* folder path share it via the `emittedFolders` sentinel.
|
|
28
|
+
* - Without `recipe.location` (or `recipe.location.folder`) →
|
|
29
|
+
* `<enumerationsRoot>/<EnumName>/<ValueName>` (flat layout).
|
|
30
|
+
*
|
|
31
|
+
* Template assignment (each item conforms to a different template —
|
|
32
|
+
* roles are NOT collapsed):
|
|
33
|
+
* - Grouping folders → `Enumerations Folder` template
|
|
34
|
+
* - Per-enum container → `Enumeration` template
|
|
35
|
+
* - Leaf value items → `Enumeration Value` template
|
|
36
|
+
*
|
|
37
|
+
* All three templates inherit Standard Template and stamp the
|
|
38
|
+
* `keyboard_key_e.png` icon via template-level inheritance, so the SXA
|
|
39
|
+
* editor shows enum items with the enum icon without per-item overrides.
|
|
40
|
+
*
|
|
41
|
+
* Each value item also writes its `value.name` to the `Value` shared
|
|
42
|
+
* field defined on the `Enumeration Value` template's inner
|
|
43
|
+
* `Enumeration` section. Without this the value items would have no
|
|
44
|
+
* payload — the Droplink picker would still enumerate them, but
|
|
45
|
+
* consumers reading the picked item's `Value` field (the canonical SXA
|
|
46
|
+
* pattern) would find it empty.
|
|
47
|
+
*
|
|
48
|
+
* Refkeys:
|
|
49
|
+
* - Grouping folder: `enumerationsGroupingFolderId(site, folder)` —
|
|
50
|
+
* site + cumulative path keyed so two recipes naming the same
|
|
51
|
+
* folder reuse one item rather than colliding.
|
|
52
|
+
* - Per-enum container: `enumerationFolderId(site, recipe.handle)` —
|
|
53
|
+
* site-scoped so cross-site pushes don't collide. (Function name is
|
|
54
|
+
* legacy; the item it identifies is the per-enum container, not a
|
|
55
|
+
* folder.)
|
|
56
|
+
* - Values: `enumValueId(folderRefKey, value.name)` — value-name keyed
|
|
57
|
+
* under the container. Renaming a value (`primary` → `accent`) emits
|
|
58
|
+
* a different GUID; consuming fields whose default referenced the
|
|
59
|
+
* old name end up orphaned. Author error.
|
|
60
|
+
*
|
|
61
|
+
* Throws `INPUT_INVALID` when `context.enumerationsRoot` is unset, or
|
|
62
|
+
* when `recipe.location.scope` is `"siteCollection"` (reserved for
|
|
63
|
+
* shared-vocabulary use; not yet implemented).
|
|
64
|
+
*/
|
|
65
|
+
function compileEnumerationRecipe(input, context, emittedFolders = new Set()) {
|
|
66
|
+
const recipe = recipe_1.EnumerationRecipeSchema.parse(input);
|
|
67
|
+
if (!context.enumerationsRoot) {
|
|
68
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' is an enumeration but no enumerationsRoot is configured.`, "INPUT_INVALID", {
|
|
69
|
+
hint: "Set `enumerationsRoot` on the active envProfile in sitecoreai.cli.json (e.g. `/sitecore/content/<siteCollection>/<site>/Settings/Enumerations`).",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const operations = [];
|
|
73
|
+
const policy = (0, policy_1.defaultPolicyForRecipe)(recipe.kind);
|
|
74
|
+
const site = (0, shared_1.siteOf)(context);
|
|
75
|
+
const { folderTemplateRefKey, enumerationTemplateRefKey, containerValueFieldRefKey, valueTemplateRefKey, valueFieldRefKey, } = (0, shared_1.ensureEnumerationTemplates)(operations, context, site, emittedFolders);
|
|
76
|
+
// Validate `default` matches one of the declared value names. Lives
|
|
77
|
+
// here (not on the schema) because `discriminatedUnion` rejects
|
|
78
|
+
// `ZodEffects` members, so cross-field validation can't be expressed
|
|
79
|
+
// on `EnumerationRecipeSchema` directly.
|
|
80
|
+
if (recipe.default !== undefined) {
|
|
81
|
+
const valueNames = new Set(recipe.values.map((v) => v.name));
|
|
82
|
+
if (!valueNames.has(recipe.default)) {
|
|
83
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' declares default='${recipe.default}' but no matching value.name.`, "INPUT_INVALID", {
|
|
84
|
+
hint: `default must match one of values[].name (got: ${[...valueNames].join(", ") || "<none>"}).`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// siteCollection scope is reserved for shared-vocabulary use
|
|
89
|
+
// (multiple sites in a collection sourcing one canonical enum) but
|
|
90
|
+
// requires a `siteCollectionEnumerationsRoot` on `CompileContext`
|
|
91
|
+
// that doesn't exist yet. Reject explicitly so authors don't get a
|
|
92
|
+
// surprise misplacement.
|
|
93
|
+
if (recipe.location?.scope === "siteCollection") {
|
|
94
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' declares location.scope='siteCollection' but the siteCollection enumerations root isn't wired up yet.`, "INPUT_INVALID", {
|
|
95
|
+
hint: 'Use `location.scope: "site"` for now (or omit `location`). Site-collection scope will land when the orchestrator threads a siteCollectionEnumerationsRoot through CompileContext.',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// Optional grouping folder(s) driven by `location.folder`. CreateOnly +
|
|
99
|
+
// dedup via emittedFolders so multiple recipes naming the same folder
|
|
100
|
+
// share one item. Multi-segment paths (e.g. "Components/Card") split
|
|
101
|
+
// on `/` — EVERY segment gets an explicit CreateItem conforming to
|
|
102
|
+
// the per-site Enumerations Folder template (intermediates included).
|
|
103
|
+
// Without an explicit emit per segment, Sitecore's executor path-walker
|
|
104
|
+
// auto-creates intermediates as the generic `Folder` template, which
|
|
105
|
+
// breaks the Insert Options chain (a generic Folder doesn't carry
|
|
106
|
+
// the Enumerations Folder Standard Values, so authors right-clicking
|
|
107
|
+
// `Components/` see no Insert Options for `Enumeration` /
|
|
108
|
+
// `Enumerations Folder`).
|
|
109
|
+
//
|
|
110
|
+
// Each segment is keyed on its CUMULATIVE path (`enumerationsGroupingFolderId(site,
|
|
111
|
+
// cumulativePath)`) so two recipes sharing a prefix (`Components/Card`
|
|
112
|
+
// + `Components/Tabs`) reuse the same `Components` item rather than
|
|
113
|
+
// colliding. Parent chain: first segment ref-paths the enumerations
|
|
114
|
+
// root; subsequent segments ref-recipe the prior segment so the
|
|
115
|
+
// executor resolves the captured itemId.
|
|
116
|
+
let parentPath = context.enumerationsRoot;
|
|
117
|
+
let parentRef = {
|
|
118
|
+
kind: "ref-path",
|
|
119
|
+
value: context.enumerationsRoot,
|
|
120
|
+
};
|
|
121
|
+
const folder = recipe.location?.folder;
|
|
122
|
+
if (folder) {
|
|
123
|
+
const folderSegments = folder
|
|
124
|
+
.split("/")
|
|
125
|
+
.map((s) => s.trim())
|
|
126
|
+
.filter(Boolean);
|
|
127
|
+
if (folderSegments.length === 0) {
|
|
128
|
+
throw (0, errors_1.createCliError)(`Recipe '${recipe.handle}' declares location.folder that is empty after trimming.`, "INPUT_INVALID", {
|
|
129
|
+
hint: "Use a non-empty folder string like 'Theme' or 'Components/Card'.",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const cumulativeSegments = [];
|
|
133
|
+
for (const segment of folderSegments) {
|
|
134
|
+
cumulativeSegments.push(segment);
|
|
135
|
+
const cumulativePath = cumulativeSegments.join("/");
|
|
136
|
+
const segmentRefKey = (0, guids_1.enumerationsGroupingFolderId)(site, cumulativePath);
|
|
137
|
+
const segmentPath = (0, shared_1.joinPath)(context.enumerationsRoot, cumulativePath);
|
|
138
|
+
if (!emittedFolders.has(segmentRefKey)) {
|
|
139
|
+
emittedFolders.add(segmentRefKey);
|
|
140
|
+
operations.push({
|
|
141
|
+
op: "CreateItem",
|
|
142
|
+
policy: "CreateOnly",
|
|
143
|
+
label: `enumerations-grouping-folder:${site}:${cumulativePath}`,
|
|
144
|
+
id: segmentRefKey,
|
|
145
|
+
path: segmentPath,
|
|
146
|
+
parent: parentRef,
|
|
147
|
+
templateOf: folderTemplateRefKey,
|
|
148
|
+
name: segment,
|
|
149
|
+
fields: [],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
parentPath = segmentPath;
|
|
153
|
+
parentRef = { kind: "ref-recipe", refKey: segmentRefKey };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Per-enum container item (e.g. `Color Scheme`, `Heading Size`).
|
|
157
|
+
// Conforms to the `Enumeration` template — NOT `Enumerations Folder`,
|
|
158
|
+
// which is reserved for grouping folders. The container's own
|
|
159
|
+
// `__Standard Values` (set on the Enumeration template) advertises
|
|
160
|
+
// `Enumeration Value` as the only Insert Option, so authors can
|
|
161
|
+
// right-click → Insert → Enumeration Value to add a value.
|
|
162
|
+
//
|
|
163
|
+
// RefKey name `folderRefKey` is legacy from before the template
|
|
164
|
+
// separation — the item it identifies is the per-enum container, not
|
|
165
|
+
// a folder.
|
|
166
|
+
const folderRefKey = (0, guids_1.enumerationFolderId)(site, recipe.handle);
|
|
167
|
+
const folderPath = (0, shared_1.joinPath)(parentPath, recipe.name);
|
|
168
|
+
const folderDisplayName = recipe.displayName ?? recipe.name;
|
|
169
|
+
// When `recipe.default` is set, write it to the container's `Value`
|
|
170
|
+
// shared field. The field write carries `fieldName: "Value"` so the
|
|
171
|
+
// executor's tenant-side resolver matches by name (recipe-derived
|
|
172
|
+
// field GUIDs don't line up with server-assigned ones once the
|
|
173
|
+
// template is materialised) — same pattern as the leaf value items.
|
|
174
|
+
const containerFields = [
|
|
175
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: folderDisplayName }),
|
|
176
|
+
];
|
|
177
|
+
if (recipe.default !== undefined) {
|
|
178
|
+
containerFields.push({
|
|
179
|
+
...(0, shared_1.sharedField)(containerValueFieldRefKey, { kind: "string", value: recipe.default }),
|
|
180
|
+
fieldName: "Value",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
operations.push({
|
|
184
|
+
op: "CreateItem",
|
|
185
|
+
policy,
|
|
186
|
+
label: `enumeration:${recipe.handle}`,
|
|
187
|
+
id: folderRefKey,
|
|
188
|
+
path: folderPath,
|
|
189
|
+
parent: parentRef,
|
|
190
|
+
templateOf: enumerationTemplateRefKey,
|
|
191
|
+
name: recipe.name,
|
|
192
|
+
fields: containerFields,
|
|
193
|
+
});
|
|
194
|
+
for (const value of recipe.values) {
|
|
195
|
+
const valueDisplayName = value.displayName ?? value.name;
|
|
196
|
+
operations.push({
|
|
197
|
+
op: "CreateItem",
|
|
198
|
+
policy,
|
|
199
|
+
label: `enumeration-value:${recipe.handle}/${value.name}`,
|
|
200
|
+
id: (0, guids_1.enumValueId)(folderRefKey, value.name),
|
|
201
|
+
path: (0, shared_1.joinPath)(folderPath, value.name),
|
|
202
|
+
parent: { kind: "ref-recipe", refKey: folderRefKey },
|
|
203
|
+
templateOf: valueTemplateRefKey,
|
|
204
|
+
name: value.name,
|
|
205
|
+
// The `Value` shared field carries the actual enumeration string
|
|
206
|
+
// (matches canonical pattern: each value item under
|
|
207
|
+
// `Background Themes/shooting-star` stores `Value: "shooting-star"`).
|
|
208
|
+
// `fieldName` is required so the executor's tenant-side resolver
|
|
209
|
+
// can locate the field by name — the recipe-derived `valueFieldRefKey`
|
|
210
|
+
// doesn't match the Sitecore-assigned field GUID after the template
|
|
211
|
+
// is materialised.
|
|
212
|
+
fields: [
|
|
213
|
+
{
|
|
214
|
+
...(0, shared_1.sharedField)(valueFieldRefKey, { kind: "string", value: value.name }),
|
|
215
|
+
fieldName: "Value",
|
|
216
|
+
},
|
|
217
|
+
(0, shared_1.versionedField)(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, {
|
|
218
|
+
kind: "string",
|
|
219
|
+
value: valueDisplayName,
|
|
220
|
+
}),
|
|
221
|
+
],
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
// Per-data-folder __Standard Values is intentionally NOT emitted —
|
|
225
|
+
// Insert Options now live on the Enumerations Folder template's own
|
|
226
|
+
// Standard Values (set up in `ensureEnumerationTemplates`) and
|
|
227
|
+
// propagate to every item conforming to the template. Emitting an SV
|
|
228
|
+
// ITEM under each data folder would re-introduce the old bug where
|
|
229
|
+
// the Droplink picker enumerates the SV as a sibling of the enum
|
|
230
|
+
// value items (the Source path's children include any direct child).
|
|
231
|
+
return operations_1.OperationIrSchema.parse({
|
|
232
|
+
schemaVersion: "1",
|
|
233
|
+
recipeHandle: recipe.handle,
|
|
234
|
+
operations,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type OperationIr } from "../ir/operations";
|
|
2
|
+
import { type PageDesignRecipe } from "../schema/recipe";
|
|
3
|
+
import { type CompileContext } from "./shared";
|
|
4
|
+
/**
|
|
5
|
+
* Compile a `PageDesignRecipe` to an Operation IR.
|
|
6
|
+
*
|
|
7
|
+
* Emits up to three ops:
|
|
8
|
+
* 1. `CreateItem` for the page-design item (SXA Page Design template)
|
|
9
|
+
* 2. `SetField(PartialDesigns)` — pipe-separated GUID list of partials
|
|
10
|
+
* 3. `SetField(__Renderings)` — only when recipe.layout is non-empty
|
|
11
|
+
*
|
|
12
|
+
* The recipe's `appliesTo` contributions to the Page Designs root's
|
|
13
|
+
* `TemplatesMapping` field are NOT emitted here — that field is
|
|
14
|
+
* cross-recipe (every page design contributes a slice) and a per-recipe
|
|
15
|
+
* `kind: "string"` write would full-replace under the executor's write
|
|
16
|
+
* semantics, with each page design overwriting its siblings. Use
|
|
17
|
+
* `compileRecipeSet` (below) to compile a coherent set of recipes —
|
|
18
|
+
* it aggregates `appliesTo` contributions across every page-design
|
|
19
|
+
* recipe in the set into one combined IR.
|
|
20
|
+
*/
|
|
21
|
+
export declare function compilePageDesignRecipe(input: PageDesignRecipe, context: CompileContext): OperationIr;
|
|
22
|
+
//# sourceMappingURL=page-design.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-design.d.ts","sourceRoot":"","sources":["../../../src/recipe/compile/page-design.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAC;AAU1B,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AAEjF,OAAO,EAAiD,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE9F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,cAAc,GACtB,WAAW,CAwEb"}
|