@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,495 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAuthoringClient = void 0;
|
|
4
|
+
const errors_1 = require("../../shared/errors");
|
|
5
|
+
const cli_tasks_1 = require("../../shared/cli-tasks");
|
|
6
|
+
const graphql_1 = require("../../shared/graphql");
|
|
7
|
+
const sitecore_templates_1 = require("../ir/sitecore-templates");
|
|
8
|
+
const ref_encoding_1 = require("./ref-encoding");
|
|
9
|
+
const graphql_2 = require("./graphql");
|
|
10
|
+
/** Sitecore itemIds are uuids — bare or wrapped in curly braces. Anything
|
|
11
|
+
* that doesn't look like one is treated as a content-tree path. */
|
|
12
|
+
const GUID_PATTERN = /^\{?[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}\}?$/i;
|
|
13
|
+
const isItemId = (value) => GUID_PATTERN.test(value.trim());
|
|
14
|
+
/**
|
|
15
|
+
* Pick the folder template scai will auto-create missing parent path
|
|
16
|
+
* segments under. Conventional SXA template per tree:
|
|
17
|
+
*
|
|
18
|
+
* - `/sitecore/templates/...` → `Template Folder` (the SXA editor
|
|
19
|
+
* treats these as templates-tree
|
|
20
|
+
* organisational nodes)
|
|
21
|
+
* - `/sitecore/layout/Renderings/...` → `Rendering Folder` (verified
|
|
22
|
+
* against live tenant — section
|
|
23
|
+
* folders under
|
|
24
|
+
* `/sitecore/layout/Renderings/Project/<site>/`
|
|
25
|
+
* all conform to this template,
|
|
26
|
+
* not generic `Folder`)
|
|
27
|
+
* - `.../Presentation/Headless Variants/...`
|
|
28
|
+
* → `HeadlessVariantsGrouping` (every
|
|
29
|
+
* folder under a site's Headless
|
|
30
|
+
* Variants tree — section
|
|
31
|
+
* groupings like `UI`, `Layout`,
|
|
32
|
+
* etc. — must conform to this
|
|
33
|
+
* template, otherwise SXA's editor
|
|
34
|
+
* won't enumerate the variants
|
|
35
|
+
* underneath. Per-rendering folders
|
|
36
|
+
* (`<root>/UI/AvatarBlock`) are
|
|
37
|
+
* always emitted explicitly with
|
|
38
|
+
* `HEADLESS_VARIANTS`, so this
|
|
39
|
+
* fallback only fires for the
|
|
40
|
+
* section-grouping depth.)
|
|
41
|
+
* - everything else → generic `Folder`
|
|
42
|
+
*
|
|
43
|
+
* Picking the wrong template here doesn't break createItem itself, but
|
|
44
|
+
* it can leave SXA's editor UI unable to recognise the auto-created
|
|
45
|
+
* folder when walking the tree.
|
|
46
|
+
*
|
|
47
|
+
* Hazard fixed by the Headless Variants branch: a previous scai version
|
|
48
|
+
* emitted variant items before the explicit section-grouping CreateItem
|
|
49
|
+
* was added. Tenants pushed under that version got their `UI` /
|
|
50
|
+
* `Layout` / etc. section folders auto-created here as generic
|
|
51
|
+
* `Folder`. Subsequent runs emit the section grouping with
|
|
52
|
+
* `HEADLESS_VARIANTS_GROUPING`, but `CreateOnly` policy skips updating
|
|
53
|
+
* the existing item, so the wrong template persists. Detecting the
|
|
54
|
+
* tree here at least keeps NEW installs correct; existing tenants
|
|
55
|
+
* still need a manual delete-and-republish (or a future template-
|
|
56
|
+
* correction migration) to fix the stale folder.
|
|
57
|
+
*/
|
|
58
|
+
const folderTemplateForPath = (path) => {
|
|
59
|
+
const normalized = path.toLowerCase();
|
|
60
|
+
if (normalized.startsWith("/sitecore/templates/")) {
|
|
61
|
+
return sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FOLDER;
|
|
62
|
+
}
|
|
63
|
+
if (normalized.startsWith("/sitecore/layout/renderings/")) {
|
|
64
|
+
return sitecore_templates_1.SITECORE_TEMPLATES.RENDERING_FOLDER;
|
|
65
|
+
}
|
|
66
|
+
if (normalized.includes("/presentation/headless variants/")) {
|
|
67
|
+
return sitecore_templates_1.SITECORE_TEMPLATES.HEADLESS_VARIANTS_GROUPING;
|
|
68
|
+
}
|
|
69
|
+
return sitecore_templates_1.SITECORE_TEMPLATES.FOLDER;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Production `AuthoringApiClient` against Sitecore Authoring GraphQL.
|
|
73
|
+
*
|
|
74
|
+
* Schema verified against XM Cloud Authoring API via introspection
|
|
75
|
+
* (2026-04-30). Notable shape facts:
|
|
76
|
+
*
|
|
77
|
+
* - `Item.parent` and `Item.template` are sub-objects (not flat scalars).
|
|
78
|
+
* - `CreateItemInput` does NOT accept `itemId` — Sitecore assigns IDs
|
|
79
|
+
* server-side. The `createItem` response is the source of truth.
|
|
80
|
+
* - `FieldValueInput` is `{ name, value, reset? }`; per-field language /
|
|
81
|
+
* version are not supported here (set at the input level via
|
|
82
|
+
* `CreateItemInput.language`).
|
|
83
|
+
*/
|
|
84
|
+
const ITEM_FRAGMENT = `
|
|
85
|
+
itemId
|
|
86
|
+
name
|
|
87
|
+
path
|
|
88
|
+
parent {
|
|
89
|
+
itemId
|
|
90
|
+
}
|
|
91
|
+
template {
|
|
92
|
+
templateId
|
|
93
|
+
}
|
|
94
|
+
fields(ownFields: false) {
|
|
95
|
+
nodes {
|
|
96
|
+
name
|
|
97
|
+
value
|
|
98
|
+
templateField {
|
|
99
|
+
templateFieldId
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
const GET_ITEM_BY_PATH = `
|
|
105
|
+
query($path: String!) {
|
|
106
|
+
item(where: { path: $path }) {
|
|
107
|
+
${ITEM_FRAGMENT}
|
|
108
|
+
}
|
|
109
|
+
}`;
|
|
110
|
+
const GET_ITEM_BY_ID = `
|
|
111
|
+
query($itemId: ID!) {
|
|
112
|
+
item(where: { itemId: $itemId }) {
|
|
113
|
+
${ITEM_FRAGMENT}
|
|
114
|
+
}
|
|
115
|
+
}`;
|
|
116
|
+
const GET_CHILDREN_BY_PATH = `
|
|
117
|
+
query($path: String!) {
|
|
118
|
+
item(where: { path: $path }) {
|
|
119
|
+
children {
|
|
120
|
+
nodes {
|
|
121
|
+
${ITEM_FRAGMENT}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}`;
|
|
126
|
+
const GET_CHILDREN_BY_ID = `
|
|
127
|
+
query($itemId: ID!) {
|
|
128
|
+
item(where: { itemId: $itemId }) {
|
|
129
|
+
children {
|
|
130
|
+
nodes {
|
|
131
|
+
${ITEM_FRAGMENT}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}`;
|
|
136
|
+
const CREATE_ITEM_MUTATION = `
|
|
137
|
+
mutation($input: CreateItemInput!) {
|
|
138
|
+
createItem(input: $input) {
|
|
139
|
+
item {
|
|
140
|
+
itemId
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}`;
|
|
144
|
+
const UPDATE_ITEM_MUTATION = `
|
|
145
|
+
mutation($input: UpdateItemInput!) {
|
|
146
|
+
updateItem(input: $input) {
|
|
147
|
+
item {
|
|
148
|
+
itemId
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}`;
|
|
152
|
+
const DELETE_ITEM_MUTATION = `
|
|
153
|
+
mutation($input: DeleteItemInput!) {
|
|
154
|
+
deleteItem(input: $input) {
|
|
155
|
+
successful
|
|
156
|
+
}
|
|
157
|
+
}`;
|
|
158
|
+
const toRemoteItem = (node) => ({
|
|
159
|
+
itemId: node.itemId,
|
|
160
|
+
name: node.name,
|
|
161
|
+
path: node.path,
|
|
162
|
+
parentId: node.parent?.itemId ?? "",
|
|
163
|
+
templateId: node.template?.templateId ?? "",
|
|
164
|
+
// The Authoring API returns `field.name` as the field's display name
|
|
165
|
+
// (e.g. "__Icon", "componentName"). Drift detection prefers the recipe
|
|
166
|
+
// op's `fieldName` when present (recipe-created fields whose GUIDs the
|
|
167
|
+
// tenant doesn't recognize); else falls back to the field's GUID at
|
|
168
|
+
// `field.templateField.templateFieldId`. Sitecore normalizes those GUIDs
|
|
169
|
+
// without dashes, so re-format to canonical 8-4-4-4-12.
|
|
170
|
+
fields: node.fields.nodes
|
|
171
|
+
.filter((field) => field.templateField?.templateFieldId)
|
|
172
|
+
.map((field) => ({
|
|
173
|
+
fieldId: (0, ref_encoding_1.dashifyGuid)(field.templateField.templateFieldId),
|
|
174
|
+
name: field.name,
|
|
175
|
+
value: field.value,
|
|
176
|
+
})),
|
|
177
|
+
});
|
|
178
|
+
const toAuthoringFieldsInput = (fields) => fields.map((field) => ({
|
|
179
|
+
// Sitecore's `FieldValueInput.name` accepts a field name OR id. For
|
|
180
|
+
// recipe-created fields, the IR's `fieldId` is only a uuidv5 refKey
|
|
181
|
+
// (the tenant's server-assigned GUID is different) — fall through to
|
|
182
|
+
// `fieldName`, which Sitecore resolves against the item's template.
|
|
183
|
+
// For system fields without a `fieldName`, the literal GUID works.
|
|
184
|
+
name: field.fieldName ?? field.fieldId,
|
|
185
|
+
value: (0, ref_encoding_1.renderRefValue)(field.value),
|
|
186
|
+
}));
|
|
187
|
+
const DEFAULT_BATCH_READ_SIZE = 25;
|
|
188
|
+
const DEFAULT_BATCH_READ_CONCURRENCY = 4;
|
|
189
|
+
const createAuthoringClient = (options) => {
|
|
190
|
+
const { environment, request, pathItemIdCache } = options;
|
|
191
|
+
const batchSize = options.batchedReadSize ?? DEFAULT_BATCH_READ_SIZE;
|
|
192
|
+
const batchConcurrency = options.batchedReadConcurrency ?? DEFAULT_BATCH_READ_CONCURRENCY;
|
|
193
|
+
/**
|
|
194
|
+
* Per-call request options for read operations — extends caller-supplied
|
|
195
|
+
* `request` with the broad retry status set. Reads are idempotent so
|
|
196
|
+
* retrying through 500/502/504 is safe and absorbs transient gateway
|
|
197
|
+
* errors without aborting the whole push.
|
|
198
|
+
*/
|
|
199
|
+
const readRequest = {
|
|
200
|
+
...request,
|
|
201
|
+
retry: { ...request?.retry, retryableStatuses: graphql_1.READ_RETRYABLE_STATUSES },
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Per-call request options for write operations — uses the conservative
|
|
205
|
+
* default retry set (just throttle / never-reached-origin codes:
|
|
206
|
+
* 408/425/429/503). A 500/502/504 may indicate the server processed
|
|
207
|
+
* the request but failed to respond; retrying would create a duplicate
|
|
208
|
+
* with no idempotency key. The recipe rollback flow recovers from
|
|
209
|
+
* partial-write states by replay, not by silent retries.
|
|
210
|
+
*/
|
|
211
|
+
const writeRequest = request ?? {};
|
|
212
|
+
const fetchOne = async (selector) => {
|
|
213
|
+
if (selector.itemId) {
|
|
214
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, GET_ITEM_BY_ID, { itemId: selector.itemId }, readRequest);
|
|
215
|
+
return data.item;
|
|
216
|
+
}
|
|
217
|
+
if (selector.path) {
|
|
218
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, GET_ITEM_BY_PATH, { path: selector.path }, readRequest);
|
|
219
|
+
return data.item;
|
|
220
|
+
}
|
|
221
|
+
throw (0, errors_1.createCliError)("ItemSelector requires either path or itemId.", "INPUT_INVALID");
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Batched path→item read using GraphQL aliased fields. One POST returns
|
|
225
|
+
* up to `batchSize` items. Aliasing format:
|
|
226
|
+
*
|
|
227
|
+
* query Batch($p0: String!, $p1: String!, ...) {
|
|
228
|
+
* i0: item(where: { path: $p0 }) { ...ItemFragment }
|
|
229
|
+
* i1: item(where: { path: $p1 }) { ...ItemFragment }
|
|
230
|
+
* ...
|
|
231
|
+
* }
|
|
232
|
+
*
|
|
233
|
+
* Aliases are stable per call (`i0`, `i1`, ...) so the response object
|
|
234
|
+
* keys map cleanly back to the input slice. Missing items return
|
|
235
|
+
* `null` under their alias — same shape as a single-path 404.
|
|
236
|
+
*/
|
|
237
|
+
const fetchOneBatch = async (paths) => {
|
|
238
|
+
if (paths.length === 0)
|
|
239
|
+
return [];
|
|
240
|
+
const variableDecls = paths.map((_, i) => `$p${i}: String!`).join(", ");
|
|
241
|
+
const aliasedSelections = paths
|
|
242
|
+
.map((_, i) => `
|
|
243
|
+
i${i}: item(where: { path: $p${i} }) {
|
|
244
|
+
${ITEM_FRAGMENT}
|
|
245
|
+
}`)
|
|
246
|
+
.join("");
|
|
247
|
+
const query = `query Batch(${variableDecls}) {${aliasedSelections}\n}`;
|
|
248
|
+
const variables = {};
|
|
249
|
+
for (let i = 0; i < paths.length; i += 1) {
|
|
250
|
+
variables[`p${i}`] = paths[i];
|
|
251
|
+
}
|
|
252
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, query, variables, readRequest);
|
|
253
|
+
return paths.map((_, i) => data[`i${i}`] ?? null);
|
|
254
|
+
};
|
|
255
|
+
const fetchChildren = async (selector) => {
|
|
256
|
+
if (selector.itemId) {
|
|
257
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, GET_CHILDREN_BY_ID, { itemId: selector.itemId }, readRequest);
|
|
258
|
+
return data.item?.children.nodes ?? [];
|
|
259
|
+
}
|
|
260
|
+
if (selector.path) {
|
|
261
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, GET_CHILDREN_BY_PATH, { path: selector.path }, readRequest);
|
|
262
|
+
return data.item?.children.nodes ?? [];
|
|
263
|
+
}
|
|
264
|
+
throw (0, errors_1.createCliError)("ItemSelector requires either path or itemId.", "INPUT_INVALID");
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Walk the content-tree path bottom-up, returning the itemId of `path`.
|
|
268
|
+
* Creates any missing segments using `folderTemplateForPath`. Recursive
|
|
269
|
+
* — each level either finds an existing item OR creates one and walks
|
|
270
|
+
* up further. The Sitecore root (`/sitecore`) MUST already exist; any
|
|
271
|
+
* path that bottoms out before reaching an existing ancestor throws.
|
|
272
|
+
*
|
|
273
|
+
* Used by `createItem` to satisfy Authoring GraphQL's
|
|
274
|
+
* `CreateItemInput.parent: ID!` typing — callers pass paths, scai
|
|
275
|
+
* resolves to itemIds (auto-provisioning the SXA-style folder chain
|
|
276
|
+
* if the tenant's per-site templates/renderings/content folders
|
|
277
|
+
* haven't been scaffolded yet).
|
|
278
|
+
*/
|
|
279
|
+
const ensurePathExists = async (rawPath) => {
|
|
280
|
+
const path = rawPath.replace(/\/+$/, "");
|
|
281
|
+
// Fast path: caller (or an earlier ensurePathExists) already resolved
|
|
282
|
+
// this path. Avoids the redundant `getItem` round trip every sibling
|
|
283
|
+
// createItem would otherwise pay under a shared section folder.
|
|
284
|
+
const cached = pathItemIdCache?.get(path);
|
|
285
|
+
if (cached)
|
|
286
|
+
return cached;
|
|
287
|
+
const existing = await fetchOne({ path });
|
|
288
|
+
if (existing) {
|
|
289
|
+
pathItemIdCache?.set(path, existing.itemId);
|
|
290
|
+
return existing.itemId;
|
|
291
|
+
}
|
|
292
|
+
const lastSlash = path.lastIndexOf("/");
|
|
293
|
+
if (lastSlash <= 0) {
|
|
294
|
+
throw (0, errors_1.createCliError)(`Cannot auto-create root path '${path}'. The Sitecore root must already exist on the tenant.`, "INPUT_INVALID");
|
|
295
|
+
}
|
|
296
|
+
const parentPath = path.slice(0, lastSlash);
|
|
297
|
+
const name = path.slice(lastSlash + 1);
|
|
298
|
+
if (!name) {
|
|
299
|
+
throw (0, errors_1.createCliError)(`Path '${rawPath}' has no leaf segment to create.`, "INPUT_INVALID");
|
|
300
|
+
}
|
|
301
|
+
const parentItemId = await ensurePathExists(parentPath);
|
|
302
|
+
const templateId = folderTemplateForPath(path);
|
|
303
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, CREATE_ITEM_MUTATION, {
|
|
304
|
+
input: {
|
|
305
|
+
parent: parentItemId,
|
|
306
|
+
templateId,
|
|
307
|
+
name,
|
|
308
|
+
database: "master",
|
|
309
|
+
language: "en",
|
|
310
|
+
fields: [],
|
|
311
|
+
},
|
|
312
|
+
}, writeRequest);
|
|
313
|
+
const itemId = data.createItem?.item?.itemId;
|
|
314
|
+
if (!itemId) {
|
|
315
|
+
throw (0, errors_1.createCliError)(`Auto-provisioning failed: Authoring API returned no itemId after creating folder '${path}'.`, "UNKNOWN");
|
|
316
|
+
}
|
|
317
|
+
pathItemIdCache?.set(path, itemId);
|
|
318
|
+
return itemId;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Detect Sitecore's name-conflict error class. Authoring GraphQL
|
|
322
|
+
* surfaces these as wrapped CliError messages of the form:
|
|
323
|
+
*
|
|
324
|
+
* `Authoring GraphQL errors: The item name "X" is already defined on this level.`
|
|
325
|
+
*
|
|
326
|
+
* The variant `"is not unique"` and `"already exists"` are also
|
|
327
|
+
* known phrasings on adjacent server versions; match permissively
|
|
328
|
+
* so our idempotent-create fallback covers them all.
|
|
329
|
+
*/
|
|
330
|
+
const isAlreadyExistsError = (error) => {
|
|
331
|
+
if (!(error instanceof Error))
|
|
332
|
+
return false;
|
|
333
|
+
const msg = error.message;
|
|
334
|
+
return (/already defined on this level/i.test(msg) ||
|
|
335
|
+
/is not unique/i.test(msg) ||
|
|
336
|
+
/already exists/i.test(msg) ||
|
|
337
|
+
/name is already in use/i.test(msg));
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Look up a single direct child of `parentItemId` by name. Used by
|
|
341
|
+
* the idempotent-create fallback when `createItem` reports a
|
|
342
|
+
* name conflict — the parent-child relationship is not subject to
|
|
343
|
+
* Sitecore's path-index propagation lag, so this returns the
|
|
344
|
+
* correct existing item even when `getItem({path})` for the same
|
|
345
|
+
* path still reports null.
|
|
346
|
+
*/
|
|
347
|
+
const findChildByName = async (parentItemId, name) => {
|
|
348
|
+
const children = await fetchChildren({ itemId: parentItemId });
|
|
349
|
+
return children.find((c) => c.name === name) ?? null;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Resolve a `CreateItemInput.parent` value (itemId GUID OR content-tree
|
|
353
|
+
* path) to a Sitecore itemId. The Authoring API's
|
|
354
|
+
* `CreateItemInput.parent` is typed `ID!`, so paths must be resolved
|
|
355
|
+
* before the mutation — otherwise GraphQL fails with
|
|
356
|
+
* "Unable to convert type from String to Guid". Missing path segments
|
|
357
|
+
* are auto-created as folders.
|
|
358
|
+
*/
|
|
359
|
+
const resolveParentItemId = async (parent) => {
|
|
360
|
+
const trimmed = parent.trim();
|
|
361
|
+
if (isItemId(trimmed))
|
|
362
|
+
return trimmed.replace(/[{}]/g, "");
|
|
363
|
+
if (trimmed.startsWith("/"))
|
|
364
|
+
return ensurePathExists(trimmed);
|
|
365
|
+
throw (0, errors_1.createCliError)(`createItem.input.parent must be a Sitecore itemId or content-tree path; got: '${trimmed}'.`, "INPUT_INVALID");
|
|
366
|
+
};
|
|
367
|
+
return {
|
|
368
|
+
async getItem(selector, _options) {
|
|
369
|
+
const node = await fetchOne(selector);
|
|
370
|
+
return node ? toRemoteItem(node) : null;
|
|
371
|
+
},
|
|
372
|
+
async getItemsByPaths(paths) {
|
|
373
|
+
const result = new Map();
|
|
374
|
+
if (paths.length === 0)
|
|
375
|
+
return result;
|
|
376
|
+
// De-duplicate within a single call so repeated paths don't
|
|
377
|
+
// cost extra wire bytes; preserve the original strings for the
|
|
378
|
+
// returned map (caller-key contract).
|
|
379
|
+
const unique = [];
|
|
380
|
+
const seen = new Set();
|
|
381
|
+
for (const p of paths) {
|
|
382
|
+
if (!seen.has(p)) {
|
|
383
|
+
seen.add(p);
|
|
384
|
+
unique.push(p);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
const batches = [];
|
|
388
|
+
for (let i = 0; i < unique.length; i += batchSize) {
|
|
389
|
+
batches.push(unique.slice(i, i + batchSize));
|
|
390
|
+
}
|
|
391
|
+
const batchResults = await (0, cli_tasks_1.mapWithConcurrency)(batches, (batch) => fetchOneBatch(batch), batchConcurrency);
|
|
392
|
+
for (let b = 0; b < batches.length; b += 1) {
|
|
393
|
+
const batch = batches[b];
|
|
394
|
+
const nodes = batchResults[b];
|
|
395
|
+
for (let i = 0; i < batch.length; i += 1) {
|
|
396
|
+
const path = batch[i];
|
|
397
|
+
const node = nodes[i];
|
|
398
|
+
const item = node ? toRemoteItem(node) : null;
|
|
399
|
+
result.set(path, item);
|
|
400
|
+
// Side-effect: seed the path → itemId cache used by the
|
|
401
|
+
// recipe executor's `ensurePathExists` and parent-resolution
|
|
402
|
+
// fast paths. Skips writing nulls — `null` means "checked
|
|
403
|
+
// and missing", and ensurePathExists distinguishes "not
|
|
404
|
+
// cached" (must check) from "cached as missing" by re-reading
|
|
405
|
+
// anyway when it auto-creates.
|
|
406
|
+
if (item && pathItemIdCache && !pathItemIdCache.has(path)) {
|
|
407
|
+
pathItemIdCache.set(path, item.itemId);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
// Re-emit caller-input keys (caller may have passed dupes — same
|
|
412
|
+
// value mapping back applies).
|
|
413
|
+
for (const p of paths) {
|
|
414
|
+
if (!result.has(p)) {
|
|
415
|
+
// Should not happen given the loop above + de-dupe, but defend.
|
|
416
|
+
result.set(p, null);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return result;
|
|
420
|
+
},
|
|
421
|
+
async getChildren(parent, _options) {
|
|
422
|
+
const nodes = await fetchChildren(parent);
|
|
423
|
+
return nodes.map(toRemoteItem);
|
|
424
|
+
},
|
|
425
|
+
async createItem(input) {
|
|
426
|
+
const parentItemId = await resolveParentItemId(input.parent);
|
|
427
|
+
try {
|
|
428
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, CREATE_ITEM_MUTATION, {
|
|
429
|
+
input: {
|
|
430
|
+
parent: parentItemId,
|
|
431
|
+
templateId: input.templateId,
|
|
432
|
+
name: input.name,
|
|
433
|
+
database: input.database ?? "master",
|
|
434
|
+
language: input.language ?? "en",
|
|
435
|
+
fields: toAuthoringFieldsInput(input.fields),
|
|
436
|
+
},
|
|
437
|
+
}, writeRequest);
|
|
438
|
+
const itemId = data.createItem?.item?.itemId;
|
|
439
|
+
if (!itemId) {
|
|
440
|
+
throw (0, errors_1.createCliError)("createItem returned no itemId — Authoring API response was malformed.", "UNKNOWN");
|
|
441
|
+
}
|
|
442
|
+
return { itemId };
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
// Idempotent-create fallback for the recurring "name already defined
|
|
446
|
+
// on this level" failure mode. Sitecore's path index (used by
|
|
447
|
+
// `getItem({path})` and the workspace prefetch) lags writes by
|
|
448
|
+
// seconds-to-minutes — so a planner that checks-by-path and sees
|
|
449
|
+
// "missing" can plan a create against a path that the tenant
|
|
450
|
+
// actually already has, either from an earlier op in the same
|
|
451
|
+
// push or from a previous push. The parent-child storage is
|
|
452
|
+
// not lag-prone, so we fall through to `getChildren(parent)`
|
|
453
|
+
// to locate the existing item by name and return its itemId
|
|
454
|
+
// as if the create succeeded. The caller's `dispatchMutation`
|
|
455
|
+
// captures it normally; for `CreateOnly` ops this is the
|
|
456
|
+
// intended behavior, for `CreateAndUpdate` we accept that the
|
|
457
|
+
// existing item's fields aren't updated in this push (the
|
|
458
|
+
// next push's prefetch will see the item via path lookup, the
|
|
459
|
+
// planner takes the update branch, and drift gets corrected).
|
|
460
|
+
if (isAlreadyExistsError(error)) {
|
|
461
|
+
const existing = await findChildByName(parentItemId, input.name);
|
|
462
|
+
if (existing) {
|
|
463
|
+
return { itemId: existing.itemId };
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
throw error;
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
async updateItem(input) {
|
|
470
|
+
await (0, graphql_2.runAuthoringGraphQL)(environment, UPDATE_ITEM_MUTATION, {
|
|
471
|
+
input: {
|
|
472
|
+
itemId: input.itemId,
|
|
473
|
+
fields: toAuthoringFieldsInput(input.fields),
|
|
474
|
+
},
|
|
475
|
+
}, writeRequest);
|
|
476
|
+
},
|
|
477
|
+
async deleteItem(selector) {
|
|
478
|
+
// `permanently: true` skips the recycle bin — rollback and integration
|
|
479
|
+
// cleanup both want full removal. Default-false would leave items
|
|
480
|
+
// discoverable by path under /sitecore/content/Recycle Bin.
|
|
481
|
+
const input = { permanently: true };
|
|
482
|
+
if (selector.itemId)
|
|
483
|
+
input.itemId = selector.itemId;
|
|
484
|
+
else if (selector.path)
|
|
485
|
+
input.path = selector.path;
|
|
486
|
+
else
|
|
487
|
+
throw (0, errors_1.createCliError)("deleteItem requires either path or itemId.", "INPUT_INVALID");
|
|
488
|
+
const data = await (0, graphql_2.runAuthoringGraphQL)(environment, DELETE_ITEM_MUTATION, { input }, writeRequest);
|
|
489
|
+
if (!data.deleteItem?.successful) {
|
|
490
|
+
throw (0, errors_1.createCliError)(`deleteItem returned successful: ${data.deleteItem?.successful} for ${selector.itemId ?? selector.path ?? "(no selector)"}`, "UNKNOWN");
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
exports.createAuthoringClient = createAuthoringClient;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoring API client surface for recipe execution.
|
|
3
|
+
*
|
|
4
|
+
* The Sitecore Authoring API server-assigns itemIds on `createItem` —
|
|
5
|
+
* we cannot specify them. The recipe push therefore uses **paths** as
|
|
6
|
+
* the identity hook: each CreateItem op carries a deterministic path
|
|
7
|
+
* (`<templatesRoot>/<recipe.name>/...`) that the planner uses for
|
|
8
|
+
* lookup, and the `createItem` mutation returns the assigned itemId,
|
|
9
|
+
* which the executor caches in a per-run map keyed by recipe-internal
|
|
10
|
+
* uuidv5 refKey for cross-reference resolution.
|
|
11
|
+
*
|
|
12
|
+
* The IR planner and executor depend only on this interface. Production
|
|
13
|
+
* runs use `createAuthoringClient` from `./authoring-client`; tests
|
|
14
|
+
* inject a mock — same seam either way.
|
|
15
|
+
*/
|
|
16
|
+
import type { FieldValue } from "../ir/operations";
|
|
17
|
+
export interface RemoteFieldValue {
|
|
18
|
+
fieldId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Field name as defined on the template (e.g. `Body`, `__Display Name`).
|
|
21
|
+
* Real `getItem` responses always carry this; optional in the type so
|
|
22
|
+
* that test mocks aren't forced to populate it for fieldId-only
|
|
23
|
+
* scenarios. The planner prefers name-based matching when the IR's
|
|
24
|
+
* SetField op carries a `fieldName` (recipe-created fields whose
|
|
25
|
+
* recipe-derived GUID is only an IR-internal refKey).
|
|
26
|
+
*/
|
|
27
|
+
name?: string;
|
|
28
|
+
/** Sitecore returns the raw stored value (string), regardless of field type. */
|
|
29
|
+
value: string;
|
|
30
|
+
/** Versioned fields carry these; shared fields do not. */
|
|
31
|
+
language?: string;
|
|
32
|
+
version?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface RemoteItem {
|
|
35
|
+
itemId: string;
|
|
36
|
+
templateId: string;
|
|
37
|
+
parentId: string;
|
|
38
|
+
name: string;
|
|
39
|
+
/** Sitecore content-tree path of the item, e.g. `/sitecore/templates/...`. */
|
|
40
|
+
path: string;
|
|
41
|
+
fields: RemoteFieldValue[];
|
|
42
|
+
}
|
|
43
|
+
/** Item lookup selector — Sitecore accepts either a path or a GUID id. */
|
|
44
|
+
export interface ItemSelector {
|
|
45
|
+
path?: string;
|
|
46
|
+
itemId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface CreateItemInput {
|
|
49
|
+
/** Parent path (e.g. `/sitecore/templates/Project`) or parent item GUID. */
|
|
50
|
+
parent: string;
|
|
51
|
+
templateId: string;
|
|
52
|
+
name: string;
|
|
53
|
+
/** Defaults to "master" if unset. */
|
|
54
|
+
database?: string;
|
|
55
|
+
/** Default language for versioned fields; defaults to "en". */
|
|
56
|
+
language?: string;
|
|
57
|
+
fields: FieldValue[];
|
|
58
|
+
}
|
|
59
|
+
export interface CreateItemResult {
|
|
60
|
+
/** Sitecore-assigned itemId (UUID without curly braces). */
|
|
61
|
+
itemId: string;
|
|
62
|
+
}
|
|
63
|
+
export interface UpdateItemInput {
|
|
64
|
+
itemId: string;
|
|
65
|
+
fields: FieldValue[];
|
|
66
|
+
}
|
|
67
|
+
export interface GetItemOptions {
|
|
68
|
+
/** Languages to fetch versioned fields for. Default: `["en"]`. */
|
|
69
|
+
languages?: string[];
|
|
70
|
+
}
|
|
71
|
+
export interface AuthoringApiClient {
|
|
72
|
+
/**
|
|
73
|
+
* Resolve an item by path or by Sitecore-assigned itemId. Returns
|
|
74
|
+
* `null` when the item does not exist.
|
|
75
|
+
*/
|
|
76
|
+
getItem(selector: ItemSelector, options?: GetItemOptions): Promise<RemoteItem | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Resolve many items at once by path. Returns a Map keyed by the SAME
|
|
79
|
+
* string the caller passed in (case-preserved) — value is the
|
|
80
|
+
* `RemoteItem` if found, `null` if the item does not exist on the
|
|
81
|
+
* tenant. Implementations should batch wire calls (e.g. via aliased
|
|
82
|
+
* GraphQL fields) so an N-path request is one or a small number of
|
|
83
|
+
* round trips, not N round trips. Used by the recipe executor's
|
|
84
|
+
* workspace-wide prefetch to populate the path → item snapshot cache
|
|
85
|
+
* before the per-op plan loop.
|
|
86
|
+
*/
|
|
87
|
+
getItemsByPaths(paths: readonly string[]): Promise<Map<string, RemoteItem | null>>;
|
|
88
|
+
/** List immediate children of `parent` (selectable by path or itemId). */
|
|
89
|
+
getChildren(parent: ItemSelector, options?: GetItemOptions): Promise<RemoteItem[]>;
|
|
90
|
+
/**
|
|
91
|
+
* Create the item at `input.parent` / `input.name`. The Authoring API
|
|
92
|
+
* assigns the itemId server-side and returns it.
|
|
93
|
+
*/
|
|
94
|
+
createItem(input: CreateItemInput): Promise<CreateItemResult>;
|
|
95
|
+
updateItem(input: UpdateItemInput): Promise<void>;
|
|
96
|
+
/** Phase 4 policy `CreateUpdateAndDelete` will use this. */
|
|
97
|
+
deleteItem(selector: ItemSelector): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/recipe/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACtF;;;;;;;;;OASG;IACH,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;IACnF,0EAA0E;IAC1E,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACnF;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC9D,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,4DAA4D;IAC5D,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Authoring API client surface for recipe execution.
|
|
4
|
+
*
|
|
5
|
+
* The Sitecore Authoring API server-assigns itemIds on `createItem` —
|
|
6
|
+
* we cannot specify them. The recipe push therefore uses **paths** as
|
|
7
|
+
* the identity hook: each CreateItem op carries a deterministic path
|
|
8
|
+
* (`<templatesRoot>/<recipe.name>/...`) that the planner uses for
|
|
9
|
+
* lookup, and the `createItem` mutation returns the assigned itemId,
|
|
10
|
+
* which the executor caches in a per-run map keyed by recipe-internal
|
|
11
|
+
* uuidv5 refKey for cross-reference resolution.
|
|
12
|
+
*
|
|
13
|
+
* The IR planner and executor depend only on this interface. Production
|
|
14
|
+
* runs use `createAuthoringClient` from `./authoring-client`; tests
|
|
15
|
+
* inject a mock — same seam either way.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoring GraphQL transport for recipe execution.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper over `src/shared/graphql.ts` — supplies the Authoring
|
|
5
|
+
* service path and label. Parallels `src/serialization/sitecore-api/graphql.ts`
|
|
6
|
+
* which targets the Management endpoint.
|
|
7
|
+
*
|
|
8
|
+
* XM Cloud Authoring API path. If a SitecoreAI tenant ever exposes the
|
|
9
|
+
* endpoint at a different path, override via `SITECOREAI_AUTHORING_PATH`.
|
|
10
|
+
*/
|
|
11
|
+
import type { EnvironmentConfiguration } from "../../config";
|
|
12
|
+
import { type GraphQLRequestOptions } from "../../shared/graphql";
|
|
13
|
+
export type AuthoringRequestOptions = GraphQLRequestOptions;
|
|
14
|
+
export declare const runAuthoringGraphQL: <T>(environment: EnvironmentConfiguration, query: string, variables?: Record<string, unknown>, options?: AuthoringRequestOptions) => Promise<T>;
|
|
15
|
+
//# sourceMappingURL=graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/recipe/api/graphql.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAsB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAQlF,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAc5D,eAAO,MAAM,mBAAmB,GAAI,CAAC,EACnC,aAAa,wBAAwB,EACrC,OAAO,MAAM,EACb,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,UAAU,uBAAuB,KAChC,OAAO,CAAC,CAAC,CAeT,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Authoring GraphQL transport for recipe execution.
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper over `src/shared/graphql.ts` — supplies the Authoring
|
|
6
|
+
* service path and label. Parallels `src/serialization/sitecore-api/graphql.ts`
|
|
7
|
+
* which targets the Management endpoint.
|
|
8
|
+
*
|
|
9
|
+
* XM Cloud Authoring API path. If a SitecoreAI tenant ever exposes the
|
|
10
|
+
* endpoint at a different path, override via `SITECOREAI_AUTHORING_PATH`.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.runAuthoringGraphQL = void 0;
|
|
14
|
+
const graphql_1 = require("../../shared/graphql");
|
|
15
|
+
const auth_1 = require("./auth");
|
|
16
|
+
const DEFAULT_AUTHORING_PATH = "/sitecore/api/authoring/graphql/v1";
|
|
17
|
+
const resolveAuthoringPath = () => process.env.SITECOREAI_AUTHORING_PATH ?? DEFAULT_AUTHORING_PATH;
|
|
18
|
+
/**
|
|
19
|
+
* Authoring GraphQL retry policy. Default 5 attempts with exponential
|
|
20
|
+
* backoff + jitter (honoring `Retry-After` on 429/503). The recipe
|
|
21
|
+
* executor fans out batched reads and serial mutations against XM
|
|
22
|
+
* Cloud — both paths benefit from absorbing transient throttling /
|
|
23
|
+
* gateway hiccups without aborting the whole push. Mutation idempotency
|
|
24
|
+
* is preserved by the executor's rollback semantics: a "succeeded but
|
|
25
|
+
* lost the response" duplicate retry surfaces as "item already exists",
|
|
26
|
+
* the executor rolls back, and the operator sees the failure.
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_AUTHORING_RETRY = { maxAttempts: 5 };
|
|
29
|
+
const runAuthoringGraphQL = (environment, query, variables, options) => (0, graphql_1.runSitecoreGraphQL)(environment, query, variables, {
|
|
30
|
+
servicePath: resolveAuthoringPath(),
|
|
31
|
+
label: "Authoring",
|
|
32
|
+
requireToken: true,
|
|
33
|
+
getAccessToken: auth_1.getAccessToken,
|
|
34
|
+
}, {
|
|
35
|
+
...options,
|
|
36
|
+
retry: { ...DEFAULT_AUTHORING_RETRY, ...(options?.retry ?? {}) },
|
|
37
|
+
});
|
|
38
|
+
exports.runAuthoringGraphQL = runAuthoringGraphQL;
|