@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,843 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensureEnumerationTemplates = exports.ensureContentModelsGroupFolder = exports.ensureRenderingsSectionFolder = exports.ensurePresentationParametersBucket = exports.ensureComponentFoldersBucket = exports.ensureSectionFolder = exports.resolveRenderingParent = exports.resolvePresentationParametersBucketPath = exports.resolveComponentFoldersBucketPath = exports.resolveComponentTemplateParent = exports.resolveEnumFolderPath = exports.siteOf = exports.joinPath = exports.PRESENTATION_PARAMETERS_BUCKET = exports.COMPONENT_FOLDERS_BUCKET = exports.DEFAULT_FIELDS_SECTION = exports.PARAMS_SECTION_NAME = void 0;
4
+ exports.sharedField = sharedField;
5
+ exports.versionedField = versionedField;
6
+ exports.emitDatasourceTemplate = emitDatasourceTemplate;
7
+ exports.buildFieldOp = buildFieldOp;
8
+ exports.buildStandardValuesFieldEntries = buildStandardValuesFieldEntries;
9
+ const guids_1 = require("../guids");
10
+ const errors_1 = require("../../shared/errors");
11
+ const sitecore_templates_1 = require("../ir/sitecore-templates");
12
+ const field_types_1 = require("../schema/field-types");
13
+ const source_fields_1 = require("../schema/source-fields");
14
+ exports.PARAMS_SECTION_NAME = "Parameters";
15
+ exports.DEFAULT_FIELDS_SECTION = "Content";
16
+ exports.COMPONENT_FOLDERS_BUCKET = "Component Folders";
17
+ exports.PRESENTATION_PARAMETERS_BUCKET = "Presentation Parameters";
18
+ const joinPath = (parent, name) => {
19
+ const trimmed = parent.endsWith("/") ? parent.slice(0, -1) : parent;
20
+ return `${trimmed}/${name}`;
21
+ };
22
+ exports.joinPath = joinPath;
23
+ /** Site name for deterministic folder refKeys. */
24
+ const siteOf = (context) => context.site ?? "default";
25
+ exports.siteOf = siteOf;
26
+ /**
27
+ * Resolve a `sitecore.enumHandle` reference to the tenant content path
28
+ * the enumeration's folder lives at. Used by `resolveFieldSource` to
29
+ * emit Droplink Source values as content paths (the form SXA Headless's
30
+ * rendering parameter dialog accepts) rather than `{GUID}` references.
31
+ *
32
+ * Path shape:
33
+ * - With `location.folder` set →
34
+ * `<enumerationsRoot>/<folder>/<enum.name>`.
35
+ * - Without `location.folder` → `<enumerationsRoot>/<enum.name>` (flat).
36
+ *
37
+ * Throws INPUT_INVALID when the enum handle isn't in the recipe set
38
+ * (author error: `sitecore.enumHandle` references something that
39
+ * doesn't exist), or when `enumerationsRoot` is unset on the context.
40
+ */
41
+ const resolveEnumFolderPath = (context, enumHandle, consumerHandle) => {
42
+ if (!context.enumerationsRoot) {
43
+ throw (0, errors_1.createCliError)(`Recipe '${consumerHandle}' references sitecore.enumHandle='${enumHandle}' but no enumerationsRoot is configured.`, "INPUT_INVALID", {
44
+ hint: "Set `enumerationsRoot` on the active envProfile in sitecoreai.cli.json.",
45
+ });
46
+ }
47
+ const enumRecipe = context.enumsByHandle?.get(enumHandle);
48
+ if (!enumRecipe) {
49
+ throw (0, errors_1.createCliError)(`Recipe '${consumerHandle}' references sitecore.enumHandle='${enumHandle}' but no EnumerationRecipe with that handle is in the set.`, "INPUT_INVALID", {
50
+ hint: "Add an `EnumerationRecipe` (kind: 'enumeration') with the matching handle to the recipe set, or change the field's `sitecore.enumHandle` to point at an existing one.",
51
+ });
52
+ }
53
+ const folder = enumRecipe.location?.folder;
54
+ return folder
55
+ ? (0, exports.joinPath)((0, exports.joinPath)(context.enumerationsRoot, folder), enumRecipe.name)
56
+ : (0, exports.joinPath)(context.enumerationsRoot, enumRecipe.name);
57
+ };
58
+ exports.resolveEnumFolderPath = resolveEnumFolderPath;
59
+ function sharedField(fieldGuid, value) {
60
+ return { fieldId: fieldGuid, value };
61
+ }
62
+ function versionedField(fieldGuid, value) {
63
+ return {
64
+ fieldId: fieldGuid,
65
+ language: sitecore_templates_1.DEFAULT_LANGUAGE,
66
+ version: sitecore_templates_1.DEFAULT_VERSION,
67
+ value,
68
+ };
69
+ }
70
+ /**
71
+ * Resolve the parent path under which a `ComponentTemplateRecipe`'s
72
+ * template item lands.
73
+ *
74
+ * - With section + componentsRoot → `<componentsRoot>/<section>` (new layout).
75
+ * - With section only → `<templatesRoot>/<section>` (mid-migration fallback).
76
+ * - Without section → `<templatesRoot>` (legacy flat layout).
77
+ */
78
+ const resolveComponentTemplateParent = (context, section) => {
79
+ if (section) {
80
+ if (context.componentsRoot) {
81
+ return (0, exports.joinPath)(context.componentsRoot, section);
82
+ }
83
+ return (0, exports.joinPath)(context.templatesRoot, section);
84
+ }
85
+ return context.templatesRoot;
86
+ };
87
+ exports.resolveComponentTemplateParent = resolveComponentTemplateParent;
88
+ /**
89
+ * Resolve the parent path for a Component Folder template — the
90
+ * `<Component> Folder` items emitted when a recipe declares
91
+ * `children:`. Always nested under
92
+ * `<sectionRoot>/Component Folders/`.
93
+ */
94
+ const resolveComponentFoldersBucketPath = (context, section) => (0, exports.joinPath)((0, exports.resolveComponentTemplateParent)(context, section), exports.COMPONENT_FOLDERS_BUCKET);
95
+ exports.resolveComponentFoldersBucketPath = resolveComponentFoldersBucketPath;
96
+ /**
97
+ * Resolve the parent path for a Presentation Parameters template —
98
+ * `<sectionRoot>/Presentation Parameters/`. When the recipe lacks a
99
+ * section (legacy callers), parameters templates land directly under
100
+ * `templatesRoot` to match the old flat layout.
101
+ */
102
+ const resolvePresentationParametersBucketPath = (context, section) => {
103
+ if (!section) {
104
+ return context.templatesRoot;
105
+ }
106
+ return (0, exports.joinPath)((0, exports.resolveComponentTemplateParent)(context, section), exports.PRESENTATION_PARAMETERS_BUCKET);
107
+ };
108
+ exports.resolvePresentationParametersBucketPath = resolvePresentationParametersBucketPath;
109
+ /**
110
+ * Resolve the parent path for the rendering item.
111
+ *
112
+ * - With section → `<renderingsRoot>/<section>/<Component>`.
113
+ * - Without → legacy flat `<renderingsRoot>/<Component>`.
114
+ */
115
+ const resolveRenderingParent = (context, section) => (section ? (0, exports.joinPath)(context.renderingsRoot, section) : context.renderingsRoot);
116
+ exports.resolveRenderingParent = resolveRenderingParent;
117
+ /**
118
+ * Ensure a section folder (under `componentsRoot/<section>`) exists.
119
+ * Idempotent: emits a CreateOnly CreateItem op the first time a given
120
+ * (site, section) pair is seen and records the refKey in the
121
+ * `emittedFolders` set so subsequent calls are no-ops.
122
+ *
123
+ * Returns the section folder's refKey for downstream callers that want
124
+ * to nest items under it.
125
+ */
126
+ const ensureSectionFolder = (operations, context, section, emittedFolders) => {
127
+ const site = (0, exports.siteOf)(context);
128
+ const refKey = (0, guids_1.sectionFolderId)(site, section);
129
+ if (emittedFolders.has(refKey))
130
+ return refKey;
131
+ emittedFolders.add(refKey);
132
+ const parent = context.componentsRoot ?? context.templatesRoot;
133
+ const path = (0, exports.joinPath)(parent, section);
134
+ operations.push({
135
+ op: "CreateItem",
136
+ policy: "CreateOnly",
137
+ label: `section-folder:${site}:${section}`,
138
+ id: refKey,
139
+ path,
140
+ parent: { kind: "ref-path", value: parent },
141
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FOLDER,
142
+ name: section,
143
+ fields: [sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.FOLDER_ICON })],
144
+ });
145
+ return refKey;
146
+ };
147
+ exports.ensureSectionFolder = ensureSectionFolder;
148
+ /**
149
+ * Ensure a "Component Folders" subfolder exists under the section
150
+ * folder. Idempotent.
151
+ */
152
+ const ensureComponentFoldersBucket = (operations, context, section, emittedFolders) => {
153
+ const site = (0, exports.siteOf)(context);
154
+ const refKey = (0, guids_1.componentFoldersBucketId)(site, section);
155
+ if (emittedFolders.has(refKey))
156
+ return refKey;
157
+ emittedFolders.add(refKey);
158
+ const sectionRefKey = (0, exports.ensureSectionFolder)(operations, context, section, emittedFolders);
159
+ const parentPath = (0, exports.resolveComponentTemplateParent)(context, section);
160
+ operations.push({
161
+ op: "CreateItem",
162
+ policy: "CreateOnly",
163
+ label: `component-folders-bucket:${site}:${section}`,
164
+ id: refKey,
165
+ path: (0, exports.joinPath)(parentPath, exports.COMPONENT_FOLDERS_BUCKET),
166
+ parent: { kind: "ref-recipe", refKey: sectionRefKey },
167
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FOLDER,
168
+ name: exports.COMPONENT_FOLDERS_BUCKET,
169
+ fields: [sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.FOLDER_ICON })],
170
+ });
171
+ return refKey;
172
+ };
173
+ exports.ensureComponentFoldersBucket = ensureComponentFoldersBucket;
174
+ /**
175
+ * Ensure a "Presentation Parameters" subfolder exists under the section
176
+ * folder. Idempotent.
177
+ */
178
+ const ensurePresentationParametersBucket = (operations, context, section, emittedFolders) => {
179
+ const site = (0, exports.siteOf)(context);
180
+ const refKey = (0, guids_1.presentationParametersBucketId)(site, section);
181
+ if (emittedFolders.has(refKey))
182
+ return refKey;
183
+ emittedFolders.add(refKey);
184
+ const sectionRefKey = (0, exports.ensureSectionFolder)(operations, context, section, emittedFolders);
185
+ const parentPath = (0, exports.resolveComponentTemplateParent)(context, section);
186
+ operations.push({
187
+ op: "CreateItem",
188
+ policy: "CreateOnly",
189
+ label: `presentation-parameters-bucket:${site}:${section}`,
190
+ id: refKey,
191
+ path: (0, exports.joinPath)(parentPath, exports.PRESENTATION_PARAMETERS_BUCKET),
192
+ parent: { kind: "ref-recipe", refKey: sectionRefKey },
193
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FOLDER,
194
+ name: exports.PRESENTATION_PARAMETERS_BUCKET,
195
+ fields: [sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.FOLDER_ICON })],
196
+ });
197
+ return refKey;
198
+ };
199
+ exports.ensurePresentationParametersBucket = ensurePresentationParametersBucket;
200
+ /**
201
+ * Ensure a section subfolder under the renderings tree exists —
202
+ * `<renderingsRoot>/<section>/`. Mirrors the templates side; the
203
+ * rendering tree shape mirrors the template tree per the layout plan.
204
+ */
205
+ const ensureRenderingsSectionFolder = (operations, context, section, emittedFolders) => {
206
+ const site = (0, exports.siteOf)(context);
207
+ const refKey = (0, guids_1.renderingsSectionFolderId)(site, section);
208
+ if (emittedFolders.has(refKey))
209
+ return refKey;
210
+ emittedFolders.add(refKey);
211
+ const path = (0, exports.joinPath)(context.renderingsRoot, section);
212
+ operations.push({
213
+ op: "CreateItem",
214
+ policy: "CreateOnly",
215
+ label: `renderings-section-folder:${site}:${section}`,
216
+ id: refKey,
217
+ path,
218
+ parent: { kind: "ref-path", value: context.renderingsRoot },
219
+ // Real SXA renderings-tree section folders use `Rendering Folder`,
220
+ // not the generic `Folder` template. Verified against live tenant
221
+ // 2026-05-02 — every section under
222
+ // `/sitecore/layout/Renderings/Project/<site>/` conforms to this.
223
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.RENDERING_FOLDER,
224
+ name: section,
225
+ fields: [sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.FOLDER_ICON })],
226
+ });
227
+ return refKey;
228
+ };
229
+ exports.ensureRenderingsSectionFolder = ensureRenderingsSectionFolder;
230
+ /**
231
+ * Ensure a Content Models group folder exists. Returns the refKey for
232
+ * downstream `CreateItem.parent` references. Idempotent across
233
+ * repeated calls within one recipe-set compile.
234
+ */
235
+ const ensureContentModelsGroupFolder = (operations, context, group, emittedFolders) => {
236
+ if (!context.contentModelsRoot)
237
+ return undefined;
238
+ const site = (0, exports.siteOf)(context);
239
+ const refKey = (0, guids_1.contentModelsGroupFolderId)(site, group);
240
+ if (emittedFolders.has(refKey))
241
+ return refKey;
242
+ emittedFolders.add(refKey);
243
+ const path = (0, exports.joinPath)(context.contentModelsRoot, group);
244
+ operations.push({
245
+ op: "CreateItem",
246
+ policy: "CreateOnly",
247
+ label: `content-models-group-folder:${site}:${group}`,
248
+ id: refKey,
249
+ path,
250
+ parent: { kind: "ref-path", value: context.contentModelsRoot },
251
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FOLDER,
252
+ name: group,
253
+ fields: [sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.FOLDER_ICON })],
254
+ });
255
+ return refKey;
256
+ };
257
+ exports.ensureContentModelsGroupFolder = ensureContentModelsGroupFolder;
258
+ const ensureEnumerationTemplates = (operations, context, site, emittedFolders) => {
259
+ const folderTemplateRefKey = (0, guids_1.enumerationsFolderTemplateId)(site);
260
+ const enumerationTemplateRefKey = (0, guids_1.enumerationTemplateId)(site);
261
+ const containerValueFieldRefKey = (0, guids_1.enumerationContainerValueFieldId)(site);
262
+ const valueTemplateRefKey = (0, guids_1.enumerationValueTemplateId)(site);
263
+ const valueFieldRefKey = (0, guids_1.enumerationTemplateValueFieldId)(site);
264
+ const sentinel = `enumeration-templates:${site}`;
265
+ if (emittedFolders.has(sentinel)) {
266
+ return {
267
+ folderTemplateRefKey,
268
+ enumerationTemplateRefKey,
269
+ containerValueFieldRefKey,
270
+ valueTemplateRefKey,
271
+ valueFieldRefKey,
272
+ };
273
+ }
274
+ emittedFolders.add(sentinel);
275
+ // Enum templates live at the SITE templates root's `/Presentation`
276
+ // bucket (sibling of `/Components`), NOT nested under `/Components`.
277
+ // Orchestrators typically alias `templatesRoot` and `componentsRoot`
278
+ // to the same `<siteRoot>/Components` value; strip the trailing
279
+ // `/Components` segment from whichever is provided to land on the
280
+ // site templates root. When the input doesn't end in `/Components`
281
+ // (legacy flat layout), use it as-is.
282
+ const root = context.componentsRoot ?? context.templatesRoot;
283
+ const siteTemplatesRoot = root.replace(/\/Components$/, "");
284
+ const parentPath = (0, exports.joinPath)(siteTemplatesRoot, "Presentation");
285
+ const templateEntries = [
286
+ { refKey: folderTemplateRefKey, name: "Enumerations Folder" },
287
+ { refKey: enumerationTemplateRefKey, name: "Enumeration" },
288
+ { refKey: valueTemplateRefKey, name: "Enumeration Value" },
289
+ ];
290
+ for (const { refKey, name } of templateEntries) {
291
+ operations.push({
292
+ op: "CreateItem",
293
+ policy: "CreateOnly",
294
+ label: `enumeration-template:${site}:${name}`,
295
+ id: refKey,
296
+ path: (0, exports.joinPath)(parentPath, name),
297
+ parent: { kind: "ref-path", value: parentPath },
298
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE,
299
+ name,
300
+ fields: [sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: sitecore_templates_1.ENUMERATION_ICON })],
301
+ });
302
+ operations.push({
303
+ op: "SetBaseTemplates",
304
+ policy: "CreateOnly",
305
+ label: `enumeration-template-base:${site}:${name}`,
306
+ itemRefKey: refKey,
307
+ baseTemplates: [sitecore_templates_1.STANDARD_TEMPLATE_ID],
308
+ });
309
+ }
310
+ // Inner `Enumeration` Section + `Value` field — emitted on BOTH the
311
+ // Enumeration template (for the per-enum container's default value)
312
+ // and the Enumeration Value template (for each leaf value's payload).
313
+ // Same field name + shape on both so Edge consumers query the same
314
+ // way to read either the canonical default (off the container) or a
315
+ // leaf payload (off a value item):
316
+ // `item.field("Value").value`.
317
+ const innerValueFieldEntries = [
318
+ {
319
+ templatePath: (0, exports.joinPath)(parentPath, "Enumeration"),
320
+ templateRefKey: enumerationTemplateRefKey,
321
+ sectionRefKey: (0, guids_1.enumerationContainerSectionId)(site),
322
+ fieldRefKey: containerValueFieldRefKey,
323
+ labelPrefix: "enumeration-template",
324
+ },
325
+ {
326
+ templatePath: (0, exports.joinPath)(parentPath, "Enumeration Value"),
327
+ templateRefKey: valueTemplateRefKey,
328
+ sectionRefKey: (0, guids_1.enumerationTemplateSectionId)(site),
329
+ fieldRefKey: valueFieldRefKey,
330
+ labelPrefix: "enumeration-value-template",
331
+ },
332
+ ];
333
+ for (const e of innerValueFieldEntries) {
334
+ const sectionPath = (0, exports.joinPath)(e.templatePath, "Enumeration");
335
+ operations.push({
336
+ op: "CreateItem",
337
+ policy: "CreateOnly",
338
+ label: `${e.labelPrefix}-section:${site}`,
339
+ id: e.sectionRefKey,
340
+ path: sectionPath,
341
+ parent: { kind: "ref-recipe", refKey: e.templateRefKey },
342
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_SECTION,
343
+ name: "Enumeration",
344
+ fields: [],
345
+ });
346
+ operations.push({
347
+ op: "CreateItem",
348
+ policy: "CreateOnly",
349
+ label: `${e.labelPrefix}-value-field:${site}`,
350
+ id: e.fieldRefKey,
351
+ path: (0, exports.joinPath)(sectionPath, "Value"),
352
+ parent: { kind: "ref-recipe", refKey: e.sectionRefKey },
353
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FIELD,
354
+ name: "Value",
355
+ fields: [
356
+ sharedField(sitecore_templates_1.TEMPLATE_FIELD_FIELDS.TYPE, {
357
+ kind: "string",
358
+ value: (0, field_types_1.sitecoreFieldTypeLabel)("single-line-text"),
359
+ }),
360
+ sharedField(sitecore_templates_1.SYSTEM_FIELDS.SORT_ORDER, { kind: "number", value: 100 }),
361
+ sharedField(sitecore_templates_1.TEMPLATE_FIELD_FIELDS.SHARED, { kind: "string", value: "1" }),
362
+ versionedField(sitecore_templates_1.TEMPLATE_FIELD_FIELDS.TITLE, { kind: "string", value: "Value" }),
363
+ versionedField(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: "Value" }),
364
+ ],
365
+ });
366
+ }
367
+ // Standard Values + Insert Options for each template that authors can
368
+ // insert into. Living at the template definition (not at every data
369
+ // folder) keeps Droplink picker results clean — only real value items
370
+ // appear, no stray __Standard Values siblings.
371
+ const standardValuesEntries = [
372
+ {
373
+ templateRefKey: folderTemplateRefKey,
374
+ templateName: "Enumerations Folder",
375
+ svRefKey: (0, guids_1.enumerationsFolderTemplateStandardValuesId)(site),
376
+ // Folders contain enums (typical) or sub-folders (nesting via
377
+ // multi-segment `folder: "Theme/Color"` recipes).
378
+ insertOptions: [enumerationTemplateRefKey, folderTemplateRefKey],
379
+ },
380
+ {
381
+ templateRefKey: enumerationTemplateRefKey,
382
+ templateName: "Enumeration",
383
+ svRefKey: (0, guids_1.enumerationTemplateStandardValuesId)(site),
384
+ // Per-enum items only contain values — never sub-enums or folders.
385
+ insertOptions: [valueTemplateRefKey],
386
+ },
387
+ ];
388
+ for (const entry of standardValuesEntries) {
389
+ const svPath = (0, exports.joinPath)((0, exports.joinPath)(parentPath, entry.templateName), "__Standard Values");
390
+ operations.push({
391
+ op: "CreateItem",
392
+ policy: "CreateOnly",
393
+ label: `enumeration-template-standard-values:${site}:${entry.templateName}`,
394
+ id: entry.svRefKey,
395
+ path: svPath,
396
+ parent: { kind: "ref-recipe", refKey: entry.templateRefKey },
397
+ templateOf: entry.templateRefKey,
398
+ name: "__Standard Values",
399
+ fields: [],
400
+ });
401
+ // SetStandardValues + Insert Options are recipe-controlled and
402
+ // CreateAndUpdate so re-pushes always reconcile the link + the
403
+ // Insert Options list — there's no "preserve CMS edit" case worth
404
+ // honouring (authors edit the recipe, not the SV's __Masters field
405
+ // directly), and CreateOnly was leaving stale values from earlier
406
+ // broken pushes in place.
407
+ operations.push({
408
+ op: "SetStandardValues",
409
+ policy: "CreateAndUpdate",
410
+ label: `enumeration-template-link-standard-values:${site}:${entry.templateName}`,
411
+ templateRefKey: entry.templateRefKey,
412
+ standardValuesRefKey: entry.svRefKey,
413
+ });
414
+ // `ref-recipe-list`, NOT `ref-guid-list` — the executor must
415
+ // resolve each template refKey against the captured-itemId map to
416
+ // the server-assigned itemId before rendering. `ref-guid-list`
417
+ // emits refKey GUIDs verbatim; those are deterministic compile-time
418
+ // values, not the actual tenant-side template IDs, so the resulting
419
+ // `__Masters` value points at items that don't exist and the
420
+ // editor's Insert menu silently has nothing to enumerate.
421
+ operations.push({
422
+ op: "SetField",
423
+ policy: "CreateAndUpdate",
424
+ label: `enumeration-template-insert-options:${site}:${entry.templateName}`,
425
+ itemRefKey: entry.svRefKey,
426
+ fieldId: sitecore_templates_1.SYSTEM_FIELDS.INSERT_OPTIONS,
427
+ value: {
428
+ kind: "ref-recipe-list",
429
+ refKeys: [...entry.insertOptions],
430
+ },
431
+ });
432
+ }
433
+ return {
434
+ folderTemplateRefKey,
435
+ enumerationTemplateRefKey,
436
+ containerValueFieldRefKey,
437
+ valueTemplateRefKey,
438
+ valueFieldRefKey,
439
+ };
440
+ };
441
+ exports.ensureEnumerationTemplates = ensureEnumerationTemplates;
442
+ function emitDatasourceTemplate(operations, recipe, context, icon, policy) {
443
+ const site = (0, exports.siteOf)(context);
444
+ const tplRefKey = (0, guids_1.templateId)(site, recipe.handle);
445
+ const parentPath = recipe.parentPath ?? context.templatesRoot;
446
+ const tplPath = (0, exports.joinPath)(parentPath, recipe.name);
447
+ const parentRef = recipe.parentRefKey
448
+ ? { kind: "ref-recipe", refKey: recipe.parentRefKey }
449
+ : { kind: "ref-path", value: parentPath };
450
+ operations.push({
451
+ op: "CreateItem",
452
+ policy,
453
+ label: `template:${recipe.handle}`,
454
+ id: tplRefKey,
455
+ path: tplPath,
456
+ parent: parentRef,
457
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE,
458
+ name: recipe.name,
459
+ fields: [
460
+ sharedField(sitecore_templates_1.SYSTEM_FIELDS.ICON, { kind: "string", value: icon }),
461
+ versionedField(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: recipe.displayName }),
462
+ ],
463
+ });
464
+ operations.push({
465
+ op: "SetBaseTemplates",
466
+ policy,
467
+ label: `base-templates:${recipe.handle}`,
468
+ itemRefKey: tplRefKey,
469
+ baseTemplates: [sitecore_templates_1.STANDARD_TEMPLATE_ID, ...(recipe.additionalBaseTemplates ?? [])],
470
+ });
471
+ for (const group of groupFieldsBySection(recipe.fields)) {
472
+ const secRefKey = (0, guids_1.sectionId)(site, recipe.handle, group.section);
473
+ const secPath = (0, exports.joinPath)(tplPath, group.section);
474
+ operations.push({
475
+ op: "CreateItem",
476
+ policy,
477
+ label: `section:${recipe.handle}/${group.section}`,
478
+ id: secRefKey,
479
+ path: secPath,
480
+ parent: { kind: "ref-recipe", refKey: tplRefKey },
481
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_SECTION,
482
+ name: group.section,
483
+ fields: [],
484
+ });
485
+ group.fields.forEach((field, index) => {
486
+ operations.push(...buildFieldOp({
487
+ recipeHandle: recipe.handle,
488
+ fieldRefKey: (0, guids_1.fieldId)(site, recipe.handle, field.name),
489
+ fieldPath: (0, exports.joinPath)(secPath, field.name),
490
+ parentRefKey: secRefKey,
491
+ labelPrefix: `field:${recipe.handle}`,
492
+ field,
493
+ zeroBasedIndex: index,
494
+ policy,
495
+ site,
496
+ context,
497
+ }));
498
+ });
499
+ }
500
+ const svRefKey = (0, guids_1.standardValuesId)(site, recipe.handle);
501
+ const svPath = (0, exports.joinPath)(tplPath, "__Standard Values");
502
+ operations.push({
503
+ op: "CreateItem",
504
+ policy,
505
+ label: `standard-values:${recipe.handle}`,
506
+ id: svRefKey,
507
+ path: svPath,
508
+ parent: { kind: "ref-recipe", refKey: tplRefKey },
509
+ // The SV item conforms to the template we just created — runtime
510
+ // resolution turns this ref-recipe placeholder into the assigned id.
511
+ templateOf: tplRefKey,
512
+ name: "__Standard Values",
513
+ // Per-field defaults from `field.default` / `field.sitecore.defaultValue`.
514
+ // These pre-fill new datasource items so authors see meaningful
515
+ // initial content instead of an empty form. Reference-shape fields
516
+ // (link/image/etc.) are skipped — their defaults need encoded
517
+ // payloads outside the simple string-default surface.
518
+ fields: buildStandardValuesFieldEntries(site, recipe.handle, recipe.fields),
519
+ });
520
+ operations.push({
521
+ op: "SetStandardValues",
522
+ policy,
523
+ label: `link-standard-values:${recipe.handle}`,
524
+ templateRefKey: tplRefKey,
525
+ standardValuesRefKey: svRefKey,
526
+ });
527
+ if (recipe.insertOptions && recipe.insertOptions.length > 0) {
528
+ operations.push({
529
+ op: "SetField",
530
+ policy,
531
+ label: `insert-options:${recipe.handle}`,
532
+ itemRefKey: svRefKey,
533
+ fieldId: sitecore_templates_1.SYSTEM_FIELDS.INSERT_OPTIONS,
534
+ value: {
535
+ kind: "ref-recipe-list",
536
+ refKeys: recipe.insertOptions.map((handle) => (0, guids_1.templateId)(site, handle)),
537
+ },
538
+ });
539
+ }
540
+ }
541
+ /**
542
+ * Build the CreateItem op for a single field definition.
543
+ *
544
+ * Always returns exactly one op — the field-definition item itself.
545
+ * Backing storage for enum-shaped fields is decided by the field's
546
+ * `sitecore.type` / `sitecore.enumHandle` and resolved into the
547
+ * `Source` field via `resolveFieldSource`:
548
+ * - `sitecore.type: "droplist"` + inline `values: [...]` → Source is
549
+ * a pipe-separated literal; Sitecore enumerates the string directly,
550
+ * no value items needed.
551
+ * - `sitecore.enumHandle: "<handle>"` (Droplink default) → Source is
552
+ * the EnumerationRecipe's folder path on the tenant; the picker
553
+ * enumerates that path's children at editor time. The values live
554
+ * under the `EnumerationRecipe`'s folder item, emitted by
555
+ * `compileEnumerationRecipe`.
556
+ *
557
+ * Inline Droplink (`shape: "enum"` + inline `values` + no `enumHandle`
558
+ * + no `sitecore.type` override) is rejected by `resolveFieldSource`
559
+ * with INPUT_INVALID — it never reliably worked in SXA Headless's
560
+ * rendering parameters dialog (the picker couldn't enumerate the
561
+ * per-field folder), so authors must commit to one of the two
562
+ * supported shapes.
563
+ */
564
+ function buildFieldOp(input) {
565
+ const { recipeHandle, fieldRefKey, fieldPath, parentRefKey, labelPrefix, field, zeroBasedIndex, policy, site, context, } = input;
566
+ const sortOrder = field.sitecore?.sortOrder ?? (zeroBasedIndex + 1) * 100;
567
+ const sitecoreType = resolveSitecoreType(field);
568
+ const fields = [
569
+ sharedField(sitecore_templates_1.TEMPLATE_FIELD_FIELDS.TYPE, {
570
+ kind: "string",
571
+ value: (0, field_types_1.sitecoreFieldTypeLabel)(sitecoreType),
572
+ }),
573
+ sharedField(sitecore_templates_1.SYSTEM_FIELDS.SORT_ORDER, { kind: "number", value: sortOrder }),
574
+ versionedField(sitecore_templates_1.TEMPLATE_FIELD_FIELDS.TITLE, { kind: "string", value: field.name }),
575
+ versionedField(sitecore_templates_1.SYSTEM_FIELDS.DISPLAY_NAME, { kind: "string", value: field.name }),
576
+ ];
577
+ const sourceValue = resolveFieldSource(field, sitecoreType, site, recipeHandle, context);
578
+ if (sourceValue !== undefined) {
579
+ fields.push(sharedField(sitecore_templates_1.TEMPLATE_FIELD_FIELDS.SOURCE, sourceValue));
580
+ }
581
+ return [
582
+ {
583
+ op: "CreateItem",
584
+ policy,
585
+ label: `${labelPrefix}/${field.name}`,
586
+ id: fieldRefKey,
587
+ path: fieldPath,
588
+ parent: { kind: "ref-recipe", refKey: parentRefKey },
589
+ templateOf: sitecore_templates_1.SITECORE_TEMPLATES.TEMPLATE_FIELD,
590
+ name: field.name,
591
+ fields,
592
+ },
593
+ ];
594
+ }
595
+ function resolveSitecoreType(field) {
596
+ if (field.sitecore?.type) {
597
+ return field.sitecore.type;
598
+ }
599
+ const multiple = "multiple" in field ? field.multiple : undefined;
600
+ return (0, field_types_1.defaultSitecoreFieldType)(field.shape, multiple);
601
+ }
602
+ /**
603
+ * Build the field-default entries for a template's `__Standard Values`
604
+ * item. Each entry carries the field's recipe-derived `fieldId` AND
605
+ * `fieldName` — Sitecore resolves recipe-created field GUIDs by name
606
+ * against the SV item's template (the recipe-derived id won't match the
607
+ * tenant's server-assigned field-definition id; the name lookup is what
608
+ * actually writes the value).
609
+ *
610
+ * Reference-shape defaults (link / image / treelist, plus
611
+ * non-enum-backed droplink) are skipped silently — those need encoded
612
+ * GUIDs or structured payloads that the simple `default: "string"`
613
+ * recipe surface can't express. Authors who need defaults for those
614
+ * can layer them in via a `ContentItemRecipe` that targets the SV
615
+ * path explicitly.
616
+ *
617
+ * Enum-shaped fields branch on the resolved Type:
618
+ * - **Type=Droplist** (override): default is the raw string. Droplist
619
+ * reads its options from a pipe-separated Source; SV default is a
620
+ * name match against that list.
621
+ * - **Type=Droplink + `sitecore.enumHandle`** (the canonical shared
622
+ * enum shape): default is a `ref-recipe` GUID reference to the
623
+ * value item under `enumerationFolderId(site, enumHandle)`.
624
+ * - **Type=Droplink without `sitecore.enumHandle`** (inline Droplink):
625
+ * unsupported — `resolveFieldSource` rejects it upstream and this
626
+ * function throws defensively if it ever reaches here.
627
+ *
628
+ * If the declared default isn't actually one of the enum's values, the
629
+ * derived GUID won't exist on the tenant and the SV write fails at
630
+ * apply time — author error, not silently masked here.
631
+ */
632
+ function buildStandardValuesFieldEntries(site, handle, fields,
633
+ // Resolver for the field-definition refKey. Defaults to `fieldId`
634
+ // (component/content templates); pass `paramsFieldId` when emitting
635
+ // SV defaults for a parameters template (which uses a different
636
+ // GUID family scoped under `paramsTemplateId`).
637
+ fieldIdResolver = guids_1.fieldId) {
638
+ const entries = [];
639
+ for (const field of fields) {
640
+ const raw = field.sitecore?.defaultValue ?? field.default;
641
+ if (raw === undefined)
642
+ continue;
643
+ const value = encodeStandardValueDefaultForField(raw, field, site, handle);
644
+ if (value === undefined)
645
+ continue;
646
+ entries.push({
647
+ fieldId: fieldIdResolver(site, handle, field.name),
648
+ fieldName: field.name,
649
+ language: sitecore_templates_1.DEFAULT_LANGUAGE,
650
+ version: sitecore_templates_1.DEFAULT_VERSION,
651
+ value,
652
+ });
653
+ }
654
+ return entries;
655
+ }
656
+ /**
657
+ * Encode an SV default value for a field. Wraps `encodeStandardValueDefault`
658
+ * with shape-aware handling for enum fields.
659
+ *
660
+ * Type decides the encoding shape:
661
+ * - Type=Droplink + `sitecore.enumHandle`: default is a GUID reference
662
+ * to the value item under the EnumerationRecipe's folder
663
+ * (`enumerationFolderId(site, enumHandle)`).
664
+ * - Type=Droplist (override): default is the raw string — Droplist's
665
+ * own enumeration is a pipe-separated Source string, so a name match
666
+ * in that list is the right encoding.
667
+ * - Type=Droplink without `enumHandle`: throws INPUT_INVALID — inline
668
+ * Droplink isn't supported; authors must commit to one of the two
669
+ * shapes above.
670
+ */
671
+ function encodeStandardValueDefaultForField(raw, field, site, handle) {
672
+ if (field.shape === "enum") {
673
+ const sitecoreType = resolveSitecoreType(field);
674
+ if (sitecoreType === "droplist") {
675
+ // Droplist enumerates from a pipe-list Source; the SV default is
676
+ // the raw value string, not a GUID.
677
+ return { kind: "string", value: raw };
678
+ }
679
+ const enumHandle = field.sitecore?.enumHandle;
680
+ if (!enumHandle) {
681
+ // Defensive — `resolveFieldSource` rejects inline Droplink at the
682
+ // upstream call site, so this branch only fires if an enum field
683
+ // somehow reached SV emission without going through field-op
684
+ // construction. Throw rather than emit a broken default.
685
+ throw (0, errors_1.createCliError)(`Field '${field.name}' on recipe '${handle}' is shape=enum + Type=Droplink but declares no sitecore.enumHandle; inline Droplink isn't supported.`, "INPUT_INVALID", {
686
+ hint: "Either set `sitecore.enumHandle` to a shared EnumerationRecipe's handle, or override `sitecore.type` to 'droplist' for an inline pipe-list dropdown.",
687
+ });
688
+ }
689
+ return {
690
+ kind: "ref-recipe",
691
+ refKey: (0, guids_1.enumValueId)((0, guids_1.enumerationFolderId)(site, enumHandle), raw),
692
+ };
693
+ }
694
+ return encodeStandardValueDefault(raw, resolveSitecoreType(field));
695
+ }
696
+ const BOOLEAN_TRUE_PATTERN = /^(1|true|yes|on|enabled)$/i;
697
+ function encodeStandardValueDefault(raw, type) {
698
+ switch (type) {
699
+ case "checkbox":
700
+ // Sitecore stores checkboxes as "1" (true) / "" (false).
701
+ return { kind: "string", value: BOOLEAN_TRUE_PATTERN.test(raw.trim()) ? "1" : "" };
702
+ case "single-line-text":
703
+ case "multi-line-text":
704
+ case "rich-text":
705
+ case "droplist":
706
+ case "lookup":
707
+ case "tags":
708
+ case "number":
709
+ case "integer":
710
+ case "date":
711
+ case "datetime":
712
+ return { kind: "string", value: raw };
713
+ case "image":
714
+ case "file":
715
+ case "general-link":
716
+ case "droplink":
717
+ case "treelist":
718
+ case "treelist-with-search":
719
+ // Reference-shape defaults need encoded payloads; not expressible
720
+ // via the simple `default: string` recipe surface. Skip; the field
721
+ // still gets created without a default.
722
+ return undefined;
723
+ }
724
+ }
725
+ /**
726
+ * Resolve a recipe field's `Source` value to a Sitecore-encoded string.
727
+ *
728
+ * When `sourceTypes` references recipe handles, the wire string depends
729
+ * on the resolved Sitecore itemIds — we can't render at compile time, so
730
+ * we emit `ref-source-fields` and the executor finishes the job with the
731
+ * captured-itemId resolver.
732
+ *
733
+ * Sources without handle references (`sourceRaw`, or `sourceQuery` /
734
+ * `sourceScope` alone) render at compile time as a plain string.
735
+ *
736
+ * Enum fields (`shape: "enum"`) accept exactly two shapes — the
737
+ * compiler rejects anything else with INPUT_INVALID:
738
+ * - **Type=Droplink + `sitecore.enumHandle`** (the canonical shared
739
+ * shape): Source is the EnumerationRecipe's tenant content path
740
+ * (resolved via `context.enumsByHandle`). SXA enumerates that
741
+ * path's children as picker entries; the values live as content
742
+ * items the EnumerationRecipe owns. Source is emitted as a path
743
+ * string (not a `{GUID}`) — SXA Headless's rendering parameter
744
+ * dialog only enumerates Droplink Source as a content path / query.
745
+ * - **Type=Droplist (override) + inline `values: [...]`**: Source is
746
+ * a pipe-separated literal of the values — Sitecore reads the
747
+ * option list straight out of the Source string with no folder
748
+ * lookup. No content items are emitted.
749
+ *
750
+ * Inline Droplink (shape=enum + `values` + neither override) is rejected
751
+ * here: SXA Headless's rendering parameters dialog never reliably picked
752
+ * up the per-field folder of values, so authors must commit to one of
753
+ * the two supported shapes.
754
+ *
755
+ * Shared-enum + Droplist isn't supported either — Droplist needs values
756
+ * at compile time, which we can't resolve from a sibling EnumerationRecipe
757
+ * without a lookup.
758
+ */
759
+ function resolveFieldSource(field, type, site, recipeHandle, context) {
760
+ const sc = field.sitecore;
761
+ if (sc) {
762
+ const fields = {
763
+ sourceTypes: sc.sourceTypes,
764
+ sourceQuery: sc.sourceQuery,
765
+ sourceScope: sc.sourceScope,
766
+ sourceRaw: sc.sourceRaw,
767
+ };
768
+ if ((0, source_fields_1.sourceFieldsNeedHandleResolution)(fields)) {
769
+ return {
770
+ kind: "ref-source-fields",
771
+ site,
772
+ sourceTypes: sc.sourceTypes,
773
+ sourceQuery: sc.sourceQuery,
774
+ sourceScope: sc.sourceScope,
775
+ };
776
+ }
777
+ const rendered = (0, source_fields_1.renderSourceFields)(fields, () => {
778
+ throw (0, errors_1.createCliError)("compile-time render should not need handle resolution", "UNKNOWN");
779
+ });
780
+ if (rendered !== undefined) {
781
+ return { kind: "string", value: rendered };
782
+ }
783
+ }
784
+ if (field.shape === "enum") {
785
+ // Droplist override on an enum field needs the inline values
786
+ // baked into Source as a pipe-separated literal — SXA's Droplist
787
+ // enumerates the string directly and never reads a folder.
788
+ if (type === "droplist") {
789
+ if (!field.values || field.values.length === 0) {
790
+ throw (0, errors_1.createCliError)(`Field '${field.name}' on recipe '${recipeHandle}' overrides sitecore.type to 'droplist' but declares no inline values; Droplist needs an inline value list.`, "INPUT_INVALID", {
791
+ hint: 'Either drop the `sitecore.type: "droplist"` override and add `sitecore.enumHandle: "<recipe>@<v>"` (shared Droplink), or add `values: [...]` to the field.',
792
+ });
793
+ }
794
+ return { kind: "string", value: field.values.join("|") };
795
+ }
796
+ if (sc?.enumHandle) {
797
+ // Shared enum + Droplink — Source is the enum folder's tenant
798
+ // content path (NOT a `{GUID}` reference). SXA Headless's
799
+ // rendering parameter dialog enumerates Droplink Source as a path
800
+ // / query; a bare GUID doesn't reliably surface picker options.
801
+ // Path is computable at compile time from the EnumerationRecipe
802
+ // looked up via `context.enumsByHandle`.
803
+ if (!context) {
804
+ throw (0, errors_1.createCliError)(`Field '${field.name}' on recipe '${recipeHandle}' uses sitecore.enumHandle='${sc.enumHandle}' but the field-op builder was invoked without a CompileContext.`, "INPUT_INVALID", {
805
+ hint: "Pass `context` into `buildFieldOp` so the enum's tenant path can be resolved from `enumsByHandle` + `enumerationsRoot`.",
806
+ });
807
+ }
808
+ const enumPath = (0, exports.resolveEnumFolderPath)(context, sc.enumHandle, recipeHandle);
809
+ return { kind: "string", value: enumPath };
810
+ }
811
+ // Inline Droplink (shape=enum + values + no enumHandle + no Droplist
812
+ // override) is not a valid shape — SXA Headless's rendering parameter
813
+ // dialog never reliably picked up a per-field folder of values, so the
814
+ // dropdown stayed empty in Pages. Force the author to commit:
815
+ // - Inline scale → `sitecore.type: "droplist"` + inline `values`.
816
+ // - Shared scale → `sitecore.enumHandle: "<EnumerationRecipe>@<v>"`.
817
+ throw (0, errors_1.createCliError)(`Field '${field.name}' on recipe '${recipeHandle}' is shape=enum but declares neither sitecore.type='droplist' (with inline values) nor sitecore.enumHandle (pointing at a shared EnumerationRecipe); inline Droplink isn't supported.`, "INPUT_INVALID", {
818
+ hint: 'Pick one: add `sitecore.type: "droplist"` for an inline pipe-list dropdown, or `sitecore.enumHandle: "<recipe>@<v>"` to point at a shared EnumerationRecipe (which authors edit out-of-band as content items).',
819
+ });
820
+ }
821
+ if (type === "droplist" && field.values && field.values.length > 0) {
822
+ return { kind: "string", value: field.values.join("|") };
823
+ }
824
+ return undefined;
825
+ }
826
+ /**
827
+ * Group recipe fields by their `sitecore.section` (default "Content").
828
+ * Section emit order = order of first occurrence in the recipe — the
829
+ * compiler is purely stable; recipe authors control ordering.
830
+ */
831
+ function groupFieldsBySection(fields) {
832
+ const order = [];
833
+ const bySection = new Map();
834
+ for (const field of fields) {
835
+ const section = field.sitecore?.section ?? exports.DEFAULT_FIELDS_SECTION;
836
+ if (!bySection.has(section)) {
837
+ bySection.set(section, []);
838
+ order.push(section);
839
+ }
840
+ bySection.get(section).push(field);
841
+ }
842
+ return order.map((section) => ({ section, fields: bySection.get(section) }));
843
+ }