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