@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":"utils.js","sourceRoot":"","sources":["../../../src/serialization/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,MAAM,UAAU,iCAAiC,CAC/C,IAIyB;IAEzB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACxB,4BAA4B,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IACD,kCAAkC,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5D,kCAAkC,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,kCAAkC,CACzC,UAAsC,EACtC,WAAwB;IAExB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9D,kCAAkC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC;QAC9C,kCAAkC,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACzD,CAAC;AACH,CAAC;AAED,SAAS,4BAA4B,CAAC,IAAc,EAAE,WAAwB;IAC5E,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,gBAAgB;YACnB,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,KAAK,mBAAmB,CAAC;QACzB,KAAK,6BAA6B;YAChC,4BAA4B,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;YAC1D,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ACjE,MAAM;QACR,CAAC;QACD,KAAK,qBAAqB;YACxB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACpC,kCAAkC,CAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;YACrE,CAAC;YACD,MAAM;QACR,KAAK,QAAQ;YACX,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC9C,kCAAkC,CAAC,KAAK,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;YACnE,CAAC;YACD,MAAM;QACR,KAAK,OAAO;YACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,kCAAkC,CAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;YAClE,CAAC;YACD,MAAM;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,SAAS,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,MAAM;IACV,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n DecoratorsNode,\n ExpressionNode,\n ModuleDeclarationNode,\n OutputDeclarationNode,\n ResourceDeclarationNode,\n TypeNode,\n VariableDeclarationNode,\n} from \"./contract/index.js\";\n\nexport function collectDependenciesForDeclaration(\n node:\n | ResourceDeclarationNode\n | VariableDeclarationNode\n | OutputDeclarationNode\n | ModuleDeclarationNode,\n): Set<string> {\n const identifiers = new Set<string>();\n if (\"valueType\" in node) {\n collectIdentifierIdsFromType(node.valueType, identifiers);\n }\n collectIdentifierIdsFromExpression(node.value, identifiers);\n collectIdentifierIdsFromDecorators(node.decorators, identifiers);\n return identifiers;\n}\n\nfunction collectIdentifierIdsFromDecorators(\n decorators: DecoratorsNode | undefined,\n identifiers: Set<string>,\n): void {\n for (const value of Object.values(decorators?.metadata ?? {})) {\n collectIdentifierIdsFromExpression(value, identifiers);\n }\n for (const value of decorators?.allowed ?? []) {\n collectIdentifierIdsFromExpression(value, identifiers);\n }\n}\n\nfunction collectIdentifierIdsFromType(type: TypeNode, identifiers: Set<string>): void {\n switch (type.kind) {\n case \"type-reference\":\n identifiers.add(type.name);\n return;\n case \"union-type-member\":\n case \"parameterized-type-argument\":\n collectIdentifierIdsFromType(type.valueType, identifiers);\n return;\n case \"array-type\":\n collectIdentifierIdsFromType(type.item, identifiers);\n return;\n case \"object-type-property\":\n case \"object-type-additional-properties\":\n collectIdentifierIdsFromType(type.valueType, identifiers);\n collectIdentifierIdsFromDecorators(type.decorators, identifiers);\n return;\n case \"object-type\":\n for (const property of type.properties) {\n collectIdentifierIdsFromType(property, identifiers);\n }\n if (type.additionalProperties !== undefined) {\n collectIdentifierIdsFromType(type.additionalProperties, identifiers);\n }\n return;\n case \"union-type\":\n for (const member of type.members) {\n collectIdentifierIdsFromType(member.valueType, identifiers);\n }\n return;\n case \"nullable-type\":\n collectIdentifierIdsFromType(type.base, identifiers);\n return;\n case \"parameterized-type-instantiation\":\n collectIdentifierIdsFromType(type.base, identifiers);\n for (const argument of type.args) {\n collectIdentifierIdsFromType(argument.valueType, identifiers);\n }\n return;\n case \"primitive-type\":\n case \"string-type-literal\":\n case \"integer-type-literal\":\n case \"boolean-type-literal\":\n case \"null-type-literal\":\n return;\n default: {\n const exhaustive: never = type;\n throw new Error(`Unsupported type kind: ${(exhaustive as { kind: string }).kind}`);\n }\n }\n}\n\nfunction collectIdentifierIdsFromExpression(\n expr: ExpressionNode,\n out: Set<string>,\n boundIdentifiers: ReadonlySet<string> = new Set(),\n): void {\n switch (expr.kind) {\n case \"identifier\":\n if (!boundIdentifiers.has(expr.id)) out.add(expr.id);\n break;\n case \"property-access\":\n collectIdentifierIdsFromExpression(expr.base, out, boundIdentifiers);\n break;\n case \"array-access\":\n collectIdentifierIdsFromExpression(expr.base, out, boundIdentifiers);\n collectIdentifierIdsFromExpression(expr.index, out, boundIdentifiers);\n break;\n case \"function-call\":\n if (typeof expr.target !== \"string\") {\n collectIdentifierIdsFromExpression(expr.target, out, boundIdentifiers);\n }\n for (const arg of expr.args) {\n collectIdentifierIdsFromExpression(arg, out, boundIdentifiers);\n }\n break;\n case \"instance-function-call\":\n collectIdentifierIdsFromExpression(expr.base, out, boundIdentifiers);\n for (const arg of expr.args) {\n collectIdentifierIdsFromExpression(arg, out, boundIdentifiers);\n }\n break;\n case \"binary-operation\":\n collectIdentifierIdsFromExpression(expr.left, out, boundIdentifiers);\n collectIdentifierIdsFromExpression(expr.right, out, boundIdentifiers);\n break;\n case \"unary-operation\":\n collectIdentifierIdsFromExpression(expr.argument, out, boundIdentifiers);\n break;\n case \"ternary-operation\":\n collectIdentifierIdsFromExpression(expr.condition, out, boundIdentifiers);\n collectIdentifierIdsFromExpression(expr.trueValue, out, boundIdentifiers);\n collectIdentifierIdsFromExpression(expr.falseValue, out, boundIdentifiers);\n break;\n case \"if-condition\":\n collectIdentifierIdsFromExpression(expr.condition, out, boundIdentifiers);\n collectIdentifierIdsFromExpression(expr.body, out, boundIdentifiers);\n break;\n case \"for-expression\": {\n collectIdentifierIdsFromExpression(expr.collection, out, boundIdentifiers);\n const loopBindings = new Set(boundIdentifiers);\n loopBindings.add(expr.itemVariable);\n if (expr.indexVariable !== undefined) {\n loopBindings.add(expr.indexVariable);\n }\n collectIdentifierIdsFromExpression(expr.body, out, loopBindings);\n break;\n }\n case \"interpolated-string\":\n for (const segment of expr.segments) {\n collectIdentifierIdsFromExpression(segment, out, boundIdentifiers);\n }\n break;\n case \"object\":\n for (const value of Object.values(expr.value)) {\n collectIdentifierIdsFromExpression(value, out, boundIdentifiers);\n }\n break;\n case \"array\":\n for (const item of expr.items) {\n collectIdentifierIdsFromExpression(item, out, boundIdentifiers);\n }\n break;\n case \"null\":\n case \"boolean\":\n case \"integer\":\n case \"string\":\n break;\n }\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global resource shape registry keyed by ARM `type` + `apiVersion`.
|
|
3
|
+
*
|
|
4
|
+
* Generated resource modules register their shape at module load so
|
|
5
|
+
* the deserialization path can look up the shape of an imported
|
|
6
|
+
* resource (which only carries `type` and `apiVersion` on the wire)
|
|
7
|
+
* and raise its raw ARM-shape state back into JS-ergonomic form.
|
|
8
|
+
*
|
|
9
|
+
* A `(type, apiVersion)` pair is either flat or has a flat list of concrete
|
|
10
|
+
* variant shapes. Each variant carries an ordered selector, such as
|
|
11
|
+
* `[name=signin]` or `[kind=cat, breed=siamese]`. The registry does not build a
|
|
12
|
+
* parallel discriminator tree.
|
|
13
|
+
*/
|
|
14
|
+
import type { FlatModelShape } from "./shape.js";
|
|
15
|
+
import { type FlatVariantSelector } from "../constructs/resource/resource-type-registry.js";
|
|
16
|
+
export interface ShapeResolveOptions {
|
|
17
|
+
/** Require an exact API version. Defaults to `true`. */
|
|
18
|
+
readonly strict?: boolean;
|
|
19
|
+
/** Naming used by the supplied state. Defaults to `"js"`. */
|
|
20
|
+
readonly valueKeyedBy?: "js" | "arm";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register a {@link FlatModelShape} for a resource type + apiVersion
|
|
24
|
+
* pair. Called at module load by generated resource modules (typically
|
|
25
|
+
* through {@link Resource.registerShape}).
|
|
26
|
+
*
|
|
27
|
+
* For normal (non-discriminated) resources, pass a flat model shape
|
|
28
|
+
* directly. Re-registering the *same* shape object (e.g. due to
|
|
29
|
+
* module-graph re-entry in test harnesses) is a silent no-op.
|
|
30
|
+
*
|
|
31
|
+
* For a concrete resource variant, pass its ordered `variantSelector`. Several
|
|
32
|
+
* selectors may register the same shape when one class claims multiple values.
|
|
33
|
+
* Duplicate selectors with different shapes throw.
|
|
34
|
+
*/
|
|
35
|
+
export declare function registerShape(type: string, apiVersion: string, shape: FlatModelShape, variantSelector?: FlatVariantSelector): void;
|
|
36
|
+
/**
|
|
37
|
+
* Look up the {@link FlatModelShape} registered for
|
|
38
|
+
* `type + apiVersion`. Variant selectors are matched against `state` using the
|
|
39
|
+
* requested naming. Every pin must match exactly; the first matching selector
|
|
40
|
+
* wins.
|
|
41
|
+
*
|
|
42
|
+
* Returns `undefined` when no shape is known, or when the entry is
|
|
43
|
+
* discriminated but `state` does not expose the discriminator value
|
|
44
|
+
* (or the value isn't a registered variant). Callers that get
|
|
45
|
+
* `undefined` should treat the resource state as opaque (passthrough).
|
|
46
|
+
*
|
|
47
|
+
* For non-discriminated resources `state` is ignored. API-version fallback is
|
|
48
|
+
* disabled by default and must be explicitly requested with `strict: false`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getShape(type: string, apiVersion: string, state: Record<string, unknown>, options?: ShapeResolveOptions): FlatModelShape | undefined;
|
|
51
|
+
//# sourceMappingURL=shape-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-registry.d.ts","sourceRoot":"","sources":["../../../src/shape/shape-registry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,kDAAkD,CAAC;AAI1D,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;CACtC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,cAAc,EACrB,eAAe,CAAC,EAAE,mBAAmB,GACpC,IAAI,CAEN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,OAAO,GAAE,mBAAwB,GAChC,cAAc,GAAG,SAAS,CAK5B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { ResourceTypeRegistry, } from "../constructs/resource/resource-type-registry.js";
|
|
4
|
+
const registry = new ResourceTypeRegistry();
|
|
5
|
+
/**
|
|
6
|
+
* Register a {@link FlatModelShape} for a resource type + apiVersion
|
|
7
|
+
* pair. Called at module load by generated resource modules (typically
|
|
8
|
+
* through {@link Resource.registerShape}).
|
|
9
|
+
*
|
|
10
|
+
* For normal (non-discriminated) resources, pass a flat model shape
|
|
11
|
+
* directly. Re-registering the *same* shape object (e.g. due to
|
|
12
|
+
* module-graph re-entry in test harnesses) is a silent no-op.
|
|
13
|
+
*
|
|
14
|
+
* For a concrete resource variant, pass its ordered `variantSelector`. Several
|
|
15
|
+
* selectors may register the same shape when one class claims multiple values.
|
|
16
|
+
* Duplicate selectors with different shapes throw.
|
|
17
|
+
*/
|
|
18
|
+
export function registerShape(type, apiVersion, shape, variantSelector) {
|
|
19
|
+
registry.register(type, apiVersion, shape, variantSelector);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Look up the {@link FlatModelShape} registered for
|
|
23
|
+
* `type + apiVersion`. Variant selectors are matched against `state` using the
|
|
24
|
+
* requested naming. Every pin must match exactly; the first matching selector
|
|
25
|
+
* wins.
|
|
26
|
+
*
|
|
27
|
+
* Returns `undefined` when no shape is known, or when the entry is
|
|
28
|
+
* discriminated but `state` does not expose the discriminator value
|
|
29
|
+
* (or the value isn't a registered variant). Callers that get
|
|
30
|
+
* `undefined` should treat the resource state as opaque (passthrough).
|
|
31
|
+
*
|
|
32
|
+
* For non-discriminated resources `state` is ignored. API-version fallback is
|
|
33
|
+
* disabled by default and must be explicitly requested with `strict: false`.
|
|
34
|
+
*/
|
|
35
|
+
export function getShape(type, apiVersion, state, options = {}) {
|
|
36
|
+
return registry.resolve(type, apiVersion, state, {
|
|
37
|
+
strict: options.strict ?? true,
|
|
38
|
+
valueKeyedBy: options.valueKeyedBy ?? "js",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=shape-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-registry.js","sourceRoot":"","sources":["../../../src/shape/shape-registry.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiBlC,OAAO,EACL,oBAAoB,GAErB,MAAM,kDAAkD,CAAC;AAE1D,MAAM,QAAQ,GAAG,IAAI,oBAAoB,EAAkB,CAAC;AAS5D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,UAAkB,EAClB,KAAqB,EACrB,eAAqC;IAErC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,QAAQ,CACtB,IAAY,EACZ,UAAkB,EAClB,KAA8B,EAC9B,UAA+B,EAAE;IAEjC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;QAC/C,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,IAAI;QAC9B,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,IAAI;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Global resource shape registry keyed by ARM `type` + `apiVersion`.\n *\n * Generated resource modules register their shape at module load so\n * the deserialization path can look up the shape of an imported\n * resource (which only carries `type` and `apiVersion` on the wire)\n * and raise its raw ARM-shape state back into JS-ergonomic form.\n *\n * A `(type, apiVersion)` pair is either flat or has a flat list of concrete\n * variant shapes. Each variant carries an ordered selector, such as\n * `[name=signin]` or `[kind=cat, breed=siamese]`. The registry does not build a\n * parallel discriminator tree.\n */\n\nimport type { FlatModelShape } from \"./shape.js\";\nimport {\n ResourceTypeRegistry,\n type FlatVariantSelector,\n} from \"../constructs/resource/resource-type-registry.js\";\n\nconst registry = new ResourceTypeRegistry<FlatModelShape>();\n\nexport interface ShapeResolveOptions {\n /** Require an exact API version. Defaults to `true`. */\n readonly strict?: boolean;\n /** Naming used by the supplied state. Defaults to `\"js\"`. */\n readonly valueKeyedBy?: \"js\" | \"arm\";\n}\n\n/**\n * Register a {@link FlatModelShape} for a resource type + apiVersion\n * pair. Called at module load by generated resource modules (typically\n * through {@link Resource.registerShape}).\n *\n * For normal (non-discriminated) resources, pass a flat model shape\n * directly. Re-registering the *same* shape object (e.g. due to\n * module-graph re-entry in test harnesses) is a silent no-op.\n *\n * For a concrete resource variant, pass its ordered `variantSelector`. Several\n * selectors may register the same shape when one class claims multiple values.\n * Duplicate selectors with different shapes throw.\n */\nexport function registerShape(\n type: string,\n apiVersion: string,\n shape: FlatModelShape,\n variantSelector?: FlatVariantSelector,\n): void {\n registry.register(type, apiVersion, shape, variantSelector);\n}\n\n/**\n * Look up the {@link FlatModelShape} registered for\n * `type + apiVersion`. Variant selectors are matched against `state` using the\n * requested naming. Every pin must match exactly; the first matching selector\n * wins.\n *\n * Returns `undefined` when no shape is known, or when the entry is\n * discriminated but `state` does not expose the discriminator value\n * (or the value isn't a registered variant). Callers that get\n * `undefined` should treat the resource state as opaque (passthrough).\n *\n * For non-discriminated resources `state` is ignored. API-version fallback is\n * disabled by default and must be explicitly requested with `strict: false`.\n */\nexport function getShape(\n type: string,\n apiVersion: string,\n state: Record<string, unknown>,\n options: ShapeResolveOptions = {},\n): FlatModelShape | undefined {\n return registry.resolve(type, apiVersion, state, {\n strict: options.strict ?? true,\n valueKeyedBy: options.valueKeyedBy ?? \"js\",\n });\n}\n"]}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime types for ARM shape information.
|
|
3
|
+
*
|
|
4
|
+
* A `ModelShape` is generated once per emitted Model and describes how
|
|
5
|
+
* to map JS-ergonomic property names + structure to the underlying ARM
|
|
6
|
+
* wire shape. The shapes are consumed by the serialization `lowerState`
|
|
7
|
+
* pass (and its inverse `raiseState`) which rewrites state keys and
|
|
8
|
+
* re-nests `@flattenProperty` paths just before serialization /
|
|
9
|
+
* after deserialization.
|
|
10
|
+
*
|
|
11
|
+
* These types are an internal cross-package runtime contract; generated code
|
|
12
|
+
* imports them from `@azure/provisioning-core/internal`.
|
|
13
|
+
*
|
|
14
|
+
* Nested-shape thunks ({@link DeferredShape}) defer dereferencing the
|
|
15
|
+
* inner shape constant until use, so mutually-referential or
|
|
16
|
+
* self-referential models can be emitted without initialization-order
|
|
17
|
+
* problems.
|
|
18
|
+
*
|
|
19
|
+
* A model shape comes in two flavors:
|
|
20
|
+
* - `FlatModelShape` ({@link FlatModelShape}): the common case —
|
|
21
|
+
* one shape per concrete model.
|
|
22
|
+
* - `DiscriminatedModelShape` ({@link DiscriminatedModelShape}): a
|
|
23
|
+
* name-discriminated variant group. ARM permits multiple resources
|
|
24
|
+
* to share an ARM `type` + `apiVersion` pair and disambiguate via a
|
|
25
|
+
* fixed field — e.g. `Microsoft.ApiManagement/service/portalsettings@2024-05-01`
|
|
26
|
+
* has three variants with `name: 'signin' | 'signup' | 'delegation'`
|
|
27
|
+
* and distinct `properties` shapes. The same machinery applies to
|
|
28
|
+
* nested models that use a `@discriminator` field.
|
|
29
|
+
*/
|
|
30
|
+
import type { BooleanValueEncodingDescriptor, BytesValueEncodingDescriptor, DateValueEncodingDescriptor, NumberValueEncodingDescriptor, NumericStringEncodingDescriptor, StringValueEncodingDescriptor } from "./value-encoding.js";
|
|
31
|
+
/** The standard single-model shape. */
|
|
32
|
+
export interface FlatModelShape {
|
|
33
|
+
/**
|
|
34
|
+
* Tag for tag-dispatched discrimination on {@link NavShape} and
|
|
35
|
+
* {@link ModelShape}. Always `"flatModel"`.
|
|
36
|
+
*/
|
|
37
|
+
readonly kind: "flatModel";
|
|
38
|
+
/**
|
|
39
|
+
* Map, keyed by JS-side (client-facing) property name, of how that
|
|
40
|
+
* property maps to the ARM wire shape. Property names not present in
|
|
41
|
+
* this map are assumed to be pass-through (identity mapping).
|
|
42
|
+
*/
|
|
43
|
+
readonly byJsName: {
|
|
44
|
+
readonly [jsName: string]: PropertyShape;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The two names a discriminator field goes by.
|
|
49
|
+
*
|
|
50
|
+
* Usually identical — ARM discriminators are `type`, `name`, `kind` and
|
|
51
|
+
* service teams rarely rename them — but a `@clientName` on the field
|
|
52
|
+
* makes them differ, and the two are looked up in different keyspaces:
|
|
53
|
+
* JS-side state is keyed by {@link jsName}, wire JSON by
|
|
54
|
+
* {@link armName}. Carrying both is what lets a discriminated shape
|
|
55
|
+
* resolve in either direction.
|
|
56
|
+
*/
|
|
57
|
+
export interface DiscriminatorNames {
|
|
58
|
+
/** Client-facing name, as authored in TypeScript and held in state. */
|
|
59
|
+
readonly jsName: string;
|
|
60
|
+
/** Wire-level name, as it appears in an ARM template or response. */
|
|
61
|
+
readonly armName: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A name-discriminated group of variants that share one parent key
|
|
65
|
+
* (an ARM `(type, apiVersion)` at the registry level, or a parent
|
|
66
|
+
* model's `@discriminator` field elsewhere). The `discriminator` names
|
|
67
|
+
* the field whose value selects a variant.
|
|
68
|
+
*/
|
|
69
|
+
export interface DiscriminatedModelShape {
|
|
70
|
+
readonly kind: "discriminatedModel";
|
|
71
|
+
/** Names of the field used to select a variant. */
|
|
72
|
+
readonly discriminator: DiscriminatorNames;
|
|
73
|
+
/**
|
|
74
|
+
* Map from discriminator value (e.g. `"signin"`) to the shape for
|
|
75
|
+
* that variant. A value with no entry here doesn't end resolution —
|
|
76
|
+
* {@link resolveModelShape} infers the variant from the payload's
|
|
77
|
+
* structure instead.
|
|
78
|
+
*
|
|
79
|
+
* Entries may be:
|
|
80
|
+
* - a {@link FlatModelShape} — the terminal, common case;
|
|
81
|
+
* - a {@link DeferredShape} — breaks emit-order / cyclic-reference
|
|
82
|
+
* hazards, exactly as {@link PropertyShape.value} does;
|
|
83
|
+
* - a nested {@link DiscriminatedModelShape} — a variant that is
|
|
84
|
+
* itself a discriminated base on a *different* field. TypeSpec
|
|
85
|
+
* permits this (`@discriminator("kind") model Pet`, then
|
|
86
|
+
* `@discriminator("breed") model Cat extends Pet`), so selecting
|
|
87
|
+
* a concrete shape may take more than one hop. See
|
|
88
|
+
* {@link resolveModelShape}.
|
|
89
|
+
*
|
|
90
|
+
* Note that a hierarchy re-using the *same* discriminator field at
|
|
91
|
+
* every level (abstract intermediates) is flattened by the emitter
|
|
92
|
+
* into a single level here — only a change of discriminator field
|
|
93
|
+
* produces a nested entry.
|
|
94
|
+
*/
|
|
95
|
+
readonly byValue: {
|
|
96
|
+
readonly [value: string]: ModelShape | DeferredShape<ModelShape>;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** A single model's shape — either flat or discriminated. */
|
|
100
|
+
export type ModelShape = FlatModelShape | DiscriminatedModelShape;
|
|
101
|
+
/**
|
|
102
|
+
* What `registerShape` stores in the global registry, keyed by
|
|
103
|
+
* `(armType, apiVersion)`. Same structural type as {@link ModelShape};
|
|
104
|
+
* the alias documents intent at the registry boundary.
|
|
105
|
+
*/
|
|
106
|
+
export type ResourceShape = ModelShape;
|
|
107
|
+
/** A single property's shape entry. */
|
|
108
|
+
export interface PropertyShape {
|
|
109
|
+
/**
|
|
110
|
+
* ARM wire path from the owning model's root to this property.
|
|
111
|
+
* Single-segment for direct properties; multi-segment for properties
|
|
112
|
+
* hoisted through one or more `@flattenProperty` wrappers.
|
|
113
|
+
*/
|
|
114
|
+
readonly armPath: readonly string[];
|
|
115
|
+
/**
|
|
116
|
+
* Describes this property's value for navigation and wire conversion.
|
|
117
|
+
* Model and container shapes recurse into nested values; a
|
|
118
|
+
* {@link TerminalValueShape} explicitly terminates recursion. Scalar
|
|
119
|
+
* terminal shapes carry only the encodings valid for their client-side
|
|
120
|
+
* JavaScript representation.
|
|
121
|
+
*/
|
|
122
|
+
readonly value: ValueShape;
|
|
123
|
+
/**
|
|
124
|
+
* `true` when ARM treats this property as server-set (visible in GET
|
|
125
|
+
* responses but rejected on PUT). Omitted (i.e. `undefined`/`false`)
|
|
126
|
+
* for writable properties.
|
|
127
|
+
*
|
|
128
|
+
* Currently consumed by the `Resource` constructor's deployment-context
|
|
129
|
+
* inheritance to skip readonly properties (notably `location` on many
|
|
130
|
+
* child resources where the field exists in the read model only).
|
|
131
|
+
*/
|
|
132
|
+
readonly readOnly?: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Deferred reference to a shape value. The thunk is called on
|
|
136
|
+
* dereference so the actual shape lookup is deferred.
|
|
137
|
+
*
|
|
138
|
+
* **Why this exists instead of embedding the shape directly.**
|
|
139
|
+
*
|
|
140
|
+
* Model shapes frequently reference each other — a model's properties
|
|
141
|
+
* can point to other models, and ARM types include both self-
|
|
142
|
+
* referential (tree-like) and mutually-referential (cyclic) structures.
|
|
143
|
+
* If we embedded a {@link ModelShape} value directly inside another
|
|
144
|
+
* model shape's value field, both shapes would need to be fully
|
|
145
|
+
* initialized when the parent is constructed. That's impossible
|
|
146
|
+
* whenever:
|
|
147
|
+
*
|
|
148
|
+
* - A model references itself, e.g. `TreeNode { children: TreeNode[] }`.
|
|
149
|
+
* - Two models reference each other, e.g. `A { b?: B }` and `B { a?: A }`.
|
|
150
|
+
* - Two modules each define shapes that reference shapes from the other.
|
|
151
|
+
*
|
|
152
|
+
* In all three cases the second constant is in the Temporal Dead Zone
|
|
153
|
+
* when the first one's literal evaluates, and the runtime throws
|
|
154
|
+
* `ReferenceError: Cannot access ... before initialization`.
|
|
155
|
+
*
|
|
156
|
+
* Wrapping the reference in a thunk solves it. The closure captures
|
|
157
|
+
* the *binding name*, not its current value. The lookup happens later
|
|
158
|
+
* when the thunk is called — by which time the module graph has
|
|
159
|
+
* finished evaluating and both shapes are fully constructed.
|
|
160
|
+
*
|
|
161
|
+
* Only the model variant of {@link ValueShape} carries a reference —
|
|
162
|
+
* container shapes (`array`, `record`) are eager because they don't
|
|
163
|
+
* reference any module-level binding directly; the inner reference
|
|
164
|
+
* deeper down handles cycle-breaking.
|
|
165
|
+
*/
|
|
166
|
+
export interface DeferredShape<T> {
|
|
167
|
+
readonly kind: "deferred";
|
|
168
|
+
readonly value: () => T;
|
|
169
|
+
}
|
|
170
|
+
/** An array-of-T property/container shape. */
|
|
171
|
+
export interface ArrayShape {
|
|
172
|
+
readonly kind: "array";
|
|
173
|
+
readonly element: ValueShape;
|
|
174
|
+
}
|
|
175
|
+
/** A `Record<string, T>` property/container shape. */
|
|
176
|
+
export interface RecordShape {
|
|
177
|
+
readonly kind: "record";
|
|
178
|
+
readonly value: ValueShape;
|
|
179
|
+
}
|
|
180
|
+
/** A fixed-length heterogeneous tuple property/container shape. */
|
|
181
|
+
export interface TupleShape {
|
|
182
|
+
readonly kind: "tuple";
|
|
183
|
+
readonly values: readonly ValueShape[];
|
|
184
|
+
}
|
|
185
|
+
/** A TypeSpec scalar rendered as TypeScript `any`. */
|
|
186
|
+
export interface AnyShape {
|
|
187
|
+
readonly kind: "any";
|
|
188
|
+
}
|
|
189
|
+
/** A scalar whose client-side JavaScript representation is `string`. */
|
|
190
|
+
export interface StringShape {
|
|
191
|
+
readonly kind: "string";
|
|
192
|
+
readonly encoding?: StringValueEncodingDescriptor;
|
|
193
|
+
}
|
|
194
|
+
/** A scalar whose client-side JavaScript representation is `boolean`. */
|
|
195
|
+
export interface BooleanShape {
|
|
196
|
+
readonly kind: "boolean";
|
|
197
|
+
readonly encoding?: BooleanValueEncodingDescriptor;
|
|
198
|
+
}
|
|
199
|
+
/** A scalar whose client-side JavaScript representation is `number`. */
|
|
200
|
+
export interface NumberShape {
|
|
201
|
+
readonly kind: "number";
|
|
202
|
+
readonly encoding?: NumberValueEncodingDescriptor;
|
|
203
|
+
}
|
|
204
|
+
/** A scalar whose client-side JavaScript representation is `Uint8Array`. */
|
|
205
|
+
export interface BytesShape {
|
|
206
|
+
readonly kind: "bytes";
|
|
207
|
+
readonly encoding?: BytesValueEncodingDescriptor;
|
|
208
|
+
}
|
|
209
|
+
/** A scalar whose client-side JavaScript representation is `Date`. */
|
|
210
|
+
export interface DateShape {
|
|
211
|
+
readonly kind: "date";
|
|
212
|
+
readonly encoding?: DateValueEncodingDescriptor;
|
|
213
|
+
}
|
|
214
|
+
/** A terminal TypeSpec string literal. Literals cannot carry `@encode`. */
|
|
215
|
+
export interface StringLiteralShape {
|
|
216
|
+
readonly kind: "stringLiteral";
|
|
217
|
+
}
|
|
218
|
+
/** A terminal TypeSpec numeric literal. */
|
|
219
|
+
export interface NumberLiteralShape {
|
|
220
|
+
readonly kind: "numberLiteral";
|
|
221
|
+
/** `@encode(string)` when the numeric literal is exposed as wire text. */
|
|
222
|
+
readonly encoding?: NumericStringEncodingDescriptor;
|
|
223
|
+
}
|
|
224
|
+
/** A terminal TypeSpec boolean literal. */
|
|
225
|
+
export interface BooleanLiteralShape {
|
|
226
|
+
readonly kind: "booleanLiteral";
|
|
227
|
+
/** `@encode(string)` while the client value remains a boolean literal. */
|
|
228
|
+
readonly encoding?: BooleanValueEncodingDescriptor;
|
|
229
|
+
}
|
|
230
|
+
/** A terminal TypeSpec enum. Enums cannot carry `@encode`. */
|
|
231
|
+
export interface EnumShape {
|
|
232
|
+
readonly kind: "enum";
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* A terminal TypeSpec union for which no single structural shape can be
|
|
236
|
+
* selected. Unions cannot carry `@encode` in the provisioning emitter.
|
|
237
|
+
*/
|
|
238
|
+
export interface UnionShape {
|
|
239
|
+
readonly kind: "union";
|
|
240
|
+
}
|
|
241
|
+
/** The TypeSpec `null` intrinsic. */
|
|
242
|
+
export interface NullShape {
|
|
243
|
+
readonly kind: "null";
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Concrete terminal values in the generated client API.
|
|
247
|
+
*
|
|
248
|
+
* Scalar kinds describe the JavaScript value accepted by the generated
|
|
249
|
+
* TypeScript surface, not necessarily the semantic TypeSpec scalar. For
|
|
250
|
+
* example, a numeric `duration` is a {@link NumberShape}, while the default
|
|
251
|
+
* ISO8601 duration is a {@link StringShape}; their narrowed `encoding` fields
|
|
252
|
+
* retain the TypeSpec source semantics needed for wire conversion. Numeric and
|
|
253
|
+
* boolean literal shapes can carry the same narrowly applicable encodings that
|
|
254
|
+
* TypeSpec permits on those values. String literals, enums, unions, and null
|
|
255
|
+
* remain distinct non-encodable terminal categories.
|
|
256
|
+
* Expressions are orthogonal wrappers around any value shape and are handled
|
|
257
|
+
* before shape-directed conversion.
|
|
258
|
+
*/
|
|
259
|
+
export type TerminalValueShape = AnyShape | StringShape | BooleanShape | NumberShape | BytesShape | DateShape | StringLiteralShape | NumberLiteralShape | BooleanLiteralShape | EnumShape | UnionShape | NullShape;
|
|
260
|
+
/** A container through which property navigation can continue. */
|
|
261
|
+
export type ContainerShape = ArrayShape | RecordShape | TupleShape;
|
|
262
|
+
export type ValueShape = TerminalValueShape | DeferredShape<ModelShape> | ContainerShape;
|
|
263
|
+
/** Build a {@link FlatModelShape} from a property map. */
|
|
264
|
+
export declare const createFlatModelShape: (byJsName: Record<string, PropertyShape>) => FlatModelShape;
|
|
265
|
+
/**
|
|
266
|
+
* Build a {@link DiscriminatedModelShape}.
|
|
267
|
+
*
|
|
268
|
+
* Pass a bare string when the field goes by the same name on both
|
|
269
|
+
* sides, which is the overwhelmingly common case; pass a
|
|
270
|
+
* {@link DiscriminatorNames} pair when a `@clientName` makes them
|
|
271
|
+
* differ.
|
|
272
|
+
*/
|
|
273
|
+
export declare const createDiscriminatedModelShape: (discriminator: string | DiscriminatorNames, byValue: Record<string, ModelShape | DeferredShape<ModelShape>>) => DiscriminatedModelShape;
|
|
274
|
+
/**
|
|
275
|
+
* Build a {@link DeferredShape}. The thunk is called on dereference; defer
|
|
276
|
+
* the actual shape lookup so that mutually-referential constants can
|
|
277
|
+
* be emitted in any order.
|
|
278
|
+
*/
|
|
279
|
+
export declare const createDeferredShape: <T>(value: () => T) => DeferredShape<T>;
|
|
280
|
+
/** Build an {@link AnyShape}. */
|
|
281
|
+
export declare const createAnyShape: () => AnyShape;
|
|
282
|
+
/** Build a {@link StringShape}, optionally with a compatible wire encoding. */
|
|
283
|
+
export declare const createStringShape: (encoding?: StringValueEncodingDescriptor) => StringShape;
|
|
284
|
+
/** Build a {@link BooleanShape}, optionally with a compatible wire encoding. */
|
|
285
|
+
export declare const createBooleanShape: (encoding?: BooleanValueEncodingDescriptor) => BooleanShape;
|
|
286
|
+
/** Build a {@link NumberShape}, optionally with a compatible wire encoding. */
|
|
287
|
+
export declare const createNumberShape: (encoding?: NumberValueEncodingDescriptor) => NumberShape;
|
|
288
|
+
/** Build a {@link BytesShape}, optionally with a compatible wire encoding. */
|
|
289
|
+
export declare const createBytesShape: (encoding?: BytesValueEncodingDescriptor) => BytesShape;
|
|
290
|
+
/** Build a {@link DateShape}, optionally with a compatible wire encoding. */
|
|
291
|
+
export declare const createDateShape: (encoding?: DateValueEncodingDescriptor) => DateShape;
|
|
292
|
+
/** Build a terminal {@link StringLiteralShape}. */
|
|
293
|
+
export declare const createStringLiteralShape: () => StringLiteralShape;
|
|
294
|
+
/** Build a terminal {@link NumberLiteralShape}. */
|
|
295
|
+
export declare const createNumberLiteralShape: (encoding?: NumericStringEncodingDescriptor) => NumberLiteralShape;
|
|
296
|
+
/** Build a terminal {@link BooleanLiteralShape}. */
|
|
297
|
+
export declare const createBooleanLiteralShape: (encoding?: BooleanValueEncodingDescriptor) => BooleanLiteralShape;
|
|
298
|
+
/** Build a terminal {@link EnumShape}. */
|
|
299
|
+
export declare const createEnumShape: () => EnumShape;
|
|
300
|
+
/** Build a terminal {@link UnionShape}. */
|
|
301
|
+
export declare const createUnionShape: () => UnionShape;
|
|
302
|
+
/** Build a terminal {@link NullShape}. */
|
|
303
|
+
export declare const createNullShape: () => NullShape;
|
|
304
|
+
/** Build an {@link ArrayShape}. */
|
|
305
|
+
export declare const createArrayShape: (element: ValueShape) => ArrayShape;
|
|
306
|
+
/** Build a {@link RecordShape}. */
|
|
307
|
+
export declare const createRecordShape: (value: ValueShape) => RecordShape;
|
|
308
|
+
/** Build a {@link TupleShape}. */
|
|
309
|
+
export declare const createTupleShape: (values: readonly ValueShape[]) => TupleShape;
|
|
310
|
+
/** Return whether a value shape terminates property navigation. */
|
|
311
|
+
export declare function isTerminalValueShape(shape: ValueShape): shape is TerminalValueShape;
|
|
312
|
+
/**
|
|
313
|
+
* Runtime navigation position for a typed proxy. Either:
|
|
314
|
+
* - a {@link ModelShape} — we're at a model's properties, whether or
|
|
315
|
+
* not its variant is known,
|
|
316
|
+
* - a {@link ContainerShape} — we're at a container that hasn't yet been
|
|
317
|
+
* indexed,
|
|
318
|
+
* - `undefined` — the current position is terminal, unknown, or the proxy
|
|
319
|
+
* was created without a shape.
|
|
320
|
+
*
|
|
321
|
+
* Proxies carry a `NavShape` through each access so they can stamp and
|
|
322
|
+
* resolve the correct shape on deeper navigation.
|
|
323
|
+
*
|
|
324
|
+
* Navigation never sits at a {@link DeferredShape} — refs are resolved
|
|
325
|
+
* eagerly as soon as the proxy encounters them.
|
|
326
|
+
*/
|
|
327
|
+
export type NavShape = ModelShape | ContainerShape | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* Resolve a {@link ModelShape} to the single concrete variant that
|
|
330
|
+
* applies to `value`.
|
|
331
|
+
*
|
|
332
|
+
* Resolution is iterative, not a single step, because a variant may
|
|
333
|
+
* itself be a discriminated group keyed on a *different* field (see
|
|
334
|
+
* {@link DiscriminatedModelShape.byValue}). Each hop reads its own
|
|
335
|
+
* discriminator out of the same `value`, so
|
|
336
|
+
* `{ kind: "cat", breed: "siamese" }` resolves through `Pet` → `Cat`
|
|
337
|
+
* → `Siamese`. {@link DeferredShape} entries are dereferenced in
|
|
338
|
+
* place, and flat model shapes are returned as-is.
|
|
339
|
+
*
|
|
340
|
+
* When a hop's discriminator can't be read — it is absent, is not a
|
|
341
|
+
* string (the *expression-valued* case), or names an unknown variant —
|
|
342
|
+
* the variant is instead **inferred from the value's structure** by
|
|
343
|
+
* {@link selectVariant}. That inference is sound rather than a guess:
|
|
344
|
+
* ARM would reject a payload that doesn't match the variant its
|
|
345
|
+
* discriminator selects, so a concrete payload determines the variant
|
|
346
|
+
* even when the discriminator itself is only known at deploy time.
|
|
347
|
+
*
|
|
348
|
+
* Bicep takes the same position — a discriminator it can't evaluate at
|
|
349
|
+
* compile time downgrades type checking for that object (diagnostic
|
|
350
|
+
* `BCP225`) rather than failing the build.
|
|
351
|
+
*
|
|
352
|
+
* Returns `undefined` when `shape` is `undefined`, when there is no
|
|
353
|
+
* `value` to infer from, or when the `byValue` graph is cyclic
|
|
354
|
+
* (defensive; the emitter does not produce cycles here).
|
|
355
|
+
*
|
|
356
|
+
* @param shape - The shape to resolve. Flat shapes are returned
|
|
357
|
+
* unchanged, so callers can pass either kind without checking.
|
|
358
|
+
* @param value - The object this shape describes, used both to read
|
|
359
|
+
* discriminators and to infer a variant when they can't be read.
|
|
360
|
+
* Omit it when no value exists (an `Expression<T>` proxy, say) and
|
|
361
|
+
* discriminated shapes will resolve to `undefined`.
|
|
362
|
+
* @param valueKeyedBy - Which naming **`value`'s own keys** use — not
|
|
363
|
+
* the shape's. A {@link FlatModelShape} is the mapping *between* the
|
|
364
|
+
* two sides (one property is `secretVersion` in TypeScript and
|
|
365
|
+
* `version` on the wire), so inference has to read both sides in the
|
|
366
|
+
* same naming or nothing matches:
|
|
367
|
+
*
|
|
368
|
+
* - `"js"` — client-facing names, as authored in TypeScript and held
|
|
369
|
+
* in a resource's state. These are
|
|
370
|
+
* {@link FlatModelShape.byJsName}'s own keys. Passed by
|
|
371
|
+
* `lowerState`, on state about to be serialized.
|
|
372
|
+
* - `"arm"` — wire names, as they appear in an ARM template or a
|
|
373
|
+
* service response. These are the first segment of each
|
|
374
|
+
* {@link PropertyShape.armPath}. Passed by `raiseState`, on JSON
|
|
375
|
+
* just parsed off the wire.
|
|
376
|
+
*
|
|
377
|
+
* Has no effect when the discriminator resolves normally, and no
|
|
378
|
+
* effect at all for models whose properties map 1:1.
|
|
379
|
+
*/
|
|
380
|
+
export declare function resolveModelShape(shape: ModelShape | undefined, value: Record<string, unknown> | undefined, valueKeyedBy?: "js" | "arm"): FlatModelShape | undefined;
|
|
381
|
+
/**
|
|
382
|
+
* Navigate `nav` one step deeper using `segment`. For string segments
|
|
383
|
+
* (`.foo`) at a model position, returns the property's shape entry as
|
|
384
|
+
* `stamp` and advances `next` into the property's target. For numeric
|
|
385
|
+
* segments (`[i]`) or string keys at a record position, peels one
|
|
386
|
+
* container layer; `stamp` is always `undefined`.
|
|
387
|
+
*
|
|
388
|
+
* Returns `{ stamp: undefined, next: undefined }` when the step can't
|
|
389
|
+
* be resolved (unknown property, out-of-shape access, etc.) — the
|
|
390
|
+
* access is treated as passthrough.
|
|
391
|
+
*
|
|
392
|
+
* @param nav - Where navigation currently sits.
|
|
393
|
+
* @param segment - The member name or array index being accessed.
|
|
394
|
+
* @param value - The value sitting at `nav`, when the caller has one.
|
|
395
|
+
* Consulted only at a {@link DiscriminatedModelShape} position, to
|
|
396
|
+
* select the variant via {@link resolveModelShape}. Always read with
|
|
397
|
+
* `"js"` naming, since navigation follows client-facing property
|
|
398
|
+
* names. Callers with no value — an `Expression<T>` proxy, for
|
|
399
|
+
* instance — omit it and get passthrough for discriminated
|
|
400
|
+
* positions, which is the honest answer when the variant is
|
|
401
|
+
* unknowable.
|
|
402
|
+
*/
|
|
403
|
+
export declare function navigateShape(nav: NavShape, segment: string | number, value?: unknown): {
|
|
404
|
+
readonly stamp: PropertyShape | undefined;
|
|
405
|
+
readonly next: NavShape;
|
|
406
|
+
};
|
|
407
|
+
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
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