@azure/provisioning-core 0.1.0-alpha.20261026.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 (795) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +3 -3
  3. package/README.md +61 -90
  4. package/dist/browser/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  5. package/dist/{constructs → browser/constructs}/built-in-resources/resource-group.js +1 -2
  6. package/dist/browser/constructs/built-in-resources/resource-group.js.map +1 -0
  7. package/dist/browser/constructs/output.d.ts.map +1 -0
  8. package/dist/{constructs → browser/constructs}/output.js +1 -2
  9. package/dist/browser/constructs/output.js.map +1 -0
  10. package/dist/{constructs → browser/constructs}/parameter.d.ts.map +1 -1
  11. package/dist/browser/constructs/parameter.js.map +1 -0
  12. package/dist/browser/constructs/provisioning-component.d.ts.map +1 -0
  13. package/dist/browser/constructs/provisioning-component.js.map +1 -0
  14. package/dist/browser/constructs/resource/resource-proxy.d.ts.map +1 -0
  15. package/dist/{constructs → browser/constructs}/resource/resource-proxy.js +7 -13
  16. package/dist/browser/constructs/resource/resource-proxy.js.map +1 -0
  17. package/dist/browser/constructs/resource/resource-query.d.ts.map +1 -0
  18. package/dist/{constructs → browser/constructs}/resource/resource-query.js +2 -4
  19. package/dist/browser/constructs/resource/resource-query.js.map +1 -0
  20. package/dist/browser/constructs/resource/resource-registry.d.ts.map +1 -0
  21. package/dist/{constructs → browser/constructs}/resource/resource-registry.js +1 -1
  22. package/dist/browser/constructs/resource/resource-registry.js.map +1 -0
  23. package/dist/browser/constructs/resource/resource-relationships.d.ts.map +1 -0
  24. package/dist/{constructs → browser/constructs}/resource/resource-relationships.js +3 -6
  25. package/dist/browser/constructs/resource/resource-relationships.js.map +1 -0
  26. package/dist/browser/constructs/resource/resource-type-registry.d.ts.map +1 -0
  27. package/dist/browser/constructs/resource/resource-type-registry.js.map +1 -0
  28. package/dist/browser/constructs/resource/resource-utils.d.ts.map +1 -0
  29. package/dist/{constructs → browser/constructs}/resource/resource-utils.js +1 -3
  30. package/dist/browser/constructs/resource/resource-utils.js.map +1 -0
  31. package/dist/browser/constructs/resource/resource.d.ts.map +1 -0
  32. package/dist/{constructs → browser/constructs}/resource/resource.js +8 -12
  33. package/dist/browser/constructs/resource/resource.js.map +1 -0
  34. package/dist/browser/constructs/stack.d.ts.map +1 -0
  35. package/dist/browser/constructs/stack.js.map +1 -0
  36. package/dist/browser/constructs/variable.d.ts.map +1 -0
  37. package/dist/browser/constructs/variable.js.map +1 -0
  38. package/dist/browser/deployment-context/deployment-context.d.ts.map +1 -0
  39. package/dist/browser/deployment-context/deployment-context.js.map +1 -0
  40. package/dist/browser/expression/ast-nodes.d.ts.map +1 -0
  41. package/dist/{expression → browser/expression}/ast-nodes.js +2 -4
  42. package/dist/browser/expression/ast-nodes.js.map +1 -0
  43. package/dist/browser/expression/expressions.d.ts.map +1 -0
  44. package/dist/{expression → browser/expression}/expressions.js +1 -1
  45. package/dist/browser/expression/expressions.js.map +1 -0
  46. package/dist/browser/expression/utils.d.ts.map +1 -0
  47. package/dist/browser/expression/utils.js.map +1 -0
  48. package/dist/browser/fn.d.ts.map +1 -0
  49. package/dist/{fn.js → browser/fn.js} +6 -25
  50. package/dist/browser/fn.js.map +1 -0
  51. package/dist/browser/index.d.ts.map +1 -0
  52. package/dist/{index.js → browser/index.js} +0 -2
  53. package/dist/browser/index.js.map +1 -0
  54. package/dist/{internal.d.ts → browser/internal.d.ts} +1 -1
  55. package/dist/browser/internal.d.ts.map +1 -0
  56. package/dist/{internal.js → browser/internal.js} +1 -1
  57. package/dist/browser/internal.js.map +1 -0
  58. package/dist/browser/naming/name-validation.d.ts.map +1 -0
  59. package/dist/{naming → browser/naming}/name-validation.js +1 -1
  60. package/dist/browser/naming/name-validation.js.map +1 -0
  61. package/dist/browser/naming/naming-policy.d.ts.map +1 -0
  62. package/dist/{naming → browser/naming}/naming-policy.js +3 -5
  63. package/dist/browser/naming/naming-policy.js.map +1 -0
  64. package/dist/browser/naming/naming-rules.d.ts.map +1 -0
  65. package/dist/browser/naming/naming-rules.js.map +1 -0
  66. package/dist/browser/package.json +8 -0
  67. package/dist/browser/serialization/arm-object-conversion.d.ts.map +1 -0
  68. package/dist/{serialization → browser/serialization}/arm-object-conversion.js +9 -18
  69. package/dist/browser/serialization/arm-object-conversion.js.map +1 -0
  70. package/dist/browser/serialization/ast/declaration-builder.d.ts.map +1 -0
  71. package/dist/{serialization → browser/serialization}/ast/declaration-builder.js +5 -12
  72. package/dist/browser/serialization/ast/declaration-builder.js.map +1 -0
  73. package/dist/browser/serialization/ast/declaration-dependencies.d.ts.map +1 -0
  74. package/dist/{serialization → browser/serialization}/ast/declaration-dependencies.js +1 -2
  75. package/dist/browser/serialization/ast/declaration-dependencies.js.map +1 -0
  76. package/dist/browser/serialization/ast/expression-builder.d.ts.map +1 -0
  77. package/dist/{serialization → browser/serialization}/ast/expression-builder.js +2 -4
  78. package/dist/browser/serialization/ast/expression-builder.js.map +1 -0
  79. package/dist/browser/serialization/ast/expression-restorer.d.ts.map +1 -0
  80. package/dist/{serialization → browser/serialization}/ast/expression-restorer.js +11 -4
  81. package/dist/browser/serialization/ast/expression-restorer.js.map +1 -0
  82. package/dist/browser/serialization/ast/expression-rewriter.d.ts.map +1 -0
  83. package/dist/{serialization → browser/serialization}/ast/expression-rewriter.js +12 -34
  84. package/dist/browser/serialization/ast/expression-rewriter.js.map +1 -0
  85. package/dist/browser/serialization/ast/expression-walker.d.ts.map +1 -0
  86. package/dist/browser/serialization/ast/expression-walker.js.map +1 -0
  87. package/dist/{serialization → browser/serialization}/ast/generated/ast.d.ts.map +1 -1
  88. package/dist/browser/serialization/ast/generated/ast.js.map +1 -0
  89. package/dist/browser/serialization/ast/index.d.ts.map +1 -0
  90. package/dist/browser/serialization/ast/index.js.map +1 -0
  91. package/dist/browser/serialization/ast/resource-utils.d.ts.map +1 -0
  92. package/dist/browser/serialization/ast/resource-utils.js.map +1 -0
  93. package/dist/browser/serialization/bicep/file-layout/authored-context.d.ts.map +1 -0
  94. package/dist/{serialization → browser/serialization}/bicep/file-layout/authored-context.js +1 -2
  95. package/dist/browser/serialization/bicep/file-layout/authored-context.js.map +1 -0
  96. package/dist/browser/serialization/bicep/file-layout/bicep-namer.d.ts.map +1 -0
  97. package/dist/{serialization → browser/serialization}/bicep/file-layout/bicep-namer.js +11 -20
  98. package/dist/browser/serialization/bicep/file-layout/bicep-namer.js.map +1 -0
  99. package/dist/browser/serialization/bicep/file-layout/build-bicep-files.d.ts.map +1 -0
  100. package/dist/{serialization → browser/serialization}/bicep/file-layout/build-bicep-files.js +7 -20
  101. package/dist/browser/serialization/bicep/file-layout/build-bicep-files.js.map +1 -0
  102. package/dist/browser/serialization/bicep/file-layout/deployment-planning.d.ts.map +1 -0
  103. package/dist/{serialization → browser/serialization}/bicep/file-layout/deployment-planning.js +2 -3
  104. package/dist/browser/serialization/bicep/file-layout/deployment-planning.js.map +1 -0
  105. package/dist/browser/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +1 -0
  106. package/dist/{serialization → browser/serialization}/bicep/file-layout/deployment-resource-utils.js +5 -9
  107. package/dist/browser/serialization/bicep/file-layout/deployment-resource-utils.js.map +1 -0
  108. package/dist/browser/serialization/bicep/file-layout/file-dependencies.d.ts.map +1 -0
  109. package/dist/{serialization → browser/serialization}/bicep/file-layout/file-dependencies.js +2 -7
  110. package/dist/browser/serialization/bicep/file-layout/file-dependencies.js.map +1 -0
  111. package/dist/browser/serialization/bicep/file-layout/file-paths.d.ts.map +1 -0
  112. package/dist/{serialization → browser/serialization}/bicep/file-layout/file-paths.js +1 -3
  113. package/dist/browser/serialization/bicep/file-layout/file-paths.js.map +1 -0
  114. package/dist/browser/serialization/bicep/file-layout/file-preparation.d.ts.map +1 -0
  115. package/dist/{serialization → browser/serialization}/bicep/file-layout/file-preparation.js +8 -16
  116. package/dist/browser/serialization/bicep/file-layout/file-preparation.js.map +1 -0
  117. package/dist/browser/serialization/bicep/file-layout/reference-wiring.d.ts.map +1 -0
  118. package/dist/{serialization → browser/serialization}/bicep/file-layout/reference-wiring.js +4 -7
  119. package/dist/browser/serialization/bicep/file-layout/reference-wiring.js.map +1 -0
  120. package/dist/browser/serialization/bicep/index.d.ts.map +1 -0
  121. package/dist/browser/serialization/bicep/index.js.map +1 -0
  122. package/dist/browser/serialization/bicep/render.d.ts.map +1 -0
  123. package/dist/{serialization → browser/serialization}/bicep/render.js +18 -34
  124. package/dist/browser/serialization/bicep/render.js.map +1 -0
  125. package/dist/browser/serialization/encoding.d.ts.map +1 -0
  126. package/dist/{serialization → browser/serialization}/encoding.js +2 -6
  127. package/dist/browser/serialization/encoding.js.map +1 -0
  128. package/dist/browser/serialization/identifiers.d.ts.map +1 -0
  129. package/dist/browser/serialization/identifiers.js.map +1 -0
  130. package/dist/browser/serialization/index.d.ts.map +1 -0
  131. package/dist/browser/serialization/index.js.map +1 -0
  132. package/dist/browser/serialization/json/deserialize.d.ts.map +1 -0
  133. package/dist/{serialization → browser/serialization}/json/deserialize.js +23 -64
  134. package/dist/browser/serialization/json/deserialize.js.map +1 -0
  135. package/dist/browser/serialization/json/serialize.d.ts.map +1 -0
  136. package/dist/{serialization → browser/serialization}/json/serialize.js +1 -3
  137. package/dist/browser/serialization/json/serialize.js.map +1 -0
  138. package/dist/browser/serialization/pluralize-config.d.ts.map +1 -0
  139. package/dist/browser/serialization/pluralize-config.js.map +1 -0
  140. package/dist/browser/serialization/symbol-map.d.ts.map +1 -0
  141. package/dist/browser/serialization/symbol-map.js.map +1 -0
  142. package/dist/browser/shape/shape-registry.d.ts.map +1 -0
  143. package/dist/browser/shape/shape-registry.js.map +1 -0
  144. package/dist/browser/shape/shape.d.ts.map +1 -0
  145. package/dist/{shape → browser/shape}/shape.js +6 -7
  146. package/dist/browser/shape/shape.js.map +1 -0
  147. package/dist/browser/shape/value-encoding.d.ts.map +1 -0
  148. package/dist/browser/shape/value-encoding.js.map +1 -0
  149. package/dist/browser/types.d.ts.map +1 -0
  150. package/dist/browser/types.js.map +1 -0
  151. package/dist/{util.d.ts → browser/util.d.ts} +1 -1
  152. package/dist/browser/util.d.ts.map +1 -0
  153. package/dist/{util.js → browser/util.js} +1 -5
  154. package/dist/browser/util.js.map +1 -0
  155. package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts +56 -0
  156. package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  157. package/dist/commonjs/constructs/built-in-resources/resource-group.js +135 -0
  158. package/dist/commonjs/constructs/built-in-resources/resource-group.js.map +7 -0
  159. package/dist/commonjs/constructs/output.d.ts +80 -0
  160. package/dist/commonjs/constructs/output.d.ts.map +1 -0
  161. package/dist/commonjs/constructs/output.js +75 -0
  162. package/dist/commonjs/constructs/output.js.map +7 -0
  163. package/dist/commonjs/constructs/parameter.d.ts +77 -0
  164. package/dist/commonjs/constructs/parameter.d.ts.map +1 -0
  165. package/dist/commonjs/constructs/parameter.js +95 -0
  166. package/dist/commonjs/constructs/parameter.js.map +7 -0
  167. package/dist/commonjs/constructs/provisioning-component.d.ts +91 -0
  168. package/dist/commonjs/constructs/provisioning-component.d.ts.map +1 -0
  169. package/dist/commonjs/constructs/provisioning-component.js +130 -0
  170. package/dist/commonjs/constructs/provisioning-component.js.map +7 -0
  171. package/dist/commonjs/constructs/resource/resource-proxy.d.ts +134 -0
  172. package/dist/commonjs/constructs/resource/resource-proxy.d.ts.map +1 -0
  173. package/dist/commonjs/constructs/resource/resource-proxy.js +456 -0
  174. package/dist/commonjs/constructs/resource/resource-proxy.js.map +7 -0
  175. package/dist/commonjs/constructs/resource/resource-query.d.ts +25 -0
  176. package/dist/commonjs/constructs/resource/resource-query.d.ts.map +1 -0
  177. package/dist/commonjs/constructs/resource/resource-query.js +79 -0
  178. package/dist/commonjs/constructs/resource/resource-query.js.map +7 -0
  179. package/dist/commonjs/constructs/resource/resource-registry.d.ts +99 -0
  180. package/dist/commonjs/constructs/resource/resource-registry.d.ts.map +1 -0
  181. package/dist/commonjs/constructs/resource/resource-registry.js +49 -0
  182. package/dist/commonjs/constructs/resource/resource-registry.js.map +7 -0
  183. package/dist/commonjs/constructs/resource/resource-relationships.d.ts +9 -0
  184. package/dist/commonjs/constructs/resource/resource-relationships.d.ts.map +1 -0
  185. package/dist/commonjs/constructs/resource/resource-relationships.js +59 -0
  186. package/dist/commonjs/constructs/resource/resource-relationships.js.map +7 -0
  187. package/dist/commonjs/constructs/resource/resource-type-registry.d.ts +46 -0
  188. package/dist/commonjs/constructs/resource/resource-type-registry.d.ts.map +1 -0
  189. package/dist/commonjs/constructs/resource/resource-type-registry.js +178 -0
  190. package/dist/commonjs/constructs/resource/resource-type-registry.js.map +7 -0
  191. package/dist/commonjs/constructs/resource/resource-utils.d.ts +60 -0
  192. package/dist/commonjs/constructs/resource/resource-utils.d.ts.map +1 -0
  193. package/dist/commonjs/constructs/resource/resource-utils.js +51 -0
  194. package/dist/commonjs/constructs/resource/resource-utils.js.map +7 -0
  195. package/dist/commonjs/constructs/resource/resource.d.ts +454 -0
  196. package/dist/commonjs/constructs/resource/resource.d.ts.map +1 -0
  197. package/dist/commonjs/constructs/resource/resource.js +477 -0
  198. package/dist/commonjs/constructs/resource/resource.js.map +7 -0
  199. package/dist/commonjs/constructs/stack.d.ts +96 -0
  200. package/dist/commonjs/constructs/stack.d.ts.map +1 -0
  201. package/dist/commonjs/constructs/stack.js +101 -0
  202. package/dist/commonjs/constructs/stack.js.map +7 -0
  203. package/dist/commonjs/constructs/variable.d.ts +63 -0
  204. package/dist/commonjs/constructs/variable.d.ts.map +1 -0
  205. package/dist/commonjs/constructs/variable.js +85 -0
  206. package/dist/commonjs/constructs/variable.js.map +7 -0
  207. package/dist/commonjs/deployment-context/deployment-context.d.ts +27 -0
  208. package/dist/commonjs/deployment-context/deployment-context.d.ts.map +1 -0
  209. package/dist/commonjs/deployment-context/deployment-context.js +16 -0
  210. package/dist/commonjs/deployment-context/deployment-context.js.map +7 -0
  211. package/dist/commonjs/expression/ast-nodes.d.ts +100 -0
  212. package/dist/commonjs/expression/ast-nodes.d.ts.map +1 -0
  213. package/dist/commonjs/expression/ast-nodes.js +152 -0
  214. package/dist/commonjs/expression/ast-nodes.js.map +7 -0
  215. package/dist/commonjs/expression/expressions.d.ts +157 -0
  216. package/dist/commonjs/expression/expressions.d.ts.map +1 -0
  217. package/dist/commonjs/expression/expressions.js +171 -0
  218. package/dist/commonjs/expression/expressions.js.map +7 -0
  219. package/dist/commonjs/expression/utils.d.ts +5 -0
  220. package/dist/commonjs/expression/utils.d.ts.map +1 -0
  221. package/dist/commonjs/expression/utils.js +43 -0
  222. package/dist/commonjs/expression/utils.js.map +7 -0
  223. package/dist/commonjs/fn.d.ts +194 -0
  224. package/dist/commonjs/fn.d.ts.map +1 -0
  225. package/dist/commonjs/fn.js +382 -0
  226. package/dist/commonjs/fn.js.map +7 -0
  227. package/dist/commonjs/index.d.ts +25 -0
  228. package/dist/commonjs/index.d.ts.map +1 -0
  229. package/dist/commonjs/index.js +93 -0
  230. package/dist/commonjs/index.js.map +7 -0
  231. package/dist/commonjs/internal.d.ts +10 -0
  232. package/dist/commonjs/internal.d.ts.map +1 -0
  233. package/dist/commonjs/internal.js +82 -0
  234. package/dist/commonjs/internal.js.map +7 -0
  235. package/dist/commonjs/naming/name-validation.d.ts +15 -0
  236. package/dist/commonjs/naming/name-validation.d.ts.map +1 -0
  237. package/dist/commonjs/naming/name-validation.js +74 -0
  238. package/dist/commonjs/naming/name-validation.js.map +7 -0
  239. package/dist/commonjs/naming/naming-policy.d.ts +56 -0
  240. package/dist/commonjs/naming/naming-policy.d.ts.map +1 -0
  241. package/dist/commonjs/naming/naming-policy.js +209 -0
  242. package/dist/commonjs/naming/naming-policy.js.map +7 -0
  243. package/dist/commonjs/naming/naming-rules.d.ts +16 -0
  244. package/dist/commonjs/naming/naming-rules.d.ts.map +1 -0
  245. package/dist/commonjs/naming/naming-rules.js +32 -0
  246. package/dist/commonjs/naming/naming-rules.js.map +7 -0
  247. package/dist/commonjs/package.json +8 -0
  248. package/dist/commonjs/serialization/arm-object-conversion.d.ts +41 -0
  249. package/dist/commonjs/serialization/arm-object-conversion.d.ts.map +1 -0
  250. package/dist/commonjs/serialization/arm-object-conversion.js +272 -0
  251. package/dist/commonjs/serialization/arm-object-conversion.js.map +7 -0
  252. package/dist/commonjs/serialization/ast/declaration-builder.d.ts +10 -0
  253. package/dist/commonjs/serialization/ast/declaration-builder.d.ts.map +1 -0
  254. package/dist/commonjs/serialization/ast/declaration-builder.js +274 -0
  255. package/dist/commonjs/serialization/ast/declaration-builder.js.map +7 -0
  256. package/dist/commonjs/serialization/ast/declaration-dependencies.d.ts +18 -0
  257. package/dist/commonjs/serialization/ast/declaration-dependencies.d.ts.map +1 -0
  258. package/dist/commonjs/serialization/ast/declaration-dependencies.js +109 -0
  259. package/dist/commonjs/serialization/ast/declaration-dependencies.js.map +7 -0
  260. package/dist/commonjs/serialization/ast/expression-builder.d.ts +14 -0
  261. package/dist/commonjs/serialization/ast/expression-builder.d.ts.map +1 -0
  262. package/dist/commonjs/serialization/ast/expression-builder.js +316 -0
  263. package/dist/commonjs/serialization/ast/expression-builder.js.map +7 -0
  264. package/dist/commonjs/serialization/ast/expression-restorer.d.ts +8 -0
  265. package/dist/commonjs/serialization/ast/expression-restorer.d.ts.map +1 -0
  266. package/dist/commonjs/serialization/ast/expression-restorer.js +193 -0
  267. package/dist/commonjs/serialization/ast/expression-restorer.js.map +7 -0
  268. package/dist/commonjs/serialization/ast/expression-rewriter.d.ts +29 -0
  269. package/dist/commonjs/serialization/ast/expression-rewriter.d.ts.map +1 -0
  270. package/dist/commonjs/serialization/ast/expression-rewriter.js +270 -0
  271. package/dist/commonjs/serialization/ast/expression-rewriter.js.map +7 -0
  272. package/dist/commonjs/serialization/ast/expression-walker.d.ts +16 -0
  273. package/dist/commonjs/serialization/ast/expression-walker.d.ts.map +1 -0
  274. package/dist/commonjs/serialization/ast/expression-walker.js +165 -0
  275. package/dist/commonjs/serialization/ast/expression-walker.js.map +7 -0
  276. package/dist/commonjs/serialization/ast/generated/ast.d.ts +508 -0
  277. package/dist/commonjs/serialization/ast/generated/ast.d.ts.map +1 -0
  278. package/dist/commonjs/serialization/ast/generated/ast.js +40 -0
  279. package/dist/commonjs/serialization/ast/generated/ast.js.map +7 -0
  280. package/dist/commonjs/serialization/ast/index.d.ts +7 -0
  281. package/dist/commonjs/serialization/ast/index.d.ts.map +1 -0
  282. package/dist/commonjs/serialization/ast/index.js +22 -0
  283. package/dist/commonjs/serialization/ast/index.js.map +7 -0
  284. package/dist/commonjs/serialization/ast/resource-utils.d.ts +10 -0
  285. package/dist/commonjs/serialization/ast/resource-utils.d.ts.map +1 -0
  286. package/dist/commonjs/serialization/ast/resource-utils.js +71 -0
  287. package/dist/commonjs/serialization/ast/resource-utils.js.map +7 -0
  288. package/dist/commonjs/serialization/bicep/file-layout/authored-context.d.ts +12 -0
  289. package/dist/commonjs/serialization/bicep/file-layout/authored-context.d.ts.map +1 -0
  290. package/dist/commonjs/serialization/bicep/file-layout/authored-context.js +74 -0
  291. package/dist/commonjs/serialization/bicep/file-layout/authored-context.js.map +7 -0
  292. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.d.ts +11 -0
  293. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.d.ts.map +1 -0
  294. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.js +130 -0
  295. package/dist/commonjs/serialization/bicep/file-layout/bicep-namer.js.map +7 -0
  296. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.d.ts +7 -0
  297. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.d.ts.map +1 -0
  298. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.js +71 -0
  299. package/dist/commonjs/serialization/bicep/file-layout/build-bicep-files.js.map +7 -0
  300. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.d.ts +19 -0
  301. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.d.ts.map +1 -0
  302. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.js +80 -0
  303. package/dist/commonjs/serialization/bicep/file-layout/deployment-planning.js.map +7 -0
  304. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.d.ts +8 -0
  305. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +1 -0
  306. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.js +91 -0
  307. package/dist/commonjs/serialization/bicep/file-layout/deployment-resource-utils.js.map +7 -0
  308. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.d.ts +4 -0
  309. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.d.ts.map +1 -0
  310. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.js +57 -0
  311. package/dist/commonjs/serialization/bicep/file-layout/file-dependencies.js.map +7 -0
  312. package/dist/commonjs/serialization/bicep/file-layout/file-paths.d.ts +3 -0
  313. package/dist/commonjs/serialization/bicep/file-layout/file-paths.d.ts.map +1 -0
  314. package/dist/commonjs/serialization/bicep/file-layout/file-paths.js +70 -0
  315. package/dist/commonjs/serialization/bicep/file-layout/file-paths.js.map +7 -0
  316. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.d.ts +34 -0
  317. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.d.ts.map +1 -0
  318. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.js +190 -0
  319. package/dist/commonjs/serialization/bicep/file-layout/file-preparation.js.map +7 -0
  320. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.d.ts +3 -0
  321. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.d.ts.map +1 -0
  322. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.js +241 -0
  323. package/dist/commonjs/serialization/bicep/file-layout/reference-wiring.js.map +7 -0
  324. package/dist/commonjs/serialization/bicep/index.d.ts +2 -0
  325. package/dist/commonjs/serialization/bicep/index.d.ts.map +1 -0
  326. package/dist/commonjs/serialization/bicep/index.js +28 -0
  327. package/dist/commonjs/serialization/bicep/index.js.map +7 -0
  328. package/dist/commonjs/serialization/bicep/render.d.ts +11 -0
  329. package/dist/commonjs/serialization/bicep/render.d.ts.map +1 -0
  330. package/dist/commonjs/serialization/bicep/render.js +312 -0
  331. package/dist/commonjs/serialization/bicep/render.js.map +7 -0
  332. package/dist/commonjs/serialization/encoding.d.ts +4 -0
  333. package/dist/commonjs/serialization/encoding.d.ts.map +1 -0
  334. package/dist/commonjs/serialization/encoding.js +296 -0
  335. package/dist/commonjs/serialization/encoding.js.map +7 -0
  336. package/dist/commonjs/serialization/identifiers.d.ts +2 -0
  337. package/dist/commonjs/serialization/identifiers.d.ts.map +1 -0
  338. package/dist/commonjs/serialization/identifiers.js +37 -0
  339. package/dist/commonjs/serialization/identifiers.js.map +7 -0
  340. package/dist/commonjs/serialization/index.d.ts +4 -0
  341. package/dist/commonjs/serialization/index.d.ts.map +1 -0
  342. package/dist/commonjs/serialization/index.js +31 -0
  343. package/dist/commonjs/serialization/index.js.map +7 -0
  344. package/dist/commonjs/serialization/json/deserialize.d.ts +24 -0
  345. package/dist/commonjs/serialization/json/deserialize.d.ts.map +1 -0
  346. package/dist/commonjs/serialization/json/deserialize.js +456 -0
  347. package/dist/commonjs/serialization/json/deserialize.js.map +7 -0
  348. package/dist/commonjs/serialization/json/serialize.d.ts +12 -0
  349. package/dist/commonjs/serialization/json/serialize.d.ts.map +1 -0
  350. package/dist/commonjs/serialization/json/serialize.js +50 -0
  351. package/dist/commonjs/serialization/json/serialize.js.map +7 -0
  352. package/dist/commonjs/serialization/pluralize-config.d.ts +3 -0
  353. package/dist/commonjs/serialization/pluralize-config.d.ts.map +1 -0
  354. package/dist/commonjs/serialization/pluralize-config.js +37 -0
  355. package/dist/commonjs/serialization/pluralize-config.js.map +7 -0
  356. package/dist/commonjs/serialization/symbol-map.d.ts +10 -0
  357. package/dist/commonjs/serialization/symbol-map.d.ts.map +1 -0
  358. package/dist/commonjs/serialization/symbol-map.js +72 -0
  359. package/dist/commonjs/serialization/symbol-map.js.map +7 -0
  360. package/dist/commonjs/shape/shape-registry.d.ts +51 -0
  361. package/dist/commonjs/shape/shape-registry.d.ts.map +1 -0
  362. package/dist/commonjs/shape/shape-registry.js +40 -0
  363. package/dist/commonjs/shape/shape-registry.js.map +7 -0
  364. package/dist/commonjs/shape/shape.d.ts +407 -0
  365. package/dist/commonjs/shape/shape.d.ts.map +1 -0
  366. package/dist/commonjs/shape/shape.js +290 -0
  367. package/dist/commonjs/shape/shape.js.map +7 -0
  368. package/dist/commonjs/shape/value-encoding.d.ts +121 -0
  369. package/dist/commonjs/shape/value-encoding.d.ts.map +1 -0
  370. package/dist/commonjs/shape/value-encoding.js +62 -0
  371. package/dist/commonjs/shape/value-encoding.js.map +7 -0
  372. package/dist/commonjs/tsdoc-metadata.json +11 -0
  373. package/dist/commonjs/types.d.ts +9 -0
  374. package/dist/commonjs/types.d.ts.map +1 -0
  375. package/dist/commonjs/types.js +16 -0
  376. package/dist/commonjs/types.js.map +7 -0
  377. package/dist/commonjs/util.d.ts +33 -0
  378. package/dist/commonjs/util.d.ts.map +1 -0
  379. package/dist/commonjs/util.js +73 -0
  380. package/dist/commonjs/util.js.map +7 -0
  381. package/dist/esm/constructs/built-in-resources/resource-group.d.ts +56 -0
  382. package/dist/esm/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  383. package/dist/esm/constructs/built-in-resources/resource-group.js +120 -0
  384. package/dist/esm/constructs/built-in-resources/resource-group.js.map +1 -0
  385. package/dist/esm/constructs/output.d.ts +80 -0
  386. package/dist/esm/constructs/output.d.ts.map +1 -0
  387. package/dist/esm/constructs/output.js +75 -0
  388. package/dist/esm/constructs/output.js.map +1 -0
  389. package/dist/esm/constructs/parameter.d.ts +77 -0
  390. package/dist/esm/constructs/parameter.d.ts.map +1 -0
  391. package/dist/esm/constructs/parameter.js +93 -0
  392. package/dist/esm/constructs/parameter.js.map +1 -0
  393. package/dist/esm/constructs/provisioning-component.d.ts +91 -0
  394. package/dist/esm/constructs/provisioning-component.d.ts.map +1 -0
  395. package/dist/esm/constructs/provisioning-component.js +150 -0
  396. package/dist/esm/constructs/provisioning-component.js.map +1 -0
  397. package/dist/esm/constructs/resource/resource-proxy.d.ts +134 -0
  398. package/dist/esm/constructs/resource/resource-proxy.d.ts.map +1 -0
  399. package/dist/esm/constructs/resource/resource-proxy.js +517 -0
  400. package/dist/esm/constructs/resource/resource-proxy.js.map +1 -0
  401. package/dist/esm/constructs/resource/resource-query.d.ts +25 -0
  402. package/dist/esm/constructs/resource/resource-query.d.ts.map +1 -0
  403. package/dist/esm/constructs/resource/resource-query.js +79 -0
  404. package/dist/esm/constructs/resource/resource-query.js.map +1 -0
  405. package/dist/esm/constructs/resource/resource-registry.d.ts +99 -0
  406. package/dist/esm/constructs/resource/resource-registry.d.ts.map +1 -0
  407. package/dist/esm/constructs/resource/resource-registry.js +51 -0
  408. package/dist/esm/constructs/resource/resource-registry.js.map +1 -0
  409. package/dist/esm/constructs/resource/resource-relationships.d.ts +9 -0
  410. package/dist/esm/constructs/resource/resource-relationships.d.ts.map +1 -0
  411. package/dist/esm/constructs/resource/resource-relationships.js +35 -0
  412. package/dist/esm/constructs/resource/resource-relationships.js.map +1 -0
  413. package/dist/esm/constructs/resource/resource-type-registry.d.ts +46 -0
  414. package/dist/esm/constructs/resource/resource-type-registry.d.ts.map +1 -0
  415. package/dist/esm/constructs/resource/resource-type-registry.js +156 -0
  416. package/dist/esm/constructs/resource/resource-type-registry.js.map +1 -0
  417. package/dist/esm/constructs/resource/resource-utils.d.ts +60 -0
  418. package/dist/esm/constructs/resource/resource-utils.d.ts.map +1 -0
  419. package/dist/esm/constructs/resource/resource-utils.js +75 -0
  420. package/dist/esm/constructs/resource/resource-utils.js.map +1 -0
  421. package/dist/esm/constructs/resource/resource.d.ts +454 -0
  422. package/dist/esm/constructs/resource/resource.d.ts.map +1 -0
  423. package/dist/esm/constructs/resource/resource.js +624 -0
  424. package/dist/esm/constructs/resource/resource.js.map +1 -0
  425. package/dist/esm/constructs/stack.d.ts +96 -0
  426. package/dist/esm/constructs/stack.d.ts.map +1 -0
  427. package/dist/esm/constructs/stack.js +96 -0
  428. package/dist/esm/constructs/stack.js.map +1 -0
  429. package/dist/esm/constructs/variable.d.ts +63 -0
  430. package/dist/esm/constructs/variable.d.ts.map +1 -0
  431. package/dist/esm/constructs/variable.js +74 -0
  432. package/dist/esm/constructs/variable.js.map +1 -0
  433. package/dist/esm/deployment-context/deployment-context.d.ts +27 -0
  434. package/dist/esm/deployment-context/deployment-context.d.ts.map +1 -0
  435. package/dist/esm/deployment-context/deployment-context.js +4 -0
  436. package/dist/esm/deployment-context/deployment-context.js.map +1 -0
  437. package/dist/esm/expression/ast-nodes.d.ts +100 -0
  438. package/dist/esm/expression/ast-nodes.d.ts.map +1 -0
  439. package/dist/esm/expression/ast-nodes.js +125 -0
  440. package/dist/esm/expression/ast-nodes.js.map +1 -0
  441. package/dist/esm/expression/expressions.d.ts +157 -0
  442. package/dist/esm/expression/expressions.d.ts.map +1 -0
  443. package/dist/esm/expression/expressions.js +204 -0
  444. package/dist/esm/expression/expressions.js.map +1 -0
  445. package/dist/esm/expression/utils.d.ts +5 -0
  446. package/dist/esm/expression/utils.d.ts.map +1 -0
  447. package/dist/esm/expression/utils.js +25 -0
  448. package/dist/esm/expression/utils.js.map +1 -0
  449. package/dist/esm/fn.d.ts +194 -0
  450. package/dist/esm/fn.d.ts.map +1 -0
  451. package/dist/esm/fn.js +334 -0
  452. package/dist/esm/fn.js.map +1 -0
  453. package/dist/esm/index.d.ts +25 -0
  454. package/dist/esm/index.d.ts.map +1 -0
  455. package/dist/esm/index.js +17 -0
  456. package/dist/esm/index.js.map +1 -0
  457. package/dist/esm/internal.d.ts +10 -0
  458. package/dist/esm/internal.d.ts.map +1 -0
  459. package/dist/esm/internal.js +8 -0
  460. package/dist/esm/internal.js.map +1 -0
  461. package/dist/esm/naming/name-validation.d.ts +15 -0
  462. package/dist/esm/naming/name-validation.d.ts.map +1 -0
  463. package/dist/esm/naming/name-validation.js +82 -0
  464. package/dist/esm/naming/name-validation.js.map +1 -0
  465. package/dist/esm/naming/naming-policy.d.ts +56 -0
  466. package/dist/esm/naming/naming-policy.d.ts.map +1 -0
  467. package/dist/esm/naming/naming-policy.js +230 -0
  468. package/dist/esm/naming/naming-policy.js.map +1 -0
  469. package/dist/esm/naming/naming-rules.d.ts +16 -0
  470. package/dist/esm/naming/naming-rules.d.ts.map +1 -0
  471. package/dist/esm/naming/naming-rules.js +8 -0
  472. package/dist/esm/naming/naming-rules.js.map +1 -0
  473. package/dist/esm/package.json +8 -0
  474. package/dist/esm/serialization/arm-object-conversion.d.ts +41 -0
  475. package/dist/esm/serialization/arm-object-conversion.d.ts.map +1 -0
  476. package/dist/esm/serialization/arm-object-conversion.js +334 -0
  477. package/dist/esm/serialization/arm-object-conversion.js.map +1 -0
  478. package/dist/esm/serialization/ast/declaration-builder.d.ts +10 -0
  479. package/dist/esm/serialization/ast/declaration-builder.d.ts.map +1 -0
  480. package/dist/esm/serialization/ast/declaration-builder.js +265 -0
  481. package/dist/esm/serialization/ast/declaration-builder.js.map +1 -0
  482. package/dist/esm/serialization/ast/declaration-dependencies.d.ts +18 -0
  483. package/dist/esm/serialization/ast/declaration-dependencies.d.ts.map +1 -0
  484. package/dist/esm/serialization/ast/declaration-dependencies.js +96 -0
  485. package/dist/esm/serialization/ast/declaration-dependencies.js.map +1 -0
  486. package/dist/esm/serialization/ast/expression-builder.d.ts +14 -0
  487. package/dist/esm/serialization/ast/expression-builder.d.ts.map +1 -0
  488. package/dist/esm/serialization/ast/expression-builder.js +313 -0
  489. package/dist/esm/serialization/ast/expression-builder.js.map +1 -0
  490. package/dist/esm/serialization/ast/expression-restorer.d.ts +8 -0
  491. package/dist/esm/serialization/ast/expression-restorer.d.ts.map +1 -0
  492. package/dist/esm/serialization/ast/expression-restorer.js +162 -0
  493. package/dist/esm/serialization/ast/expression-restorer.js.map +1 -0
  494. package/dist/esm/serialization/ast/expression-rewriter.d.ts +29 -0
  495. package/dist/esm/serialization/ast/expression-rewriter.d.ts.map +1 -0
  496. package/dist/esm/serialization/ast/expression-rewriter.js +257 -0
  497. package/dist/esm/serialization/ast/expression-rewriter.js.map +1 -0
  498. package/dist/esm/serialization/ast/expression-walker.d.ts +16 -0
  499. package/dist/esm/serialization/ast/expression-walker.d.ts.map +1 -0
  500. package/dist/esm/serialization/ast/expression-walker.js +154 -0
  501. package/dist/esm/serialization/ast/expression-walker.js.map +1 -0
  502. package/dist/esm/serialization/ast/generated/ast.d.ts +508 -0
  503. package/dist/esm/serialization/ast/generated/ast.d.ts.map +1 -0
  504. package/dist/esm/serialization/ast/generated/ast.js +23 -0
  505. package/dist/esm/serialization/ast/generated/ast.js.map +1 -0
  506. package/dist/esm/serialization/ast/index.d.ts +7 -0
  507. package/dist/esm/serialization/ast/index.d.ts.map +1 -0
  508. package/dist/esm/serialization/ast/index.js +4 -0
  509. package/dist/esm/serialization/ast/index.js.map +1 -0
  510. package/dist/esm/serialization/ast/resource-utils.d.ts +10 -0
  511. package/dist/esm/serialization/ast/resource-utils.d.ts.map +1 -0
  512. package/dist/esm/serialization/ast/resource-utils.js +52 -0
  513. package/dist/esm/serialization/ast/resource-utils.js.map +1 -0
  514. package/dist/esm/serialization/bicep/file-layout/authored-context.d.ts +12 -0
  515. package/dist/esm/serialization/bicep/file-layout/authored-context.d.ts.map +1 -0
  516. package/dist/esm/serialization/bicep/file-layout/authored-context.js +57 -0
  517. package/dist/esm/serialization/bicep/file-layout/authored-context.js.map +1 -0
  518. package/dist/esm/serialization/bicep/file-layout/bicep-namer.d.ts +11 -0
  519. package/dist/esm/serialization/bicep/file-layout/bicep-namer.d.ts.map +1 -0
  520. package/dist/esm/serialization/bicep/file-layout/bicep-namer.js +100 -0
  521. package/dist/esm/serialization/bicep/file-layout/bicep-namer.js.map +1 -0
  522. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.d.ts +7 -0
  523. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.d.ts.map +1 -0
  524. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.js +46 -0
  525. package/dist/esm/serialization/bicep/file-layout/build-bicep-files.js.map +1 -0
  526. package/dist/esm/serialization/bicep/file-layout/deployment-planning.d.ts +19 -0
  527. package/dist/esm/serialization/bicep/file-layout/deployment-planning.d.ts.map +1 -0
  528. package/dist/esm/serialization/bicep/file-layout/deployment-planning.js +68 -0
  529. package/dist/esm/serialization/bicep/file-layout/deployment-planning.js.map +1 -0
  530. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.d.ts +8 -0
  531. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +1 -0
  532. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.js +67 -0
  533. package/dist/esm/serialization/bicep/file-layout/deployment-resource-utils.js.map +1 -0
  534. package/dist/esm/serialization/bicep/file-layout/file-dependencies.d.ts +4 -0
  535. package/dist/esm/serialization/bicep/file-layout/file-dependencies.d.ts.map +1 -0
  536. package/dist/esm/serialization/bicep/file-layout/file-dependencies.js +32 -0
  537. package/dist/esm/serialization/bicep/file-layout/file-dependencies.js.map +1 -0
  538. package/dist/esm/serialization/bicep/file-layout/file-paths.d.ts +3 -0
  539. package/dist/esm/serialization/bicep/file-layout/file-paths.d.ts.map +1 -0
  540. package/dist/esm/serialization/bicep/file-layout/file-paths.js +46 -0
  541. package/dist/esm/serialization/bicep/file-layout/file-paths.js.map +1 -0
  542. package/dist/esm/serialization/bicep/file-layout/file-preparation.d.ts +34 -0
  543. package/dist/esm/serialization/bicep/file-layout/file-preparation.d.ts.map +1 -0
  544. package/dist/esm/serialization/bicep/file-layout/file-preparation.js +140 -0
  545. package/dist/esm/serialization/bicep/file-layout/file-preparation.js.map +1 -0
  546. package/dist/esm/serialization/bicep/file-layout/reference-wiring.d.ts +3 -0
  547. package/dist/esm/serialization/bicep/file-layout/reference-wiring.d.ts.map +1 -0
  548. package/dist/esm/serialization/bicep/file-layout/reference-wiring.js +225 -0
  549. package/dist/esm/serialization/bicep/file-layout/reference-wiring.js.map +1 -0
  550. package/dist/esm/serialization/bicep/index.d.ts +2 -0
  551. package/dist/esm/serialization/bicep/index.d.ts.map +1 -0
  552. package/dist/esm/serialization/bicep/index.js +4 -0
  553. package/dist/esm/serialization/bicep/index.js.map +1 -0
  554. package/dist/esm/serialization/bicep/render.d.ts +11 -0
  555. package/dist/esm/serialization/bicep/render.d.ts.map +1 -0
  556. package/dist/esm/serialization/bicep/render.js +293 -0
  557. package/dist/esm/serialization/bicep/render.js.map +1 -0
  558. package/dist/esm/serialization/encoding.d.ts +4 -0
  559. package/dist/esm/serialization/encoding.d.ts.map +1 -0
  560. package/dist/esm/serialization/encoding.js +309 -0
  561. package/dist/esm/serialization/encoding.js.map +1 -0
  562. package/dist/esm/serialization/identifiers.d.ts +2 -0
  563. package/dist/esm/serialization/identifiers.d.ts.map +1 -0
  564. package/dist/esm/serialization/identifiers.js +19 -0
  565. package/dist/esm/serialization/identifiers.js.map +1 -0
  566. package/dist/esm/serialization/index.d.ts +4 -0
  567. package/dist/esm/serialization/index.d.ts.map +1 -0
  568. package/dist/esm/serialization/index.js +5 -0
  569. package/dist/esm/serialization/index.js.map +1 -0
  570. package/dist/esm/serialization/json/deserialize.d.ts +24 -0
  571. package/dist/esm/serialization/json/deserialize.d.ts.map +1 -0
  572. package/dist/esm/serialization/json/deserialize.js +529 -0
  573. package/dist/esm/serialization/json/deserialize.js.map +1 -0
  574. package/dist/esm/serialization/json/serialize.d.ts +12 -0
  575. package/dist/esm/serialization/json/serialize.d.ts.map +1 -0
  576. package/dist/esm/serialization/json/serialize.js +34 -0
  577. package/dist/esm/serialization/json/serialize.js.map +1 -0
  578. package/dist/esm/serialization/pluralize-config.d.ts +3 -0
  579. package/dist/esm/serialization/pluralize-config.d.ts.map +1 -0
  580. package/dist/esm/serialization/pluralize-config.js +7 -0
  581. package/dist/esm/serialization/pluralize-config.js.map +1 -0
  582. package/dist/esm/serialization/symbol-map.d.ts +10 -0
  583. package/dist/esm/serialization/symbol-map.d.ts.map +1 -0
  584. package/dist/esm/serialization/symbol-map.js +40 -0
  585. package/dist/esm/serialization/symbol-map.js.map +1 -0
  586. package/dist/esm/shape/shape-registry.d.ts +51 -0
  587. package/dist/esm/shape/shape-registry.d.ts.map +1 -0
  588. package/dist/esm/shape/shape-registry.js +41 -0
  589. package/dist/esm/shape/shape-registry.js.map +1 -0
  590. package/dist/esm/shape/shape.d.ts +407 -0
  591. package/dist/esm/shape/shape.d.ts.map +1 -0
  592. package/dist/esm/shape/shape.js +424 -0
  593. package/dist/esm/shape/shape.js.map +1 -0
  594. package/dist/esm/shape/value-encoding.d.ts +121 -0
  595. package/dist/esm/shape/value-encoding.d.ts.map +1 -0
  596. package/dist/esm/shape/value-encoding.js +32 -0
  597. package/dist/esm/shape/value-encoding.js.map +1 -0
  598. package/dist/esm/types.d.ts +9 -0
  599. package/dist/esm/types.d.ts.map +1 -0
  600. package/dist/esm/types.js +4 -0
  601. package/dist/esm/types.js.map +1 -0
  602. package/dist/esm/util.d.ts +33 -0
  603. package/dist/esm/util.d.ts.map +1 -0
  604. package/dist/esm/util.js +74 -0
  605. package/dist/esm/util.js.map +1 -0
  606. package/package.json +92 -27
  607. package/dist/constructs/built-in-resources/resource-group.d.ts.map +0 -1
  608. package/dist/constructs/built-in-resources/resource-group.js.map +0 -1
  609. package/dist/constructs/output.d.ts.map +0 -1
  610. package/dist/constructs/output.js.map +0 -1
  611. package/dist/constructs/parameter.js.map +0 -1
  612. package/dist/constructs/provisioning-component.d.ts.map +0 -1
  613. package/dist/constructs/provisioning-component.js.map +0 -1
  614. package/dist/constructs/resource/resource-proxy.d.ts.map +0 -1
  615. package/dist/constructs/resource/resource-proxy.js.map +0 -1
  616. package/dist/constructs/resource/resource-query.d.ts.map +0 -1
  617. package/dist/constructs/resource/resource-query.js.map +0 -1
  618. package/dist/constructs/resource/resource-registry.d.ts.map +0 -1
  619. package/dist/constructs/resource/resource-registry.js.map +0 -1
  620. package/dist/constructs/resource/resource-relationships.d.ts.map +0 -1
  621. package/dist/constructs/resource/resource-relationships.js.map +0 -1
  622. package/dist/constructs/resource/resource-type-registry.d.ts.map +0 -1
  623. package/dist/constructs/resource/resource-type-registry.js.map +0 -1
  624. package/dist/constructs/resource/resource-utils.d.ts.map +0 -1
  625. package/dist/constructs/resource/resource-utils.js.map +0 -1
  626. package/dist/constructs/resource/resource.d.ts.map +0 -1
  627. package/dist/constructs/resource/resource.js.map +0 -1
  628. package/dist/constructs/stack.d.ts.map +0 -1
  629. package/dist/constructs/stack.js.map +0 -1
  630. package/dist/constructs/variable.d.ts.map +0 -1
  631. package/dist/constructs/variable.js.map +0 -1
  632. package/dist/deployment-context/deployment-context.d.ts.map +0 -1
  633. package/dist/deployment-context/deployment-context.js.map +0 -1
  634. package/dist/expression/ast-nodes.d.ts.map +0 -1
  635. package/dist/expression/ast-nodes.js.map +0 -1
  636. package/dist/expression/expressions.d.ts.map +0 -1
  637. package/dist/expression/expressions.js.map +0 -1
  638. package/dist/expression/utils.d.ts.map +0 -1
  639. package/dist/expression/utils.js.map +0 -1
  640. package/dist/fn.d.ts.map +0 -1
  641. package/dist/fn.js.map +0 -1
  642. package/dist/index.d.ts.map +0 -1
  643. package/dist/index.js.map +0 -1
  644. package/dist/internal-loop.d.ts +0 -14
  645. package/dist/internal-loop.d.ts.map +0 -1
  646. package/dist/internal-loop.js +0 -16
  647. package/dist/internal-loop.js.map +0 -1
  648. package/dist/internal.d.ts.map +0 -1
  649. package/dist/internal.js.map +0 -1
  650. package/dist/naming/name-validation.d.ts.map +0 -1
  651. package/dist/naming/name-validation.js.map +0 -1
  652. package/dist/naming/naming-policy.d.ts.map +0 -1
  653. package/dist/naming/naming-policy.js.map +0 -1
  654. package/dist/naming/naming-rules.d.ts.map +0 -1
  655. package/dist/naming/naming-rules.js.map +0 -1
  656. package/dist/serialization/arm-object-conversion.d.ts.map +0 -1
  657. package/dist/serialization/arm-object-conversion.js.map +0 -1
  658. package/dist/serialization/ast/declaration-builder.d.ts.map +0 -1
  659. package/dist/serialization/ast/declaration-builder.js.map +0 -1
  660. package/dist/serialization/ast/declaration-dependencies.d.ts.map +0 -1
  661. package/dist/serialization/ast/declaration-dependencies.js.map +0 -1
  662. package/dist/serialization/ast/expression-builder.d.ts.map +0 -1
  663. package/dist/serialization/ast/expression-builder.js.map +0 -1
  664. package/dist/serialization/ast/expression-restorer.d.ts.map +0 -1
  665. package/dist/serialization/ast/expression-restorer.js.map +0 -1
  666. package/dist/serialization/ast/expression-rewriter.d.ts.map +0 -1
  667. package/dist/serialization/ast/expression-rewriter.js.map +0 -1
  668. package/dist/serialization/ast/expression-walker.d.ts.map +0 -1
  669. package/dist/serialization/ast/expression-walker.js.map +0 -1
  670. package/dist/serialization/ast/generated/ast.js.map +0 -1
  671. package/dist/serialization/ast/index.d.ts.map +0 -1
  672. package/dist/serialization/ast/index.js.map +0 -1
  673. package/dist/serialization/ast/resource-utils.d.ts.map +0 -1
  674. package/dist/serialization/ast/resource-utils.js.map +0 -1
  675. package/dist/serialization/bicep/file-layout/authored-context.d.ts.map +0 -1
  676. package/dist/serialization/bicep/file-layout/authored-context.js.map +0 -1
  677. package/dist/serialization/bicep/file-layout/bicep-namer.d.ts.map +0 -1
  678. package/dist/serialization/bicep/file-layout/bicep-namer.js.map +0 -1
  679. package/dist/serialization/bicep/file-layout/build-bicep-files.d.ts.map +0 -1
  680. package/dist/serialization/bicep/file-layout/build-bicep-files.js.map +0 -1
  681. package/dist/serialization/bicep/file-layout/deployment-planning.d.ts.map +0 -1
  682. package/dist/serialization/bicep/file-layout/deployment-planning.js.map +0 -1
  683. package/dist/serialization/bicep/file-layout/deployment-resource-utils.d.ts.map +0 -1
  684. package/dist/serialization/bicep/file-layout/deployment-resource-utils.js.map +0 -1
  685. package/dist/serialization/bicep/file-layout/file-dependencies.d.ts.map +0 -1
  686. package/dist/serialization/bicep/file-layout/file-dependencies.js.map +0 -1
  687. package/dist/serialization/bicep/file-layout/file-paths.d.ts.map +0 -1
  688. package/dist/serialization/bicep/file-layout/file-paths.js.map +0 -1
  689. package/dist/serialization/bicep/file-layout/file-preparation.d.ts.map +0 -1
  690. package/dist/serialization/bicep/file-layout/file-preparation.js.map +0 -1
  691. package/dist/serialization/bicep/file-layout/reference-wiring.d.ts.map +0 -1
  692. package/dist/serialization/bicep/file-layout/reference-wiring.js.map +0 -1
  693. package/dist/serialization/bicep/index.d.ts.map +0 -1
  694. package/dist/serialization/bicep/index.js.map +0 -1
  695. package/dist/serialization/bicep/render.d.ts.map +0 -1
  696. package/dist/serialization/bicep/render.js.map +0 -1
  697. package/dist/serialization/encoding.d.ts.map +0 -1
  698. package/dist/serialization/encoding.js.map +0 -1
  699. package/dist/serialization/identifiers.d.ts.map +0 -1
  700. package/dist/serialization/identifiers.js.map +0 -1
  701. package/dist/serialization/index.d.ts.map +0 -1
  702. package/dist/serialization/index.js.map +0 -1
  703. package/dist/serialization/json/deserialize.d.ts.map +0 -1
  704. package/dist/serialization/json/deserialize.js.map +0 -1
  705. package/dist/serialization/json/serialize.d.ts.map +0 -1
  706. package/dist/serialization/json/serialize.js.map +0 -1
  707. package/dist/serialization/pluralize-config.d.ts.map +0 -1
  708. package/dist/serialization/pluralize-config.js.map +0 -1
  709. package/dist/serialization/symbol-map.d.ts.map +0 -1
  710. package/dist/serialization/symbol-map.js.map +0 -1
  711. package/dist/shape/shape-registry.d.ts.map +0 -1
  712. package/dist/shape/shape-registry.js.map +0 -1
  713. package/dist/shape/shape.d.ts.map +0 -1
  714. package/dist/shape/shape.js.map +0 -1
  715. package/dist/shape/value-encoding.d.ts.map +0 -1
  716. package/dist/shape/value-encoding.js.map +0 -1
  717. package/dist/tsconfig.tsbuildinfo +0 -1
  718. package/dist/types.d.ts.map +0 -1
  719. package/dist/types.js.map +0 -1
  720. package/dist/util.d.ts.map +0 -1
  721. package/dist/util.js.map +0 -1
  722. /package/dist/{constructs → browser/constructs}/built-in-resources/resource-group.d.ts +0 -0
  723. /package/dist/{constructs → browser/constructs}/output.d.ts +0 -0
  724. /package/dist/{constructs → browser/constructs}/parameter.d.ts +0 -0
  725. /package/dist/{constructs → browser/constructs}/parameter.js +0 -0
  726. /package/dist/{constructs → browser/constructs}/provisioning-component.d.ts +0 -0
  727. /package/dist/{constructs → browser/constructs}/provisioning-component.js +0 -0
  728. /package/dist/{constructs → browser/constructs}/resource/resource-proxy.d.ts +0 -0
  729. /package/dist/{constructs → browser/constructs}/resource/resource-query.d.ts +0 -0
  730. /package/dist/{constructs → browser/constructs}/resource/resource-registry.d.ts +0 -0
  731. /package/dist/{constructs → browser/constructs}/resource/resource-relationships.d.ts +0 -0
  732. /package/dist/{constructs → browser/constructs}/resource/resource-type-registry.d.ts +0 -0
  733. /package/dist/{constructs → browser/constructs}/resource/resource-type-registry.js +0 -0
  734. /package/dist/{constructs → browser/constructs}/resource/resource-utils.d.ts +0 -0
  735. /package/dist/{constructs → browser/constructs}/resource/resource.d.ts +0 -0
  736. /package/dist/{constructs → browser/constructs}/stack.d.ts +0 -0
  737. /package/dist/{constructs → browser/constructs}/stack.js +0 -0
  738. /package/dist/{constructs → browser/constructs}/variable.d.ts +0 -0
  739. /package/dist/{constructs → browser/constructs}/variable.js +0 -0
  740. /package/dist/{deployment-context → browser/deployment-context}/deployment-context.d.ts +0 -0
  741. /package/dist/{deployment-context → browser/deployment-context}/deployment-context.js +0 -0
  742. /package/dist/{expression → browser/expression}/ast-nodes.d.ts +0 -0
  743. /package/dist/{expression → browser/expression}/expressions.d.ts +0 -0
  744. /package/dist/{expression → browser/expression}/utils.d.ts +0 -0
  745. /package/dist/{expression → browser/expression}/utils.js +0 -0
  746. /package/dist/{fn.d.ts → browser/fn.d.ts} +0 -0
  747. /package/dist/{index.d.ts → browser/index.d.ts} +0 -0
  748. /package/dist/{naming → browser/naming}/name-validation.d.ts +0 -0
  749. /package/dist/{naming → browser/naming}/naming-policy.d.ts +0 -0
  750. /package/dist/{naming → browser/naming}/naming-rules.d.ts +0 -0
  751. /package/dist/{naming → browser/naming}/naming-rules.js +0 -0
  752. /package/dist/{serialization → browser/serialization}/arm-object-conversion.d.ts +0 -0
  753. /package/dist/{serialization → browser/serialization}/ast/declaration-builder.d.ts +0 -0
  754. /package/dist/{serialization → browser/serialization}/ast/declaration-dependencies.d.ts +0 -0
  755. /package/dist/{serialization → browser/serialization}/ast/expression-builder.d.ts +0 -0
  756. /package/dist/{serialization → browser/serialization}/ast/expression-restorer.d.ts +0 -0
  757. /package/dist/{serialization → browser/serialization}/ast/expression-rewriter.d.ts +0 -0
  758. /package/dist/{serialization → browser/serialization}/ast/expression-walker.d.ts +0 -0
  759. /package/dist/{serialization → browser/serialization}/ast/expression-walker.js +0 -0
  760. /package/dist/{serialization → browser/serialization}/ast/generated/ast.d.ts +0 -0
  761. /package/dist/{serialization → browser/serialization}/ast/generated/ast.js +0 -0
  762. /package/dist/{serialization → browser/serialization}/ast/index.d.ts +0 -0
  763. /package/dist/{serialization → browser/serialization}/ast/index.js +0 -0
  764. /package/dist/{serialization → browser/serialization}/ast/resource-utils.d.ts +0 -0
  765. /package/dist/{serialization → browser/serialization}/ast/resource-utils.js +0 -0
  766. /package/dist/{serialization → browser/serialization}/bicep/file-layout/authored-context.d.ts +0 -0
  767. /package/dist/{serialization → browser/serialization}/bicep/file-layout/bicep-namer.d.ts +0 -0
  768. /package/dist/{serialization → browser/serialization}/bicep/file-layout/build-bicep-files.d.ts +0 -0
  769. /package/dist/{serialization → browser/serialization}/bicep/file-layout/deployment-planning.d.ts +0 -0
  770. /package/dist/{serialization → browser/serialization}/bicep/file-layout/deployment-resource-utils.d.ts +0 -0
  771. /package/dist/{serialization → browser/serialization}/bicep/file-layout/file-dependencies.d.ts +0 -0
  772. /package/dist/{serialization → browser/serialization}/bicep/file-layout/file-paths.d.ts +0 -0
  773. /package/dist/{serialization → browser/serialization}/bicep/file-layout/file-preparation.d.ts +0 -0
  774. /package/dist/{serialization → browser/serialization}/bicep/file-layout/reference-wiring.d.ts +0 -0
  775. /package/dist/{serialization → browser/serialization}/bicep/index.d.ts +0 -0
  776. /package/dist/{serialization → browser/serialization}/bicep/index.js +0 -0
  777. /package/dist/{serialization → browser/serialization}/bicep/render.d.ts +0 -0
  778. /package/dist/{serialization → browser/serialization}/encoding.d.ts +0 -0
  779. /package/dist/{serialization → browser/serialization}/identifiers.d.ts +0 -0
  780. /package/dist/{serialization → browser/serialization}/identifiers.js +0 -0
  781. /package/dist/{serialization → browser/serialization}/index.d.ts +0 -0
  782. /package/dist/{serialization → browser/serialization}/index.js +0 -0
  783. /package/dist/{serialization → browser/serialization}/json/deserialize.d.ts +0 -0
  784. /package/dist/{serialization → browser/serialization}/json/serialize.d.ts +0 -0
  785. /package/dist/{serialization → browser/serialization}/pluralize-config.d.ts +0 -0
  786. /package/dist/{serialization → browser/serialization}/pluralize-config.js +0 -0
  787. /package/dist/{serialization → browser/serialization}/symbol-map.d.ts +0 -0
  788. /package/dist/{serialization → browser/serialization}/symbol-map.js +0 -0
  789. /package/dist/{shape → browser/shape}/shape-registry.d.ts +0 -0
  790. /package/dist/{shape → browser/shape}/shape-registry.js +0 -0
  791. /package/dist/{shape → browser/shape}/shape.d.ts +0 -0
  792. /package/dist/{shape → browser/shape}/value-encoding.d.ts +0 -0
  793. /package/dist/{shape → browser/shape}/value-encoding.js +0 -0
  794. /package/dist/{types.d.ts → browser/types.d.ts} +0 -0
  795. /package/dist/{types.js → browser/types.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-registry.js","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-registry.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAoClC,OAAO,EAAE,oBAAoB,EAA4B,MAAM,6BAA6B,CAAC;AAsC7F,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;AAMhF,SAAS,WAAW;IAClB,MAAM,IAAI,GAAG,UAAqC,CAAC;IACnD,IAAI,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;IACrC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,QAAQ,GAAG,IAAI,oBAAoB,EAAgB,CAAC;QACpD,IAAI,CAAC,eAAe,CAAC,GAAG,QAAQ,CAAC;IACnC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAkB,EAAE,eAAqC;IACxF,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;AACpF,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,UAAkB,EAClB,KAA+B,EAC/B,OAAwB;IAExB,OAAO,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,EAAE;QAC1D,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;QAChC,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Global registry mapping a resource class's registry key to its\n * constructor.\n *\n * Populated at module load by each class's `static {}` initializer\n * (via {@link Resource.register}). The deserializer reads this\n * registry to construct the correct class instance — preserving\n * identity, prototype methods, and constructor-initialized child\n * collections — instead of materialising a base `Resource`.\n *\n * Each `type@apiVersion` entry is either one flat constructor or a flat list\n * of concrete constructors paired with ordered variant selectors. A selector\n * can contain singleton `name`, model discriminators such as `kind`, and\n * nested discriminator segments.\n *\n * Resolution has two modes:\n *\n * - **Best-effort (default).** Exact `(type, apiVersion)` first, then\n * falls back to the highest registered `apiVersion` for the same\n * selector. Enables\n * deserializing older JSON against a newer package version without\n * losing typed handles.\n * - **Strict** (opt-in via `{ strict: true }`). Exact match only;\n * returns `undefined` for any apiVersion the package doesn't ship.\n *\n * The shared registry tracks the highest `apiVersion` per `(type, selector)`.\n * Best-effort lookups consult it in O(1); no scanning is needed.\n *\n * Keyed on a process-global symbol so multiple copies of `@azure/provisioning-core`\n * in the same realm share one registry, mirroring the cross-realm\n * strategy used by {@link isResource}'s brand symbol.\n */\n\nimport type { Resource } from \"./resource.js\";\nimport { ResourceTypeRegistry, type FlatVariantSelector } from \"./resource-type-registry.js\";\n\n/**\n * A `Resource` class that's eligible to live in the registry.\n *\n * - The construct signature uses `any` for both `context` and `props`\n * because concrete classes narrow these (child resources require a\n * specific parent class as context; each resource has its own `Props`\n * shape). TypeScript's parameter contravariance would reject any\n * concrete parameter types here. The deserializer is the sole caller\n * of resolved constructors and forwards already-correct values it\n * built from the wire document.\n * - The two static fields `resourceType` and `apiVersion` form the\n * registry key and are always present on emitter-generated classes\n * (and on the hand-maintained `ResourceGroup`).\n * - The generic `T` propagates the instance type — used by the query\n * API (`stack.getResources(KeyVault)` → `KeyVault[]`) to narrow\n * return types without needing a separate descriptor object.\n */\nexport type ResourceCtor<T extends Resource = Resource> = {\n new (context: any, props: any, options?: any): T;\n readonly resourceType: string;\n readonly apiVersion: string;\n};\n\n/**\n * Options controlling how {@link resolveResource} handles\n * apiVersion mismatches.\n */\nexport interface ResolveOptions {\n /**\n * When `true`, only an exact `(resourceType, apiVersion)` match is\n * returned; the best-effort fallback to the highest registered\n * version for the type is skipped. Defaults to `false`.\n */\n readonly strict?: boolean;\n}\n\nconst REGISTRY_SYMBOL = Symbol.for(\"@azure/provisioning-core.resourceRegistry\");\n\ninterface RegistryHost {\n [REGISTRY_SYMBOL]?: ResourceTypeRegistry<ResourceCtor>;\n}\n\nfunction getRegistry(): ResourceTypeRegistry<ResourceCtor> {\n const host = globalThis as unknown as RegistryHost;\n let registry = host[REGISTRY_SYMBOL];\n if (registry === undefined) {\n registry = new ResourceTypeRegistry<ResourceCtor>();\n host[REGISTRY_SYMBOL] = registry;\n }\n return registry;\n}\n\n/**\n * Register `ctor` as the canonical class for its\n * `(resourceType, apiVersion[, variantSelector])` key.\n *\n * Pass an ordered selector for variants; omit it for ordinary resources.\n * Re-registering the same constructor for the\n * same key is a silent no-op so module-graph re-entry (test\n * harnesses, dual-format builds) is safe. Registering a *different*\n * constructor for an existing key throws — that's a genuine conflict\n * (e.g. two packages claiming the same ARM type).\n *\n * A `(resourceType, apiVersion)` pair is either entirely flat or entirely\n * variant-based. Attempting to mix both modes throws,\n * preserving the invariant the deserializer relies on.\n */\nexport function registerResource(ctor: ResourceCtor, variantSelector?: FlatVariantSelector): void {\n getRegistry().register(ctor.resourceType, ctor.apiVersion, ctor, variantSelector);\n}\n\n/**\n * Resolve the registered class for a wire resource.\n *\n * Default is best-effort:\n * 1. Try the exact `(type, apiVersion)` entry and match its selectors\n * against ARM-side keys in `state`.\n * 2. On miss, retry with the highest registered version of each selector.\n *\n * Pass `{ strict: true }` to skip step 2 and require an exact match.\n *\n * Returns `undefined` when nothing matches — callers (notably the\n * deserializer) then fall back to constructing a base `Resource`.\n */\nexport function resolveResource(\n type: string,\n apiVersion: string,\n state?: Record<string, unknown>,\n options?: ResolveOptions,\n): ResourceCtor | undefined {\n return getRegistry().resolve(type, apiVersion, state ?? {}, {\n strict: options?.strict ?? false,\n valueKeyedBy: \"arm\",\n });\n}\n"]}
@@ -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"}
@@ -3,14 +3,12 @@
3
3
  import { ResourceGroup } from "../built-in-resources/resource-group.js";
4
4
  import { unwrapResourceHandle } from "./resource-proxy.js";
5
5
  import { isResourceDeclaration } from "./resource-utils.js";
6
- import { isExpressionNode, } from "../../expression/ast-nodes.js";
6
+ import { isExpressionNode } from "../../expression/ast-nodes.js";
7
7
  /** Finds the nearest resource parent, excluding resource-group containment. */
8
8
  export function getArmParent(resource) {
9
9
  for (let parent = resource.parent; parent !== undefined; parent = parent.parent) {
10
10
  if (isResourceDeclaration(parent)) {
11
- return parent.type === ResourceGroup.resourceType
12
- ? undefined
13
- : parent.self;
11
+ return parent.type === ResourceGroup.resourceType ? undefined : parent.self;
14
12
  }
15
13
  }
16
14
  return undefined;
@@ -18,8 +16,7 @@ export function getArmParent(resource) {
18
16
  /** Finds the resource group containing the authored resource. */
19
17
  export function getResourceGroupAncestor(resource) {
20
18
  for (let current = resource.parent; current !== undefined; current = current.parent) {
21
- if (isResourceDeclaration(current) &&
22
- current.type === ResourceGroup.resourceType) {
19
+ if (isResourceDeclaration(current) && current.type === ResourceGroup.resourceType) {
23
20
  return current.self;
24
21
  }
25
22
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-relationships.js","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-relationships.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAuB,MAAM,+BAA+B,CAAC;AAEtF,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAAC,QAA6B;IACxD,KAAK,IAAI,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAChF,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,OAAO,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAC9E,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,wBAAwB,CACtC,QAA6B;IAE7B,KAAK,IAAI,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QACpF,IAAI,qBAAqB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,KAAK,aAAa,CAAC,YAAY,EAAE,CAAC;YAClF,OAAO,OAAO,CAAC,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,QAA6B;IAC5D,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5E,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,wCAAwC,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ResourceGroup } from \"../built-in-resources/resource-group.js\";\nimport { unwrapResourceHandle } from \"./resource-proxy.js\";\nimport { isResourceDeclaration } from \"./resource-utils.js\";\nimport type { ResourceDeclaration } from \"./resource.js\";\nimport { isExpressionNode, type ExpressionNode } from \"../../expression/ast-nodes.js\";\n\n/** Finds the nearest resource parent, excluding resource-group containment. */\nexport function getArmParent(resource: ResourceDeclaration): ResourceDeclaration | undefined {\n for (let parent = resource.parent; parent !== undefined; parent = parent.parent) {\n if (isResourceDeclaration(parent)) {\n return parent.type === ResourceGroup.resourceType ? undefined : parent.self;\n }\n }\n return undefined;\n}\n\n/** Finds the resource group containing the authored resource. */\nexport function getResourceGroupAncestor(\n resource: ResourceDeclaration,\n): ResourceDeclaration | undefined {\n for (let current = resource.parent; current !== undefined; current = current.parent) {\n if (isResourceDeclaration(current) && current.type === ResourceGroup.resourceType) {\n return current.self;\n }\n }\n return undefined;\n}\n\n/** Reads an explicit scope expression without creating a resource-property reference. */\nexport function getResourceScope(resource: ResourceDeclaration): ExpressionNode | undefined {\n const scope: unknown = Reflect.get(unwrapResourceHandle(resource), \"scope\");\n if (scope === undefined) return undefined;\n if (!isExpressionNode(scope)) {\n throw new Error(`Invalid authored scope for resource \"${resource.type}\".`);\n }\n return scope;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-type-registry.d.ts","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-type-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,SAAS,cAAc,EAAE,CAAC;AAE5D,qEAAqE;AACrE,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,mBAAm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AAC,GAAG,SAAS,CASf"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-type-registry.js","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-type-registry.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA8ClC,2EAA2E;AAC3E,MAAM,OAAO,oBAAoB;IACtB,MAAM,GAAG,IAAI,GAAG,EAAwC,CAAC;IACzD,QAAQ,GAAG,IAAI,GAAG,EAAyD,CAAC;IAErF,QAAQ,CACN,YAAoB,EACpB,UAAkB,EAClB,MAAS,EACT,eAAqC;QAErC,MAAM,QAAQ,GAAG,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;QACvE,MAAM,QAAQ,GAAG,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;QAClE,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAErD,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC3C,UAAU,CAAC,YAAY,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QACjD,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvD,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,CACL,YAAoB,EACpB,UAAkB,EAClB,KAA8B,EAC9B,OAA2C;QAE3C,MAAM,KAAK,GAAG,YAAY,CACxB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,EACjE,KAAK,EACL,OAAO,CAAC,YAAY,CACrB,CAAC;QACF,IAAI,KAA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AC,CAAC;AACX,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,kBAAkB,CAChC,OAA+C,EAC/C,KAA0C,EAC1C,YAA0B;IAE1B,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAE7B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC,MAAM,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,eAAe,CACtB,QAA6B,EAC7B,KAA8B,EAC9B,YAA0B;IAE1B,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE;QACjD,MAAM,GAAG,GAAG,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC;QACjF,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { DiscriminatorNames } from \"../../shape/shape.js\";\n\n/** One discriminator pinned to a fixed value by a concrete flat variant. */\nexport interface FlatVariantPin {\n readonly discriminator: DiscriminatorNames;\n readonly value: string;\n}\n\n/** Pins selecting one concrete flat variant. */\nexport type FlatVariantSelector = readonly FlatVariantPin[];\n\n/** One concrete variant together with a selector that chooses it. */\nexport interface FlatVariantSelection<T> {\n readonly variant: T;\n readonly selector: FlatVariantSelector;\n}\n\n/** One selector-to-target record stored in a variant registry bucket. */\nexport interface FlatVariantRegistryEntry<T> {\n readonly selector: FlatVariantSelector;\n readonly target: T;\n}\n\n/** One `(resourceType, apiVersion)` registry bucket. */\nexport type ResourceTypeRegistryEntry<T> =\n | {\n readonly kind: \"flat\";\n readonly target: T;\n }\n | {\n readonly kind: \"variants\";\n readonly variants: FlatVariantRegistryEntry<T>[];\n };\n\nexport interface ResourceTypeRegistryResolveOptions {\n readonly strict: boolean;\n readonly valueKeyedBy: \"js\" | \"arm\";\n}\n\ninterface VersionedTarget<T> {\n readonly apiVersion: string;\n readonly target: T;\n}\n\n/** Registry for versioned resource-type targets with optional variants. */\nexport class ResourceTypeRegistry<T> {\n readonly #exact = new Map<string, ResourceTypeRegistryEntry<T>>();\n readonly #highest = new Map<string, ResourceTypeRegistryEntry<VersionedTarget<T>>>();\n\n register(\n resourceType: string,\n apiVersion: string,\n target: T,\n variantSelector?: FlatVariantSelector,\n ): void {\n const selector = variantSelector?.length ? variantSelector : undefined;\n const exactKey = resourceTypeVersionKey(resourceType, apiVersion);\n const exactEntry = this.#exact.get(exactKey);\n const highestEntry = this.#highest.get(resourceType);\n\n assertMode(exactEntry, selector, exactKey);\n assertMode(highestEntry, selector, resourceType);\n registerExact(this.#exact, exactKey, target, selector);\n this.#updateHighest(resourceType, apiVersion, target, selector);\n }\n\n resolve(\n resourceType: string,\n apiVersion: string,\n state: Record<string, unknown>,\n options: ResourceTypeRegistryResolveOptions,\n ): T | undefined {\n const exact = resolveEntry(\n this.#exact.get(resourceTypeVersionKey(resourceType, apiVersion)),\n state,\n options.valueKeyedBy,\n );\n if (exact !== undefined || options.strict) return exact;\n\n const fallback = resolveEntry(this.#highest.get(resourceType), state, options.valueKeyedBy);\n return fallback?.target;\n }\n\n #updateHighest(\n resourceType: string,\n apiVersion: string,\n target: T,\n selector: FlatVariantSelector | undefined,\n ): void {\n const entry = this.#highest.get(resourceType);\n const versionedTarget = { apiVersion, target };\n\n if (!entry) {\n this.#highest.set(\n resourceType,\n selector\n ? {\n kind: \"variants\",\n variants: [{ selector: [...selector], target: versionedTarget }],\n }\n : { kind: \"flat\", target: versionedTarget },\n );\n return;\n }\n\n if (entry.kind === \"flat\") {\n if (apiVersionCompare(apiVersion, entry.target.apiVersion) > 0) {\n this.#highest.set(resourceType, {\n kind: \"flat\",\n target: versionedTarget,\n });\n }\n return;\n }\n\n const selectorKey = flatVariantSelectorKey(selector!);\n const priorIndex = entry.variants.findIndex(\n (variant) => flatVariantSelectorKey(variant.selector) === selectorKey,\n );\n const prior = entry.variants[priorIndex];\n if (!prior) {\n entry.variants.push({\n selector: [...selector!],\n target: versionedTarget,\n });\n } else if (apiVersionCompare(apiVersion, prior.target.apiVersion) > 0) {\n entry.variants[priorIndex] = {\n selector: [...selector!],\n target: versionedTarget,\n };\n }\n }\n}\n\nfunction assertMode<T>(\n entry: ResourceTypeRegistryEntry<T> | undefined,\n selector: FlatVariantSelector | undefined,\n key: string,\n): void {\n if (!entry) return;\n if (!selector && entry.kind === \"variants\") {\n throw new Error(`Cannot register flat target for ${key}: variants are already registered.`);\n }\n if (selector && entry.kind === \"flat\") {\n throw new Error(\n `Cannot register variant target for ${key}: a flat target is already registered.`,\n );\n }\n}\n\nfunction registerExact<T>(\n entries: Map<string, ResourceTypeRegistryEntry<T>>,\n key: string,\n target: T,\n selector: FlatVariantSelector | undefined,\n): void {\n const entry = entries.get(key);\n if (!entry) {\n entries.set(\n key,\n selector\n ? {\n kind: \"variants\",\n variants: [{ selector: [...selector], target }],\n }\n : { kind: \"flat\", target },\n );\n return;\n }\n\n if (entry.kind === \"flat\") {\n if (entry.target !== target) {\n throw new Error(`Conflicting flat target registration for ${key}.`);\n }\n return;\n }\n\n const selectorKey = flatVariantSelectorKey(selector!);\n const existing = entry.variants.find(\n (variant) => flatVariantSelectorKey(variant.selector) === selectorKey,\n );\n if (existing) {\n if (existing.target !== target) {\n throw new Error(`Conflicting variant target registration for ${key}@${selectorKey}.`);\n }\n return;\n }\n entry.variants.push({ selector: [...selector!], target });\n}\n\nfunction resolveEntry<T>(\n entry: ResourceTypeRegistryEntry<T> | undefined,\n state: Record<string, unknown>,\n valueKeyedBy: \"js\" | \"arm\",\n): T | undefined {\n if (!entry) return undefined;\n if (entry.kind === \"flat\") return entry.target;\n return resolveFlatVariant(entry.variants, state, valueKeyedBy);\n}\n\nfunction resourceTypeVersionKey(resourceType: string, apiVersion: string): string {\n return `${resourceType}@${apiVersion}`;\n}\n\n/** Compare ARM API versions for best-effort fallback selection. */\nfunction apiVersionCompare(left: string, right: string): number {\n if (left === right) return 0;\n if (right.startsWith(`${left}-`)) return 1;\n if (left.startsWith(`${right}-`)) return -1;\n return left < right ? -1 : 1;\n}\n\n/**\n * Stable identity for duplicate detection and version indexes.\n * Pins are sorted in the key because the matched state is flat and selector\n * matching is a conjunction of discriminator/value pairs, independent of\n * hierarchy order. The selector itself is not mutated.\n */\nexport function flatVariantSelectorKey(selector: FlatVariantSelector): string {\n const pins = selector.map(\n ({ discriminator, value }) => [discriminator.jsName, discriminator.armName, value] as const,\n );\n pins.sort(comparePinTuples);\n return JSON.stringify(pins);\n}\n\nfunction comparePinTuples(\n left: readonly [string, string, string],\n right: readonly [string, string, string],\n): number {\n for (let index = 0; index < left.length; index++) {\n if (left[index]! < right[index]!) return -1;\n if (left[index]! > right[index]!) return 1;\n }\n return 0;\n}\n\n/** Resolve the first registered selector exactly matched by `state`. */\nexport function resolveFlatVariant<T>(\n entries: readonly FlatVariantRegistryEntry<T>[],\n state: Record<string, unknown> | undefined,\n valueKeyedBy: \"js\" | \"arm\",\n): T | undefined {\n if (!state) return undefined;\n\n for (const entry of entries) {\n if (matchesSelector(entry.selector, state, valueKeyedBy)) {\n return entry.target;\n }\n }\n return undefined;\n}\n\nfunction matchesSelector(\n selector: FlatVariantSelector,\n state: Record<string, unknown>,\n valueKeyedBy: \"js\" | \"arm\",\n): boolean {\n return selector.every(({ discriminator, value }) => {\n const key = valueKeyedBy === \"js\" ? discriminator.jsName : discriminator.armName;\n return state[key] === value;\n });\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-utils.d.ts","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-utils.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AAEH,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,QAAQ,CAIpD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,mBAAmB,CAM1E;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,CAM1E;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAE1F;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,QAAQ,EACnD,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GACpB,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAExB"}
@@ -18,9 +18,7 @@ import { RESOURCE_BRAND, RESOURCE_DECLARATION_BRAND, LOOPED_RESOURCE_BRAND, } fr
18
18
  */
19
19
  /** Is `x` a scalar {@link Resource} (not a looped declaration)? */
20
20
  export function isResource(x) {
21
- return (typeof x === "object" &&
22
- x !== null &&
23
- x[RESOURCE_BRAND] === true);
21
+ return (typeof x === "object" && x !== null && x[RESOURCE_BRAND] === true);
24
22
  }
25
23
  /**
26
24
  * Is `x` a Bicep resource declaration — either a scalar {@link Resource} or
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-utils.js","sourceRoot":"","sources":["../../../../src/constructs/resource/resource-utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAI7B;;;;;;;;;;;;;;GAcG;AAEH,mEAAmE;AACnE,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAK,CAA6B,CAAC,cAAc,CAAC,KAAK,IAAI,CAC/F,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,CAAU;IAC9C,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACT,CAA6B,CAAC,0BAA0B,CAAC,KAAK,IAAI,CACpE,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,gBAAgB,CAAC,CAAU;IACzC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACT,CAA6B,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAC/D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY,CAAqB,CAAU,EAAE,IAAqB;IAChF,OAAO,CAAC,YAAY,IAAI,CAAC;AAC3B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,CAAU,EACV,IAAqB;IAErB,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAK,CAAC,CAAC,WAAuB,KAAK,IAAI,CAAC;AACpE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n RESOURCE_BRAND,\n RESOURCE_DECLARATION_BRAND,\n LOOPED_RESOURCE_BRAND,\n} from \"./resource-proxy.js\";\nimport type { Resource, ResourceDeclaration, LoopedResource } from \"./resource.js\";\nimport type { ResourceCtor } from \"./resource-registry.js\";\n\n/**\n * Cross-realm-safe brand guards for resource declarations.\n *\n * These live in a standalone module — importing only the brand **symbols**\n * (from `resource-proxy.ts`) and `resource.ts` **types** — so tree-walking\n * utilities (e.g. the query layer, `ProvisioningComponent`) can identify resources\n * WITHOUT a runtime import of `resource.ts`, which `extends ProvisioningComponent` and\n * would otherwise create an eval-time import cycle\n * (`ProvisioningComponent` → `query` → `resource` → `ProvisioningComponent`).\n *\n * The public guard API is these standalone functions (`isResource`,\n * `isResourceDeclaration`, `isLoopedResource`, `isResourceOf`,\n * `isLoopedResourceOf`) — there are no class-static guards, so a subclass\n * like `Secret` never inherits a misleading `Secret.isResource(...)`.\n */\n\n/** Is `x` a scalar {@link Resource} (not a looped declaration)? */\nexport function isResource(x: unknown): x is Resource {\n return (\n typeof x === \"object\" && x !== null && (x as Record<symbol, unknown>)[RESOURCE_BRAND] === true\n );\n}\n\n/**\n * Is `x` a Bicep resource declaration — either a scalar {@link Resource} or\n * a {@link LoopedResource}?\n */\nexport function isResourceDeclaration(x: unknown): x is ResourceDeclaration {\n return (\n typeof x === \"object\" &&\n x !== null &&\n (x as Record<symbol, unknown>)[RESOURCE_DECLARATION_BRAND] === true\n );\n}\n\n/** Is `x` a {@link LoopedResource} (`Ctor.fromLoop(...)`)? */\nexport function isLoopedResource(x: unknown): x is LoopedResource<Resource> {\n return (\n typeof x === \"object\" &&\n x !== null &&\n (x as Record<symbol, unknown>)[LOOPED_RESOURCE_BRAND] === true\n );\n}\n\n/**\n * Type guard: is `x` an instance of the resource class `ctor`?\n * Narrows `x` to the class's instance type, so callers can access\n * subclass-specific accessors (e.g. `kv.secrets`) inside the guarded\n * block.\n *\n * Accepts any value (`unknown`), like the other brand guards. A\n * `LoopedResource<T>` is not a `Resource`, so `instanceof ctor` returns\n * `false` for it — the narrowing is safe. `instanceof` alone is sufficient\n * (and stricter than a brand + ARM-type-string check: a base-`Resource`\n * impostor carrying the same `type`/`apiVersion` is correctly rejected), so\n * no `isResource` pre-check is needed.\n *\n * Matches scalar resource **declarations** (from a constructor / query /\n * collection). It does NOT match a `parent.at(i)` element reference of a\n * looped declaration: that proxy intentionally keeps `LoopedResource`'s\n * prototype (no `getPrototypeOf` trap), so `instanceof` is `false` for it\n * even though its ARM reads work. If we ever need cross-realm subclass\n * matching (per-subclass `Symbol.for` brands, mirroring the base\n * `RESOURCE_BRAND`), this is the one place to swap.\n */\nexport function isResourceOf<T extends Resource>(x: unknown, ctor: ResourceCtor<T>): x is T {\n return x instanceof ctor;\n}\n\n/**\n * Type guard: is `x` a {@link LoopedResource} whose wrapped resource class is\n * `ctor` (i.e. a `LoopedResource<T>` produced by `T.fromLoop(...)`)? Narrows\n * `x` to `LoopedResource<T>`, the looped analogue of {@link isResourceOf}.\n *\n * Matches on the declaration's `wrappedCtor` identity — the concrete subclass\n * passed to `fromLoop` — so `isLoopedResourceOf(x, StorageAccount)`\n * replaces the `x.wrappedCtor === StorageAccount` checks scattered across the\n * query / collection layers.\n */\nexport function isLoopedResourceOf<T extends Resource>(\n x: unknown,\n ctor: ResourceCtor<T>,\n): x is LoopedResource<T> {\n return isLoopedResource(x) && (x.wrappedCtor as unknown) === ctor;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../../src/constructs/resource/resource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,0BAA0B,EAC1B,qBAAqB,EAStB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sB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Ac,CAAC,CAAC,CAAC,CA6BnB"}
@@ -4,10 +4,10 @@ import { ProvisioningComponent } from "../provisioning-component.js";
4
4
  import { createBinaryExpression, unwrapExpression, wrapExpression, } from "../../expression/expressions.js";
5
5
  import { symbolicValueExpressionNode } from "../../expression/ast-nodes.js";
6
6
  import { assertValidResourceName } from "../../naming/name-validation.js";
7
- import { namingRequiredPolicy, generateResourceName, } from "../../naming/naming-policy.js";
7
+ import { namingRequiredPolicy, generateResourceName } from "../../naming/naming-policy.js";
8
8
  import { RAW_RESOURCE_HANDLE, RESOURCE_BRAND, RESOURCE_DECLARATION_BRAND, LOOPED_RESOURCE_BRAND, PROXY_INDEX_REF, INDEXED_PROXY_TARGET, STATE_PARENT_INDEX, createIndexedResourceProxy, createResourceMemberProxy, createResourceProxy, normalizeAssignedValue, unwrapResourceHandle, } from "./resource-proxy.js";
9
9
  import { isResourceDeclaration } from "./resource-utils.js";
10
- import { getShape, registerShape as registerShapeInRegistry, } from "../../shape/shape-registry.js";
10
+ import { getShape, registerShape as registerShapeInRegistry } from "../../shape/shape-registry.js";
11
11
  import { registerResource as registerResourceInRegistry, } from "./resource-registry.js";
12
12
  /**
13
13
  * Shared base for resource declaration implementations.
@@ -71,8 +71,7 @@ export class ResourceDeclaration extends ProvisioningComponent {
71
71
  // Automatic naming uses the authored rather than the discovered hierarchy.
72
72
  const nameSegments = namingRules !== undefined &&
73
73
  (armParent !== undefined || namingRules.nameSegments !== undefined)
74
- ? props.type.split("/").length -
75
- (armParent?.type.split("/").length ?? 1)
74
+ ? props.type.split("/").length - (armParent?.type.split("/").length ?? 1)
76
75
  : undefined;
77
76
  if (props.name !== undefined) {
78
77
  assertValidResourceName(props.name, props.type, namingRules);
@@ -118,9 +117,7 @@ export class ResourceDeclaration extends ProvisioningComponent {
118
117
  while (parent !== undefined && !isResourceDeclaration(parent)) {
119
118
  parent = parent.parent;
120
119
  }
121
- const inheritedCondition = isResourceDeclaration(parent)
122
- ? parent.condition
123
- : undefined;
120
+ const inheritedCondition = isResourceDeclaration(parent) ? parent.condition : undefined;
124
121
  const explicitCondition = options?.condition;
125
122
  const condition = explicitCondition !== undefined && inheritedCondition !== undefined
126
123
  ? createBinaryExpression("&&", inheritedCondition, explicitCondition)
@@ -191,8 +188,7 @@ export class ResourceDeclaration extends ProvisioningComponent {
191
188
  const shape = getShape(props.type, props.apiVersion, data);
192
189
  if (shape !== undefined) {
193
190
  const properties = Object.entries(shape.byJsName);
194
- const locationProperty = properties.find(([jsName, property]) => property.armPath.length <= 1 &&
195
- (property.armPath[0] ?? jsName) === "location");
191
+ const locationProperty = properties.find(([jsName, property]) => property.armPath.length <= 1 && (property.armPath[0] ?? jsName) === "location");
196
192
  const locationName = locationProperty?.[0];
197
193
  const locationShape = locationProperty?.[1];
198
194
  if (locationName !== undefined &&
@@ -202,8 +198,7 @@ export class ResourceDeclaration extends ProvisioningComponent {
202
198
  ctx.location !== undefined) {
203
199
  data[locationName] = ctx.location;
204
200
  }
205
- const tagsProperty = properties.find(([jsName, property]) => property.armPath.length <= 1 &&
206
- (property.armPath[0] ?? jsName) === "tags");
201
+ const tagsProperty = properties.find(([jsName, property]) => property.armPath.length <= 1 && (property.armPath[0] ?? jsName) === "tags");
207
202
  const tagsName = tagsProperty?.[0];
208
203
  const tagsShape = tagsProperty?.[1];
209
204
  if (tagsName !== undefined &&
@@ -569,7 +564,8 @@ export class LoopedResource extends ResourceDeclaration {
569
564
  if (props.name === undefined) {
570
565
  throw new Error(`Looped resource '${props.type}' requires an explicit per-iteration name.`);
571
566
  }
572
- const namingRules = wrappedCtor.namingRules;
567
+ const namingRules = wrappedCtor
568
+ .namingRules;
573
569
  wrappedCtor.validate.call(wrappedCtor, context, props, options, namingRules);
574
570
  super(context, props, options, namingRules);
575
571
  this.#wrappedCtor = wrappedCtor;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../../src/constructs/resource/resource.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,k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,WAAW,CAAC;QAChC,qEAAqE;QACrE,sEAAsE;QACtE,2EAA2E;QAC3E,0DAA0D;QAC1D,6DAA6D;QAC7D,qEAAqE;QACrE,yEAAyE;QACzE,IAAI,CAAC,IAAI,GAAG;YACV,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvE,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,WAAW;QAKb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;;;OASG;IACH,EAAE,CAAC,KAAgC;QACjC,qEAAqE;QACrE,qEAAqE;QACrE,qEAAqE;QACrE,+BAA+B;QAC/B,OAAO,0BAA0B,CAAoB,IAAI,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAClC,WAAuE,EACvE,IAAgB,EAChB,OAAU,EACV,GAAG,IAEsC;IAEzC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,IAA8B,CAAC;IAC5D,0EAA0E;IAC1E,oEAAoE;IACpE,MAAM,UAAU,GAAG,cAaG,CAAC;IACvB,OAAO,IAAI,UAAU,CACnB,OAAO,EACP,WAIM,EACN,SAAS,EACT,IAAI,EACJ,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProvisioningComponent } from \"../provisioning-component.js\";\nimport {\n createBinaryExpression,\n unwrapExpression,\n wrapExpression,\n type Expression,\n type ExpressionOrValue,\n} from \"../../expression/expressions.js\";\nimport type { ExpressionNode } from \"../../expression/ast-nodes.js\";\nimport { symbolicValueExpressionNode } from \"../../expression/ast-nodes.js\";\nimport type { PropertySegment } from \"../../types.js\";\nimport type { ResourceNamingRules } from \"../../naming/naming-rules.js\";\nimport { assertValidResourceName } from \"../../naming/name-validation.js\";\nimport { namingRequiredPolicy, generateResourceName } from \"../../naming/naming-policy.js\";\nimport {\n RAW_RESOURCE_HANDLE,\n RESOURCE_BRAND,\n RESOURCE_DECLARATION_BRAND,\n LOOPED_RESOURCE_BRAND,\n PROXY_INDEX_REF,\n INDEXED_PROXY_TARGET,\n STATE_PARENT_INDEX,\n createIndexedResourceProxy,\n createResourceMemberProxy,\n createResourceProxy,\n normalizeAssignedValue,\n unwrapResourceHandle,\n} from \"./resource-proxy.js\";\nimport { isResourceDeclaration } from \"./resource-utils.js\";\nimport type { FlatModelShape } from \"../../shape/shape.js\";\nimport { getShape, registerShape as registerShapeInRegistry } from \"../../shape/shape-registry.js\";\nimport {\n registerResource as registerResourceInRegistry,\n type ResourceCtor,\n} from \"./resource-registry.js\";\nimport type { FlatVariantSelector } from \"./resource-type-registry.js\";\n\n// ---------------------------------------------------------------------------\n// Resource types\n// ---------------------------------------------------------------------------\n\n/**\n * A Bicep `scope:` expression. Used on `existing` resource references for\n * cross-RG / cross-subscription / cross-MG / cross-tenant lookups, and on\n * modules to set the nested deployment scope.\n *\n * Typed as `Expression<unknown>` because the natural producers are the\n * scope-function helpers in `fn` (`fn.resourceGroup(...)`,\n * `fn.subscription(...)`, `fn.managementGroup(...)`, `fn.tenant()`), all\n * of which return `Expression<TScope>` proxies. Narrowing further isn't\n * worthwhile today since the set of acceptable scope-producing\n * expressions isn't closed and Bicep validates the actual call shape\n * downstream.\n */\n// TODO: further narrow to allowed expression if possible?\nexport type ScopeExpression = Expression<unknown>;\n\n/**\n * Internal representation used to construct resource handle objects.\n * The proxy converts these into the public Resource shape.\n */\nexport interface ResourceState<TType extends string = string> {\n name: ExpressionOrValue<string>;\n readonly type: TType;\n readonly apiVersion: string;\n readonly existing?: boolean | undefined;\n /**\n * Explicit scope expression. Authoring populates this for existing-resource\n * lookups; restoration can retain uninterpreted scope expressions on any\n * declaration. Expressions are normalized to raw nodes.\n *\n * New-resource authoring still derives placement from the Stack and parent\n * context rather than accepting an explicit scope override.\n */\n readonly scope?: ExpressionNode | undefined;\n readonly condition?: ExpressionOrValue<boolean> | undefined;\n}\n\n/**\n * Public-facing props for a reference to an existing (pre-deployed) Azure\n * resource. This is strictly narrower than the deployable resource props —\n * Bicep `existing` declarations only accept `name` and optional `scope:`.\n *\n * Read-side access on the returned resource handle is unrestricted —\n * `kv.properties.vaultUri`, `sa.id`, etc. all work and compile to symbolic\n * references that ARM resolves at deployment time.\n *\n * Symbolic parent/extension scopes are expressed by passing the parent\n * resource as the ProvisioningComponent `context` argument to the resource constructor\n * (with `{ existing: true }`), not via this `scope` field.\n */\nexport interface ExistingResourceProps<TName extends string = string> {\n /** Required. The actual Azure name of the existing resource. */\n readonly name: ExpressionOrValue<TName>;\n\n /**\n * Optional. The scope at which to look up the resource. Used when the\n * resource lives outside the current deployment's scope (different RG,\n * subscription, management group, or tenant).\n *\n * Pass a scope-function call expression (e.g. `resourceGroup(\"name\")`,\n * `subscription()`, `managementGroup(\"mg\")`, `tenant()`).\n */\n readonly scope?: ScopeExpression;\n}\n\n/**\n * `ExistingResourceProps` for singleton child resources — `name` is omitted\n * because singleton children have a fixed name (e.g. `\"default\"`).\n */\nexport type SingletonExistingResourceProps = Omit<ExistingResourceProps, \"name\">;\n\n/**\n * Internal props accepted by the base `Resource` constructor. A loose\n * superset of both the deployable and existing public shapes — the runtime\n * constructor branches on `props.existing` to decide which fields are\n * honored. Generated CDK resource classes expose a discriminated union\n * `(Deployable & { existing?: false }) | (Existing & { existing: true })`;\n * passing `{ ...existingProps, existing: true }` selects the existing arm and\n * emits a Bicep `existing` reference instead of a new declaration.\n */\nexport interface ResourceProps<TType extends string> {\n readonly name?: ExpressionOrValue<string> | undefined;\n readonly apiVersion: string;\n readonly type: TType;\n\n readonly existing?: boolean;\n\n /**\n * Optional Bicep `scope:` value for an existing resource reference.\n * Only honored when `existing === true`. Ignored on deployable resources\n * (non-existing resources have no per-resource scope in Bicep).\n */\n readonly scope?: ScopeExpression;\n}\n\n/**\n * Optional third-argument bag passed to every resource constructor. Holds\n * authoring flags that affect how the resource declaration is emitted but are\n * not ARM-modeled properties of the resource body.\n *\n * Fields:\n * - `condition` — an `if(...)` guard on the declaration. A boolean\n * expression (typically produced by `fn.eq`, `fn.and`, etc.) or a\n * plain `boolean`. Bind it to a `const` to reuse the same predicate\n * across multiple resources.\n *\n * `existing` is deliberately **not** an option — it is the discriminant of\n * the generated props union (`{ existing?: false } | { existing: true }`)\n * and lives on `props`. Routing it through options too would allow\n * contradictory settings between the two channels.\n *\n * `namingRules` is deliberately **not** an option either — it is\n * per-resource-type metadata declared as a `protected static namingRules`\n * field on each concrete `Resource` subclass and consumed by the base\n * constructor reflectively, so it stays off the user-facing surface.\n *\n */\nexport interface ResourceOptions {\n readonly condition?: ExpressionOrValue<boolean>;\n readonly dependsOn?: readonly ResourceDeclaration[];\n}\n\n/**\n * Shared base for resource declaration implementations.\n *\n * @remarks\n *\n * Both represent one Bicep resource declaration in the component tree and\n * share the same declaration-level state layout: identity fields\n * (`type`, `apiVersion`, `existing`), the `if(...)` guard (`condition`),\n * the optional cross-scope reference (`scope`), and the raw prop bag that\n * becomes the resource body.\n *\n * This class owns the common declaration state layout, raw-handle escape\n * hatch, and identity accessors. Subclasses supply their construction and\n * access behavior.\n */\nexport abstract class ResourceDeclaration<\n TType extends string = string,\n> extends ProvisioningComponent {\n protected readonly namingRules: ResourceNamingRules | undefined;\n /**\n * Brand marker for cross-realm `isResourceDeclaration()` checks. Uses\n * `Symbol.for` so it survives multiple copies of `@azure/provisioning-core`.\n * Inherited by every resource declaration implementation.\n */\n readonly [RESOURCE_DECLARATION_BRAND] = true as const;\n\n // Not `readonly`: the ctor writes `this.state = data` once. TypeScript\n // forbids subclass writes to a `readonly` parent field, so the\n // immutability is a runtime contract (never reassigned after ctor)\n // rather than a static one.\n protected state!: ResourceState<TType> & Record<string, unknown>;\n\n /**\n * Base constructor for every Bicep resource declaration.\n *\n * @remarks\n *\n * Responsibilities:\n * 1. Register in the component tree (`super(context)`).\n * 2. Enforce a deployment context ancestor.\n * 3. Unwrap `context` if it's an indexed proxy from `.at(i)` /\n * `parent.at(loop.index)`, and stash `parentIndex` on `state` so the\n * serializer can emit `parent: parentSym[index]` on the child.\n * 4. Inherit `condition` from the immediate parent resource\n * declaration when the caller doesn't supply one (Bicep requires\n * children of a conditional resource to share the same guard).\n * 5. Populate `state` — existing arm records only identity fields;\n * deployable arm runs the naming policy and applies\n * `DeploymentContext` defaults for `location` / `tags` per the\n * shape descriptor.\n *\n * Subclasses supply the last mile, including their public handle behavior.\n *\n * @param namingRules - per-resource-type constraints for the naming\n * policy. `Resource` reads this reflectively off the concrete subclass\n * constructor; internal declaration implementations receive it from\n * the concrete resource constructor they represent.\n */\n constructor(\n context: ProvisioningComponent,\n props: ResourceProps<TType> & Record<string, unknown>,\n options?: ResourceOptions,\n namingRules?: ResourceNamingRules,\n ) {\n const armParent =\n isResourceDeclaration(context) &&\n props.type.toLowerCase().startsWith(context.type.toLowerCase() + \"/\")\n ? context\n : undefined;\n // Automatic naming uses the authored rather than the discovered hierarchy.\n const nameSegments =\n namingRules !== undefined &&\n (armParent !== undefined || namingRules.nameSegments !== undefined)\n ? props.type.split(\"/\").length - (armParent?.type.split(\"/\").length ?? 1)\n : undefined;\n if (props.name !== undefined) {\n assertValidResourceName(props.name, props.type, namingRules);\n }\n super(context);\n this.namingRules = namingRules;\n\n if (!this.hasDeploymentContext()) {\n throw new Error(\"Resource declaration must have a parent deployment context.\");\n }\n\n // If `context` is an indexed proxy returned by\n // `LoopedResource.at(i)`, unwrap `this.parent`\n // back to the raw parent so tree walks and symbol-map lookups continue\n // to work, and capture the index so the serializer can emit\n // `parent: parentSym[index]` on this child. The `ProvisioningComponent` constructor\n // already pushed `this` into the correct children array (indexed proxy\n // passes `.children` through to the raw parent's array), so nothing to\n // fix up there.\n //\n // The index is recorded on the child's state (not the parent's) because\n // siblings can have different indices — `new Child(p.at(0), …)` and\n // `new Child(p.at(1), …)` both resolve `.parent` to the same raw parent,\n // so the index that distinguishes them must be per-child.\n const indexRef = (context as unknown as Record<symbol, unknown>)[PROXY_INDEX_REF];\n let parentIndex: unknown = undefined;\n if (indexRef !== undefined) {\n const rawParent = (context as unknown as Record<symbol, unknown>)[INDEXED_PROXY_TARGET] as\n ProvisioningComponent | undefined;\n if (rawParent !== undefined) {\n (this as unknown as { parent: ProvisioningComponent | undefined }).parent = rawParent;\n }\n parentIndex = indexRef;\n }\n\n // `existing` lives on `props` (it's the discriminant of the generated\n // `{ existing?: false } | { existing: true }` union). `condition` is\n // routed through `options`.\n //\n // Bicep requires a child of a conditional resource to itself be\n // conditional on the same expression. When no explicit `condition` is\n // supplied, inherit the nearest parent resource declaration's\n // condition so the emitted template stays valid — child authoring\n // shouldn't have to redundantly restate the parent's guard.\n const isExisting = props.existing === true;\n let parent = this.parent;\n while (parent !== undefined && !isResourceDeclaration(parent)) {\n parent = parent.parent;\n }\n const inheritedCondition = isResourceDeclaration(parent) ? parent.condition : undefined;\n const explicitCondition = options?.condition;\n const condition =\n explicitCondition !== undefined && inheritedCondition !== undefined\n ? createBinaryExpression<boolean>(\"&&\", inheritedCondition, explicitCondition)\n : (explicitCondition ?? inheritedCondition);\n const dependsOn = options?.dependsOn;\n\n let data: ResourceState<TType> & Record<string, unknown>;\n if (isExisting) {\n // Existing arm: only name + optional scope land in state. Any other\n // keys on the props object are ignored — the deserialize path may pass\n // them through, but they're never emitted on an `existing` resource.\n if (props.name === undefined) {\n throw new Error(`Resource ${props.type} marked as 'existing' but no 'name' was provided.`);\n }\n data = {\n name: props.name,\n type: props.type,\n apiVersion: props.apiVersion,\n existing: true,\n scope: props.scope === undefined ? undefined : unwrapExpression(props.scope),\n condition,\n dependsOn,\n };\n if (parentIndex !== undefined) {\n data[STATE_PARENT_INDEX] = parentIndex;\n }\n } else {\n // Deployable arm: name flows through the naming policy; the keys\n // handled explicitly here are stripped from the props bag, and\n // every remaining key is copied verbatim into state as a user-\n // authored property.\n const {\n name: _name,\n type: _type,\n apiVersion: _apiVersion,\n existing: _existing,\n scope: _scope,\n ...userProps\n } = props as ResourceProps<TType> & Record<string, unknown>;\n const ctx = this.deploymentContext;\n let resolvedName: ExpressionOrValue<string>;\n try {\n resolvedName =\n props.name ??\n generateResourceName(\n ctx.namingPolicy ?? namingRequiredPolicy,\n props.type,\n namingRules,\n nameSegments,\n );\n } catch (error) {\n // A rejected generated name must not leave a partial declaration\n // registered in its parent's tree.\n const index = this.parent?.children.indexOf(this) ?? -1;\n if (index >= 0) this.parent!.children.splice(index, 1);\n throw error;\n }\n data = {\n name: resolvedName,\n type: props.type,\n apiVersion: props.apiVersion,\n condition,\n dependsOn,\n ...userProps,\n };\n\n if (parentIndex !== undefined) {\n data[STATE_PARENT_INDEX] = parentIndex;\n }\n\n // Apply DeploymentContext defaults for `location` and `tags`, gated\n // on the shape descriptor declaring those properties as writable.\n // The TypeSpec model is the source of truth: a field marked\n // readonly in the ARM contract (e.g. `location` on most child\n // resources) is server-set, so propagating an inherited value\n // would produce an invalid PUT body. Both fields are user-wins:\n // if the user supplied a value, the inherited value is ignored\n // entirely (no merge for tags either — explicit user tags fully\n // replace inherited tags).\n const shape = getShape(props.type, props.apiVersion, data);\n if (shape !== undefined) {\n const properties = Object.entries(shape.byJsName);\n const locationProperty = properties.find(\n ([jsName, property]) =>\n property.armPath.length <= 1 && (property.armPath[0] ?? jsName) === \"location\",\n );\n const locationName = locationProperty?.[0];\n const locationShape = locationProperty?.[1];\n if (\n locationName !== undefined &&\n locationShape !== undefined &&\n locationShape.readOnly !== true &&\n data[locationName] === undefined &&\n ctx.location !== undefined\n ) {\n data[locationName] = ctx.location;\n }\n const tagsProperty = properties.find(\n ([jsName, property]) =>\n property.armPath.length <= 1 && (property.armPath[0] ?? jsName) === \"tags\",\n );\n const tagsName = tagsProperty?.[0];\n const tagsShape = tagsProperty?.[1];\n if (\n tagsName !== undefined &&\n tagsShape !== undefined &&\n tagsShape.readOnly !== true &&\n data[tagsName] === undefined &&\n ctx.tags !== undefined &&\n Object.keys(ctx.tags).length > 0\n ) {\n data[tagsName] = { ...ctx.tags };\n }\n }\n }\n\n this.state = data;\n }\n\n /**\n * Core-internal escape hatch: exposes the raw `state` backing object to\n * the proxy layer (`resource-proxy.ts`) so it can read/unwrap the\n * declaration's data across module boundaries. Keyed by the\n * module-scoped {@link RAW_RESOURCE_HANDLE} symbol, which is **not**\n * exported from `@azure/provisioning-core`, so package consumers can't name it.\n *\n * `protected` (not `private`) because the accessors that read it use\n * `Reflect.get` / structural casts that bypass TS visibility anyway;\n * the modifier just keeps it off the public type surface. It can't be a\n * `#private` field because the proxy layer lives in a different class.\n *\n * @internal\n */\n protected get [RAW_RESOURCE_HANDLE](): ResourceState<TType> & Record<string, unknown> {\n return this.state;\n }\n\n get type(): TType {\n return this.state.type;\n }\n\n get apiVersion(): string {\n return this.state.apiVersion;\n }\n\n get existing(): boolean | undefined {\n return this.state.existing;\n }\n\n get condition(): ExpressionOrValue<boolean> | undefined {\n return this.state.condition;\n }\n\n get dependsOn(): readonly ResourceDeclaration[] | undefined {\n return this.state.dependsOn as readonly ResourceDeclaration[] | undefined;\n }\n\n protected expr<TValue>(...path: readonly PropertySegment[]): Expression<TValue> & TValue {\n return createResourceMemberProxy(\n {\n resource: this as unknown as Resource,\n root: unwrapResourceHandle(this as unknown as Resource) as unknown as Record<\n string,\n unknown\n >,\n },\n path,\n );\n }\n\n protected setProperty(key: string, value: unknown): void {\n if (key === \"name\") {\n assertValidResourceName(value, this.type, this.namingRules);\n }\n this.state[key] = normalizeAssignedValue(value, this as unknown as Resource);\n }\n}\n\n/**\n * Base class for all Azure resources.\n *\n * @remarks\n * Resources are fully initialized at construction time. Pass a parent\n * `ProvisioningComponent` (typically a `Stack` or `ResourceGroup`) as the first\n * argument — the resource registers itself in the tree automatically.\n *\n * Properties use expression-backed proxies: reading `resource.name`\n * returns an `Expression` that compiles to a Bicep symbolic reference,\n * not a plain string. Use `this.expr()` in subclasses to create\n * property getters and `this.setProperty()` for setters.\n *\n * @example\n * ```typescript snippet:ignore\n * import { ResourceGroup, Stack } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\", { targetScope: \"subscription\" });\n * const rg = new ResourceGroup(stack, { name: \"rg-my-app\", location: \"eastus\" });\n * const vault = new KeyVault(rg, {\n * name: \"kv-my-app\",\n * properties: {\n * tenantId: \"11111111-1111-1111-1111-111111111111\",\n * sku: { family: \"A\", name: \"standard\" },\n * },\n * });\n *\n * // vault.name is an Expression, not a string\n * // vault.id compiles to resourceId(...)\n * ```\n */\nexport class Resource<TType extends string = string> extends ResourceDeclaration<TType> {\n /**\n * Brand marker for cross-realm `isResource()` checks.\n * Uses `Symbol.for` so it survives multiple copies of `@azure/provisioning-core`.\n */\n readonly [RESOURCE_BRAND] = true as const;\n\n /**\n * Register a {@link FlatModelShape} for this resource class's\n * `(resourceType, apiVersion)` pair. Intended to be invoked from a\n * `static {}` initializer in generated subclasses so the registration\n * happens at module load.\n *\n * The static method reads `resourceType` and `apiVersion` off `this`\n * (the subclass that called it), so callers don't repeat the literals.\n */\n static registerShape(\n this: { readonly resourceType: string; readonly apiVersion: string },\n shape: FlatModelShape,\n variantSelector?: FlatVariantSelector,\n ): void {\n registerShapeInRegistry(this.resourceType, this.apiVersion, shape, variantSelector);\n }\n\n /**\n * Register this class with the global resource registry so the\n * deserializer can reconstruct instances of it (instead of falling\n * back to base `Resource`) for matching `(resourceType, apiVersion)`\n * pairs. Intended to be invoked from a `static {}` initializer in\n * generated classes alongside {@link Resource.registerShape}.\n *\n * Pass an ordered discriminator path for concrete resource variants. A\n * singleton is one segment (`name=signin`); model-discriminated resources\n * may use `kind` or several nested segments. Omit for ordinary resources.\n */\n protected static register(this: ResourceCtor, variantSelector?: FlatVariantSelector): void {\n registerResourceInRegistry(this, variantSelector);\n }\n\n /**\n * Assemble the base-`Resource` constructor payload (the second `super(...)`\n * argument) from the user-facing props. This is a **static \"virtual\"**:\n * it runs before an instance exists (to compute the `super` argument), so\n * it can't be an instance method — but it still dispatches through the\n * calling constructor, so a subclass's override wins.\n *\n * Every emitter-generated resource overrides this to inject its fixed\n * identity (`type` / `apiVersion`), the singleton `name`, and its explicit\n * writable-field copy. Both ordinary construction and internal resource\n * reconstruction funnel through this method so prop shaping remains\n * consistent.\n *\n * This base default is the fallback used when the wrapped constructor is\n * base `Resource` itself — the deserialize path for an unregistered\n * `(type, apiVersion)` pair, where `type` / `apiVersion` are threaded in\n * through `props` rather than read off statics. Keeping the default here\n * guarantees the method is always present for internal reconstruction.\n */\n protected static buildResourceProps(\n props?: unknown,\n ): ResourceProps<string> & Record<string, unknown> {\n const p = (props as Record<string, unknown> | undefined) ?? {};\n return {\n ...p,\n type:\n (p[\"type\"] as string | undefined) ??\n (this as unknown as { resourceType?: string }).resourceType,\n apiVersion:\n (p[\"apiVersion\"] as string | undefined) ??\n (this as unknown as { apiVersion?: string }).apiVersion,\n } as ResourceProps<string> & Record<string, unknown>;\n }\n\n /**\n * Per-resource-type naming constraints, consumed by the active\n * {@link NamingPolicy} when a resource is created without an explicit\n * `name`. Generated CDK subclasses override this with a concrete value;\n * the base default of `undefined` uses the default naming convention.\n *\n * This is type metadata, not user input, so it is kept off the public\n * props surface and read reflectively in the constructor via\n * `this.constructor` rather than being threaded through `ResourceProps`.\n */\n protected static namingRules?: ResourceNamingRules;\n\n /** Validates construction inputs before a scalar or looped declaration is registered. */\n protected static validate(\n _context: ProvisioningComponent,\n _props: ResourceProps<string> & Record<string, unknown>,\n _options?: ResourceOptions,\n _namingRules?: ResourceNamingRules,\n ): void {\n // Resource subclasses can impose additional construction constraints.\n }\n\n protected _selfProxy: this | undefined;\n\n constructor(\n context: ProvisioningComponent,\n props: ResourceProps<TType> & Record<string, unknown>,\n options?: ResourceOptions,\n ) {\n const namingRules = (new.target as typeof Resource).namingRules;\n (new.target as typeof Resource).validate(context, props, options, namingRules);\n super(context, props, options, namingRules);\n\n const proxy = createResourceProxy(this as this & Resource<TType>);\n this._selfProxy = proxy;\n\n // Tricky part for the proxy implementation:\n // ProvisioningComponent constructor pushed `this` (bare instance) into parent.children\n // before the proxy existed. Swap it for the proxy so external consumers\n // see proxy-backed handles (with property access, etc.) when iterating.\n const idx = context.children.indexOf(this);\n if (idx >= 0) context.children[idx] = proxy;\n\n return proxy;\n }\n\n override get self(): this {\n return this._selfProxy ?? this;\n }\n\n /**\n * The Azure resource name as a Bicep symbolic-reference expression.\n *\n * The value is established at construction time (either user-supplied\n * via `props.name` or filled in by the naming policy) and stored on\n * `state.name`. The setter routes through `setProperty` so post-\n * construction edits flow through the same proxy/expression machinery\n * as any other property — useful when working with a base `Resource`\n * reference and re-binding the name dynamically. Singleton subclasses\n * override this getter to narrow the return type to the literal\n * `Expression<\"<singletonName>\">`; non-singleton subclasses inherit\n * this accessor pair as-is.\n */\n get name(): Expression<string> {\n return this.expr(\"name\");\n }\n set name(value: ExpressionOrValue<string>) {\n this.setProperty(\"name\", value);\n }\n\n get id(): Expression<string> {\n return this.expr(\"id\");\n }\n}\n\n// ---------------------------------------------------------------------------\n// Loop\n// ---------------------------------------------------------------------------\n\n/**\n * Metadata describing a Bicep `[for … in …]` loop and the concrete\n * variable names used inside it. Stored publicly on {@link LoopedResource.loop}\n * once a looped resource declaration has been created.\n */\nexport interface LoopContext {\n readonly collection: unknown;\n readonly itemVariable: string;\n readonly indexVariable?: string;\n readonly batchSize?: number;\n}\n\n/**\n * Options accepted by `new Loop(collection, options?)`. All fields are\n * optional overrides; the constructor supplies defaults. Derived from\n * {@link LoopContext} so there is exactly one source of truth for the\n * shape of loop metadata.\n */\nexport type LoopOptions = Partial<Omit<LoopContext, \"collection\">>;\n\n/**\n * Describes a Bicep `[for item in collection: ...]` loop as a plain data\n * object. Construct one and pass it to\n * `Ctor.fromLoop(loop, context, props, options?)` (e.g.\n * `StorageAccount.fromLoop(...)`) to expand a resource declaration into a\n * resource-copy loop.\n *\n * The item and index variable names default to `item` / `i`. Bicep\n * for-expressions bind their loop variables only within their own body,\n * so two sibling `[for item in xs: …]` / `[for item in ys: …]` in the\n * same file do **not** collide — each `item` is scoped to its own\n * expression. If you nest a `Loop` inside another loop's body (rare),\n * pass `{ itemVariable, indexVariable }` explicitly on the inner one to\n * disambiguate. `batchSize` on the loop renders as `@batchSize(n)` on\n * the resource that consumes it.\n *\n * The `indexVariable` name is always materialized on read (never\n * `undefined`), but whether the wire actually **records** it — and\n * therefore whether the renderer emits the `[for (item, i) in …]` tuple\n * binding — is decided by whether anyone accessed `loop.index` (or the\n * caller supplied `{ indexVariable }` explicitly). A loop whose body\n * never mentions an index emits a bare `[for item in xs: …]`.\n *\n * `Loop` instances are pure data — creating one has no side effect.\n */\nexport class Loop<T> {\n readonly collection: ExpressionOrValue<T[]>;\n readonly itemVariable: string;\n readonly item: Expression<T>;\n readonly batchSize?: number;\n\n // The default name assigned to `indexVariable` on first materialization,\n // if the caller neither passed `{ indexVariable }` nor accessed `.index`.\n readonly #defaultIndexVariable: string;\n #indexVariable: string | undefined;\n #indexExpr: Expression<number> | undefined;\n #indexRequested = false;\n\n constructor(collection: ExpressionOrValue<T[]>, options?: LoopOptions) {\n this.collection = collection;\n\n this.itemVariable = options?.itemVariable ?? \"item\";\n this.#defaultIndexVariable = \"i\";\n\n if (options?.indexVariable !== undefined) {\n // Explicit option counts as a request — the wire and renderer must\n // honor the caller's chosen name whether or not they read `.index`.\n this.#indexVariable = options.indexVariable;\n this.#indexRequested = true;\n }\n if (options?.batchSize !== undefined) {\n this.batchSize = options.batchSize;\n }\n\n this.item = wrapExpression(symbolicValueExpressionNode(this.itemVariable)) as Expression<T>;\n }\n\n /**\n * Name of the loop's index variable. Always defined — reading it\n * materializes the default (`i`) if the caller neither passed\n * `{ indexVariable }` nor accessed `.index` yet.\n *\n * Reading `.indexVariable` also marks the index as requested (same as\n * reading `.index`), because a caller who wants the variable name is\n * almost certainly going to use it. If the wire-omit optimization\n * (bare `[for item in …]` with no index binding) matters, callers\n * should gate on `.indexRequested` first before touching this getter.\n */\n get indexVariable(): string {\n this.#indexRequested = true;\n if (this.#indexVariable === undefined) {\n this.#indexVariable = this.#defaultIndexVariable;\n }\n return this.#indexVariable;\n }\n\n /**\n * Expression referencing the current iteration's index. Reading this the\n * first time marks the index as requested, which causes the wire to\n * include `indexVariable` on the `for-expression` node and the renderer\n * to emit `[for (item, i) in …]`. Callers who never touch `.index` get\n * the cleaner index-less form.\n */\n get index(): Expression<number> {\n this.#indexRequested = true;\n if (this.#indexExpr === undefined) {\n const name = this.indexVariable;\n this.#indexExpr = wrapExpression(symbolicValueExpressionNode(name)) as Expression<number>;\n }\n return this.#indexExpr;\n }\n\n /**\n * Framework-internal signal used by `Resource.fromLoop` to decide\n * whether the wire should include the index binding. `true` when the\n * caller either supplied `{ indexVariable }` explicitly or has accessed\n * `.index` / `.indexVariable` at least once. Not exported from\n * `@azure/provisioning-core`.\n *\n * @internal\n */\n get indexRequested(): boolean {\n return this.#indexRequested;\n }\n}\n\n// ---------------------------------------------------------------------------\n// LoopedResource<T> — a Bicep for-expanded resource declaration as a real\n// ProvisioningComponent in the tree, sitting alongside scalar `Resource` under the same\n// `ResourceDeclaration` base.\n// ---------------------------------------------------------------------------\n\n/**\n * A `LoopedResource<T>` represents a single Bicep resource declaration\n * expanded across a loop (`[for x in xs: {...}]`). It is a real\n * `ProvisioningComponent` in the tree — one node per emitted declaration — and\n * exposes indexed access into individual iterations via\n * {@link LoopedResource.at}.\n *\n * @remarks\n *\n * Property access on a `LoopedResource` is deliberately not exposed at\n * the type level: pick an index (`at`) to obtain a proxy that emits\n * `sym[i].prop`. This mirrors Bicep's requirement that individual\n * iterations be accessed by index.\n *\n * `.at(i)` returns the concrete resource type `T`. The returned proxy\n * exposes the essential ARM surface — the property getters/setters that\n * funnel through `this.expr(...)` (`.id`, `.name`, `.sku`,\n * `.properties.*`, …) rooted at `sym[i]` — as well as the child\n * accessors (`keyVault.secrets`, singleton getter/setters), which are\n * derived from the parent's `children` scoped to element `i`. To attach\n * per-iteration children, parent them to `parent.at(loop.index)` — e.g.\n * `Child.fromLoop(loop, parent.at(loop.index), ...)`.\n *\n * Projection over the loop (Bicep `map(sym, x => body)`) is tracked as\n * a follow-up effort — see the \"lambda + fn.map\" issue.\n */\nexport class LoopedResource<T extends Resource = Resource> extends ResourceDeclaration<T[\"type\"]> {\n /**\n * Cross-realm brand — same technique as the scalar `RESOURCE_BRAND`.\n * Use {@link isLoopedResource} instead of `instanceof`\n * when multiple copies of `@azure/provisioning-core` may be loaded.\n */\n readonly [LOOPED_RESOURCE_BRAND] = true as const;\n\n /** Metadata describing the loop that produced this declaration. */\n readonly loop: LoopContext;\n\n readonly #wrappedCtor: new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T;\n\n private constructor(\n context: ProvisioningComponent,\n wrappedCtor: new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T,\n userProps: unknown,\n loop: LoopContext & {\n readonly indexRequested: boolean;\n readonly indexVariable: string;\n },\n options?: ResourceOptions,\n ) {\n // The subclass constructor never runs for a looped row — only this\n // shared `ResourceDeclaration` ctor does. To keep the scalar and\n // looped construction paths from drifting, shape the props bag through\n // the SAME static the scalar ctor uses: every `Resource` (sub)class\n // inherits or overrides `buildResourceProps`, which returns the exact\n // `super()` payload the scalar ctor passes — including the fixed `name`\n // for singletons and any other prop shaping. (This is what fixes looped\n // singletons losing their fixed `name`.)\n //\n // It is always present: base `Resource` — the deserialize fallback ctor\n // for an unregistered `(type, apiVersion)` pair — supplies a default\n // that threads `type` / `apiVersion` in from `userProps`. So there's no\n // existence branch here.\n const props = (\n wrappedCtor as unknown as {\n buildResourceProps: (props: unknown) => ResourceProps<T[\"type\"]> & Record<string, unknown>;\n }\n ).buildResourceProps.call(wrappedCtor, userProps);\n if (props.name === undefined) {\n throw new Error(`Looped resource '${props.type}' requires an explicit per-iteration name.`);\n }\n const namingRules = (wrappedCtor as unknown as { namingRules?: ResourceNamingRules })\n .namingRules;\n (\n wrappedCtor as unknown as {\n validate(\n context: ProvisioningComponent,\n props: ResourceProps<string> & Record<string, unknown>,\n options?: ResourceOptions,\n namingRules?: ResourceNamingRules,\n ): void;\n }\n ).validate.call(wrappedCtor, context, props, options, namingRules);\n super(context, props, options, namingRules);\n this.#wrappedCtor = wrappedCtor;\n // Snapshot the loop metadata at declaration time. `indexVariable` is\n // recorded only if the index was requested by now — either the caller\n // supplied `{ indexVariable }` or read `loop.index` / `loop.indexVariable`\n // before this declaration. Reading `loop.index` (e.g. via\n // `parent.at(loop.index)`) marks the live loop so descendant\n // declarations (which snapshot the same loop afterwards) pick up the\n // binding, while this declaration's own for-expression stays index-less.\n this.loop = {\n collection: loop.collection,\n itemVariable: loop.itemVariable,\n ...(loop.indexRequested ? { indexVariable: loop.indexVariable } : {}),\n ...(loop.batchSize !== undefined ? { batchSize: loop.batchSize } : {}),\n };\n }\n\n /**\n * The concrete `Resource` subclass this looped declaration wraps.\n * Used by query machinery to answer \"which subclass is this looped\n * resource\" — the analogue of `instanceof T` for `LoopedResource<T>`.\n *\n * This is always the full subclass the user constructed via\n * `Xxx.fromLoop(...)` — query identity matches on that class, and it is\n * the prototype the `.at(i)` proxy uses to resolve ARM accessors.\n */\n get wrappedCtor(): new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T {\n return this.#wrappedCtor;\n }\n\n /**\n * Reference the element at `index`. Emits `sym[index].<...>` for\n * subsequent property access.\n *\n * Returns the concrete resource type `T`. At runtime an indexed proxy is\n * spliced over the full class prototype (`#wrappedCtor.prototype`):\n * prototype getters that funnel through `this.expr(...)` (`.id`, `.name`,\n * `.properties.*`, …) resolve rooted at `sym[index]`. A child created with\n * `parent.at(i)` is stamped with that index for serialization.\n */\n at(index: ExpressionOrValue<number>): T {\n // `this` is a `ResourceDeclaration`; the handle derives the subclass\n // prototype from `this.wrappedCtor`. The explicit type argument pins\n // the return type, which TypeScript can't otherwise resolve from the\n // deferred polymorphic `this`.\n return createIndexedResourceProxy<LoopedResource<T>>(this, index);\n }\n}\n\n/** @internal */\nexport function createLoopedResource<T extends Resource, C extends ProvisioningComponent, P, Item>(\n wrappedCtor: new (context: C, props: P, options?: ResourceOptions) => T,\n loop: Loop<Item>,\n context: C,\n ...rest: undefined extends P\n ? [props?: P, options?: ResourceOptions]\n : [props: P, options?: ResourceOptions]\n): LoopedResource<T> {\n const [userProps, options] = rest as [P?, ResourceOptions?];\n // `LoopedResource`'s ctor is private; access via cast because this module\n // owns both the declaration and its internal construction boundary.\n const LoopedCtor = LoopedResource as unknown as new <U extends Resource>(\n context: ProvisioningComponent,\n wrappedCtor: new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => U,\n userProps: unknown,\n loop: LoopContext & {\n readonly indexRequested: boolean;\n readonly indexVariable: string;\n },\n options?: ResourceOptions,\n ) => LoopedResource<U>;\n return new LoopedCtor(\n context,\n wrappedCtor as new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T,\n userProps,\n loop,\n options,\n );\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/constructs/stack.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE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B,CAC/B,KAAY,EACZ,IAAoE,EACpE,IAAmB,EACnB,GAAG,IAEsC;IAEzC,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProvisioningComponent } from \"./provisioning-component.js\";\nimport type { ExpressionOrValue } from \"../expression/expressions.js\";\nimport type { NamingPolicy } from \"../naming/naming-policy.js\";\nimport { DefaultNamingPolicy } from \"../naming/naming-policy.js\";\nimport { OutputCollection } from \"./output.js\";\nimport { ParameterCollection } from \"./parameter.js\";\nimport { VariableCollection } from \"./variable.js\";\nimport {\n getLoopedResources as runGetLoopedResources,\n getResources as runGetResources,\n getResource as runGetResource,\n type QueryOptions,\n} from \"./resource/resource-query.js\";\nimport {\n createLoopedResource,\n type Loop,\n type LoopedResource,\n type Resource,\n type ResourceOptions,\n} from \"./resource/resource.js\";\nimport type { ResourceCtor } from \"./resource/resource-registry.js\";\nimport type { TargetScope } from \"../serialization/ast/index.js\";\n\n// ---------------------------------------------------------------------------\n// Stack — class-based API for creating stacks\n// ---------------------------------------------------------------------------\n\nexport interface StackOptions {\n readonly targetScope?: TargetScope | undefined;\n readonly location?: ExpressionOrValue<string> | undefined;\n readonly tags?: Record<string, ExpressionOrValue<string>> | undefined;\n readonly namingPolicy?: NamingPolicy | undefined;\n}\n\n/**\n * A Stack defines a deployment unit.\n *\n * @remarks\n * Each stack produces one or more Bicep files — resources at different\n * scopes (subscription vs. resource group) are split into separate files\n * linked by module references.\n *\n * Resources register themselves by passing the stack (or a child component)\n * as their first constructor argument. `Stack.add()` is available as a\n * convenience for creating child components with the stack as parent.\n *\n * The `targetScope` option controls the Bicep target scope. Default is\n * `\"subscription\"`, which requires explicit `ResourceGroup` instances.\n * Set `\"resourceGroup\"` to deploy resources directly into an existing\n * resource group.\n *\n * Every stack registers itself in `Stack.roots` for collection by tools\n * like the playground and CLI.\n *\n * {@link https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/provisioning-keyvault#getting-started | Key Vault getting started example}\n */\nexport class Stack extends ProvisioningComponent {\n readonly name: string;\n readonly targetScope: TargetScope;\n readonly parameters: ParameterCollection = new ParameterCollection();\n readonly variables: VariableCollection = new VariableCollection();\n readonly outputs: OutputCollection = new OutputCollection();\n\n // --- Static root stack registry ---\n\n static #roots: Stack[] = [];\n\n /** All root stacks created since the last call to `Stack.clearRoots()`. */\n static get roots(): readonly Stack[] {\n return Stack.#roots;\n }\n\n /**\n * Returns all root stacks and clears the registry. Useful for collecting\n * all stacks after executing user code (e.g. in the playground or CLI).\n */\n static clearRoots(): Stack[] {\n return Stack.#roots.splice(0, Stack.#roots.length);\n }\n\n /** Create a root stack. */\n constructor(name: string, options?: StackOptions) {\n super();\n const opts = options ?? {};\n this.name = name;\n this.targetScope = opts.targetScope ?? \"subscription\";\n Stack.#roots.push(this);\n this._localDeploymentContext = {\n location: opts.location,\n tags: opts.tags,\n namingPolicy: opts.namingPolicy ?? new DefaultNamingPolicy({ workload: name }),\n };\n }\n\n // --- Query ---\n // Query the resources in this stack. Exposed on `Stack` (not `ProvisioningComponent`)\n // because \"all resources in the stack\" is unambiguous, whereas\n // `resource.getResources()` — which excludes the resource itself —\n // would be confusing. For multiple stacks, use\n // `stacks.flatMap(s => s.getResources(...))`.\n\n /**\n * The scalar resources in this stack. With no `type`, returns\n * every scalar resource; pass a resource class to filter and narrow to\n * that subclass. Returns a plain array — use native `.filter` / `.find` /\n * `.map` for anything further.\n *\n * By default walks the whole tree; pass `{ recursive: false }` to consider\n * only the stack's direct children.\n */\n getResources(options?: QueryOptions): Resource[];\n getResources<T extends Resource>(type: ResourceCtor<T>, options?: QueryOptions): T[];\n getResources(\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n ): Resource[] {\n return runGetResources(this, typeOrOptions as never, maybeOptions);\n }\n\n /**\n * Find the **first** scalar resource of `type` whose literal name equals\n * `name`, or `undefined` if none matches.\n *\n * @remarks\n * Returns the first match in tree order. ARM names are unique only *per\n * resource type within a scope*, so a stack MAY legitimately contain more\n * than one resource of the same `type` and `name` (e.g. across different\n * resource groups) — this returns whichever is found first. Use\n * `getResources(type)` and filter yourself if you need all matches.\n *\n * Only scalar resources are searched, and names that do not resolve to a\n * string literal are never matched. Pass `{ recursive: false }` to search\n * only the stack's direct children.\n */\n getResource<T extends Resource>(\n type: ResourceCtor<T>,\n name: string,\n options?: QueryOptions,\n ): T | undefined {\n return runGetResource(this, type, name, options);\n }\n\n /**\n * Create a child under this stack (with the stack as its parent context),\n * as a convenience for `new Ctor(stack, ...args)`.\n *\n * Constructs a single child instance and returns it.\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 add(\n ctor: new (context: ProvisioningComponent, ...args: any[]) => ProvisioningComponent,\n ...rest: any[]\n ): ProvisioningComponent {\n return new ctor(this.self, ...rest);\n }\n}\n\n/** @internal */\nexport function getLoopedResources(\n stack: Stack,\n options?: QueryOptions,\n): LoopedResource<Resource>[];\n/** @internal */\nexport function getLoopedResources<T extends Resource>(\n stack: Stack,\n type: ResourceCtor<T>,\n options?: QueryOptions,\n): LoopedResource<T>[];\nexport function getLoopedResources(\n stack: Stack,\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n): LoopedResource<Resource>[] {\n return runGetLoopedResources(stack, typeOrOptions as never, maybeOptions);\n}\n\n/** @internal */\nexport function addLoopedResource<T extends Resource, P>(\n stack: Stack,\n ctor: new (context: Stack, props: P, options?: ResourceOptions) => T,\n loop: Loop<unknown>,\n ...rest: undefined extends P\n ? [props?: P, options?: ResourceOptions]\n : [props: P, options?: ResourceOptions]\n): LoopedResource<T> {\n return createLoopedResource(ctor, loop, stack.self, ...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C,EAAE,CAAC,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAY;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAY,EACZ,IAAY,EACZ,KAAa,EACb,OAAyB;IAEzB,OAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Expression, InputOf } from \"../expression/expressions.js\";\nimport { wrapExpression } from \"../expression/expressions.js\";\nimport { symbolicValueExpressionNode } from \"../expression/ast-nodes.js\";\nimport type { Stack } from \"./stack.js\";\nimport { assertBicepIdentifier } from \"../util.js\";\n\nexport type ExpressionValue<T> = T extends Expression<infer U> ? U : T;\n\n/**\n * A value accepted as a deployment variable's value: any JSON literal\n * (scalar, `null`, array, object — recursively), an `Expression`, or a\n * resource view (`InputOf<unknown>`). The literal members are required so\n * plain object/array literals are accepted (a bare `InputOf<unknown>` is a\n * weak type and would reject them).\n */\nexport type VariableValue =\n | string\n | number\n | boolean\n | null\n | readonly VariableValue[]\n | { readonly [key: string]: VariableValue }\n | InputOf<unknown>;\n\nexport type VariableOptions = {\n readonly description?: string | undefined;\n readonly export?: boolean | undefined;\n};\n\n/**\n * Pure declaration data for a deployment variable. Stored on the stack\n * (paired with the returned expression handle in {@link VariableEntry});\n * read by the serializer at emit time. Not part of the value-level handle.\n */\nexport interface VariableMetadata extends VariableOptions {\n readonly name: string;\n readonly value: VariableValue;\n}\n\ninterface VariableEntry {\n readonly metadata: VariableMetadata;\n readonly variable: Expression<unknown>;\n}\n\nexport type Variable<TValue extends VariableValue = VariableValue> = Expression<\n ExpressionValue<TValue>\n>;\n\n/**\n * Authoring-time collection of a stack's deployment variables. Backed by an\n * ordered private array; supports add/get/delete/iteration. Look variables up\n * by name via {@link VariableCollection.get}.\n */\nexport class VariableCollection {\n #entries: VariableEntry[] = [];\n\n /** Add a variable; returns its expression handle. Throws on duplicate name. */\n add<TValue extends VariableValue = VariableValue>(\n name: string,\n value: TValue,\n options?: VariableOptions,\n ): Variable<TValue> {\n assertBicepIdentifier(name, \"Deployment variable\");\n if (this.has(name)) {\n throw new Error(`Duplicate deployment variable name: ${name}`);\n }\n const variable = wrapExpression<ExpressionValue<TValue>>(\n symbolicValueExpressionNode<ExpressionValue<TValue>, string>(name),\n );\n this.#entries.push({ metadata: { name, value, ...options }, variable });\n return variable;\n }\n\n /** The expression handle for a variable, or `undefined`. */\n get(name: string): Variable | undefined {\n return this.#find(name)?.variable;\n }\n\n /** The declaration metadata for a variable, or `undefined`. */\n getMetadata(name: string): VariableMetadata | undefined {\n return this.#find(name)?.metadata;\n }\n\n /** All variable handles, in insertion order. */\n list(): readonly Variable[] {\n return this.#entries.map((e) => e.variable);\n }\n\n /** All declaration metadata, in insertion order. */\n listMetadata(): readonly VariableMetadata[] {\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 variable 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<Variable> {\n return this.#entries.map((e) => e.variable)[Symbol.iterator]();\n }\n\n #find(name: string): VariableEntry | undefined {\n return this.#entries.find((e) => e.metadata.name === name);\n }\n}\n\n/**\n * A computed value evaluated at deploy time, compiled to a Bicep `var` declaration.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, createVariable } from \"@azure/provisioning-core\";\n *\n * const stack = new Stack(\"my-app\");\n * const suffix = createVariable(stack, \"suffix\", \"prod\");\n * ```\n */\nexport function createVariable<TValue extends VariableValue = VariableValue>(\n stack: Stack,\n name: string,\n value: TValue,\n options?: VariableOptions,\n): Variable<TValue> {\n return stack.variables.add(name, value, options);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-context.d.ts","sourceRoot":"","sources":["../../../src/deployment-context/deployment-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAClD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-context.js","sourceRoot":"","sources":["../../../src/deployment-context/deployment-context.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ExpressionOrValue } from \"../expression/expressions.js\";\nimport type { NamingPolicy } from \"../naming/naming-policy.js\";\n\n/**\n * Inherited environment that flows down the component tree.\n *\n * @remarks\n * Each node may attach a local contribution via `ProvisioningComponent._localDeploymentContext`\n * (today, only `Stack` and `ResourceGroup` do). When a `Resource` reads the\n * effective context, the framework walks ancestors and resolves each field:\n *\n * - `location`: nearest ancestor with a value wins.\n * - `namingPolicy`: nearest ancestor with a value wins.\n * - `tags`: flat-merged across **all** ancestors; innermost wins on key conflict.\n *\n * Per-resource Bicep `scope:` is not part of this — a resource's deployment\n * scope is determined by which file or module it lands in, which in turn is\n * determined by the ProvisioningComponent tree (the nearest `ResourceGroup`/`Stack` ancestor).\n *\n * The same interface describes both a node's local contribution and the\n * fully-resolved view returned by `ProvisioningComponent.deploymentContext`.\n */\nexport interface DeploymentContext {\n readonly location?: ExpressionOrValue<string> | undefined;\n readonly tags?: Record<string, ExpressionOrValue<string>> | undefined;\n readonly namingPolicy?: NamingPolicy | undefined;\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-nodes.d.ts","sourceRoot":"","sources":["../../../src/expression/ast-nodes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAe9C,MAAM,WAAW,0BAA0B,CAAC,OAAO,GAAG,OAAO,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM;IAC9F,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,2BAA2B,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,SAAS,MAAM,GAAG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BAAmB,CAAC,MAAM,CAAC,CAE7B;AAED,wBAAgB,qBAAqB,CAAC,MAAM,GAAG,OAAO,EACpD,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,OAAO,GAClB,qBAAqB,CAAC,MAAM,CAAC,CAO/B;AAED,wBAAgB,kCAAkC,CAAC,MAAM,GAAG,OAAO,EACjE,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,OAAO,EAAE,GACvB,kCAAkC,CAAC,MAAM,CAAC,CAO5C;AAED,wBAAgB,gCAAgC,CAAC,MAAM,GAAG,OAAO,EAC/D,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,gCAAgC,CAAC,MAAM,CAAC,CAE1C;AAUD,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,SAAS,GAAG,SAAS,CAAC,CAAM,GAC/E,4BAA4B,GAAG,yBAAyB,CAI1D"}
@@ -43,15 +43,13 @@ export function isExpressionNode(value) {
43
43
  typeof node.nullish === "boolean" &&
44
44
  typeof node.fromEnd === "boolean");
45
45
  case "binary":
46
- return (typeof node.operator === "string" && "left" in node && "right" in node);
46
+ return typeof node.operator === "string" && "left" in node && "right" in node;
47
47
  case "unary":
48
48
  return typeof node.operator === "string" && "argument" in node;
49
49
  case "ternary":
50
50
  return "condition" in node && "trueValue" in node && "falseValue" in node;
51
51
  case "instance-function-call":
52
- return (isExpressionNode(node.base) &&
53
- typeof node.name === "string" &&
54
- Array.isArray(node.args));
52
+ return (isExpressionNode(node.base) && typeof node.name === "string" && Array.isArray(node.args));
55
53
  case "interpolated-string":
56
54
  return Array.isArray(node.segments);
57
55
  default:
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-nodes.js","sourceRoot":"","sources":["../../../src/expression/ast-nodes.ts"],"names":[],"mappings":"A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AAM,UAAU,kCAAkC,CAChD,IAAoB,EACpB,IAAY,EACZ,IAAwB;IAExB,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,IAAI;QACJ,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,QAA4B;IAE5B,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAoB,EACpB,MAAuB,EACvB,UAA8E,EAAE;IAEhF,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;QAC/D,CAAC,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC;QAClD,CAAC,CAAC,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Resource } from \"../constructs/resource/resource.js\";\nimport type { BinaryOperator, UnaryOperator } from \"../serialization/ast/index.js\";\nimport type { PropertySegment } from \"../types.js\";\n\nexport type { BinaryOperator, UnaryOperator };\n\n// ---------------------------------------------------------------------------\n// Expression node interfaces (the raw discriminated union members)\n// ---------------------------------------------------------------------------\n\n// Note: every interface declares a phantom `TValue` (when otherwise it wouldn't\n// need one). `TValue` is *not* used in any field of any interface — but its\n// presence in the variant *type-parameter slot* is what allows\n// `ExpressionNode<T>` to thread `T` through to each variant, which in turn is\n// what lets `ExpressionBrand<T>` carry inference-visible `T` across project-\n// reference boundaries. Removing `TValue` and making `ExpressionNode<T>` a\n// fully-phantom alias breaks `coalesce<T>(...)` inference and the\n// `as DeploymentParameter<...>` cast in cross-project consumers (e.g. `demo`).\n\nexport interface FunctionCallExpressionNode<_TValue = unknown, TOperator extends string = string> {\n readonly kind: \"fn-call\";\n readonly operator: TOperator;\n readonly args: readonly unknown[];\n}\n\nexport interface SymbolicValueExpressionNode<_TValue = unknown, TPath extends string = string> {\n readonly kind: \"symbolic-value\";\n readonly path: TPath;\n}\n\nexport interface IdentifierExpressionNode<_TValue = unknown> {\n readonly kind: \"identifier\";\n readonly id: string | Resource;\n}\n\nexport interface PropertyAccessExpressionNode<_TValue = unknown> {\n readonly kind: \"property-access\";\n readonly base: ExpressionNode;\n readonly property: string;\n readonly nullish: boolean;\n /**\n * Optional ARM wire-path segments. When present, the serialization\n * lowering pass rewrites this single access into a chain that walks\n * these segments (handling renames + `@flattenProperty` hoisting).\n * Untyped / hand-built expressions leave this `undefined` and pass\n * through unchanged.\n */\n readonly armPath?: readonly string[] | undefined;\n}\n\nexport interface ArrayAccessExpressionNode<_TValue = unknown> {\n readonly kind: \"array-access\";\n readonly base: ExpressionNode;\n /**\n * The index into the array. A literal `number`/`string` lowers to an\n * integer/string array-access (or a property-access for identifier-like\n * strings) at serialize time. Any {@link ExpressionNode} is serialized\n * recursively into the wire array-access's `index` slot — e.g. a looped\n * `.at(loop.index)` stores the unwrapped `symbolic-value` node (emitting\n * `sym[i]`), and a computed offset stores a `binary` / `fn-call` node\n * (`sym[i + 1]`). `Expression<T>` proxies are always unwrapped to their\n * raw node before landing here, per the \"state holds normalized raw\n * nodes\" invariant — so a proxy is never stored directly.\n */\n readonly index: ArrayAccessIndex;\n readonly nullish: boolean;\n readonly fromEnd: boolean;\n}\n\nexport interface BinaryExpressionNode<_TValue = unknown> {\n readonly kind: \"binary\";\n readonly operator: BinaryOperator;\n readonly left: unknown;\n readonly right: unknown;\n}\n\nexport interface UnaryExpressionNode<_TValue = unknown> {\n readonly kind: \"unary\";\n readonly operator: UnaryOperator;\n readonly argument: unknown;\n}\n\nexport interface TernaryExpressionNode<_TValue = unknown> {\n readonly kind: \"ternary\";\n readonly condition: unknown;\n readonly trueValue: unknown;\n readonly falseValue: unknown;\n}\n\nexport interface InstanceFunctionCallExpressionNode<_TValue = unknown> {\n readonly kind: \"instance-function-call\";\n readonly base: ExpressionNode;\n readonly name: string;\n readonly args: readonly unknown[];\n}\n\nexport interface InterpolatedStringExpressionNode<_TValue = unknown> {\n readonly kind: \"interpolated-string\";\n readonly segments: readonly unknown[];\n}\n\n// ---------------------------------------------------------------------------\n// ExpressionNode union\n// ---------------------------------------------------------------------------\n\n// `T` is threaded through every variant. See the long comment above the node\n// interfaces for why this matters.\nexport type ExpressionNode<T = unknown> =\n | FunctionCallExpressionNode<T>\n | SymbolicValueExpressionNode<T>\n | IdentifierExpressionNode<T>\n | PropertyAccessExpressionNode<T>\n | ArrayAccessExpressionNode<T>\n | BinaryExpressionNode<T>\n | UnaryExpressionNode<T>\n | TernaryExpressionNode<T>\n | InstanceFunctionCallExpressionNode<T>\n | InterpolatedStringExpressionNode<T>;\n\n/**\n * The index stored on an {@link ArrayAccessExpressionNode}: a literal\n * `number` or `string`, or a raw {@link ExpressionNode} evaluated at\n * serialize time (e.g. a loop's `symbolic-value` index, or a `binary` /\n * `fn-call` node for a computed offset). `Expression<T>` proxies are\n * unwrapped to their raw node before being stored, so the proxy type is\n * intentionally absent here.\n */\nexport type ArrayAccessIndex = number | string | ExpressionNode;\n\n// Typed as `Record<ExpressionNode[\"kind\"], true>` so adding a new variant to\n// `ExpressionNode` forces a compile error here until the new kind is listed.\nconst EXPRESSION_NODE_KINDS: Record<ExpressionNode[\"kind\"], true> = {\n \"fn-call\": true,\n \"symbolic-value\": true,\n identifier: true,\n \"property-access\": true,\n \"array-access\": true,\n binary: true,\n unary: true,\n ternary: true,\n \"instance-function-call\": true,\n \"interpolated-string\": true,\n};\n\n/** Tests whether a value structurally matches a raw expression AST node. */\nexport function isExpressionNode(value: unknown): value is ExpressionNode {\n if (\n typeof value !== \"object\" ||\n value === null ||\n !Object.prototype.hasOwnProperty.call(value, \"kind\") ||\n typeof (value as { kind: unknown }).kind !== \"string\"\n ) {\n return false;\n }\n const node = value as Record<string, unknown>;\n if (!Object.prototype.hasOwnProperty.call(EXPRESSION_NODE_KINDS, node.kind as string)) {\n return false;\n }\n switch (node.kind) {\n case \"fn-call\":\n return typeof node.operator === \"string\" && Array.isArray(node.args);\n case \"symbolic-value\":\n return typeof node.path === \"string\";\n case \"identifier\":\n return typeof node.id === \"string\" || typeof node.id === \"object\";\n case \"property-access\":\n return (\n isExpressionNode(node.base) &&\n typeof node.property === \"string\" &&\n typeof node.nullish === \"boolean\"\n );\n case \"array-access\":\n return (\n isExpressionNode(node.base) &&\n \"index\" in node &&\n typeof node.nullish === \"boolean\" &&\n typeof node.fromEnd === \"boolean\"\n );\n case \"binary\":\n return typeof node.operator === \"string\" && \"left\" in node && \"right\" in node;\n case \"unary\":\n return typeof node.operator === \"string\" && \"argument\" in node;\n case \"ternary\":\n return \"condition\" in node && \"trueValue\" in node && \"falseValue\" in node;\n case \"instance-function-call\":\n return (\n isExpressionNode(node.base) && typeof node.name === \"string\" && Array.isArray(node.args)\n );\n case \"interpolated-string\":\n return Array.isArray(node.segments);\n default:\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Factory functions\n// ---------------------------------------------------------------------------\n\nexport function functionCallExpressionNode<TValue = unknown, TOperator extends string = string>(\n operator: TOperator,\n args: readonly unknown[],\n): FunctionCallExpressionNode<TValue, TOperator> {\n return { kind: \"fn-call\", operator, args };\n}\n\nexport function symbolicValueExpressionNode<TValue = unknown, TPath extends string = string>(\n path: TPath,\n): SymbolicValueExpressionNode<TValue, TPath> {\n return { kind: \"symbolic-value\", path };\n}\n\nexport function identifierExpressionNode<TValue = unknown>(\n identifier: string | Resource,\n): IdentifierExpressionNode<TValue> {\n return { kind: \"identifier\", id: identifier };\n}\n\nexport function propertyAccessExpressionNode<TValue = unknown>(\n base: ExpressionNode,\n property: string,\n options: Partial<Pick<PropertyAccessExpressionNode, \"armPath\" | \"nullish\">> = {},\n): PropertyAccessExpressionNode<TValue> {\n return {\n kind: \"property-access\",\n base,\n property,\n nullish: options.nullish ?? false,\n ...(options.armPath === undefined ? {} : { armPath: options.armPath }),\n };\n}\n\nexport function arrayAccessExpressionNode<TValue = unknown>(\n base: ExpressionNode,\n index: ArrayAccessIndex,\n options: Partial<Pick<ArrayAccessExpressionNode, \"nullish\" | \"fromEnd\">> = {},\n): ArrayAccessExpressionNode<TValue> {\n return {\n kind: \"array-access\",\n base,\n index,\n nullish: options.nullish ?? false,\n fromEnd: options.fromEnd ?? false,\n };\n}\n\nexport function binaryExpressionNode<TValue = unknown>(\n operator: BinaryOperator,\n left: unknown,\n right: unknown,\n): BinaryExpressionNode<TValue> {\n return { kind: \"binary\", operator, left, right };\n}\n\nexport function unaryExpressionNode<TValue = unknown>(\n operator: UnaryOperator,\n argument: unknown,\n): UnaryExpressionNode<TValue> {\n return { kind: \"unary\", operator, argument };\n}\n\nexport function ternaryExpressionNode<TValue = unknown>(\n condition: unknown,\n trueValue: unknown,\n falseValue: unknown,\n): TernaryExpressionNode<TValue> {\n return {\n kind: \"ternary\",\n condition,\n trueValue,\n falseValue,\n };\n}\n\nexport function instanceFunctionCallExpressionNode<TValue = unknown>(\n base: ExpressionNode,\n name: string,\n args: readonly unknown[],\n): InstanceFunctionCallExpressionNode<TValue> {\n return {\n kind: \"instance-function-call\",\n base,\n name,\n args,\n };\n}\n\nexport function interpolatedStringExpressionNode<TValue = unknown>(\n segments: readonly unknown[],\n): InterpolatedStringExpressionNode<TValue> {\n return { kind: \"interpolated-string\", segments };\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction isIdentifierSegment(segment: string): boolean {\n return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(segment);\n}\n\nexport function accessExpressionNode(\n base: ExpressionNode,\n member: PropertySegment,\n options: Partial<Pick<PropertyAccessExpressionNode, \"armPath\" | \"nullish\">> = {},\n): PropertyAccessExpressionNode | ArrayAccessExpressionNode {\n return typeof member === \"number\" || !isIdentifierSegment(member)\n ? arrayAccessExpressionNode(base, member, options)\n : propertyAccessExpressionNode(base, member, options);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../../src/expression/expressions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAEnB,MAAM,gBAAgB,CAAC;AAMxB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,MAAmC,CAAC;AAE1E,+EAA+E;AAC/E,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAC;AAM/C,MAAM,WAAW,eAAe,CAAC,GAAG,CAAC,CAAC;IACpC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACjD;AAKD,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAC7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GACtD,aAAa,GACb,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAElC,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,OAAO,EAAE,GACzD,MAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,GACxB;IACE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,C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GAAG,UAAU,CAAC,MAAM,CAAC,CA2D9B;AAMD,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,GACb,UAAU,CAAC,CAAC,CAAC,CAEf;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAE5F;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,OAAO,GAClB,UAAU,CAAC,CAAC,CAAC,CAEf;AAED,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAE5F"}
@@ -81,7 +81,7 @@ export function unwrapExpression(expr) {
81
81
  * for that.
82
82
  */
83
83
  export function isExpression(value) {
84
- return (typeof value === "object" && value !== null && EXPRESSION_BRAND in value);
84
+ return typeof value === "object" && value !== null && EXPRESSION_BRAND in value;
85
85
  }
86
86
  // ---------------------------------------------------------------------------
87
87
  // Expression proxy factory
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../../src/expression/expressions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EAIrB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB,MAAM,CAAC,kBAAkB,CAAC,CAAC;AA2I1E,8EAA8E;AAC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YACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACrC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,wBAAwB,CAAC,OAAO,EAAE,IAAI;YACpC,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBAC9B,OAAO;oBACL,YAAY,EAAE,IAAI;oBAClB,UAAU,EAAE,KAAK;oBACjB,KAAK,EAAE,UAAU;iBAClB,CAAC;YACJ,CAAC;YACD,OAAO,OAAO,CAAC,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzD,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,8EAA8E;AAC9E,sDAAsD;AACtD,8EAA8E;AAE9E,MAAM,UAAU,sBAAsB,CACpC,EAAkB,EAClB,IAAa,EACb,KAAc;IAEd,OAAO,cAAc,CAAC,oBAAoB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAI,EAAiB,EAAE,QAAiB;IAC3E,OAAO,cAAc,CAAC,mBAAmB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,SAAkB,EAClB,SAAkB,EAClB,UAAmB;IAEnB,OAAO,cAAc,CAAC,qBAAqB,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAI,IAAY,EAAE,IAAe;IAC3E,OAAO,cAAc,CAAC,0BAA0B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAChE,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { navigateShape, type NavShape } from \"../shape/shape.js\";\nimport {\n arrayAccessExpressionNode,\n binaryExpressionNode,\n functionCallExpressionNode,\n propertyAccessExpressionNode,\n ternaryExpressionNode,\n type BinaryOperator,\n type ExpressionNode,\n type UnaryOperator,\n unaryExpressionNode,\n} from \"./ast-nodes.js\";\n\n// ---------------------------------------------------------------------------\n// Brand symbol (runtime + type-only)\n// ---------------------------------------------------------------------------\n\n/**\n * Runtime symbol key storing the underlying `ExpressionNode` on proxies.\n * Internal to the package — consumers should use `isExpression()` and\n * `unwrapExpression()` instead of accessing this directly.\n */\nexport const EXPRESSION_BRAND: unique symbol = Symbol(\"expression-brand\");\n\n/** Declared symbol type used in the `Expression<T>` interface for branding. */\ndeclare const __expressionBrand: unique symbol;\n\n// ---------------------------------------------------------------------------\n// Public opaque Expression<T> type\n// ---------------------------------------------------------------------------\n\nexport interface ExpressionBrand<out T> {\n readonly [__expressionBrand]: ExpressionNode<T>;\n}\n\n// Prevents TypeScript from simplifying `Expression<primitive>` down to\n// just `ExpressionBrand<primitive>` — keeps the alias name visible in hovers.\n// Symbol-keyed so it stays hidden from IntelliSense.\ndeclare const __expressionTag: unique symbol;\nexport interface ExpressionTag {\n readonly [__expressionTag]?: never;\n}\n\n/**\n * An opaque deploy-time expression wrapping type `T`.\n *\n * For object types, properties of `T` are accessible as\n * `Expression<Exclude<T[K], undefined>>`. Expression proxies always expose a\n * symbolic property path, so TypeScript's `undefined` omission marker does not\n * belong in the projected value type. Explicit `null` remains intact.\n * For array types, numeric indices return `Expression<element>` and\n * `.length` is an `Expression<number>`.\n *\n * Function-typed keys on `T` are intentionally NOT surfaced — an\n * `Expression<(...)=>R>` isn't callable at the type level or meaningful\n * at emit time. When bicep-level array/object methods are needed\n * (concat, union, etc.), they are added explicitly via dedicated helper\n * types (e.g. a future `ArrayExpression<T>`), not reflectively derived.\n *\n * `NonNullable<T>` is applied at the input boundary, so\n * `Expression<R | undefined>` yields the same structural surface as\n * `Expression<R>` — otherwise the `| undefined` union would distribute\n * and collapse the object branch into `mapped | {}`, erasing the\n * index signature / member projection.\n */\nexport type Expression<T = unknown> = ExpressionBrand<T> &\n ExpressionTag &\n ExpressionShape<NonNullable<T>>;\n\nexport type ExpressionShape<T> = T extends readonly unknown[]\n ? number extends T[\"length\"]\n ? {\n readonly length: Expression<number>;\n readonly [index: number]: Expression<T[number]>;\n }\n : {\n readonly [K in Exclude<keyof T, keyof any[]>]: Expression<T[K]>;\n } & {\n readonly length: Expression<number>;\n readonly [index: number]: Expression<T[number]>;\n }\n : T extends object\n ? {\n readonly [K in keyof T as T[K] extends (...a: any[]) => any ? never : K]-?: Expression<\n Exclude<T[K], undefined>\n >;\n }\n : {};\n\n// ---------------------------------------------------------------------------\n// Input-side types — optional-brand trick\n// ---------------------------------------------------------------------------\n\n/**\n * Carries an *optional* Expression brand on an Input-shaped interface.\n *\n * This is the asymmetric-brand trick that makes the Input type system\n * work without discriminated unions:\n *\n * - Every generated `*Input` interface extends `InputOf<Raw>` and therefore\n * inherits the optional brand. Plain literal values (e.g. `{ foo: 1 }`)\n * trivially satisfy it because the brand property is absent, which is\n * permitted by an optional field.\n * - `Expression<Raw>` carries a *required* brand of the same shape.\n * Required-fields-satisfy-optional is part of TS structural assignability,\n * so any `Expression<Raw>` is assignable where an `InputOf<Raw>`\n * (and thus any `*Input` that extends it) is expected.\n *\n * Net effect: a single `MInput` parameter accepts both literals and\n * whole-subtree `Expression<M>` replacements — no `MInput | Expression<M>`\n * union is needed in the generated signatures. Callers that want to\n * inspect whether a value is a literal or expression use `isExpression()`.\n */\nexport interface InputOf<out Raw> {\n readonly [__expressionBrand]?: ExpressionNode<Raw>;\n}\n\n/**\n * Writable input form for an array container.\n *\n * Accepts literal `T[]`, another `InputArray<T>`, or `Expression<Raw>`.\n * Deliberately NOT a subtype of `T[]` — passing a CDK-backed array to\n * an API that expects a plain `Array<T>` fails at compile time, which\n * is the correct signal (the value may actually be a Proxy wrapping an\n * `ExpressionNode`, not a real JS array).\n */\nexport interface InputArray<T, Raw = readonly T[]> extends InputOf<Raw> {\n length: number | Expression<number>;\n [index: number]: T;\n}\n\n/** Writable input form for a `Record<string, V>` container. */\nexport interface InputRecord<V, Raw = Record<string, V>> extends InputOf<Raw> {\n [key: string]: V;\n}\n\n/** Writable input form for a fixed-length heterogeneous tuple. */\nexport type InputTuple<\n T extends readonly unknown[],\n Raw extends readonly unknown[] = T,\n> = InputOf<Raw> & {\n length: T[\"length\"] | Expression<number>;\n [index: number]: T[number] | Expression<Raw[number]>;\n} & {\n [K in Exclude<keyof T, keyof any[]>]: T[K];\n};\n\n// ---------------------------------------------------------------------------\n// ExpressionOrValue\n// ---------------------------------------------------------------------------\n\n/**\n * Accepts either a plain value `T` or an `Expression<T>` substitution.\n *\n * Use this on scalar/leaf Input sites (primitives, enums, literal-only\n * unions) where a full `InputOf<...>` structural extension doesn't apply.\n * The result is a simple discriminated union; call `isExpression()` to\n * branch on the runtime shape.\n */\nexport type ExpressionOrValue<T> = T | Expression<T>;\n\n// ---------------------------------------------------------------------------\n// Discriminator escape hatch\n// ---------------------------------------------------------------------------\n\n/**\n * Asserts that a deploy-time expression resolves to a specific literal,\n * so it can be used where a discriminator is expected.\n *\n * Discriminator properties on a `@discriminator` model are typed as bare\n * literals (`kind: \"cache\"`) rather than `ExpressionOrValue<\"cache\">`.\n * That is deliberate: TypeScript only treats a property as a discriminant\n * when its type is a *unit* type in every constituent of the union, and a\n * single widened arm disables narrowing for the whole union — completions\n * then offer every variant's properties and excess-property checking\n * degrades to \"allowed if the property exists in any variant\".\n *\n * When the discriminator genuinely isn't known until deployment, wrap the\n * expression with this to state which variant you mean. See the\n * {@link https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/provisioning-core#deploy-time-discriminators | deploy-time discriminator example}.\n *\n * Every other property is still fully checked — only the discriminator's\n * type safety is waived. Note that the runtime cannot dispatch on a\n * non-literal discriminator, so serialization falls back to structural\n * variant inference; prefer a literal wherever possible.\n *\n * The literal is inferred from the expression's own type argument. If the\n * expression is loosely typed (`Expression<string>`), name the variant\n * explicitly: `asDiscriminator<\"cache\">(param)`.\n */\nexport function asDiscriminator<L extends string>(value: ExpressionOrValue<L>): L {\n return value as L;\n}\n\n// ---------------------------------------------------------------------------\n// Unwrap + type guards\n// ---------------------------------------------------------------------------\n\n// Two distinct concepts, two distinct guards:\n//\n// - `isExpression(x)` — \"is `x` a typed `Expression<T>` handle\n// (the value-level, proxy-backed form)?\"\n// - `isExpressionNode(x)` — \"is `x` a raw `ExpressionNode` data object\n// (one of the AST kinds)?\"\n//\n// These are *disjoint* — a value is either a wrapped Expression handle or a\n// raw AST node, never both. To check the AST kind of either form, narrow\n// via the discriminated `kind` field:\n//\n// if (isExpression(value)) {\n// const node = unwrapExpression(value);\n// if (node.kind === \"fn-call\") { /* node: FunctionCallExpressionNode */ }\n// }\n// if (isExpressionNode(value)) {\n// if (value.kind === \"binary\") { /* value: BinaryExpressionNode */ }\n// }\n\n/**\n * Extracts the underlying `ExpressionNode` from an `Expression<T>` value.\n *\n * `Expression<T>` is the public, typed handle for a deploy-time expression\n * (backed by a Proxy at runtime); `ExpressionNode` is the raw AST node that\n * the proxy wraps. Use this to walk / inspect / serialize the underlying\n * tree without reaching for the brand symbol directly.\n */\nexport function unwrapExpression<T>(expr: Expression<T>): ExpressionNode<T> {\n return (expr as unknown as { [EXPRESSION_BRAND]: ExpressionNode<T> })[EXPRESSION_BRAND];\n}\n\n/**\n * Tests whether a value is an `Expression<T>` — the typed, branded handle\n * for a deploy-time expression (proxy-backed). Returns false for raw\n * `ExpressionNode` data; use {@link isExpressionNode} from `./ast-nodes.js`\n * for that.\n */\nexport function isExpression(value: unknown): value is Expression<unknown> {\n return typeof value === \"object\" && value !== null && EXPRESSION_BRAND in value;\n}\n\n// ---------------------------------------------------------------------------\n// Expression proxy factory\n// ---------------------------------------------------------------------------\n\nexport function wrapExpression<T = unknown>(\n expression: ExpressionNode,\n nav?: NavShape,\n): Expression<T> {\n return new Proxy(Object.create(null) as Expression<T>, {\n get(_target, prop, _receiver) {\n if (prop === EXPRESSION_BRAND) {\n return expression;\n }\n\n if (prop === Symbol.toPrimitive || prop === \"toString\") {\n return () => \"[Expression]\";\n }\n\n if (prop === \"valueOf\") {\n return () => expression;\n }\n\n // Avoid being treated as a thenable / Promise\n if (prop === \"then\") {\n return undefined;\n }\n\n if (typeof prop === \"symbol\") {\n return undefined;\n }\n\n // Numeric string → array access.\n if (/^\\d+$/u.test(prop)) {\n const index = Number(prop);\n const step = navigateShape(nav, index);\n return wrapExpression(\n arrayAccessExpressionNode(expression as ExpressionNode, index),\n step.next,\n );\n }\n\n // String property → property access. Consult the current nav\n // shape; stamp the access with the wire armPath if an entry\n // exists, otherwise pass through unchanged. Container navs\n // (record/array) yield no stamp but still peel a layer.\n const step = navigateShape(nav, prop);\n return wrapExpression(\n propertyAccessExpressionNode(expression as ExpressionNode, prop, {\n armPath: step.stamp?.armPath,\n }),\n step.next,\n );\n },\n\n has(_target, prop) {\n return prop === EXPRESSION_BRAND;\n },\n\n ownKeys() {\n return [];\n },\n\n getOwnPropertyDescriptor(_target, prop) {\n if (prop === EXPRESSION_BRAND) {\n return {\n configurable: true,\n enumerable: false,\n value: expression,\n };\n }\n return undefined;\n },\n });\n}\n\nexport function wrapExpressionOver<TObject extends object, TValue = unknown>(\n target: TObject,\n expression: ExpressionNode,\n): TObject & Expression<TValue> {\n return new Proxy(target as TObject & Expression<TValue>, {\n get(backing, prop, receiver) {\n if (prop === EXPRESSION_BRAND) {\n return expression;\n }\n\n if (prop === Symbol.toPrimitive || prop === \"toString\") {\n return () => \"[Expression]\";\n }\n\n if (prop === \"valueOf\") {\n return () => expression;\n }\n\n if (prop === \"then\") {\n return undefined;\n }\n\n if (Reflect.has(backing, prop)) {\n return Reflect.get(backing, prop, receiver);\n }\n\n if (typeof prop === \"symbol\") {\n return undefined;\n }\n\n if (/^\\d+$/u.test(prop)) {\n return wrapExpression(\n arrayAccessExpressionNode(expression as ExpressionNode, Number(prop)),\n );\n }\n\n return wrapExpression(propertyAccessExpressionNode(expression as ExpressionNode, prop));\n },\n\n has(backing, prop) {\n return prop === EXPRESSION_BRAND || Reflect.has(backing, prop);\n },\n\n ownKeys(backing) {\n const keys = Reflect.ownKeys(backing);\n if (!keys.includes(EXPRESSION_BRAND)) {\n keys.push(EXPRESSION_BRAND);\n }\n return keys;\n },\n\n getOwnPropertyDescriptor(backing, prop) {\n if (prop === EXPRESSION_BRAND) {\n return {\n configurable: true,\n enumerable: false,\n value: expression,\n };\n }\n return Reflect.getOwnPropertyDescriptor(backing, prop);\n },\n });\n}\n\n// ---------------------------------------------------------------------------\n// Proxied-expression factories (return Expression<T>)\n// ---------------------------------------------------------------------------\n\nexport function createBinaryExpression<T>(\n op: BinaryOperator,\n left: unknown,\n right: unknown,\n): Expression<T> {\n return wrapExpression(binaryExpressionNode(op, left, right));\n}\n\nexport function createUnaryExpression<T>(op: UnaryOperator, argument: unknown): Expression<T> {\n return wrapExpression(unaryExpressionNode(op, argument));\n}\n\nexport function createTernaryExpression<T>(\n condition: unknown,\n trueValue: unknown,\n falseValue: unknown,\n): Expression<T> {\n return wrapExpression(ternaryExpressionNode(condition, trueValue, falseValue));\n}\n\nexport function createFunctionCallExpression<T>(name: string, args: unknown[]): Expression<T> {\n return wrapExpression(functionCallExpressionNode(name, args));\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/expression/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,kFAAkF;AAClF,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,cAAc,GAAG,kBAAkB,GAAG,SAAS,GACrD,WAAW,GAAG,SAAS,CAoBzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/expression/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,kFAAkF;AAClF,MAAM,UAAU,sBAAsB,CACpC,KAAsD;IAEtD,MAAM,MAAM,GACV,KAAK,EAAE,IAAI,KAAK,eAAe;QAC7B,CAAC,CAAC,KAAK,CAAC,MAAM;QACd,CAAC,CAAC,KAAK,EAAE,IAAI,KAAK,SAAS;YACzB,CAAC,CAAC,KAAK,CAAC,QAAQ;YAChB,CAAC,CAAC,SAAS,CAAC;IAClB,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACjD,QAAQ,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,iBAAiB;YACpB,OAAO,iBAAiB,CAAC;QAC3B,KAAK,cAAc;YACjB,OAAO,cAAc,CAAC;QACxB,KAAK,eAAe;YAClB,OAAO,eAAe,CAAC;QACzB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ExpressionNode, TargetScope } from \"../serialization/ast/index.js\";\nimport type { ExpressionNode as CoreExpressionNode } from \"./ast-nodes.js\";\n\n/** Identifies the standard scope functions without evaluating their arguments. */\nexport function getScopeFunctionTarget(\n scope: ExpressionNode | CoreExpressionNode | undefined,\n): TargetScope | undefined {\n const target =\n scope?.kind === \"function-call\"\n ? scope.target\n : scope?.kind === \"fn-call\"\n ? scope.operator\n : undefined;\n if (typeof target !== \"string\") return undefined;\n switch (target.replace(/^az\\./u, \"\")) {\n case \"tenant\":\n return \"tenant\";\n case \"managementGroup\":\n return \"managementGroup\";\n case \"subscription\":\n return \"subscription\";\n case \"resourceGroup\":\n return \"resourceGroup\";\n default:\n return undefined;\n }\n}\n"]}