@azure/provisioning-core 1.0.0-beta.1

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 (440) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +40 -0
  4. package/dist/browser/constructs/built-in-resources/resource-group.d.ts +50 -0
  5. package/dist/browser/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  6. package/dist/browser/constructs/built-in-resources/resource-group.js +100 -0
  7. package/dist/browser/constructs/built-in-resources/resource-group.js.map +1 -0
  8. package/dist/browser/constructs/output.d.ts +80 -0
  9. package/dist/browser/constructs/output.d.ts.map +1 -0
  10. package/dist/browser/constructs/output.js +75 -0
  11. package/dist/browser/constructs/output.js.map +1 -0
  12. package/dist/browser/constructs/parameter.d.ts +77 -0
  13. package/dist/browser/constructs/parameter.d.ts.map +1 -0
  14. package/dist/browser/constructs/parameter.js +93 -0
  15. package/dist/browser/constructs/parameter.js.map +1 -0
  16. package/dist/browser/constructs/provisioning-component.d.ts +91 -0
  17. package/dist/browser/constructs/provisioning-component.d.ts.map +1 -0
  18. package/dist/browser/constructs/provisioning-component.js +150 -0
  19. package/dist/browser/constructs/provisioning-component.js.map +1 -0
  20. package/dist/browser/constructs/resource/resource-proxy.d.ts +134 -0
  21. package/dist/browser/constructs/resource/resource-proxy.d.ts.map +1 -0
  22. package/dist/browser/constructs/resource/resource-proxy.js +517 -0
  23. package/dist/browser/constructs/resource/resource-proxy.js.map +1 -0
  24. package/dist/browser/constructs/resource/resource-query.d.ts +23 -0
  25. package/dist/browser/constructs/resource/resource-query.d.ts.map +1 -0
  26. package/dist/browser/constructs/resource/resource-query.js +69 -0
  27. package/dist/browser/constructs/resource/resource-query.js.map +1 -0
  28. package/dist/browser/constructs/resource/resource-registry.d.ts +99 -0
  29. package/dist/browser/constructs/resource/resource-registry.d.ts.map +1 -0
  30. package/dist/browser/constructs/resource/resource-registry.js +51 -0
  31. package/dist/browser/constructs/resource/resource-registry.js.map +1 -0
  32. package/dist/browser/constructs/resource/resource-type-registry.d.ts +46 -0
  33. package/dist/browser/constructs/resource/resource-type-registry.d.ts.map +1 -0
  34. package/dist/browser/constructs/resource/resource-type-registry.js +156 -0
  35. package/dist/browser/constructs/resource/resource-type-registry.js.map +1 -0
  36. package/dist/browser/constructs/resource/resource-utils.d.ts +60 -0
  37. package/dist/browser/constructs/resource/resource-utils.d.ts.map +1 -0
  38. package/dist/browser/constructs/resource/resource-utils.js +75 -0
  39. package/dist/browser/constructs/resource/resource-utils.js.map +1 -0
  40. package/dist/browser/constructs/resource/resource.d.ts +460 -0
  41. package/dist/browser/constructs/resource/resource.d.ts.map +1 -0
  42. package/dist/browser/constructs/resource/resource.js +582 -0
  43. package/dist/browser/constructs/resource/resource.js.map +1 -0
  44. package/dist/browser/constructs/stack.d.ts +110 -0
  45. package/dist/browser/constructs/stack.d.ts.map +1 -0
  46. package/dist/browser/constructs/stack.js +110 -0
  47. package/dist/browser/constructs/stack.js.map +1 -0
  48. package/dist/browser/constructs/variable.d.ts +63 -0
  49. package/dist/browser/constructs/variable.d.ts.map +1 -0
  50. package/dist/browser/constructs/variable.js +74 -0
  51. package/dist/browser/constructs/variable.js.map +1 -0
  52. package/dist/browser/deployment-context/deployment-context.d.ts +27 -0
  53. package/dist/browser/deployment-context/deployment-context.d.ts.map +1 -0
  54. package/dist/browser/deployment-context/deployment-context.js +4 -0
  55. package/dist/browser/deployment-context/deployment-context.js.map +1 -0
  56. package/dist/browser/expression/ast-nodes.d.ts +100 -0
  57. package/dist/browser/expression/ast-nodes.d.ts.map +1 -0
  58. package/dist/browser/expression/ast-nodes.js +125 -0
  59. package/dist/browser/expression/ast-nodes.js.map +1 -0
  60. package/dist/browser/expression/expressions.d.ts +164 -0
  61. package/dist/browser/expression/expressions.d.ts.map +1 -0
  62. package/dist/browser/expression/expressions.js +211 -0
  63. package/dist/browser/expression/expressions.js.map +1 -0
  64. package/dist/browser/fn.d.ts +194 -0
  65. package/dist/browser/fn.d.ts.map +1 -0
  66. package/dist/browser/fn.js +334 -0
  67. package/dist/browser/fn.js.map +1 -0
  68. package/dist/browser/index.d.ts +25 -0
  69. package/dist/browser/index.d.ts.map +1 -0
  70. package/dist/browser/index.js +17 -0
  71. package/dist/browser/index.js.map +1 -0
  72. package/dist/browser/internal.d.ts +13 -0
  73. package/dist/browser/internal.d.ts.map +1 -0
  74. package/dist/browser/internal.js +10 -0
  75. package/dist/browser/internal.js.map +1 -0
  76. package/dist/browser/naming/naming-policy.d.ts +56 -0
  77. package/dist/browser/naming/naming-policy.d.ts.map +1 -0
  78. package/dist/browser/naming/naming-policy.js +97 -0
  79. package/dist/browser/naming/naming-policy.js.map +1 -0
  80. package/dist/browser/naming/naming-rules.d.ts +15 -0
  81. package/dist/browser/naming/naming-rules.d.ts.map +1 -0
  82. package/dist/browser/naming/naming-rules.js +15 -0
  83. package/dist/browser/naming/naming-rules.js.map +1 -0
  84. package/dist/browser/package.json +8 -0
  85. package/dist/browser/serialization/contract/generated/ast.d.ts +508 -0
  86. package/dist/browser/serialization/contract/generated/ast.d.ts.map +1 -0
  87. package/dist/browser/serialization/contract/generated/ast.js +23 -0
  88. package/dist/browser/serialization/contract/generated/ast.js.map +1 -0
  89. package/dist/browser/serialization/contract/index.d.ts +2 -0
  90. package/dist/browser/serialization/contract/index.d.ts.map +1 -0
  91. package/dist/browser/serialization/contract/index.js +4 -0
  92. package/dist/browser/serialization/contract/index.js.map +1 -0
  93. package/dist/browser/serialization/index.d.ts +4 -0
  94. package/dist/browser/serialization/index.d.ts.map +1 -0
  95. package/dist/browser/serialization/index.js +5 -0
  96. package/dist/browser/serialization/index.js.map +1 -0
  97. package/dist/browser/serialization/json/deserialize.d.ts +24 -0
  98. package/dist/browser/serialization/json/deserialize.d.ts.map +1 -0
  99. package/dist/browser/serialization/json/deserialize.js +437 -0
  100. package/dist/browser/serialization/json/deserialize.js.map +1 -0
  101. package/dist/browser/serialization/json/encoding.d.ts +4 -0
  102. package/dist/browser/serialization/json/encoding.d.ts.map +1 -0
  103. package/dist/browser/serialization/json/encoding.js +319 -0
  104. package/dist/browser/serialization/json/encoding.js.map +1 -0
  105. package/dist/browser/serialization/json/expression.d.ts +32 -0
  106. package/dist/browser/serialization/json/expression.d.ts.map +1 -0
  107. package/dist/browser/serialization/json/expression.js +494 -0
  108. package/dist/browser/serialization/json/expression.js.map +1 -0
  109. package/dist/browser/serialization/json/lower.d.ts +41 -0
  110. package/dist/browser/serialization/json/lower.d.ts.map +1 -0
  111. package/dist/browser/serialization/json/lower.js +334 -0
  112. package/dist/browser/serialization/json/lower.js.map +1 -0
  113. package/dist/browser/serialization/json/pluralize-config.d.ts +3 -0
  114. package/dist/browser/serialization/json/pluralize-config.d.ts.map +1 -0
  115. package/dist/browser/serialization/json/pluralize-config.js +7 -0
  116. package/dist/browser/serialization/json/pluralize-config.js.map +1 -0
  117. package/dist/browser/serialization/json/serialize.d.ts +12 -0
  118. package/dist/browser/serialization/json/serialize.d.ts.map +1 -0
  119. package/dist/browser/serialization/json/serialize.js +389 -0
  120. package/dist/browser/serialization/json/serialize.js.map +1 -0
  121. package/dist/browser/serialization/json/util.d.ts +2 -0
  122. package/dist/browser/serialization/json/util.d.ts.map +1 -0
  123. package/dist/browser/serialization/json/util.js +19 -0
  124. package/dist/browser/serialization/json/util.js.map +1 -0
  125. package/dist/browser/serialization/utils.d.ts +3 -0
  126. package/dist/browser/serialization/utils.d.ts.map +1 -0
  127. package/dist/browser/serialization/utils.js +146 -0
  128. package/dist/browser/serialization/utils.js.map +1 -0
  129. package/dist/browser/shape/shape-registry.d.ts +51 -0
  130. package/dist/browser/shape/shape-registry.d.ts.map +1 -0
  131. package/dist/browser/shape/shape-registry.js +41 -0
  132. package/dist/browser/shape/shape-registry.js.map +1 -0
  133. package/dist/browser/shape/shape.d.ts +407 -0
  134. package/dist/browser/shape/shape.d.ts.map +1 -0
  135. package/dist/browser/shape/shape.js +424 -0
  136. package/dist/browser/shape/shape.js.map +1 -0
  137. package/dist/browser/shape/value-encoding.d.ts +121 -0
  138. package/dist/browser/shape/value-encoding.d.ts.map +1 -0
  139. package/dist/browser/shape/value-encoding.js +32 -0
  140. package/dist/browser/shape/value-encoding.js.map +1 -0
  141. package/dist/browser/types.d.ts +9 -0
  142. package/dist/browser/types.d.ts.map +1 -0
  143. package/dist/browser/types.js +4 -0
  144. package/dist/browser/types.js.map +1 -0
  145. package/dist/browser/util.d.ts +33 -0
  146. package/dist/browser/util.d.ts.map +1 -0
  147. package/dist/browser/util.js +74 -0
  148. package/dist/browser/util.js.map +1 -0
  149. package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts +50 -0
  150. package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  151. package/dist/commonjs/constructs/built-in-resources/resource-group.js +114 -0
  152. package/dist/commonjs/constructs/built-in-resources/resource-group.js.map +7 -0
  153. package/dist/commonjs/constructs/output.d.ts +80 -0
  154. package/dist/commonjs/constructs/output.d.ts.map +1 -0
  155. package/dist/commonjs/constructs/output.js +75 -0
  156. package/dist/commonjs/constructs/output.js.map +7 -0
  157. package/dist/commonjs/constructs/parameter.d.ts +77 -0
  158. package/dist/commonjs/constructs/parameter.d.ts.map +1 -0
  159. package/dist/commonjs/constructs/parameter.js +95 -0
  160. package/dist/commonjs/constructs/parameter.js.map +7 -0
  161. package/dist/commonjs/constructs/provisioning-component.d.ts +91 -0
  162. package/dist/commonjs/constructs/provisioning-component.d.ts.map +1 -0
  163. package/dist/commonjs/constructs/provisioning-component.js +130 -0
  164. package/dist/commonjs/constructs/provisioning-component.js.map +7 -0
  165. package/dist/commonjs/constructs/resource/resource-proxy.d.ts +134 -0
  166. package/dist/commonjs/constructs/resource/resource-proxy.d.ts.map +1 -0
  167. package/dist/commonjs/constructs/resource/resource-proxy.js +456 -0
  168. package/dist/commonjs/constructs/resource/resource-proxy.js.map +7 -0
  169. package/dist/commonjs/constructs/resource/resource-query.d.ts +23 -0
  170. package/dist/commonjs/constructs/resource/resource-query.d.ts.map +1 -0
  171. package/dist/commonjs/constructs/resource/resource-query.js +68 -0
  172. package/dist/commonjs/constructs/resource/resource-query.js.map +7 -0
  173. package/dist/commonjs/constructs/resource/resource-registry.d.ts +99 -0
  174. package/dist/commonjs/constructs/resource/resource-registry.d.ts.map +1 -0
  175. package/dist/commonjs/constructs/resource/resource-registry.js +49 -0
  176. package/dist/commonjs/constructs/resource/resource-registry.js.map +7 -0
  177. package/dist/commonjs/constructs/resource/resource-type-registry.d.ts +46 -0
  178. package/dist/commonjs/constructs/resource/resource-type-registry.d.ts.map +1 -0
  179. package/dist/commonjs/constructs/resource/resource-type-registry.js +178 -0
  180. package/dist/commonjs/constructs/resource/resource-type-registry.js.map +7 -0
  181. package/dist/commonjs/constructs/resource/resource-utils.d.ts +60 -0
  182. package/dist/commonjs/constructs/resource/resource-utils.d.ts.map +1 -0
  183. package/dist/commonjs/constructs/resource/resource-utils.js +51 -0
  184. package/dist/commonjs/constructs/resource/resource-utils.js.map +7 -0
  185. package/dist/commonjs/constructs/resource/resource.d.ts +460 -0
  186. package/dist/commonjs/constructs/resource/resource.d.ts.map +1 -0
  187. package/dist/commonjs/constructs/resource/resource.js +455 -0
  188. package/dist/commonjs/constructs/resource/resource.js.map +7 -0
  189. package/dist/commonjs/constructs/stack.d.ts +110 -0
  190. package/dist/commonjs/constructs/stack.d.ts.map +1 -0
  191. package/dist/commonjs/constructs/stack.js +101 -0
  192. package/dist/commonjs/constructs/stack.js.map +7 -0
  193. package/dist/commonjs/constructs/variable.d.ts +63 -0
  194. package/dist/commonjs/constructs/variable.d.ts.map +1 -0
  195. package/dist/commonjs/constructs/variable.js +85 -0
  196. package/dist/commonjs/constructs/variable.js.map +7 -0
  197. package/dist/commonjs/deployment-context/deployment-context.d.ts +27 -0
  198. package/dist/commonjs/deployment-context/deployment-context.d.ts.map +1 -0
  199. package/dist/commonjs/deployment-context/deployment-context.js +16 -0
  200. package/dist/commonjs/deployment-context/deployment-context.js.map +7 -0
  201. package/dist/commonjs/expression/ast-nodes.d.ts +100 -0
  202. package/dist/commonjs/expression/ast-nodes.d.ts.map +1 -0
  203. package/dist/commonjs/expression/ast-nodes.js +152 -0
  204. package/dist/commonjs/expression/ast-nodes.js.map +7 -0
  205. package/dist/commonjs/expression/expressions.d.ts +164 -0
  206. package/dist/commonjs/expression/expressions.d.ts.map +1 -0
  207. package/dist/commonjs/expression/expressions.js +171 -0
  208. package/dist/commonjs/expression/expressions.js.map +7 -0
  209. package/dist/commonjs/fn.d.ts +194 -0
  210. package/dist/commonjs/fn.d.ts.map +1 -0
  211. package/dist/commonjs/fn.js +382 -0
  212. package/dist/commonjs/fn.js.map +7 -0
  213. package/dist/commonjs/index.d.ts +25 -0
  214. package/dist/commonjs/index.d.ts.map +1 -0
  215. package/dist/commonjs/index.js +93 -0
  216. package/dist/commonjs/index.js.map +7 -0
  217. package/dist/commonjs/internal.d.ts +13 -0
  218. package/dist/commonjs/internal.d.ts.map +1 -0
  219. package/dist/commonjs/internal.js +88 -0
  220. package/dist/commonjs/internal.js.map +7 -0
  221. package/dist/commonjs/naming/naming-policy.d.ts +56 -0
  222. package/dist/commonjs/naming/naming-policy.d.ts.map +1 -0
  223. package/dist/commonjs/naming/naming-policy.js +99 -0
  224. package/dist/commonjs/naming/naming-policy.js.map +7 -0
  225. package/dist/commonjs/naming/naming-rules.d.ts +15 -0
  226. package/dist/commonjs/naming/naming-rules.d.ts.map +1 -0
  227. package/dist/commonjs/naming/naming-rules.js +39 -0
  228. package/dist/commonjs/naming/naming-rules.js.map +7 -0
  229. package/dist/commonjs/package.json +8 -0
  230. package/dist/commonjs/serialization/contract/generated/ast.d.ts +508 -0
  231. package/dist/commonjs/serialization/contract/generated/ast.d.ts.map +1 -0
  232. package/dist/commonjs/serialization/contract/generated/ast.js +40 -0
  233. package/dist/commonjs/serialization/contract/generated/ast.js.map +7 -0
  234. package/dist/commonjs/serialization/contract/index.d.ts +2 -0
  235. package/dist/commonjs/serialization/contract/index.d.ts.map +1 -0
  236. package/dist/commonjs/serialization/contract/index.js +22 -0
  237. package/dist/commonjs/serialization/contract/index.js.map +7 -0
  238. package/dist/commonjs/serialization/index.d.ts +4 -0
  239. package/dist/commonjs/serialization/index.d.ts.map +1 -0
  240. package/dist/commonjs/serialization/index.js +31 -0
  241. package/dist/commonjs/serialization/index.js.map +7 -0
  242. package/dist/commonjs/serialization/json/deserialize.d.ts +24 -0
  243. package/dist/commonjs/serialization/json/deserialize.d.ts.map +1 -0
  244. package/dist/commonjs/serialization/json/deserialize.js +385 -0
  245. package/dist/commonjs/serialization/json/deserialize.js.map +7 -0
  246. package/dist/commonjs/serialization/json/encoding.d.ts +4 -0
  247. package/dist/commonjs/serialization/json/encoding.d.ts.map +1 -0
  248. package/dist/commonjs/serialization/json/encoding.js +306 -0
  249. package/dist/commonjs/serialization/json/encoding.js.map +7 -0
  250. package/dist/commonjs/serialization/json/expression.d.ts +32 -0
  251. package/dist/commonjs/serialization/json/expression.d.ts.map +1 -0
  252. package/dist/commonjs/serialization/json/expression.js +509 -0
  253. package/dist/commonjs/serialization/json/expression.js.map +7 -0
  254. package/dist/commonjs/serialization/json/lower.d.ts +41 -0
  255. package/dist/commonjs/serialization/json/lower.d.ts.map +1 -0
  256. package/dist/commonjs/serialization/json/lower.js +272 -0
  257. package/dist/commonjs/serialization/json/lower.js.map +7 -0
  258. package/dist/commonjs/serialization/json/pluralize-config.d.ts +3 -0
  259. package/dist/commonjs/serialization/json/pluralize-config.d.ts.map +1 -0
  260. package/dist/commonjs/serialization/json/pluralize-config.js +37 -0
  261. package/dist/commonjs/serialization/json/pluralize-config.js.map +7 -0
  262. package/dist/commonjs/serialization/json/serialize.d.ts +12 -0
  263. package/dist/commonjs/serialization/json/serialize.d.ts.map +1 -0
  264. package/dist/commonjs/serialization/json/serialize.js +352 -0
  265. package/dist/commonjs/serialization/json/serialize.js.map +7 -0
  266. package/dist/commonjs/serialization/json/util.d.ts +2 -0
  267. package/dist/commonjs/serialization/json/util.d.ts.map +1 -0
  268. package/dist/commonjs/serialization/json/util.js +37 -0
  269. package/dist/commonjs/serialization/json/util.js.map +7 -0
  270. package/dist/commonjs/serialization/utils.d.ts +3 -0
  271. package/dist/commonjs/serialization/utils.d.ts.map +1 -0
  272. package/dist/commonjs/serialization/utils.js +169 -0
  273. package/dist/commonjs/serialization/utils.js.map +7 -0
  274. package/dist/commonjs/shape/shape-registry.d.ts +51 -0
  275. package/dist/commonjs/shape/shape-registry.d.ts.map +1 -0
  276. package/dist/commonjs/shape/shape-registry.js +40 -0
  277. package/dist/commonjs/shape/shape-registry.js.map +7 -0
  278. package/dist/commonjs/shape/shape.d.ts +407 -0
  279. package/dist/commonjs/shape/shape.d.ts.map +1 -0
  280. package/dist/commonjs/shape/shape.js +290 -0
  281. package/dist/commonjs/shape/shape.js.map +7 -0
  282. package/dist/commonjs/shape/value-encoding.d.ts +121 -0
  283. package/dist/commonjs/shape/value-encoding.d.ts.map +1 -0
  284. package/dist/commonjs/shape/value-encoding.js +62 -0
  285. package/dist/commonjs/shape/value-encoding.js.map +7 -0
  286. package/dist/commonjs/tsdoc-metadata.json +11 -0
  287. package/dist/commonjs/types.d.ts +9 -0
  288. package/dist/commonjs/types.d.ts.map +1 -0
  289. package/dist/commonjs/types.js +16 -0
  290. package/dist/commonjs/types.js.map +7 -0
  291. package/dist/commonjs/util.d.ts +33 -0
  292. package/dist/commonjs/util.d.ts.map +1 -0
  293. package/dist/commonjs/util.js +73 -0
  294. package/dist/commonjs/util.js.map +7 -0
  295. package/dist/esm/constructs/built-in-resources/resource-group.d.ts +50 -0
  296. package/dist/esm/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  297. package/dist/esm/constructs/built-in-resources/resource-group.js +100 -0
  298. package/dist/esm/constructs/built-in-resources/resource-group.js.map +1 -0
  299. package/dist/esm/constructs/output.d.ts +80 -0
  300. package/dist/esm/constructs/output.d.ts.map +1 -0
  301. package/dist/esm/constructs/output.js +75 -0
  302. package/dist/esm/constructs/output.js.map +1 -0
  303. package/dist/esm/constructs/parameter.d.ts +77 -0
  304. package/dist/esm/constructs/parameter.d.ts.map +1 -0
  305. package/dist/esm/constructs/parameter.js +93 -0
  306. package/dist/esm/constructs/parameter.js.map +1 -0
  307. package/dist/esm/constructs/provisioning-component.d.ts +91 -0
  308. package/dist/esm/constructs/provisioning-component.d.ts.map +1 -0
  309. package/dist/esm/constructs/provisioning-component.js +150 -0
  310. package/dist/esm/constructs/provisioning-component.js.map +1 -0
  311. package/dist/esm/constructs/resource/resource-proxy.d.ts +134 -0
  312. package/dist/esm/constructs/resource/resource-proxy.d.ts.map +1 -0
  313. package/dist/esm/constructs/resource/resource-proxy.js +517 -0
  314. package/dist/esm/constructs/resource/resource-proxy.js.map +1 -0
  315. package/dist/esm/constructs/resource/resource-query.d.ts +23 -0
  316. package/dist/esm/constructs/resource/resource-query.d.ts.map +1 -0
  317. package/dist/esm/constructs/resource/resource-query.js +69 -0
  318. package/dist/esm/constructs/resource/resource-query.js.map +1 -0
  319. package/dist/esm/constructs/resource/resource-registry.d.ts +99 -0
  320. package/dist/esm/constructs/resource/resource-registry.d.ts.map +1 -0
  321. package/dist/esm/constructs/resource/resource-registry.js +51 -0
  322. package/dist/esm/constructs/resource/resource-registry.js.map +1 -0
  323. package/dist/esm/constructs/resource/resource-type-registry.d.ts +46 -0
  324. package/dist/esm/constructs/resource/resource-type-registry.d.ts.map +1 -0
  325. package/dist/esm/constructs/resource/resource-type-registry.js +156 -0
  326. package/dist/esm/constructs/resource/resource-type-registry.js.map +1 -0
  327. package/dist/esm/constructs/resource/resource-utils.d.ts +60 -0
  328. package/dist/esm/constructs/resource/resource-utils.d.ts.map +1 -0
  329. package/dist/esm/constructs/resource/resource-utils.js +75 -0
  330. package/dist/esm/constructs/resource/resource-utils.js.map +1 -0
  331. package/dist/esm/constructs/resource/resource.d.ts +460 -0
  332. package/dist/esm/constructs/resource/resource.d.ts.map +1 -0
  333. package/dist/esm/constructs/resource/resource.js +582 -0
  334. package/dist/esm/constructs/resource/resource.js.map +1 -0
  335. package/dist/esm/constructs/stack.d.ts +110 -0
  336. package/dist/esm/constructs/stack.d.ts.map +1 -0
  337. package/dist/esm/constructs/stack.js +110 -0
  338. package/dist/esm/constructs/stack.js.map +1 -0
  339. package/dist/esm/constructs/variable.d.ts +63 -0
  340. package/dist/esm/constructs/variable.d.ts.map +1 -0
  341. package/dist/esm/constructs/variable.js +74 -0
  342. package/dist/esm/constructs/variable.js.map +1 -0
  343. package/dist/esm/deployment-context/deployment-context.d.ts +27 -0
  344. package/dist/esm/deployment-context/deployment-context.d.ts.map +1 -0
  345. package/dist/esm/deployment-context/deployment-context.js +4 -0
  346. package/dist/esm/deployment-context/deployment-context.js.map +1 -0
  347. package/dist/esm/expression/ast-nodes.d.ts +100 -0
  348. package/dist/esm/expression/ast-nodes.d.ts.map +1 -0
  349. package/dist/esm/expression/ast-nodes.js +125 -0
  350. package/dist/esm/expression/ast-nodes.js.map +1 -0
  351. package/dist/esm/expression/expressions.d.ts +164 -0
  352. package/dist/esm/expression/expressions.d.ts.map +1 -0
  353. package/dist/esm/expression/expressions.js +211 -0
  354. package/dist/esm/expression/expressions.js.map +1 -0
  355. package/dist/esm/fn.d.ts +194 -0
  356. package/dist/esm/fn.d.ts.map +1 -0
  357. package/dist/esm/fn.js +334 -0
  358. package/dist/esm/fn.js.map +1 -0
  359. package/dist/esm/index.d.ts +25 -0
  360. package/dist/esm/index.d.ts.map +1 -0
  361. package/dist/esm/index.js +17 -0
  362. package/dist/esm/index.js.map +1 -0
  363. package/dist/esm/internal.d.ts +13 -0
  364. package/dist/esm/internal.d.ts.map +1 -0
  365. package/dist/esm/internal.js +10 -0
  366. package/dist/esm/internal.js.map +1 -0
  367. package/dist/esm/naming/naming-policy.d.ts +56 -0
  368. package/dist/esm/naming/naming-policy.d.ts.map +1 -0
  369. package/dist/esm/naming/naming-policy.js +97 -0
  370. package/dist/esm/naming/naming-policy.js.map +1 -0
  371. package/dist/esm/naming/naming-rules.d.ts +15 -0
  372. package/dist/esm/naming/naming-rules.d.ts.map +1 -0
  373. package/dist/esm/naming/naming-rules.js +15 -0
  374. package/dist/esm/naming/naming-rules.js.map +1 -0
  375. package/dist/esm/package.json +8 -0
  376. package/dist/esm/serialization/contract/generated/ast.d.ts +508 -0
  377. package/dist/esm/serialization/contract/generated/ast.d.ts.map +1 -0
  378. package/dist/esm/serialization/contract/generated/ast.js +23 -0
  379. package/dist/esm/serialization/contract/generated/ast.js.map +1 -0
  380. package/dist/esm/serialization/contract/index.d.ts +2 -0
  381. package/dist/esm/serialization/contract/index.d.ts.map +1 -0
  382. package/dist/esm/serialization/contract/index.js +4 -0
  383. package/dist/esm/serialization/contract/index.js.map +1 -0
  384. package/dist/esm/serialization/index.d.ts +4 -0
  385. package/dist/esm/serialization/index.d.ts.map +1 -0
  386. package/dist/esm/serialization/index.js +5 -0
  387. package/dist/esm/serialization/index.js.map +1 -0
  388. package/dist/esm/serialization/json/deserialize.d.ts +24 -0
  389. package/dist/esm/serialization/json/deserialize.d.ts.map +1 -0
  390. package/dist/esm/serialization/json/deserialize.js +437 -0
  391. package/dist/esm/serialization/json/deserialize.js.map +1 -0
  392. package/dist/esm/serialization/json/encoding.d.ts +4 -0
  393. package/dist/esm/serialization/json/encoding.d.ts.map +1 -0
  394. package/dist/esm/serialization/json/encoding.js +319 -0
  395. package/dist/esm/serialization/json/encoding.js.map +1 -0
  396. package/dist/esm/serialization/json/expression.d.ts +32 -0
  397. package/dist/esm/serialization/json/expression.d.ts.map +1 -0
  398. package/dist/esm/serialization/json/expression.js +494 -0
  399. package/dist/esm/serialization/json/expression.js.map +1 -0
  400. package/dist/esm/serialization/json/lower.d.ts +41 -0
  401. package/dist/esm/serialization/json/lower.d.ts.map +1 -0
  402. package/dist/esm/serialization/json/lower.js +334 -0
  403. package/dist/esm/serialization/json/lower.js.map +1 -0
  404. package/dist/esm/serialization/json/pluralize-config.d.ts +3 -0
  405. package/dist/esm/serialization/json/pluralize-config.d.ts.map +1 -0
  406. package/dist/esm/serialization/json/pluralize-config.js +7 -0
  407. package/dist/esm/serialization/json/pluralize-config.js.map +1 -0
  408. package/dist/esm/serialization/json/serialize.d.ts +12 -0
  409. package/dist/esm/serialization/json/serialize.d.ts.map +1 -0
  410. package/dist/esm/serialization/json/serialize.js +389 -0
  411. package/dist/esm/serialization/json/serialize.js.map +1 -0
  412. package/dist/esm/serialization/json/util.d.ts +2 -0
  413. package/dist/esm/serialization/json/util.d.ts.map +1 -0
  414. package/dist/esm/serialization/json/util.js +19 -0
  415. package/dist/esm/serialization/json/util.js.map +1 -0
  416. package/dist/esm/serialization/utils.d.ts +3 -0
  417. package/dist/esm/serialization/utils.d.ts.map +1 -0
  418. package/dist/esm/serialization/utils.js +146 -0
  419. package/dist/esm/serialization/utils.js.map +1 -0
  420. package/dist/esm/shape/shape-registry.d.ts +51 -0
  421. package/dist/esm/shape/shape-registry.d.ts.map +1 -0
  422. package/dist/esm/shape/shape-registry.js +41 -0
  423. package/dist/esm/shape/shape-registry.js.map +1 -0
  424. package/dist/esm/shape/shape.d.ts +407 -0
  425. package/dist/esm/shape/shape.d.ts.map +1 -0
  426. package/dist/esm/shape/shape.js +424 -0
  427. package/dist/esm/shape/shape.js.map +1 -0
  428. package/dist/esm/shape/value-encoding.d.ts +121 -0
  429. package/dist/esm/shape/value-encoding.d.ts.map +1 -0
  430. package/dist/esm/shape/value-encoding.js +32 -0
  431. package/dist/esm/shape/value-encoding.js.map +1 -0
  432. package/dist/esm/types.d.ts +9 -0
  433. package/dist/esm/types.d.ts.map +1 -0
  434. package/dist/esm/types.js +4 -0
  435. package/dist/esm/types.js.map +1 -0
  436. package/dist/esm/util.d.ts +33 -0
  437. package/dist/esm/util.d.ts.map +1 -0
  438. package/dist/esm/util.js +74 -0
  439. package/dist/esm/util.js.map +1 -0
  440. package/package.json +117 -0
@@ -0,0 +1,582 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ProvisioningComponent } from "../provisioning-component.js";
4
+ import { createBinaryExpression, unwrapExpression, wrapExpression, } from "../../expression/expressions.js";
5
+ import { symbolicValueExpressionNode } from "../../expression/ast-nodes.js";
6
+ import { namingRequiredPolicy, resolveResourceName } from "../../naming/naming-policy.js";
7
+ 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";
8
+ import { isResourceDeclaration } from "./resource-utils.js";
9
+ import { getShape, registerShape as registerShapeInRegistry } from "../../shape/shape-registry.js";
10
+ import { registerResource as registerResourceInRegistry, } from "./resource-registry.js";
11
+ /**
12
+ * Shared base for resource declaration implementations.
13
+ *
14
+ * @remarks
15
+ *
16
+ * Both represent one Bicep resource declaration in the component tree and
17
+ * share the same declaration-level state layout: identity fields
18
+ * (`type`, `apiVersion`, `existing`), the `if(...)` guard (`condition`),
19
+ * the optional cross-scope reference (`scope`), and the raw prop bag that
20
+ * becomes the resource body.
21
+ *
22
+ * This class owns the common declaration state layout, raw-handle escape
23
+ * hatch, and identity accessors. Subclasses supply their construction and
24
+ * access behavior.
25
+ */
26
+ export class ResourceDeclaration extends ProvisioningComponent {
27
+ /**
28
+ * Brand marker for cross-realm `isResourceDeclaration()` checks. Uses
29
+ * `Symbol.for` so it survives multiple copies of `@azure/provisioning-core`.
30
+ * Inherited by every resource declaration implementation.
31
+ */
32
+ [RESOURCE_DECLARATION_BRAND] = true;
33
+ // Not `readonly`: the ctor writes `this.state = data` once. TypeScript
34
+ // forbids subclass writes to a `readonly` parent field, so the
35
+ // immutability is a runtime contract (never reassigned after ctor)
36
+ // rather than a static one.
37
+ state;
38
+ /**
39
+ * Base constructor for every Bicep resource declaration.
40
+ *
41
+ * @remarks
42
+ *
43
+ * Responsibilities:
44
+ * 1. Register in the component tree (`super(context)`).
45
+ * 2. Enforce a deployment context ancestor.
46
+ * 3. Unwrap `context` if it's an indexed proxy from `.at(i)` /
47
+ * `parent.at(loop.index)`, and stash `parentIndex` on `state` so the
48
+ * serializer can emit `parent: parentSym[index]` on the child.
49
+ * 4. Inherit `condition` from the immediate parent resource
50
+ * declaration when the caller doesn't supply one (Bicep requires
51
+ * children of a conditional resource to share the same guard).
52
+ * 5. Populate `state` — existing arm records only identity fields;
53
+ * deployable arm runs the naming policy and applies
54
+ * `DeploymentContext` defaults for `location` / `tags` per the
55
+ * shape descriptor.
56
+ *
57
+ * Subclasses supply the last mile, including their public handle behavior.
58
+ *
59
+ * @param namingRules - per-resource-type constraints for the naming
60
+ * policy. `Resource` reads this reflectively off the concrete subclass
61
+ * constructor; internal declaration implementations receive it from
62
+ * the concrete resource constructor they represent.
63
+ */
64
+ constructor(context, props, options, namingRules) {
65
+ super(context);
66
+ if (!this.hasDeploymentContext()) {
67
+ throw new Error("Resource declaration must have a parent deployment context.");
68
+ }
69
+ // If `context` is an indexed proxy returned by
70
+ // `LoopedResource.at(i)`, unwrap `this.parent`
71
+ // back to the raw parent so tree walks and symbol-map lookups continue
72
+ // to work, and capture the index so the serializer can emit
73
+ // `parent: parentSym[index]` on this child. The `ProvisioningComponent` constructor
74
+ // already pushed `this` into the correct children array (indexed proxy
75
+ // passes `.children` through to the raw parent's array), so nothing to
76
+ // fix up there.
77
+ //
78
+ // The index is recorded on the child's state (not the parent's) because
79
+ // siblings can have different indices — `new Child(p.at(0), …)` and
80
+ // `new Child(p.at(1), …)` both resolve `.parent` to the same raw parent,
81
+ // so the index that distinguishes them must be per-child.
82
+ const indexRef = context[PROXY_INDEX_REF];
83
+ let parentIndex = undefined;
84
+ if (indexRef !== undefined) {
85
+ const rawParent = context[INDEXED_PROXY_TARGET];
86
+ if (rawParent !== undefined) {
87
+ this.parent = rawParent;
88
+ }
89
+ parentIndex = indexRef;
90
+ }
91
+ // `existing` lives on `props` (it's the discriminant of the generated
92
+ // `{ existing?: false } | { existing: true }` union). `condition` is
93
+ // routed through `options`.
94
+ //
95
+ // Bicep requires a child of a conditional resource to itself be
96
+ // conditional on the same expression. When no explicit `condition` is
97
+ // supplied, inherit the immediate parent resource declaration's
98
+ // condition so the emitted template stays valid — child authoring
99
+ // shouldn't have to redundantly restate the parent's guard.
100
+ const isExisting = props.existing === true;
101
+ const parent = this.parent;
102
+ const inheritedCondition = isResourceDeclaration(parent)
103
+ ? parent.self.state["condition"]
104
+ : undefined;
105
+ const explicitCondition = options?.condition;
106
+ const condition = explicitCondition !== undefined && inheritedCondition !== undefined
107
+ ? createBinaryExpression("&&", inheritedCondition, explicitCondition)
108
+ : (explicitCondition ?? inheritedCondition);
109
+ const dependsOn = options?.dependsOn;
110
+ let data;
111
+ if (isExisting) {
112
+ // Existing arm: only name + optional scope land in state. Any other
113
+ // keys on the props object are ignored — the deserialize path may pass
114
+ // them through, but they're never emitted on an `existing` resource.
115
+ if (props.name === undefined) {
116
+ throw new Error(`Resource ${props.type} marked as 'existing' but no 'name' was provided.`);
117
+ }
118
+ data = {
119
+ name: props.name,
120
+ type: props.type,
121
+ apiVersion: props.apiVersion,
122
+ existing: true,
123
+ scope: props.scope === undefined ? undefined : unwrapExpression(props.scope),
124
+ condition,
125
+ dependsOn,
126
+ };
127
+ if (parentIndex !== undefined) {
128
+ data[STATE_PARENT_INDEX] = parentIndex;
129
+ }
130
+ }
131
+ else {
132
+ // Deployable arm: name flows through the naming policy; the keys
133
+ // handled explicitly here are stripped from the props bag, and
134
+ // every remaining key is copied verbatim into state as a user-
135
+ // authored property.
136
+ const { name: _name, type: _type, apiVersion: _apiVersion, existing: _existing, scope: _scope, ...userProps } = props;
137
+ const ctx = this.deploymentContext;
138
+ data = {
139
+ name: resolveResourceName(ctx.namingPolicy ?? namingRequiredPolicy, props.name, props.type, namingRules),
140
+ type: props.type,
141
+ apiVersion: props.apiVersion,
142
+ condition,
143
+ dependsOn,
144
+ ...userProps,
145
+ };
146
+ if (parentIndex !== undefined) {
147
+ data[STATE_PARENT_INDEX] = parentIndex;
148
+ }
149
+ // Apply DeploymentContext defaults for `location` and `tags`, gated
150
+ // on the shape descriptor declaring those properties as writable.
151
+ // The TypeSpec model is the source of truth: a field marked
152
+ // readonly in the ARM contract (e.g. `location` on most child
153
+ // resources) is server-set, so propagating an inherited value
154
+ // would produce an invalid PUT body. Both fields are user-wins:
155
+ // if the user supplied a value, the inherited value is ignored
156
+ // entirely (no merge for tags either — explicit user tags fully
157
+ // replace inherited tags).
158
+ const shape = getShape(props.type, props.apiVersion, data);
159
+ if (shape !== undefined) {
160
+ const locationShape = shape.byJsName["location"];
161
+ if (locationShape !== undefined &&
162
+ locationShape.readOnly !== true &&
163
+ data["location"] === undefined &&
164
+ ctx.location !== undefined) {
165
+ data["location"] = ctx.location;
166
+ }
167
+ const tagsShape = shape.byJsName["tags"];
168
+ if (tagsShape !== undefined &&
169
+ tagsShape.readOnly !== true &&
170
+ data["tags"] === undefined &&
171
+ ctx.tags !== undefined &&
172
+ Object.keys(ctx.tags).length > 0) {
173
+ data["tags"] = { ...ctx.tags };
174
+ }
175
+ }
176
+ }
177
+ this.state = data;
178
+ }
179
+ /**
180
+ * Core-internal escape hatch: exposes the raw `state` backing object to
181
+ * the proxy layer (`resource-proxy.ts`) so it can read/unwrap the
182
+ * declaration's data across module boundaries. Keyed by the
183
+ * module-scoped {@link RAW_RESOURCE_HANDLE} symbol, which is **not**
184
+ * exported from `@azure/provisioning-core`, so package consumers can't name it.
185
+ *
186
+ * `protected` (not `private`) because the accessors that read it use
187
+ * `Reflect.get` / structural casts that bypass TS visibility anyway;
188
+ * the modifier just keeps it off the public type surface. It can't be a
189
+ * `#private` field because the proxy layer lives in a different class.
190
+ *
191
+ * @internal
192
+ */
193
+ get [RAW_RESOURCE_HANDLE]() {
194
+ return this.state;
195
+ }
196
+ get type() {
197
+ return this.state.type;
198
+ }
199
+ get apiVersion() {
200
+ return this.state.apiVersion;
201
+ }
202
+ get existing() {
203
+ return this.state.existing;
204
+ }
205
+ get condition() {
206
+ return this.state.condition;
207
+ }
208
+ get dependsOn() {
209
+ return this.state.dependsOn;
210
+ }
211
+ expr(...path) {
212
+ return createResourceMemberProxy({
213
+ resource: this,
214
+ root: unwrapResourceHandle(this),
215
+ }, path);
216
+ }
217
+ setProperty(key, value) {
218
+ this.state[key] = normalizeAssignedValue(value, this);
219
+ }
220
+ }
221
+ /**
222
+ * Base class for all Azure resources.
223
+ *
224
+ * @remarks
225
+ * Resources are fully initialized at construction time. Pass a parent
226
+ * `ProvisioningComponent` (typically a `Stack` or `ResourceGroup`) as the first
227
+ * argument — the resource registers itself in the tree automatically.
228
+ *
229
+ * Properties use expression-backed proxies: reading `resource.name`
230
+ * returns an `Expression` that compiles to a Bicep symbolic reference,
231
+ * not a plain string. Use `this.expr()` in subclasses to create
232
+ * property getters and `this.setProperty()` for setters.
233
+ *
234
+ * @example
235
+ * ```typescript snippet:ignore
236
+ * import { ResourceGroup, Stack } from "@azure/provisioning-core";
237
+ * import { KeyVault } from "@azure/provisioning-keyvault";
238
+ *
239
+ * const stack = new Stack("my-app", { targetScope: "subscription" });
240
+ * const rg = new ResourceGroup(stack, { name: "rg-my-app", location: "eastus" });
241
+ * const vault = new KeyVault(rg, {
242
+ * name: "kv-my-app",
243
+ * properties: {
244
+ * tenantId: "11111111-1111-1111-1111-111111111111",
245
+ * sku: { family: "A", name: "standard" },
246
+ * },
247
+ * });
248
+ *
249
+ * // vault.name is an Expression, not a string
250
+ * // vault.id compiles to resourceId(...)
251
+ * ```
252
+ */
253
+ export class Resource extends ResourceDeclaration {
254
+ /**
255
+ * Brand marker for cross-realm `isResource()` checks.
256
+ * Uses `Symbol.for` so it survives multiple copies of `@azure/provisioning-core`.
257
+ */
258
+ [RESOURCE_BRAND] = true;
259
+ /**
260
+ * Register a {@link FlatModelShape} for this resource class's
261
+ * `(resourceType, apiVersion)` pair. Intended to be invoked from a
262
+ * `static {}` initializer in generated subclasses so the registration
263
+ * happens at module load.
264
+ *
265
+ * The static method reads `resourceType` and `apiVersion` off `this`
266
+ * (the subclass that called it), so callers don't repeat the literals.
267
+ */
268
+ static registerShape(shape, variantSelector) {
269
+ registerShapeInRegistry(this.resourceType, this.apiVersion, shape, variantSelector);
270
+ }
271
+ /**
272
+ * Register this class with the global resource registry so the
273
+ * deserializer can reconstruct instances of it (instead of falling
274
+ * back to base `Resource`) for matching `(resourceType, apiVersion)`
275
+ * pairs. Intended to be invoked from a `static {}` initializer in
276
+ * generated classes alongside {@link Resource.registerShape}.
277
+ *
278
+ * Pass an ordered discriminator path for concrete resource variants. A
279
+ * singleton is one segment (`name=signin`); model-discriminated resources
280
+ * may use `kind` or several nested segments. Omit for ordinary resources.
281
+ */
282
+ static register(variantSelector) {
283
+ registerResourceInRegistry(this, variantSelector);
284
+ }
285
+ /**
286
+ * Assemble the base-`Resource` constructor payload (the second `super(...)`
287
+ * argument) from the user-facing props. This is a **static "virtual"**:
288
+ * it runs before an instance exists (to compute the `super` argument), so
289
+ * it can't be an instance method — but it still dispatches through the
290
+ * calling constructor, so a subclass's override wins.
291
+ *
292
+ * Every emitter-generated resource overrides this to inject its fixed
293
+ * identity (`type` / `apiVersion`), the singleton `name`, and its explicit
294
+ * writable-field copy. Both ordinary construction and internal resource
295
+ * reconstruction funnel through this method so prop shaping remains
296
+ * consistent.
297
+ *
298
+ * This base default is the fallback used when the wrapped constructor is
299
+ * base `Resource` itself — the deserialize path for an unregistered
300
+ * `(type, apiVersion)` pair, where `type` / `apiVersion` are threaded in
301
+ * through `props` rather than read off statics. Keeping the default here
302
+ * guarantees the method is always present for internal reconstruction.
303
+ */
304
+ static buildResourceProps(props) {
305
+ const p = props ?? {};
306
+ return {
307
+ ...p,
308
+ type: p["type"] ??
309
+ this.resourceType,
310
+ apiVersion: p["apiVersion"] ??
311
+ this.apiVersion,
312
+ };
313
+ }
314
+ /**
315
+ * Per-resource-type naming constraints, consumed by the active
316
+ * {@link NamingPolicy} when a resource is created without an explicit
317
+ * `name`. Generated CDK subclasses override this with a concrete value;
318
+ * the base default of `undefined` yields `MOST_RESTRICTIVE` behavior.
319
+ *
320
+ * This is type metadata, not user input, so it is kept off the public
321
+ * props surface and read reflectively in the constructor via
322
+ * `this.constructor` rather than being threaded through `ResourceProps`.
323
+ */
324
+ static namingRules;
325
+ _selfProxy;
326
+ constructor(context, props, options) {
327
+ super(context, props, options,
328
+ // Naming rules live as a `protected static namingRules` field on
329
+ // each concrete resource subclass, not on the public props bag.
330
+ // Read reflectively off `new.target` (the most-derived class being
331
+ // instantiated) — `this.constructor` would work too but TS forbids
332
+ // touching `this` before `super()`. Static inheritance falls back
333
+ // to `Resource`'s `undefined` default when a subclass omits the
334
+ // field (e.g. singleton children). `resolveResourceName` (called
335
+ // inside `ResourceDeclaration`) treats `undefined` as
336
+ // `MOST_RESTRICTIVE`.
337
+ new.target.namingRules);
338
+ const proxy = createResourceProxy(this);
339
+ this._selfProxy = proxy;
340
+ // Tricky part for the proxy implementation:
341
+ // ProvisioningComponent constructor pushed `this` (bare instance) into parent.children
342
+ // before the proxy existed. Swap it for the proxy so external consumers
343
+ // see proxy-backed handles (with property access, etc.) when iterating.
344
+ const idx = context.children.indexOf(this);
345
+ if (idx >= 0)
346
+ context.children[idx] = proxy;
347
+ return proxy;
348
+ }
349
+ get self() {
350
+ return this._selfProxy ?? this;
351
+ }
352
+ /**
353
+ * The Azure resource name as a Bicep symbolic-reference expression.
354
+ *
355
+ * The value is established at construction time (either user-supplied
356
+ * via `props.name` or filled in by the naming policy) and stored on
357
+ * `state.name`. The setter routes through `setProperty` so post-
358
+ * construction edits flow through the same proxy/expression machinery
359
+ * as any other property — useful when working with a base `Resource`
360
+ * reference and re-binding the name dynamically. Singleton subclasses
361
+ * override this getter to narrow the return type to the literal
362
+ * `Expression<"<singletonName>">`; non-singleton subclasses inherit
363
+ * this accessor pair as-is.
364
+ */
365
+ get name() {
366
+ return this.expr("name");
367
+ }
368
+ set name(value) {
369
+ this.setProperty("name", value);
370
+ }
371
+ get id() {
372
+ return this.expr("id");
373
+ }
374
+ }
375
+ /**
376
+ * Describes a Bicep `[for item in collection: ...]` loop as a plain data
377
+ * object. Construct one and pass it to
378
+ * `Ctor.fromLoop(loop, context, props, options?)` (e.g.
379
+ * `StorageAccount.fromLoop(...)`) to expand a resource declaration into a
380
+ * resource-copy loop.
381
+ *
382
+ * The item and index variable names default to `item` / `i`. Bicep
383
+ * for-expressions bind their loop variables only within their own body,
384
+ * so two sibling `[for item in xs: …]` / `[for item in ys: …]` in the
385
+ * same file do **not** collide — each `item` is scoped to its own
386
+ * expression. If you nest a `Loop` inside another loop's body (rare),
387
+ * pass `{ itemVariable, indexVariable }` explicitly on the inner one to
388
+ * disambiguate. `batchSize` on the loop renders as `@batchSize(n)` on
389
+ * the resource that consumes it.
390
+ *
391
+ * The `indexVariable` name is always materialized on read (never
392
+ * `undefined`), but whether the wire actually **records** it — and
393
+ * therefore whether the renderer emits the `[for (item, i) in …]` tuple
394
+ * binding — is decided by whether anyone accessed `loop.index` (or the
395
+ * caller supplied `{ indexVariable }` explicitly). A loop whose body
396
+ * never mentions an index emits a bare `[for item in xs: …]`.
397
+ *
398
+ * `Loop` instances are pure data — creating one has no side effect.
399
+ */
400
+ export class Loop {
401
+ collection;
402
+ itemVariable;
403
+ item;
404
+ batchSize;
405
+ // The default name assigned to `indexVariable` on first materialization,
406
+ // if the caller neither passed `{ indexVariable }` nor accessed `.index`.
407
+ #defaultIndexVariable;
408
+ #indexVariable;
409
+ #indexExpr;
410
+ #indexRequested = false;
411
+ constructor(collection, options) {
412
+ this.collection = collection;
413
+ this.itemVariable = options?.itemVariable ?? "item";
414
+ this.#defaultIndexVariable = "i";
415
+ if (options?.indexVariable !== undefined) {
416
+ // Explicit option counts as a request — the wire and renderer must
417
+ // honor the caller's chosen name whether or not they read `.index`.
418
+ this.#indexVariable = options.indexVariable;
419
+ this.#indexRequested = true;
420
+ }
421
+ if (options?.batchSize !== undefined) {
422
+ this.batchSize = options.batchSize;
423
+ }
424
+ this.item = wrapExpression(symbolicValueExpressionNode(this.itemVariable));
425
+ }
426
+ /**
427
+ * Name of the loop's index variable. Always defined — reading it
428
+ * materializes the default (`i`) if the caller neither passed
429
+ * `{ indexVariable }` nor accessed `.index` yet.
430
+ *
431
+ * Reading `.indexVariable` also marks the index as requested (same as
432
+ * reading `.index`), because a caller who wants the variable name is
433
+ * almost certainly going to use it. If the wire-omit optimization
434
+ * (bare `[for item in …]` with no index binding) matters, callers
435
+ * should gate on `.indexRequested` first before touching this getter.
436
+ */
437
+ get indexVariable() {
438
+ this.#indexRequested = true;
439
+ if (this.#indexVariable === undefined) {
440
+ this.#indexVariable = this.#defaultIndexVariable;
441
+ }
442
+ return this.#indexVariable;
443
+ }
444
+ /**
445
+ * Expression referencing the current iteration's index. Reading this the
446
+ * first time marks the index as requested, which causes the wire to
447
+ * include `indexVariable` on the `for-expression` node and the renderer
448
+ * to emit `[for (item, i) in …]`. Callers who never touch `.index` get
449
+ * the cleaner index-less form.
450
+ */
451
+ get index() {
452
+ this.#indexRequested = true;
453
+ if (this.#indexExpr === undefined) {
454
+ const name = this.indexVariable;
455
+ this.#indexExpr = wrapExpression(symbolicValueExpressionNode(name));
456
+ }
457
+ return this.#indexExpr;
458
+ }
459
+ /**
460
+ * Framework-internal signal used by `Resource.fromLoop` to decide
461
+ * whether the wire should include the index binding. `true` when the
462
+ * caller either supplied `{ indexVariable }` explicitly or has accessed
463
+ * `.index` / `.indexVariable` at least once. Not exported from
464
+ * `@azure/provisioning-core`.
465
+ *
466
+ * @internal
467
+ */
468
+ get indexRequested() {
469
+ return this.#indexRequested;
470
+ }
471
+ }
472
+ // ---------------------------------------------------------------------------
473
+ // LoopedResource<T> — a Bicep for-expanded resource declaration as a real
474
+ // ProvisioningComponent in the tree, sitting alongside scalar `Resource` under the same
475
+ // `ResourceDeclaration` base.
476
+ // ---------------------------------------------------------------------------
477
+ /**
478
+ * A `LoopedResource<T>` represents a single Bicep resource declaration
479
+ * expanded across a loop (`[for x in xs: {...}]`). It is a real
480
+ * `ProvisioningComponent` in the tree — one node per emitted declaration — and
481
+ * exposes indexed access into individual iterations via
482
+ * {@link LoopedResource.at}.
483
+ *
484
+ * @remarks
485
+ *
486
+ * Property access on a `LoopedResource` is deliberately not exposed at
487
+ * the type level: pick an index (`at`) to obtain a proxy that emits
488
+ * `sym[i].prop`. This mirrors Bicep's requirement that individual
489
+ * iterations be accessed by index.
490
+ *
491
+ * `.at(i)` returns the concrete resource type `T`. The returned proxy
492
+ * exposes the essential ARM surface — the property getters/setters that
493
+ * funnel through `this.expr(...)` (`.id`, `.name`, `.sku`,
494
+ * `.properties.*`, …) rooted at `sym[i]` — as well as the child
495
+ * accessors (`keyVault.secrets`, singleton getter/setters), which are
496
+ * derived from the parent's `children` scoped to element `i`. To attach
497
+ * per-iteration children, parent them to `parent.at(loop.index)` — e.g.
498
+ * `Child.fromLoop(loop, parent.at(loop.index), ...)`.
499
+ *
500
+ * Projection over the loop (Bicep `map(sym, x => body)`) is tracked as
501
+ * a follow-up effort — see the "lambda + fn.map" issue.
502
+ */
503
+ export class LoopedResource extends ResourceDeclaration {
504
+ /**
505
+ * Cross-realm brand — same technique as the scalar `RESOURCE_BRAND`.
506
+ * Use {@link isLoopedResource} instead of `instanceof`
507
+ * when multiple copies of `@azure/provisioning-core` may be loaded.
508
+ */
509
+ [LOOPED_RESOURCE_BRAND] = true;
510
+ /** Metadata describing the loop that produced this declaration. */
511
+ loop;
512
+ #wrappedCtor;
513
+ constructor(context, wrappedCtor, userProps, loop, options) {
514
+ // The subclass constructor never runs for a looped row — only this
515
+ // shared `ResourceDeclaration` ctor does. To keep the scalar and
516
+ // looped construction paths from drifting, shape the props bag through
517
+ // the SAME static the scalar ctor uses: every `Resource` (sub)class
518
+ // inherits or overrides `buildResourceProps`, which returns the exact
519
+ // `super()` payload the scalar ctor passes — including the fixed `name`
520
+ // for singletons and any other prop shaping. (This is what fixes looped
521
+ // singletons losing their fixed `name`.)
522
+ //
523
+ // It is always present: base `Resource` — the deserialize fallback ctor
524
+ // for an unregistered `(type, apiVersion)` pair — supplies a default
525
+ // that threads `type` / `apiVersion` in from `userProps`. So there's no
526
+ // existence branch here.
527
+ const props = wrappedCtor.buildResourceProps.call(wrappedCtor, userProps);
528
+ super(context, props, options, wrappedCtor.namingRules);
529
+ this.#wrappedCtor = wrappedCtor;
530
+ // Snapshot the loop metadata at declaration time. `indexVariable` is
531
+ // recorded only if the index was requested by now — either the caller
532
+ // supplied `{ indexVariable }` or read `loop.index` / `loop.indexVariable`
533
+ // before this declaration. Reading `loop.index` (e.g. via
534
+ // `parent.at(loop.index)`) marks the live loop so descendant
535
+ // declarations (which snapshot the same loop afterwards) pick up the
536
+ // binding, while this declaration's own for-expression stays index-less.
537
+ this.loop = {
538
+ collection: loop.collection,
539
+ itemVariable: loop.itemVariable,
540
+ ...(loop.indexRequested ? { indexVariable: loop.indexVariable } : {}),
541
+ ...(loop.batchSize !== undefined ? { batchSize: loop.batchSize } : {}),
542
+ };
543
+ }
544
+ /**
545
+ * The concrete `Resource` subclass this looped declaration wraps.
546
+ * Used by query machinery to answer "which subclass is this looped
547
+ * resource" — the analogue of `instanceof T` for `LoopedResource<T>`.
548
+ *
549
+ * This is always the full subclass the user constructed via
550
+ * `Xxx.fromLoop(...)` — query identity matches on that class, and it is
551
+ * the prototype the `.at(i)` proxy uses to resolve ARM accessors.
552
+ */
553
+ get wrappedCtor() {
554
+ return this.#wrappedCtor;
555
+ }
556
+ /**
557
+ * Reference the element at `index`. Emits `sym[index].<...>` for
558
+ * subsequent property access.
559
+ *
560
+ * Returns the concrete resource type `T`. At runtime an indexed proxy is
561
+ * spliced over the full class prototype (`#wrappedCtor.prototype`):
562
+ * prototype getters that funnel through `this.expr(...)` (`.id`, `.name`,
563
+ * `.properties.*`, …) resolve rooted at `sym[index]`. A child created with
564
+ * `parent.at(i)` is stamped with that index for serialization.
565
+ */
566
+ at(index) {
567
+ // `this` is a `ResourceDeclaration`; the handle derives the subclass
568
+ // prototype from `this.wrappedCtor`. The explicit type argument pins
569
+ // the return type, which TypeScript can't otherwise resolve from the
570
+ // deferred polymorphic `this`.
571
+ return createIndexedResourceProxy(this, index);
572
+ }
573
+ }
574
+ /** @internal */
575
+ export function createLoopedResource(wrappedCtor, loop, context, ...rest) {
576
+ const [userProps, options] = rest;
577
+ // `LoopedResource`'s ctor is private; access via cast because this module
578
+ // owns both the declaration and its internal construction boundary.
579
+ const LoopedCtor = LoopedResource;
580
+ return new LoopedCtor(context, wrappedCtor, userProps, loop, options);
581
+ }
582
+ //# sourceMappingURL=resource.js.map