@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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/browser/constructs/built-in-resources/resource-group.d.ts +50 -0
- package/dist/browser/constructs/built-in-resources/resource-group.d.ts.map +1 -0
- package/dist/browser/constructs/built-in-resources/resource-group.js +100 -0
- package/dist/browser/constructs/built-in-resources/resource-group.js.map +1 -0
- package/dist/browser/constructs/output.d.ts +80 -0
- package/dist/browser/constructs/output.d.ts.map +1 -0
- package/dist/browser/constructs/output.js +75 -0
- package/dist/browser/constructs/output.js.map +1 -0
- package/dist/browser/constructs/parameter.d.ts +77 -0
- package/dist/browser/constructs/parameter.d.ts.map +1 -0
- package/dist/browser/constructs/parameter.js +93 -0
- package/dist/browser/constructs/parameter.js.map +1 -0
- package/dist/browser/constructs/provisioning-component.d.ts +91 -0
- package/dist/browser/constructs/provisioning-component.d.ts.map +1 -0
- package/dist/browser/constructs/provisioning-component.js +150 -0
- package/dist/browser/constructs/provisioning-component.js.map +1 -0
- package/dist/browser/constructs/resource/resource-proxy.d.ts +134 -0
- package/dist/browser/constructs/resource/resource-proxy.d.ts.map +1 -0
- package/dist/browser/constructs/resource/resource-proxy.js +517 -0
- package/dist/browser/constructs/resource/resource-proxy.js.map +1 -0
- package/dist/browser/constructs/resource/resource-query.d.ts +23 -0
- package/dist/browser/constructs/resource/resource-query.d.ts.map +1 -0
- package/dist/browser/constructs/resource/resource-query.js +69 -0
- package/dist/browser/constructs/resource/resource-query.js.map +1 -0
- package/dist/browser/constructs/resource/resource-registry.d.ts +99 -0
- package/dist/browser/constructs/resource/resource-registry.d.ts.map +1 -0
- package/dist/browser/constructs/resource/resource-registry.js +51 -0
- package/dist/browser/constructs/resource/resource-registry.js.map +1 -0
- package/dist/browser/constructs/resource/resource-type-registry.d.ts +46 -0
- package/dist/browser/constructs/resource/resource-type-registry.d.ts.map +1 -0
- package/dist/browser/constructs/resource/resource-type-registry.js +156 -0
- package/dist/browser/constructs/resource/resource-type-registry.js.map +1 -0
- package/dist/browser/constructs/resource/resource-utils.d.ts +60 -0
- package/dist/browser/constructs/resource/resource-utils.d.ts.map +1 -0
- package/dist/browser/constructs/resource/resource-utils.js +75 -0
- package/dist/browser/constructs/resource/resource-utils.js.map +1 -0
- package/dist/browser/constructs/resource/resource.d.ts +460 -0
- package/dist/browser/constructs/resource/resource.d.ts.map +1 -0
- package/dist/browser/constructs/resource/resource.js +582 -0
- package/dist/browser/constructs/resource/resource.js.map +1 -0
- package/dist/browser/constructs/stack.d.ts +110 -0
- package/dist/browser/constructs/stack.d.ts.map +1 -0
- package/dist/browser/constructs/stack.js +110 -0
- package/dist/browser/constructs/stack.js.map +1 -0
- package/dist/browser/constructs/variable.d.ts +63 -0
- package/dist/browser/constructs/variable.d.ts.map +1 -0
- package/dist/browser/constructs/variable.js +74 -0
- package/dist/browser/constructs/variable.js.map +1 -0
- package/dist/browser/deployment-context/deployment-context.d.ts +27 -0
- package/dist/browser/deployment-context/deployment-context.d.ts.map +1 -0
- package/dist/browser/deployment-context/deployment-context.js +4 -0
- package/dist/browser/deployment-context/deployment-context.js.map +1 -0
- package/dist/browser/expression/ast-nodes.d.ts +100 -0
- package/dist/browser/expression/ast-nodes.d.ts.map +1 -0
- package/dist/browser/expression/ast-nodes.js +125 -0
- package/dist/browser/expression/ast-nodes.js.map +1 -0
- package/dist/browser/expression/expressions.d.ts +164 -0
- package/dist/browser/expression/expressions.d.ts.map +1 -0
- package/dist/browser/expression/expressions.js +211 -0
- package/dist/browser/expression/expressions.js.map +1 -0
- package/dist/browser/fn.d.ts +194 -0
- package/dist/browser/fn.d.ts.map +1 -0
- package/dist/browser/fn.js +334 -0
- package/dist/browser/fn.js.map +1 -0
- package/dist/browser/index.d.ts +25 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +17 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/internal.d.ts +13 -0
- package/dist/browser/internal.d.ts.map +1 -0
- package/dist/browser/internal.js +10 -0
- package/dist/browser/internal.js.map +1 -0
- package/dist/browser/naming/naming-policy.d.ts +56 -0
- package/dist/browser/naming/naming-policy.d.ts.map +1 -0
- package/dist/browser/naming/naming-policy.js +97 -0
- package/dist/browser/naming/naming-policy.js.map +1 -0
- package/dist/browser/naming/naming-rules.d.ts +15 -0
- package/dist/browser/naming/naming-rules.d.ts.map +1 -0
- package/dist/browser/naming/naming-rules.js +15 -0
- package/dist/browser/naming/naming-rules.js.map +1 -0
- package/dist/browser/package.json +8 -0
- package/dist/browser/serialization/contract/generated/ast.d.ts +508 -0
- package/dist/browser/serialization/contract/generated/ast.d.ts.map +1 -0
- package/dist/browser/serialization/contract/generated/ast.js +23 -0
- package/dist/browser/serialization/contract/generated/ast.js.map +1 -0
- package/dist/browser/serialization/contract/index.d.ts +2 -0
- package/dist/browser/serialization/contract/index.d.ts.map +1 -0
- package/dist/browser/serialization/contract/index.js +4 -0
- package/dist/browser/serialization/contract/index.js.map +1 -0
- package/dist/browser/serialization/index.d.ts +4 -0
- package/dist/browser/serialization/index.d.ts.map +1 -0
- package/dist/browser/serialization/index.js +5 -0
- package/dist/browser/serialization/index.js.map +1 -0
- package/dist/browser/serialization/json/deserialize.d.ts +24 -0
- package/dist/browser/serialization/json/deserialize.d.ts.map +1 -0
- package/dist/browser/serialization/json/deserialize.js +437 -0
- package/dist/browser/serialization/json/deserialize.js.map +1 -0
- package/dist/browser/serialization/json/encoding.d.ts +4 -0
- package/dist/browser/serialization/json/encoding.d.ts.map +1 -0
- package/dist/browser/serialization/json/encoding.js +319 -0
- package/dist/browser/serialization/json/encoding.js.map +1 -0
- package/dist/browser/serialization/json/expression.d.ts +32 -0
- package/dist/browser/serialization/json/expression.d.ts.map +1 -0
- package/dist/browser/serialization/json/expression.js +494 -0
- package/dist/browser/serialization/json/expression.js.map +1 -0
- package/dist/browser/serialization/json/lower.d.ts +41 -0
- package/dist/browser/serialization/json/lower.d.ts.map +1 -0
- package/dist/browser/serialization/json/lower.js +334 -0
- package/dist/browser/serialization/json/lower.js.map +1 -0
- package/dist/browser/serialization/json/pluralize-config.d.ts +3 -0
- package/dist/browser/serialization/json/pluralize-config.d.ts.map +1 -0
- package/dist/browser/serialization/json/pluralize-config.js +7 -0
- package/dist/browser/serialization/json/pluralize-config.js.map +1 -0
- package/dist/browser/serialization/json/serialize.d.ts +12 -0
- package/dist/browser/serialization/json/serialize.d.ts.map +1 -0
- package/dist/browser/serialization/json/serialize.js +389 -0
- package/dist/browser/serialization/json/serialize.js.map +1 -0
- package/dist/browser/serialization/json/util.d.ts +2 -0
- package/dist/browser/serialization/json/util.d.ts.map +1 -0
- package/dist/browser/serialization/json/util.js +19 -0
- package/dist/browser/serialization/json/util.js.map +1 -0
- package/dist/browser/serialization/utils.d.ts +3 -0
- package/dist/browser/serialization/utils.d.ts.map +1 -0
- package/dist/browser/serialization/utils.js +146 -0
- package/dist/browser/serialization/utils.js.map +1 -0
- package/dist/browser/shape/shape-registry.d.ts +51 -0
- package/dist/browser/shape/shape-registry.d.ts.map +1 -0
- package/dist/browser/shape/shape-registry.js +41 -0
- package/dist/browser/shape/shape-registry.js.map +1 -0
- package/dist/browser/shape/shape.d.ts +407 -0
- package/dist/browser/shape/shape.d.ts.map +1 -0
- package/dist/browser/shape/shape.js +424 -0
- package/dist/browser/shape/shape.js.map +1 -0
- package/dist/browser/shape/value-encoding.d.ts +121 -0
- package/dist/browser/shape/value-encoding.d.ts.map +1 -0
- package/dist/browser/shape/value-encoding.js +32 -0
- package/dist/browser/shape/value-encoding.js.map +1 -0
- package/dist/browser/types.d.ts +9 -0
- package/dist/browser/types.d.ts.map +1 -0
- package/dist/browser/types.js +4 -0
- package/dist/browser/types.js.map +1 -0
- package/dist/browser/util.d.ts +33 -0
- package/dist/browser/util.d.ts.map +1 -0
- package/dist/browser/util.js +74 -0
- package/dist/browser/util.js.map +1 -0
- package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts +50 -0
- package/dist/commonjs/constructs/built-in-resources/resource-group.d.ts.map +1 -0
- package/dist/commonjs/constructs/built-in-resources/resource-group.js +114 -0
- package/dist/commonjs/constructs/built-in-resources/resource-group.js.map +7 -0
- package/dist/commonjs/constructs/output.d.ts +80 -0
- package/dist/commonjs/constructs/output.d.ts.map +1 -0
- package/dist/commonjs/constructs/output.js +75 -0
- package/dist/commonjs/constructs/output.js.map +7 -0
- package/dist/commonjs/constructs/parameter.d.ts +77 -0
- package/dist/commonjs/constructs/parameter.d.ts.map +1 -0
- package/dist/commonjs/constructs/parameter.js +95 -0
- package/dist/commonjs/constructs/parameter.js.map +7 -0
- package/dist/commonjs/constructs/provisioning-component.d.ts +91 -0
- package/dist/commonjs/constructs/provisioning-component.d.ts.map +1 -0
- package/dist/commonjs/constructs/provisioning-component.js +130 -0
- package/dist/commonjs/constructs/provisioning-component.js.map +7 -0
- package/dist/commonjs/constructs/resource/resource-proxy.d.ts +134 -0
- package/dist/commonjs/constructs/resource/resource-proxy.d.ts.map +1 -0
- package/dist/commonjs/constructs/resource/resource-proxy.js +456 -0
- package/dist/commonjs/constructs/resource/resource-proxy.js.map +7 -0
- package/dist/commonjs/constructs/resource/resource-query.d.ts +23 -0
- package/dist/commonjs/constructs/resource/resource-query.d.ts.map +1 -0
- package/dist/commonjs/constructs/resource/resource-query.js +68 -0
- package/dist/commonjs/constructs/resource/resource-query.js.map +7 -0
- package/dist/commonjs/constructs/resource/resource-registry.d.ts +99 -0
- package/dist/commonjs/constructs/resource/resource-registry.d.ts.map +1 -0
- package/dist/commonjs/constructs/resource/resource-registry.js +49 -0
- package/dist/commonjs/constructs/resource/resource-registry.js.map +7 -0
- package/dist/commonjs/constructs/resource/resource-type-registry.d.ts +46 -0
- package/dist/commonjs/constructs/resource/resource-type-registry.d.ts.map +1 -0
- package/dist/commonjs/constructs/resource/resource-type-registry.js +178 -0
- package/dist/commonjs/constructs/resource/resource-type-registry.js.map +7 -0
- package/dist/commonjs/constructs/resource/resource-utils.d.ts +60 -0
- package/dist/commonjs/constructs/resource/resource-utils.d.ts.map +1 -0
- package/dist/commonjs/constructs/resource/resource-utils.js +51 -0
- package/dist/commonjs/constructs/resource/resource-utils.js.map +7 -0
- package/dist/commonjs/constructs/resource/resource.d.ts +460 -0
- package/dist/commonjs/constructs/resource/resource.d.ts.map +1 -0
- package/dist/commonjs/constructs/resource/resource.js +455 -0
- package/dist/commonjs/constructs/resource/resource.js.map +7 -0
- package/dist/commonjs/constructs/stack.d.ts +110 -0
- package/dist/commonjs/constructs/stack.d.ts.map +1 -0
- package/dist/commonjs/constructs/stack.js +101 -0
- package/dist/commonjs/constructs/stack.js.map +7 -0
- package/dist/commonjs/constructs/variable.d.ts +63 -0
- package/dist/commonjs/constructs/variable.d.ts.map +1 -0
- package/dist/commonjs/constructs/variable.js +85 -0
- package/dist/commonjs/constructs/variable.js.map +7 -0
- package/dist/commonjs/deployment-context/deployment-context.d.ts +27 -0
- package/dist/commonjs/deployment-context/deployment-context.d.ts.map +1 -0
- package/dist/commonjs/deployment-context/deployment-context.js +16 -0
- package/dist/commonjs/deployment-context/deployment-context.js.map +7 -0
- package/dist/commonjs/expression/ast-nodes.d.ts +100 -0
- package/dist/commonjs/expression/ast-nodes.d.ts.map +1 -0
- package/dist/commonjs/expression/ast-nodes.js +152 -0
- package/dist/commonjs/expression/ast-nodes.js.map +7 -0
- package/dist/commonjs/expression/expressions.d.ts +164 -0
- package/dist/commonjs/expression/expressions.d.ts.map +1 -0
- package/dist/commonjs/expression/expressions.js +171 -0
- package/dist/commonjs/expression/expressions.js.map +7 -0
- package/dist/commonjs/fn.d.ts +194 -0
- package/dist/commonjs/fn.d.ts.map +1 -0
- package/dist/commonjs/fn.js +382 -0
- package/dist/commonjs/fn.js.map +7 -0
- package/dist/commonjs/index.d.ts +25 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +93 -0
- package/dist/commonjs/index.js.map +7 -0
- package/dist/commonjs/internal.d.ts +13 -0
- package/dist/commonjs/internal.d.ts.map +1 -0
- package/dist/commonjs/internal.js +88 -0
- package/dist/commonjs/internal.js.map +7 -0
- package/dist/commonjs/naming/naming-policy.d.ts +56 -0
- package/dist/commonjs/naming/naming-policy.d.ts.map +1 -0
- package/dist/commonjs/naming/naming-policy.js +99 -0
- package/dist/commonjs/naming/naming-policy.js.map +7 -0
- package/dist/commonjs/naming/naming-rules.d.ts +15 -0
- package/dist/commonjs/naming/naming-rules.d.ts.map +1 -0
- package/dist/commonjs/naming/naming-rules.js +39 -0
- package/dist/commonjs/naming/naming-rules.js.map +7 -0
- package/dist/commonjs/package.json +8 -0
- package/dist/commonjs/serialization/contract/generated/ast.d.ts +508 -0
- package/dist/commonjs/serialization/contract/generated/ast.d.ts.map +1 -0
- package/dist/commonjs/serialization/contract/generated/ast.js +40 -0
- package/dist/commonjs/serialization/contract/generated/ast.js.map +7 -0
- package/dist/commonjs/serialization/contract/index.d.ts +2 -0
- package/dist/commonjs/serialization/contract/index.d.ts.map +1 -0
- package/dist/commonjs/serialization/contract/index.js +22 -0
- package/dist/commonjs/serialization/contract/index.js.map +7 -0
- package/dist/commonjs/serialization/index.d.ts +4 -0
- package/dist/commonjs/serialization/index.d.ts.map +1 -0
- package/dist/commonjs/serialization/index.js +31 -0
- package/dist/commonjs/serialization/index.js.map +7 -0
- package/dist/commonjs/serialization/json/deserialize.d.ts +24 -0
- package/dist/commonjs/serialization/json/deserialize.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/deserialize.js +385 -0
- package/dist/commonjs/serialization/json/deserialize.js.map +7 -0
- package/dist/commonjs/serialization/json/encoding.d.ts +4 -0
- package/dist/commonjs/serialization/json/encoding.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/encoding.js +306 -0
- package/dist/commonjs/serialization/json/encoding.js.map +7 -0
- package/dist/commonjs/serialization/json/expression.d.ts +32 -0
- package/dist/commonjs/serialization/json/expression.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/expression.js +509 -0
- package/dist/commonjs/serialization/json/expression.js.map +7 -0
- package/dist/commonjs/serialization/json/lower.d.ts +41 -0
- package/dist/commonjs/serialization/json/lower.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/lower.js +272 -0
- package/dist/commonjs/serialization/json/lower.js.map +7 -0
- package/dist/commonjs/serialization/json/pluralize-config.d.ts +3 -0
- package/dist/commonjs/serialization/json/pluralize-config.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/pluralize-config.js +37 -0
- package/dist/commonjs/serialization/json/pluralize-config.js.map +7 -0
- package/dist/commonjs/serialization/json/serialize.d.ts +12 -0
- package/dist/commonjs/serialization/json/serialize.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/serialize.js +352 -0
- package/dist/commonjs/serialization/json/serialize.js.map +7 -0
- package/dist/commonjs/serialization/json/util.d.ts +2 -0
- package/dist/commonjs/serialization/json/util.d.ts.map +1 -0
- package/dist/commonjs/serialization/json/util.js +37 -0
- package/dist/commonjs/serialization/json/util.js.map +7 -0
- package/dist/commonjs/serialization/utils.d.ts +3 -0
- package/dist/commonjs/serialization/utils.d.ts.map +1 -0
- package/dist/commonjs/serialization/utils.js +169 -0
- package/dist/commonjs/serialization/utils.js.map +7 -0
- package/dist/commonjs/shape/shape-registry.d.ts +51 -0
- package/dist/commonjs/shape/shape-registry.d.ts.map +1 -0
- package/dist/commonjs/shape/shape-registry.js +40 -0
- package/dist/commonjs/shape/shape-registry.js.map +7 -0
- package/dist/commonjs/shape/shape.d.ts +407 -0
- package/dist/commonjs/shape/shape.d.ts.map +1 -0
- package/dist/commonjs/shape/shape.js +290 -0
- package/dist/commonjs/shape/shape.js.map +7 -0
- package/dist/commonjs/shape/value-encoding.d.ts +121 -0
- package/dist/commonjs/shape/value-encoding.d.ts.map +1 -0
- package/dist/commonjs/shape/value-encoding.js +62 -0
- package/dist/commonjs/shape/value-encoding.js.map +7 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/commonjs/types.d.ts +9 -0
- package/dist/commonjs/types.d.ts.map +1 -0
- package/dist/commonjs/types.js +16 -0
- package/dist/commonjs/types.js.map +7 -0
- package/dist/commonjs/util.d.ts +33 -0
- package/dist/commonjs/util.d.ts.map +1 -0
- package/dist/commonjs/util.js +73 -0
- package/dist/commonjs/util.js.map +7 -0
- package/dist/esm/constructs/built-in-resources/resource-group.d.ts +50 -0
- package/dist/esm/constructs/built-in-resources/resource-group.d.ts.map +1 -0
- package/dist/esm/constructs/built-in-resources/resource-group.js +100 -0
- package/dist/esm/constructs/built-in-resources/resource-group.js.map +1 -0
- package/dist/esm/constructs/output.d.ts +80 -0
- package/dist/esm/constructs/output.d.ts.map +1 -0
- package/dist/esm/constructs/output.js +75 -0
- package/dist/esm/constructs/output.js.map +1 -0
- package/dist/esm/constructs/parameter.d.ts +77 -0
- package/dist/esm/constructs/parameter.d.ts.map +1 -0
- package/dist/esm/constructs/parameter.js +93 -0
- package/dist/esm/constructs/parameter.js.map +1 -0
- package/dist/esm/constructs/provisioning-component.d.ts +91 -0
- package/dist/esm/constructs/provisioning-component.d.ts.map +1 -0
- package/dist/esm/constructs/provisioning-component.js +150 -0
- package/dist/esm/constructs/provisioning-component.js.map +1 -0
- package/dist/esm/constructs/resource/resource-proxy.d.ts +134 -0
- package/dist/esm/constructs/resource/resource-proxy.d.ts.map +1 -0
- package/dist/esm/constructs/resource/resource-proxy.js +517 -0
- package/dist/esm/constructs/resource/resource-proxy.js.map +1 -0
- package/dist/esm/constructs/resource/resource-query.d.ts +23 -0
- package/dist/esm/constructs/resource/resource-query.d.ts.map +1 -0
- package/dist/esm/constructs/resource/resource-query.js +69 -0
- package/dist/esm/constructs/resource/resource-query.js.map +1 -0
- package/dist/esm/constructs/resource/resource-registry.d.ts +99 -0
- package/dist/esm/constructs/resource/resource-registry.d.ts.map +1 -0
- package/dist/esm/constructs/resource/resource-registry.js +51 -0
- package/dist/esm/constructs/resource/resource-registry.js.map +1 -0
- package/dist/esm/constructs/resource/resource-type-registry.d.ts +46 -0
- package/dist/esm/constructs/resource/resource-type-registry.d.ts.map +1 -0
- package/dist/esm/constructs/resource/resource-type-registry.js +156 -0
- package/dist/esm/constructs/resource/resource-type-registry.js.map +1 -0
- package/dist/esm/constructs/resource/resource-utils.d.ts +60 -0
- package/dist/esm/constructs/resource/resource-utils.d.ts.map +1 -0
- package/dist/esm/constructs/resource/resource-utils.js +75 -0
- package/dist/esm/constructs/resource/resource-utils.js.map +1 -0
- package/dist/esm/constructs/resource/resource.d.ts +460 -0
- package/dist/esm/constructs/resource/resource.d.ts.map +1 -0
- package/dist/esm/constructs/resource/resource.js +582 -0
- package/dist/esm/constructs/resource/resource.js.map +1 -0
- package/dist/esm/constructs/stack.d.ts +110 -0
- package/dist/esm/constructs/stack.d.ts.map +1 -0
- package/dist/esm/constructs/stack.js +110 -0
- package/dist/esm/constructs/stack.js.map +1 -0
- package/dist/esm/constructs/variable.d.ts +63 -0
- package/dist/esm/constructs/variable.d.ts.map +1 -0
- package/dist/esm/constructs/variable.js +74 -0
- package/dist/esm/constructs/variable.js.map +1 -0
- package/dist/esm/deployment-context/deployment-context.d.ts +27 -0
- package/dist/esm/deployment-context/deployment-context.d.ts.map +1 -0
- package/dist/esm/deployment-context/deployment-context.js +4 -0
- package/dist/esm/deployment-context/deployment-context.js.map +1 -0
- package/dist/esm/expression/ast-nodes.d.ts +100 -0
- package/dist/esm/expression/ast-nodes.d.ts.map +1 -0
- package/dist/esm/expression/ast-nodes.js +125 -0
- package/dist/esm/expression/ast-nodes.js.map +1 -0
- package/dist/esm/expression/expressions.d.ts +164 -0
- package/dist/esm/expression/expressions.d.ts.map +1 -0
- package/dist/esm/expression/expressions.js +211 -0
- package/dist/esm/expression/expressions.js.map +1 -0
- package/dist/esm/fn.d.ts +194 -0
- package/dist/esm/fn.d.ts.map +1 -0
- package/dist/esm/fn.js +334 -0
- package/dist/esm/fn.js.map +1 -0
- package/dist/esm/index.d.ts +25 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal.d.ts +13 -0
- package/dist/esm/internal.d.ts.map +1 -0
- package/dist/esm/internal.js +10 -0
- package/dist/esm/internal.js.map +1 -0
- package/dist/esm/naming/naming-policy.d.ts +56 -0
- package/dist/esm/naming/naming-policy.d.ts.map +1 -0
- package/dist/esm/naming/naming-policy.js +97 -0
- package/dist/esm/naming/naming-policy.js.map +1 -0
- package/dist/esm/naming/naming-rules.d.ts +15 -0
- package/dist/esm/naming/naming-rules.d.ts.map +1 -0
- package/dist/esm/naming/naming-rules.js +15 -0
- package/dist/esm/naming/naming-rules.js.map +1 -0
- package/dist/esm/package.json +8 -0
- package/dist/esm/serialization/contract/generated/ast.d.ts +508 -0
- package/dist/esm/serialization/contract/generated/ast.d.ts.map +1 -0
- package/dist/esm/serialization/contract/generated/ast.js +23 -0
- package/dist/esm/serialization/contract/generated/ast.js.map +1 -0
- package/dist/esm/serialization/contract/index.d.ts +2 -0
- package/dist/esm/serialization/contract/index.d.ts.map +1 -0
- package/dist/esm/serialization/contract/index.js +4 -0
- package/dist/esm/serialization/contract/index.js.map +1 -0
- package/dist/esm/serialization/index.d.ts +4 -0
- package/dist/esm/serialization/index.d.ts.map +1 -0
- package/dist/esm/serialization/index.js +5 -0
- package/dist/esm/serialization/index.js.map +1 -0
- package/dist/esm/serialization/json/deserialize.d.ts +24 -0
- package/dist/esm/serialization/json/deserialize.d.ts.map +1 -0
- package/dist/esm/serialization/json/deserialize.js +437 -0
- package/dist/esm/serialization/json/deserialize.js.map +1 -0
- package/dist/esm/serialization/json/encoding.d.ts +4 -0
- package/dist/esm/serialization/json/encoding.d.ts.map +1 -0
- package/dist/esm/serialization/json/encoding.js +319 -0
- package/dist/esm/serialization/json/encoding.js.map +1 -0
- package/dist/esm/serialization/json/expression.d.ts +32 -0
- package/dist/esm/serialization/json/expression.d.ts.map +1 -0
- package/dist/esm/serialization/json/expression.js +494 -0
- package/dist/esm/serialization/json/expression.js.map +1 -0
- package/dist/esm/serialization/json/lower.d.ts +41 -0
- package/dist/esm/serialization/json/lower.d.ts.map +1 -0
- package/dist/esm/serialization/json/lower.js +334 -0
- package/dist/esm/serialization/json/lower.js.map +1 -0
- package/dist/esm/serialization/json/pluralize-config.d.ts +3 -0
- package/dist/esm/serialization/json/pluralize-config.d.ts.map +1 -0
- package/dist/esm/serialization/json/pluralize-config.js +7 -0
- package/dist/esm/serialization/json/pluralize-config.js.map +1 -0
- package/dist/esm/serialization/json/serialize.d.ts +12 -0
- package/dist/esm/serialization/json/serialize.d.ts.map +1 -0
- package/dist/esm/serialization/json/serialize.js +389 -0
- package/dist/esm/serialization/json/serialize.js.map +1 -0
- package/dist/esm/serialization/json/util.d.ts +2 -0
- package/dist/esm/serialization/json/util.d.ts.map +1 -0
- package/dist/esm/serialization/json/util.js +19 -0
- package/dist/esm/serialization/json/util.js.map +1 -0
- package/dist/esm/serialization/utils.d.ts +3 -0
- package/dist/esm/serialization/utils.d.ts.map +1 -0
- package/dist/esm/serialization/utils.js +146 -0
- package/dist/esm/serialization/utils.js.map +1 -0
- package/dist/esm/shape/shape-registry.d.ts +51 -0
- package/dist/esm/shape/shape-registry.d.ts.map +1 -0
- package/dist/esm/shape/shape-registry.js +41 -0
- package/dist/esm/shape/shape-registry.js.map +1 -0
- package/dist/esm/shape/shape.d.ts +407 -0
- package/dist/esm/shape/shape.d.ts.map +1 -0
- package/dist/esm/shape/shape.js +424 -0
- package/dist/esm/shape/shape.js.map +1 -0
- package/dist/esm/shape/value-encoding.d.ts +121 -0
- package/dist/esm/shape/value-encoding.d.ts.map +1 -0
- package/dist/esm/shape/value-encoding.js +32 -0
- package/dist/esm/shape/value-encoding.js.map +1 -0
- package/dist/esm/types.d.ts +9 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +4 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/util.d.ts +33 -0
- package/dist/esm/util.d.ts.map +1 -0
- package/dist/esm/util.js +74 -0
- package/dist/esm/util.js.map +1 -0
- package/package.json +117 -0
|
@@ -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,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,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,EAAE,QAAQ,EAAE,aAAa,IAAI,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EACL,gBAAgB,IAAI,0BAA0B,GAE/C,MAAM,wBAAwB,CAAC;AA0IhC;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,mBAEpB,SAAQ,qBAAqB;IAC7B;;;;OAIG;IACM,CAAC,0BAA0B,CAAC,GAAG,IAAa,CAAC;IAEtD,uEAAuE;IACvE,+DAA+D;IAC/D,mEAAmE;IACnE,4BAA4B;IAClB,KAAK,CAAkD;IAEjE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,YACE,OAA8B,EAC9B,KAAqD,EACrD,OAAyB,EACzB,WAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI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;QACF,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,qEAAqE;QACrE,sEAAsE;QACtE,2EAA2E;QAC3E,0DAA0D;QAC1D,6DAA6D;QAC7D,qEAAqE;QACrE,yEAAyE;QACzE,IAAI,CAAC,IAAI,GAAG;YACV,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvE,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,WAAW;QAKb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;;;;;;;;OASG;IACH,EAAE,CAAC,KAAgC;QACjC,qEAAqE;QACrE,qEAAqE;QACrE,qEAAqE;QACrE,+BAA+B;QAC/B,OAAO,0BAA0B,CAAoB,IAAI,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;CACF;AAED,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAClC,WAAuE,EACvE,IAAgB,EAChB,OAAU,EACV,GAAG,IAEsC;IAEzC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,IAA8B,CAAC;IAC5D,0EAA0E;IAC1E,oEAAoE;IACpE,MAAM,UAAU,GAAG,cAUG,CAAC;IACvB,OAAO,IAAI,UAAU,CACnB,OAAO,EACP,WAIM,EACN,SAAS,EACT,IAAI,EACJ,OAAO,CACR,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProvisioningComponent } from \"../provisioning-component.js\";\nimport {\n createBinaryExpression,\n unwrapExpression,\n wrapExpression,\n type Expression,\n type ExpressionOrValue,\n} from \"../../expression/expressions.js\";\nimport type { ExpressionNode } from \"../../expression/ast-nodes.js\";\nimport { symbolicValueExpressionNode } from \"../../expression/ast-nodes.js\";\nimport type { PropertySegment } from \"../../types.js\";\nimport type { ResourceNamingRules } from \"../../naming/naming-rules.js\";\nimport { namingRequiredPolicy, resolveResourceName } from \"../../naming/naming-policy.js\";\nimport {\n RAW_RESOURCE_HANDLE,\n RESOURCE_BRAND,\n RESOURCE_DECLARATION_BRAND,\n LOOPED_RESOURCE_BRAND,\n PROXY_INDEX_REF,\n INDEXED_PROXY_TARGET,\n STATE_PARENT_INDEX,\n createIndexedResourceProxy,\n createResourceMemberProxy,\n createResourceProxy,\n normalizeAssignedValue,\n unwrapResourceHandle,\n} from \"./resource-proxy.js\";\nimport { isResourceDeclaration } from \"./resource-utils.js\";\nimport type { FlatModelShape } from \"../../shape/shape.js\";\nimport { getShape, registerShape as registerShapeInRegistry } from \"../../shape/shape-registry.js\";\nimport {\n registerResource as registerResourceInRegistry,\n type ResourceCtor,\n} from \"./resource-registry.js\";\nimport type { FlatVariantSelector } from \"./resource-type-registry.js\";\n\n// ---------------------------------------------------------------------------\n// Resource types\n// ---------------------------------------------------------------------------\n\n/**\n * A Bicep `scope:` expression. Used on `existing` resource references for\n * cross-RG / cross-subscription / cross-MG / cross-tenant lookups, and on\n * modules to set the nested deployment scope.\n *\n * Typed as `Expression<unknown>` because the natural producers are the\n * scope-function helpers in `fn` (`fn.resourceGroup(...)`,\n * `fn.subscription(...)`, `fn.managementGroup(...)`, `fn.tenant()`), all\n * of which return `Expression<TScope>` proxies. Narrowing further isn't\n * worthwhile today since the set of acceptable scope-producing\n * expressions isn't closed and Bicep validates the actual call shape\n * downstream.\n */\n// TODO: further narrow to allowed expression if possible?\nexport type ScopeExpression = Expression<unknown>;\n\n/**\n * Internal representation used to construct resource handle objects.\n * The proxy converts these into the public Resource shape.\n */\nexport interface ResourceState<TType extends string = string> {\n name: ExpressionOrValue<string>;\n readonly type: TType;\n readonly apiVersion: string;\n readonly existing?: boolean | undefined;\n /**\n * Optional Bicep `scope:` expression. Currently emitted only on `existing`\n * resource references (e.g. `scope: resourceGroup('shared')` for a\n * cross-RG lookup). Future scope-hoisted resource types may emit it on\n * deployable resources too — for example, deploying a\n * `Microsoft.Management/managementGroups` from a subscription-targeted\n * file requires `scope: tenant()`. See `contributing/bicep/bicep-scope.md` section 2.2.\n *\n * For ordinary deployable resources this field is `undefined` — their\n * deployment scope is determined by the file's `targetScope` (or by the\n * containing `ResourceGroup` / module the resource lives in).\n *\n * Stored as a raw `ExpressionNode` (the user-facing `ScopeExpression`\n * proxy is unwrapped at the constructor boundary, matching the\n * \"`state` holds normalized raw nodes\" invariant that\n * `normalizeAssignedValue` maintains for every other field).\n */\n readonly scope?: ExpressionNode | undefined;\n readonly condition?: ExpressionOrValue<boolean> | undefined;\n}\n\n/**\n * Public-facing props for a reference to an existing (pre-deployed) Azure\n * resource. This is strictly narrower than the deployable resource props —\n * Bicep `existing` declarations only accept `name` and optional `scope:`.\n *\n * Read-side access on the returned resource handle is unrestricted —\n * `kv.properties.vaultUri`, `sa.id`, etc. all work and compile to symbolic\n * references that ARM resolves at deployment time.\n *\n * Symbolic parent/extension scopes are expressed by passing the parent\n * resource as the ProvisioningComponent `context` argument to the resource constructor\n * (with `{ existing: true }`), not via this `scope` field.\n */\nexport interface ExistingResourceProps {\n /** Required. The actual Azure name of the existing resource. */\n readonly name: ExpressionOrValue<string>;\n\n /**\n * Optional. The scope at which to look up the resource. Used when the\n * resource lives outside the current deployment's scope (different RG,\n * subscription, management group, or tenant).\n *\n * Pass a scope-function call expression (e.g. `resourceGroup(\"name\")`,\n * `subscription()`, `managementGroup(\"mg\")`, `tenant()`).\n */\n readonly scope?: ScopeExpression;\n}\n\n/**\n * `ExistingResourceProps` for singleton child resources — `name` is omitted\n * because singleton children have a fixed name (e.g. `\"default\"`).\n */\nexport type SingletonExistingResourceProps = Omit<ExistingResourceProps, \"name\">;\n\n/**\n * Internal props accepted by the base `Resource` constructor. A loose\n * superset of both the deployable and existing public shapes — the runtime\n * constructor branches on `props.existing` to decide which fields are\n * honored. Generated CDK resource classes expose a discriminated union\n * `(Deployable & { existing?: false }) | (Existing & { existing: true })`;\n * passing `{ ...existingProps, existing: true }` selects the existing arm and\n * emits a Bicep `existing` reference instead of a new declaration.\n */\nexport interface ResourceProps<TType extends string> {\n readonly name?: ExpressionOrValue<string> | undefined;\n readonly apiVersion: string;\n readonly type: TType;\n\n readonly existing?: boolean;\n\n /**\n * Optional Bicep `scope:` value for an existing resource reference.\n * Only honored when `existing === true`. Ignored on deployable resources\n * (non-existing resources have no per-resource scope in Bicep).\n */\n readonly scope?: ScopeExpression;\n}\n\n/**\n * Optional third-argument bag passed to every resource constructor. Holds\n * authoring flags that affect how the resource declaration is emitted but are\n * not ARM-modeled properties of the resource body.\n *\n * Fields:\n * - `condition` — an `if(...)` guard on the declaration. A boolean\n * expression (typically produced by `fn.eq`, `fn.and`, etc.) or a\n * plain `boolean`. Bind it to a `const` to reuse the same predicate\n * across multiple resources.\n *\n * `existing` is deliberately **not** an option — it is the discriminant of\n * the generated props union (`{ existing?: false } | { existing: true }`)\n * and lives on `props`. Routing it through options too would allow\n * contradictory settings between the two channels.\n *\n * `namingRules` is deliberately **not** an option either — it is\n * per-resource-type metadata declared as a `protected static namingRules`\n * field on each concrete `Resource` subclass and consumed by the base\n * constructor reflectively, so it stays off the user-facing surface.\n *\n */\nexport interface ResourceOptions {\n readonly condition?: ExpressionOrValue<boolean>;\n readonly dependsOn?: readonly ResourceDeclaration[];\n}\n\n/**\n * Shared base for resource declaration implementations.\n *\n * @remarks\n *\n * Both represent one Bicep resource declaration in the component tree and\n * share the same declaration-level state layout: identity fields\n * (`type`, `apiVersion`, `existing`), the `if(...)` guard (`condition`),\n * the optional cross-scope reference (`scope`), and the raw prop bag that\n * becomes the resource body.\n *\n * This class owns the common declaration state layout, raw-handle escape\n * hatch, and identity accessors. Subclasses supply their construction and\n * access behavior.\n */\nexport abstract class ResourceDeclaration<\n TType extends string = string,\n> extends ProvisioningComponent {\n /**\n * Brand marker for cross-realm `isResourceDeclaration()` checks. Uses\n * `Symbol.for` so it survives multiple copies of `@azure/provisioning-core`.\n * Inherited by every resource declaration implementation.\n */\n readonly [RESOURCE_DECLARATION_BRAND] = true as const;\n\n // Not `readonly`: the ctor writes `this.state = data` once. TypeScript\n // forbids subclass writes to a `readonly` parent field, so the\n // immutability is a runtime contract (never reassigned after ctor)\n // rather than a static one.\n protected state!: ResourceState<TType> & Record<string, unknown>;\n\n /**\n * Base constructor for every Bicep resource declaration.\n *\n * @remarks\n *\n * Responsibilities:\n * 1. Register in the component tree (`super(context)`).\n * 2. Enforce a deployment context ancestor.\n * 3. Unwrap `context` if it's an indexed proxy from `.at(i)` /\n * `parent.at(loop.index)`, and stash `parentIndex` on `state` so the\n * serializer can emit `parent: parentSym[index]` on the child.\n * 4. Inherit `condition` from the immediate parent resource\n * declaration when the caller doesn't supply one (Bicep requires\n * children of a conditional resource to share the same guard).\n * 5. Populate `state` — existing arm records only identity fields;\n * deployable arm runs the naming policy and applies\n * `DeploymentContext` defaults for `location` / `tags` per the\n * shape descriptor.\n *\n * Subclasses supply the last mile, including their public handle behavior.\n *\n * @param namingRules - per-resource-type constraints for the naming\n * policy. `Resource` reads this reflectively off the concrete subclass\n * constructor; internal declaration implementations receive it from\n * the concrete resource constructor they represent.\n */\n constructor(\n context: ProvisioningComponent,\n props: ResourceProps<TType> & Record<string, unknown>,\n options?: ResourceOptions,\n namingRules?: ResourceNamingRules,\n ) {\n super(context);\n\n if (!this.hasDeploymentContext()) {\n throw new Error(\"Resource declaration must have a parent deployment context.\");\n }\n\n // If `context` is an indexed proxy returned by\n // `LoopedResource.at(i)`, unwrap `this.parent`\n // back to the raw parent so tree walks and symbol-map lookups continue\n // to work, and capture the index so the serializer can emit\n // `parent: parentSym[index]` on this child. The `ProvisioningComponent` constructor\n // already pushed `this` into the correct children array (indexed proxy\n // passes `.children` through to the raw parent's array), so nothing to\n // fix up there.\n //\n // The index is recorded on the child's state (not the parent's) because\n // siblings can have different indices — `new Child(p.at(0), …)` and\n // `new Child(p.at(1), …)` both resolve `.parent` to the same raw parent,\n // so the index that distinguishes them must be per-child.\n const indexRef = (context as unknown as Record<symbol, unknown>)[PROXY_INDEX_REF];\n let parentIndex: unknown = undefined;\n if (indexRef !== undefined) {\n const rawParent = (context as unknown as Record<symbol, unknown>)[INDEXED_PROXY_TARGET] as\n ProvisioningComponent | undefined;\n if (rawParent !== undefined) {\n (this as unknown as { parent: ProvisioningComponent | undefined }).parent = rawParent;\n }\n parentIndex = indexRef;\n }\n\n // `existing` lives on `props` (it's the discriminant of the generated\n // `{ existing?: false } | { existing: true }` union). `condition` is\n // routed through `options`.\n //\n // Bicep requires a child of a conditional resource to itself be\n // conditional on the same expression. When no explicit `condition` is\n // supplied, inherit the immediate parent resource declaration's\n // condition so the emitted template stays valid — child authoring\n // shouldn't have to redundantly restate the parent's guard.\n const isExisting = props.existing === true;\n const parent = this.parent;\n const inheritedCondition = isResourceDeclaration(parent)\n ? (parent.self as unknown as { state: Record<string, unknown> }).state[\"condition\"]\n : undefined;\n const explicitCondition = options?.condition;\n const condition =\n explicitCondition !== undefined && inheritedCondition !== undefined\n ? createBinaryExpression<boolean>(\"&&\", inheritedCondition, explicitCondition)\n : (explicitCondition ?? (inheritedCondition as ExpressionOrValue<boolean> | undefined));\n const dependsOn = options?.dependsOn;\n\n let data: ResourceState<TType> & Record<string, unknown>;\n if (isExisting) {\n // Existing arm: only name + optional scope land in state. Any other\n // keys on the props object are ignored — the deserialize path may pass\n // them through, but they're never emitted on an `existing` resource.\n if (props.name === undefined) {\n throw new Error(`Resource ${props.type} marked as 'existing' but no 'name' was provided.`);\n }\n data = {\n name: props.name,\n type: props.type,\n apiVersion: props.apiVersion,\n existing: true,\n scope: props.scope === undefined ? undefined : unwrapExpression(props.scope),\n condition,\n dependsOn,\n };\n if (parentIndex !== undefined) {\n data[STATE_PARENT_INDEX] = parentIndex;\n }\n } else {\n // Deployable arm: name flows through the naming policy; the keys\n // handled explicitly here are stripped from the props bag, and\n // every remaining key is copied verbatim into state as a user-\n // authored property.\n const {\n name: _name,\n type: _type,\n apiVersion: _apiVersion,\n existing: _existing,\n scope: _scope,\n ...userProps\n } = props as ResourceProps<TType> & Record<string, unknown>;\n const ctx = this.deploymentContext;\n data = {\n name: resolveResourceName(\n ctx.namingPolicy ?? namingRequiredPolicy,\n props.name,\n props.type,\n namingRules,\n ),\n type: props.type,\n apiVersion: props.apiVersion,\n condition,\n dependsOn,\n ...userProps,\n };\n\n if (parentIndex !== undefined) {\n data[STATE_PARENT_INDEX] = parentIndex;\n }\n\n // Apply DeploymentContext defaults for `location` and `tags`, gated\n // on the shape descriptor declaring those properties as writable.\n // The TypeSpec model is the source of truth: a field marked\n // readonly in the ARM contract (e.g. `location` on most child\n // resources) is server-set, so propagating an inherited value\n // would produce an invalid PUT body. Both fields are user-wins:\n // if the user supplied a value, the inherited value is ignored\n // entirely (no merge for tags either — explicit user tags fully\n // replace inherited tags).\n const shape = getShape(props.type, props.apiVersion, data);\n if (shape !== undefined) {\n const locationShape = shape.byJsName[\"location\"];\n if (\n locationShape !== undefined &&\n locationShape.readOnly !== true &&\n data[\"location\"] === undefined &&\n ctx.location !== undefined\n ) {\n data[\"location\"] = ctx.location;\n }\n const tagsShape = shape.byJsName[\"tags\"];\n if (\n tagsShape !== undefined &&\n tagsShape.readOnly !== true &&\n data[\"tags\"] === undefined &&\n ctx.tags !== undefined &&\n Object.keys(ctx.tags).length > 0\n ) {\n data[\"tags\"] = { ...ctx.tags };\n }\n }\n }\n\n this.state = data;\n }\n\n /**\n * Core-internal escape hatch: exposes the raw `state` backing object to\n * the proxy layer (`resource-proxy.ts`) so it can read/unwrap the\n * declaration's data across module boundaries. Keyed by the\n * module-scoped {@link RAW_RESOURCE_HANDLE} symbol, which is **not**\n * exported from `@azure/provisioning-core`, so package consumers can't name it.\n *\n * `protected` (not `private`) because the accessors that read it use\n * `Reflect.get` / structural casts that bypass TS visibility anyway;\n * the modifier just keeps it off the public type surface. It can't be a\n * `#private` field because the proxy layer lives in a different class.\n *\n * @internal\n */\n protected get [RAW_RESOURCE_HANDLE](): ResourceState<TType> & Record<string, unknown> {\n return this.state;\n }\n\n get type(): TType {\n return this.state.type;\n }\n\n get apiVersion(): string {\n return this.state.apiVersion;\n }\n\n get existing(): boolean | undefined {\n return this.state.existing;\n }\n\n get condition(): ExpressionOrValue<boolean> | undefined {\n return this.state.condition;\n }\n\n get dependsOn(): readonly ResourceDeclaration[] | undefined {\n return this.state.dependsOn as readonly ResourceDeclaration[] | undefined;\n }\n\n protected expr<TValue>(...path: readonly PropertySegment[]): Expression<TValue> & TValue {\n return createResourceMemberProxy(\n {\n resource: this as unknown as Resource,\n root: unwrapResourceHandle(this as unknown as Resource) as unknown as Record<\n string,\n unknown\n >,\n },\n path,\n );\n }\n\n protected setProperty(key: string, value: unknown): void {\n this.state[key] = normalizeAssignedValue(value, this as unknown as Resource);\n }\n}\n\n/**\n * Base class for all Azure resources.\n *\n * @remarks\n * Resources are fully initialized at construction time. Pass a parent\n * `ProvisioningComponent` (typically a `Stack` or `ResourceGroup`) as the first\n * argument — the resource registers itself in the tree automatically.\n *\n * Properties use expression-backed proxies: reading `resource.name`\n * returns an `Expression` that compiles to a Bicep symbolic reference,\n * not a plain string. Use `this.expr()` in subclasses to create\n * property getters and `this.setProperty()` for setters.\n *\n * @example\n * ```typescript snippet:ignore\n * import { ResourceGroup, Stack } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\", { targetScope: \"subscription\" });\n * const rg = new ResourceGroup(stack, { name: \"rg-my-app\", location: \"eastus\" });\n * const vault = new KeyVault(rg, {\n * name: \"kv-my-app\",\n * properties: {\n * tenantId: \"11111111-1111-1111-1111-111111111111\",\n * sku: { family: \"A\", name: \"standard\" },\n * },\n * });\n *\n * // vault.name is an Expression, not a string\n * // vault.id compiles to resourceId(...)\n * ```\n */\nexport class Resource<TType extends string = string> extends ResourceDeclaration<TType> {\n /**\n * Brand marker for cross-realm `isResource()` checks.\n * Uses `Symbol.for` so it survives multiple copies of `@azure/provisioning-core`.\n */\n readonly [RESOURCE_BRAND] = true as const;\n\n /**\n * Register a {@link FlatModelShape} for this resource class's\n * `(resourceType, apiVersion)` pair. Intended to be invoked from a\n * `static {}` initializer in generated subclasses so the registration\n * happens at module load.\n *\n * The static method reads `resourceType` and `apiVersion` off `this`\n * (the subclass that called it), so callers don't repeat the literals.\n */\n static registerShape(\n this: { readonly resourceType: string; readonly apiVersion: string },\n shape: FlatModelShape,\n variantSelector?: FlatVariantSelector,\n ): void {\n registerShapeInRegistry(this.resourceType, this.apiVersion, shape, variantSelector);\n }\n\n /**\n * Register this class with the global resource registry so the\n * deserializer can reconstruct instances of it (instead of falling\n * back to base `Resource`) for matching `(resourceType, apiVersion)`\n * pairs. Intended to be invoked from a `static {}` initializer in\n * generated classes alongside {@link Resource.registerShape}.\n *\n * Pass an ordered discriminator path for concrete resource variants. A\n * singleton is one segment (`name=signin`); model-discriminated resources\n * may use `kind` or several nested segments. Omit for ordinary resources.\n */\n protected static register(this: ResourceCtor, variantSelector?: FlatVariantSelector): void {\n registerResourceInRegistry(this, variantSelector);\n }\n\n /**\n * Assemble the base-`Resource` constructor payload (the second `super(...)`\n * argument) from the user-facing props. This is a **static \"virtual\"**:\n * it runs before an instance exists (to compute the `super` argument), so\n * it can't be an instance method — but it still dispatches through the\n * calling constructor, so a subclass's override wins.\n *\n * Every emitter-generated resource overrides this to inject its fixed\n * identity (`type` / `apiVersion`), the singleton `name`, and its explicit\n * writable-field copy. Both ordinary construction and internal resource\n * reconstruction funnel through this method so prop shaping remains\n * consistent.\n *\n * This base default is the fallback used when the wrapped constructor is\n * base `Resource` itself — the deserialize path for an unregistered\n * `(type, apiVersion)` pair, where `type` / `apiVersion` are threaded in\n * through `props` rather than read off statics. Keeping the default here\n * guarantees the method is always present for internal reconstruction.\n */\n protected static buildResourceProps(\n props?: unknown,\n ): ResourceProps<string> & Record<string, unknown> {\n const p = (props as Record<string, unknown> | undefined) ?? {};\n return {\n ...p,\n type:\n (p[\"type\"] as string | undefined) ??\n (this as unknown as { resourceType?: string }).resourceType,\n apiVersion:\n (p[\"apiVersion\"] as string | undefined) ??\n (this as unknown as { apiVersion?: string }).apiVersion,\n } as ResourceProps<string> & Record<string, unknown>;\n }\n\n /**\n * Per-resource-type naming constraints, consumed by the active\n * {@link NamingPolicy} when a resource is created without an explicit\n * `name`. Generated CDK subclasses override this with a concrete value;\n * the base default of `undefined` yields `MOST_RESTRICTIVE` behavior.\n *\n * This is type metadata, not user input, so it is kept off the public\n * props surface and read reflectively in the constructor via\n * `this.constructor` rather than being threaded through `ResourceProps`.\n */\n protected static namingRules?: ResourceNamingRules;\n\n protected _selfProxy: this | undefined;\n\n constructor(\n context: ProvisioningComponent,\n props: ResourceProps<TType> & Record<string, unknown>,\n options?: ResourceOptions,\n ) {\n super(\n context,\n props,\n options,\n // Naming rules live as a `protected static namingRules` field on\n // each concrete resource subclass, not on the public props bag.\n // Read reflectively off `new.target` (the most-derived class being\n // instantiated) — `this.constructor` would work too but TS forbids\n // touching `this` before `super()`. Static inheritance falls back\n // to `Resource`'s `undefined` default when a subclass omits the\n // field (e.g. singleton children). `resolveResourceName` (called\n // inside `ResourceDeclaration`) treats `undefined` as\n // `MOST_RESTRICTIVE`.\n (new.target as typeof Resource).namingRules,\n );\n\n const proxy = createResourceProxy(this as this & Resource<TType>);\n this._selfProxy = proxy;\n\n // Tricky part for the proxy implementation:\n // ProvisioningComponent constructor pushed `this` (bare instance) into parent.children\n // before the proxy existed. Swap it for the proxy so external consumers\n // see proxy-backed handles (with property access, etc.) when iterating.\n const idx = context.children.indexOf(this);\n if (idx >= 0) context.children[idx] = proxy;\n\n return proxy;\n }\n\n override get self(): this {\n return this._selfProxy ?? this;\n }\n\n /**\n * The Azure resource name as a Bicep symbolic-reference expression.\n *\n * The value is established at construction time (either user-supplied\n * via `props.name` or filled in by the naming policy) and stored on\n * `state.name`. The setter routes through `setProperty` so post-\n * construction edits flow through the same proxy/expression machinery\n * as any other property — useful when working with a base `Resource`\n * reference and re-binding the name dynamically. Singleton subclasses\n * override this getter to narrow the return type to the literal\n * `Expression<\"<singletonName>\">`; non-singleton subclasses inherit\n * this accessor pair as-is.\n */\n get name(): Expression<string> {\n return this.expr(\"name\");\n }\n set name(value: ExpressionOrValue<string>) {\n this.setProperty(\"name\", value);\n }\n\n get id(): Expression<string> {\n return this.expr(\"id\");\n }\n}\n\n// ---------------------------------------------------------------------------\n// Loop\n// ---------------------------------------------------------------------------\n\n/**\n * Metadata describing a Bicep `[for … in …]` loop and the concrete\n * variable names used inside it. Stored publicly on {@link LoopedResource.loop}\n * once a looped resource declaration has been created.\n */\nexport interface LoopContext {\n readonly collection: unknown;\n readonly itemVariable: string;\n readonly indexVariable?: string;\n readonly batchSize?: number;\n}\n\n/**\n * Options accepted by `new Loop(collection, options?)`. All fields are\n * optional overrides; the constructor supplies defaults. Derived from\n * {@link LoopContext} so there is exactly one source of truth for the\n * shape of loop metadata.\n */\nexport type LoopOptions = Partial<Omit<LoopContext, \"collection\">>;\n\n/**\n * Describes a Bicep `[for item in collection: ...]` loop as a plain data\n * object. Construct one and pass it to\n * `Ctor.fromLoop(loop, context, props, options?)` (e.g.\n * `StorageAccount.fromLoop(...)`) to expand a resource declaration into a\n * resource-copy loop.\n *\n * The item and index variable names default to `item` / `i`. Bicep\n * for-expressions bind their loop variables only within their own body,\n * so two sibling `[for item in xs: …]` / `[for item in ys: …]` in the\n * same file do **not** collide — each `item` is scoped to its own\n * expression. If you nest a `Loop` inside another loop's body (rare),\n * pass `{ itemVariable, indexVariable }` explicitly on the inner one to\n * disambiguate. `batchSize` on the loop renders as `@batchSize(n)` on\n * the resource that consumes it.\n *\n * The `indexVariable` name is always materialized on read (never\n * `undefined`), but whether the wire actually **records** it — and\n * therefore whether the renderer emits the `[for (item, i) in …]` tuple\n * binding — is decided by whether anyone accessed `loop.index` (or the\n * caller supplied `{ indexVariable }` explicitly). A loop whose body\n * never mentions an index emits a bare `[for item in xs: …]`.\n *\n * `Loop` instances are pure data — creating one has no side effect.\n */\nexport class Loop<T> {\n readonly collection: ExpressionOrValue<T[]>;\n readonly itemVariable: string;\n readonly item: Expression<T>;\n readonly batchSize?: number;\n\n // The default name assigned to `indexVariable` on first materialization,\n // if the caller neither passed `{ indexVariable }` nor accessed `.index`.\n readonly #defaultIndexVariable: string;\n #indexVariable: string | undefined;\n #indexExpr: Expression<number> | undefined;\n #indexRequested = false;\n\n constructor(collection: ExpressionOrValue<T[]>, options?: LoopOptions) {\n this.collection = collection;\n\n this.itemVariable = options?.itemVariable ?? \"item\";\n this.#defaultIndexVariable = \"i\";\n\n if (options?.indexVariable !== undefined) {\n // Explicit option counts as a request — the wire and renderer must\n // honor the caller's chosen name whether or not they read `.index`.\n this.#indexVariable = options.indexVariable;\n this.#indexRequested = true;\n }\n if (options?.batchSize !== undefined) {\n this.batchSize = options.batchSize;\n }\n\n this.item = wrapExpression(symbolicValueExpressionNode(this.itemVariable)) as Expression<T>;\n }\n\n /**\n * Name of the loop's index variable. Always defined — reading it\n * materializes the default (`i`) if the caller neither passed\n * `{ indexVariable }` nor accessed `.index` yet.\n *\n * Reading `.indexVariable` also marks the index as requested (same as\n * reading `.index`), because a caller who wants the variable name is\n * almost certainly going to use it. If the wire-omit optimization\n * (bare `[for item in …]` with no index binding) matters, callers\n * should gate on `.indexRequested` first before touching this getter.\n */\n get indexVariable(): string {\n this.#indexRequested = true;\n if (this.#indexVariable === undefined) {\n this.#indexVariable = this.#defaultIndexVariable;\n }\n return this.#indexVariable;\n }\n\n /**\n * Expression referencing the current iteration's index. Reading this the\n * first time marks the index as requested, which causes the wire to\n * include `indexVariable` on the `for-expression` node and the renderer\n * to emit `[for (item, i) in …]`. Callers who never touch `.index` get\n * the cleaner index-less form.\n */\n get index(): Expression<number> {\n this.#indexRequested = true;\n if (this.#indexExpr === undefined) {\n const name = this.indexVariable;\n this.#indexExpr = wrapExpression(symbolicValueExpressionNode(name)) as Expression<number>;\n }\n return this.#indexExpr;\n }\n\n /**\n * Framework-internal signal used by `Resource.fromLoop` to decide\n * whether the wire should include the index binding. `true` when the\n * caller either supplied `{ indexVariable }` explicitly or has accessed\n * `.index` / `.indexVariable` at least once. Not exported from\n * `@azure/provisioning-core`.\n *\n * @internal\n */\n get indexRequested(): boolean {\n return this.#indexRequested;\n }\n}\n\n// ---------------------------------------------------------------------------\n// LoopedResource<T> — a Bicep for-expanded resource declaration as a real\n// ProvisioningComponent in the tree, sitting alongside scalar `Resource` under the same\n// `ResourceDeclaration` base.\n// ---------------------------------------------------------------------------\n\n/**\n * A `LoopedResource<T>` represents a single Bicep resource declaration\n * expanded across a loop (`[for x in xs: {...}]`). It is a real\n * `ProvisioningComponent` in the tree — one node per emitted declaration — and\n * exposes indexed access into individual iterations via\n * {@link LoopedResource.at}.\n *\n * @remarks\n *\n * Property access on a `LoopedResource` is deliberately not exposed at\n * the type level: pick an index (`at`) to obtain a proxy that emits\n * `sym[i].prop`. This mirrors Bicep's requirement that individual\n * iterations be accessed by index.\n *\n * `.at(i)` returns the concrete resource type `T`. The returned proxy\n * exposes the essential ARM surface — the property getters/setters that\n * funnel through `this.expr(...)` (`.id`, `.name`, `.sku`,\n * `.properties.*`, …) rooted at `sym[i]` — as well as the child\n * accessors (`keyVault.secrets`, singleton getter/setters), which are\n * derived from the parent's `children` scoped to element `i`. To attach\n * per-iteration children, parent them to `parent.at(loop.index)` — e.g.\n * `Child.fromLoop(loop, parent.at(loop.index), ...)`.\n *\n * Projection over the loop (Bicep `map(sym, x => body)`) is tracked as\n * a follow-up effort — see the \"lambda + fn.map\" issue.\n */\nexport class LoopedResource<T extends Resource = Resource> extends ResourceDeclaration<T[\"type\"]> {\n /**\n * Cross-realm brand — same technique as the scalar `RESOURCE_BRAND`.\n * Use {@link isLoopedResource} instead of `instanceof`\n * when multiple copies of `@azure/provisioning-core` may be loaded.\n */\n readonly [LOOPED_RESOURCE_BRAND] = true as const;\n\n /** Metadata describing the loop that produced this declaration. */\n readonly loop: LoopContext;\n\n readonly #wrappedCtor: new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T;\n\n private constructor(\n context: ProvisioningComponent,\n wrappedCtor: new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T,\n userProps: unknown,\n loop: Loop<unknown>,\n options?: ResourceOptions,\n ) {\n // The subclass constructor never runs for a looped row — only this\n // shared `ResourceDeclaration` ctor does. To keep the scalar and\n // looped construction paths from drifting, shape the props bag through\n // the SAME static the scalar ctor uses: every `Resource` (sub)class\n // inherits or overrides `buildResourceProps`, which returns the exact\n // `super()` payload the scalar ctor passes — including the fixed `name`\n // for singletons and any other prop shaping. (This is what fixes looped\n // singletons losing their fixed `name`.)\n //\n // It is always present: base `Resource` — the deserialize fallback ctor\n // for an unregistered `(type, apiVersion)` pair — supplies a default\n // that threads `type` / `apiVersion` in from `userProps`. So there's no\n // existence branch here.\n const props = (\n wrappedCtor as unknown as {\n buildResourceProps: (props: unknown) => ResourceProps<T[\"type\"]> & Record<string, unknown>;\n }\n ).buildResourceProps.call(wrappedCtor, userProps);\n super(\n context,\n props,\n options,\n (wrappedCtor as unknown as { namingRules?: ResourceNamingRules }).namingRules,\n );\n this.#wrappedCtor = wrappedCtor;\n // Snapshot the loop metadata at declaration time. `indexVariable` is\n // recorded only if the index was requested by now — either the caller\n // supplied `{ indexVariable }` or read `loop.index` / `loop.indexVariable`\n // before this declaration. Reading `loop.index` (e.g. via\n // `parent.at(loop.index)`) marks the live loop so descendant\n // declarations (which snapshot the same loop afterwards) pick up the\n // binding, while this declaration's own for-expression stays index-less.\n this.loop = {\n collection: loop.collection,\n itemVariable: loop.itemVariable,\n ...(loop.indexRequested ? { indexVariable: loop.indexVariable } : {}),\n ...(loop.batchSize !== undefined ? { batchSize: loop.batchSize } : {}),\n };\n }\n\n /**\n * The concrete `Resource` subclass this looped declaration wraps.\n * Used by query machinery to answer \"which subclass is this looped\n * resource\" — the analogue of `instanceof T` for `LoopedResource<T>`.\n *\n * This is always the full subclass the user constructed via\n * `Xxx.fromLoop(...)` — query identity matches on that class, and it is\n * the prototype the `.at(i)` proxy uses to resolve ARM accessors.\n */\n get wrappedCtor(): new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T {\n return this.#wrappedCtor;\n }\n\n /**\n * Reference the element at `index`. Emits `sym[index].<...>` for\n * subsequent property access.\n *\n * Returns the concrete resource type `T`. At runtime an indexed proxy is\n * spliced over the full class prototype (`#wrappedCtor.prototype`):\n * prototype getters that funnel through `this.expr(...)` (`.id`, `.name`,\n * `.properties.*`, …) resolve rooted at `sym[index]`. A child created with\n * `parent.at(i)` is stamped with that index for serialization.\n */\n at(index: ExpressionOrValue<number>): T {\n // `this` is a `ResourceDeclaration`; the handle derives the subclass\n // prototype from `this.wrappedCtor`. The explicit type argument pins\n // the return type, which TypeScript can't otherwise resolve from the\n // deferred polymorphic `this`.\n return createIndexedResourceProxy<LoopedResource<T>>(this, index);\n }\n}\n\n/** @internal */\nexport function createLoopedResource<T extends Resource, C extends ProvisioningComponent, P, Item>(\n wrappedCtor: new (context: C, props: P, options?: ResourceOptions) => T,\n loop: Loop<Item>,\n context: C,\n ...rest: undefined extends P\n ? [props?: P, options?: ResourceOptions]\n : [props: P, options?: ResourceOptions]\n): LoopedResource<T> {\n const [userProps, options] = rest as [P?, ResourceOptions?];\n // `LoopedResource`'s ctor is private; access via cast because this module\n // owns both the declaration and its internal construction boundary.\n const LoopedCtor = LoopedResource as unknown as new <U extends Resource>(\n context: ProvisioningComponent,\n wrappedCtor: new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => U,\n userProps: unknown,\n loop: Loop<unknown>,\n options?: ResourceOptions,\n ) => LoopedResource<U>;\n return new LoopedCtor(\n context,\n wrappedCtor as new (\n context: ProvisioningComponent,\n props: unknown,\n options?: ResourceOptions,\n ) => T,\n userProps,\n loop,\n options,\n );\n}\n"]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ProvisioningComponent } from "./provisioning-component.js";
|
|
2
|
+
import type { ExpressionOrValue } from "../expression/expressions.js";
|
|
3
|
+
import type { NamingPolicy } from "../naming/naming-policy.js";
|
|
4
|
+
import { OutputCollection } from "./output.js";
|
|
5
|
+
import { ParameterCollection } from "./parameter.js";
|
|
6
|
+
import { VariableCollection } from "./variable.js";
|
|
7
|
+
import { type QueryOptions } from "./resource/resource-query.js";
|
|
8
|
+
import { type Loop, type LoopedResource, type Resource, type ResourceOptions } from "./resource/resource.js";
|
|
9
|
+
import type { ResourceCtor } from "./resource/resource-registry.js";
|
|
10
|
+
import type { TargetScope } from "../serialization/contract/index.js";
|
|
11
|
+
export interface StackOptions {
|
|
12
|
+
readonly targetScope?: TargetScope | undefined;
|
|
13
|
+
readonly location?: ExpressionOrValue<string> | undefined;
|
|
14
|
+
readonly tags?: Record<string, ExpressionOrValue<string>> | undefined;
|
|
15
|
+
readonly namingPolicy?: NamingPolicy | undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Stack defines a deployment unit.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Each stack produces one or more Bicep files — resources at different
|
|
22
|
+
* scopes (subscription vs. resource group) are split into separate files
|
|
23
|
+
* linked by module references.
|
|
24
|
+
*
|
|
25
|
+
* Resources register themselves by passing the stack (or a child component)
|
|
26
|
+
* as their first constructor argument. `Stack.add()` is available as a
|
|
27
|
+
* convenience for creating child components with the stack as parent.
|
|
28
|
+
*
|
|
29
|
+
* The `targetScope` option controls the Bicep target scope. Default is
|
|
30
|
+
* `"subscription"`, which requires explicit `ResourceGroup` instances.
|
|
31
|
+
* Set `"resourceGroup"` to deploy resources directly into an existing
|
|
32
|
+
* resource group.
|
|
33
|
+
*
|
|
34
|
+
* Every stack registers itself in `Stack.roots` for collection by tools
|
|
35
|
+
* like the playground and CLI.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript snippet:ignore
|
|
39
|
+
* import { Stack, ResourceGroup } from "@azure/provisioning-core";
|
|
40
|
+
* import { KeyVault } from "@azure/provisioning-keyvault";
|
|
41
|
+
*
|
|
42
|
+
* const stack = new Stack("my-app");
|
|
43
|
+
* const rg = new ResourceGroup(stack, { name: "rg-my-app", location: "eastus" });
|
|
44
|
+
* const vault = new KeyVault(rg, {
|
|
45
|
+
* name: "kv-my-app",
|
|
46
|
+
* properties: {
|
|
47
|
+
* tenantId: "11111111-1111-1111-1111-111111111111",
|
|
48
|
+
* sku: { family: "A", name: "standard" },
|
|
49
|
+
* },
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare class Stack extends ProvisioningComponent {
|
|
54
|
+
#private;
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly targetScope: TargetScope;
|
|
57
|
+
readonly parameters: ParameterCollection;
|
|
58
|
+
readonly variables: VariableCollection;
|
|
59
|
+
readonly outputs: OutputCollection;
|
|
60
|
+
/** All root stacks created since the last call to `Stack.clearRoots()`. */
|
|
61
|
+
static get roots(): readonly Stack[];
|
|
62
|
+
/**
|
|
63
|
+
* Returns all root stacks and clears the registry. Useful for collecting
|
|
64
|
+
* all stacks after executing user code (e.g. in the playground or CLI).
|
|
65
|
+
*/
|
|
66
|
+
static clearRoots(): Stack[];
|
|
67
|
+
/** Create a root stack. */
|
|
68
|
+
constructor(name: string, options?: StackOptions);
|
|
69
|
+
/**
|
|
70
|
+
* The scalar resources in this stack. With no `type`, returns
|
|
71
|
+
* every scalar resource; pass a resource class to filter and narrow to
|
|
72
|
+
* that subclass. Returns a plain array — use native `.filter` / `.find` /
|
|
73
|
+
* `.map` for anything further.
|
|
74
|
+
*
|
|
75
|
+
* By default walks the whole tree; pass `{ recursive: false }` to consider
|
|
76
|
+
* only the stack's direct children.
|
|
77
|
+
*/
|
|
78
|
+
getResources(options?: QueryOptions): Resource[];
|
|
79
|
+
getResources<T extends Resource>(type: ResourceCtor<T>, options?: QueryOptions): T[];
|
|
80
|
+
/**
|
|
81
|
+
* Find the **first** scalar resource of `type` whose literal name equals
|
|
82
|
+
* `name`, or `undefined` if none matches.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* Returns the first match in tree order. ARM names are unique only *per
|
|
86
|
+
* resource type within a scope*, so a stack MAY legitimately contain more
|
|
87
|
+
* than one resource of the same `type` and `name` (e.g. across different
|
|
88
|
+
* resource groups) — this returns whichever is found first. Use
|
|
89
|
+
* `getResources(type)` and filter yourself if you need all matches.
|
|
90
|
+
*
|
|
91
|
+
* Only scalar resources are searched, and names that do not resolve to a
|
|
92
|
+
* string literal are never matched. Pass `{ recursive: false }` to search
|
|
93
|
+
* only the stack's direct children.
|
|
94
|
+
*/
|
|
95
|
+
getResource<T extends Resource>(type: ResourceCtor<T>, name: string, options?: QueryOptions): T | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Create a child under this stack (with the stack as its parent context),
|
|
98
|
+
* as a convenience for `new Ctor(stack, ...args)`.
|
|
99
|
+
*
|
|
100
|
+
* Constructs a single child instance and returns it.
|
|
101
|
+
*/
|
|
102
|
+
add<T extends new (context: ProvisioningComponent, ...args: any[]) => ProvisioningComponent>(ctor: T, ...args: ConstructorParameters<T> extends [any, ...infer Rest] ? Rest : never): InstanceType<T>;
|
|
103
|
+
}
|
|
104
|
+
/** @internal */
|
|
105
|
+
export declare function getLoopedResources(stack: Stack, options?: QueryOptions): LoopedResource<Resource>[];
|
|
106
|
+
/** @internal */
|
|
107
|
+
export declare function getLoopedResources<T extends Resource>(stack: Stack, type: ResourceCtor<T>, options?: QueryOptions): LoopedResource<T>[];
|
|
108
|
+
/** @internal */
|
|
109
|
+
export declare function addLoopedResource<T extends Resource, P>(stack: Stack, ctor: new (context: Stack, props: P, options?: ResourceOptions) => T, loop: Loop<unknown>, ...rest: undefined extends P ? [props?: P, options?: ResourceOptions] : [props: P, options?: ResourceOptions]): LoopedResource<T>;
|
|
110
|
+
//# sourceMappingURL=stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../src/constructs/stack.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAMtE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAClD;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AChB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,YAAY,GACrB,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC9B,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,QAAQ,EACnD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,EAAE,YAAY,GACrB,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;AASvB,gBAAgB;AAChB,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,EACrD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,KAAK,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,KAAK,CAAC,EACpE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EACnB,GAAG,IAAI,EAAE,SAAS,SAAS,CAAC,GACxB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,CAAC,GACtC,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,eAAe,CAAC,GACxC,cAAc,CAAC,CAAC,CAAC,CAEnB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { ProvisioningComponent } from "./provisioning-component.js";
|
|
4
|
+
import { DefaultNamingPolicy } from "../naming/naming-policy.js";
|
|
5
|
+
import { OutputCollection } from "./output.js";
|
|
6
|
+
import { ParameterCollection } from "./parameter.js";
|
|
7
|
+
import { VariableCollection } from "./variable.js";
|
|
8
|
+
import { getLoopedResources as runGetLoopedResources, getResources as runGetResources, getResource as runGetResource, } from "./resource/resource-query.js";
|
|
9
|
+
import { createLoopedResource, } from "./resource/resource.js";
|
|
10
|
+
/**
|
|
11
|
+
* A Stack defines a deployment unit.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Each stack produces one or more Bicep files — resources at different
|
|
15
|
+
* scopes (subscription vs. resource group) are split into separate files
|
|
16
|
+
* linked by module references.
|
|
17
|
+
*
|
|
18
|
+
* Resources register themselves by passing the stack (or a child component)
|
|
19
|
+
* as their first constructor argument. `Stack.add()` is available as a
|
|
20
|
+
* convenience for creating child components with the stack as parent.
|
|
21
|
+
*
|
|
22
|
+
* The `targetScope` option controls the Bicep target scope. Default is
|
|
23
|
+
* `"subscription"`, which requires explicit `ResourceGroup` instances.
|
|
24
|
+
* Set `"resourceGroup"` to deploy resources directly into an existing
|
|
25
|
+
* resource group.
|
|
26
|
+
*
|
|
27
|
+
* Every stack registers itself in `Stack.roots` for collection by tools
|
|
28
|
+
* like the playground and CLI.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript snippet:ignore
|
|
32
|
+
* import { Stack, ResourceGroup } from "@azure/provisioning-core";
|
|
33
|
+
* import { KeyVault } from "@azure/provisioning-keyvault";
|
|
34
|
+
*
|
|
35
|
+
* const stack = new Stack("my-app");
|
|
36
|
+
* const rg = new ResourceGroup(stack, { name: "rg-my-app", location: "eastus" });
|
|
37
|
+
* const vault = new KeyVault(rg, {
|
|
38
|
+
* name: "kv-my-app",
|
|
39
|
+
* properties: {
|
|
40
|
+
* tenantId: "11111111-1111-1111-1111-111111111111",
|
|
41
|
+
* sku: { family: "A", name: "standard" },
|
|
42
|
+
* },
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class Stack extends ProvisioningComponent {
|
|
47
|
+
name;
|
|
48
|
+
targetScope;
|
|
49
|
+
parameters = new ParameterCollection();
|
|
50
|
+
variables = new VariableCollection();
|
|
51
|
+
outputs = new OutputCollection();
|
|
52
|
+
// --- Static root stack registry ---
|
|
53
|
+
static #roots = [];
|
|
54
|
+
/** All root stacks created since the last call to `Stack.clearRoots()`. */
|
|
55
|
+
static get roots() {
|
|
56
|
+
return Stack.#roots;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns all root stacks and clears the registry. Useful for collecting
|
|
60
|
+
* all stacks after executing user code (e.g. in the playground or CLI).
|
|
61
|
+
*/
|
|
62
|
+
static clearRoots() {
|
|
63
|
+
return Stack.#roots.splice(0, Stack.#roots.length);
|
|
64
|
+
}
|
|
65
|
+
/** Create a root stack. */
|
|
66
|
+
constructor(name, options) {
|
|
67
|
+
super();
|
|
68
|
+
const opts = options ?? {};
|
|
69
|
+
this.name = name;
|
|
70
|
+
this.targetScope = opts.targetScope ?? "subscription";
|
|
71
|
+
Stack.#roots.push(this);
|
|
72
|
+
this._localDeploymentContext = {
|
|
73
|
+
location: opts.location,
|
|
74
|
+
tags: opts.tags,
|
|
75
|
+
namingPolicy: opts.namingPolicy ?? new DefaultNamingPolicy({ workload: name }),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
getResources(typeOrOptions, maybeOptions) {
|
|
79
|
+
return runGetResources(this, typeOrOptions, maybeOptions);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Find the **first** scalar resource of `type` whose literal name equals
|
|
83
|
+
* `name`, or `undefined` if none matches.
|
|
84
|
+
*
|
|
85
|
+
* @remarks
|
|
86
|
+
* Returns the first match in tree order. ARM names are unique only *per
|
|
87
|
+
* resource type within a scope*, so a stack MAY legitimately contain more
|
|
88
|
+
* than one resource of the same `type` and `name` (e.g. across different
|
|
89
|
+
* resource groups) — this returns whichever is found first. Use
|
|
90
|
+
* `getResources(type)` and filter yourself if you need all matches.
|
|
91
|
+
*
|
|
92
|
+
* Only scalar resources are searched, and names that do not resolve to a
|
|
93
|
+
* string literal are never matched. Pass `{ recursive: false }` to search
|
|
94
|
+
* only the stack's direct children.
|
|
95
|
+
*/
|
|
96
|
+
getResource(type, name, options) {
|
|
97
|
+
return runGetResource(this, type, name, options);
|
|
98
|
+
}
|
|
99
|
+
add(ctor, ...rest) {
|
|
100
|
+
return new ctor(this.self, ...rest);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export function getLoopedResources(stack, typeOrOptions, maybeOptions) {
|
|
104
|
+
return runGetLoopedResources(stack, typeOrOptions, maybeOptions);
|
|
105
|
+
}
|
|
106
|
+
/** @internal */
|
|
107
|
+
export function addLoopedResource(stack, ctor, loop, ...rest) {
|
|
108
|
+
return createLoopedResource(ctor, loop, stack.self, ...rest);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../src/constructs/stack.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,kBAAkB,IAAI,qBAAqB,EAC3C,YAAY,IAAI,eAAe,EAC/B,WAAW,IAAI,cAAc,GAE9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAAoB,GAKrB,MAAM,wBAAwB,CAAC;AAehC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,KAAM,SAAQ,qBAAqB;IACrC,IAAI,CAAS;IACb,WAAW,CAAc;IACzB,UAAU,GAAwB,IAAI,mBAAmB,EAAE,CAAC;IAC5D,SAAS,GAAuB,IAAI,kBAAkB,EAAE,CAAC;IACzD,OAAO,GAAqB,IAAI,gBAAgB,EAAE,CAAC;IAE5D,qCAAqC;IAErC,MAAM,CAAC,MAAM,GAAY,EAAE,CAAC;IAE5B,2EAA2E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,OAAO,qBAAqB,CAAC,KAAK,EAAE,aAAsB,EAAE,YAAY,CAAC,CAAC;AAC5E,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,iBAAiB,CAC/B,KAAY,EACZ,IAAoE,EACpE,IAAmB,EACnB,GAAG,IAEsC;IAEzC,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ProvisioningComponent } from \"./provisioning-component.js\";\nimport type { ExpressionOrValue } from \"../expression/expressions.js\";\nimport type { NamingPolicy } from \"../naming/naming-policy.js\";\nimport { DefaultNamingPolicy } from \"../naming/naming-policy.js\";\nimport { OutputCollection } from \"./output.js\";\nimport { ParameterCollection } from \"./parameter.js\";\nimport { VariableCollection } from \"./variable.js\";\nimport {\n getLoopedResources as runGetLoopedResources,\n getResources as runGetResources,\n getResource as runGetResource,\n type QueryOptions,\n} from \"./resource/resource-query.js\";\nimport {\n createLoopedResource,\n type Loop,\n type LoopedResource,\n type Resource,\n type ResourceOptions,\n} from \"./resource/resource.js\";\nimport type { ResourceCtor } from \"./resource/resource-registry.js\";\nimport type { TargetScope } from \"../serialization/contract/index.js\";\n\n// ---------------------------------------------------------------------------\n// Stack — class-based API for creating stacks\n// ---------------------------------------------------------------------------\n\nexport interface StackOptions {\n readonly targetScope?: TargetScope | undefined;\n readonly location?: ExpressionOrValue<string> | undefined;\n readonly tags?: Record<string, ExpressionOrValue<string>> | undefined;\n readonly namingPolicy?: NamingPolicy | undefined;\n}\n\n/**\n * A Stack defines a deployment unit.\n *\n * @remarks\n * Each stack produces one or more Bicep files — resources at different\n * scopes (subscription vs. resource group) are split into separate files\n * linked by module references.\n *\n * Resources register themselves by passing the stack (or a child component)\n * as their first constructor argument. `Stack.add()` is available as a\n * convenience for creating child components with the stack as parent.\n *\n * The `targetScope` option controls the Bicep target scope. Default is\n * `\"subscription\"`, which requires explicit `ResourceGroup` instances.\n * Set `\"resourceGroup\"` to deploy resources directly into an existing\n * resource group.\n *\n * Every stack registers itself in `Stack.roots` for collection by tools\n * like the playground and CLI.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, ResourceGroup } from \"@azure/provisioning-core\";\n * import { KeyVault } from \"@azure/provisioning-keyvault\";\n *\n * const stack = new Stack(\"my-app\");\n * const rg = new ResourceGroup(stack, { name: \"rg-my-app\", location: \"eastus\" });\n * const vault = new KeyVault(rg, {\n * name: \"kv-my-app\",\n * properties: {\n * tenantId: \"11111111-1111-1111-1111-111111111111\",\n * sku: { family: \"A\", name: \"standard\" },\n * },\n * });\n * ```\n */\nexport class Stack extends ProvisioningComponent {\n readonly name: string;\n readonly targetScope: TargetScope;\n readonly parameters: ParameterCollection = new ParameterCollection();\n readonly variables: VariableCollection = new VariableCollection();\n readonly outputs: OutputCollection = new OutputCollection();\n\n // --- Static root stack registry ---\n\n static #roots: Stack[] = [];\n\n /** All root stacks created since the last call to `Stack.clearRoots()`. */\n static get roots(): readonly Stack[] {\n return Stack.#roots;\n }\n\n /**\n * Returns all root stacks and clears the registry. Useful for collecting\n * all stacks after executing user code (e.g. in the playground or CLI).\n */\n static clearRoots(): Stack[] {\n return Stack.#roots.splice(0, Stack.#roots.length);\n }\n\n /** Create a root stack. */\n constructor(name: string, options?: StackOptions) {\n super();\n const opts = options ?? {};\n this.name = name;\n this.targetScope = opts.targetScope ?? \"subscription\";\n Stack.#roots.push(this);\n this._localDeploymentContext = {\n location: opts.location,\n tags: opts.tags,\n namingPolicy: opts.namingPolicy ?? new DefaultNamingPolicy({ workload: name }),\n };\n }\n\n // --- Query ---\n // Query the resources in this stack. Exposed on `Stack` (not `ProvisioningComponent`)\n // because \"all resources in the stack\" is unambiguous, whereas\n // `resource.getResources()` — which excludes the resource itself —\n // would be confusing. For multiple stacks, use\n // `stacks.flatMap(s => s.getResources(...))`.\n\n /**\n * The scalar resources in this stack. With no `type`, returns\n * every scalar resource; pass a resource class to filter and narrow to\n * that subclass. Returns a plain array — use native `.filter` / `.find` /\n * `.map` for anything further.\n *\n * By default walks the whole tree; pass `{ recursive: false }` to consider\n * only the stack's direct children.\n */\n getResources(options?: QueryOptions): Resource[];\n getResources<T extends Resource>(type: ResourceCtor<T>, options?: QueryOptions): T[];\n getResources(\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n ): Resource[] {\n return runGetResources(this, typeOrOptions as never, maybeOptions);\n }\n\n /**\n * Find the **first** scalar resource of `type` whose literal name equals\n * `name`, or `undefined` if none matches.\n *\n * @remarks\n * Returns the first match in tree order. ARM names are unique only *per\n * resource type within a scope*, so a stack MAY legitimately contain more\n * than one resource of the same `type` and `name` (e.g. across different\n * resource groups) — this returns whichever is found first. Use\n * `getResources(type)` and filter yourself if you need all matches.\n *\n * Only scalar resources are searched, and names that do not resolve to a\n * string literal are never matched. Pass `{ recursive: false }` to search\n * only the stack's direct children.\n */\n getResource<T extends Resource>(\n type: ResourceCtor<T>,\n name: string,\n options?: QueryOptions,\n ): T | undefined {\n return runGetResource(this, type, name, options);\n }\n\n /**\n * Create a child under this stack (with the stack as its parent context),\n * as a convenience for `new Ctor(stack, ...args)`.\n *\n * Constructs a single child instance and returns it.\n */\n add<T extends new (context: ProvisioningComponent, ...args: any[]) => ProvisioningComponent>(\n ctor: T,\n ...args: ConstructorParameters<T> extends [any, ...infer Rest] ? Rest : never\n ): InstanceType<T>;\n add(\n ctor: new (context: ProvisioningComponent, ...args: any[]) => ProvisioningComponent,\n ...rest: any[]\n ): ProvisioningComponent {\n return new ctor(this.self, ...rest);\n }\n}\n\n/** @internal */\nexport function getLoopedResources(\n stack: Stack,\n options?: QueryOptions,\n): LoopedResource<Resource>[];\n/** @internal */\nexport function getLoopedResources<T extends Resource>(\n stack: Stack,\n type: ResourceCtor<T>,\n options?: QueryOptions,\n): LoopedResource<T>[];\nexport function getLoopedResources(\n stack: Stack,\n typeOrOptions?: ResourceCtor<Resource> | QueryOptions,\n maybeOptions?: QueryOptions,\n): LoopedResource<Resource>[] {\n return runGetLoopedResources(stack, typeOrOptions as never, maybeOptions);\n}\n\n/** @internal */\nexport function addLoopedResource<T extends Resource, P>(\n stack: Stack,\n ctor: new (context: Stack, props: P, options?: ResourceOptions) => T,\n loop: Loop<unknown>,\n ...rest: undefined extends P\n ? [props?: P, options?: ResourceOptions]\n : [props: P, options?: ResourceOptions]\n): LoopedResource<T> {\n return createLoopedResource(ctor, loop, stack.self, ...rest);\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Expression, InputOf } from "../expression/expressions.js";
|
|
2
|
+
import type { Stack } from "./stack.js";
|
|
3
|
+
export type ExpressionValue<T> = T extends Expression<infer U> ? U : T;
|
|
4
|
+
/**
|
|
5
|
+
* A value accepted as a deployment variable's value: any JSON literal
|
|
6
|
+
* (scalar, `null`, array, object — recursively), an `Expression`, or a
|
|
7
|
+
* resource view (`InputOf<unknown>`). The literal members are required so
|
|
8
|
+
* plain object/array literals are accepted (a bare `InputOf<unknown>` is a
|
|
9
|
+
* weak type and would reject them).
|
|
10
|
+
*/
|
|
11
|
+
export type VariableValue = string | number | boolean | null | readonly VariableValue[] | {
|
|
12
|
+
readonly [key: string]: VariableValue;
|
|
13
|
+
} | InputOf<unknown>;
|
|
14
|
+
export type VariableOptions = {
|
|
15
|
+
readonly description?: string | undefined;
|
|
16
|
+
readonly export?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Pure declaration data for a deployment variable. Stored on the stack
|
|
20
|
+
* (paired with the returned expression handle in {@link VariableEntry});
|
|
21
|
+
* read by the serializer at emit time. Not part of the value-level handle.
|
|
22
|
+
*/
|
|
23
|
+
export interface VariableMetadata extends VariableOptions {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly value: VariableValue;
|
|
26
|
+
}
|
|
27
|
+
export type Variable<TValue extends VariableValue = VariableValue> = Expression<ExpressionValue<TValue>>;
|
|
28
|
+
/**
|
|
29
|
+
* Authoring-time collection of a stack's deployment variables. Backed by an
|
|
30
|
+
* ordered private array; supports add/get/delete/iteration. Look variables up
|
|
31
|
+
* by name via {@link VariableCollection.get}.
|
|
32
|
+
*/
|
|
33
|
+
export declare class VariableCollection {
|
|
34
|
+
#private;
|
|
35
|
+
/** Add a variable; returns its expression handle. Throws on duplicate name. */
|
|
36
|
+
add<TValue extends VariableValue = VariableValue>(name: string, value: TValue, options?: VariableOptions): Variable<TValue>;
|
|
37
|
+
/** The expression handle for a variable, or `undefined`. */
|
|
38
|
+
get(name: string): Variable | undefined;
|
|
39
|
+
/** The declaration metadata for a variable, or `undefined`. */
|
|
40
|
+
getMetadata(name: string): VariableMetadata | undefined;
|
|
41
|
+
/** All variable handles, in insertion order. */
|
|
42
|
+
list(): readonly Variable[];
|
|
43
|
+
/** All declaration metadata, in insertion order. */
|
|
44
|
+
listMetadata(): readonly VariableMetadata[];
|
|
45
|
+
has(name: string): boolean;
|
|
46
|
+
/** Remove a variable by name. Returns whether one was removed. */
|
|
47
|
+
delete(name: string): boolean;
|
|
48
|
+
get size(): number;
|
|
49
|
+
[Symbol.iterator](): IterableIterator<Variable>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A computed value evaluated at deploy time, compiled to a Bicep `var` declaration.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript snippet:ignore
|
|
56
|
+
* import { Stack, createVariable } from "@azure/provisioning-core";
|
|
57
|
+
*
|
|
58
|
+
* const stack = new Stack("my-app");
|
|
59
|
+
* const suffix = createVariable(stack, "suffix", "prod");
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function createVariable<TValue extends VariableValue = VariableValue>(stack: Stack, name: string, value: TValue, options?: VariableOptions): Variable<TValue>;
|
|
63
|
+
//# sourceMappingURL=variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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G,SAAS;IAIvC,+DAA+D;IAC/D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAIvD,gDAAgD;IAChD,IAAI,IAAI,SAAS,QAAQ,EAAE;IAI3B,oDAAoD;IACpD,YAAY,IAAI,SAAS,gBAAgB,EAAE;IAI3C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,kEAAkE;IAClE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAO7B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,QAAQ,CAAC;CAOhD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa,EACzE,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,GACxB,QAAQ,CAAC,MAAM,CAAC,CAElB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { wrapExpression } from "../expression/expressions.js";
|
|
4
|
+
import { symbolicValueExpressionNode } from "../expression/ast-nodes.js";
|
|
5
|
+
import { assertBicepIdentifier } from "../util.js";
|
|
6
|
+
/**
|
|
7
|
+
* Authoring-time collection of a stack's deployment variables. Backed by an
|
|
8
|
+
* ordered private array; supports add/get/delete/iteration. Look variables up
|
|
9
|
+
* by name via {@link VariableCollection.get}.
|
|
10
|
+
*/
|
|
11
|
+
export class VariableCollection {
|
|
12
|
+
#entries = [];
|
|
13
|
+
/** Add a variable; returns its expression handle. Throws on duplicate name. */
|
|
14
|
+
add(name, value, options) {
|
|
15
|
+
assertBicepIdentifier(name, "Deployment variable");
|
|
16
|
+
if (this.has(name)) {
|
|
17
|
+
throw new Error(`Duplicate deployment variable name: ${name}`);
|
|
18
|
+
}
|
|
19
|
+
const variable = wrapExpression(symbolicValueExpressionNode(name));
|
|
20
|
+
this.#entries.push({ metadata: { name, value, ...options }, variable });
|
|
21
|
+
return variable;
|
|
22
|
+
}
|
|
23
|
+
/** The expression handle for a variable, or `undefined`. */
|
|
24
|
+
get(name) {
|
|
25
|
+
return this.#find(name)?.variable;
|
|
26
|
+
}
|
|
27
|
+
/** The declaration metadata for a variable, or `undefined`. */
|
|
28
|
+
getMetadata(name) {
|
|
29
|
+
return this.#find(name)?.metadata;
|
|
30
|
+
}
|
|
31
|
+
/** All variable handles, in insertion order. */
|
|
32
|
+
list() {
|
|
33
|
+
return this.#entries.map((e) => e.variable);
|
|
34
|
+
}
|
|
35
|
+
/** All declaration metadata, in insertion order. */
|
|
36
|
+
listMetadata() {
|
|
37
|
+
return this.#entries.map((e) => e.metadata);
|
|
38
|
+
}
|
|
39
|
+
has(name) {
|
|
40
|
+
return this.#find(name) !== undefined;
|
|
41
|
+
}
|
|
42
|
+
/** Remove a variable by name. Returns whether one was removed. */
|
|
43
|
+
delete(name) {
|
|
44
|
+
const i = this.#entries.findIndex((e) => e.metadata.name === name);
|
|
45
|
+
if (i === -1)
|
|
46
|
+
return false;
|
|
47
|
+
this.#entries.splice(i, 1);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
get size() {
|
|
51
|
+
return this.#entries.length;
|
|
52
|
+
}
|
|
53
|
+
[Symbol.iterator]() {
|
|
54
|
+
return this.#entries.map((e) => e.variable)[Symbol.iterator]();
|
|
55
|
+
}
|
|
56
|
+
#find(name) {
|
|
57
|
+
return this.#entries.find((e) => e.metadata.name === name);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A computed value evaluated at deploy time, compiled to a Bicep `var` declaration.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript snippet:ignore
|
|
65
|
+
* import { Stack, createVariable } from "@azure/provisioning-core";
|
|
66
|
+
*
|
|
67
|
+
* const stack = new Stack("my-app");
|
|
68
|
+
* const suffix = createVariable(stack, "suffix", "prod");
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export function createVariable(stack, name, value, options) {
|
|
72
|
+
return stack.variables.add(name, value, options);
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable.js","sourceRoot":"","sources":["../../../src/constructs/variable.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA4CnD;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC7B,QAAQ,GAAoB,EAAE,CAAC;IAE/B,+EAA+E;IAC/E,GAAG,CACD,IAAY,EACZ,KAAa,EACb,OAAyB;QAEzB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,MAAM,QAAQ,GAAG,cAAc,CAC7B,2BAA2B,CAAkC,IAAI,CAAC,CACnE,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,4DAA4D;IAC5D,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACpC,CAAC;IAED,+DAA+D;IAC/D,WAAW,C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Q,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC7D,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAY,EACZ,IAAY,EACZ,KAAa,EACb,OAAyB;IAEzB,OAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Expression, InputOf } from \"../expression/expressions.js\";\nimport { wrapExpression } from \"../expression/expressions.js\";\nimport { symbolicValueExpressionNode } from \"../expression/ast-nodes.js\";\nimport type { Stack } from \"./stack.js\";\nimport { assertBicepIdentifier } from \"../util.js\";\n\nexport type ExpressionValue<T> = T extends Expression<infer U> ? U : T;\n\n/**\n * A value accepted as a deployment variable's value: any JSON literal\n * (scalar, `null`, array, object — recursively), an `Expression`, or a\n * resource view (`InputOf<unknown>`). The literal members are required so\n * plain object/array literals are accepted (a bare `InputOf<unknown>` is a\n * weak type and would reject them).\n */\nexport type VariableValue =\n | string\n | number\n | boolean\n | null\n | readonly VariableValue[]\n | { readonly [key: string]: VariableValue }\n | InputOf<unknown>;\n\nexport type VariableOptions = {\n readonly description?: string | undefined;\n readonly export?: boolean | undefined;\n};\n\n/**\n * Pure declaration data for a deployment variable. Stored on the stack\n * (paired with the returned expression handle in {@link VariableEntry});\n * read by the serializer at emit time. Not part of the value-level handle.\n */\nexport interface VariableMetadata extends VariableOptions {\n readonly name: string;\n readonly value: VariableValue;\n}\n\ninterface VariableEntry {\n readonly metadata: VariableMetadata;\n readonly variable: Expression<unknown>;\n}\n\nexport type Variable<TValue extends VariableValue = VariableValue> = Expression<\n ExpressionValue<TValue>\n>;\n\n/**\n * Authoring-time collection of a stack's deployment variables. Backed by an\n * ordered private array; supports add/get/delete/iteration. Look variables up\n * by name via {@link VariableCollection.get}.\n */\nexport class VariableCollection {\n #entries: VariableEntry[] = [];\n\n /** Add a variable; returns its expression handle. Throws on duplicate name. */\n add<TValue extends VariableValue = VariableValue>(\n name: string,\n value: TValue,\n options?: VariableOptions,\n ): Variable<TValue> {\n assertBicepIdentifier(name, \"Deployment variable\");\n if (this.has(name)) {\n throw new Error(`Duplicate deployment variable name: ${name}`);\n }\n const variable = wrapExpression<ExpressionValue<TValue>>(\n symbolicValueExpressionNode<ExpressionValue<TValue>, string>(name),\n );\n this.#entries.push({ metadata: { name, value, ...options }, variable });\n return variable;\n }\n\n /** The expression handle for a variable, or `undefined`. */\n get(name: string): Variable | undefined {\n return this.#find(name)?.variable;\n }\n\n /** The declaration metadata for a variable, or `undefined`. */\n getMetadata(name: string): VariableMetadata | undefined {\n return this.#find(name)?.metadata;\n }\n\n /** All variable handles, in insertion order. */\n list(): readonly Variable[] {\n return this.#entries.map((e) => e.variable);\n }\n\n /** All declaration metadata, in insertion order. */\n listMetadata(): readonly VariableMetadata[] {\n return this.#entries.map((e) => e.metadata);\n }\n\n has(name: string): boolean {\n return this.#find(name) !== undefined;\n }\n\n /** Remove a variable by name. Returns whether one was removed. */\n delete(name: string): boolean {\n const i = this.#entries.findIndex((e) => e.metadata.name === name);\n if (i === -1) return false;\n this.#entries.splice(i, 1);\n return true;\n }\n\n get size(): number {\n return this.#entries.length;\n }\n\n [Symbol.iterator](): IterableIterator<Variable> {\n return this.#entries.map((e) => e.variable)[Symbol.iterator]();\n }\n\n #find(name: string): VariableEntry | undefined {\n return this.#entries.find((e) => e.metadata.name === name);\n }\n}\n\n/**\n * A computed value evaluated at deploy time, compiled to a Bicep `var` declaration.\n *\n * @example\n * ```typescript snippet:ignore\n * import { Stack, createVariable } from \"@azure/provisioning-core\";\n *\n * const stack = new Stack(\"my-app\");\n * const suffix = createVariable(stack, \"suffix\", \"prod\");\n * ```\n */\nexport function createVariable<TValue extends VariableValue = VariableValue>(\n stack: Stack,\n name: string,\n value: TValue,\n options?: VariableOptions,\n): Variable<TValue> {\n return stack.variables.add(name, value, options);\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExpressionOrValue } from "../expression/expressions.js";
|
|
2
|
+
import type { NamingPolicy } from "../naming/naming-policy.js";
|
|
3
|
+
/**
|
|
4
|
+
* Inherited environment that flows down the component tree.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Each node may attach a local contribution via `ProvisioningComponent._localDeploymentContext`
|
|
8
|
+
* (today, only `Stack` and `ResourceGroup` do). When a `Resource` reads the
|
|
9
|
+
* effective context, the framework walks ancestors and resolves each field:
|
|
10
|
+
*
|
|
11
|
+
* - `location`: nearest ancestor with a value wins.
|
|
12
|
+
* - `namingPolicy`: nearest ancestor with a value wins.
|
|
13
|
+
* - `tags`: flat-merged across **all** ancestors; innermost wins on key conflict.
|
|
14
|
+
*
|
|
15
|
+
* Per-resource Bicep `scope:` is not part of this — a resource's deployment
|
|
16
|
+
* scope is determined by which file or module it lands in, which in turn is
|
|
17
|
+
* determined by the ProvisioningComponent tree (the nearest `ResourceGroup`/`Stack` ancestor).
|
|
18
|
+
*
|
|
19
|
+
* The same interface describes both a node's local contribution and the
|
|
20
|
+
* fully-resolved view returned by `ProvisioningComponent.deploymentContext`.
|
|
21
|
+
*/
|
|
22
|
+
export interface DeploymentContext {
|
|
23
|
+
readonly location?: ExpressionOrValue<string> | undefined;
|
|
24
|
+
readonly tags?: Record<string, ExpressionOrValue<string>> | undefined;
|
|
25
|
+
readonly namingPolicy?: NamingPolicy | undefined;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=deployment-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-context.d.ts","sourceRoot":"","sources":["../../../src/deployment-context/deployment-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAClD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-context.js","sourceRoot":"","sources":["../../../src/deployment-context/deployment-context.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ExpressionOrValue } from \"../expression/expressions.js\";\nimport type { NamingPolicy } from \"../naming/naming-policy.js\";\n\n/**\n * Inherited environment that flows down the component tree.\n *\n * @remarks\n * Each node may attach a local contribution via `ProvisioningComponent._localDeploymentContext`\n * (today, only `Stack` and `ResourceGroup` do). When a `Resource` reads the\n * effective context, the framework walks ancestors and resolves each field:\n *\n * - `location`: nearest ancestor with a value wins.\n * - `namingPolicy`: nearest ancestor with a value wins.\n * - `tags`: flat-merged across **all** ancestors; innermost wins on key conflict.\n *\n * Per-resource Bicep `scope:` is not part of this — a resource's deployment\n * scope is determined by which file or module it lands in, which in turn is\n * determined by the ProvisioningComponent tree (the nearest `ResourceGroup`/`Stack` ancestor).\n *\n * The same interface describes both a node's local contribution and the\n * fully-resolved view returned by `ProvisioningComponent.deploymentContext`.\n */\nexport interface DeploymentContext {\n readonly location?: ExpressionOrValue<string> | undefined;\n readonly tags?: Record<string, ExpressionOrValue<string>> | undefined;\n readonly namingPolicy?: NamingPolicy | undefined;\n}\n"]}
|