@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,38 @@
|
|
|
1
|
+
import type { RefValue } from "../ir/operations";
|
|
2
|
+
/**
|
|
3
|
+
* Render a typed `RefValue` to the canonical Sitecore string form.
|
|
4
|
+
*
|
|
5
|
+
* Sitecore field storage is always a string — the `RefValue` discriminator
|
|
6
|
+
* tells us *how* to serialize that string for Sitecore to understand it.
|
|
7
|
+
* See `plans/sitecore-relationships.md` (Reference encoding patterns) for
|
|
8
|
+
* the per-pattern serialization rules.
|
|
9
|
+
*
|
|
10
|
+
* `ref-recipe` / `ref-recipe-list` cannot be rendered directly — the
|
|
11
|
+
* executor must resolve their `refKey` against the per-run captured-itemId
|
|
12
|
+
* map first (see `resolveRecipeRefs` below). Calling `renderRefValue` on
|
|
13
|
+
* an unresolved recipe-ref is a programmer error.
|
|
14
|
+
*/
|
|
15
|
+
export declare const renderRefValue: (value: RefValue) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Substitute every `ref-recipe` / `ref-recipe-list` against the captured
|
|
18
|
+
* Sitecore itemId map. Returns a new `RefValue` with `ref-guid` /
|
|
19
|
+
* `ref-guid-list` in their place. Throws when a refKey is missing — that
|
|
20
|
+
* indicates a topological ordering bug (executor referenced an item that
|
|
21
|
+
* hadn't been created yet).
|
|
22
|
+
*/
|
|
23
|
+
export declare const resolveRecipeRefs: (value: RefValue, capturedItemIds: ReadonlyMap<string, string>) => RefValue;
|
|
24
|
+
/**
|
|
25
|
+
* Normalise a Sitecore itemId to the canonical 8-4-4-4-12 dashed
|
|
26
|
+
* form. Authoring GraphQL returns IDs without dashes
|
|
27
|
+
* (`825b30b4b40b422e992023a1b6bda89c`), but Sitecore's Treelist
|
|
28
|
+
* field-value parser only resolves IDs in dashed form
|
|
29
|
+
* (`{825B30B4-B40B-422E-9920-23A1B6BDA89C}`). Without this, multilist
|
|
30
|
+
* field values written by `toCurly` come out as `{NODASH}` and the
|
|
31
|
+
* editor renders "Item not found" for every entry even though the
|
|
32
|
+
* items exist.
|
|
33
|
+
*
|
|
34
|
+
* Returns input unchanged (lowercased) when the value isn't a 32-hex
|
|
35
|
+
* GUID — defensive against ref values that aren't actual itemIds.
|
|
36
|
+
*/
|
|
37
|
+
export declare const dashifyGuid: (guid: string) => string;
|
|
38
|
+
//# sourceMappingURL=ref-encoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ref-encoding.d.ts","sourceRoot":"","sources":["../../../src/recipe/api/ref-encoding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,QAAQ,KAAG,MAgChD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,QAAQ,EACf,iBAAiB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAC3C,QA4EF,CAAC;AAOF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAI1C,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dashifyGuid = exports.resolveRecipeRefs = exports.renderRefValue = void 0;
|
|
4
|
+
const errors_1 = require("../../shared/errors");
|
|
5
|
+
const source_fields_1 = require("../schema/source-fields");
|
|
6
|
+
/**
|
|
7
|
+
* Render a typed `RefValue` to the canonical Sitecore string form.
|
|
8
|
+
*
|
|
9
|
+
* Sitecore field storage is always a string — the `RefValue` discriminator
|
|
10
|
+
* tells us *how* to serialize that string for Sitecore to understand it.
|
|
11
|
+
* See `plans/sitecore-relationships.md` (Reference encoding patterns) for
|
|
12
|
+
* the per-pattern serialization rules.
|
|
13
|
+
*
|
|
14
|
+
* `ref-recipe` / `ref-recipe-list` cannot be rendered directly — the
|
|
15
|
+
* executor must resolve their `refKey` against the per-run captured-itemId
|
|
16
|
+
* map first (see `resolveRecipeRefs` below). Calling `renderRefValue` on
|
|
17
|
+
* an unresolved recipe-ref is a programmer error.
|
|
18
|
+
*/
|
|
19
|
+
const renderRefValue = (value) => {
|
|
20
|
+
switch (value.kind) {
|
|
21
|
+
case "string":
|
|
22
|
+
return value.value;
|
|
23
|
+
case "bool":
|
|
24
|
+
return value.value ? "1" : "0";
|
|
25
|
+
case "number":
|
|
26
|
+
return String(value.value);
|
|
27
|
+
case "ref-guid":
|
|
28
|
+
return toCurly(value.value);
|
|
29
|
+
case "ref-guid-list":
|
|
30
|
+
return value.values.map(toCurly).join("|");
|
|
31
|
+
case "ref-recipe":
|
|
32
|
+
case "ref-recipe-list":
|
|
33
|
+
case "ref-source-fields":
|
|
34
|
+
throw (0, errors_1.createCliError)(`Unresolved ${value.kind} cannot be rendered — call resolveRecipeRefs first.`, "UNKNOWN");
|
|
35
|
+
case "ref-path":
|
|
36
|
+
return value.value;
|
|
37
|
+
case "query":
|
|
38
|
+
return value.value;
|
|
39
|
+
case "url-string-map":
|
|
40
|
+
return Object.entries(value.entries)
|
|
41
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
42
|
+
.join("&");
|
|
43
|
+
default: {
|
|
44
|
+
const exhaustive = value;
|
|
45
|
+
throw (0, errors_1.createCliError)(`Unhandled RefValue kind: ${JSON.stringify(exhaustive)}`, "UNKNOWN");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.renderRefValue = renderRefValue;
|
|
50
|
+
/**
|
|
51
|
+
* Substitute every `ref-recipe` / `ref-recipe-list` against the captured
|
|
52
|
+
* Sitecore itemId map. Returns a new `RefValue` with `ref-guid` /
|
|
53
|
+
* `ref-guid-list` in their place. Throws when a refKey is missing — that
|
|
54
|
+
* indicates a topological ordering bug (executor referenced an item that
|
|
55
|
+
* hadn't been created yet).
|
|
56
|
+
*/
|
|
57
|
+
const resolveRecipeRefs = (value, capturedItemIds) => {
|
|
58
|
+
switch (value.kind) {
|
|
59
|
+
case "ref-recipe": {
|
|
60
|
+
const itemId = capturedItemIds.get(value.refKey);
|
|
61
|
+
if (itemId)
|
|
62
|
+
return { kind: "ref-guid", value: itemId };
|
|
63
|
+
// Pass-through: when a refKey isn't in the captured map but looks
|
|
64
|
+
// like a literal Sitecore GUID (e.g. `SITECORE_TEMPLATES.FOLDER`
|
|
65
|
+
// baked into an aggregator's ref-recipe list), treat it as a
|
|
66
|
+
// literal rather than failing. Recipe-internal refKeys are also
|
|
67
|
+
// valid GUIDs in shape, so this is purely a fallback for items
|
|
68
|
+
// that don't get produced by sibling CreateItem ops — built-in
|
|
69
|
+
// templates, tenant-pre-existing items.
|
|
70
|
+
if (isGuid(value.refKey)) {
|
|
71
|
+
return { kind: "ref-guid", value: value.refKey };
|
|
72
|
+
}
|
|
73
|
+
throw (0, errors_1.createCliError)(`ref-recipe refKey ${value.refKey} not in captured map — was the producing CreateItem op skipped or did it run after this op?`, "UNKNOWN");
|
|
74
|
+
}
|
|
75
|
+
case "ref-recipe-list": {
|
|
76
|
+
const guids = [];
|
|
77
|
+
for (const refKey of value.refKeys) {
|
|
78
|
+
const itemId = capturedItemIds.get(refKey);
|
|
79
|
+
if (itemId) {
|
|
80
|
+
guids.push(itemId);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
// Same pass-through as `ref-recipe` above — built-in Sitecore
|
|
84
|
+
// template constants and tenant-pre-existing items appear in
|
|
85
|
+
// aggregator ref-recipe-list values; honour them as literals.
|
|
86
|
+
if (isGuid(refKey)) {
|
|
87
|
+
guids.push(refKey);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (value.tolerateMissing)
|
|
91
|
+
continue;
|
|
92
|
+
throw (0, errors_1.createCliError)(`ref-recipe-list refKey ${refKey} not in captured map — was the producing CreateItem op skipped or did it run after this op?`, "UNKNOWN");
|
|
93
|
+
}
|
|
94
|
+
return { kind: "ref-guid-list", values: guids };
|
|
95
|
+
}
|
|
96
|
+
case "ref-source-fields": {
|
|
97
|
+
// Structured source fields with recipe-handle references in
|
|
98
|
+
// `sourceTypes`. Resolve each handle to its captured Sitecore
|
|
99
|
+
// itemId, then render. Recipe handles map to refKeys via
|
|
100
|
+
// `templateId(site, handle)`, which the planner registers when the
|
|
101
|
+
// referenced template's CreateItem op completes. The site name is
|
|
102
|
+
// embedded on the value at compile time — the encoder can't otherwise
|
|
103
|
+
// know which site the recipe set was compiled under.
|
|
104
|
+
const rendered = (0, source_fields_1.renderSourceFields)({
|
|
105
|
+
sourceTypes: value.sourceTypes,
|
|
106
|
+
sourceQuery: value.sourceQuery,
|
|
107
|
+
sourceScope: value.sourceScope,
|
|
108
|
+
}, (handle) => {
|
|
109
|
+
const refKey = (0, guids_1.templateId)(value.site, handle);
|
|
110
|
+
const itemId = capturedItemIds.get(refKey);
|
|
111
|
+
if (!itemId) {
|
|
112
|
+
throw (0, errors_1.createCliError)(`ref-source-fields references handle '${handle}' (refKey ${refKey}); not yet in captured map.`, "UNKNOWN");
|
|
113
|
+
}
|
|
114
|
+
return itemId;
|
|
115
|
+
});
|
|
116
|
+
// sourceTypes is non-empty in this branch (IR validation), so
|
|
117
|
+
// renderSourceFields always returns a string.
|
|
118
|
+
return { kind: "string", value: rendered };
|
|
119
|
+
}
|
|
120
|
+
default:
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
exports.resolveRecipeRefs = resolveRecipeRefs;
|
|
125
|
+
// Re-import here to avoid a circular dep with `guids.ts → ir/operations`.
|
|
126
|
+
// `templateId` is a pure uuidv5 derivation; importing it lazily keeps the
|
|
127
|
+
// resolver self-contained.
|
|
128
|
+
const guids_1 = require("../guids");
|
|
129
|
+
/**
|
|
130
|
+
* Normalise a Sitecore itemId to the canonical 8-4-4-4-12 dashed
|
|
131
|
+
* form. Authoring GraphQL returns IDs without dashes
|
|
132
|
+
* (`825b30b4b40b422e992023a1b6bda89c`), but Sitecore's Treelist
|
|
133
|
+
* field-value parser only resolves IDs in dashed form
|
|
134
|
+
* (`{825B30B4-B40B-422E-9920-23A1B6BDA89C}`). Without this, multilist
|
|
135
|
+
* field values written by `toCurly` come out as `{NODASH}` and the
|
|
136
|
+
* editor renders "Item not found" for every entry even though the
|
|
137
|
+
* items exist.
|
|
138
|
+
*
|
|
139
|
+
* Returns input unchanged (lowercased) when the value isn't a 32-hex
|
|
140
|
+
* GUID — defensive against ref values that aren't actual itemIds.
|
|
141
|
+
*/
|
|
142
|
+
const dashifyGuid = (guid) => {
|
|
143
|
+
const compact = guid.replace(/[{}-]/g, "").toLowerCase();
|
|
144
|
+
if (compact.length !== 32)
|
|
145
|
+
return guid.toLowerCase();
|
|
146
|
+
return `${compact.slice(0, 8)}-${compact.slice(8, 12)}-${compact.slice(12, 16)}-${compact.slice(16, 20)}-${compact.slice(20, 32)}`;
|
|
147
|
+
};
|
|
148
|
+
exports.dashifyGuid = dashifyGuid;
|
|
149
|
+
/**
|
|
150
|
+
* True when the string is a valid Sitecore item GUID — 32 hex chars,
|
|
151
|
+
* with or without dashes, with or without curly braces. Used by the
|
|
152
|
+
* `ref-recipe` / `ref-recipe-list` resolvers to pass through literal
|
|
153
|
+
* GUIDs (built-in Sitecore template constants, tenant-pre-existing
|
|
154
|
+
* items) that aren't produced by sibling CreateItem ops.
|
|
155
|
+
*/
|
|
156
|
+
const isGuid = (s) => {
|
|
157
|
+
const compact = s.replace(/[{}-]/g, "");
|
|
158
|
+
return compact.length === 32 && /^[0-9a-fA-F]{32}$/.test(compact);
|
|
159
|
+
};
|
|
160
|
+
const toCurly = (guid) => `{${(0, exports.dashifyGuid)(guid).toUpperCase()}}`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discover SXA sites in a Sitecore CM environment via the Authoring
|
|
3
|
+
* GraphQL API.
|
|
4
|
+
*
|
|
5
|
+
* The convention this walks: each CM environment has a single tenant
|
|
6
|
+
* at `/sitecore/content/<Tenant>` with one or more sites under it at
|
|
7
|
+
* `/sitecore/content/<Tenant>/<Site>`. Tenants and sites are identified
|
|
8
|
+
* by template name match rather than hard-coded template GUIDs so
|
|
9
|
+
* the discovery is resilient across SXA / XM Cloud variants:
|
|
10
|
+
*
|
|
11
|
+
* - Tenant: `Tenant`, `Tenant Folder`, `Headless Tenant`,
|
|
12
|
+
* `Headless Tenant Folder`
|
|
13
|
+
* - Site: `Site`, `Headless Site`
|
|
14
|
+
*
|
|
15
|
+
* Two round trips minimum:
|
|
16
|
+
* 1. children of `/sitecore/content` → candidate tenants
|
|
17
|
+
* 2. children of each tenant → candidate sites
|
|
18
|
+
*
|
|
19
|
+
* Sites typically expose hostnames via a `Settings/Site Grouping/<grouping>`
|
|
20
|
+
* sub-item. Walking deeper for hostnames is opt-in (`includeHostnames`)
|
|
21
|
+
* because it adds an N+1 round trip per site.
|
|
22
|
+
*/
|
|
23
|
+
import { EnvironmentConfiguration } from "../../config";
|
|
24
|
+
export type DiscoveredSite = {
|
|
25
|
+
/** Item name (URL-safe slug). Used as the SXA site name. */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Display name from the item, or the item name if not set. */
|
|
28
|
+
displayName: string;
|
|
29
|
+
/** Full Sitecore content path, e.g. `/sitecore/content/MyTenant/MySite`. */
|
|
30
|
+
path: string;
|
|
31
|
+
/** Parent tenant's item name. */
|
|
32
|
+
tenantName: string;
|
|
33
|
+
/** Parent tenant's full path. */
|
|
34
|
+
tenantPath: string;
|
|
35
|
+
/** Hostnames declared by `Settings/Site Grouping/<grouping>` items.
|
|
36
|
+
* Populated only when `includeHostnames: true` is requested. */
|
|
37
|
+
hostnames?: string[];
|
|
38
|
+
};
|
|
39
|
+
export type DiscoverSitesOptions = {
|
|
40
|
+
/** Resolve each site's hostnames from its Site Grouping sub-items.
|
|
41
|
+
* Adds N+1 GraphQL round trips. Defaults to false. */
|
|
42
|
+
includeHostnames?: boolean;
|
|
43
|
+
/** Override the content root walked. Default `/sitecore/content`.
|
|
44
|
+
* Useful for tests or for installations that nest content under a
|
|
45
|
+
* non-default root. */
|
|
46
|
+
contentRoot?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare const discoverSites: (environment: EnvironmentConfiguration, options?: DiscoverSitesOptions) => Promise<DiscoveredSite[]>;
|
|
49
|
+
//# sourceMappingURL=site-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-discovery.d.ts","sourceRoot":"","sources":["../../../src/recipe/api/site-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,MAAM,cAAc,GAAG;IAC3B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB;qEACiE;IACjE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;2DACuD;IACvD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;4BAEwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAyGF,eAAO,MAAM,aAAa,GACxB,aAAa,wBAAwB,EACrC,UAAS,oBAAyB,KACjC,OAAO,CAAC,cAAc,EAAE,CA2B1B,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Discover SXA sites in a Sitecore CM environment via the Authoring
|
|
4
|
+
* GraphQL API.
|
|
5
|
+
*
|
|
6
|
+
* The convention this walks: each CM environment has a single tenant
|
|
7
|
+
* at `/sitecore/content/<Tenant>` with one or more sites under it at
|
|
8
|
+
* `/sitecore/content/<Tenant>/<Site>`. Tenants and sites are identified
|
|
9
|
+
* by template name match rather than hard-coded template GUIDs so
|
|
10
|
+
* the discovery is resilient across SXA / XM Cloud variants:
|
|
11
|
+
*
|
|
12
|
+
* - Tenant: `Tenant`, `Tenant Folder`, `Headless Tenant`,
|
|
13
|
+
* `Headless Tenant Folder`
|
|
14
|
+
* - Site: `Site`, `Headless Site`
|
|
15
|
+
*
|
|
16
|
+
* Two round trips minimum:
|
|
17
|
+
* 1. children of `/sitecore/content` → candidate tenants
|
|
18
|
+
* 2. children of each tenant → candidate sites
|
|
19
|
+
*
|
|
20
|
+
* Sites typically expose hostnames via a `Settings/Site Grouping/<grouping>`
|
|
21
|
+
* sub-item. Walking deeper for hostnames is opt-in (`includeHostnames`)
|
|
22
|
+
* because it adds an N+1 round trip per site.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.discoverSites = void 0;
|
|
26
|
+
const graphql_1 = require("./graphql");
|
|
27
|
+
const DEFAULT_CONTENT_ROOT = "/sitecore/content";
|
|
28
|
+
const TENANT_TEMPLATE_NAMES = new Set([
|
|
29
|
+
"Tenant",
|
|
30
|
+
"Tenant Folder",
|
|
31
|
+
"Headless Tenant",
|
|
32
|
+
"Headless Tenant Folder",
|
|
33
|
+
]);
|
|
34
|
+
const SITE_TEMPLATE_NAMES = new Set(["Site", "Headless Site"]);
|
|
35
|
+
const SITE_GROUPING_NAMES = new Set(["Site Grouping"]);
|
|
36
|
+
const CHILDREN_QUERY = `
|
|
37
|
+
query($path: String!) {
|
|
38
|
+
item(where: { path: $path }) {
|
|
39
|
+
children {
|
|
40
|
+
nodes {
|
|
41
|
+
itemId
|
|
42
|
+
name
|
|
43
|
+
displayName
|
|
44
|
+
path
|
|
45
|
+
template {
|
|
46
|
+
name
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}`;
|
|
52
|
+
const HOSTNAME_QUERY = `
|
|
53
|
+
query($path: String!) {
|
|
54
|
+
item(where: { path: $path }) {
|
|
55
|
+
fields(ownFields: false) {
|
|
56
|
+
nodes {
|
|
57
|
+
name
|
|
58
|
+
value
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}`;
|
|
63
|
+
const fetchChildren = async (environment, path) => {
|
|
64
|
+
const data = await (0, graphql_1.runAuthoringGraphQL)(environment, CHILDREN_QUERY, { path });
|
|
65
|
+
return data.item?.children.nodes ?? [];
|
|
66
|
+
};
|
|
67
|
+
const fetchHostnames = async (environment, sitePath) => {
|
|
68
|
+
// Site groupings live at <site>/Settings/Site Grouping/<grouping>
|
|
69
|
+
// and expose a `Hostname` field. Walk: site → settings → site
|
|
70
|
+
// grouping container → grouping items → collect Hostname.
|
|
71
|
+
const settings = await fetchChildren(environment, sitePath);
|
|
72
|
+
const settingsItem = settings.find((node) => node.name === "Settings");
|
|
73
|
+
if (!settingsItem)
|
|
74
|
+
return [];
|
|
75
|
+
const settingsChildren = await fetchChildren(environment, settingsItem.path);
|
|
76
|
+
const groupingContainer = settingsChildren.find((node) => SITE_GROUPING_NAMES.has(node.name));
|
|
77
|
+
if (!groupingContainer)
|
|
78
|
+
return [];
|
|
79
|
+
const groupings = await fetchChildren(environment, groupingContainer.path);
|
|
80
|
+
const hostnames = [];
|
|
81
|
+
for (const grouping of groupings) {
|
|
82
|
+
const data = await (0, graphql_1.runAuthoringGraphQL)(environment, HOSTNAME_QUERY, {
|
|
83
|
+
path: grouping.path,
|
|
84
|
+
});
|
|
85
|
+
const value = data.item?.fields.nodes.find((field) => field.name === "Hostname")?.value;
|
|
86
|
+
if (value && value.trim()) {
|
|
87
|
+
// Hostname field is typically a single hostname or `|`-separated list.
|
|
88
|
+
for (const host of value.split("|")) {
|
|
89
|
+
const trimmed = host.trim();
|
|
90
|
+
if (trimmed)
|
|
91
|
+
hostnames.push(trimmed);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return hostnames;
|
|
96
|
+
};
|
|
97
|
+
const isTenantNode = (node) => TENANT_TEMPLATE_NAMES.has(node.template?.name ?? "");
|
|
98
|
+
const isSiteNode = (node) => SITE_TEMPLATE_NAMES.has(node.template?.name ?? "");
|
|
99
|
+
const discoverSites = async (environment, options = {}) => {
|
|
100
|
+
const contentRoot = options.contentRoot ?? DEFAULT_CONTENT_ROOT;
|
|
101
|
+
const tenantCandidates = await fetchChildren(environment, contentRoot);
|
|
102
|
+
// SXA convention: top-level items under /sitecore/content are tenants.
|
|
103
|
+
// Some installations have non-tenant items here too (e.g. legacy "Home")
|
|
104
|
+
// — filter by template name to skip them.
|
|
105
|
+
const tenants = tenantCandidates.filter(isTenantNode);
|
|
106
|
+
const sites = [];
|
|
107
|
+
for (const tenant of tenants) {
|
|
108
|
+
const tenantChildren = await fetchChildren(environment, tenant.path);
|
|
109
|
+
for (const child of tenantChildren) {
|
|
110
|
+
if (!isSiteNode(child))
|
|
111
|
+
continue;
|
|
112
|
+
const site = {
|
|
113
|
+
name: child.name,
|
|
114
|
+
displayName: child.displayName?.trim() || child.name,
|
|
115
|
+
path: child.path,
|
|
116
|
+
tenantName: tenant.name,
|
|
117
|
+
tenantPath: tenant.path,
|
|
118
|
+
};
|
|
119
|
+
if (options.includeHostnames) {
|
|
120
|
+
site.hostnames = await fetchHostnames(environment, child.path);
|
|
121
|
+
}
|
|
122
|
+
sites.push(site);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return sites;
|
|
126
|
+
};
|
|
127
|
+
exports.discoverSites = discoverSites;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Job, type JobResponse, type Language, type NewSiteInput, type Site, type SiteCollection, type SiteTemplate, type SitesApiClientOptions as RawSitesApiClientOptions } from "../../sites/api";
|
|
2
|
+
/**
|
|
3
|
+
* Sites API client surface for recipe execution.
|
|
4
|
+
*
|
|
5
|
+
* The recipe planner and executor depend only on this interface — they
|
|
6
|
+
* don't reach into `src/sites/api/*` directly. Production runs use
|
|
7
|
+
* `createSitesApiClient(options)`, which adapts the function-style
|
|
8
|
+
* Sites API surface into the interface; tests inject a mock — same
|
|
9
|
+
* seam either way (parallel to how `AuthoringApiClient` works).
|
|
10
|
+
*
|
|
11
|
+
* Surface is the recipe-required subset:
|
|
12
|
+
* - `createSite` for `CreateSiteFromTemplate` ops
|
|
13
|
+
* - `getJobStatus` for awaiting async createSite completion
|
|
14
|
+
* - `listSites` for idempotency check (does this siteName exist?)
|
|
15
|
+
* - `listSiteTemplates` for diagnostics (which templates are usable?)
|
|
16
|
+
* - `listCollections` for resolving `collectionId`
|
|
17
|
+
* - `listLanguages` + `addLanguage` for ensuring required language(s)
|
|
18
|
+
* are present before site creation
|
|
19
|
+
*
|
|
20
|
+
* Additional Sites API operations (favourites, editor profiles, hosts,
|
|
21
|
+
* aggregation) live in `src/sites/api/*` and are not part of this
|
|
22
|
+
* recipe-execution surface — they belong to the broader CLI subcommand
|
|
23
|
+
* tree, not the push pipeline.
|
|
24
|
+
*/
|
|
25
|
+
export interface SitesApiClient {
|
|
26
|
+
createSite(input: NewSiteInput): Promise<JobResponse>;
|
|
27
|
+
getJobStatus(jobHandle: string): Promise<Job>;
|
|
28
|
+
listSites(): Promise<Site[]>;
|
|
29
|
+
listSiteTemplates(): Promise<SiteTemplate[]>;
|
|
30
|
+
listCollections(): Promise<SiteCollection[]>;
|
|
31
|
+
listLanguages(): Promise<Language[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Add a language to the environment by ISO code (e.g. `"en"`, `"da"`,
|
|
34
|
+
* `"fr-CA"`). The Sites API distinguishes language code from
|
|
35
|
+
* regional code; the recipe push pipeline only needs to declare the
|
|
36
|
+
* language code. If the language is already present, the API
|
|
37
|
+
* surfaces a 409-style error which the executor treats as success.
|
|
38
|
+
*/
|
|
39
|
+
addLanguage(languageCode: string): Promise<Language>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Adapter: build a `SitesApiClient` over the function-style Sites API
|
|
43
|
+
* surface. The `options` arg carries the OAuth-resolved auth header and
|
|
44
|
+
* base URL; the underlying `sitesRequest` re-uses these per call.
|
|
45
|
+
*/
|
|
46
|
+
export declare const createSitesApiClient: (options: RawSitesApiClientOptions) => SitesApiClient;
|
|
47
|
+
export type { Job, JobResponse, Language, NewSiteInput, Site, SiteCollection, SiteTemplate, };
|
|
48
|
+
//# sourceMappingURL=sites-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sites-client.d.ts","sourceRoot":"","sources":["../../../src/recipe/api/sites-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,QAAQ,EAKb,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,qBAAqB,IAAI,wBAAwB,EACvD,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACtD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9C,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7B,iBAAiB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7C,eAAe,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC7C,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrC;;;;;;OAMG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtD;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,wBAAwB,KAChC,cAQD,CAAC;AAEH,YAAY,EACV,GAAG,EACH,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,cAAc,EACd,YAAY,GACb,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSitesApiClient = void 0;
|
|
4
|
+
const api_1 = require("../../sites/api");
|
|
5
|
+
/**
|
|
6
|
+
* Adapter: build a `SitesApiClient` over the function-style Sites API
|
|
7
|
+
* surface. The `options` arg carries the OAuth-resolved auth header and
|
|
8
|
+
* base URL; the underlying `sitesRequest` re-uses these per call.
|
|
9
|
+
*/
|
|
10
|
+
const createSitesApiClient = (options) => ({
|
|
11
|
+
createSite: (input) => (0, api_1.createSite)(options, input),
|
|
12
|
+
getJobStatus: (jobHandle) => (0, api_1.getJobStatus)(options, jobHandle),
|
|
13
|
+
listSites: () => (0, api_1.listSites)(options),
|
|
14
|
+
listSiteTemplates: () => (0, api_1.listSiteTemplates)(options),
|
|
15
|
+
listCollections: () => (0, api_1.listCollections)(options),
|
|
16
|
+
listLanguages: () => (0, api_1.listLanguages)(options),
|
|
17
|
+
addLanguage: (languageCode) => (0, api_1.addLanguage)(options, { languageCode }),
|
|
18
|
+
});
|
|
19
|
+
exports.createSitesApiClient = createSitesApiClient;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { OperationIr } from "./ir/operations";
|
|
2
|
+
export interface RecipeCacheEntry {
|
|
3
|
+
irHash: string;
|
|
4
|
+
lastApplied: string;
|
|
5
|
+
summary: {
|
|
6
|
+
create: number;
|
|
7
|
+
update: number;
|
|
8
|
+
skip: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface RecipeCacheTenant {
|
|
12
|
+
rootsHash: string;
|
|
13
|
+
recipes: Record<string, RecipeCacheEntry>;
|
|
14
|
+
}
|
|
15
|
+
export interface RecipeCacheFile {
|
|
16
|
+
schemaVersion: "1";
|
|
17
|
+
tenants: Record<string, RecipeCacheTenant>;
|
|
18
|
+
}
|
|
19
|
+
export declare const hashIr: (ir: OperationIr) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Hash the env-profile roots that affect IR compilation. When any of
|
|
22
|
+
* these change, the IR shape changes and the cached `irHash` is no
|
|
23
|
+
* longer comparable — the cache entry is invalidated.
|
|
24
|
+
*/
|
|
25
|
+
export declare const hashRoots: (roots: Record<string, string | undefined>) => string;
|
|
26
|
+
export declare const loadRecipeCache: (configDir: string) => Promise<RecipeCacheFile>;
|
|
27
|
+
export declare const saveRecipeCache: (configDir: string, cache: RecipeCacheFile) => Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Decide whether an IR can be skipped based on the cache. Returns
|
|
30
|
+
* `null` when no cached entry applies (different roots hash, missing
|
|
31
|
+
* entry, or schema mismatch); otherwise returns the cached summary
|
|
32
|
+
* to surface in the push output.
|
|
33
|
+
*/
|
|
34
|
+
export declare const cachedSkipFor: (cache: RecipeCacheFile, envName: string, rootsHash: string, recipeHandle: string, irHash: string) => RecipeCacheEntry | null;
|
|
35
|
+
export declare const recordCacheEntry: (cache: RecipeCacheFile, envName: string, rootsHash: string, recipeHandle: string, entry: RecipeCacheEntry) => void;
|
|
36
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/recipe/cache.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,GAAG,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC5C;AAQD,eAAO,MAAM,MAAM,GAAI,IAAI,WAAW,KAAG,MACsB,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAG,MAOrE,CAAC;AAQF,eAAO,MAAM,eAAe,GAAU,WAAW,MAAM,KAAG,OAAO,CAAC,eAAe,CAiBhF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,WAAW,MAAM,EAAE,OAAO,eAAe,KAAG,OAAO,CAAC,IAAI,CAI7F,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,eAAe,EACtB,SAAS,MAAM,EACf,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,QAAQ,MAAM,KACb,gBAAgB,GAAG,IAQrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,eAAe,EACtB,SAAS,MAAM,EACf,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,OAAO,gBAAgB,KACtB,IASF,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.recordCacheEntry = exports.cachedSkipFor = exports.saveRecipeCache = exports.loadRecipeCache = exports.hashRoots = exports.hashIr = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Recipe-level content-hash skip cache.
|
|
9
|
+
*
|
|
10
|
+
* Persists a per-(tenant, recipe) digest of the last successfully-applied
|
|
11
|
+
* IR alongside a digest of the env-profile roots that influence
|
|
12
|
+
* compilation. On the next push, recipes whose IR digest + roots digest
|
|
13
|
+
* both match the cached entry are treated as up-to-date and skipped
|
|
14
|
+
* entirely — no plan-time reads, no per-op round trips. Trades a
|
|
15
|
+
* narrow correctness window (out-of-band CMS edits to recipe-owned
|
|
16
|
+
* items aren't auto-redetected until the recipe source changes) for a
|
|
17
|
+
* substantial speedup on no-op re-pushes.
|
|
18
|
+
*
|
|
19
|
+
* Cache is opt-in via `--skip-unchanged-recipes`; default OFF so the
|
|
20
|
+
* existing read-then-diff semantics stay the default for human
|
|
21
|
+
* operators. The orchestrator's automated re-push path is the
|
|
22
|
+
* intended primary consumer.
|
|
23
|
+
*
|
|
24
|
+
* File location: `<configDir>/.scai/recipe-cache.json`. Always-write
|
|
25
|
+
* after a successful, non-aborted push; never persists partial state.
|
|
26
|
+
*/
|
|
27
|
+
const node_fs_1 = require("node:fs");
|
|
28
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
29
|
+
const node_crypto_1 = require("node:crypto");
|
|
30
|
+
const CACHE_DIR = ".scai";
|
|
31
|
+
const CACHE_FILE = "recipe-cache.json";
|
|
32
|
+
const SCHEMA_VERSION = "1";
|
|
33
|
+
const cachePath = (configDir) => node_path_1.default.join(configDir, CACHE_DIR, CACHE_FILE);
|
|
34
|
+
const hashIr = (ir) => (0, node_crypto_1.createHash)("sha256").update(JSON.stringify(ir)).digest("hex");
|
|
35
|
+
exports.hashIr = hashIr;
|
|
36
|
+
/**
|
|
37
|
+
* Hash the env-profile roots that affect IR compilation. When any of
|
|
38
|
+
* these change, the IR shape changes and the cached `irHash` is no
|
|
39
|
+
* longer comparable — the cache entry is invalidated.
|
|
40
|
+
*/
|
|
41
|
+
const hashRoots = (roots) => {
|
|
42
|
+
const ordered = {};
|
|
43
|
+
for (const key of Object.keys(roots).sort()) {
|
|
44
|
+
const value = roots[key];
|
|
45
|
+
if (value !== undefined)
|
|
46
|
+
ordered[key] = value;
|
|
47
|
+
}
|
|
48
|
+
return (0, node_crypto_1.createHash)("sha256").update(JSON.stringify(ordered)).digest("hex");
|
|
49
|
+
};
|
|
50
|
+
exports.hashRoots = hashRoots;
|
|
51
|
+
const isCacheFile = (raw) => {
|
|
52
|
+
if (!raw || typeof raw !== "object")
|
|
53
|
+
return false;
|
|
54
|
+
const file = raw;
|
|
55
|
+
return file.schemaVersion === SCHEMA_VERSION && typeof file.tenants === "object";
|
|
56
|
+
};
|
|
57
|
+
const loadRecipeCache = async (configDir) => {
|
|
58
|
+
const filePath = cachePath(configDir);
|
|
59
|
+
try {
|
|
60
|
+
const raw = await node_fs_1.promises.readFile(filePath, "utf8");
|
|
61
|
+
const parsed = JSON.parse(raw);
|
|
62
|
+
if (isCacheFile(parsed))
|
|
63
|
+
return parsed;
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
// ENOENT → first run. Anything else (corrupted JSON, stale schema)
|
|
67
|
+
// also returns an empty cache; we'd rather rebuild silently than
|
|
68
|
+
// fail the push. The next save overwrites the bad file.
|
|
69
|
+
if (error.code !== "ENOENT") {
|
|
70
|
+
// Corruption — treat as empty cache. (Could log via the caller's
|
|
71
|
+
// logger but this path is hot and shouldn't pull in a logger
|
|
72
|
+
// dependency.)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { schemaVersion: SCHEMA_VERSION, tenants: {} };
|
|
76
|
+
};
|
|
77
|
+
exports.loadRecipeCache = loadRecipeCache;
|
|
78
|
+
const saveRecipeCache = async (configDir, cache) => {
|
|
79
|
+
const filePath = cachePath(configDir);
|
|
80
|
+
await node_fs_1.promises.mkdir(node_path_1.default.dirname(filePath), { recursive: true });
|
|
81
|
+
await node_fs_1.promises.writeFile(filePath, `${JSON.stringify(cache, null, 2)}\n`, "utf8");
|
|
82
|
+
};
|
|
83
|
+
exports.saveRecipeCache = saveRecipeCache;
|
|
84
|
+
/**
|
|
85
|
+
* Decide whether an IR can be skipped based on the cache. Returns
|
|
86
|
+
* `null` when no cached entry applies (different roots hash, missing
|
|
87
|
+
* entry, or schema mismatch); otherwise returns the cached summary
|
|
88
|
+
* to surface in the push output.
|
|
89
|
+
*/
|
|
90
|
+
const cachedSkipFor = (cache, envName, rootsHash, recipeHandle, irHash) => {
|
|
91
|
+
const tenant = cache.tenants[envName];
|
|
92
|
+
if (!tenant)
|
|
93
|
+
return null;
|
|
94
|
+
if (tenant.rootsHash !== rootsHash)
|
|
95
|
+
return null;
|
|
96
|
+
const entry = tenant.recipes[recipeHandle];
|
|
97
|
+
if (!entry)
|
|
98
|
+
return null;
|
|
99
|
+
if (entry.irHash !== irHash)
|
|
100
|
+
return null;
|
|
101
|
+
return entry;
|
|
102
|
+
};
|
|
103
|
+
exports.cachedSkipFor = cachedSkipFor;
|
|
104
|
+
const recordCacheEntry = (cache, envName, rootsHash, recipeHandle, entry) => {
|
|
105
|
+
let tenant = cache.tenants[envName];
|
|
106
|
+
if (!tenant || tenant.rootsHash !== rootsHash) {
|
|
107
|
+
// Roots changed → drop all stale entries for this tenant; the
|
|
108
|
+
// next save persists only the freshly-validated ones.
|
|
109
|
+
tenant = { rootsHash, recipes: {} };
|
|
110
|
+
cache.tenants[envName] = tenant;
|
|
111
|
+
}
|
|
112
|
+
tenant.recipes[recipeHandle] = entry;
|
|
113
|
+
};
|
|
114
|
+
exports.recordCacheEntry = recordCacheEntry;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type OperationIr } from "../ir/operations";
|
|
2
|
+
import { type ComponentSectionRecipe } from "../schema/recipe";
|
|
3
|
+
import { type CompileContext } from "./shared";
|
|
4
|
+
/**
|
|
5
|
+
* Compile a `ComponentSectionRecipe` to an Operation IR.
|
|
6
|
+
*
|
|
7
|
+
* Owns the three SECTION-LEVEL organisational items (one each per
|
|
8
|
+
* `(site, section.name)`):
|
|
9
|
+
*
|
|
10
|
+
* 1. Templates section folder — `<componentsRoot>/<name>/`
|
|
11
|
+
* 4. Renderings-tree section folder — `<renderingsRoot>/<name>/`
|
|
12
|
+
* 5. Headless Variants section — `<headlessVariantsRoot>/<name>/`
|
|
13
|
+
*
|
|
14
|
+
* Each carries the recipe's `displayName`, `icon`, and `sortOrder`
|
|
15
|
+
* fields so the SXA editor's tree shows the section with the author's
|
|
16
|
+
* intent. `compileRecipeSet` MUST process section recipes BEFORE
|
|
17
|
+
* component recipes — the per-section sentinels seeded into
|
|
18
|
+
* `emittedFolders` here make subsequent `ensureSectionFolder` /
|
|
19
|
+
* `ensureRenderingsSectionFolder` calls from component recipes
|
|
20
|
+
* no-op-with-the-section-already-existing.
|
|
21
|
+
*
|
|
22
|
+
* The two SUBORDINATE buckets (#2 Component Folders, #3 Presentation
|
|
23
|
+
* Parameters) are NOT emitted here — they're emitted lazily by
|
|
24
|
+
* `ensureComponentFoldersBucket` / `ensurePresentationParametersBucket`
|
|
25
|
+
* when a component recipe in the section actually needs them. They live
|
|
26
|
+
* under the section folder so they inherit positional context but get
|
|
27
|
+
* the default `FOLDER_ICON` (no per-bucket rich fields by design).
|
|
28
|
+
*
|
|
29
|
+
* The Available Renderings item (#6) is emitted by the cross-recipe
|
|
30
|
+
* aggregate `buildAvailableRenderingsAggregate` in `compile.ts`; it
|
|
31
|
+
* reads sections via the same `sectionsByHandle` map and applies the
|
|
32
|
+
* section recipe's `displayName` to the toolbox label.
|
|
33
|
+
*/
|
|
34
|
+
export declare function compileComponentSectionRecipe(input: ComponentSectionRecipe, context: CompileContext, emittedFolders?: Set<string>): OperationIr;
|
|
35
|
+
/**
|
|
36
|
+
* Look up a `ComponentSectionRecipe` by handle. Throws INPUT_INVALID
|
|
37
|
+
* with a helpful hint when a component references a section handle no
|
|
38
|
+
* `ComponentSectionRecipe` in the set provides — this is the
|
|
39
|
+
* cross-recipe validation that closes the implicit-fallback gap the
|
|
40
|
+
* old `section: string` field had.
|
|
41
|
+
*
|
|
42
|
+
* `consumerHandle` is the recipe doing the lookup (used in the error
|
|
43
|
+
* message so authors can locate the source of the bad reference).
|
|
44
|
+
*/
|
|
45
|
+
export declare const resolveSectionRecipe: (consumerHandle: string, sectionHandle: string, sectionsByHandle: ReadonlyMap<string, ComponentSectionRecipe> | undefined) => ComponentSectionRecipe;
|
|
46
|
+
//# sourceMappingURL=component-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-section.d.ts","sourceRoot":"","sources":["../../../src/recipe/compile/component-section.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,WAAW,EAEjB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EACL,KAAK,sBAAsB,EAE5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,cAAc,EACvB,cAAc,GAAE,GAAG,CAAC,MAAM,CAAa,GACtC,WAAW,CAyFb;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,MAAM,EACtB,eAAe,MAAM,EACrB,kBAAkB,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAAG,SAAS,KACxE,sBAYF,CAAC"}
|