@azure/provisioning-core 1.0.0-beta.1 → 1.0.0-beta.2

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 (571) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +49 -10
  3. package/dist/browser/constructs/built-in-resources/resource-group.d.ts +7 -1
  4. package/dist/browser/constructs/built-in-resources/resource-group.d.ts.map +1 -1
  5. package/dist/browser/constructs/built-in-resources/resource-group.js +26 -6
  6. package/dist/browser/constructs/built-in-resources/resource-group.js.map +1 -1
  7. package/dist/browser/constructs/output.d.ts +1 -1
  8. package/dist/browser/constructs/output.d.ts.map +1 -1
  9. package/dist/browser/constructs/output.js.map +1 -1
  10. package/dist/browser/constructs/parameter.d.ts +1 -1
  11. package/dist/browser/constructs/parameter.d.ts.map +1 -1
  12. package/dist/browser/constructs/parameter.js.map +1 -1
  13. package/dist/browser/constructs/resource/resource-query.d.ts +3 -1
  14. package/dist/browser/constructs/resource/resource-query.d.ts.map +1 -1
  15. package/dist/browser/constructs/resource/resource-query.js +10 -0
  16. package/dist/browser/constructs/resource/resource-query.js.map +1 -1
  17. package/dist/browser/constructs/resource/resource-relationships.d.ts +9 -0
  18. package/dist/browser/constructs/resource/resource-relationships.d.ts.map +1 -0
  19. package/dist/browser/constructs/resource/resource-relationships.js +35 -0
  20. package/dist/browser/constructs/resource/resource-relationships.js.map +1 -0
  21. package/dist/browser/constructs/resource/resource.d.ts +11 -17
  22. package/dist/browser/constructs/resource/resource.d.ts.map +1 -1
  23. package/dist/browser/constructs/resource/resource.js +70 -28
  24. package/dist/browser/constructs/resource/resource.js.map +1 -1
  25. package/dist/browser/constructs/stack.d.ts +2 -16
  26. package/dist/browser/constructs/stack.d.ts.map +1 -1
  27. package/dist/browser/constructs/stack.js +1 -15
  28. package/dist/browser/constructs/stack.js.map +1 -1
  29. package/dist/browser/expression/ast-nodes.d.ts +1 -1
  30. package/dist/browser/expression/ast-nodes.d.ts.map +1 -1
  31. package/dist/browser/expression/ast-nodes.js.map +1 -1
  32. package/dist/browser/expression/expressions.d.ts +2 -9
  33. package/dist/browser/expression/expressions.d.ts.map +1 -1
  34. package/dist/browser/expression/expressions.js +2 -9
  35. package/dist/browser/expression/expressions.js.map +1 -1
  36. package/dist/browser/expression/utils.d.ts +5 -0
  37. package/dist/browser/expression/utils.d.ts.map +1 -0
  38. package/dist/browser/expression/utils.js +25 -0
  39. package/dist/browser/expression/utils.js.map +1 -0
  40. package/dist/browser/index.d.ts +4 -4
  41. package/dist/browser/index.d.ts.map +1 -1
  42. package/dist/browser/index.js.map +1 -1
  43. package/dist/browser/internal.d.ts +2 -5
  44. package/dist/browser/internal.d.ts.map +1 -1
  45. package/dist/browser/internal.js +1 -3
  46. package/dist/browser/internal.js.map +1 -1
  47. package/dist/browser/naming/name-validation.d.ts +15 -0
  48. package/dist/browser/naming/name-validation.d.ts.map +1 -0
  49. package/dist/browser/naming/name-validation.js +82 -0
  50. package/dist/browser/naming/name-validation.js.map +1 -0
  51. package/dist/browser/naming/naming-policy.d.ts +7 -7
  52. package/dist/browser/naming/naming-policy.d.ts.map +1 -1
  53. package/dist/browser/naming/naming-policy.js +166 -33
  54. package/dist/browser/naming/naming-policy.js.map +1 -1
  55. package/dist/browser/naming/naming-rules.d.ts +12 -11
  56. package/dist/browser/naming/naming-rules.d.ts.map +1 -1
  57. package/dist/browser/naming/naming-rules.js +2 -9
  58. package/dist/browser/naming/naming-rules.js.map +1 -1
  59. package/dist/browser/package.json +1 -1
  60. package/dist/{esm/serialization/json/lower.d.ts → browser/serialization/arm-object-conversion.d.ts} +11 -11
  61. package/dist/browser/serialization/arm-object-conversion.d.ts.map +1 -0
  62. package/dist/{esm/serialization/json/lower.js → browser/serialization/arm-object-conversion.js} +20 -20
  63. package/dist/browser/serialization/arm-object-conversion.js.map +1 -0
  64. package/dist/browser/serialization/ast/declaration-builder.d.ts +10 -0
  65. package/dist/browser/serialization/ast/declaration-builder.d.ts.map +1 -0
  66. package/dist/browser/serialization/ast/declaration-builder.js +265 -0
  67. package/dist/browser/serialization/ast/declaration-builder.js.map +1 -0
  68. package/dist/browser/serialization/ast/declaration-dependencies.d.ts +18 -0
  69. package/dist/browser/serialization/ast/declaration-dependencies.d.ts.map +1 -0
  70. package/dist/browser/serialization/ast/declaration-dependencies.js +96 -0
  71. package/dist/browser/serialization/ast/declaration-dependencies.js.map +1 -0
  72. package/dist/browser/serialization/ast/expression-builder.d.ts +14 -0
  73. package/dist/browser/serialization/ast/expression-builder.d.ts.map +1 -0
  74. package/dist/browser/serialization/ast/expression-builder.js +313 -0
  75. package/dist/browser/serialization/ast/expression-builder.js.map +1 -0
  76. package/dist/browser/serialization/ast/expression-restorer.d.ts +8 -0
  77. package/dist/browser/serialization/ast/expression-restorer.d.ts.map +1 -0
  78. package/dist/browser/serialization/ast/expression-restorer.js +162 -0
  79. package/dist/browser/serialization/ast/expression-restorer.js.map +1 -0
  80. package/dist/browser/serialization/ast/expression-rewriter.d.ts +29 -0
  81. package/dist/browser/serialization/ast/expression-rewriter.d.ts.map +1 -0
  82. package/dist/browser/serialization/ast/expression-rewriter.js +257 -0
  83. package/dist/browser/serialization/ast/expression-rewriter.js.map +1 -0
  84. package/dist/browser/serialization/ast/expression-walker.d.ts +16 -0
  85. package/dist/browser/serialization/ast/expression-walker.d.ts.map +1 -0
  86. package/dist/browser/serialization/ast/expression-walker.js +154 -0
  87. package/dist/browser/serialization/ast/expression-walker.js.map +1 -0
  88. package/dist/browser/serialization/ast/generated/ast.d.ts.map +1 -0
  89. package/dist/browser/serialization/ast/generated/ast.js.map +1 -0
  90. package/dist/browser/serialization/ast/index.d.ts +7 -0
  91. package/dist/browser/serialization/ast/index.d.ts.map +1 -0
  92. package/dist/browser/serialization/ast/index.js.map +1 -0
  93. package/dist/browser/serialization/ast/resource-utils.d.ts +10 -0
  94. package/dist/browser/serialization/ast/resource-utils.d.ts.map +1 -0
  95. package/dist/browser/serialization/ast/resource-utils.js +52 -0
  96. package/dist/browser/serialization/ast/resource-utils.js.map +1 -0
  97. package/dist/browser/serialization/bicep/file-layout/authored-context.d.ts +12 -0
  98. package/dist/browser/serialization/bicep/file-layout/authored-context.d.ts.map +1 -0
  99. package/dist/browser/serialization/bicep/file-layout/authored-context.js +57 -0
  100. package/dist/browser/serialization/bicep/file-layout/authored-context.js.map +1 -0
  101. package/dist/browser/serialization/bicep/file-layout/bicep-namer.d.ts +11 -0
  102. package/dist/browser/serialization/bicep/file-layout/bicep-namer.d.ts.map +1 -0
  103. package/dist/browser/serialization/bicep/file-layout/bicep-namer.js +100 -0
  104. package/dist/browser/serialization/bicep/file-layout/bicep-namer.js.map +1 -0
  105. package/dist/browser/serialization/bicep/file-layout/build-bicep-files.d.ts +7 -0
  106. package/dist/browser/serialization/bicep/file-layout/build-bicep-files.d.ts.map +1 -0
  107. package/dist/browser/serialization/bicep/file-layout/build-bicep-files.js +46 -0
  108. package/dist/browser/serialization/bicep/file-layout/build-bicep-files.js.map +1 -0
  109. package/dist/browser/serialization/bicep/file-layout/deployment-planning.d.ts +19 -0
  110. package/dist/browser/serialization/bicep/file-layout/deployment-planning.d.ts.map +1 -0
  111. package/dist/browser/serialization/bicep/file-layout/deployment-planning.js +68 -0
  112. package/dist/browser/serialization/bicep/file-layout/deployment-planning.js.map +1 -0
  113. package/dist/browser/serialization/bicep/file-layout/deployment-resource-utils.d.ts +8 -0
  114. package/dist/browser/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +1 -0
  115. package/dist/browser/serialization/bicep/file-layout/deployment-resource-utils.js +67 -0
  116. package/dist/browser/serialization/bicep/file-layout/deployment-resource-utils.js.map +1 -0
  117. package/dist/browser/serialization/bicep/file-layout/file-dependencies.d.ts +4 -0
  118. package/dist/browser/serialization/bicep/file-layout/file-dependencies.d.ts.map +1 -0
  119. package/dist/browser/serialization/bicep/file-layout/file-dependencies.js +32 -0
  120. package/dist/browser/serialization/bicep/file-layout/file-dependencies.js.map +1 -0
  121. package/dist/browser/serialization/bicep/file-layout/file-paths.d.ts +3 -0
  122. package/dist/browser/serialization/bicep/file-layout/file-paths.d.ts.map +1 -0
  123. package/dist/browser/serialization/bicep/file-layout/file-paths.js +46 -0
  124. package/dist/browser/serialization/bicep/file-layout/file-paths.js.map +1 -0
  125. package/dist/browser/serialization/bicep/file-layout/file-preparation.d.ts +34 -0
  126. package/dist/browser/serialization/bicep/file-layout/file-preparation.d.ts.map +1 -0
  127. package/dist/browser/serialization/bicep/file-layout/file-preparation.js +140 -0
  128. package/dist/browser/serialization/bicep/file-layout/file-preparation.js.map +1 -0
  129. package/dist/browser/serialization/bicep/file-layout/reference-wiring.d.ts +3 -0
  130. package/dist/browser/serialization/bicep/file-layout/reference-wiring.d.ts.map +1 -0
  131. package/dist/browser/serialization/bicep/file-layout/reference-wiring.js +225 -0
  132. package/dist/browser/serialization/bicep/file-layout/reference-wiring.js.map +1 -0
  133. package/dist/browser/serialization/bicep/index.d.ts +2 -0
  134. package/dist/browser/serialization/bicep/index.d.ts.map +1 -0
  135. package/dist/browser/serialization/bicep/index.js +4 -0
  136. package/dist/browser/serialization/bicep/index.js.map +1 -0
  137. package/dist/browser/serialization/bicep/render.d.ts +11 -0
  138. package/dist/browser/serialization/bicep/render.d.ts.map +1 -0
  139. package/dist/browser/serialization/bicep/render.js +293 -0
  140. package/dist/browser/serialization/bicep/render.js.map +1 -0
  141. package/dist/browser/serialization/{json/encoding.d.ts → encoding.d.ts} +1 -1
  142. package/dist/browser/serialization/encoding.d.ts.map +1 -0
  143. package/dist/browser/serialization/{json/encoding.js → encoding.js} +2 -12
  144. package/dist/browser/serialization/encoding.js.map +1 -0
  145. package/dist/browser/serialization/{json/util.d.ts → identifiers.d.ts} +1 -1
  146. package/dist/browser/serialization/identifiers.d.ts.map +1 -0
  147. package/dist/browser/serialization/{json/util.js → identifiers.js} +1 -1
  148. package/dist/browser/serialization/identifiers.js.map +1 -0
  149. package/dist/browser/serialization/index.d.ts +1 -1
  150. package/dist/browser/serialization/index.d.ts.map +1 -1
  151. package/dist/browser/serialization/index.js.map +1 -1
  152. package/dist/browser/serialization/json/deserialize.d.ts.map +1 -1
  153. package/dist/browser/serialization/json/deserialize.js +131 -39
  154. package/dist/browser/serialization/json/deserialize.js.map +1 -1
  155. package/dist/browser/serialization/json/serialize.d.ts +1 -1
  156. package/dist/browser/serialization/json/serialize.d.ts.map +1 -1
  157. package/dist/browser/serialization/json/serialize.js +5 -360
  158. package/dist/browser/serialization/json/serialize.js.map +1 -1
  159. package/dist/browser/serialization/pluralize-config.d.ts.map +1 -0
  160. package/dist/browser/serialization/pluralize-config.js.map +1 -0
  161. package/dist/browser/serialization/symbol-map.d.ts +10 -0
  162. package/dist/browser/serialization/symbol-map.d.ts.map +1 -0
  163. package/dist/browser/serialization/symbol-map.js +40 -0
  164. package/dist/browser/serialization/symbol-map.js.map +1 -0
  165. package/dist/browser/shape/shape.d.ts +4 -4
  166. package/dist/browser/shape/shape.js +2 -2
  167. package/dist/browser/shape/shape.js.map +1 -1
  168. package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts +7 -1
  169. package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts.map +1 -1
  170. package/dist/commonjs/constructs/built-in-resources/resource-group.js +27 -6
  171. package/dist/commonjs/constructs/built-in-resources/resource-group.js.map +2 -2
  172. package/dist/commonjs/constructs/output.d.ts +1 -1
  173. package/dist/commonjs/constructs/output.d.ts.map +1 -1
  174. package/dist/commonjs/constructs/output.js.map +1 -1
  175. package/dist/commonjs/constructs/parameter.d.ts +1 -1
  176. package/dist/commonjs/constructs/parameter.d.ts.map +1 -1
  177. package/dist/commonjs/constructs/parameter.js.map +1 -1
  178. package/dist/commonjs/constructs/resource/resource-query.d.ts +3 -1
  179. package/dist/commonjs/constructs/resource/resource-query.d.ts.map +1 -1
  180. package/dist/commonjs/constructs/resource/resource-query.js +11 -0
  181. package/dist/commonjs/constructs/resource/resource-query.js.map +2 -2
  182. package/dist/commonjs/constructs/resource/resource-relationships.d.ts +9 -0
  183. package/dist/commonjs/constructs/resource/resource-relationships.d.ts.map +1 -0
  184. package/dist/commonjs/constructs/resource/resource-relationships.js +59 -0
  185. package/dist/commonjs/constructs/resource/resource-relationships.js.map +7 -0
  186. package/dist/commonjs/constructs/resource/resource.d.ts +11 -17
  187. package/dist/commonjs/constructs/resource/resource.d.ts.map +1 -1
  188. package/dist/commonjs/constructs/resource/resource.js +57 -35
  189. package/dist/commonjs/constructs/resource/resource.js.map +2 -2
  190. package/dist/commonjs/constructs/stack.d.ts +2 -16
  191. package/dist/commonjs/constructs/stack.d.ts.map +1 -1
  192. package/dist/commonjs/constructs/stack.js.map +2 -2
  193. package/dist/commonjs/expression/ast-nodes.d.ts +1 -1
  194. package/dist/commonjs/expression/ast-nodes.d.ts.map +1 -1
  195. package/dist/commonjs/expression/ast-nodes.js.map +1 -1
  196. package/dist/commonjs/expression/expressions.d.ts +2 -9
  197. package/dist/commonjs/expression/expressions.d.ts.map +1 -1
  198. package/dist/commonjs/expression/expressions.js.map +2 -2
  199. package/dist/commonjs/expression/utils.d.ts +5 -0
  200. package/dist/commonjs/expression/utils.d.ts.map +1 -0
  201. package/dist/commonjs/expression/utils.js +43 -0
  202. package/dist/commonjs/expression/utils.js.map +7 -0
  203. package/dist/commonjs/index.d.ts +4 -4
  204. package/dist/commonjs/index.d.ts.map +1 -1
  205. package/dist/commonjs/index.js.map +2 -2
  206. package/dist/commonjs/internal.d.ts +2 -5
  207. package/dist/commonjs/internal.d.ts.map +1 -1
  208. package/dist/commonjs/internal.js +3 -9
  209. package/dist/commonjs/internal.js.map +2 -2
  210. package/dist/commonjs/naming/name-validation.d.ts +15 -0
  211. package/dist/commonjs/naming/name-validation.d.ts.map +1 -0
  212. package/dist/commonjs/naming/name-validation.js +74 -0
  213. package/dist/commonjs/naming/name-validation.js.map +7 -0
  214. package/dist/commonjs/naming/naming-policy.d.ts +7 -7
  215. package/dist/commonjs/naming/naming-policy.d.ts.map +1 -1
  216. package/dist/commonjs/naming/naming-policy.js +136 -26
  217. package/dist/commonjs/naming/naming-policy.js.map +2 -2
  218. package/dist/commonjs/naming/naming-rules.d.ts +12 -11
  219. package/dist/commonjs/naming/naming-rules.d.ts.map +1 -1
  220. package/dist/commonjs/naming/naming-rules.js +4 -11
  221. package/dist/commonjs/naming/naming-rules.js.map +2 -2
  222. package/dist/commonjs/package.json +1 -1
  223. package/dist/{browser/serialization/json/lower.d.ts → commonjs/serialization/arm-object-conversion.d.ts} +11 -11
  224. package/dist/commonjs/serialization/arm-object-conversion.d.ts.map +1 -0
  225. package/dist/commonjs/serialization/{json/lower.js → arm-object-conversion.js} +15 -15
  226. package/dist/commonjs/serialization/arm-object-conversion.js.map +7 -0
  227. package/dist/commonjs/serialization/ast/declaration-builder.d.ts +10 -0
  228. package/dist/commonjs/serialization/ast/declaration-builder.d.ts.map +1 -0
  229. package/dist/commonjs/serialization/ast/declaration-builder.js +274 -0
  230. package/dist/commonjs/serialization/ast/declaration-builder.js.map +7 -0
  231. package/dist/commonjs/serialization/ast/declaration-dependencies.d.ts +18 -0
  232. package/dist/commonjs/serialization/ast/declaration-dependencies.d.ts.map +1 -0
  233. package/dist/commonjs/serialization/ast/declaration-dependencies.js +109 -0
  234. package/dist/commonjs/serialization/ast/declaration-dependencies.js.map +7 -0
  235. package/dist/commonjs/serialization/ast/expression-builder.d.ts +14 -0
  236. package/dist/commonjs/serialization/ast/expression-builder.d.ts.map +1 -0
  237. package/dist/commonjs/serialization/ast/expression-builder.js +316 -0
  238. package/dist/commonjs/serialization/ast/expression-builder.js.map +7 -0
  239. package/dist/commonjs/serialization/ast/expression-restorer.d.ts +8 -0
  240. package/dist/commonjs/serialization/ast/expression-restorer.d.ts.map +1 -0
  241. package/dist/commonjs/serialization/ast/expression-restorer.js +193 -0
  242. package/dist/commonjs/serialization/ast/expression-restorer.js.map +7 -0
  243. package/dist/commonjs/serialization/ast/expression-rewriter.d.ts +29 -0
  244. package/dist/commonjs/serialization/ast/expression-rewriter.d.ts.map +1 -0
  245. package/dist/commonjs/serialization/ast/expression-rewriter.js +270 -0
  246. package/dist/commonjs/serialization/ast/expression-rewriter.js.map +7 -0
  247. package/dist/commonjs/serialization/ast/expression-walker.d.ts +16 -0
  248. package/dist/commonjs/serialization/ast/expression-walker.d.ts.map +1 -0
  249. package/dist/commonjs/serialization/ast/expression-walker.js +165 -0
  250. package/dist/commonjs/serialization/ast/expression-walker.js.map +7 -0
  251. package/dist/commonjs/serialization/ast/generated/ast.d.ts.map +1 -0
  252. package/dist/commonjs/serialization/{contract → ast}/generated/ast.js.map +1 -1
  253. package/dist/commonjs/serialization/ast/index.d.ts +7 -0
  254. package/dist/commonjs/serialization/ast/index.d.ts.map +1 -0
  255. package/dist/commonjs/serialization/{contract → ast}/index.js +3 -3
  256. package/dist/commonjs/serialization/ast/index.js.map +7 -0
  257. package/dist/commonjs/serialization/ast/resource-utils.d.ts +10 -0
  258. package/dist/commonjs/serialization/ast/resource-utils.d.ts.map +1 -0
  259. package/dist/commonjs/serialization/ast/resource-utils.js +71 -0
  260. package/dist/commonjs/serialization/ast/resource-utils.js.map +7 -0
  261. package/dist/commonjs/serialization/bicep/file-layout/authored-context.d.ts +12 -0
  262. package/dist/commonjs/serialization/bicep/file-layout/authored-context.d.ts.map +1 -0
  263. package/dist/commonjs/serialization/bicep/file-layout/authored-context.js +74 -0
  264. package/dist/commonjs/serialization/bicep/file-layout/authored-context.js.map +7 -0
  265. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.d.ts +11 -0
  266. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.d.ts.map +1 -0
  267. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.js +130 -0
  268. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.js.map +7 -0
  269. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.d.ts +7 -0
  270. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.d.ts.map +1 -0
  271. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.js +71 -0
  272. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.js.map +7 -0
  273. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.d.ts +19 -0
  274. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.d.ts.map +1 -0
  275. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.js +80 -0
  276. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.js.map +7 -0
  277. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.d.ts +8 -0
  278. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +1 -0
  279. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.js +91 -0
  280. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.js.map +7 -0
  281. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.d.ts +4 -0
  282. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.d.ts.map +1 -0
  283. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.js +57 -0
  284. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.js.map +7 -0
  285. package/dist/commonjs/serialization/bicep/file-layout/file-paths.d.ts +3 -0
  286. package/dist/commonjs/serialization/bicep/file-layout/file-paths.d.ts.map +1 -0
  287. package/dist/commonjs/serialization/bicep/file-layout/file-paths.js +70 -0
  288. package/dist/commonjs/serialization/bicep/file-layout/file-paths.js.map +7 -0
  289. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.d.ts +34 -0
  290. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.d.ts.map +1 -0
  291. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.js +190 -0
  292. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.js.map +7 -0
  293. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.d.ts +3 -0
  294. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.d.ts.map +1 -0
  295. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.js +241 -0
  296. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.js.map +7 -0
  297. package/dist/commonjs/serialization/bicep/index.d.ts +2 -0
  298. package/dist/commonjs/serialization/bicep/index.d.ts.map +1 -0
  299. package/dist/commonjs/serialization/bicep/index.js +28 -0
  300. package/dist/commonjs/serialization/bicep/index.js.map +7 -0
  301. package/dist/commonjs/serialization/bicep/render.d.ts +11 -0
  302. package/dist/commonjs/serialization/bicep/render.d.ts.map +1 -0
  303. package/dist/commonjs/serialization/bicep/render.js +312 -0
  304. package/dist/commonjs/serialization/bicep/render.js.map +7 -0
  305. package/dist/commonjs/serialization/{json/encoding.d.ts → encoding.d.ts} +1 -1
  306. package/dist/commonjs/serialization/encoding.d.ts.map +1 -0
  307. package/dist/commonjs/serialization/{json/encoding.js → encoding.js} +2 -12
  308. package/dist/commonjs/serialization/encoding.js.map +7 -0
  309. package/dist/commonjs/serialization/{json/util.d.ts → identifiers.d.ts} +1 -1
  310. package/dist/commonjs/serialization/identifiers.d.ts.map +1 -0
  311. package/dist/commonjs/serialization/{json/util.js → identifiers.js} +4 -4
  312. package/dist/commonjs/serialization/{json/util.js.map → identifiers.js.map} +1 -1
  313. package/dist/commonjs/serialization/index.d.ts +1 -1
  314. package/dist/commonjs/serialization/index.d.ts.map +1 -1
  315. package/dist/commonjs/serialization/index.js.map +1 -1
  316. package/dist/commonjs/serialization/json/deserialize.d.ts.map +1 -1
  317. package/dist/commonjs/serialization/json/deserialize.js +115 -44
  318. package/dist/commonjs/serialization/json/deserialize.js.map +2 -2
  319. package/dist/commonjs/serialization/json/serialize.d.ts +1 -1
  320. package/dist/commonjs/serialization/json/serialize.d.ts.map +1 -1
  321. package/dist/commonjs/serialization/json/serialize.js +6 -308
  322. package/dist/commonjs/serialization/json/serialize.js.map +3 -3
  323. package/dist/commonjs/serialization/pluralize-config.d.ts.map +1 -0
  324. package/dist/commonjs/serialization/{json/pluralize-config.js.map → pluralize-config.js.map} +1 -1
  325. package/dist/commonjs/serialization/symbol-map.d.ts +10 -0
  326. package/dist/commonjs/serialization/symbol-map.d.ts.map +1 -0
  327. package/dist/commonjs/serialization/symbol-map.js +72 -0
  328. package/dist/commonjs/serialization/symbol-map.js.map +7 -0
  329. package/dist/commonjs/shape/shape.d.ts +4 -4
  330. package/dist/commonjs/shape/shape.js.map +1 -1
  331. package/dist/commonjs/tsdoc-metadata.json +1 -1
  332. package/dist/esm/constructs/built-in-resources/resource-group.d.ts +7 -1
  333. package/dist/esm/constructs/built-in-resources/resource-group.d.ts.map +1 -1
  334. package/dist/esm/constructs/built-in-resources/resource-group.js +26 -6
  335. package/dist/esm/constructs/built-in-resources/resource-group.js.map +1 -1
  336. package/dist/esm/constructs/output.d.ts +1 -1
  337. package/dist/esm/constructs/output.d.ts.map +1 -1
  338. package/dist/esm/constructs/output.js.map +1 -1
  339. package/dist/esm/constructs/parameter.d.ts +1 -1
  340. package/dist/esm/constructs/parameter.d.ts.map +1 -1
  341. package/dist/esm/constructs/parameter.js.map +1 -1
  342. package/dist/esm/constructs/resource/resource-query.d.ts +3 -1
  343. package/dist/esm/constructs/resource/resource-query.d.ts.map +1 -1
  344. package/dist/esm/constructs/resource/resource-query.js +10 -0
  345. package/dist/esm/constructs/resource/resource-query.js.map +1 -1
  346. package/dist/esm/constructs/resource/resource-relationships.d.ts +9 -0
  347. package/dist/esm/constructs/resource/resource-relationships.d.ts.map +1 -0
  348. package/dist/esm/constructs/resource/resource-relationships.js +35 -0
  349. package/dist/esm/constructs/resource/resource-relationships.js.map +1 -0
  350. package/dist/esm/constructs/resource/resource.d.ts +11 -17
  351. package/dist/esm/constructs/resource/resource.d.ts.map +1 -1
  352. package/dist/esm/constructs/resource/resource.js +70 -28
  353. package/dist/esm/constructs/resource/resource.js.map +1 -1
  354. package/dist/esm/constructs/stack.d.ts +2 -16
  355. package/dist/esm/constructs/stack.d.ts.map +1 -1
  356. package/dist/esm/constructs/stack.js +1 -15
  357. package/dist/esm/constructs/stack.js.map +1 -1
  358. package/dist/esm/expression/ast-nodes.d.ts +1 -1
  359. package/dist/esm/expression/ast-nodes.d.ts.map +1 -1
  360. package/dist/esm/expression/ast-nodes.js.map +1 -1
  361. package/dist/esm/expression/expressions.d.ts +2 -9
  362. package/dist/esm/expression/expressions.d.ts.map +1 -1
  363. package/dist/esm/expression/expressions.js +2 -9
  364. package/dist/esm/expression/expressions.js.map +1 -1
  365. package/dist/esm/expression/utils.d.ts +5 -0
  366. package/dist/esm/expression/utils.d.ts.map +1 -0
  367. package/dist/esm/expression/utils.js +25 -0
  368. package/dist/esm/expression/utils.js.map +1 -0
  369. package/dist/esm/index.d.ts +4 -4
  370. package/dist/esm/index.d.ts.map +1 -1
  371. package/dist/esm/index.js.map +1 -1
  372. package/dist/esm/internal.d.ts +2 -5
  373. package/dist/esm/internal.d.ts.map +1 -1
  374. package/dist/esm/internal.js +1 -3
  375. package/dist/esm/internal.js.map +1 -1
  376. package/dist/esm/naming/name-validation.d.ts +15 -0
  377. package/dist/esm/naming/name-validation.d.ts.map +1 -0
  378. package/dist/esm/naming/name-validation.js +82 -0
  379. package/dist/esm/naming/name-validation.js.map +1 -0
  380. package/dist/esm/naming/naming-policy.d.ts +7 -7
  381. package/dist/esm/naming/naming-policy.d.ts.map +1 -1
  382. package/dist/esm/naming/naming-policy.js +166 -33
  383. package/dist/esm/naming/naming-policy.js.map +1 -1
  384. package/dist/esm/naming/naming-rules.d.ts +12 -11
  385. package/dist/esm/naming/naming-rules.d.ts.map +1 -1
  386. package/dist/esm/naming/naming-rules.js +2 -9
  387. package/dist/esm/naming/naming-rules.js.map +1 -1
  388. package/dist/esm/package.json +1 -1
  389. package/dist/{commonjs/serialization/json/lower.d.ts → esm/serialization/arm-object-conversion.d.ts} +11 -11
  390. package/dist/esm/serialization/arm-object-conversion.d.ts.map +1 -0
  391. package/dist/{browser/serialization/json/lower.js → esm/serialization/arm-object-conversion.js} +20 -20
  392. package/dist/esm/serialization/arm-object-conversion.js.map +1 -0
  393. package/dist/esm/serialization/ast/declaration-builder.d.ts +10 -0
  394. package/dist/esm/serialization/ast/declaration-builder.d.ts.map +1 -0
  395. package/dist/esm/serialization/ast/declaration-builder.js +265 -0
  396. package/dist/esm/serialization/ast/declaration-builder.js.map +1 -0
  397. package/dist/esm/serialization/ast/declaration-dependencies.d.ts +18 -0
  398. package/dist/esm/serialization/ast/declaration-dependencies.d.ts.map +1 -0
  399. package/dist/esm/serialization/ast/declaration-dependencies.js +96 -0
  400. package/dist/esm/serialization/ast/declaration-dependencies.js.map +1 -0
  401. package/dist/esm/serialization/ast/expression-builder.d.ts +14 -0
  402. package/dist/esm/serialization/ast/expression-builder.d.ts.map +1 -0
  403. package/dist/esm/serialization/ast/expression-builder.js +313 -0
  404. package/dist/esm/serialization/ast/expression-builder.js.map +1 -0
  405. package/dist/esm/serialization/ast/expression-restorer.d.ts +8 -0
  406. package/dist/esm/serialization/ast/expression-restorer.d.ts.map +1 -0
  407. package/dist/esm/serialization/ast/expression-restorer.js +162 -0
  408. package/dist/esm/serialization/ast/expression-restorer.js.map +1 -0
  409. package/dist/esm/serialization/ast/expression-rewriter.d.ts +29 -0
  410. package/dist/esm/serialization/ast/expression-rewriter.d.ts.map +1 -0
  411. package/dist/esm/serialization/ast/expression-rewriter.js +257 -0
  412. package/dist/esm/serialization/ast/expression-rewriter.js.map +1 -0
  413. package/dist/esm/serialization/ast/expression-walker.d.ts +16 -0
  414. package/dist/esm/serialization/ast/expression-walker.d.ts.map +1 -0
  415. package/dist/esm/serialization/ast/expression-walker.js +154 -0
  416. package/dist/esm/serialization/ast/expression-walker.js.map +1 -0
  417. package/dist/esm/serialization/ast/generated/ast.d.ts.map +1 -0
  418. package/dist/esm/serialization/ast/generated/ast.js.map +1 -0
  419. package/dist/esm/serialization/ast/index.d.ts +7 -0
  420. package/dist/esm/serialization/ast/index.d.ts.map +1 -0
  421. package/dist/esm/serialization/ast/index.js.map +1 -0
  422. package/dist/esm/serialization/ast/resource-utils.d.ts +10 -0
  423. package/dist/esm/serialization/ast/resource-utils.d.ts.map +1 -0
  424. package/dist/esm/serialization/ast/resource-utils.js +52 -0
  425. package/dist/esm/serialization/ast/resource-utils.js.map +1 -0
  426. package/dist/esm/serialization/bicep/file-layout/authored-context.d.ts +12 -0
  427. package/dist/esm/serialization/bicep/file-layout/authored-context.d.ts.map +1 -0
  428. package/dist/esm/serialization/bicep/file-layout/authored-context.js +57 -0
  429. package/dist/esm/serialization/bicep/file-layout/authored-context.js.map +1 -0
  430. package/dist/esm/serialization/bicep/file-layout/bicep-namer.d.ts +11 -0
  431. package/dist/esm/serialization/bicep/file-layout/bicep-namer.d.ts.map +1 -0
  432. package/dist/esm/serialization/bicep/file-layout/bicep-namer.js +100 -0
  433. package/dist/esm/serialization/bicep/file-layout/bicep-namer.js.map +1 -0
  434. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.d.ts +7 -0
  435. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.d.ts.map +1 -0
  436. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.js +46 -0
  437. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.js.map +1 -0
  438. package/dist/esm/serialization/bicep/file-layout/deployment-planning.d.ts +19 -0
  439. package/dist/esm/serialization/bicep/file-layout/deployment-planning.d.ts.map +1 -0
  440. package/dist/esm/serialization/bicep/file-layout/deployment-planning.js +68 -0
  441. package/dist/esm/serialization/bicep/file-layout/deployment-planning.js.map +1 -0
  442. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.d.ts +8 -0
  443. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +1 -0
  444. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.js +67 -0
  445. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.js.map +1 -0
  446. package/dist/esm/serialization/bicep/file-layout/file-dependencies.d.ts +4 -0
  447. package/dist/esm/serialization/bicep/file-layout/file-dependencies.d.ts.map +1 -0
  448. package/dist/esm/serialization/bicep/file-layout/file-dependencies.js +32 -0
  449. package/dist/esm/serialization/bicep/file-layout/file-dependencies.js.map +1 -0
  450. package/dist/esm/serialization/bicep/file-layout/file-paths.d.ts +3 -0
  451. package/dist/esm/serialization/bicep/file-layout/file-paths.d.ts.map +1 -0
  452. package/dist/esm/serialization/bicep/file-layout/file-paths.js +46 -0
  453. package/dist/esm/serialization/bicep/file-layout/file-paths.js.map +1 -0
  454. package/dist/esm/serialization/bicep/file-layout/file-preparation.d.ts +34 -0
  455. package/dist/esm/serialization/bicep/file-layout/file-preparation.d.ts.map +1 -0
  456. package/dist/esm/serialization/bicep/file-layout/file-preparation.js +140 -0
  457. package/dist/esm/serialization/bicep/file-layout/file-preparation.js.map +1 -0
  458. package/dist/esm/serialization/bicep/file-layout/reference-wiring.d.ts +3 -0
  459. package/dist/esm/serialization/bicep/file-layout/reference-wiring.d.ts.map +1 -0
  460. package/dist/esm/serialization/bicep/file-layout/reference-wiring.js +225 -0
  461. package/dist/esm/serialization/bicep/file-layout/reference-wiring.js.map +1 -0
  462. package/dist/esm/serialization/bicep/index.d.ts +2 -0
  463. package/dist/esm/serialization/bicep/index.d.ts.map +1 -0
  464. package/dist/esm/serialization/bicep/index.js +4 -0
  465. package/dist/esm/serialization/bicep/index.js.map +1 -0
  466. package/dist/esm/serialization/bicep/render.d.ts +11 -0
  467. package/dist/esm/serialization/bicep/render.d.ts.map +1 -0
  468. package/dist/esm/serialization/bicep/render.js +293 -0
  469. package/dist/esm/serialization/bicep/render.js.map +1 -0
  470. package/dist/esm/serialization/{json/encoding.d.ts → encoding.d.ts} +1 -1
  471. package/dist/esm/serialization/encoding.d.ts.map +1 -0
  472. package/dist/esm/serialization/{json/encoding.js → encoding.js} +2 -12
  473. package/dist/esm/serialization/encoding.js.map +1 -0
  474. package/dist/esm/serialization/{json/util.d.ts → identifiers.d.ts} +1 -1
  475. package/dist/esm/serialization/identifiers.d.ts.map +1 -0
  476. package/dist/esm/serialization/{json/util.js → identifiers.js} +1 -1
  477. package/dist/esm/serialization/identifiers.js.map +1 -0
  478. package/dist/esm/serialization/index.d.ts +1 -1
  479. package/dist/esm/serialization/index.d.ts.map +1 -1
  480. package/dist/esm/serialization/index.js.map +1 -1
  481. package/dist/esm/serialization/json/deserialize.d.ts.map +1 -1
  482. package/dist/esm/serialization/json/deserialize.js +131 -39
  483. package/dist/esm/serialization/json/deserialize.js.map +1 -1
  484. package/dist/esm/serialization/json/serialize.d.ts +1 -1
  485. package/dist/esm/serialization/json/serialize.d.ts.map +1 -1
  486. package/dist/esm/serialization/json/serialize.js +5 -360
  487. package/dist/esm/serialization/json/serialize.js.map +1 -1
  488. package/dist/esm/serialization/pluralize-config.d.ts.map +1 -0
  489. package/dist/esm/serialization/pluralize-config.js.map +1 -0
  490. package/dist/esm/serialization/symbol-map.d.ts +10 -0
  491. package/dist/esm/serialization/symbol-map.d.ts.map +1 -0
  492. package/dist/esm/serialization/symbol-map.js +40 -0
  493. package/dist/esm/serialization/symbol-map.js.map +1 -0
  494. package/dist/esm/shape/shape.d.ts +4 -4
  495. package/dist/esm/shape/shape.js +2 -2
  496. package/dist/esm/shape/shape.js.map +1 -1
  497. package/package.json +3 -2
  498. package/dist/browser/serialization/contract/generated/ast.d.ts.map +0 -1
  499. package/dist/browser/serialization/contract/generated/ast.js.map +0 -1
  500. package/dist/browser/serialization/contract/index.d.ts +0 -2
  501. package/dist/browser/serialization/contract/index.d.ts.map +0 -1
  502. package/dist/browser/serialization/contract/index.js.map +0 -1
  503. package/dist/browser/serialization/json/encoding.d.ts.map +0 -1
  504. package/dist/browser/serialization/json/encoding.js.map +0 -1
  505. package/dist/browser/serialization/json/expression.d.ts +0 -32
  506. package/dist/browser/serialization/json/expression.d.ts.map +0 -1
  507. package/dist/browser/serialization/json/expression.js +0 -494
  508. package/dist/browser/serialization/json/expression.js.map +0 -1
  509. package/dist/browser/serialization/json/lower.d.ts.map +0 -1
  510. package/dist/browser/serialization/json/lower.js.map +0 -1
  511. package/dist/browser/serialization/json/pluralize-config.d.ts.map +0 -1
  512. package/dist/browser/serialization/json/pluralize-config.js.map +0 -1
  513. package/dist/browser/serialization/json/util.d.ts.map +0 -1
  514. package/dist/browser/serialization/json/util.js.map +0 -1
  515. package/dist/browser/serialization/utils.d.ts +0 -3
  516. package/dist/browser/serialization/utils.d.ts.map +0 -1
  517. package/dist/browser/serialization/utils.js +0 -146
  518. package/dist/browser/serialization/utils.js.map +0 -1
  519. package/dist/commonjs/serialization/contract/generated/ast.d.ts.map +0 -1
  520. package/dist/commonjs/serialization/contract/index.d.ts +0 -2
  521. package/dist/commonjs/serialization/contract/index.d.ts.map +0 -1
  522. package/dist/commonjs/serialization/contract/index.js.map +0 -7
  523. package/dist/commonjs/serialization/json/encoding.d.ts.map +0 -1
  524. package/dist/commonjs/serialization/json/encoding.js.map +0 -7
  525. package/dist/commonjs/serialization/json/expression.d.ts +0 -32
  526. package/dist/commonjs/serialization/json/expression.d.ts.map +0 -1
  527. package/dist/commonjs/serialization/json/expression.js +0 -509
  528. package/dist/commonjs/serialization/json/expression.js.map +0 -7
  529. package/dist/commonjs/serialization/json/lower.d.ts.map +0 -1
  530. package/dist/commonjs/serialization/json/lower.js.map +0 -7
  531. package/dist/commonjs/serialization/json/pluralize-config.d.ts.map +0 -1
  532. package/dist/commonjs/serialization/json/util.d.ts.map +0 -1
  533. package/dist/commonjs/serialization/utils.d.ts +0 -3
  534. package/dist/commonjs/serialization/utils.d.ts.map +0 -1
  535. package/dist/commonjs/serialization/utils.js +0 -169
  536. package/dist/commonjs/serialization/utils.js.map +0 -7
  537. package/dist/esm/serialization/contract/generated/ast.d.ts.map +0 -1
  538. package/dist/esm/serialization/contract/generated/ast.js.map +0 -1
  539. package/dist/esm/serialization/contract/index.d.ts +0 -2
  540. package/dist/esm/serialization/contract/index.d.ts.map +0 -1
  541. package/dist/esm/serialization/contract/index.js.map +0 -1
  542. package/dist/esm/serialization/json/encoding.d.ts.map +0 -1
  543. package/dist/esm/serialization/json/encoding.js.map +0 -1
  544. package/dist/esm/serialization/json/expression.d.ts +0 -32
  545. package/dist/esm/serialization/json/expression.d.ts.map +0 -1
  546. package/dist/esm/serialization/json/expression.js +0 -494
  547. package/dist/esm/serialization/json/expression.js.map +0 -1
  548. package/dist/esm/serialization/json/lower.d.ts.map +0 -1
  549. package/dist/esm/serialization/json/lower.js.map +0 -1
  550. package/dist/esm/serialization/json/pluralize-config.d.ts.map +0 -1
  551. package/dist/esm/serialization/json/pluralize-config.js.map +0 -1
  552. package/dist/esm/serialization/json/util.d.ts.map +0 -1
  553. package/dist/esm/serialization/json/util.js.map +0 -1
  554. package/dist/esm/serialization/utils.d.ts +0 -3
  555. package/dist/esm/serialization/utils.d.ts.map +0 -1
  556. package/dist/esm/serialization/utils.js +0 -146
  557. package/dist/esm/serialization/utils.js.map +0 -1
  558. /package/dist/browser/serialization/{contract → ast}/generated/ast.d.ts +0 -0
  559. /package/dist/browser/serialization/{contract → ast}/generated/ast.js +0 -0
  560. /package/dist/browser/serialization/{contract → ast}/index.js +0 -0
  561. /package/dist/browser/serialization/{json/pluralize-config.d.ts → pluralize-config.d.ts} +0 -0
  562. /package/dist/browser/serialization/{json/pluralize-config.js → pluralize-config.js} +0 -0
  563. /package/dist/commonjs/serialization/{contract → ast}/generated/ast.d.ts +0 -0
  564. /package/dist/commonjs/serialization/{contract → ast}/generated/ast.js +0 -0
  565. /package/dist/commonjs/serialization/{json/pluralize-config.d.ts → pluralize-config.d.ts} +0 -0
  566. /package/dist/commonjs/serialization/{json/pluralize-config.js → pluralize-config.js} +0 -0
  567. /package/dist/esm/serialization/{contract → ast}/generated/ast.d.ts +0 -0
  568. /package/dist/esm/serialization/{contract → ast}/generated/ast.js +0 -0
  569. /package/dist/esm/serialization/{contract → ast}/index.js +0 -0
  570. /package/dist/esm/serialization/{json/pluralize-config.d.ts → pluralize-config.d.ts} +0 -0
  571. /package/dist/esm/serialization/{json/pluralize-config.js → pluralize-config.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"shape.js","sourceRoot":"","sources":["../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S,YAAY,CAAC,GAAa;IACjC,OAAO,GAAG,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC;AAC9F,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,GAAa,EAAE,KAAa;IACjD,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1D,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,WAAW,CAAC,KAA6B;IAChD,IAAI,CAAC,KAAK,IAAI,oBAAoB,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Runtime types for ARM shape information.\n *\n * A `ModelShape` is generated once per emitted Model and describes how\n * to map JS-ergonomic property names + structure to the underlying ARM\n * wire shape. The shapes are consumed by the serialization `lowerState`\n * pass (and its inverse `raiseState`) which rewrites state keys and\n * re-nests `@flattenProperty` paths just before serialization /\n * after deserialization.\n *\n * These types are an internal cross-package runtime contract; generated code\n * imports them from `@azure/provisioning-core/internal`.\n *\n * Nested-shape thunks ({@link DeferredShape}) defer dereferencing the\n * inner shape constant until use, so mutually-referential or\n * self-referential models can be emitted without initialization-order\n * problems.\n *\n * A model shape comes in two flavors:\n * - `FlatModelShape` ({@link FlatModelShape}): the common case —\n * one shape per concrete model.\n * - `DiscriminatedModelShape` ({@link DiscriminatedModelShape}): a\n * name-discriminated variant group. ARM permits multiple resources\n * to share an ARM `type` + `apiVersion` pair and disambiguate via a\n * fixed field — e.g. `Microsoft.ApiManagement/service/portalsettings@2024-05-01`\n * has three variants with `name: 'signin' | 'signup' | 'delegation'`\n * and distinct `properties` shapes. The same machinery applies to\n * nested models that use a `@discriminator` field.\n */\nimport type {\n BooleanValueEncodingDescriptor,\n BytesValueEncodingDescriptor,\n DateValueEncodingDescriptor,\n NumberValueEncodingDescriptor,\n NumericStringEncodingDescriptor,\n StringValueEncodingDescriptor,\n} from \"./value-encoding.js\";\n\n/** The standard single-model shape. */\nexport interface FlatModelShape {\n /**\n * Tag for tag-dispatched discrimination on {@link NavShape} and\n * {@link ModelShape}. Always `\"flatModel\"`.\n */\n readonly kind: \"flatModel\";\n /**\n * Map, keyed by JS-side (client-facing) property name, of how that\n * property maps to the ARM wire shape. Property names not present in\n * this map are assumed to be pass-through (identity mapping).\n */\n readonly byJsName: { readonly [jsName: string]: PropertyShape };\n}\n\n/**\n * The two names a discriminator field goes by.\n *\n * Usually identical — ARM discriminators are `type`, `name`, `kind` and\n * service teams rarely rename them — but a `@clientName` on the field\n * makes them differ, and the two are looked up in different keyspaces:\n * JS-side state is keyed by {@link jsName}, wire JSON by\n * {@link armName}. Carrying both is what lets a discriminated shape\n * resolve in either direction.\n */\nexport interface DiscriminatorNames {\n /** Client-facing name, as authored in TypeScript and held in state. */\n readonly jsName: string;\n /** Wire-level name, as it appears in an ARM template or response. */\n readonly armName: string;\n}\n\n/**\n * A name-discriminated group of variants that share one parent key\n * (an ARM `(type, apiVersion)` at the registry level, or a parent\n * model's `@discriminator` field elsewhere). The `discriminator` names\n * the field whose value selects a variant.\n */\nexport interface DiscriminatedModelShape {\n readonly kind: \"discriminatedModel\";\n /** Names of the field used to select a variant. */\n readonly discriminator: DiscriminatorNames;\n /**\n * Map from discriminator value (e.g. `\"signin\"`) to the shape for\n * that variant. A value with no entry here doesn't end resolution —\n * {@link resolveModelShape} infers the variant from the payload's\n * structure instead.\n *\n * Entries may be:\n * - a {@link FlatModelShape} — the terminal, common case;\n * - a {@link DeferredShape} — breaks emit-order / cyclic-reference\n * hazards, exactly as {@link PropertyShape.value} does;\n * - a nested {@link DiscriminatedModelShape} — a variant that is\n * itself a discriminated base on a *different* field. TypeSpec\n * permits this (`@discriminator(\"kind\") model Pet`, then\n * `@discriminator(\"breed\") model Cat extends Pet`), so selecting\n * a concrete shape may take more than one hop. See\n * {@link resolveModelShape}.\n *\n * Note that a hierarchy re-using the *same* discriminator field at\n * every level (abstract intermediates) is flattened by the emitter\n * into a single level here — only a change of discriminator field\n * produces a nested entry.\n */\n readonly byValue: {\n readonly [value: string]: ModelShape | DeferredShape<ModelShape>;\n };\n}\n\n/** A single model's shape — either flat or discriminated. */\nexport type ModelShape = FlatModelShape | DiscriminatedModelShape;\n\n/**\n * What `registerShape` stores in the global registry, keyed by\n * `(armType, apiVersion)`. Same structural type as {@link ModelShape};\n * the alias documents intent at the registry boundary.\n */\nexport type ResourceShape = ModelShape;\n\n/** A single property's shape entry. */\nexport interface PropertyShape {\n /**\n * ARM wire path from the owning model's root to this property.\n * Single-segment for direct properties; multi-segment for properties\n * hoisted through one or more `@flattenProperty` wrappers.\n */\n readonly armPath: readonly string[];\n\n /**\n * Describes this property's value for navigation and wire conversion.\n * Model and container shapes recurse into nested values; a\n * {@link TerminalValueShape} explicitly terminates recursion. Scalar\n * terminal shapes carry only the encodings valid for their client-side\n * JavaScript representation.\n */\n readonly value: ValueShape;\n\n /**\n * `true` when ARM treats this property as server-set (visible in GET\n * responses but rejected on PUT). Omitted (i.e. `undefined`/`false`)\n * for writable properties.\n *\n * Currently consumed by the `Resource` constructor's deployment-context\n * inheritance to skip readonly properties (notably `location` on many\n * child resources where the field exists in the read model only).\n */\n readonly readOnly?: boolean;\n}\n\n/**\n * Deferred reference to a shape value. The thunk is called on\n * dereference so the actual shape lookup is deferred.\n *\n * **Why this exists instead of embedding the shape directly.**\n *\n * Model shapes frequently reference each other — a model's properties\n * can point to other models, and ARM types include both self-\n * referential (tree-like) and mutually-referential (cyclic) structures.\n * If we embedded a {@link ModelShape} value directly inside another\n * model shape's value field, both shapes would need to be fully\n * initialized when the parent is constructed. That's impossible\n * whenever:\n *\n * - A model references itself, e.g. `TreeNode { children: TreeNode[] }`.\n * - Two models reference each other, e.g. `A { b?: B }` and `B { a?: A }`.\n * - Two modules each define shapes that reference shapes from the other.\n *\n * In all three cases the second constant is in the Temporal Dead Zone\n * when the first one's literal evaluates, and the runtime throws\n * `ReferenceError: Cannot access ... before initialization`.\n *\n * Wrapping the reference in a thunk solves it. The closure captures\n * the *binding name*, not its current value. The lookup happens later\n * when the thunk is called — by which time the module graph has\n * finished evaluating and both shapes are fully constructed.\n *\n * Only the model variant of {@link ValueShape} carries a reference —\n * container shapes (`array`, `record`) are eager because they don't\n * reference any module-level binding directly; the inner reference\n * deeper down handles cycle-breaking.\n */\nexport interface DeferredShape<T> {\n readonly kind: \"deferred\";\n readonly value: () => T;\n}\n\n/** An array-of-T property/container shape. */\nexport interface ArrayShape {\n readonly kind: \"array\";\n readonly element: ValueShape;\n}\n\n/** A `Record<string, T>` property/container shape. */\nexport interface RecordShape {\n readonly kind: \"record\";\n readonly value: ValueShape;\n}\n\n/** A fixed-length heterogeneous tuple property/container shape. */\nexport interface TupleShape {\n readonly kind: \"tuple\";\n readonly values: readonly ValueShape[];\n}\n\n/** A TypeSpec scalar rendered as TypeScript `any`. */\nexport interface AnyShape {\n readonly kind: \"any\";\n}\n\n/** A scalar whose client-side JavaScript representation is `string`. */\nexport interface StringShape {\n readonly kind: \"string\";\n readonly encoding?: StringValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `boolean`. */\nexport interface BooleanShape {\n readonly kind: \"boolean\";\n readonly encoding?: BooleanValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `number`. */\nexport interface NumberShape {\n readonly kind: \"number\";\n readonly encoding?: NumberValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `Uint8Array`. */\nexport interface BytesShape {\n readonly kind: \"bytes\";\n readonly encoding?: BytesValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `Date`. */\nexport interface DateShape {\n readonly kind: \"date\";\n readonly encoding?: DateValueEncodingDescriptor;\n}\n\n/** A terminal TypeSpec string literal. Literals cannot carry `@encode`. */\nexport interface StringLiteralShape {\n readonly kind: \"stringLiteral\";\n}\n\n/** A terminal TypeSpec numeric literal. */\nexport interface NumberLiteralShape {\n readonly kind: \"numberLiteral\";\n /** `@encode(string)` when the numeric literal is exposed as wire text. */\n readonly encoding?: NumericStringEncodingDescriptor;\n}\n\n/** A terminal TypeSpec boolean literal. */\nexport interface BooleanLiteralShape {\n readonly kind: \"booleanLiteral\";\n /** `@encode(string)` while the client value remains a boolean literal. */\n readonly encoding?: BooleanValueEncodingDescriptor;\n}\n\n/** A terminal TypeSpec enum. Enums cannot carry `@encode`. */\nexport interface EnumShape {\n readonly kind: \"enum\";\n}\n\n/**\n * A terminal TypeSpec union for which no single structural shape can be\n * selected. Unions cannot carry `@encode` in the provisioning emitter.\n */\nexport interface UnionShape {\n readonly kind: \"union\";\n}\n\n/** The TypeSpec `null` intrinsic. */\nexport interface NullShape {\n readonly kind: \"null\";\n}\n\n/**\n * Concrete terminal values in the generated client API.\n *\n * Scalar kinds describe the JavaScript value accepted by the generated\n * TypeScript surface, not necessarily the semantic TypeSpec scalar. For\n * example, a numeric `duration` is a {@link NumberShape}, while the default\n * ISO8601 duration is a {@link StringShape}; their narrowed `encoding` fields\n * retain the TypeSpec source semantics needed for wire conversion. Numeric and\n * boolean literal shapes can carry the same narrowly applicable encodings that\n * TypeSpec permits on those values. String literals, enums, unions, and null\n * remain distinct non-encodable terminal categories.\n * Expressions are orthogonal wrappers around any value shape and are handled\n * before shape-directed conversion.\n */\nexport type TerminalValueShape =\n | AnyShape\n | StringShape\n | BooleanShape\n | NumberShape\n | BytesShape\n | DateShape\n | StringLiteralShape\n | NumberLiteralShape\n | BooleanLiteralShape\n | EnumShape\n | UnionShape\n | NullShape;\n\n/** A container through which property navigation can continue. */\nexport type ContainerShape = ArrayShape | RecordShape | TupleShape;\n\nexport type ValueShape = TerminalValueShape | DeferredShape<ModelShape> | ContainerShape;\n\n// ---------------------------------------------------------------------------\n// Constructor helpers\n// ---------------------------------------------------------------------------\n\n/** Build a {@link FlatModelShape} from a property map. */\nexport const createFlatModelShape = (byJsName: Record<string, PropertyShape>): FlatModelShape => ({\n kind: \"flatModel\",\n byJsName,\n});\n\n/**\n * Build a {@link DiscriminatedModelShape}.\n *\n * Pass a bare string when the field goes by the same name on both\n * sides, which is the overwhelmingly common case; pass a\n * {@link DiscriminatorNames} pair when a `@clientName` makes them\n * differ.\n */\nexport const createDiscriminatedModelShape = (\n discriminator: string | DiscriminatorNames,\n byValue: Record<string, ModelShape | DeferredShape<ModelShape>>,\n): DiscriminatedModelShape => ({\n kind: \"discriminatedModel\",\n discriminator:\n typeof discriminator === \"string\"\n ? { jsName: discriminator, armName: discriminator }\n : discriminator,\n byValue,\n});\n\n/**\n * Build a {@link DeferredShape}. The thunk is called on dereference; defer\n * the actual shape lookup so that mutually-referential constants can\n * be emitted in any order.\n */\nexport const createDeferredShape = <T>(value: () => T): DeferredShape<T> => ({\n kind: \"deferred\",\n value,\n});\n\n/** Build an {@link AnyShape}. */\nexport const createAnyShape = (): AnyShape => ({ kind: \"any\" });\n\n/** Build a {@link StringShape}, optionally with a compatible wire encoding. */\nexport const createStringShape = (encoding?: StringValueEncodingDescriptor): StringShape => ({\n kind: \"string\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link BooleanShape}, optionally with a compatible wire encoding. */\nexport const createBooleanShape = (encoding?: BooleanValueEncodingDescriptor): BooleanShape => ({\n kind: \"boolean\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link NumberShape}, optionally with a compatible wire encoding. */\nexport const createNumberShape = (encoding?: NumberValueEncodingDescriptor): NumberShape => ({\n kind: \"number\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link BytesShape}, optionally with a compatible wire encoding. */\nexport const createBytesShape = (encoding?: BytesValueEncodingDescriptor): BytesShape => ({\n kind: \"bytes\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link DateShape}, optionally with a compatible wire encoding. */\nexport const createDateShape = (encoding?: DateValueEncodingDescriptor): DateShape => ({\n kind: \"date\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a terminal {@link StringLiteralShape}. */\nexport const createStringLiteralShape = (): StringLiteralShape => ({\n kind: \"stringLiteral\",\n});\n\n/** Build a terminal {@link NumberLiteralShape}. */\nexport const createNumberLiteralShape = (\n encoding?: NumericStringEncodingDescriptor,\n): NumberLiteralShape => ({\n kind: \"numberLiteral\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a terminal {@link BooleanLiteralShape}. */\nexport const createBooleanLiteralShape = (\n encoding?: BooleanValueEncodingDescriptor,\n): BooleanLiteralShape => ({\n kind: \"booleanLiteral\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a terminal {@link EnumShape}. */\nexport const createEnumShape = (): EnumShape => ({ kind: \"enum\" });\n\n/** Build a terminal {@link UnionShape}. */\nexport const createUnionShape = (): UnionShape => ({ kind: \"union\" });\n\n/** Build a terminal {@link NullShape}. */\nexport const createNullShape = (): NullShape => ({ kind: \"null\" });\n\n/** Build an {@link ArrayShape}. */\nexport const createArrayShape = (element: ValueShape): ArrayShape => ({\n kind: \"array\",\n element,\n});\n\n/** Build a {@link RecordShape}. */\nexport const createRecordShape = (value: ValueShape): RecordShape => ({\n kind: \"record\",\n value,\n});\n\n/** Build a {@link TupleShape}. */\nexport const createTupleShape = (values: readonly ValueShape[]): TupleShape => ({\n kind: \"tuple\",\n values,\n});\n\n/** Return whether a value shape terminates property navigation. */\nexport function isTerminalValueShape(shape: ValueShape): shape is TerminalValueShape {\n switch (shape.kind) {\n case \"any\":\n case \"string\":\n case \"boolean\":\n case \"number\":\n case \"bytes\":\n case \"date\":\n case \"stringLiteral\":\n case \"numberLiteral\":\n case \"booleanLiteral\":\n case \"enum\":\n case \"union\":\n case \"null\":\n return true;\n case \"deferred\":\n case \"array\":\n case \"record\":\n case \"tuple\":\n return false;\n default:\n return assertNeverShape(shape);\n }\n}\n\nfunction assertNeverShape(shape: never): never {\n throw new Error(`Unhandled value shape: ${String(shape)}`);\n}\n\n// ---------------------------------------------------------------------------\n// Helpers used by the runtime proxy + lowering pass\n// ---------------------------------------------------------------------------\n\n/**\n * Runtime navigation position for a typed proxy. Either:\n * - a {@link ModelShape} — we're at a model's properties, whether or\n * not its variant is known,\n * - a {@link ContainerShape} — we're at a container that hasn't yet been\n * indexed,\n * - `undefined` — the current position is terminal, unknown, or the proxy\n * was created without a shape.\n *\n * Proxies carry a `NavShape` through each access so they can stamp and\n * resolve the correct shape on deeper navigation.\n *\n * Navigation never sits at a {@link DeferredShape} — refs are resolved\n * eagerly as soon as the proxy encounters them.\n */\nexport type NavShape = ModelShape | ContainerShape | undefined;\n\n/**\n * Resolve a {@link ModelShape} to the single concrete variant that\n * applies to `value`.\n *\n * Resolution is iterative, not a single step, because a variant may\n * itself be a discriminated group keyed on a *different* field (see\n * {@link DiscriminatedModelShape.byValue}). Each hop reads its own\n * discriminator out of the same `value`, so\n * `{ kind: \"cat\", breed: \"siamese\" }` resolves through `Pet` → `Cat`\n * → `Siamese`. {@link DeferredShape} entries are dereferenced in\n * place, and flat model shapes are returned as-is.\n *\n * When a hop's discriminator can't be read — it is absent, is not a\n * string (the *expression-valued* case), or names an unknown variant —\n * the variant is instead **inferred from the value's structure** by\n * {@link selectVariant}. That inference is sound rather than a guess:\n * ARM would reject a payload that doesn't match the variant its\n * discriminator selects, so a concrete payload determines the variant\n * even when the discriminator itself is only known at deploy time.\n *\n * Bicep takes the same position — a discriminator it can't evaluate at\n * compile time downgrades type checking for that object (diagnostic\n * `BCP225`) rather than failing the build.\n *\n * Returns `undefined` when `shape` is `undefined`, when there is no\n * `value` to infer from, or when the `byValue` graph is cyclic\n * (defensive; the emitter does not produce cycles here).\n *\n * @param shape - The shape to resolve. Flat shapes are returned\n * unchanged, so callers can pass either kind without checking.\n * @param value - The object this shape describes, used both to read\n * discriminators and to infer a variant when they can't be read.\n * Omit it when no value exists (an `Expression<T>` proxy, say) and\n * discriminated shapes will resolve to `undefined`.\n * @param valueKeyedBy - Which naming **`value`'s own keys** use — not\n * the shape's. A {@link FlatModelShape} is the mapping *between* the\n * two sides (one property is `secretVersion` in TypeScript and\n * `version` on the wire), so inference has to read both sides in the\n * same naming or nothing matches:\n *\n * - `\"js\"` — client-facing names, as authored in TypeScript and held\n * in a resource's state. These are\n * {@link FlatModelShape.byJsName}'s own keys. Passed by\n * `lowerState`, on state about to be serialized.\n * - `\"arm\"` — wire names, as they appear in an ARM template or a\n * service response. These are the first segment of each\n * {@link PropertyShape.armPath}. Passed by `raiseState`, on JSON\n * just parsed off the wire.\n *\n * Has no effect when the discriminator resolves normally, and no\n * effect at all for models whose properties map 1:1.\n */\nexport function resolveModelShape(\n shape: ModelShape | undefined,\n value: Record<string, unknown> | undefined,\n valueKeyedBy: \"js\" | \"arm\" = \"js\",\n): FlatModelShape | undefined {\n let current: ModelShape | DeferredShape<ModelShape> | undefined = shape;\n const seen = new Set<ModelShape | DeferredShape<ModelShape>>();\n\n while (current !== undefined) {\n if (seen.has(current)) return undefined;\n seen.add(current);\n\n if (current.kind === \"deferred\") {\n current = current.value();\n continue;\n }\n if (current.kind === \"flatModel\") return current;\n\n const group: DiscriminatedModelShape = current;\n // Read the discriminator under the same naming as `value`'s own\n // keys: JS-side state holds it under the client name, wire JSON\n // under the ARM name. The two coincide for almost every ARM\n // discriminator, but a `@clientName` on the field makes them\n // differ, and reading the wrong one silently downgrades exact\n // dispatch to structural inference below.\n const names = group.discriminator;\n const key = value?.[valueKeyedBy === \"js\" ? names.jsName : names.armName];\n const next = typeof key === \"string\" ? group.byValue[key] : undefined;\n if (next === undefined) {\n return value ? selectVariant(group, value, valueKeyedBy) : undefined;\n }\n current = next;\n }\n\n return undefined;\n}\n\n/**\n * Infer which variant of `group` a value belongs to by structure.\n *\n * Every variant is scored by how many of the value's keys it declares,\n * descending into nested objects and containers so that variants which\n * are indistinguishable at the top level can still be told apart. CDN's\n * delivery-rule actions are exactly that case: all nine variants\n * declare `{ name, parameters }` and differ only inside `parameters`.\n *\n * The highest score wins; ties keep the earliest variant in `byValue`\n * order, which is stable emitter output. A tie means the tied variants\n * declare the same keys for the data given, and the emitter guarantees\n * that keys shared across variants map identically — so either choice\n * produces the same wire mapping for everything actually present.\n */\nfunction selectVariant(\n group: DiscriminatedModelShape,\n value: Record<string, unknown>,\n valueKeyedBy: \"js\" | \"arm\",\n): FlatModelShape | undefined {\n let best: FlatModelShape | undefined;\n let bestScore = -1;\n\n for (const variant of flattenVariants(group, new Set())) {\n const score = scoreShape(variant, value, valueKeyedBy, new WeakSet());\n if (score > bestScore) {\n bestScore = score;\n best = variant;\n }\n }\n\n return best;\n}\n\n/** How many of `value`'s keys, recursively, `shape` accounts for. */\nfunction scoreShape(\n shape: FlatModelShape,\n value: Record<string, unknown>,\n valueKeyedBy: \"js\" | \"arm\",\n visiting: WeakSet<object>,\n): number {\n if (visiting.has(value)) return 0;\n visiting.add(value);\n\n const byKey = getShapePropertiesMap(shape, valueKeyedBy);\n let score = 0;\n\n for (const [key, sub] of Object.entries(value)) {\n const prop = byKey.get(key);\n if (!prop) continue;\n score += 1;\n score += scoreNested(sub, prop.value, valueKeyedBy, visiting);\n }\n\n visiting.delete(value);\n return score;\n}\n\n/**\n * Score one level deeper, through a property's target. Containers are\n * sampled at their first entry — enough to discriminate, and bounded\n * regardless of how large the value is.\n */\nfunction scoreNested(\n value: unknown,\n target: ValueShape | undefined,\n valueKeyedBy: \"js\" | \"arm\",\n visiting: WeakSet<object>,\n): number {\n if (!target || isTerminalValueShape(target) || value === null || typeof value !== \"object\") {\n return 0;\n }\n\n if (target.kind === \"array\") {\n if (!Array.isArray(value) || value.length === 0) return 0;\n return scoreNested(value[0], target.element, valueKeyedBy, visiting);\n }\n\n if (target.kind === \"record\") {\n if (Array.isArray(value)) return 0;\n const first = Object.values(value)[0];\n if (first === undefined) return 0;\n return scoreNested(first, target.value, valueKeyedBy, visiting);\n }\n\n if (target.kind === \"tuple\") {\n if (!Array.isArray(value)) return 0;\n return target.values.reduce(\n (score, tupleValue, index) =>\n score + scoreNested(value[index], tupleValue, valueKeyedBy, visiting),\n 0,\n );\n }\n\n if (Array.isArray(value)) return 0;\n const nested = resolveModelShape(target.value(), value as Record<string, unknown>, valueKeyedBy);\n if (!nested) return 0;\n return scoreShape(nested, value as Record<string, unknown>, valueKeyedBy, visiting);\n}\n\nconst shapePropertiesCache = new WeakMap<\n FlatModelShape,\n Map<\"js\" | \"arm\", Map<string, PropertyShape>>\n>();\n\n/**\n * A shape's properties as a map, keyed by the name they go by in the\n * requested naming. Pass the same naming the value uses and the two\n * line up, which is what lets {@link scoreShape} compare them.\n *\n * Memoized per (shape, naming): scoring calls this once per candidate\n * variant per level, so rebuilding would be wasteful.\n *\n * @param shape - The shape whose properties to map.\n * @param keyedBy - Which name to key by. Note this describes the *map\n * being built*, not an incoming value — unlike the `valueKeyedBy`\n * parameter the callers thread through.\n */\nfunction getShapePropertiesMap(\n shape: FlatModelShape,\n keyedBy: \"js\" | \"arm\",\n): Map<string, PropertyShape> {\n let byNaming = shapePropertiesCache.get(shape);\n if (!byNaming) {\n byNaming = new Map();\n shapePropertiesCache.set(shape, byNaming);\n }\n let byKey = byNaming.get(keyedBy);\n if (byKey) return byKey;\n\n byKey = new Map<string, PropertyShape>();\n for (const [jsName, prop] of Object.entries(shape.byJsName)) {\n // `armPath[0]` rather than the whole path: that is the top-level\n // wire key, even for properties hoisted through `@flattenProperty`.\n const key = keyedBy === \"js\" ? jsName : prop.armPath[0];\n // First writer wins, so a hoisted property never shadows the\n // wrapper it was hoisted through.\n if (key !== undefined && !byKey.has(key)) byKey.set(key, prop);\n }\n byNaming.set(keyedBy, byKey);\n return byKey;\n}\n\n/**\n * Flatten a group to the concrete flat shapes underneath it,\n * dereferencing thunks and descending through nested groups.\n */\nfunction flattenVariants(\n group: DiscriminatedModelShape,\n seen: Set<DiscriminatedModelShape>,\n): FlatModelShape[] {\n if (seen.has(group)) return [];\n seen.add(group);\n\n const out: FlatModelShape[] = [];\n for (const key of Object.keys(group.byValue)) {\n let entry: ModelShape | DeferredShape<ModelShape> | undefined = group.byValue[key];\n if (entry?.kind === \"deferred\") entry = entry.value();\n if (entry === undefined) continue;\n if (entry.kind === \"flatModel\") out.push(entry);\n else out.push(...flattenVariants(entry, seen));\n }\n return out;\n}\n\n/**\n * Navigate `nav` one step deeper using `segment`. For string segments\n * (`.foo`) at a model position, returns the property's shape entry as\n * `stamp` and advances `next` into the property's target. For numeric\n * segments (`[i]`) or string keys at a record position, peels one\n * container layer; `stamp` is always `undefined`.\n *\n * Returns `{ stamp: undefined, next: undefined }` when the step can't\n * be resolved (unknown property, out-of-shape access, etc.) — the\n * access is treated as passthrough.\n *\n * @param nav - Where navigation currently sits.\n * @param segment - The member name or array index being accessed.\n * @param value - The value sitting at `nav`, when the caller has one.\n * Consulted only at a {@link DiscriminatedModelShape} position, to\n * select the variant via {@link resolveModelShape}. Always read with\n * `\"js\"` naming, since navigation follows client-facing property\n * names. Callers with no value — an `Expression<T>` proxy, for\n * instance — omit it and get passthrough for discriminated\n * positions, which is the honest answer when the variant is\n * unknowable.\n */\nexport function navigateShape(\n nav: NavShape,\n segment: string | number,\n value?: unknown,\n): { readonly stamp: PropertyShape | undefined; readonly next: NavShape } {\n if (typeof segment === \"number\") {\n return { stamp: undefined, next: peelContainer(nav, segment) };\n }\n if (isModelShape(nav)) {\n const flat = resolveModelShape(nav, asRecord(value));\n const stamp = flat?.byJsName[segment];\n if (!stamp) return { stamp: undefined, next: undefined };\n return { stamp, next: derefTarget(stamp.value) };\n }\n // String segment against a container — treat as a record key access.\n if (nav && nav.kind === \"record\") {\n return { stamp: undefined, next: derefTarget(nav.value) };\n }\n return { stamp: undefined, next: undefined };\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction isModelShape(nav: NavShape): nav is ModelShape {\n return nav !== undefined && (nav.kind === \"flatModel\" || nav.kind === \"discriminatedModel\");\n}\n\n/**\n * Peel one container layer off `nav`. Returns `undefined` for\n * non-containers (caller treats the step as passthrough).\n */\nfunction peelContainer(nav: NavShape, index: number): NavShape {\n if (!nav || isModelShape(nav)) return undefined;\n if (nav.kind === \"array\") return derefTarget(nav.element);\n if (nav.kind === \"record\") return derefTarget(nav.value);\n return derefTarget(nav.values[index]);\n}\n\n/**\n * Convert a {@link ValueShape} — where a property *points* — into a\n * {@link NavShape} — where navigation now *is*.\n *\n * The only real work is forcing a {@link DeferredShape} thunk; the\n * resolved model becomes the new position whether or not it is\n * discriminated, since {@link navigateShape} can look up properties on\n * either. Container shapes pass through unchanged, pending an index\n * step.\n *\n * Deliberately *not* named `resolve*` — that prefix belongs to\n * {@link resolveModelShape}, which picks a variant and is a much\n * heavier operation.\n */\nfunction derefTarget(shape: ValueShape | undefined): NavShape {\n if (!shape || isTerminalValueShape(shape)) return undefined;\n if (shape.kind === \"deferred\") return shape.value();\n return shape;\n}\n"]}
1
+ {"version":3,"file":"shape.js","sourceRoot":"","sources":["../../../src/shape/shape.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAqTlC,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAAuC,EAAkB,EAAE,CAAC,CAAC;IAChG,IAAI,EAAE,WAAW;IACjB,QAA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,IAAI,YAAY,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1D,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,WAAW,CAAC,KAA6B;IAChD,IAAI,CAAC,KAAK,IAAI,oBAAoB,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAAE,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Runtime types for ARM shape information.\n *\n * A `ModelShape` is generated once per emitted Model and describes how\n * to map JS-ergonomic property names + structure to the underlying ARM\n * wire shape. The shapes are consumed by the serialization `convertToArmObject`\n * pass (and its inverse `convertFromArmObject`) which rewrites state keys and\n * re-nests `@flattenProperty` paths just before serialization /\n * after deserialization.\n *\n * These types are an internal cross-package runtime contract; generated code\n * imports them from `@azure/provisioning-core/internal`.\n *\n * Nested-shape thunks ({@link DeferredShape}) defer dereferencing the\n * inner shape constant until use, so mutually-referential or\n * self-referential models can be emitted without initialization-order\n * problems.\n *\n * A model shape comes in two flavors:\n * - `FlatModelShape` ({@link FlatModelShape}): the common case —\n * one shape per concrete model.\n * - `DiscriminatedModelShape` ({@link DiscriminatedModelShape}): a\n * name-discriminated variant group. ARM permits multiple resources\n * to share an ARM `type` + `apiVersion` pair and disambiguate via a\n * fixed field — e.g. `Microsoft.ApiManagement/service/portalsettings@2024-05-01`\n * has three variants with `name: 'signin' | 'signup' | 'delegation'`\n * and distinct `properties` shapes. The same machinery applies to\n * nested models that use a `@discriminator` field.\n */\nimport type {\n BooleanValueEncodingDescriptor,\n BytesValueEncodingDescriptor,\n DateValueEncodingDescriptor,\n NumberValueEncodingDescriptor,\n NumericStringEncodingDescriptor,\n StringValueEncodingDescriptor,\n} from \"./value-encoding.js\";\n\n/** The standard single-model shape. */\nexport interface FlatModelShape {\n /**\n * Tag for tag-dispatched discrimination on {@link NavShape} and\n * {@link ModelShape}. Always `\"flatModel\"`.\n */\n readonly kind: \"flatModel\";\n /**\n * Map, keyed by JS-side (client-facing) property name, of how that\n * property maps to the ARM wire shape. Property names not present in\n * this map are assumed to be pass-through (identity mapping).\n */\n readonly byJsName: { readonly [jsName: string]: PropertyShape };\n}\n\n/**\n * The two names a discriminator field goes by.\n *\n * Usually identical — ARM discriminators are `type`, `name`, `kind` and\n * service teams rarely rename them — but a `@clientName` on the field\n * makes them differ, and the two are looked up in different keyspaces:\n * JS-side state is keyed by {@link jsName}, wire JSON by\n * {@link armName}. Carrying both is what lets a discriminated shape\n * resolve in either direction.\n */\nexport interface DiscriminatorNames {\n /** Client-facing name, as authored in TypeScript and held in state. */\n readonly jsName: string;\n /** Wire-level name, as it appears in an ARM template or response. */\n readonly armName: string;\n}\n\n/**\n * A name-discriminated group of variants that share one parent key\n * (an ARM `(type, apiVersion)` at the registry level, or a parent\n * model's `@discriminator` field elsewhere). The `discriminator` names\n * the field whose value selects a variant.\n */\nexport interface DiscriminatedModelShape {\n readonly kind: \"discriminatedModel\";\n /** Names of the field used to select a variant. */\n readonly discriminator: DiscriminatorNames;\n /**\n * Map from discriminator value (e.g. `\"signin\"`) to the shape for\n * that variant. A value with no entry here doesn't end resolution —\n * {@link resolveModelShape} infers the variant from the payload's\n * structure instead.\n *\n * Entries may be:\n * - a {@link FlatModelShape} — the terminal, common case;\n * - a {@link DeferredShape} — breaks emit-order / cyclic-reference\n * hazards, exactly as {@link PropertyShape.value} does;\n * - a nested {@link DiscriminatedModelShape} — a variant that is\n * itself a discriminated base on a *different* field. TypeSpec\n * permits this (`@discriminator(\"kind\") model Pet`, then\n * `@discriminator(\"breed\") model Cat extends Pet`), so selecting\n * a concrete shape may take more than one hop. See\n * {@link resolveModelShape}.\n *\n * Note that a hierarchy re-using the *same* discriminator field at\n * every level (abstract intermediates) is flattened by the emitter\n * into a single level here — only a change of discriminator field\n * produces a nested entry.\n */\n readonly byValue: {\n readonly [value: string]: ModelShape | DeferredShape<ModelShape>;\n };\n}\n\n/** A single model's shape — either flat or discriminated. */\nexport type ModelShape = FlatModelShape | DiscriminatedModelShape;\n\n/**\n * What `registerShape` stores in the global registry, keyed by\n * `(armType, apiVersion)`. Same structural type as {@link ModelShape};\n * the alias documents intent at the registry boundary.\n */\nexport type ResourceShape = ModelShape;\n\n/** A single property's shape entry. */\nexport interface PropertyShape {\n /**\n * ARM wire path from the owning model's root to this property.\n * Single-segment for direct properties; multi-segment for properties\n * hoisted through one or more `@flattenProperty` wrappers.\n */\n readonly armPath: readonly string[];\n\n /**\n * Describes this property's value for navigation and wire conversion.\n * Model and container shapes recurse into nested values; a\n * {@link TerminalValueShape} explicitly terminates recursion. Scalar\n * terminal shapes carry only the encodings valid for their client-side\n * JavaScript representation.\n */\n readonly value: ValueShape;\n\n /**\n * `true` when ARM treats this property as server-set (visible in GET\n * responses but rejected on PUT). Omitted (i.e. `undefined`/`false`)\n * for writable properties.\n *\n * Currently consumed by the `Resource` constructor's deployment-context\n * inheritance to skip readonly properties (notably `location` on many\n * child resources where the field exists in the read model only).\n */\n readonly readOnly?: boolean;\n}\n\n/**\n * Deferred reference to a shape value. The thunk is called on\n * dereference so the actual shape lookup is deferred.\n *\n * **Why this exists instead of embedding the shape directly.**\n *\n * Model shapes frequently reference each other — a model's properties\n * can point to other models, and ARM types include both self-\n * referential (tree-like) and mutually-referential (cyclic) structures.\n * If we embedded a {@link ModelShape} value directly inside another\n * model shape's value field, both shapes would need to be fully\n * initialized when the parent is constructed. That's impossible\n * whenever:\n *\n * - A model references itself, e.g. `TreeNode { children: TreeNode[] }`.\n * - Two models reference each other, e.g. `A { b?: B }` and `B { a?: A }`.\n * - Two modules each define shapes that reference shapes from the other.\n *\n * In all three cases the second constant is in the Temporal Dead Zone\n * when the first one's literal evaluates, and the runtime throws\n * `ReferenceError: Cannot access ... before initialization`.\n *\n * Wrapping the reference in a thunk solves it. The closure captures\n * the *binding name*, not its current value. The lookup happens later\n * when the thunk is called — by which time the module graph has\n * finished evaluating and both shapes are fully constructed.\n *\n * Only the model variant of {@link ValueShape} carries a reference —\n * container shapes (`array`, `record`) are eager because they don't\n * reference any module-level binding directly; the inner reference\n * deeper down handles cycle-breaking.\n */\nexport interface DeferredShape<T> {\n readonly kind: \"deferred\";\n readonly value: () => T;\n}\n\n/** An array-of-T property/container shape. */\nexport interface ArrayShape {\n readonly kind: \"array\";\n readonly element: ValueShape;\n}\n\n/** A `Record<string, T>` property/container shape. */\nexport interface RecordShape {\n readonly kind: \"record\";\n readonly value: ValueShape;\n}\n\n/** A fixed-length heterogeneous tuple property/container shape. */\nexport interface TupleShape {\n readonly kind: \"tuple\";\n readonly values: readonly ValueShape[];\n}\n\n/** A TypeSpec scalar rendered as TypeScript `any`. */\nexport interface AnyShape {\n readonly kind: \"any\";\n}\n\n/** A scalar whose client-side JavaScript representation is `string`. */\nexport interface StringShape {\n readonly kind: \"string\";\n readonly encoding?: StringValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `boolean`. */\nexport interface BooleanShape {\n readonly kind: \"boolean\";\n readonly encoding?: BooleanValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `number`. */\nexport interface NumberShape {\n readonly kind: \"number\";\n readonly encoding?: NumberValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `Uint8Array`. */\nexport interface BytesShape {\n readonly kind: \"bytes\";\n readonly encoding?: BytesValueEncodingDescriptor;\n}\n\n/** A scalar whose client-side JavaScript representation is `Date`. */\nexport interface DateShape {\n readonly kind: \"date\";\n readonly encoding?: DateValueEncodingDescriptor;\n}\n\n/** A terminal TypeSpec string literal. Literals cannot carry `@encode`. */\nexport interface StringLiteralShape {\n readonly kind: \"stringLiteral\";\n}\n\n/** A terminal TypeSpec numeric literal. */\nexport interface NumberLiteralShape {\n readonly kind: \"numberLiteral\";\n /** `@encode(string)` when the numeric literal is exposed as wire text. */\n readonly encoding?: NumericStringEncodingDescriptor;\n}\n\n/** A terminal TypeSpec boolean literal. */\nexport interface BooleanLiteralShape {\n readonly kind: \"booleanLiteral\";\n /** `@encode(string)` while the client value remains a boolean literal. */\n readonly encoding?: BooleanValueEncodingDescriptor;\n}\n\n/** A terminal TypeSpec enum. Enums cannot carry `@encode`. */\nexport interface EnumShape {\n readonly kind: \"enum\";\n}\n\n/**\n * A terminal TypeSpec union for which no single structural shape can be\n * selected. Unions cannot carry `@encode` in the provisioning emitter.\n */\nexport interface UnionShape {\n readonly kind: \"union\";\n}\n\n/** The TypeSpec `null` intrinsic. */\nexport interface NullShape {\n readonly kind: \"null\";\n}\n\n/**\n * Concrete terminal values in the generated client API.\n *\n * Scalar kinds describe the JavaScript value accepted by the generated\n * TypeScript surface, not necessarily the semantic TypeSpec scalar. For\n * example, a numeric `duration` is a {@link NumberShape}, while the default\n * ISO8601 duration is a {@link StringShape}; their narrowed `encoding` fields\n * retain the TypeSpec source semantics needed for wire conversion. Numeric and\n * boolean literal shapes can carry the same narrowly applicable encodings that\n * TypeSpec permits on those values. String literals, enums, unions, and null\n * remain distinct non-encodable terminal categories.\n * Expressions are orthogonal wrappers around any value shape and are handled\n * before shape-directed conversion.\n */\nexport type TerminalValueShape =\n | AnyShape\n | StringShape\n | BooleanShape\n | NumberShape\n | BytesShape\n | DateShape\n | StringLiteralShape\n | NumberLiteralShape\n | BooleanLiteralShape\n | EnumShape\n | UnionShape\n | NullShape;\n\n/** A container through which property navigation can continue. */\nexport type ContainerShape = ArrayShape | RecordShape | TupleShape;\n\nexport type ValueShape = TerminalValueShape | DeferredShape<ModelShape> | ContainerShape;\n\n// ---------------------------------------------------------------------------\n// Constructor helpers\n// ---------------------------------------------------------------------------\n\n/** Build a {@link FlatModelShape} from a property map. */\nexport const createFlatModelShape = (byJsName: Record<string, PropertyShape>): FlatModelShape => ({\n kind: \"flatModel\",\n byJsName,\n});\n\n/**\n * Build a {@link DiscriminatedModelShape}.\n *\n * Pass a bare string when the field goes by the same name on both\n * sides, which is the overwhelmingly common case; pass a\n * {@link DiscriminatorNames} pair when a `@clientName` makes them\n * differ.\n */\nexport const createDiscriminatedModelShape = (\n discriminator: string | DiscriminatorNames,\n byValue: Record<string, ModelShape | DeferredShape<ModelShape>>,\n): DiscriminatedModelShape => ({\n kind: \"discriminatedModel\",\n discriminator:\n typeof discriminator === \"string\"\n ? { jsName: discriminator, armName: discriminator }\n : discriminator,\n byValue,\n});\n\n/**\n * Build a {@link DeferredShape}. The thunk is called on dereference; defer\n * the actual shape lookup so that mutually-referential constants can\n * be emitted in any order.\n */\nexport const createDeferredShape = <T>(value: () => T): DeferredShape<T> => ({\n kind: \"deferred\",\n value,\n});\n\n/** Build an {@link AnyShape}. */\nexport const createAnyShape = (): AnyShape => ({ kind: \"any\" });\n\n/** Build a {@link StringShape}, optionally with a compatible wire encoding. */\nexport const createStringShape = (encoding?: StringValueEncodingDescriptor): StringShape => ({\n kind: \"string\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link BooleanShape}, optionally with a compatible wire encoding. */\nexport const createBooleanShape = (encoding?: BooleanValueEncodingDescriptor): BooleanShape => ({\n kind: \"boolean\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link NumberShape}, optionally with a compatible wire encoding. */\nexport const createNumberShape = (encoding?: NumberValueEncodingDescriptor): NumberShape => ({\n kind: \"number\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link BytesShape}, optionally with a compatible wire encoding. */\nexport const createBytesShape = (encoding?: BytesValueEncodingDescriptor): BytesShape => ({\n kind: \"bytes\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a {@link DateShape}, optionally with a compatible wire encoding. */\nexport const createDateShape = (encoding?: DateValueEncodingDescriptor): DateShape => ({\n kind: \"date\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a terminal {@link StringLiteralShape}. */\nexport const createStringLiteralShape = (): StringLiteralShape => ({\n kind: \"stringLiteral\",\n});\n\n/** Build a terminal {@link NumberLiteralShape}. */\nexport const createNumberLiteralShape = (\n encoding?: NumericStringEncodingDescriptor,\n): NumberLiteralShape => ({\n kind: \"numberLiteral\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a terminal {@link BooleanLiteralShape}. */\nexport const createBooleanLiteralShape = (\n encoding?: BooleanValueEncodingDescriptor,\n): BooleanLiteralShape => ({\n kind: \"booleanLiteral\",\n ...(encoding ? { encoding } : {}),\n});\n\n/** Build a terminal {@link EnumShape}. */\nexport const createEnumShape = (): EnumShape => ({ kind: \"enum\" });\n\n/** Build a terminal {@link UnionShape}. */\nexport const createUnionShape = (): UnionShape => ({ kind: \"union\" });\n\n/** Build a terminal {@link NullShape}. */\nexport const createNullShape = (): NullShape => ({ kind: \"null\" });\n\n/** Build an {@link ArrayShape}. */\nexport const createArrayShape = (element: ValueShape): ArrayShape => ({\n kind: \"array\",\n element,\n});\n\n/** Build a {@link RecordShape}. */\nexport const createRecordShape = (value: ValueShape): RecordShape => ({\n kind: \"record\",\n value,\n});\n\n/** Build a {@link TupleShape}. */\nexport const createTupleShape = (values: readonly ValueShape[]): TupleShape => ({\n kind: \"tuple\",\n values,\n});\n\n/** Return whether a value shape terminates property navigation. */\nexport function isTerminalValueShape(shape: ValueShape): shape is TerminalValueShape {\n switch (shape.kind) {\n case \"any\":\n case \"string\":\n case \"boolean\":\n case \"number\":\n case \"bytes\":\n case \"date\":\n case \"stringLiteral\":\n case \"numberLiteral\":\n case \"booleanLiteral\":\n case \"enum\":\n case \"union\":\n case \"null\":\n return true;\n case \"deferred\":\n case \"array\":\n case \"record\":\n case \"tuple\":\n return false;\n default:\n return assertNeverShape(shape);\n }\n}\n\nfunction assertNeverShape(shape: never): never {\n throw new Error(`Unhandled value shape: ${String(shape)}`);\n}\n\n// ---------------------------------------------------------------------------\n// Helpers used by the runtime proxy + lowering pass\n// ---------------------------------------------------------------------------\n\n/**\n * Runtime navigation position for a typed proxy. Either:\n * - a {@link ModelShape} — we're at a model's properties, whether or\n * not its variant is known,\n * - a {@link ContainerShape} — we're at a container that hasn't yet been\n * indexed,\n * - `undefined` — the current position is terminal, unknown, or the proxy\n * was created without a shape.\n *\n * Proxies carry a `NavShape` through each access so they can stamp and\n * resolve the correct shape on deeper navigation.\n *\n * Navigation never sits at a {@link DeferredShape} — refs are resolved\n * eagerly as soon as the proxy encounters them.\n */\nexport type NavShape = ModelShape | ContainerShape | undefined;\n\n/**\n * Resolve a {@link ModelShape} to the single concrete variant that\n * applies to `value`.\n *\n * Resolution is iterative, not a single step, because a variant may\n * itself be a discriminated group keyed on a *different* field (see\n * {@link DiscriminatedModelShape.byValue}). Each hop reads its own\n * discriminator out of the same `value`, so\n * `{ kind: \"cat\", breed: \"siamese\" }` resolves through `Pet` → `Cat`\n * → `Siamese`. {@link DeferredShape} entries are dereferenced in\n * place, and flat model shapes are returned as-is.\n *\n * When a hop's discriminator can't be read — it is absent, is not a\n * string (the *expression-valued* case), or names an unknown variant —\n * the variant is instead **inferred from the value's structure** by\n * {@link selectVariant}. That inference is sound rather than a guess:\n * ARM would reject a payload that doesn't match the variant its\n * discriminator selects, so a concrete payload determines the variant\n * even when the discriminator itself is only known at deploy time.\n *\n * Bicep takes the same position — a discriminator it can't evaluate at\n * compile time downgrades type checking for that object (diagnostic\n * `BCP225`) rather than failing the build.\n *\n * Returns `undefined` when `shape` is `undefined`, when there is no\n * `value` to infer from, or when the `byValue` graph is cyclic\n * (defensive; the emitter does not produce cycles here).\n *\n * @param shape - The shape to resolve. Flat shapes are returned\n * unchanged, so callers can pass either kind without checking.\n * @param value - The object this shape describes, used both to read\n * discriminators and to infer a variant when they can't be read.\n * Omit it when no value exists (an `Expression<T>` proxy, say) and\n * discriminated shapes will resolve to `undefined`.\n * @param valueKeyedBy - Which naming **`value`'s own keys** use — not\n * the shape's. A {@link FlatModelShape} is the mapping *between* the\n * two sides (one property is `secretVersion` in TypeScript and\n * `version` on the wire), so inference has to read both sides in the\n * same naming or nothing matches:\n *\n * - `\"js\"` — client-facing names, as authored in TypeScript and held\n * in a resource's state. These are\n * {@link FlatModelShape.byJsName}'s own keys. Passed by\n * `convertToArmObject`, on state about to be serialized.\n * - `\"arm\"` — wire names, as they appear in an ARM template or a\n * service response. These are the first segment of each\n * {@link PropertyShape.armPath}. Passed by `convertFromArmObject`, on JSON\n * just parsed off the wire.\n *\n * Has no effect when the discriminator resolves normally, and no\n * effect at all for models whose properties map 1:1.\n */\nexport function resolveModelShape(\n shape: ModelShape | undefined,\n value: Record<string, unknown> | undefined,\n valueKeyedBy: \"js\" | \"arm\" = \"js\",\n): FlatModelShape | undefined {\n let current: ModelShape | DeferredShape<ModelShape> | undefined = shape;\n const seen = new Set<ModelShape | DeferredShape<ModelShape>>();\n\n while (current !== undefined) {\n if (seen.has(current)) return undefined;\n seen.add(current);\n\n if (current.kind === \"deferred\") {\n current = current.value();\n continue;\n }\n if (current.kind === \"flatModel\") return current;\n\n const group: DiscriminatedModelShape = current;\n // Read the discriminator under the same naming as `value`'s own\n // keys: JS-side state holds it under the client name, wire JSON\n // under the ARM name. The two coincide for almost every ARM\n // discriminator, but a `@clientName` on the field makes them\n // differ, and reading the wrong one silently downgrades exact\n // dispatch to structural inference below.\n const names = group.discriminator;\n const key = value?.[valueKeyedBy === \"js\" ? names.jsName : names.armName];\n const next = typeof key === \"string\" ? group.byValue[key] : undefined;\n if (next === undefined) {\n return value ? selectVariant(group, value, valueKeyedBy) : undefined;\n }\n current = next;\n }\n\n return undefined;\n}\n\n/**\n * Infer which variant of `group` a value belongs to by structure.\n *\n * Every variant is scored by how many of the value's keys it declares,\n * descending into nested objects and containers so that variants which\n * are indistinguishable at the top level can still be told apart. CDN's\n * delivery-rule actions are exactly that case: all nine variants\n * declare `{ name, parameters }` and differ only inside `parameters`.\n *\n * The highest score wins; ties keep the earliest variant in `byValue`\n * order, which is stable emitter output. A tie means the tied variants\n * declare the same keys for the data given, and the emitter guarantees\n * that keys shared across variants map identically — so either choice\n * produces the same wire mapping for everything actually present.\n */\nfunction selectVariant(\n group: DiscriminatedModelShape,\n value: Record<string, unknown>,\n valueKeyedBy: \"js\" | \"arm\",\n): FlatModelShape | undefined {\n let best: FlatModelShape | undefined;\n let bestScore = -1;\n\n for (const variant of flattenVariants(group, new Set())) {\n const score = scoreShape(variant, value, valueKeyedBy, new WeakSet());\n if (score > bestScore) {\n bestScore = score;\n best = variant;\n }\n }\n\n return best;\n}\n\n/** How many of `value`'s keys, recursively, `shape` accounts for. */\nfunction scoreShape(\n shape: FlatModelShape,\n value: Record<string, unknown>,\n valueKeyedBy: \"js\" | \"arm\",\n visiting: WeakSet<object>,\n): number {\n if (visiting.has(value)) return 0;\n visiting.add(value);\n\n const byKey = getShapePropertiesMap(shape, valueKeyedBy);\n let score = 0;\n\n for (const [key, sub] of Object.entries(value)) {\n const prop = byKey.get(key);\n if (!prop) continue;\n score += 1;\n score += scoreNested(sub, prop.value, valueKeyedBy, visiting);\n }\n\n visiting.delete(value);\n return score;\n}\n\n/**\n * Score one level deeper, through a property's target. Containers are\n * sampled at their first entry — enough to discriminate, and bounded\n * regardless of how large the value is.\n */\nfunction scoreNested(\n value: unknown,\n target: ValueShape | undefined,\n valueKeyedBy: \"js\" | \"arm\",\n visiting: WeakSet<object>,\n): number {\n if (!target || isTerminalValueShape(target) || value === null || typeof value !== \"object\") {\n return 0;\n }\n\n if (target.kind === \"array\") {\n if (!Array.isArray(value) || value.length === 0) return 0;\n return scoreNested(value[0], target.element, valueKeyedBy, visiting);\n }\n\n if (target.kind === \"record\") {\n if (Array.isArray(value)) return 0;\n const first = Object.values(value)[0];\n if (first === undefined) return 0;\n return scoreNested(first, target.value, valueKeyedBy, visiting);\n }\n\n if (target.kind === \"tuple\") {\n if (!Array.isArray(value)) return 0;\n return target.values.reduce(\n (score, tupleValue, index) =>\n score + scoreNested(value[index], tupleValue, valueKeyedBy, visiting),\n 0,\n );\n }\n\n if (Array.isArray(value)) return 0;\n const nested = resolveModelShape(target.value(), value as Record<string, unknown>, valueKeyedBy);\n if (!nested) return 0;\n return scoreShape(nested, value as Record<string, unknown>, valueKeyedBy, visiting);\n}\n\nconst shapePropertiesCache = new WeakMap<\n FlatModelShape,\n Map<\"js\" | \"arm\", Map<string, PropertyShape>>\n>();\n\n/**\n * A shape's properties as a map, keyed by the name they go by in the\n * requested naming. Pass the same naming the value uses and the two\n * line up, which is what lets {@link scoreShape} compare them.\n *\n * Memoized per (shape, naming): scoring calls this once per candidate\n * variant per level, so rebuilding would be wasteful.\n *\n * @param shape - The shape whose properties to map.\n * @param keyedBy - Which name to key by. Note this describes the *map\n * being built*, not an incoming value — unlike the `valueKeyedBy`\n * parameter the callers thread through.\n */\nfunction getShapePropertiesMap(\n shape: FlatModelShape,\n keyedBy: \"js\" | \"arm\",\n): Map<string, PropertyShape> {\n let byNaming = shapePropertiesCache.get(shape);\n if (!byNaming) {\n byNaming = new Map();\n shapePropertiesCache.set(shape, byNaming);\n }\n let byKey = byNaming.get(keyedBy);\n if (byKey) return byKey;\n\n byKey = new Map<string, PropertyShape>();\n for (const [jsName, prop] of Object.entries(shape.byJsName)) {\n // `armPath[0]` rather than the whole path: that is the top-level\n // wire key, even for properties hoisted through `@flattenProperty`.\n const key = keyedBy === \"js\" ? jsName : prop.armPath[0];\n // First writer wins, so a hoisted property never shadows the\n // wrapper it was hoisted through.\n if (key !== undefined && !byKey.has(key)) byKey.set(key, prop);\n }\n byNaming.set(keyedBy, byKey);\n return byKey;\n}\n\n/**\n * Flatten a group to the concrete flat shapes underneath it,\n * dereferencing thunks and descending through nested groups.\n */\nfunction flattenVariants(\n group: DiscriminatedModelShape,\n seen: Set<DiscriminatedModelShape>,\n): FlatModelShape[] {\n if (seen.has(group)) return [];\n seen.add(group);\n\n const out: FlatModelShape[] = [];\n for (const key of Object.keys(group.byValue)) {\n let entry: ModelShape | DeferredShape<ModelShape> | undefined = group.byValue[key];\n if (entry?.kind === \"deferred\") entry = entry.value();\n if (entry === undefined) continue;\n if (entry.kind === \"flatModel\") out.push(entry);\n else out.push(...flattenVariants(entry, seen));\n }\n return out;\n}\n\n/**\n * Navigate `nav` one step deeper using `segment`. For string segments\n * (`.foo`) at a model position, returns the property's shape entry as\n * `stamp` and advances `next` into the property's target. For numeric\n * segments (`[i]`) or string keys at a record position, peels one\n * container layer; `stamp` is always `undefined`.\n *\n * Returns `{ stamp: undefined, next: undefined }` when the step can't\n * be resolved (unknown property, out-of-shape access, etc.) — the\n * access is treated as passthrough.\n *\n * @param nav - Where navigation currently sits.\n * @param segment - The member name or array index being accessed.\n * @param value - The value sitting at `nav`, when the caller has one.\n * Consulted only at a {@link DiscriminatedModelShape} position, to\n * select the variant via {@link resolveModelShape}. Always read with\n * `\"js\"` naming, since navigation follows client-facing property\n * names. Callers with no value — an `Expression<T>` proxy, for\n * instance — omit it and get passthrough for discriminated\n * positions, which is the honest answer when the variant is\n * unknowable.\n */\nexport function navigateShape(\n nav: NavShape,\n segment: string | number,\n value?: unknown,\n): { readonly stamp: PropertyShape | undefined; readonly next: NavShape } {\n if (typeof segment === \"number\") {\n return { stamp: undefined, next: peelContainer(nav, segment) };\n }\n if (isModelShape(nav)) {\n const flat = resolveModelShape(nav, asRecord(value));\n const stamp = flat?.byJsName[segment];\n if (!stamp) return { stamp: undefined, next: undefined };\n return { stamp, next: derefTarget(stamp.value) };\n }\n // String segment against a container — treat as a record key access.\n if (nav && nav.kind === \"record\") {\n return { stamp: undefined, next: derefTarget(nav.value) };\n }\n return { stamp: undefined, next: undefined };\n}\n\nfunction asRecord(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction isModelShape(nav: NavShape): nav is ModelShape {\n return nav !== undefined && (nav.kind === \"flatModel\" || nav.kind === \"discriminatedModel\");\n}\n\n/**\n * Peel one container layer off `nav`. Returns `undefined` for\n * non-containers (caller treats the step as passthrough).\n */\nfunction peelContainer(nav: NavShape, index: number): NavShape {\n if (!nav || isModelShape(nav)) return undefined;\n if (nav.kind === \"array\") return derefTarget(nav.element);\n if (nav.kind === \"record\") return derefTarget(nav.value);\n return derefTarget(nav.values[index]);\n}\n\n/**\n * Convert a {@link ValueShape} — where a property *points* — into a\n * {@link NavShape} — where navigation now *is*.\n *\n * The only real work is forcing a {@link DeferredShape} thunk; the\n * resolved model becomes the new position whether or not it is\n * discriminated, since {@link navigateShape} can look up properties on\n * either. Container shapes pass through unchanged, pending an index\n * step.\n *\n * Deliberately *not* named `resolve*` — that prefix belongs to\n * {@link resolveModelShape}, which picks a variant and is a much\n * heavier operation.\n */\nfunction derefTarget(shape: ValueShape | undefined): NavShape {\n if (!shape || isTerminalValueShape(shape)) return undefined;\n if (shape.kind === \"deferred\") return shape.value();\n return shape;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { ProvisioningComponent } from "../provisioning-component.js";
2
2
  import { type Expression, type ExpressionOrValue, type InputRecord } from "../../expression/expressions.js";
3
3
  import type { ResourceNamingRules } from "../../naming/naming-rules.js";
4
- import type { ExistingResourceProps } from "../resource/resource.js";
4
+ import type { ExistingResourceProps, ResourceOptions, ResourceProps } from "../resource/resource.js";
5
5
  import { Resource } from "../resource/resource.js";
6
6
  export interface ResourceGroupProps {
7
7
  name?: ExpressionOrValue<string> | undefined;
@@ -17,6 +17,11 @@ export interface ResourceGroupProps {
17
17
  * location, tags, and naming policy, and deploy at resource-group scope
18
18
  * in the generated Bicep.
19
19
  *
20
+ * The parent may be a Stack or an ordinary component, with no resource
21
+ * declarations in its ancestry. New groups require a subscription-scoped Stack.
22
+ * Existing groups may be referenced from other Stack scopes with an appropriate
23
+ * lookup scope.
24
+ *
20
25
  * @example
21
26
  * ```typescript snippet:ignore
22
27
  * import { Stack, ResourceGroup } from "@azure/provisioning-core";
@@ -33,6 +38,7 @@ export declare class ResourceGroup extends Resource<"Microsoft.Resources/resourc
33
38
  static readonly resourceType: "Microsoft.Resources/resourceGroups";
34
39
  static readonly apiVersion = "2024-03-01";
35
40
  protected static namingRules: ResourceNamingRules;
41
+ protected static validate(context: ProvisioningComponent, props: ResourceProps<string> & Record<string, unknown>, _options?: ResourceOptions, _namingRules?: ResourceNamingRules): void;
36
42
  constructor(context: ProvisioningComponent, props: (ResourceGroupProps & {
37
43
  existing?: false;
38
44
  }) | (ExistingResourceProps & {
@@ -1 +1 @@
1
- {"version":3,"file":"resource-group.d.ts","sourceRoot":"","sources":["../../../../src/constructs/built-in-resources/resource-group.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EACL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAgBnD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC7C,QAAQ,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,a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;QAAE,QAAQ,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,GAAG,CAAC,qBAAqB,GAAG;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,CAAC;IAmB9F,sDAAsD;IACtD,IAAI,QAAQ,IAAI,UAAU,CAAC,MAAM,CAAC,CAEjC;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,EAE5C;IAED,IAAI,SAAS,IAAI,UAAU,CAAC,MAAM,CAAC,CAElC;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,SAAS,EAEzD;IAED,IAAI,IAAI,IAAI,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAIrF;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,EAMzF;IAED,GAAG,CAAC,CAAC,SAAS,KAAK,OAAO,EAAE,qBAAqB,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,qBAAqB,EACzF,IAAI,EAAE,CAAC,EACP,GAAG,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GAC5E,YAAY,CAAC,CAAC,CAAC;CAGnB"}
@@ -33,17 +33,15 @@ module.exports = __toCommonJS(resource_group_exports);
33
33
  var fn = __toESM(require("../../fn.js"));
34
34
  var import_resource_proxy = require("../resource/resource-proxy.js");
35
35
  var import_resource = require("../resource/resource.js");
36
+ var import_resource_utils = require("../resource/resource-utils.js");
37
+ var import_stack = require("../stack.js");
36
38
  var import_shape = require("../../shape/shape.js");
37
39
  const resourceGroupNamingRules = {
38
40
  abbreviation: "rg",
39
41
  minLength: 1,
40
42
  maxLength: 90,
41
- validCharacters: {
42
- uppercase: true,
43
- hyphens: true,
44
- underscores: true,
45
- periods: true
46
- },
43
+ // ARM CommonTypes.ResourceGroupNameParameter.
44
+ pattern: { regex: "^[-\\w\\._\\(\\)]+$" },
47
45
  scope: "subscription"
48
46
  };
49
47
  class ResourceGroup extends import_resource.Resource {
@@ -64,6 +62,29 @@ class ResourceGroup extends import_resource.Resource {
64
62
  );
65
63
  this.register();
66
64
  }
65
+ static validate(context, props, _options, _namingRules) {
66
+ let ancestor = context;
67
+ while (ancestor !== void 0 && !(ancestor instanceof import_stack.Stack)) {
68
+ if ((0, import_resource_utils.isResourceDeclaration)(ancestor)) {
69
+ throw new Error(
70
+ "ResourceGroup cannot be nested beneath a resource declaration, directly or through components."
71
+ );
72
+ }
73
+ ancestor = ancestor.parent;
74
+ }
75
+ if (props.existing !== true) {
76
+ if (!(ancestor instanceof import_stack.Stack)) {
77
+ throw new Error(
78
+ 'A new ResourceGroup requires a containing Stack with targetScope "subscription".'
79
+ );
80
+ }
81
+ if (ancestor.targetScope !== "subscription") {
82
+ throw new Error(
83
+ `A new ResourceGroup requires Stack targetScope "subscription", but Stack "${ancestor.name}" targets "${ancestor.targetScope}".`
84
+ );
85
+ }
86
+ }
87
+ }
67
88
  constructor(context, props) {
68
89
  super(context, {
69
90
  ...props,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/constructs/built-in-resources/resource-group.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ProvisioningComponent } from \"../provisioning-component.js\";\nimport * as fn from \"../../fn.js\";\nimport {\n type Expression,\n type ExpressionOrValue,\n type InputRecord,\n} from \"../../expression/expressions.js\";\nimport type { ResourceNamingRules } from \"../../naming/naming-rules.js\";\nimport { deref } from \"../resource/resource-proxy.js\";\nimport type { ExistingResourceProps } from \"../resource/resource.js\";\nimport { Resource } from \"../resource/resource.js\";\nimport { createFlatModelShape, createRecordShape, createStringShape } from \"../../shape/shape.js\";\n\nconst resourceGroupNamingRules: ResourceNamingRules = {\n abbreviation: \"rg\",\n minLength: 1,\n maxLength: 90,\n validCharacters: {\n uppercase: true,\n hyphens: true,\n underscores: true,\n periods: true,\n },\n scope: \"subscription\",\n};\n\nexport interface ResourceGroupProps {\n name?: ExpressionOrValue<string> | undefined;\n location: ExpressionOrValue<string>;\n tags?: Record<string, ExpressionOrValue<string>>;\n managedBy?: ExpressionOrValue<string>;\n}\n\n/**\n * An Azure resource group that establishes a deployment boundary.\n *\n * @remarks\n * Resources created with a `ResourceGroup` as their parent inherit its\n * location, tags, and naming policy, and deploy at resource-group scope\n * in the generated Bicep.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, ResourceGroup } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\");\n * const rg = new ResourceGroup(stack, { location: \"eastus\" });\n * const vault = new KeyVault(rg, {\n * properties: { tenantId: \"...\", sku: { family: \"A\", name: \"standard\" } },\n * });\n * ```\n */\nexport class ResourceGroup extends Resource<\"Microsoft.Resources/resourceGroups\"> {\n static readonly resourceType = \"Microsoft.Resources/resourceGroups\" as const;\n static readonly apiVersion = \"2024-03-01\";\n\n protected static namingRules = resourceGroupNamingRules;\n\n static {\n this.registerShape(\n createFlatModelShape({\n name: { armPath: [\"name\"], value: createStringShape() },\n location: { armPath: [\"location\"], value: createStringShape() },\n tags: {\n armPath: [\"tags\"],\n value: createRecordShape(createStringShape()),\n },\n managedBy: { armPath: [\"managedBy\"], value: createStringShape() },\n }),\n );\n this.register();\n }\n\n constructor(\n context: ProvisioningComponent,\n props:\n (ResourceGroupProps & { existing?: false }) | (ExistingResourceProps & { existing: true }),\n ) {\n super(context, {\n ...props,\n type: ResourceGroup.resourceType,\n apiVersion: ResourceGroup.apiVersion,\n });\n\n this._localDeploymentContext = {\n // Resources inside this RG deploy at RG scope, so the canonical\n // default is the Bicep runtime expression `resourceGroup().location`\n // (i.e. the actual location of whichever RG hosts the deployment).\n // This is correct whether the RG is authored locally or referenced\n // as `existing`.\n location: fn.resourceGroup().location,\n tags: deref(this.tags),\n };\n }\n\n /** The resource group's location as an expression. */\n get location(): Expression<string> {\n return this.expr(\"location\");\n }\n set location(value: ExpressionOrValue<string>) {\n this.setProperty(\"location\", value);\n }\n\n get managedBy(): Expression<string> {\n return this.expr(\"managedBy\");\n }\n set managedBy(value: ExpressionOrValue<string> | undefined) {\n this.setProperty(\"managedBy\", value);\n }\n\n get tags(): InputRecord<ExpressionOrValue<string>, Record<string, string>> | undefined {\n return this.state.tags === undefined\n ? undefined\n : (this.expr(\"tags\") as InputRecord<ExpressionOrValue<string>, Record<string, string>>);\n }\n set tags(value: InputRecord<ExpressionOrValue<string>, Record<string, string>> | undefined) {\n this.setProperty(\"tags\", value);\n this._localDeploymentContext = {\n ...this._localDeploymentContext,\n tags: deref(this.tags),\n };\n }\n\n add<T extends new (context: ProvisioningComponent, ...args: any[]) => ProvisioningComponent>(\n ctor: T,\n ...args: ConstructorParameters<T> extends [any, ...infer Rest] ? Rest : never\n ): InstanceType<T> {\n return new ctor(this.self, ...args) as InstanceType<T>;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AAOpB,4BAAsB;AAEtB,sBAAyB;AACzB,mBAA2E;AAE3E,MAAM,2BAAgD;AAAA,EACpD,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,iBAAiB;AAAA,IACf,WAAW;AAAA,IACX,SAAS;AAAA,IACT,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA,OAAO;AACT;AA6BO,MAAM,sBAAsB,yBAA+C;AAAA,EAChF,OAAgB,eAAe;AAAA,EAC/B,OAAgB,aAAa;AAAA,EAE7B,OAAiB,cAAc;AAAA,EAE/B,OAAO;A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AEA,IACE,SACG,MACc;AACjB,WAAO,IAAI,KAAK,KAAK,MAAM,GAAG,IAAI;AAAA,EACpC;AACF;",
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ProvisioningComponent } from \"../provisioning-component.js\";\nimport * as fn from \"../../fn.js\";\nimport {\n type Expression,\n type ExpressionOrValue,\n type InputRecord,\n} from \"../../expression/expressions.js\";\nimport type { ResourceNamingRules } from \"../../naming/naming-rules.js\";\nimport { deref } from \"../resource/resource-proxy.js\";\nimport type {\n ExistingResourceProps,\n ResourceOptions,\n ResourceProps,\n} from \"../resource/resource.js\";\nimport { Resource } from \"../resource/resource.js\";\nimport { isResourceDeclaration } from \"../resource/resource-utils.js\";\nimport { Stack } from \"../stack.js\";\nimport { createFlatModelShape, createRecordShape, createStringShape } from \"../../shape/shape.js\";\n\nconst resourceGroupNamingRules: ResourceNamingRules = {\n abbreviation: \"rg\",\n minLength: 1,\n maxLength: 90,\n // ARM CommonTypes.ResourceGroupNameParameter.\n pattern: { regex: \"^[-\\\\w\\\\._\\\\(\\\\)]+$\" },\n scope: \"subscription\",\n};\n\nexport interface ResourceGroupProps {\n name?: ExpressionOrValue<string> | undefined;\n location: ExpressionOrValue<string>;\n tags?: Record<string, ExpressionOrValue<string>>;\n managedBy?: ExpressionOrValue<string>;\n}\n\n/**\n * An Azure resource group that establishes a deployment boundary.\n *\n * @remarks\n * Resources created with a `ResourceGroup` as their parent inherit its\n * location, tags, and naming policy, and deploy at resource-group scope\n * in the generated Bicep.\n *\n * The parent may be a Stack or an ordinary component, with no resource\n * declarations in its ancestry. New groups require a subscription-scoped Stack.\n * Existing groups may be referenced from other Stack scopes with an appropriate\n * lookup scope.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, ResourceGroup } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\");\n * const rg = new ResourceGroup(stack, { location: \"eastus\" });\n * const vault = new KeyVault(rg, {\n * properties: { tenantId: \"...\", sku: { family: \"A\", name: \"standard\" } },\n * });\n * ```\n */\nexport class ResourceGroup extends Resource<\"Microsoft.Resources/resourceGroups\"> {\n static readonly resourceType = \"Microsoft.Resources/resourceGroups\" as const;\n static readonly apiVersion = \"2024-03-01\";\n\n protected static namingRules = resourceGroupNamingRules;\n\n static {\n this.registerShape(\n createFlatModelShape({\n name: { armPath: [\"name\"], value: createStringShape() },\n location: { armPath: [\"location\"], value: createStringShape() },\n tags: {\n armPath: [\"tags\"],\n value: createRecordShape(createStringShape()),\n },\n managedBy: { armPath: [\"managedBy\"], value: createStringShape() },\n }),\n );\n this.register();\n }\n\n protected static override validate(\n context: ProvisioningComponent,\n props: ResourceProps<string> & Record<string, unknown>,\n _options?: ResourceOptions,\n _namingRules?: ResourceNamingRules,\n ): void {\n let ancestor: ProvisioningComponent | undefined = context;\n while (ancestor !== undefined && !(ancestor instanceof Stack)) {\n if (isResourceDeclaration(ancestor)) {\n throw new Error(\n \"ResourceGroup cannot be nested beneath a resource declaration, directly or through components.\",\n );\n }\n ancestor = ancestor.parent;\n }\n if (props.existing !== true) {\n if (!(ancestor instanceof Stack)) {\n throw new Error(\n 'A new ResourceGroup requires a containing Stack with targetScope \"subscription\".',\n );\n }\n if (ancestor.targetScope !== \"subscription\") {\n throw new Error(\n `A new ResourceGroup requires Stack targetScope \"subscription\", but Stack \"${ancestor.name}\" targets \"${ancestor.targetScope}\".`,\n );\n }\n }\n }\n\n constructor(\n context: ProvisioningComponent,\n props:\n (ResourceGroupProps & { existing?: false }) | (ExistingResourceProps & { existing: true }),\n ) {\n super(context, {\n ...props,\n type: ResourceGroup.resourceType,\n apiVersion: ResourceGroup.apiVersion,\n });\n\n this._localDeploymentContext = {\n // Resources inside this RG deploy at RG scope, so the canonical\n // default is the Bicep runtime expression `resourceGroup().location`\n // (i.e. the actual location of whichever RG hosts the deployment).\n // This is correct whether the RG is authored locally or referenced\n // as `existing`.\n location: fn.resourceGroup().location,\n tags: deref(this.tags),\n };\n }\n\n /** The resource group's location as an expression. */\n get location(): Expression<string> {\n return this.expr(\"location\");\n }\n set location(value: ExpressionOrValue<string>) {\n this.setProperty(\"location\", value);\n }\n\n get managedBy(): Expression<string> {\n return this.expr(\"managedBy\");\n }\n set managedBy(value: ExpressionOrValue<string> | undefined) {\n this.setProperty(\"managedBy\", value);\n }\n\n get tags(): InputRecord<ExpressionOrValue<string>, Record<string, string>> | undefined {\n return this.state.tags === undefined\n ? undefined\n : (this.expr(\"tags\") as InputRecord<ExpressionOrValue<string>, Record<string, string>>);\n }\n set tags(value: InputRecord<ExpressionOrValue<string>, Record<string, string>> | undefined) {\n this.setProperty(\"tags\", value);\n this._localDeploymentContext = {\n ...this._localDeploymentContext,\n tags: deref(this.tags),\n };\n }\n\n add<T extends new (context: ProvisioningComponent, ...args: any[]) => ProvisioningComponent>(\n ctor: T,\n ...args: ConstructorParameters<T> extends [any, ...infer Rest] ? Rest : never\n ): InstanceType<T> {\n return new ctor(this.self, ...args) as InstanceType<T>;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,SAAoB;AAOpB,4BAAsB;AAMtB,sBAAyB;AACzB,4BAAsC;AACtC,mBAAsB;AACtB,mBAA2E;AAE3E,MAAM,2BAAgD;AAAA,EACpD,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA;AAAA,EAEX,SAAS,EAAE,OAAO,sBAAsB;AAAA,EACxC,OAAO;AACT;AAkCO,MAAM,sBAAsB,yBAA+C;AAAA,EAChF,OAAgB,eAAe;AAAA,EAC/B,OAAgB,aAAa;AAAA,EAE7B,OAAiB,cAAc;AAAA,EAE/B,OAAO;AACL,SAAK;AAAA,UACH,mCAAqB;AAAA,QACnB,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,WAAO,gCAAkB,EAAE;AAAA,QACtD,UAAU,EAAE,SAAS,CAAC,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A,EAC9B;AAAA,EACA,IAAI,UAAU,OAA8C;AAC1D,SAAK,YAAY,aAAa,KAAK;AAAA,EACrC;AAAA,EAEA,IAAI,OAAmF;AACrF,WAAO,KAAK,MAAM,SAAS,SACvB,SACC,KAAK,KAAK,MAAM;AAAA,EACvB;AAAA,EACA,IAAI,KAAK,OAAmF;AAC1F,SAAK,YAAY,QAAQ,KAAK;AAC9B,SAAK,0BAA0B;AAAA,MAC7B,GAAG,KAAK;AAAA,MACR,UAAM,6BAAM,KAAK,IAAI;AAAA,IACvB;AAAA,EACF;AAAA,EAEA,IACE,SACG,MACc;AACjB,WAAO,IAAI,KAAK,KAAK,MAAM,GAAG,IAAI;AAAA,EACpC;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { PrimitiveTypeMap, PrimitiveTypeName } from "../serialization/contract/index.js";
1
+ import type { PrimitiveTypeMap, PrimitiveTypeName } from "../serialization/ast/index.js";
2
2
  import type { ExpressionOrValue, InputOf } from "../expression/expressions.js";
3
3
  import type { Resource } from "./resource/resource.js";
4
4
  import type { Stack } from "./stack.js";
@@ -1 +1 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../../src/constructs/output.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,WAAW,EAAE,GACtB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GACvC,OAAO,CAAC,OAAO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,GAAG,CAAC,CAAC,SAAS,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EACjC,OAAO,CAAC,EAAE,aAAa,GACtB,cAAc;IAcjB,8DAA8D;IAC9D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C,+CAA+C;IAC/C,IAAI,IAAI,SAAS,cAAc,EAAE;IAIjC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,cAAc,CAAC;CAGtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,UAAU,EAC/C,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EACjC,OAAO,CAAC,EAAE,aAAa,GACtB,cAAc,CAEhB"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/constructs/output.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PrimitiveTypeMap, PrimitiveTypeName } from \"../serialization/contract/index.js\";\nimport type { ExpressionOrValue, InputOf } from \"../expression/expressions.js\";\nimport type { Resource } from \"./resource/resource.js\";\nimport { isResource } from \"./resource/resource-utils.js\";\nimport type { Stack } from \"./stack.js\";\nimport { assertBicepIdentifier, assertValueAssignableToType } from \"../util.js\";\n\n/**\n * A value accepted as a deployment output's value: any JSON literal (scalar,\n * `null`, array, object \u2014 recursively), an `Expression`, a resource view\n * (`InputOf<unknown>`), or a {@link Resource} handle. The literal members are\n * required so plain object/array literals are accepted (a bare\n * `InputOf<unknown>` is a weak type and would reject them).\n */\nexport type OutputValue =\n | string\n | number\n | boolean\n | null\n | readonly OutputValue[]\n | { readonly [key: string]: OutputValue }\n | InputOf<unknown>\n | Resource;\n\n/** Primitive Bicep type names supported by deployment outputs. */\nexport type OutputType = PrimitiveTypeName;\n\nexport type ScalarOutputType = \"string\" | \"int\" | \"bool\";\nexport type OutputValueFor<T extends OutputType> = T extends ScalarOutputType\n ? ExpressionOrValue<PrimitiveTypeMap[T]>\n : OutputValue;\n\nexport type OutputOptions = {\n readonly description?: string | undefined;\n readonly secure?: boolean | undefined;\n readonly minValue?: number | undefined;\n readonly maxValue?: number | undefined;\n readonly minLength?: number | undefined;\n readonly maxLength?: number | undefined;\n readonly metadata?: Record<string, unknown> | undefined;\n readonly discriminator?: string | undefined;\n readonly sealed?: boolean | undefined;\n};\n\n/**\n * Pure declaration data for a deployment output. Stored on the stack and read\n * by the serializer at emit time. An output is a terminal sink \u2014 it has no\n * expression handle.\n */\nexport interface OutputMetadata extends OutputOptions {\n readonly name: string;\n readonly type: OutputType;\n readonly value: OutputValue;\n}\n\n/**\n * Authoring-time collection of a stack's deployment outputs. Backed by an\n * ordered private array; supports add/get/delete/iteration. Outputs are\n * terminal sinks (no expression handle), so iteration yields metadata.\n */\nexport class OutputCollection {\n #entries: OutputMetadata[] = [];\n\n /** Add an output. Throws on duplicate name. Returns the stored metadata. */\n add<T extends OutputType>(\n name: string,\n type: T,\n value: OutputValueFor<NoInfer<T>>,\n options?: OutputOptions,\n ): OutputMetadata {\n assertBicepIdentifier(name, \"Deployment output\");\n if (this.has(name)) {\n throw new Error(`Duplicate deployment output name: ${name}`);\n }\n if ((type === \"string\" || type === \"int\" || type === \"bool\") && isResource(value)) {\n throw new Error(`Deployment output \"${name}\" expected type \"${type}\" but got resource.`);\n }\n assertValueAssignableToType(value, type, `Deployment output \"${name}\"`);\n const metadata: OutputMetadata = { name, type, value, ...options };\n this.#entries.push(metadata);\n return metadata;\n }\n\n /** The declaration metadata for an output, or `undefined`. */\n get(name: string): OutputMetadata | undefined {\n return this.#entries.find((e) => e.name === name);\n }\n\n /** All output metadata, in insertion order. */\n list(): readonly OutputMetadata[] {\n return this.#entries;\n }\n\n has(name: string): boolean {\n return this.get(name) !== undefined;\n }\n\n /** Remove an output by name. Returns whether one was removed. */\n delete(name: string): boolean {\n const i = this.#entries.findIndex((e) => e.name === name);\n if (i === -1) return false;\n this.#entries.splice(i, 1);\n return true;\n }\n\n get size(): number {\n return this.#entries.length;\n }\n\n [Symbol.iterator](): IterableIterator<OutputMetadata> {\n return this.#entries[Symbol.iterator]();\n }\n}\n\n/**\n * A deployment output, compiled to a Bicep `output` declaration.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\", { targetScope: \"resourceGroup\" });\n * const vault = new KeyVault(stack, {\n * name: \"kv-my-app\",\n * location: \"eastus\",\n * properties: {\n * tenantId: \"11111111-1111-1111-1111-111111111111\",\n * sku: { family: \"A\", name: \"standard\" },\n * },\n * });\n * stack.outputs.add(\"vaultUri\", \"string\", vault.properties.vaultUri);\n * ```\n */\nexport function createOutput<T extends OutputType>(\n stack: Stack,\n name: string,\n type: T,\n value: OutputValueFor<NoInfer<T>>,\n options?: OutputOptions,\n): OutputMetadata {\n return stack.outputs.add(name, type, value, options);\n}\n"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PrimitiveTypeMap, PrimitiveTypeName } from \"../serialization/ast/index.js\";\nimport type { ExpressionOrValue, InputOf } from \"../expression/expressions.js\";\nimport type { Resource } from \"./resource/resource.js\";\nimport { isResource } from \"./resource/resource-utils.js\";\nimport type { Stack } from \"./stack.js\";\nimport { assertBicepIdentifier, assertValueAssignableToType } from \"../util.js\";\n\n/**\n * A value accepted as a deployment output's value: any JSON literal (scalar,\n * `null`, array, object \u2014 recursively), an `Expression`, a resource view\n * (`InputOf<unknown>`), or a {@link Resource} handle. The literal members are\n * required so plain object/array literals are accepted (a bare\n * `InputOf<unknown>` is a weak type and would reject them).\n */\nexport type OutputValue =\n | string\n | number\n | boolean\n | null\n | readonly OutputValue[]\n | { readonly [key: string]: OutputValue }\n | InputOf<unknown>\n | Resource;\n\n/** Primitive Bicep type names supported by deployment outputs. */\nexport type OutputType = PrimitiveTypeName;\n\nexport type ScalarOutputType = \"string\" | \"int\" | \"bool\";\nexport type OutputValueFor<T extends OutputType> = T extends ScalarOutputType\n ? ExpressionOrValue<PrimitiveTypeMap[T]>\n : OutputValue;\n\nexport type OutputOptions = {\n readonly description?: string | undefined;\n readonly secure?: boolean | undefined;\n readonly minValue?: number | undefined;\n readonly maxValue?: number | undefined;\n readonly minLength?: number | undefined;\n readonly maxLength?: number | undefined;\n readonly metadata?: Record<string, unknown> | undefined;\n readonly discriminator?: string | undefined;\n readonly sealed?: boolean | undefined;\n};\n\n/**\n * Pure declaration data for a deployment output. Stored on the stack and read\n * by the serializer at emit time. An output is a terminal sink \u2014 it has no\n * expression handle.\n */\nexport interface OutputMetadata extends OutputOptions {\n readonly name: string;\n readonly type: OutputType;\n readonly value: OutputValue;\n}\n\n/**\n * Authoring-time collection of a stack's deployment outputs. Backed by an\n * ordered private array; supports add/get/delete/iteration. Outputs are\n * terminal sinks (no expression handle), so iteration yields metadata.\n */\nexport class OutputCollection {\n #entries: OutputMetadata[] = [];\n\n /** Add an output. Throws on duplicate name. Returns the stored metadata. */\n add<T extends OutputType>(\n name: string,\n type: T,\n value: OutputValueFor<NoInfer<T>>,\n options?: OutputOptions,\n ): OutputMetadata {\n assertBicepIdentifier(name, \"Deployment output\");\n if (this.has(name)) {\n throw new Error(`Duplicate deployment output name: ${name}`);\n }\n if ((type === \"string\" || type === \"int\" || type === \"bool\") && isResource(value)) {\n throw new Error(`Deployment output \"${name}\" expected type \"${type}\" but got resource.`);\n }\n assertValueAssignableToType(value, type, `Deployment output \"${name}\"`);\n const metadata: OutputMetadata = { name, type, value, ...options };\n this.#entries.push(metadata);\n return metadata;\n }\n\n /** The declaration metadata for an output, or `undefined`. */\n get(name: string): OutputMetadata | undefined {\n return this.#entries.find((e) => e.name === name);\n }\n\n /** All output metadata, in insertion order. */\n list(): readonly OutputMetadata[] {\n return this.#entries;\n }\n\n has(name: string): boolean {\n return this.get(name) !== undefined;\n }\n\n /** Remove an output by name. Returns whether one was removed. */\n delete(name: string): boolean {\n const i = this.#entries.findIndex((e) => e.name === name);\n if (i === -1) return false;\n this.#entries.splice(i, 1);\n return true;\n }\n\n get size(): number {\n return this.#entries.length;\n }\n\n [Symbol.iterator](): IterableIterator<OutputMetadata> {\n return this.#entries[Symbol.iterator]();\n }\n}\n\n/**\n * A deployment output, compiled to a Bicep `output` declaration.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\", { targetScope: \"resourceGroup\" });\n * const vault = new KeyVault(stack, {\n * name: \"kv-my-app\",\n * location: \"eastus\",\n * properties: {\n * tenantId: \"11111111-1111-1111-1111-111111111111\",\n * sku: { family: \"A\", name: \"standard\" },\n * },\n * });\n * stack.outputs.add(\"vaultUri\", \"string\", vault.properties.vaultUri);\n * ```\n */\nexport function createOutput<T extends OutputType>(\n stack: Stack,\n name: string,\n type: T,\n value: OutputValueFor<NoInfer<T>>,\n options?: OutputOptions,\n): OutputMetadata {\n return stack.outputs.add(name, type, value, options);\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,4BAA2B;AAE3B,kBAAmE;AAuD5D,MAAM,iBAAiB;AAAA,EAC5B,WAA6B,CAAC;AAAA;AAAA,EAG9B,IACE,MACA,MACA,OACA,SACgB;AAChB,2CAAsB,MAAM,mBAAmB;AAC/C,QAAI,KAAK,IAAI,IAAI,GAAG;AAClB,YAAM,IAAI,MAAM,qCAAqC,IAAI,EAAE;AAAA,IAC7D;AACA,SAAK,SAAS,YAAY,SAAS,SAAS,SAAS,eAAW,kCAAW,KAAK,GAAG;AACjF,YAAM,IAAI,MAAM,sBAAsB,IAAI,oBAAoB,IAAI,qBAAqB;AAAA,IACzF;AACA,iDAA4B,OAAO,MAAM,sBAAsB,IAAI,GAAG;AACtE,UAAM,WAA2B,EAAE,MAAM,MAAM,OAAO,GAAG,QAAQ;AACjE,SAAK,SAAS,KAAK,QAAQ;AAC3B,WAAO;AAAA,EACT;AAAA;AAAA,EAGA,IAAI,MAA0C;AAC5C,WAAO,KAAK,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAAA,EAClD;AAAA;AAAA,EAGA,OAAkC;AAChC,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,MAAuB;AACzB,WAAO,KAAK,IAAI,IAAI,MAAM;AAAA,EAC5B;AAAA;AAAA,EAGA,OAAO,MAAuB;AAC5B,UAAM,IAAI,KAAK,SAAS,UAAU,CAAC,MAAM,EAAE,SAAS,IAAI;AACxD,QAAI,MAAM,GAAI,QAAO;AACrB,SAAK,SAAS,OAAO,GAAG,CAAC;AACzB,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,OAAe;AACjB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,CAAC,OAAO,QAAQ,IAAsC;AACpD,WAAO,KAAK,SAAS,OAAO,QAAQ,EAAE;AAAA,EACxC;AACF;AAsBO,SAAS,aACd,OACA,MACA,MACA,OACA,SACgB;AAChB,SAAO,MAAM,QAAQ,IAAI,MAAM,MAAM,OAAO,OAAO;AACrD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { PrimitiveTypeMap } from "../serialization/contract/index.js";
1
+ import type { PrimitiveTypeMap } from "../serialization/ast/index.js";
2
2
  import type { Expression, ExpressionOrValue } from "../expression/expressions.js";
3
3
  import type { Stack } from "./stack.js";
4
4
  export type InferParamType<T extends keyof PrimitiveTypeMap, A> = A extends readonly (infer E)[] ? E : PrimitiveTypeMap[T];
@@ -1 +1 @@
1
- {"version":3,"file":"parameter.d.ts","sourceRoot":"","sources":["../../../src/constructs/parameter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAIlF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,CAAC,IAAI,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAC5F,CAAC,GACD,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,IAClF,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzC,MAAM,MAAM,gBAAgB,CAC1B,CAAC,SAAS,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,EACzD,CAAC,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,SAAS,IAC9D;IACF,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAA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AQ,CAAC,IAAI,gBAAgB,CAAC,SAAS,CAAC;CAOjD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC7B,CAAC,SAAS,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,EACzD,KAAK,CAAC,CAAC,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,GAAG,SAAS,EACtE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAExF"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/constructs/parameter.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PrimitiveTypeMap } from \"../serialization/contract/index.js\";\nimport type { Expression, ExpressionOrValue } from \"../expression/expressions.js\";\nimport { wrapExpression } from \"../expression/expressions.js\";\nimport { isExpression } from \"../expression/expressions.js\";\nimport { symbolicValueExpressionNode } from \"../expression/ast-nodes.js\";\nimport type { Stack } from \"./stack.js\";\nimport { assertBicepIdentifier, assertValueAssignableToType } from \"../util.js\";\n\nexport type InferParamType<T extends keyof PrimitiveTypeMap, A> = A extends readonly (infer E)[]\n ? E\n : PrimitiveTypeMap[T];\n\n/**\n * A value accepted as a parameter's `defaultValue`: a literal of the declared\n * type or an `Expression` of it. Resource views are intentionally excluded \u2014\n * a Bicep `param` default cannot reference resources.\n */\nexport type ParameterValue<T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap> =\n ExpressionOrValue<PrimitiveTypeMap[T]>;\n\nexport type ParameterOptions<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n> = {\n readonly defaultValue?: ExpressionOrValue<InferParamType<T, A>> | undefined;\n readonly description?: string | undefined;\n readonly secure?: boolean | undefined;\n readonly minValue?: number | undefined;\n readonly maxValue?: number | undefined;\n readonly minLength?: number | undefined;\n readonly maxLength?: number | undefined;\n readonly metadata?: Record<string, unknown> | undefined;\n readonly allowed?: A;\n readonly discriminator?: string | undefined;\n readonly sealed?: boolean | undefined;\n};\n\n/**\n * Pure declaration data for a deployment parameter. Stored on the stack\n * (paired with the returned expression handle in {@link ParameterEntry});\n * read by the serializer at emit time. Not part of the value-level handle.\n */\nexport interface ParameterMetadata extends ParameterOptions<\n keyof PrimitiveTypeMap,\n readonly PrimitiveTypeMap[keyof PrimitiveTypeMap][] | undefined\n> {\n readonly name: string;\n readonly type: keyof PrimitiveTypeMap;\n}\n\n/**\n * A stack entry pairing a parameter's declaration metadata with the\n * expression handle returned to the user. Internal; metadata is exposed via\n * {@link ParameterCollection.getMetadata} / {@link ParameterCollection.listMetadata}.\n */\ninterface ParameterEntry {\n readonly metadata: ParameterMetadata;\n readonly parameter: Expression<unknown>;\n}\n\nexport type Parameter<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n> = Expression<InferParamType<T, A>>;\n\n/**\n * Authoring-time collection of a stack's deployment parameters. Backed by an\n * ordered private array; supports add/get/delete/iteration. Look parameters up\n * by name via {@link ParameterCollection.get}.\n */\nexport class ParameterCollection {\n #entries: ParameterEntry[] = [];\n\n /** Add a parameter; returns its expression handle. Throws on duplicate name. */\n add<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n const A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n >(name: string, type: T, options?: ParameterOptions<T, A>): Parameter<T, A> {\n assertBicepIdentifier(name, \"Deployment parameter\");\n if (this.has(name)) {\n throw new Error(`Duplicate deployment parameter name: ${name}`);\n }\n assertValueAssignableToType(options?.defaultValue, type, `Deployment parameter \"${name}\"`);\n if (\n options?.defaultValue !== undefined &&\n !isExpression(options.defaultValue) &&\n options.allowed !== undefined &&\n !options.allowed.includes(options.defaultValue as PrimitiveTypeMap[T])\n ) {\n throw new Error(\n `Deployment parameter \"${name}\" default value must be one of its allowed values.`,\n );\n }\n const param = wrapExpression<InferParamType<T, A>>(\n symbolicValueExpressionNode<InferParamType<T, A>, string>(name),\n );\n this.#entries.push({\n metadata: { name, type, ...options },\n parameter: param,\n });\n return param;\n }\n\n /** The expression handle for a parameter, or `undefined`. */\n get(name: string): Parameter | undefined {\n return this.#find(name)?.parameter;\n }\n\n /** The declaration metadata for a parameter, or `undefined`. */\n getMetadata(name: string): ParameterMetadata | undefined {\n return this.#find(name)?.metadata;\n }\n\n /** All parameter handles, in insertion order. */\n list(): readonly Parameter[] {\n return this.#entries.map((e) => e.parameter);\n }\n\n /** All declaration metadata, in insertion order. */\n listMetadata(): readonly ParameterMetadata[] {\n return this.#entries.map((e) => e.metadata);\n }\n\n has(name: string): boolean {\n return this.#find(name) !== undefined;\n }\n\n /** Remove a parameter by name. Returns whether one was removed. */\n delete(name: string): boolean {\n const i = this.#entries.findIndex((e) => e.metadata.name === name);\n if (i === -1) return false;\n this.#entries.splice(i, 1);\n return true;\n }\n\n get size(): number {\n return this.#entries.length;\n }\n\n [Symbol.iterator](): IterableIterator<Parameter> {\n return this.#entries.map((e) => e.parameter)[Symbol.iterator]();\n }\n\n #find(name: string): ParameterEntry | undefined {\n return this.#entries.find((e) => e.metadata.name === name);\n }\n}\n\n/**\n * A deploy-time input to a stack, compiled to a Bicep `param` declaration.\n *\n * @remarks\n * The returned value is an `Expression` that can be passed to resource\n * properties. At deploy time, the user supplies the actual value. The\n * declaration metadata is stored separately on the stack, keyed by name.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, createParameter } from \"@azure/provisioning-core\";\n *\n * const stack = new Stack(\"my-app\", { targetScope: \"resourceGroup\" });\n * const env = createParameter(stack, \"env\", \"string\", {\n * allowed: [\"dev\", \"staging\", \"prod\"] as const,\n * defaultValue: \"dev\",\n * });\n * ```\n */\nexport function createParameter<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n const A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n>(stack: Stack, name: string, type: T, options?: ParameterOptions<T, A>): Parameter<T, A> {\n return stack.parameters.add(name, type, options);\n}\n"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PrimitiveTypeMap } from \"../serialization/ast/index.js\";\nimport type { Expression, ExpressionOrValue } from \"../expression/expressions.js\";\nimport { wrapExpression } from \"../expression/expressions.js\";\nimport { isExpression } from \"../expression/expressions.js\";\nimport { symbolicValueExpressionNode } from \"../expression/ast-nodes.js\";\nimport type { Stack } from \"./stack.js\";\nimport { assertBicepIdentifier, assertValueAssignableToType } from \"../util.js\";\n\nexport type InferParamType<T extends keyof PrimitiveTypeMap, A> = A extends readonly (infer E)[]\n ? E\n : PrimitiveTypeMap[T];\n\n/**\n * A value accepted as a parameter's `defaultValue`: a literal of the declared\n * type or an `Expression` of it. Resource views are intentionally excluded \u2014\n * a Bicep `param` default cannot reference resources.\n */\nexport type ParameterValue<T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap> =\n ExpressionOrValue<PrimitiveTypeMap[T]>;\n\nexport type ParameterOptions<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n> = {\n readonly defaultValue?: ExpressionOrValue<InferParamType<T, A>> | undefined;\n readonly description?: string | undefined;\n readonly secure?: boolean | undefined;\n readonly minValue?: number | undefined;\n readonly maxValue?: number | undefined;\n readonly minLength?: number | undefined;\n readonly maxLength?: number | undefined;\n readonly metadata?: Record<string, unknown> | undefined;\n readonly allowed?: A;\n readonly discriminator?: string | undefined;\n readonly sealed?: boolean | undefined;\n};\n\n/**\n * Pure declaration data for a deployment parameter. Stored on the stack\n * (paired with the returned expression handle in {@link ParameterEntry});\n * read by the serializer at emit time. Not part of the value-level handle.\n */\nexport interface ParameterMetadata extends ParameterOptions<\n keyof PrimitiveTypeMap,\n readonly PrimitiveTypeMap[keyof PrimitiveTypeMap][] | undefined\n> {\n readonly name: string;\n readonly type: keyof PrimitiveTypeMap;\n}\n\n/**\n * A stack entry pairing a parameter's declaration metadata with the\n * expression handle returned to the user. Internal; metadata is exposed via\n * {@link ParameterCollection.getMetadata} / {@link ParameterCollection.listMetadata}.\n */\ninterface ParameterEntry {\n readonly metadata: ParameterMetadata;\n readonly parameter: Expression<unknown>;\n}\n\nexport type Parameter<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n> = Expression<InferParamType<T, A>>;\n\n/**\n * Authoring-time collection of a stack's deployment parameters. Backed by an\n * ordered private array; supports add/get/delete/iteration. Look parameters up\n * by name via {@link ParameterCollection.get}.\n */\nexport class ParameterCollection {\n #entries: ParameterEntry[] = [];\n\n /** Add a parameter; returns its expression handle. Throws on duplicate name. */\n add<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n const A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n >(name: string, type: T, options?: ParameterOptions<T, A>): Parameter<T, A> {\n assertBicepIdentifier(name, \"Deployment parameter\");\n if (this.has(name)) {\n throw new Error(`Duplicate deployment parameter name: ${name}`);\n }\n assertValueAssignableToType(options?.defaultValue, type, `Deployment parameter \"${name}\"`);\n if (\n options?.defaultValue !== undefined &&\n !isExpression(options.defaultValue) &&\n options.allowed !== undefined &&\n !options.allowed.includes(options.defaultValue as PrimitiveTypeMap[T])\n ) {\n throw new Error(\n `Deployment parameter \"${name}\" default value must be one of its allowed values.`,\n );\n }\n const param = wrapExpression<InferParamType<T, A>>(\n symbolicValueExpressionNode<InferParamType<T, A>, string>(name),\n );\n this.#entries.push({\n metadata: { name, type, ...options },\n parameter: param,\n });\n return param;\n }\n\n /** The expression handle for a parameter, or `undefined`. */\n get(name: string): Parameter | undefined {\n return this.#find(name)?.parameter;\n }\n\n /** The declaration metadata for a parameter, or `undefined`. */\n getMetadata(name: string): ParameterMetadata | undefined {\n return this.#find(name)?.metadata;\n }\n\n /** All parameter handles, in insertion order. */\n list(): readonly Parameter[] {\n return this.#entries.map((e) => e.parameter);\n }\n\n /** All declaration metadata, in insertion order. */\n listMetadata(): readonly ParameterMetadata[] {\n return this.#entries.map((e) => e.metadata);\n }\n\n has(name: string): boolean {\n return this.#find(name) !== undefined;\n }\n\n /** Remove a parameter by name. Returns whether one was removed. */\n delete(name: string): boolean {\n const i = this.#entries.findIndex((e) => e.metadata.name === name);\n if (i === -1) return false;\n this.#entries.splice(i, 1);\n return true;\n }\n\n get size(): number {\n return this.#entries.length;\n }\n\n [Symbol.iterator](): IterableIterator<Parameter> {\n return this.#entries.map((e) => e.parameter)[Symbol.iterator]();\n }\n\n #find(name: string): ParameterEntry | undefined {\n return this.#entries.find((e) => e.metadata.name === name);\n }\n}\n\n/**\n * A deploy-time input to a stack, compiled to a Bicep `param` declaration.\n *\n * @remarks\n * The returned value is an `Expression` that can be passed to resource\n * properties. At deploy time, the user supplies the actual value. The\n * declaration metadata is stored separately on the stack, keyed by name.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, createParameter } from \"@azure/provisioning-core\";\n *\n * const stack = new Stack(\"my-app\", { targetScope: \"resourceGroup\" });\n * const env = createParameter(stack, \"env\", \"string\", {\n * allowed: [\"dev\", \"staging\", \"prod\"] as const,\n * defaultValue: \"dev\",\n * });\n * ```\n */\nexport function createParameter<\n T extends keyof PrimitiveTypeMap = keyof PrimitiveTypeMap,\n const A extends readonly PrimitiveTypeMap[T][] | undefined = undefined,\n>(stack: Stack, name: string, type: T, options?: ParameterOptions<T, A>): Parameter<T, A> {\n return stack.parameters.add(name, type, options);\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,yBAA+B;AAC/B,IAAAA,sBAA6B;AAC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QAAO;AACrB,SAAK,SAAS,OAAO,GAAG,CAAC;AACzB,WAAO;AAAA,EACT;AAAA,EAEA,IAAI,OAAe;AACjB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,CAAC,OAAO,QAAQ,IAAiC;AAC/C,WAAO,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,QAAQ,EAAE;AAAA,EAChE;AAAA,EAEA,MAAM,MAA0C;AAC9C,WAAO,KAAK,SAAS,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS,IAAI;AAAA,EAC3D;AACF;AAqBO,SAAS,gBAGd,OAAc,MAAc,MAAS,SAAmD;AACxF,SAAO,MAAM,WAAW,IAAI,MAAM,MAAM,OAAO;AACjD;",
6
6
  "names": ["import_expressions"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { ProvisioningComponent } from "../provisioning-component.js";
2
- import type { LoopedResource, Resource } from "./resource.js";
2
+ import type { LoopedResource, Resource, ResourceDeclaration } from "./resource.js";
3
3
  import type { ResourceCtor } from "./resource-registry.js";
4
4
  /** Options accepted by the `Stack` resource queries. */
5
5
  export interface QueryOptions {
@@ -9,6 +9,8 @@ export interface QueryOptions {
9
9
  */
10
10
  readonly recursive?: boolean;
11
11
  }
12
+ /** All scalar and looped declarations in tree order, including a resource root. */
13
+ export declare function collectResourceDeclarations(root: ProvisioningComponent): ResourceDeclaration[];
12
14
  /** Scalar (un-looped) resource declarations. */
13
15
  export declare function getResources(root: ProvisioningComponent, typeOrOptions?: ResourceCtor<Resource> | QueryOptions, maybeOptions?: QueryOptions): Resource[];
14
16
  /** Loop-expanded resource declarations (`Ctor.fromLoop(...)`). */
@@ -1 +1 @@
1
- {"version":3,"file":"resource-query.d.ts","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE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2B,CAAC,IAAI,EAAE,qBAAqB,GAAG,mBAAmB,EAAE,CAQ9F;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,qBAAqB,EAC3B,aAAa,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,EACrD,YAAY,CAAC,EAAE,YAAY,GAC1B,QAAQ,EAAE,CAOZ;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,qBAAqB,EAC3B,aAAa,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,YAAY,EACrD,YAAY,CAAC,EAAE,YAAY,GAC1B,cAAc,CAAC,QAAQ,CAAC,EAAE,CAO5B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAC5C,IAAI,EAAE,qBAAqB,EAC3B,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,YAAY,GACrB,CAAC,GAAG,SAAS,CAKf"}
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var resource_query_exports = {};
19
19
  __export(resource_query_exports, {
20
+ collectResourceDeclarations: () => collectResourceDeclarations,
20
21
  getLoopedResources: () => getLoopedResources,
21
22
  getResource: () => getResource,
22
23
  getResources: () => getResources
@@ -37,6 +38,15 @@ function collectResourcesUnder(root, wantLooped, recursive) {
37
38
  }
38
39
  return result;
39
40
  }
41
+ function collectResourceDeclarations(root) {
42
+ const result = [];
43
+ root.visit((node) => {
44
+ if ((0, import_resource_utils.isResourceDeclaration)(node)) {
45
+ result.push(node.self);
46
+ }
47
+ });
48
+ return result;
49
+ }
40
50
  function getResources(root, typeOrOptions, maybeOptions) {
41
51
  const isCtor = typeof typeOrOptions === "function";
42
52
  const type = isCtor ? typeOrOptions : void 0;
@@ -61,6 +71,7 @@ function getResource(root, type, name, options) {
61
71
  }
62
72
  // Annotate the CommonJS export names for ESM import in node:
63
73
  0 && (module.exports = {
74
+ collectResourceDeclarations,
64
75
  getLoopedResources,
65
76
  getResource,
66
77
  getResources
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/constructs/resource/resource-query.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isResourceDeclaration, isLoopedResource, isLoopedResourceOf } from \"./resource-utils.js\";\nimport { deref } from \"./resource-proxy.js\";\nimport type { ProvisioningComponent } from \"../provisioning-component.js\";\nimport type { LoopedResource, Resource } from \"./resource.js\";\nimport type { ResourceCtor } from \"./resource-registry.js\";\n\n// ---------------------------------------------------------------------------\n// Query result types\n// ---------------------------------------------------------------------------\n\n/** Options accepted by the `Stack` resource queries. */\nexport interface QueryOptions {\n /**\n * Whether to walk the stack's entire subtree (default `true`) or only its\n * **direct children** (`false`).\n */\n readonly recursive?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Query engine (module-private)\n// ---------------------------------------------------------------------------\n// Imports only brand guards (`resource-utils`) \u2014 which do not import\n// `ProvisioningComponent`/`Stack` at runtime \u2014 plus types (type-only), so there is no\n// import cycle.\n\n/**\n * Collect the resource declarations beneath `root` (the root itself is never\n * included). `recursive` descends the whole subtree via `visit`; otherwise\n * only `root`'s direct children are considered. `wantLooped` selects the\n * looped declarations (`Ctor.fromLoop(...)`) vs. the scalar ones.\n */\nfunction collectResourcesUnder(\n root: ProvisioningComponent,\n wantLooped: boolean,\n recursive: boolean,\n): (Resource | LoopedResource<Resource>)[] {\n const result: (Resource | LoopedResource<Resource>)[] = [];\n const consider = (node: ProvisioningComponent): void => {\n if (!isResourceDeclaration(node)) return;\n const r = node.self as Resource | LoopedResource<Resource>;\n if (isLoopedResource(r) === wantLooped) result.push(r);\n };\n for (const child of root.children) {\n if (recursive) child.visit(consider);\n else consider(child);\n }\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Engine entry points \u2014 thin, loosely-typed; `Stack` supplies the public\n// typed overloads and delegates here.\n// ---------------------------------------------------------------------------\n\n/** Scalar (un-looped) resource declarations. */\nexport function getResources(\n root: ProvisioningComponent,\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n): Resource[] {\n const isCtor = typeof typeOrOptions === \"function\";\n const type = isCtor ? (typeOrOptions as ResourceCtor<Resource>) : undefined;\n const options = (isCtor ? maybeOptions : typeOrOptions) as QueryOptions | undefined;\n const recursive = options?.recursive ?? true;\n const found = collectResourcesUnder(root, false, recursive) as Resource[];\n return type === undefined ? found : found.filter((r) => r instanceof type);\n}\n\n/** Loop-expanded resource declarations (`Ctor.fromLoop(...)`). */\nexport function getLoopedResources(\n root: ProvisioningComponent,\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n): LoopedResource<Resource>[] {\n const isCtor = typeof typeOrOptions === \"function\";\n const type = isCtor ? (typeOrOptions as ResourceCtor<Resource>) : undefined;\n const options = (isCtor ? maybeOptions : typeOrOptions) as QueryOptions | undefined;\n const recursive = options?.recursive ?? true;\n const found = collectResourcesUnder(root, true, recursive) as LoopedResource<Resource>[];\n return type === undefined ? found : found.filter((r) => isLoopedResourceOf(r, type));\n}\n\n/**\n * First scalar resource of `type` whose literal name equals `name`, or\n * `undefined`. `deref` resolves the name's expression proxy to its literal\n * (a `Resource`'s `name` is an `Expression`, so `r.name === name` is always\n * false without it).\n */\nexport function getResource<T extends Resource>(\n root: ProvisioningComponent,\n type: ResourceCtor<T>,\n name: string,\n options?: QueryOptions,\n): T | undefined {\n for (const r of getResources(root, type, options)) {\n if (deref((r as Resource).name) === name) return r as T;\n }\n return undefined;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA4E;AAC5E,4BAAsB;AA+BtB,SAAS,sBACP,MACA,YACA,WACyC;AACzC,QAAM,SAAkD,CAAC;AACzD,QAAM,WAAW,CAAC,SAAsC;AACtD,QAAI,KAAC,6CAAsB,IAAI,EAAG;AAClC,UAAM,IAAI,KAAK;AACf,YAAI,wCAAiB,CAAC,MAAM,WAAY,QAAO,KAAK,CAAC;AAAA,EACvD;AACA,aAAW,SAAS,KAAK,UAAU;AACjC,QAAI,UAAW,OAAM,MAAM,QAAQ;AAAA,QAC9B,UAAS,KAAK;AAAA,EACrB;AACA,SAAO;AACT;AAQO,SAAS,aACd,MACA,eACA,cACY;AACZ,QAAM,SAAS,OAAO,kBAAkB;AACxC,QAAM,OAAO,SAAU,gBAA2C;AAClE,QAAM,UAAW,SAAS,eAAe;AACzC,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,QAAQ,sBAAsB,MAAM,OAAO,SAAS;AAC1D,SAAO,SAAS,SAAY,QAAQ,MAAM,OAAO,CAAC,MAAM,aAAa,IAAI;AAC3E;AAGO,SAAS,mBACd,MACA,eACA,cAC4B;AAC5B,QAAM,SAAS,OAAO,kBAAkB;AACxC,QAAM,OAAO,SAAU,gBAA2C;AAClE,QAAM,UAAW,SAAS,eAAe;AACzC,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,QAAQ,sBAAsB,MAAM,MAAM,SAAS;AACzD,SAAO,SAAS,SAAY,QAAQ,MAAM,OAAO,CAAC,UAAM,0CAAmB,GAAG,IAAI,CAAC;AACrF;AAQO,SAAS,YACd,MACA,MACA,MACA,SACe;AACf,aAAW,KAAK,aAAa,MAAM,MAAM,OAAO,GAAG;AACjD,YAAI,6BAAO,EAAe,IAAI,MAAM,KAAM,QAAO;AAAA,EACnD;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isResourceDeclaration, isLoopedResource, isLoopedResourceOf } from \"./resource-utils.js\";\nimport { deref } from \"./resource-proxy.js\";\nimport type { ProvisioningComponent } from \"../provisioning-component.js\";\nimport type { LoopedResource, Resource, ResourceDeclaration } from \"./resource.js\";\nimport type { ResourceCtor } from \"./resource-registry.js\";\n\n// ---------------------------------------------------------------------------\n// Query result types\n// ---------------------------------------------------------------------------\n\n/** Options accepted by the `Stack` resource queries. */\nexport interface QueryOptions {\n /**\n * Whether to walk the stack's entire subtree (default `true`) or only its\n * **direct children** (`false`).\n */\n readonly recursive?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Query engine (module-private)\n// ---------------------------------------------------------------------------\n// Imports only brand guards (`resource-utils`) \u2014 which do not import\n// `ProvisioningComponent`/`Stack` at runtime \u2014 plus types (type-only), so there is no\n// import cycle.\n\n/**\n * Collect the resource declarations beneath `root` (the root itself is never\n * included). `recursive` descends the whole subtree via `visit`; otherwise\n * only `root`'s direct children are considered. `wantLooped` selects the\n * looped declarations (`Ctor.fromLoop(...)`) vs. the scalar ones.\n */\nfunction collectResourcesUnder(\n root: ProvisioningComponent,\n wantLooped: boolean,\n recursive: boolean,\n): (Resource | LoopedResource<Resource>)[] {\n const result: (Resource | LoopedResource<Resource>)[] = [];\n const consider = (node: ProvisioningComponent): void => {\n if (!isResourceDeclaration(node)) return;\n const r = node.self as Resource | LoopedResource<Resource>;\n if (isLoopedResource(r) === wantLooped) result.push(r);\n };\n for (const child of root.children) {\n if (recursive) child.visit(consider);\n else consider(child);\n }\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Engine entry points \u2014 thin, loosely-typed; `Stack` supplies the public\n// typed overloads and delegates here.\n// ---------------------------------------------------------------------------\n\n/** All scalar and looped declarations in tree order, including a resource root. */\nexport function collectResourceDeclarations(root: ProvisioningComponent): ResourceDeclaration[] {\n const result: ResourceDeclaration[] = [];\n root.visit((node) => {\n if (isResourceDeclaration(node)) {\n result.push(node.self);\n }\n });\n return result;\n}\n\n/** Scalar (un-looped) resource declarations. */\nexport function getResources(\n root: ProvisioningComponent,\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n): Resource[] {\n const isCtor = typeof typeOrOptions === \"function\";\n const type = isCtor ? (typeOrOptions as ResourceCtor<Resource>) : undefined;\n const options = (isCtor ? maybeOptions : typeOrOptions) as QueryOptions | undefined;\n const recursive = options?.recursive ?? true;\n const found = collectResourcesUnder(root, false, recursive) as Resource[];\n return type === undefined ? found : found.filter((r) => r instanceof type);\n}\n\n/** Loop-expanded resource declarations (`Ctor.fromLoop(...)`). */\nexport function getLoopedResources(\n root: ProvisioningComponent,\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n): LoopedResource<Resource>[] {\n const isCtor = typeof typeOrOptions === \"function\";\n const type = isCtor ? (typeOrOptions as ResourceCtor<Resource>) : undefined;\n const options = (isCtor ? maybeOptions : typeOrOptions) as QueryOptions | undefined;\n const recursive = options?.recursive ?? true;\n const found = collectResourcesUnder(root, true, recursive) as LoopedResource<Resource>[];\n return type === undefined ? found : found.filter((r) => isLoopedResourceOf(r, type));\n}\n\n/**\n * First scalar resource of `type` whose literal name equals `name`, or\n * `undefined`. `deref` resolves the name's expression proxy to its literal\n * (a `Resource`'s `name` is an `Expression`, so `r.name === name` is always\n * false without it).\n */\nexport function getResource<T extends Resource>(\n root: ProvisioningComponent,\n type: ResourceCtor<T>,\n name: string,\n options?: QueryOptions,\n): T | undefined {\n for (const r of getResources(root, type, options)) {\n if (deref((r as Resource).name) === name) return r as T;\n }\n return undefined;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA4E;AAC5E,4BAAsB;AA+BtB,SAAS,sBACP,MACA,YACA,WACyC;AACzC,QAAM,SAAkD,CAAC;AACzD,QAAM,WAAW,CAAC,SAAsC;AACtD,QAAI,KAAC,6CAAsB,IAAI,EAAG;AAClC,UAAM,IAAI,KAAK;AACf,YAAI,wCAAiB,CAAC,MAAM,WAAY,QAAO,KAAK,CAAC;AAAA,EACvD;AACA,aAAW,SAAS,KAAK,UAAU;AACjC,QAAI,UAAW,OAAM,MAAM,QAAQ;AAAA,QAC9B,UAAS,KAAK;AAAA,EACrB;AACA,SAAO;AACT;AAQO,SAAS,4BAA4B,MAAoD;AAC9F,QAAM,SAAgC,CAAC;AACvC,OAAK,MAAM,CAAC,SAAS;AACnB,YAAI,6CAAsB,IAAI,GAAG;AAC/B,aAAO,KAAK,KAAK,IAAI;AAAA,IACvB;AAAA,EACF,CAAC;AACD,SAAO;AACT;AAGO,SAAS,aACd,MACA,eACA,cACY;AACZ,QAAM,SAAS,OAAO,kBAAkB;AACxC,QAAM,OAAO,SAAU,gBAA2C;AAClE,QAAM,UAAW,SAAS,eAAe;AACzC,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,QAAQ,sBAAsB,MAAM,OAAO,SAAS;AAC1D,SAAO,SAAS,SAAY,QAAQ,MAAM,OAAO,CAAC,MAAM,aAAa,IAAI;AAC3E;AAGO,SAAS,mBACd,MACA,eACA,cAC4B;AAC5B,QAAM,SAAS,OAAO,kBAAkB;AACxC,QAAM,OAAO,SAAU,gBAA2C;AAClE,QAAM,UAAW,SAAS,eAAe;AACzC,QAAM,YAAY,SAAS,aAAa;AACxC,QAAM,QAAQ,sBAAsB,MAAM,MAAM,SAAS;AACzD,SAAO,SAAS,SAAY,QAAQ,MAAM,OAAO,CAAC,UAAM,0CAAmB,GAAG,IAAI,CAAC;AACrF;AAQO,SAAS,YACd,MACA,MACA,MACA,SACe;AACf,aAAW,KAAK,aAAa,MAAM,MAAM,OAAO,GAAG;AACjD,YAAI,6BAAO,EAAe,IAAI,MAAM,KAAM,QAAO;AAAA,EACnD;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,9 @@
1
+ import type { ResourceDeclaration } from "./resource.js";
2
+ import { type ExpressionNode } from "../../expression/ast-nodes.js";
3
+ /** Finds the nearest resource parent, excluding resource-group containment. */
4
+ export declare function getArmParent(resource: ResourceDeclaration): ResourceDeclaration | undefined;
5
+ /** Finds the resource group containing the authored resource. */
6
+ export declare function getResourceGroupAncestor(resource: ResourceDeclaration): ResourceDeclaration | undefined;
7
+ /** Reads an explicit scope expression without creating a resource-property reference. */
8
+ export declare function getResourceScope(resource: ResourceDeclaration): ExpressionNode | undefined;
9
+ //# sourceMappingURL=resource-relationships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-relationships.d.ts","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-relationships.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEtF,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS,CAO3F;AAED,iEAAiE;AACjE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,mBAAmB,GAC5B,mBAAmB,GAAG,SAAS,CAOjC;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,cAAc,GAAG,SAAS,CAO1F"}