@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.
Files changed (569) hide show
  1. package/AGENTS.md +67 -0
  2. package/LICENSE +21 -0
  3. package/README.md +357 -0
  4. package/bin/sitecoreai-cli +3 -0
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +358 -0
  8. package/dist/commands/config.d.ts +3 -0
  9. package/dist/commands/config.d.ts.map +1 -0
  10. package/dist/commands/config.js +27 -0
  11. package/dist/commands/deploy/deployments.d.ts +3 -0
  12. package/dist/commands/deploy/deployments.d.ts.map +1 -0
  13. package/dist/commands/deploy/deployments.js +58 -0
  14. package/dist/commands/deploy/editing-host.d.ts +3 -0
  15. package/dist/commands/deploy/editing-host.d.ts.map +1 -0
  16. package/dist/commands/deploy/editing-host.js +49 -0
  17. package/dist/commands/deploy/environments/deployments.d.ts +3 -0
  18. package/dist/commands/deploy/environments/deployments.d.ts.map +1 -0
  19. package/dist/commands/deploy/environments/deployments.js +28 -0
  20. package/dist/commands/deploy/environments/index.d.ts +3 -0
  21. package/dist/commands/deploy/environments/index.d.ts.map +1 -0
  22. package/dist/commands/deploy/environments/index.js +29 -0
  23. package/dist/commands/deploy/environments/mutations.d.ts +9 -0
  24. package/dist/commands/deploy/environments/mutations.d.ts.map +1 -0
  25. package/dist/commands/deploy/environments/mutations.js +103 -0
  26. package/dist/commands/deploy/environments/queries.d.ts +7 -0
  27. package/dist/commands/deploy/environments/queries.d.ts.map +1 -0
  28. package/dist/commands/deploy/environments/queries.js +56 -0
  29. package/dist/commands/deploy/environments/variables.d.ts +3 -0
  30. package/dist/commands/deploy/environments/variables.d.ts.map +1 -0
  31. package/dist/commands/deploy/environments/variables.js +40 -0
  32. package/dist/commands/deploy/environments.d.ts +2 -0
  33. package/dist/commands/deploy/environments.d.ts.map +1 -0
  34. package/dist/commands/deploy/environments.js +17 -0
  35. package/dist/commands/deploy/index.d.ts +3 -0
  36. package/dist/commands/deploy/index.d.ts.map +1 -0
  37. package/dist/commands/deploy/index.js +26 -0
  38. package/dist/commands/deploy/logs.d.ts +3 -0
  39. package/dist/commands/deploy/logs.d.ts.map +1 -0
  40. package/dist/commands/deploy/logs.js +39 -0
  41. package/dist/commands/deploy/organizations.d.ts +3 -0
  42. package/dist/commands/deploy/organizations.d.ts.map +1 -0
  43. package/dist/commands/deploy/organizations.js +29 -0
  44. package/dist/commands/deploy/projects.d.ts +3 -0
  45. package/dist/commands/deploy/projects.d.ts.map +1 -0
  46. package/dist/commands/deploy/projects.js +74 -0
  47. package/dist/commands/deploy/shared.d.ts +3 -0
  48. package/dist/commands/deploy/shared.d.ts.map +1 -0
  49. package/dist/commands/deploy/shared.js +12 -0
  50. package/dist/commands/deploy/site.d.ts +10 -0
  51. package/dist/commands/deploy/site.d.ts.map +1 -0
  52. package/dist/commands/deploy/site.js +36 -0
  53. package/dist/commands/deploy/source-control.d.ts +3 -0
  54. package/dist/commands/deploy/source-control.d.ts.map +1 -0
  55. package/dist/commands/deploy/source-control.js +89 -0
  56. package/dist/commands/deploy.d.ts +2 -0
  57. package/dist/commands/deploy.d.ts.map +1 -0
  58. package/dist/commands/deploy.js +5 -0
  59. package/dist/commands/history.d.ts +3 -0
  60. package/dist/commands/history.d.ts.map +1 -0
  61. package/dist/commands/history.js +88 -0
  62. package/dist/commands/init.d.ts +3 -0
  63. package/dist/commands/init.d.ts.map +1 -0
  64. package/dist/commands/init.js +32 -0
  65. package/dist/commands/login.d.ts +3 -0
  66. package/dist/commands/login.d.ts.map +1 -0
  67. package/dist/commands/login.js +21 -0
  68. package/dist/commands/logout.d.ts +3 -0
  69. package/dist/commands/logout.d.ts.map +1 -0
  70. package/dist/commands/logout.js +18 -0
  71. package/dist/commands/recipe/index.d.ts +3 -0
  72. package/dist/commands/recipe/index.d.ts.map +1 -0
  73. package/dist/commands/recipe/index.js +158 -0
  74. package/dist/commands/serialization/index.d.ts +3 -0
  75. package/dist/commands/serialization/index.d.ts.map +1 -0
  76. package/dist/commands/serialization/index.js +89 -0
  77. package/dist/commands/serialization/package.d.ts +3 -0
  78. package/dist/commands/serialization/package.d.ts.map +1 -0
  79. package/dist/commands/serialization/package.js +36 -0
  80. package/dist/commands/shared.d.ts +21 -0
  81. package/dist/commands/shared.d.ts.map +1 -0
  82. package/dist/commands/shared.js +82 -0
  83. package/dist/commands/shell.d.ts +10 -0
  84. package/dist/commands/shell.d.ts.map +1 -0
  85. package/dist/commands/shell.js +155 -0
  86. package/dist/commands/status.d.ts +3 -0
  87. package/dist/commands/status.d.ts.map +1 -0
  88. package/dist/commands/status.js +15 -0
  89. package/dist/commands/telemetry.d.ts +3 -0
  90. package/dist/commands/telemetry.d.ts.map +1 -0
  91. package/dist/commands/telemetry.js +28 -0
  92. package/dist/config/env-overrides.d.ts +4 -0
  93. package/dist/config/env-overrides.d.ts.map +1 -0
  94. package/dist/config/env-overrides.js +199 -0
  95. package/dist/config/index.d.ts +5 -0
  96. package/dist/config/index.d.ts.map +1 -0
  97. package/dist/config/index.js +13 -0
  98. package/dist/config/modules.d.ts +4 -0
  99. package/dist/config/modules.d.ts.map +1 -0
  100. package/dist/config/modules.js +152 -0
  101. package/dist/config/paths.d.ts +2 -0
  102. package/dist/config/paths.d.ts.map +1 -0
  103. package/dist/config/paths.js +39 -0
  104. package/dist/config/root-config.d.ts +10 -0
  105. package/dist/config/root-config.d.ts.map +1 -0
  106. package/dist/config/root-config.js +159 -0
  107. package/dist/config/schema.json +278 -0
  108. package/dist/config/serialization-module.schema.json +127 -0
  109. package/dist/config/telemetry.schema.json +21 -0
  110. package/dist/config/types.d.ts +245 -0
  111. package/dist/config/types.d.ts.map +1 -0
  112. package/dist/config/types.js +19 -0
  113. package/dist/config/validation.d.ts +10 -0
  114. package/dist/config/validation.d.ts.map +1 -0
  115. package/dist/config/validation.js +43 -0
  116. package/dist/deploy/api/common/headers.d.ts +2 -0
  117. package/dist/deploy/api/common/headers.d.ts.map +1 -0
  118. package/dist/deploy/api/common/headers.js +10 -0
  119. package/dist/deploy/api/common/index.d.ts +4 -0
  120. package/dist/deploy/api/common/index.d.ts.map +1 -0
  121. package/dist/deploy/api/common/index.js +19 -0
  122. package/dist/deploy/api/common/request.d.ts +9 -0
  123. package/dist/deploy/api/common/request.d.ts.map +1 -0
  124. package/dist/deploy/api/common/request.js +253 -0
  125. package/dist/deploy/api/common/types.d.ts +44 -0
  126. package/dist/deploy/api/common/types.d.ts.map +1 -0
  127. package/dist/deploy/api/common/types.js +5 -0
  128. package/dist/deploy/api/common.d.ts +2 -0
  129. package/dist/deploy/api/common.d.ts.map +1 -0
  130. package/dist/deploy/api/common.js +17 -0
  131. package/dist/deploy/api/deployment-logs.d.ts +2 -0
  132. package/dist/deploy/api/deployment-logs.d.ts.map +1 -0
  133. package/dist/deploy/api/deployment-logs.js +23 -0
  134. package/dist/deploy/api/deployments.d.ts +9 -0
  135. package/dist/deploy/api/deployments.d.ts.map +1 -0
  136. package/dist/deploy/api/deployments.js +61 -0
  137. package/dist/deploy/api/environments.d.ts +21 -0
  138. package/dist/deploy/api/environments.d.ts.map +1 -0
  139. package/dist/deploy/api/environments.js +67 -0
  140. package/dist/deploy/api/index.d.ts +9 -0
  141. package/dist/deploy/api/index.d.ts.map +1 -0
  142. package/dist/deploy/api/index.js +24 -0
  143. package/dist/deploy/api/logs.d.ts +8 -0
  144. package/dist/deploy/api/logs.d.ts.map +1 -0
  145. package/dist/deploy/api/logs.js +29 -0
  146. package/dist/deploy/api/organizations.d.ts +6 -0
  147. package/dist/deploy/api/organizations.d.ts.map +1 -0
  148. package/dist/deploy/api/organizations.js +18 -0
  149. package/dist/deploy/api/projects.d.ts +13 -0
  150. package/dist/deploy/api/projects.d.ts.map +1 -0
  151. package/dist/deploy/api/projects.js +42 -0
  152. package/dist/deploy/api/source-control.d.ts +15 -0
  153. package/dist/deploy/api/source-control.d.ts.map +1 -0
  154. package/dist/deploy/api/source-control.js +71 -0
  155. package/dist/deploy/api.d.ts +2 -0
  156. package/dist/deploy/api.d.ts.map +1 -0
  157. package/dist/deploy/api.js +17 -0
  158. package/dist/deploy/tasks/deployment-result.d.ts +6 -0
  159. package/dist/deploy/tasks/deployment-result.d.ts.map +1 -0
  160. package/dist/deploy/tasks/deployment-result.js +36 -0
  161. package/dist/deploy/tasks/deployments.d.ts +10 -0
  162. package/dist/deploy/tasks/deployments.d.ts.map +1 -0
  163. package/dist/deploy/tasks/deployments.js +201 -0
  164. package/dist/deploy/tasks/editing-host.d.ts +28 -0
  165. package/dist/deploy/tasks/editing-host.d.ts.map +1 -0
  166. package/dist/deploy/tasks/editing-host.js +216 -0
  167. package/dist/deploy/tasks/environments.d.ts +20 -0
  168. package/dist/deploy/tasks/environments.d.ts.map +1 -0
  169. package/dist/deploy/tasks/environments.js +364 -0
  170. package/dist/deploy/tasks/index.d.ts +10 -0
  171. package/dist/deploy/tasks/index.d.ts.map +1 -0
  172. package/dist/deploy/tasks/index.js +25 -0
  173. package/dist/deploy/tasks/logs.d.ts +5 -0
  174. package/dist/deploy/tasks/logs.d.ts.map +1 -0
  175. package/dist/deploy/tasks/logs.js +56 -0
  176. package/dist/deploy/tasks/organizations.d.ts +6 -0
  177. package/dist/deploy/tasks/organizations.d.ts.map +1 -0
  178. package/dist/deploy/tasks/organizations.js +51 -0
  179. package/dist/deploy/tasks/projects.d.ts +11 -0
  180. package/dist/deploy/tasks/projects.d.ts.map +1 -0
  181. package/dist/deploy/tasks/projects.js +246 -0
  182. package/dist/deploy/tasks/shared.d.ts +63 -0
  183. package/dist/deploy/tasks/shared.d.ts.map +1 -0
  184. package/dist/deploy/tasks/shared.js +261 -0
  185. package/dist/deploy/tasks/site-bind.d.ts +21 -0
  186. package/dist/deploy/tasks/site-bind.d.ts.map +1 -0
  187. package/dist/deploy/tasks/site-bind.js +142 -0
  188. package/dist/deploy/tasks/site.d.ts +14 -0
  189. package/dist/deploy/tasks/site.d.ts.map +1 -0
  190. package/dist/deploy/tasks/site.js +29 -0
  191. package/dist/deploy/tasks/source-control.d.ts +14 -0
  192. package/dist/deploy/tasks/source-control.d.ts.map +1 -0
  193. package/dist/deploy/tasks/source-control.js +173 -0
  194. package/dist/deploy/tasks/types.d.ts +204 -0
  195. package/dist/deploy/tasks/types.d.ts.map +1 -0
  196. package/dist/deploy/tasks/types.js +7 -0
  197. package/dist/deploy/tasks.d.ts +3 -0
  198. package/dist/deploy/tasks.d.ts.map +1 -0
  199. package/dist/deploy/tasks.js +18 -0
  200. package/dist/recipe/api/auth.d.ts +9 -0
  201. package/dist/recipe/api/auth.d.ts.map +1 -0
  202. package/dist/recipe/api/auth.js +12 -0
  203. package/dist/recipe/api/authoring-client.d.ts +37 -0
  204. package/dist/recipe/api/authoring-client.d.ts.map +1 -0
  205. package/dist/recipe/api/authoring-client.js +495 -0
  206. package/dist/recipe/api/client.d.ts +99 -0
  207. package/dist/recipe/api/client.d.ts.map +1 -0
  208. package/dist/recipe/api/client.js +17 -0
  209. package/dist/recipe/api/graphql.d.ts +15 -0
  210. package/dist/recipe/api/graphql.d.ts.map +1 -0
  211. package/dist/recipe/api/graphql.js +38 -0
  212. package/dist/recipe/api/ref-encoding.d.ts +38 -0
  213. package/dist/recipe/api/ref-encoding.d.ts.map +1 -0
  214. package/dist/recipe/api/ref-encoding.js +160 -0
  215. package/dist/recipe/api/site-discovery.d.ts +49 -0
  216. package/dist/recipe/api/site-discovery.d.ts.map +1 -0
  217. package/dist/recipe/api/site-discovery.js +127 -0
  218. package/dist/recipe/api/sites-client.d.ts +48 -0
  219. package/dist/recipe/api/sites-client.d.ts.map +1 -0
  220. package/dist/recipe/api/sites-client.js +19 -0
  221. package/dist/recipe/cache.d.ts +36 -0
  222. package/dist/recipe/cache.d.ts.map +1 -0
  223. package/dist/recipe/cache.js +114 -0
  224. package/dist/recipe/compile/component-section.d.ts +46 -0
  225. package/dist/recipe/compile/component-section.d.ts.map +1 -0
  226. package/dist/recipe/compile/component-section.js +143 -0
  227. package/dist/recipe/compile/component-template.d.ts +34 -0
  228. package/dist/recipe/compile/component-template.d.ts.map +1 -0
  229. package/dist/recipe/compile/component-template.js +709 -0
  230. package/dist/recipe/compile/content-item.d.ts +31 -0
  231. package/dist/recipe/compile/content-item.d.ts.map +1 -0
  232. package/dist/recipe/compile/content-item.js +189 -0
  233. package/dist/recipe/compile/content-template.d.ts +18 -0
  234. package/dist/recipe/compile/content-template.d.ts.map +1 -0
  235. package/dist/recipe/compile/content-template.js +52 -0
  236. package/dist/recipe/compile/enumeration.d.ts +59 -0
  237. package/dist/recipe/compile/enumeration.d.ts.map +1 -0
  238. package/dist/recipe/compile/enumeration.js +236 -0
  239. package/dist/recipe/compile/page-design.d.ts +22 -0
  240. package/dist/recipe/compile/page-design.d.ts.map +1 -0
  241. package/dist/recipe/compile/page-design.js +93 -0
  242. package/dist/recipe/compile/parameters-template.d.ts +14 -0
  243. package/dist/recipe/compile/parameters-template.d.ts.map +1 -0
  244. package/dist/recipe/compile/parameters-template.js +92 -0
  245. package/dist/recipe/compile/partial-design.d.ts +18 -0
  246. package/dist/recipe/compile/partial-design.d.ts.map +1 -0
  247. package/dist/recipe/compile/partial-design.js +76 -0
  248. package/dist/recipe/compile/section-definition.d.ts +18 -0
  249. package/dist/recipe/compile/section-definition.d.ts.map +1 -0
  250. package/dist/recipe/compile/section-definition.js +26 -0
  251. package/dist/recipe/compile/shared.d.ts +442 -0
  252. package/dist/recipe/compile/shared.d.ts.map +1 -0
  253. package/dist/recipe/compile/shared.js +843 -0
  254. package/dist/recipe/compile/site-template.d.ts +52 -0
  255. package/dist/recipe/compile/site-template.d.ts.map +1 -0
  256. package/dist/recipe/compile/site-template.js +140 -0
  257. package/dist/recipe/compile/site.d.ts +44 -0
  258. package/dist/recipe/compile/site.d.ts.map +1 -0
  259. package/dist/recipe/compile/site.js +127 -0
  260. package/dist/recipe/compile.d.ts +93 -0
  261. package/dist/recipe/compile.d.ts.map +1 -0
  262. package/dist/recipe/compile.js +741 -0
  263. package/dist/recipe/execute.d.ts +119 -0
  264. package/dist/recipe/execute.d.ts.map +1 -0
  265. package/dist/recipe/execute.js +273 -0
  266. package/dist/recipe/guids.d.ts +400 -0
  267. package/dist/recipe/guids.d.ts.map +1 -0
  268. package/dist/recipe/guids.js +488 -0
  269. package/dist/recipe/index.d.ts +32 -0
  270. package/dist/recipe/index.d.ts.map +1 -0
  271. package/dist/recipe/index.js +156 -0
  272. package/dist/recipe/io.d.ts +21 -0
  273. package/dist/recipe/io.d.ts.map +1 -0
  274. package/dist/recipe/io.js +147 -0
  275. package/dist/recipe/ir/operations.d.ts +692 -0
  276. package/dist/recipe/ir/operations.d.ts.map +1 -0
  277. package/dist/recipe/ir/operations.js +347 -0
  278. package/dist/recipe/ir/sitecore-templates.d.ts +455 -0
  279. package/dist/recipe/ir/sitecore-templates.d.ts.map +1 -0
  280. package/dist/recipe/ir/sitecore-templates.js +465 -0
  281. package/dist/recipe/layout/emit.d.ts +101 -0
  282. package/dist/recipe/layout/emit.d.ts.map +1 -0
  283. package/dist/recipe/layout/emit.js +127 -0
  284. package/dist/recipe/layout/templates-mapping.d.ts +28 -0
  285. package/dist/recipe/layout/templates-mapping.d.ts.map +1 -0
  286. package/dist/recipe/layout/templates-mapping.js +29 -0
  287. package/dist/recipe/plan.d.ts +134 -0
  288. package/dist/recipe/plan.d.ts.map +1 -0
  289. package/dist/recipe/plan.js +565 -0
  290. package/dist/recipe/policy.d.ts +43 -0
  291. package/dist/recipe/policy.d.ts.map +1 -0
  292. package/dist/recipe/policy.js +75 -0
  293. package/dist/recipe/rollback.d.ts +72 -0
  294. package/dist/recipe/rollback.d.ts.map +1 -0
  295. package/dist/recipe/rollback.js +130 -0
  296. package/dist/recipe/schema/field-types.d.ts +72 -0
  297. package/dist/recipe/schema/field-types.d.ts.map +1 -0
  298. package/dist/recipe/schema/field-types.js +118 -0
  299. package/dist/recipe/schema/recipe.d.ts +1545 -0
  300. package/dist/recipe/schema/recipe.d.ts.map +1 -0
  301. package/dist/recipe/schema/recipe.js +1175 -0
  302. package/dist/recipe/schema/source-fields.d.ts +48 -0
  303. package/dist/recipe/schema/source-fields.d.ts.map +1 -0
  304. package/dist/recipe/schema/source-fields.js +79 -0
  305. package/dist/recipe/tasks/compile.d.ts +14 -0
  306. package/dist/recipe/tasks/compile.d.ts.map +1 -0
  307. package/dist/recipe/tasks/compile.js +89 -0
  308. package/dist/recipe/tasks/diff.d.ts +17 -0
  309. package/dist/recipe/tasks/diff.d.ts.map +1 -0
  310. package/dist/recipe/tasks/diff.js +6 -0
  311. package/dist/recipe/tasks/index.d.ts +9 -0
  312. package/dist/recipe/tasks/index.d.ts.map +1 -0
  313. package/dist/recipe/tasks/index.js +13 -0
  314. package/dist/recipe/tasks/placeholder-allow.d.ts +53 -0
  315. package/dist/recipe/tasks/placeholder-allow.d.ts.map +1 -0
  316. package/dist/recipe/tasks/placeholder-allow.js +218 -0
  317. package/dist/recipe/tasks/plan.d.ts +11 -0
  318. package/dist/recipe/tasks/plan.d.ts.map +1 -0
  319. package/dist/recipe/tasks/plan.js +72 -0
  320. package/dist/recipe/tasks/prune-defaults.d.ts +90 -0
  321. package/dist/recipe/tasks/prune-defaults.d.ts.map +1 -0
  322. package/dist/recipe/tasks/prune-defaults.js +184 -0
  323. package/dist/recipe/tasks/push.d.ts +18 -0
  324. package/dist/recipe/tasks/push.d.ts.map +1 -0
  325. package/dist/recipe/tasks/push.js +417 -0
  326. package/dist/recipe/tasks/shared.d.ts +152 -0
  327. package/dist/recipe/tasks/shared.d.ts.map +1 -0
  328. package/dist/recipe/tasks/shared.js +94 -0
  329. package/dist/recipe/validate.d.ts +103 -0
  330. package/dist/recipe/validate.d.ts.map +1 -0
  331. package/dist/recipe/validate.js +297 -0
  332. package/dist/serialization/commands.d.ts +48 -0
  333. package/dist/serialization/commands.d.ts.map +1 -0
  334. package/dist/serialization/commands.js +175 -0
  335. package/dist/serialization/compare.d.ts +29 -0
  336. package/dist/serialization/compare.d.ts.map +1 -0
  337. package/dist/serialization/compare.js +124 -0
  338. package/dist/serialization/field-filter.d.ts +7 -0
  339. package/dist/serialization/field-filter.d.ts.map +1 -0
  340. package/dist/serialization/field-filter.js +20 -0
  341. package/dist/serialization/filesystem-store/constants.d.ts +3 -0
  342. package/dist/serialization/filesystem-store/constants.d.ts.map +1 -0
  343. package/dist/serialization/filesystem-store/constants.js +5 -0
  344. package/dist/serialization/filesystem-store/index.d.ts +4 -0
  345. package/dist/serialization/filesystem-store/index.d.ts.map +1 -0
  346. package/dist/serialization/filesystem-store/index.js +15 -0
  347. package/dist/serialization/filesystem-store/items.d.ts +10 -0
  348. package/dist/serialization/filesystem-store/items.d.ts.map +1 -0
  349. package/dist/serialization/filesystem-store/items.js +64 -0
  350. package/dist/serialization/filesystem-store/roles.d.ts +6 -0
  351. package/dist/serialization/filesystem-store/roles.d.ts.map +1 -0
  352. package/dist/serialization/filesystem-store/roles.js +46 -0
  353. package/dist/serialization/filesystem-store/users.d.ts +6 -0
  354. package/dist/serialization/filesystem-store/users.d.ts.map +1 -0
  355. package/dist/serialization/filesystem-store/users.js +46 -0
  356. package/dist/serialization/filesystem-store/utils.d.ts +2 -0
  357. package/dist/serialization/filesystem-store/utils.d.ts.map +1 -0
  358. package/dist/serialization/filesystem-store/utils.js +17 -0
  359. package/dist/serialization/filesystem-store.d.ts +2 -0
  360. package/dist/serialization/filesystem-store.d.ts.map +1 -0
  361. package/dist/serialization/filesystem-store.js +17 -0
  362. package/dist/serialization/item-path.d.ts +32 -0
  363. package/dist/serialization/item-path.d.ts.map +1 -0
  364. package/dist/serialization/item-path.js +123 -0
  365. package/dist/serialization/path-provider.d.ts +12 -0
  366. package/dist/serialization/path-provider.d.ts.map +1 -0
  367. package/dist/serialization/path-provider.js +271 -0
  368. package/dist/serialization/signature.d.ts +4 -0
  369. package/dist/serialization/signature.d.ts.map +1 -0
  370. package/dist/serialization/signature.js +71 -0
  371. package/dist/serialization/sitecore-api/auth.d.ts +31 -0
  372. package/dist/serialization/sitecore-api/auth.d.ts.map +1 -0
  373. package/dist/serialization/sitecore-api/auth.js +319 -0
  374. package/dist/serialization/sitecore-api/graphql.d.ts +12 -0
  375. package/dist/serialization/sitecore-api/graphql.d.ts.map +1 -0
  376. package/dist/serialization/sitecore-api/graphql.js +20 -0
  377. package/dist/serialization/sitecore-api/history.d.ts +9 -0
  378. package/dist/serialization/sitecore-api/history.d.ts.map +1 -0
  379. package/dist/serialization/sitecore-api/history.js +36 -0
  380. package/dist/serialization/sitecore-api/index.d.ts +7 -0
  381. package/dist/serialization/sitecore-api/index.d.ts.map +1 -0
  382. package/dist/serialization/sitecore-api/index.js +22 -0
  383. package/dist/serialization/sitecore-api/items.d.ts +8 -0
  384. package/dist/serialization/sitecore-api/items.d.ts.map +1 -0
  385. package/dist/serialization/sitecore-api/items.js +132 -0
  386. package/dist/serialization/sitecore-api/publish.d.ts +14 -0
  387. package/dist/serialization/sitecore-api/publish.d.ts.map +1 -0
  388. package/dist/serialization/sitecore-api/publish.js +43 -0
  389. package/dist/serialization/sitecore-api/roles.d.ts +9 -0
  390. package/dist/serialization/sitecore-api/roles.d.ts.map +1 -0
  391. package/dist/serialization/sitecore-api/roles.js +42 -0
  392. package/dist/serialization/sitecore-api/users.d.ts +9 -0
  393. package/dist/serialization/sitecore-api/users.d.ts.map +1 -0
  394. package/dist/serialization/sitecore-api/users.js +62 -0
  395. package/dist/serialization/sitecore-api.d.ts +2 -0
  396. package/dist/serialization/sitecore-api.d.ts.map +1 -0
  397. package/dist/serialization/sitecore-api.js +17 -0
  398. package/dist/serialization/tasks/diff.d.ts +3 -0
  399. package/dist/serialization/tasks/diff.d.ts.map +1 -0
  400. package/dist/serialization/tasks/diff.js +109 -0
  401. package/dist/serialization/tasks/env/constants.d.ts +2 -0
  402. package/dist/serialization/tasks/env/constants.d.ts.map +1 -0
  403. package/dist/serialization/tasks/env/constants.js +4 -0
  404. package/dist/serialization/tasks/env/deploy-token.d.ts +3 -0
  405. package/dist/serialization/tasks/env/deploy-token.d.ts.map +1 -0
  406. package/dist/serialization/tasks/env/deploy-token.js +128 -0
  407. package/dist/serialization/tasks/env/index.d.ts +5 -0
  408. package/dist/serialization/tasks/env/index.d.ts.map +1 -0
  409. package/dist/serialization/tasks/env/index.js +11 -0
  410. package/dist/serialization/tasks/env/init/auth.d.ts +24 -0
  411. package/dist/serialization/tasks/env/init/auth.d.ts.map +1 -0
  412. package/dist/serialization/tasks/env/init/auth.js +122 -0
  413. package/dist/serialization/tasks/env/init/deploy-lookup.d.ts +22 -0
  414. package/dist/serialization/tasks/env/init/deploy-lookup.d.ts.map +1 -0
  415. package/dist/serialization/tasks/env/init/deploy-lookup.js +244 -0
  416. package/dist/serialization/tasks/env/init.d.ts +3 -0
  417. package/dist/serialization/tasks/env/init.d.ts.map +1 -0
  418. package/dist/serialization/tasks/env/init.js +253 -0
  419. package/dist/serialization/tasks/env/logout.d.ts +3 -0
  420. package/dist/serialization/tasks/env/logout.d.ts.map +1 -0
  421. package/dist/serialization/tasks/env/logout.js +61 -0
  422. package/dist/serialization/tasks/env/status.d.ts +3 -0
  423. package/dist/serialization/tasks/env/status.d.ts.map +1 -0
  424. package/dist/serialization/tasks/env/status.js +149 -0
  425. package/dist/serialization/tasks/env.d.ts +2 -0
  426. package/dist/serialization/tasks/env.d.ts.map +1 -0
  427. package/dist/serialization/tasks/env.js +17 -0
  428. package/dist/serialization/tasks/helpers/collect.d.ts +8 -0
  429. package/dist/serialization/tasks/helpers/collect.d.ts.map +1 -0
  430. package/dist/serialization/tasks/helpers/collect.js +29 -0
  431. package/dist/serialization/tasks/helpers/commands.d.ts +5 -0
  432. package/dist/serialization/tasks/helpers/commands.d.ts.map +1 -0
  433. package/dist/serialization/tasks/helpers/commands.js +14 -0
  434. package/dist/serialization/tasks/helpers/filesystem.d.ts +6 -0
  435. package/dist/serialization/tasks/helpers/filesystem.d.ts.map +1 -0
  436. package/dist/serialization/tasks/helpers/filesystem.js +27 -0
  437. package/dist/serialization/tasks/helpers/index.d.ts +6 -0
  438. package/dist/serialization/tasks/helpers/index.d.ts.map +1 -0
  439. package/dist/serialization/tasks/helpers/index.js +13 -0
  440. package/dist/serialization/tasks/helpers/items.d.ts +3 -0
  441. package/dist/serialization/tasks/helpers/items.d.ts.map +1 -0
  442. package/dist/serialization/tasks/helpers/items.js +5 -0
  443. package/dist/serialization/tasks/helpers/sitecore.d.ts +5 -0
  444. package/dist/serialization/tasks/helpers/sitecore.d.ts.map +1 -0
  445. package/dist/serialization/tasks/helpers/sitecore.js +109 -0
  446. package/dist/serialization/tasks/helpers.d.ts +2 -0
  447. package/dist/serialization/tasks/helpers.d.ts.map +1 -0
  448. package/dist/serialization/tasks/helpers.js +17 -0
  449. package/dist/serialization/tasks/index.d.ts +8 -0
  450. package/dist/serialization/tasks/index.d.ts.map +1 -0
  451. package/dist/serialization/tasks/index.js +19 -0
  452. package/dist/serialization/tasks/info.d.ts +4 -0
  453. package/dist/serialization/tasks/info.d.ts.map +1 -0
  454. package/dist/serialization/tasks/info.js +82 -0
  455. package/dist/serialization/tasks/package.d.ts +4 -0
  456. package/dist/serialization/tasks/package.d.ts.map +1 -0
  457. package/dist/serialization/tasks/package.js +171 -0
  458. package/dist/serialization/tasks/pull.d.ts +3 -0
  459. package/dist/serialization/tasks/pull.d.ts.map +1 -0
  460. package/dist/serialization/tasks/pull.js +82 -0
  461. package/dist/serialization/tasks/push.d.ts +3 -0
  462. package/dist/serialization/tasks/push.d.ts.map +1 -0
  463. package/dist/serialization/tasks/push.js +101 -0
  464. package/dist/serialization/tasks/roles.d.ts +6 -0
  465. package/dist/serialization/tasks/roles.d.ts.map +1 -0
  466. package/dist/serialization/tasks/roles.js +103 -0
  467. package/dist/serialization/tasks/shared.d.ts +19 -0
  468. package/dist/serialization/tasks/shared.d.ts.map +1 -0
  469. package/dist/serialization/tasks/shared.js +59 -0
  470. package/dist/serialization/tasks/types.d.ts +73 -0
  471. package/dist/serialization/tasks/types.d.ts.map +1 -0
  472. package/dist/serialization/tasks/types.js +8 -0
  473. package/dist/serialization/tasks/users.d.ts +5 -0
  474. package/dist/serialization/tasks/users.d.ts.map +1 -0
  475. package/dist/serialization/tasks/users.js +90 -0
  476. package/dist/serialization/tasks/validate.d.ts +5 -0
  477. package/dist/serialization/tasks/validate.d.ts.map +1 -0
  478. package/dist/serialization/tasks/validate.js +50 -0
  479. package/dist/serialization/tasks/watch.d.ts +3 -0
  480. package/dist/serialization/tasks/watch.d.ts.map +1 -0
  481. package/dist/serialization/tasks/watch.js +75 -0
  482. package/dist/serialization/tasks.d.ts +4 -0
  483. package/dist/serialization/tasks.d.ts.map +1 -0
  484. package/dist/serialization/tasks.js +19 -0
  485. package/dist/serialization/tree-spec.d.ts +51 -0
  486. package/dist/serialization/tree-spec.d.ts.map +1 -0
  487. package/dist/serialization/tree-spec.js +241 -0
  488. package/dist/serialization/types.d.ts +75 -0
  489. package/dist/serialization/types.d.ts.map +1 -0
  490. package/dist/serialization/types.js +2 -0
  491. package/dist/serialization/wildcard.d.ts +3 -0
  492. package/dist/serialization/wildcard.d.ts.map +1 -0
  493. package/dist/serialization/wildcard.js +24 -0
  494. package/dist/serialization/yaml.d.ts +9 -0
  495. package/dist/serialization/yaml.d.ts.map +1 -0
  496. package/dist/serialization/yaml.js +307 -0
  497. package/dist/shared/browser.d.ts +2 -0
  498. package/dist/shared/browser.d.ts.map +1 -0
  499. package/dist/shared/browser.js +36 -0
  500. package/dist/shared/cli-options.d.ts +17 -0
  501. package/dist/shared/cli-options.d.ts.map +1 -0
  502. package/dist/shared/cli-options.js +8 -0
  503. package/dist/shared/cli-tasks.d.ts +38 -0
  504. package/dist/shared/cli-tasks.d.ts.map +1 -0
  505. package/dist/shared/cli-tasks.js +108 -0
  506. package/dist/shared/config-template.d.ts +23 -0
  507. package/dist/shared/config-template.d.ts.map +1 -0
  508. package/dist/shared/config-template.js +38 -0
  509. package/dist/shared/env.d.ts +28 -0
  510. package/dist/shared/env.d.ts.map +1 -0
  511. package/dist/shared/env.js +38 -0
  512. package/dist/shared/errors.d.ts +21 -0
  513. package/dist/shared/errors.d.ts.map +1 -0
  514. package/dist/shared/errors.js +59 -0
  515. package/dist/shared/graphql.d.ts +76 -0
  516. package/dist/shared/graphql.d.ts.map +1 -0
  517. package/dist/shared/graphql.js +222 -0
  518. package/dist/shared/history.d.ts +12 -0
  519. package/dist/shared/history.d.ts.map +1 -0
  520. package/dist/shared/history.js +62 -0
  521. package/dist/shared/keychain.d.ts +15 -0
  522. package/dist/shared/keychain.d.ts.map +1 -0
  523. package/dist/shared/keychain.js +177 -0
  524. package/dist/shared/logger.d.ts +24 -0
  525. package/dist/shared/logger.d.ts.map +1 -0
  526. package/dist/shared/logger.js +157 -0
  527. package/dist/shared/output.d.ts +7 -0
  528. package/dist/shared/output.d.ts.map +1 -0
  529. package/dist/shared/output.js +21 -0
  530. package/dist/shared/prompt.d.ts +5 -0
  531. package/dist/shared/prompt.d.ts.map +1 -0
  532. package/dist/shared/prompt.js +87 -0
  533. package/dist/shared/redact.d.ts +3 -0
  534. package/dist/shared/redact.d.ts.map +1 -0
  535. package/dist/shared/redact.js +47 -0
  536. package/dist/shared/spinner.d.ts +5 -0
  537. package/dist/shared/spinner.d.ts.map +1 -0
  538. package/dist/shared/spinner.js +89 -0
  539. package/dist/shared/style.d.ts +2 -0
  540. package/dist/shared/style.d.ts.map +1 -0
  541. package/dist/shared/style.js +61 -0
  542. package/dist/shared/telemetry.d.ts +21 -0
  543. package/dist/shared/telemetry.d.ts.map +1 -0
  544. package/dist/shared/telemetry.js +226 -0
  545. package/dist/shared/validate.d.ts +3 -0
  546. package/dist/shared/validate.d.ts.map +1 -0
  547. package/dist/shared/validate.js +32 -0
  548. package/dist/sites/api/collections.d.ts +25 -0
  549. package/dist/sites/api/collections.d.ts.map +1 -0
  550. package/dist/sites/api/collections.js +21 -0
  551. package/dist/sites/api/index.d.ts +26 -0
  552. package/dist/sites/api/index.d.ts.map +1 -0
  553. package/dist/sites/api/index.js +55 -0
  554. package/dist/sites/api/jobs.d.ts +31 -0
  555. package/dist/sites/api/jobs.d.ts.map +1 -0
  556. package/dist/sites/api/jobs.js +10 -0
  557. package/dist/sites/api/languages.d.ts +22 -0
  558. package/dist/sites/api/languages.d.ts.map +1 -0
  559. package/dist/sites/api/languages.js +18 -0
  560. package/dist/sites/api/request.d.ts +24 -0
  561. package/dist/sites/api/request.d.ts.map +1 -0
  562. package/dist/sites/api/request.js +99 -0
  563. package/dist/sites/api/sites.d.ts +53 -0
  564. package/dist/sites/api/sites.d.ts.map +1 -0
  565. package/dist/sites/api/sites.js +41 -0
  566. package/dist/sites/api/types.d.ts +29 -0
  567. package/dist/sites/api/types.d.ts.map +1 -0
  568. package/dist/sites/api/types.js +4 -0
  569. package/package.json +109 -0
@@ -0,0 +1,565 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildPlan = exports.buildAction = void 0;
4
+ const sitecore_templates_1 = require("./ir/sitecore-templates");
5
+ const ref_encoding_1 = require("./api/ref-encoding");
6
+ const lookupField = (remote, fieldId, fieldName, language, version) => remote.fields.find((f) => {
7
+ // Match by name when the IR carries one — recipe-created field GUIDs
8
+ // are IR-internal refKeys that don't match the tenant's actual GUIDs,
9
+ // so name is the only reliable selector. Else match by GUID (system
10
+ // fields' GUIDs are real Sitecore built-ins).
11
+ const idMatches = fieldName
12
+ ? f.name === fieldName
13
+ : f.fieldId.toLowerCase() === fieldId.toLowerCase();
14
+ return (idMatches &&
15
+ // Sitecore Authoring GraphQL doesn't return per-field language/version
16
+ // on the basic `Item.fields` query — `f.language`/`f.version` are
17
+ // typically undefined. Match only when the recipe's filter is also
18
+ // undefined or when the API DID return them (custom integrations).
19
+ (language === undefined || f.language === undefined || f.language === language) &&
20
+ (version === undefined || f.version === undefined || f.version === version));
21
+ });
22
+ /** Resolve every recipe-ref / source-prefix in a field value list. */
23
+ const resolveAll = (fields, capturedItemIds) => fields.map((field) => ({
24
+ ...field,
25
+ value: (0, ref_encoding_1.resolveRecipeRefs)(field.value, capturedItemIds),
26
+ }));
27
+ const computeFieldDrift = (desired, remote, capturedItemIds) => {
28
+ const drift = [];
29
+ for (const field of desired) {
30
+ const resolvedValue = (0, ref_encoding_1.resolveRecipeRefs)(field.value, capturedItemIds);
31
+ const want = (0, ref_encoding_1.renderRefValue)(resolvedValue);
32
+ const found = lookupField(remote, field.fieldId, field.fieldName, field.language, field.version);
33
+ if (!found) {
34
+ drift.push({
35
+ fieldId: field.fieldId,
36
+ before: null,
37
+ after: want,
38
+ language: field.language,
39
+ version: field.version,
40
+ });
41
+ continue;
42
+ }
43
+ if (found.value !== want) {
44
+ drift.push({
45
+ fieldId: field.fieldId,
46
+ before: found.value,
47
+ after: want,
48
+ language: field.language,
49
+ version: field.version,
50
+ });
51
+ }
52
+ }
53
+ return drift;
54
+ };
55
+ /**
56
+ * Resolve a CreateItem op's parent ref to a Sitecore itemId.
57
+ *
58
+ * Sitecore's `createItem` requires `parent: ID!` (a GUID). Path-only
59
+ * parents (`ref-path`) are looked up via `getItem({ path })` and cached
60
+ * in `capturedItemIds` keyed by the path string itself. Recipe-internal
61
+ * `ref-recipe` parents resolve via the same map keyed by their refKey,
62
+ * populated as parent ops apply.
63
+ *
64
+ * Returns `unresolvedRefKey` only when a `ref-recipe` parent's CreateItem
65
+ * has not yet captured an itemId (plan-mode against an empty tenant
66
+ * before applies happen).
67
+ */
68
+ const resolveCreateItemParent = (op, capturedItemIds) => {
69
+ if (op.parent.kind === "ref-path") {
70
+ const cached = capturedItemIds.get(op.parent.value);
71
+ if (cached)
72
+ return { resolved: cached };
73
+ // Plan-mode fallback when the path lookup returned null (tenant
74
+ // doesn't have it yet, or we're testing without a live tenant).
75
+ return { resolved: op.parent.value };
76
+ }
77
+ const itemId = capturedItemIds.get(op.parent.refKey);
78
+ if (itemId) {
79
+ return { resolved: itemId };
80
+ }
81
+ // Plan-mode preview fallback: when the parent's CreateItem hasn't run
82
+ // yet (captured map empty), derive the parent path from op.path. Apply-
83
+ // mode normally fills the captured map before children dispatch, so this
84
+ // branch is mostly for `recipe plan` output.
85
+ const trail = `/${op.name}`;
86
+ if (op.path.endsWith(trail)) {
87
+ const parentPath = op.path.slice(0, -trail.length);
88
+ if (parentPath) {
89
+ return { resolved: parentPath };
90
+ }
91
+ }
92
+ return { unresolvedRefKey: op.parent.refKey };
93
+ };
94
+ /** Resolve a CreateItem op's templateOf — usually a constant Sitecore GUID,
95
+ * but the SV item case has it as the recipe's own template refKey. */
96
+ const resolveTemplateOf = (op, capturedItemIds) => {
97
+ // If templateOf matches a refKey in our captured map, resolve it.
98
+ // Otherwise it's a known Sitecore built-in GUID and we use as-is.
99
+ const captured = capturedItemIds.get(op.templateOf);
100
+ if (captured) {
101
+ return { resolved: captured };
102
+ }
103
+ // Known Sitecore built-in (Template, Section, Field, Folder, Rendering, etc.).
104
+ return { resolved: op.templateOf };
105
+ };
106
+ const planCreateItem = (op, remote, index, capturedItemIds) => {
107
+ if (!remote) {
108
+ const parent = resolveCreateItemParent(op, capturedItemIds);
109
+ if ("unresolvedRefKey" in parent) {
110
+ return {
111
+ index,
112
+ operation: op,
113
+ status: "skip",
114
+ reason: `Parent ref ${parent.unresolvedRefKey} not yet captured (parent's CreateItem hasn't run).`,
115
+ };
116
+ }
117
+ const tpl = resolveTemplateOf(op, capturedItemIds);
118
+ if ("unresolvedRefKey" in tpl) {
119
+ return {
120
+ index,
121
+ operation: op,
122
+ status: "skip",
123
+ reason: `templateOf ref ${tpl.unresolvedRefKey} not yet captured.`,
124
+ };
125
+ }
126
+ // Plan-mode preview tolerates unresolved field refs: we report status
127
+ // create, but omit the mutation snapshot until apply-mode actually
128
+ // captures the dependent itemIds. Apply-mode populates the captured
129
+ // map as it goes, so by the time a child op runs its parents' refs
130
+ // are present and resolveAll succeeds.
131
+ let resolvedFields;
132
+ try {
133
+ resolvedFields = resolveAll(op.fields, capturedItemIds);
134
+ }
135
+ catch (error) {
136
+ const message = error instanceof Error ? error.message : String(error);
137
+ return {
138
+ index,
139
+ operation: op,
140
+ status: "create",
141
+ reason: `Plan preview: ${message}`,
142
+ };
143
+ }
144
+ return {
145
+ index,
146
+ operation: op,
147
+ status: "create",
148
+ mutation: {
149
+ kind: "createItem",
150
+ input: {
151
+ parent: parent.resolved,
152
+ templateId: tpl.resolved,
153
+ name: op.name,
154
+ fields: resolvedFields,
155
+ },
156
+ },
157
+ };
158
+ }
159
+ if (op.policy === "CreateOnly") {
160
+ return {
161
+ index,
162
+ operation: op,
163
+ status: "skip",
164
+ reason: "Item already exists and policy is CreateOnly.",
165
+ };
166
+ }
167
+ const drift = computeFieldDrift(op.fields, remote, capturedItemIds);
168
+ if (drift.length === 0) {
169
+ return {
170
+ index,
171
+ operation: op,
172
+ status: "skip",
173
+ reason: "Item exists and all tracked fields match.",
174
+ };
175
+ }
176
+ const driftedSet = new Set(drift.map((d) => `${d.fieldId}:${d.language ?? ""}:${d.version ?? ""}`));
177
+ const fieldsToSet = resolveAll(op.fields.filter((f) => driftedSet.has(`${f.fieldId}:${f.language ?? ""}:${f.version ?? ""}`)), capturedItemIds);
178
+ return {
179
+ index,
180
+ operation: op,
181
+ status: "update",
182
+ diff: drift,
183
+ mutation: {
184
+ kind: "updateItem",
185
+ input: { itemId: remote.itemId, fields: fieldsToSet },
186
+ },
187
+ };
188
+ };
189
+ const planUpdateOp = (index, op, itemRefKey, desiredFields, policy, remote, capturedItemIds) => {
190
+ if (!remote) {
191
+ return {
192
+ index,
193
+ operation: op,
194
+ status: "skip",
195
+ reason: `Target item (refKey ${itemRefKey}) not yet captured/created.`,
196
+ };
197
+ }
198
+ const drift = computeFieldDrift(desiredFields, remote, capturedItemIds);
199
+ if (drift.length === 0) {
200
+ return {
201
+ index,
202
+ operation: op,
203
+ status: "skip",
204
+ reason: "Field already at desired value.",
205
+ };
206
+ }
207
+ if (policy === "CreateOnly") {
208
+ const allBlankBefore = drift.every((d) => d.before === null || d.before === "");
209
+ if (!allBlankBefore) {
210
+ return {
211
+ index,
212
+ operation: op,
213
+ status: "skip",
214
+ reason: "Field already set; CreateOnly policy preserves CMS edits.",
215
+ };
216
+ }
217
+ }
218
+ return {
219
+ index,
220
+ operation: op,
221
+ status: "update",
222
+ diff: drift,
223
+ mutation: {
224
+ kind: "updateItem",
225
+ input: {
226
+ itemId: remote.itemId,
227
+ fields: resolveAll(desiredFields, capturedItemIds),
228
+ },
229
+ },
230
+ };
231
+ };
232
+ const setFieldDesired = (op) => [
233
+ {
234
+ fieldId: op.fieldId,
235
+ fieldName: op.fieldName,
236
+ language: op.language,
237
+ version: op.version,
238
+ value: op.value,
239
+ },
240
+ ];
241
+ const setBaseTemplatesDesired = (op) => [
242
+ {
243
+ fieldId: sitecore_templates_1.SYSTEM_FIELDS.BASE_TEMPLATE,
244
+ value: { kind: "ref-guid-list", values: op.baseTemplates },
245
+ },
246
+ ];
247
+ const setStandardValuesDesired = (op) => [
248
+ {
249
+ fieldId: sitecore_templates_1.SYSTEM_FIELDS.STANDARD_VALUES,
250
+ value: { kind: "ref-recipe", refKey: op.standardValuesRefKey },
251
+ },
252
+ ];
253
+ /**
254
+ * Compute the lookup selector for a given op. CreateItem looks up by
255
+ * path; update-style ops look up by the captured itemId for their target
256
+ * refKey. Returns `null` when the captured map doesn't have the refKey
257
+ * yet — that signals the planner to skip.
258
+ */
259
+ const lookupSelector = (op, capturedItemIds) => {
260
+ if (op.op === "CreateItem") {
261
+ return { path: op.path };
262
+ }
263
+ if (op.op === "CreateSiteFromTemplate") {
264
+ // Site idempotency lookup goes through SitesApiClient.listSites, not
265
+ // Authoring API getItem; planCreateSite handles the lookup itself.
266
+ return null;
267
+ }
268
+ let refKey;
269
+ if (op.op === "SetField" || op.op === "SetBaseTemplates") {
270
+ refKey = op.itemRefKey;
271
+ }
272
+ else if (op.op === "SetStandardValues") {
273
+ refKey = op.templateRefKey;
274
+ }
275
+ else {
276
+ // AppendToMultiList — target item is keyed by itemRefKey, same as SetField.
277
+ refKey = op.itemRefKey;
278
+ }
279
+ const itemId = capturedItemIds.get(refKey);
280
+ return itemId ? { itemId } : null;
281
+ };
282
+ /**
283
+ * Plan a single op against the current remote state. Exposed so the
284
+ * executor's apply mode can interleave plan-and-apply per-op (each op's
285
+ * plan sees the cascading effect of earlier ops' applies — required for
286
+ * idempotency: a second push must see no drift on update-style ops whose
287
+ * targets the first push created).
288
+ *
289
+ * Updates `capturedItemIds` when `getItem(by path)` finds an existing
290
+ * item (so subsequent ops can resolve refs without dispatching).
291
+ *
292
+ * When a `pathSnapshotCache` is provided (workspace prefetch), each
293
+ * `getItem({ path })` call short-circuits to the cached value when the
294
+ * path is already known — `null` means "checked and missing", a
295
+ * `RemoteItem` means "use this snapshot". Non-path lookups (by itemId)
296
+ * still hit the wire.
297
+ */
298
+ const buildAction = async (index, op, client, capturedItemIds, sitesClient, pathSnapshotCache) => {
299
+ const cachedReadByPath = async (path) => {
300
+ if (pathSnapshotCache?.has(path)) {
301
+ return pathSnapshotCache.get(path) ?? null;
302
+ }
303
+ const remote = await client.getItem({ path });
304
+ pathSnapshotCache?.set(path, remote);
305
+ return remote;
306
+ };
307
+ // Late-path resolution: SetField ops whose target is materialised
308
+ // mid-push (e.g. dictionary phrases under a CreateSiteFromTemplate)
309
+ // carry an optional `latePath`. If the op's itemRefKey isn't yet in
310
+ // the captured map AND a latePath is set, do an on-demand getItem
311
+ // lookup to seed the map BEFORE lookupSelector runs. Without this,
312
+ // lookupSelector sees no captured itemId and the SetField skips
313
+ // with "not yet captured/created" — even though the item exists.
314
+ if ((op.op === "SetField" || op.op === "AppendToMultiList") &&
315
+ op.latePath &&
316
+ !capturedItemIds.has(op.itemRefKey)) {
317
+ const lateRemote = await cachedReadByPath(op.latePath);
318
+ if (lateRemote) {
319
+ capturedItemIds.set(op.itemRefKey, lateRemote.itemId);
320
+ }
321
+ }
322
+ const selector = lookupSelector(op, capturedItemIds);
323
+ const remote = await (async () => {
324
+ if (!selector)
325
+ return null;
326
+ if (selector.path)
327
+ return cachedReadByPath(selector.path);
328
+ return client.getItem(selector);
329
+ })();
330
+ if (op.op === "CreateItem" && remote) {
331
+ capturedItemIds.set(op.id, remote.itemId);
332
+ }
333
+ // For CreateItem with a path-only parent (top-level items like the
334
+ // configured templatesRoot/renderingsRoot), resolve the parent path to
335
+ // its Sitecore-assigned itemId once and cache it on the captured map
336
+ // keyed by path. The Authoring API requires `parent: ID!` (GUID) on
337
+ // createItem; passing a path errors with "String→Guid" conversion.
338
+ if (op.op === "CreateItem" && op.parent.kind === "ref-path") {
339
+ const parentPath = op.parent.value;
340
+ if (!capturedItemIds.has(parentPath)) {
341
+ const parentRemote = await cachedReadByPath(parentPath);
342
+ if (parentRemote) {
343
+ capturedItemIds.set(parentPath, parentRemote.itemId);
344
+ }
345
+ }
346
+ }
347
+ const action = await (async () => {
348
+ switch (op.op) {
349
+ case "CreateItem":
350
+ return planCreateItem(op, remote, index, capturedItemIds);
351
+ case "SetField":
352
+ return planUpdateOp(index, op, op.itemRefKey, setFieldDesired(op), op.policy, remote, capturedItemIds);
353
+ case "SetBaseTemplates":
354
+ return planUpdateOp(index, op, op.itemRefKey, setBaseTemplatesDesired(op), op.policy, remote, capturedItemIds);
355
+ case "SetStandardValues":
356
+ return planUpdateOp(index, op, op.templateRefKey, setStandardValuesDesired(op), op.policy, remote, capturedItemIds);
357
+ case "CreateSiteFromTemplate":
358
+ return planCreateSite(index, op, capturedItemIds, sitesClient);
359
+ case "AppendToMultiList":
360
+ return planAppendToMultiList(index, op, remote, capturedItemIds);
361
+ }
362
+ })();
363
+ return { ...action, snapshot: remote };
364
+ };
365
+ exports.buildAction = buildAction;
366
+ /**
367
+ * Parse a Sitecore multi-list field value (pipe-separated GUIDs, each
368
+ * either bare or curly-wrapped) into a normalised lowercase, no-curly
369
+ * GUID set. Tolerates extra whitespace / empty entries from operator
370
+ * edits.
371
+ */
372
+ const parseMultiList = (value) => {
373
+ if (!value)
374
+ return [];
375
+ return value
376
+ .split("|")
377
+ .map((s) => s.trim())
378
+ .filter((s) => s.length > 0)
379
+ .map((s) => s.replace(/^\{|\}$/g, "").toLowerCase());
380
+ };
381
+ const formatMultiList = (guids) => guids.map((g) => `{${g.toUpperCase()}}`).join("|");
382
+ /**
383
+ * Plan an `AppendToMultiList` op. Reads the target's current field
384
+ * value, computes the union with the desired values (resolving recipe
385
+ * refs first), and emits an updateItem mutation only when the merge
386
+ * adds something new — otherwise a skip with a clear reason.
387
+ */
388
+ const planAppendToMultiList = (index, op, remote, capturedItemIds) => {
389
+ if (!remote) {
390
+ return {
391
+ index,
392
+ operation: op,
393
+ status: "skip",
394
+ reason: `Target item (refKey ${op.itemRefKey}) not yet captured — section definition may not exist or path lookup hasn't run.`,
395
+ };
396
+ }
397
+ // Resolve every desired value into a concrete GUID. ref-recipe entries
398
+ // resolve via the captured map; ref-guid entries pass through.
399
+ const desired = [];
400
+ for (const entry of op.values) {
401
+ if (entry.kind === "ref-guid") {
402
+ desired.push(entry.value.toLowerCase());
403
+ }
404
+ else {
405
+ const itemId = capturedItemIds.get(entry.refKey);
406
+ if (!itemId) {
407
+ return {
408
+ index,
409
+ operation: op,
410
+ status: "skip",
411
+ reason: `AppendToMultiList: refKey ${entry.refKey} not yet captured — producer recipe hasn't landed.`,
412
+ };
413
+ }
414
+ desired.push(itemId.toLowerCase());
415
+ }
416
+ }
417
+ // Read the current field value — match by name when carried (recipe-
418
+ // defined fields), else by GUID (system fields).
419
+ const found = remote.fields.find((f) => {
420
+ const idMatches = op.fieldName
421
+ ? f.name === op.fieldName
422
+ : f.fieldId.toLowerCase() === op.fieldId.toLowerCase();
423
+ return idMatches;
424
+ });
425
+ const existing = parseMultiList(found?.value ?? null);
426
+ const existingSet = new Set(existing);
427
+ const additions = desired.filter((g) => !existingSet.has(g));
428
+ if (additions.length === 0) {
429
+ return {
430
+ index,
431
+ operation: op,
432
+ status: "skip",
433
+ reason: "All desired values already present in multi-list (merge-unique).",
434
+ };
435
+ }
436
+ const merged = [...existing, ...additions];
437
+ const updatedField = {
438
+ fieldId: op.fieldId,
439
+ ...(op.fieldName !== undefined && { fieldName: op.fieldName }),
440
+ value: { kind: "string", value: formatMultiList(merged) },
441
+ };
442
+ return {
443
+ index,
444
+ operation: op,
445
+ status: "update",
446
+ diff: [
447
+ {
448
+ fieldId: op.fieldId,
449
+ before: found?.value ?? null,
450
+ after: formatMultiList(merged),
451
+ },
452
+ ],
453
+ mutation: {
454
+ kind: "updateItem",
455
+ input: { itemId: remote.itemId, fields: [updatedField] },
456
+ },
457
+ };
458
+ };
459
+ /**
460
+ * Plan a `CreateSiteFromTemplate` op. Idempotency lookup goes through
461
+ * `SitesApiClient.listSites` (filter by name) — the Sites API doesn't
462
+ * resolve site instances by Sitecore content-tree path the way Authoring
463
+ * API does for items.
464
+ *
465
+ * Outcomes:
466
+ * - sitesClient missing → status: error (executor was not threaded one)
467
+ * - templateRefKey not yet captured → status: skip (the SiteTemplate
468
+ * hasn't been pushed; cross-recipe ref pre-seeding will pick it up
469
+ * on the next push)
470
+ * - site already exists with the same name → status: skip; capture
471
+ * the existing site's itemId so subsequent SetField overrides resolve
472
+ * - site doesn't exist → status: create; mutation `createSite` carries
473
+ * a fully-resolved NewSiteInput plus the op's siteRefKey
474
+ *
475
+ * "Already exists with a different template" is NOT detected here —
476
+ * Sites API doesn't expose a clean way to read a site's template
477
+ * back. If a same-named site references a different template, the
478
+ * push silently treats it as "skip"; operators must delete and re-push
479
+ * to switch templates. Tracked as a follow-up.
480
+ */
481
+ const planCreateSite = async (index, op, capturedItemIds, sitesClient) => {
482
+ if (!sitesClient) {
483
+ return {
484
+ index,
485
+ operation: op,
486
+ status: "error",
487
+ reason: "CreateSiteFromTemplate requires a SitesApiClient — none was provided to the executor.",
488
+ };
489
+ }
490
+ const templateId = capturedItemIds.get(op.templateRefKey);
491
+ if (!templateId) {
492
+ return {
493
+ index,
494
+ operation: op,
495
+ status: "skip",
496
+ reason: `siteTemplate refKey ${op.templateRefKey} not yet captured (push the SiteTemplate first or via cross-recipe ref).`,
497
+ };
498
+ }
499
+ const sites = await sitesClient.listSites();
500
+ const existing = sites.find((s) => s.name === op.siteName);
501
+ if (existing?.id) {
502
+ capturedItemIds.set(op.siteRefKey, existing.id);
503
+ return {
504
+ index,
505
+ operation: op,
506
+ status: "skip",
507
+ reason: `Site '${op.siteName}' already exists.`,
508
+ };
509
+ }
510
+ const input = {
511
+ siteName: op.siteName,
512
+ templateId,
513
+ language: op.language,
514
+ ...(op.displayName !== undefined && { displayName: op.displayName }),
515
+ ...(op.description !== undefined && { description: op.description }),
516
+ ...(op.hostName !== undefined && { hostName: op.hostName }),
517
+ ...(op.collectionId !== undefined && { collectionId: op.collectionId }),
518
+ ...(op.collectionName !== undefined && { collectionName: op.collectionName }),
519
+ ...(op.collectionDisplayName !== undefined && {
520
+ collectionDisplayName: op.collectionDisplayName,
521
+ }),
522
+ ...(op.collectionDescription !== undefined && {
523
+ collectionDescription: op.collectionDescription,
524
+ }),
525
+ };
526
+ return {
527
+ index,
528
+ operation: op,
529
+ status: "create",
530
+ mutation: { kind: "createSite", input, siteRefKey: op.siteRefKey },
531
+ };
532
+ };
533
+ const buildPlan = async (ir, client, options = {}) => {
534
+ const actions = [];
535
+ const summary = { create: 0, update: 0, skip: 0, error: 0 };
536
+ const capturedItemIds = options.capturedItemIds ?? new Map();
537
+ for (let index = 0; index < ir.operations.length; index += 1) {
538
+ const op = ir.operations[index];
539
+ options.emit?.({ kind: "op-start", index, operation: op });
540
+ let action;
541
+ try {
542
+ action = await (0, exports.buildAction)(index, op, client, capturedItemIds, options.sitesClient, options.pathSnapshotCache);
543
+ }
544
+ catch (error) {
545
+ const message = error instanceof Error ? error.message : String(error);
546
+ action = {
547
+ index,
548
+ operation: op,
549
+ status: "error",
550
+ reason: message,
551
+ };
552
+ options.emit?.({ kind: "op-error", index, operation: op, error: message });
553
+ }
554
+ summary[action.status] += 1;
555
+ actions.push(action);
556
+ options.emit?.({ kind: "op-result", action });
557
+ }
558
+ return {
559
+ schemaVersion: "1",
560
+ recipeHandle: ir.recipeHandle,
561
+ actions,
562
+ summary,
563
+ };
564
+ };
565
+ exports.buildPlan = buildPlan;
@@ -0,0 +1,43 @@
1
+ import type { Operation, PushPolicy } from "./ir/operations";
2
+ import type { Recipe } from "./schema/recipe";
3
+ /**
4
+ * Policy assignment for compiler-emitted operations.
5
+ *
6
+ * Phase 1: every op a recipe emits is `CreateAndUpdate` — the registry is
7
+ * the source of truth for templates, sections, fields, renderings, and
8
+ * variants. Authors should not edit those in the CMS; if they do, a
9
+ * registry deploy overwrites.
10
+ *
11
+ * Phase 3 (datasource items, page items) introduces `CreateOnly`: the
12
+ * registry seeds initial content, the CMS owns it thereafter. The
13
+ * `policyFor` switch is the single seam to add that distinction without
14
+ * rewriting every emission site in `compile.ts`.
15
+ */
16
+ /**
17
+ * The kind of op being emitted. Phase 1 only has `template-structure`
18
+ * ops; Phase 3+ adds `datasource-item` and `page-item`. Phase 4 adds
19
+ * `composition-structure` for partials and page designs (registry-owned
20
+ * compositional artifacts, like component templates — `CreateAndUpdate`).
21
+ */
22
+ export type OpPurpose = "template-structure" | "composition-structure" | "datasource-item" | "page-item";
23
+ export declare const purposeForRecipe: (kind: Recipe["kind"]) => OpPurpose;
24
+ /**
25
+ * Policy assignment, given the purpose of the op being emitted. Phase 1
26
+ * collapses to a single value; future phases add branches here.
27
+ */
28
+ export declare const policyFor: (purpose: OpPurpose) => PushPolicy;
29
+ /**
30
+ * Convenience: the default policy a recipe of the given kind should attach
31
+ * to every op it emits. Compiler call site:
32
+ *
33
+ * const policy = defaultPolicyForRecipe(recipe.kind);
34
+ * operations.push({ op: "CreateItem", policy, ... });
35
+ */
36
+ export declare const defaultPolicyForRecipe: (kind: Recipe["kind"]) => PushPolicy;
37
+ /**
38
+ * Type guard for narrowing op kinds — exposed so consumers (planner,
39
+ * executor, telemetry) can dispatch on policy without re-implementing the
40
+ * mapping.
41
+ */
42
+ export declare const policyForOp: (op: Operation) => PushPolicy;
43
+ //# sourceMappingURL=policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/recipe/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;;;;;;;GAYG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,oBAAoB,GACpB,uBAAuB,GACvB,iBAAiB,GACjB,WAAW,CAAC;AA0ChB,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,CAAC,MAAM,CAAC,KAAG,SAAyC,CAAC;AAElG;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,SAAS,KAAG,UAS9C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,CAAC,MAAM,CAAC,KAAG,UAC3B,CAAC;AAEpC;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,SAAS,KAAG,UAAuB,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.policyForOp = exports.defaultPolicyForRecipe = exports.policyFor = exports.purposeForRecipe = void 0;
4
+ const PURPOSE_BY_RECIPE_KIND = {
5
+ // Component sections own organisational folders that components live
6
+ // under (templates section folder, renderings section folder, etc.).
7
+ // Registry-owned structure — CreateAndUpdate so re-pushes can update
8
+ // the section's display name / icon / sort order.
9
+ "component-section": "template-structure",
10
+ "component-template": "template-structure",
11
+ "content-template": "template-structure",
12
+ "content-item": "datasource-item",
13
+ // Standalone parameters templates and the synthesised inline-hoisted
14
+ // ones share the same policy as component templates — they're
15
+ // registry-owned and should overwrite tenant edits.
16
+ "parameters-template": "template-structure",
17
+ // Section definitions are typically tenant-pre-existing; the
18
+ // compiler emits AppendToMultiList ops against them rather than
19
+ // CreateItem. Treat as composition-structure so any future
20
+ // `CreateItem` for a missing section definition lands with the
21
+ // CreateAndUpdate policy.
22
+ "section-definition": "composition-structure",
23
+ "partial-design": "composition-structure",
24
+ "page-design": "composition-structure",
25
+ // Site templates are registry-owned brand definitions — the template
26
+ // item itself + its structural metadata (insert options, designs, etc.)
27
+ // are template-structure-shaped. Compiler implementation lands in
28
+ // composition-recipes-site-branches.md Milestone C.
29
+ "site-template": "composition-structure",
30
+ // Site instances are operator-driven — the site item is created via
31
+ // Sites API and its grouping / overrides are operator overrides on
32
+ // top of the template defaults. Treat as composition-structure for
33
+ // policy purposes; per-op CreateOnly vs CreateAndUpdate gets
34
+ // refined when the executor lands (Milestone D).
35
+ site: "composition-structure",
36
+ // Enumerations are registry-owned vocabulary. CreateAndUpdate so
37
+ // re-pushes flip displayName edits and add/remove value items as
38
+ // the recipe evolves. Authors who need extra values can add them
39
+ // to the recipe and re-push; CMS edits to enumeration items get
40
+ // overwritten.
41
+ enumeration: "template-structure",
42
+ };
43
+ const purposeForRecipe = (kind) => PURPOSE_BY_RECIPE_KIND[kind];
44
+ exports.purposeForRecipe = purposeForRecipe;
45
+ /**
46
+ * Policy assignment, given the purpose of the op being emitted. Phase 1
47
+ * collapses to a single value; future phases add branches here.
48
+ */
49
+ const policyFor = (purpose) => {
50
+ switch (purpose) {
51
+ case "template-structure":
52
+ case "composition-structure":
53
+ return "CreateAndUpdate";
54
+ case "datasource-item":
55
+ case "page-item":
56
+ return "CreateOnly";
57
+ }
58
+ };
59
+ exports.policyFor = policyFor;
60
+ /**
61
+ * Convenience: the default policy a recipe of the given kind should attach
62
+ * to every op it emits. Compiler call site:
63
+ *
64
+ * const policy = defaultPolicyForRecipe(recipe.kind);
65
+ * operations.push({ op: "CreateItem", policy, ... });
66
+ */
67
+ const defaultPolicyForRecipe = (kind) => (0, exports.policyFor)((0, exports.purposeForRecipe)(kind));
68
+ exports.defaultPolicyForRecipe = defaultPolicyForRecipe;
69
+ /**
70
+ * Type guard for narrowing op kinds — exposed so consumers (planner,
71
+ * executor, telemetry) can dispatch on policy without re-implementing the
72
+ * mapping.
73
+ */
74
+ const policyForOp = (op) => op.policy;
75
+ exports.policyForOp = policyForOp;