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