@azure/provisioning-core 0.1.0-alpha.20261014.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/constructs/built-in-resources/resource-group.d.ts +50 -0
  4. package/dist/constructs/built-in-resources/resource-group.d.ts.map +1 -0
  5. package/dist/constructs/built-in-resources/resource-group.js +97 -0
  6. package/dist/constructs/built-in-resources/resource-group.js.map +1 -0
  7. package/dist/constructs/output.d.ts +80 -0
  8. package/dist/constructs/output.d.ts.map +1 -0
  9. package/dist/constructs/output.js +76 -0
  10. package/dist/constructs/output.js.map +1 -0
  11. package/dist/constructs/parameter.d.ts +77 -0
  12. package/dist/constructs/parameter.d.ts.map +1 -0
  13. package/dist/constructs/parameter.js +93 -0
  14. package/dist/constructs/parameter.js.map +1 -0
  15. package/dist/constructs/provisioning-component.d.ts +91 -0
  16. package/dist/constructs/provisioning-component.d.ts.map +1 -0
  17. package/dist/constructs/provisioning-component.js +150 -0
  18. package/dist/constructs/provisioning-component.js.map +1 -0
  19. package/dist/constructs/resource/resource-proxy.d.ts +134 -0
  20. package/dist/constructs/resource/resource-proxy.d.ts.map +1 -0
  21. package/dist/constructs/resource/resource-proxy.js +523 -0
  22. package/dist/constructs/resource/resource-proxy.js.map +1 -0
  23. package/dist/constructs/resource/resource-query.d.ts +23 -0
  24. package/dist/constructs/resource/resource-query.d.ts.map +1 -0
  25. package/dist/constructs/resource/resource-query.js +71 -0
  26. package/dist/constructs/resource/resource-query.js.map +1 -0
  27. package/dist/constructs/resource/resource-registry.d.ts +99 -0
  28. package/dist/constructs/resource/resource-registry.d.ts.map +1 -0
  29. package/dist/constructs/resource/resource-registry.js +51 -0
  30. package/dist/constructs/resource/resource-registry.js.map +1 -0
  31. package/dist/constructs/resource/resource-type-registry.d.ts +46 -0
  32. package/dist/constructs/resource/resource-type-registry.d.ts.map +1 -0
  33. package/dist/constructs/resource/resource-type-registry.js +156 -0
  34. package/dist/constructs/resource/resource-type-registry.js.map +1 -0
  35. package/dist/constructs/resource/resource-utils.d.ts +60 -0
  36. package/dist/constructs/resource/resource-utils.d.ts.map +1 -0
  37. package/dist/constructs/resource/resource-utils.js +77 -0
  38. package/dist/constructs/resource/resource-utils.js.map +1 -0
  39. package/dist/constructs/resource/resource.d.ts +460 -0
  40. package/dist/constructs/resource/resource.d.ts.map +1 -0
  41. package/dist/constructs/resource/resource.js +584 -0
  42. package/dist/constructs/resource/resource.js.map +1 -0
  43. package/dist/constructs/stack.d.ts +110 -0
  44. package/dist/constructs/stack.d.ts.map +1 -0
  45. package/dist/constructs/stack.js +110 -0
  46. package/dist/constructs/stack.js.map +1 -0
  47. package/dist/constructs/variable.d.ts +63 -0
  48. package/dist/constructs/variable.d.ts.map +1 -0
  49. package/dist/constructs/variable.js +74 -0
  50. package/dist/constructs/variable.js.map +1 -0
  51. package/dist/deployment-context/deployment-context.d.ts +27 -0
  52. package/dist/deployment-context/deployment-context.d.ts.map +1 -0
  53. package/dist/deployment-context/deployment-context.js +4 -0
  54. package/dist/deployment-context/deployment-context.js.map +1 -0
  55. package/dist/expression/ast-nodes.d.ts +100 -0
  56. package/dist/expression/ast-nodes.d.ts.map +1 -0
  57. package/dist/expression/ast-nodes.js +127 -0
  58. package/dist/expression/ast-nodes.js.map +1 -0
  59. package/dist/expression/expressions.d.ts +164 -0
  60. package/dist/expression/expressions.d.ts.map +1 -0
  61. package/dist/expression/expressions.js +211 -0
  62. package/dist/expression/expressions.js.map +1 -0
  63. package/dist/fn.d.ts +194 -0
  64. package/dist/fn.d.ts.map +1 -0
  65. package/dist/fn.js +353 -0
  66. package/dist/fn.js.map +1 -0
  67. package/dist/index.d.ts +25 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +19 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/internal-loop.d.ts +14 -0
  72. package/dist/internal-loop.d.ts.map +1 -0
  73. package/dist/internal-loop.js +16 -0
  74. package/dist/internal-loop.js.map +1 -0
  75. package/dist/internal.d.ts +13 -0
  76. package/dist/internal.d.ts.map +1 -0
  77. package/dist/internal.js +10 -0
  78. package/dist/internal.js.map +1 -0
  79. package/dist/naming/naming-policy.d.ts +56 -0
  80. package/dist/naming/naming-policy.d.ts.map +1 -0
  81. package/dist/naming/naming-policy.js +99 -0
  82. package/dist/naming/naming-policy.js.map +1 -0
  83. package/dist/naming/naming-rules.d.ts +15 -0
  84. package/dist/naming/naming-rules.d.ts.map +1 -0
  85. package/dist/naming/naming-rules.js +15 -0
  86. package/dist/naming/naming-rules.js.map +1 -0
  87. package/dist/serialization/contract/generated/ast.d.ts +508 -0
  88. package/dist/serialization/contract/generated/ast.d.ts.map +1 -0
  89. package/dist/serialization/contract/generated/ast.js +23 -0
  90. package/dist/serialization/contract/generated/ast.js.map +1 -0
  91. package/dist/serialization/contract/index.d.ts +2 -0
  92. package/dist/serialization/contract/index.d.ts.map +1 -0
  93. package/dist/serialization/contract/index.js +4 -0
  94. package/dist/serialization/contract/index.js.map +1 -0
  95. package/dist/serialization/index.d.ts +4 -0
  96. package/dist/serialization/index.d.ts.map +1 -0
  97. package/dist/serialization/index.js +5 -0
  98. package/dist/serialization/index.js.map +1 -0
  99. package/dist/serialization/json/deserialize.d.ts +24 -0
  100. package/dist/serialization/json/deserialize.d.ts.map +1 -0
  101. package/dist/serialization/json/deserialize.js +476 -0
  102. package/dist/serialization/json/deserialize.js.map +1 -0
  103. package/dist/serialization/json/encoding.d.ts +4 -0
  104. package/dist/serialization/json/encoding.d.ts.map +1 -0
  105. package/dist/serialization/json/encoding.js +323 -0
  106. package/dist/serialization/json/encoding.js.map +1 -0
  107. package/dist/serialization/json/expression.d.ts +32 -0
  108. package/dist/serialization/json/expression.d.ts.map +1 -0
  109. package/dist/serialization/json/expression.js +490 -0
  110. package/dist/serialization/json/expression.js.map +1 -0
  111. package/dist/serialization/json/lower.d.ts +41 -0
  112. package/dist/serialization/json/lower.d.ts.map +1 -0
  113. package/dist/serialization/json/lower.js +343 -0
  114. package/dist/serialization/json/lower.js.map +1 -0
  115. package/dist/serialization/json/pluralize-config.d.ts +3 -0
  116. package/dist/serialization/json/pluralize-config.d.ts.map +1 -0
  117. package/dist/serialization/json/pluralize-config.js +7 -0
  118. package/dist/serialization/json/pluralize-config.js.map +1 -0
  119. package/dist/serialization/json/serialize.d.ts +12 -0
  120. package/dist/serialization/json/serialize.d.ts.map +1 -0
  121. package/dist/serialization/json/serialize.js +399 -0
  122. package/dist/serialization/json/serialize.js.map +1 -0
  123. package/dist/serialization/json/util.d.ts +2 -0
  124. package/dist/serialization/json/util.d.ts.map +1 -0
  125. package/dist/serialization/json/util.js +19 -0
  126. package/dist/serialization/json/util.js.map +1 -0
  127. package/dist/serialization/utils.d.ts +3 -0
  128. package/dist/serialization/utils.d.ts.map +1 -0
  129. package/dist/serialization/utils.js +146 -0
  130. package/dist/serialization/utils.js.map +1 -0
  131. package/dist/shape/shape-registry.d.ts +51 -0
  132. package/dist/shape/shape-registry.d.ts.map +1 -0
  133. package/dist/shape/shape-registry.js +41 -0
  134. package/dist/shape/shape-registry.js.map +1 -0
  135. package/dist/shape/shape.d.ts +407 -0
  136. package/dist/shape/shape.d.ts.map +1 -0
  137. package/dist/shape/shape.js +425 -0
  138. package/dist/shape/shape.js.map +1 -0
  139. package/dist/shape/value-encoding.d.ts +121 -0
  140. package/dist/shape/value-encoding.d.ts.map +1 -0
  141. package/dist/shape/value-encoding.js +32 -0
  142. package/dist/shape/value-encoding.js.map +1 -0
  143. package/dist/tsconfig.tsbuildinfo +1 -0
  144. package/dist/types.d.ts +9 -0
  145. package/dist/types.d.ts.map +1 -0
  146. package/dist/types.js +4 -0
  147. package/dist/types.js.map +1 -0
  148. package/dist/util.d.ts +33 -0
  149. package/dist/util.d.ts.map +1 -0
  150. package/dist/util.js +78 -0
  151. package/dist/util.js.map +1 -0
  152. package/package.json +49 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EACL,YAAY,EACZ,gBAAgB,GAOjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,eAAe,EACf,mBAAmB,GAMpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,cAAc,EAEd,kBAAkB,GAKnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,EAAqB,MAAM,uBAAuB,CAAC;AACjE,OAAO,EACL,qBAAqB,GAEtB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,eAAe,EACf,YAAY,GAQb,MAAM,6BAA6B,CAAC;AAiBrC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAIrB,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAAqB,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,YAAY,GACb,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAc,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAMN,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAgC7D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAiBrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,aAAa,GAEd,MAAM,mDAAmD,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * We are hiding these loop APIs from the public npm surface temporarily, so move
3
+ * the related APIs to this internal module. TODO: move them back to index.ts after
4
+ * we are ready to expose them publicly again.
5
+ *
6
+ * Workspace-only loop APIs used to preserve coverage while loop authoring is
7
+ * not part of the published npm surface.
8
+ *
9
+ * This module must not be added to `package.json#exports`.
10
+ */
11
+ export { createLoopedResource, Loop, LoopedResource, type LoopContext, type LoopOptions, } from "./constructs/resource/resource.js";
12
+ export { isLoopedResource, isLoopedResourceOf, } from "./constructs/resource/resource-utils.js";
13
+ export { addLoopedResource, getLoopedResources } from "./constructs/stack.js";
14
+ //# sourceMappingURL=internal-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-loop.d.ts","sourceRoot":"","sources":["../src/internal-loop.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * We are hiding these loop APIs from the public npm surface temporarily, so move
5
+ * the related APIs to this internal module. TODO: move them back to index.ts after
6
+ * we are ready to expose them publicly again.
7
+ *
8
+ * Workspace-only loop APIs used to preserve coverage while loop authoring is
9
+ * not part of the published npm surface.
10
+ *
11
+ * This module must not be added to `package.json#exports`.
12
+ */
13
+ export { createLoopedResource, Loop, LoopedResource, } from "./constructs/resource/resource.js";
14
+ export { isLoopedResource, isLoopedResourceOf, } from "./constructs/resource/resource-utils.js";
15
+ export { addLoopedResource, getLoopedResources } from "./constructs/stack.js";
16
+ //# sourceMappingURL=internal-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-loop.js","sourceRoot":"","sources":["../src/internal-loop.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;GASG;AACH,OAAO,EACL,oBAAoB,EACpB,IAAI,EACJ,cAAc,GAGf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export { unwrapExpression, wrapExpression, type InputArray, type InputOf, type InputRecord, type InputTuple, } from "./expression/expressions.js";
2
+ export { serializeExpression, type SerializableValue, } from "./serialization/json/expression.js";
3
+ export { sanitizeIdentifier } from "./serialization/json/util.js";
4
+ export { collectDependenciesForDeclaration } from "./serialization/utils.js";
5
+ export type { BinaryOperator, DeclarableBodyNode, DecoratorsNode, ExpressionNode, IdentifierExpression, InfraNode, ModuleDeclarationNode, ObjectValue, OutputDeclarationNode, ParameterDeclarationNode, PrimitiveTypeMap, ResourceDeclarationNode, TargetScope, TypeNode, UnaryOperator, VariableDeclarationNode, } from "./serialization/contract/index.js";
6
+ export { unwrapResourceHandle } from "./constructs/resource/resource-proxy.js";
7
+ export type { ResourceProps, SingletonExistingResourceProps, } from "./constructs/resource/resource.js";
8
+ export type { AnyShape, ArrayShape, BooleanLiteralShape, BooleanShape, BytesShape, ContainerShape, DateShape, DeferredShape, DiscriminatedModelShape, DiscriminatorNames, EnumShape, FlatModelShape, ModelShape, NullShape, NumberLiteralShape, NumberShape, PropertyShape, RecordShape, StringLiteralShape, StringShape, TerminalValueShape, TupleShape, UnionShape, ValueShape, } from "./shape/shape.js";
9
+ export { createAnyShape, createArrayShape, createBooleanLiteralShape, createBooleanShape, createBytesShape, createDateShape, createDeferredShape, createDiscriminatedModelShape, createEnumShape, createFlatModelShape, createNullShape, createNumberLiteralShape, createNumberShape, createRecordShape, createStringLiteralShape, createStringShape, createTupleShape, createUnionShape, } from "./shape/shape.js";
10
+ export type { FlatVariantSelection, FlatVariantSelector, } from "./constructs/resource/resource-type-registry.js";
11
+ export { INTEGER_SCALAR_NAMES, isIntegerScalarName, isNumericScalarName, NUMERIC_SCALAR_NAMES, type BooleanStringEncodingDescriptor, type BooleanValueEncodingDescriptor, type BytesEncodingDescriptor, type BytesValueEncodingDescriptor, type DateTimeTextEncodingDescriptor, type DateValueEncodingDescriptor, type DurationIso8601EncodingDescriptor, type DurationNumericEncodingDescriptor, type IntegerScalarName, type NumberValueEncodingDescriptor, type NumericScalarName, type NumericStringEncodingDescriptor, type PlainDateEncodingDescriptor, type StringValueEncodingDescriptor, type UnixTimestampEncodingDescriptor, type ValueEncodingDescriptor, } from "./shape/value-encoding.js";
12
+ export type { ResourceNamingRules, ResourceNamingValidCharacters, } from "./naming/naming-rules.js";
13
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,EACnB,KAAK,iBAAiB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,uBAAuB,GACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,YAAY,EACV,aAAa,EACb,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EAChC,KAAK,iCAAiC,EACtC,KAAK,iCAAiC,EACtC,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,EAChC,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,10 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export { unwrapExpression, wrapExpression, } from "./expression/expressions.js";
4
+ export { serializeExpression, } from "./serialization/json/expression.js";
5
+ export { sanitizeIdentifier } from "./serialization/json/util.js";
6
+ export { collectDependenciesForDeclaration } from "./serialization/utils.js";
7
+ export { unwrapResourceHandle } from "./constructs/resource/resource-proxy.js";
8
+ export { createAnyShape, createArrayShape, createBooleanLiteralShape, createBooleanShape, createBytesShape, createDateShape, createDeferredShape, createDiscriminatedModelShape, createEnumShape, createFlatModelShape, createNullShape, createNumberLiteralShape, createNumberShape, createRecordShape, createStringLiteralShape, createStringShape, createTupleShape, createUnionShape, } from "./shape/shape.js";
9
+ export { INTEGER_SCALAR_NAMES, isIntegerScalarName, isNumericScalarName, NUMERIC_SCALAR_NAMES, } from "./shape/value-encoding.js";
10
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,gBAAgB,EAChB,cAAc,GAKf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,GAEpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAmB7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AA+B/E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GAiBrB,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,56 @@
1
+ import type { ExpressionOrValue } from "../expression/expressions.js";
2
+ import { type ResourceNamingRules } from "./naming-rules.js";
3
+ export interface NamingContext {
4
+ readonly type: string;
5
+ readonly rules: ResourceNamingRules;
6
+ readonly label?: string | undefined;
7
+ }
8
+ /**
9
+ * Strategy for generating Azure resource names when a resource is created
10
+ * without an explicit `name`.
11
+ *
12
+ * Implement this interface to provide a custom naming convention. Two
13
+ * built-in implementations are provided:
14
+ *
15
+ * - {@link DefaultNamingPolicy} — workload-based names with abbreviations,
16
+ * ordinals, and `uniqueString()` for globally-scoped resources.
17
+ * - {@link namingRequiredPolicy} — a singleton that throws if a resource
18
+ * doesn't provide an explicit `name`.
19
+ */
20
+ export interface NamingPolicy {
21
+ generateName(context: NamingContext): ExpressionOrValue<string>;
22
+ }
23
+ export interface NamingPolicyOptions {
24
+ readonly workload: string;
25
+ readonly environment?: string | undefined;
26
+ readonly region?: string | undefined;
27
+ }
28
+ /**
29
+ * Default workload-based naming policy.
30
+ *
31
+ * Generates names by composing the resource type abbreviation, workload,
32
+ * environment, region, label, and an ordinal suffix for repeated types.
33
+ * Global-scope resources get a `uniqueString(subscription().subscriptionId)`
34
+ * suffix to ensure uniqueness.
35
+ */
36
+ export declare class DefaultNamingPolicy implements NamingPolicy {
37
+ #private;
38
+ constructor(options: NamingPolicyOptions);
39
+ generateName(context: NamingContext): ExpressionOrValue<string>;
40
+ }
41
+ /**
42
+ * Naming policy that requires every resource to provide an explicit `name`.
43
+ *
44
+ * Throws an error when asked to generate a name. Use this on a stack to
45
+ * disable auto-naming entirely.
46
+ */
47
+ export declare const namingRequiredPolicy: NamingPolicy;
48
+ /**
49
+ * Resolves the Azure resource name for a resource instance.
50
+ *
51
+ * - If `name` is explicitly provided (string or expression), it is used
52
+ * as-is — the naming policy does not transform it.
53
+ * - Otherwise, the active naming policy generates a name.
54
+ */
55
+ export declare function resolveResourceName(policy: NamingPolicy, name: ExpressionOrValue<string> | undefined, type: string, namingRules: ResourceNamingRules | undefined): ExpressionOrValue<string>;
56
+ //# sourceMappingUR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ft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { concat, subscription, toLower, uniqueString } from "../fn.js";
4
+ import { MOST_RESTRICTIVE } from "./naming-rules.js";
5
+ /**
6
+ * Default workload-based naming policy.
7
+ *
8
+ * Generates names by composing the resource type abbreviation, workload,
9
+ * environment, region, label, and an ordinal suffix for repeated types.
10
+ * Global-scope resources get a `uniqueString(subscription().subscriptionId)`
11
+ * suffix to ensure uniqueness.
12
+ */
13
+ export class DefaultNamingPolicy {
14
+ #options;
15
+ #ordinals = new Map();
16
+ constructor(options) {
17
+ this.#options = options;
18
+ }
19
+ generateName(context) {
20
+ const ordinal = this.#ordinals.get(context.type) ?? 0;
21
+ this.#ordinals.set(context.type, ordinal + 1);
22
+ const rules = context.rules;
23
+ const sep = rules.validCharacters.hyphens ? "-" : "";
24
+ const sanitize = (segment) => {
25
+ let value = segment;
26
+ if (!rules.validCharacters.hyphens)
27
+ value = value.replace(/-/gu, "");
28
+ if (!rules.validCharacters.underscores)
29
+ value = value.replace(/_/gu, "");
30
+ if (!rules.validCharacters.periods)
31
+ value = value.replace(/\./gu, "");
32
+ value = value.replace(/[^A-Za-z0-9._-]/gu, "");
33
+ return rules.validCharacters.uppercase ? value : value.toLowerCase();
34
+ };
35
+ const segments = [];
36
+ if (rules.abbreviation) {
37
+ segments.push(sanitize(rules.abbreviation));
38
+ }
39
+ segments.push(sanitize(this.#options.workload));
40
+ if (this.#options.environment) {
41
+ segments.push(sanitize(this.#options.environment));
42
+ }
43
+ if (this.#options.region) {
44
+ segments.push(sanitize(this.#options.region));
45
+ }
46
+ if (context.label) {
47
+ segments.push(sanitize(context.label));
48
+ }
49
+ const ordinalSuffix = ordinal > 0 ? String(ordinal + 1) : "";
50
+ const base = segments.filter(Boolean).join(sep);
51
+ const truncateWithOrdinal = (available) => {
52
+ const ordinalPrefix = ordinalSuffix ? sep : "";
53
+ const baseLimit = Math.max(0, available - ordinalPrefix.length - ordinalSuffix.length);
54
+ return `${base.slice(0, baseLimit)}${ordinalPrefix}${ordinalSuffix}`;
55
+ };
56
+ if (rules.scope === "global") {
57
+ // Bicep uniqueString() always returns 13 characters. Reserve that suffix
58
+ // and the ordinal before truncating so repeated resources stay unique.
59
+ const uniqueSuffixLength = 13;
60
+ const prefix = truncateWithOrdinal(rules.maxLength - sep.length - uniqueSuffixLength);
61
+ const full = concat(prefix + sep, uniqueString(subscription().subscriptionId));
62
+ return rules.validCharacters.uppercase ? full : toLower(full);
63
+ }
64
+ // Non-global scope: no uniqueString needed, plain string is fine
65
+ const truncated = truncateWithOrdinal(rules.maxLength);
66
+ return rules.validCharacters.uppercase
67
+ ? truncated
68
+ : truncated.toLowerCase();
69
+ }
70
+ }
71
+ /**
72
+ * Naming policy that requires every resource to provide an explicit `name`.
73
+ *
74
+ * Throws an error when asked to generate a name. Use this on a stack to
75
+ * disable auto-naming entirely.
76
+ */
77
+ export const namingRequiredPolicy = {
78
+ generateName(context) {
79
+ throw new Error(`Resource of type '${context.type}' requires an explicit 'name' ` +
80
+ `(the stack uses 'namingRequiredPolicy').`);
81
+ },
82
+ };
83
+ /**
84
+ * Resolves the Azure resource name for a resource instance.
85
+ *
86
+ * - If `name` is explicitly provided (string or expression), it is used
87
+ * as-is — the naming policy does not transform it.
88
+ * - Otherwise, the active naming policy generates a name.
89
+ */
90
+ export function resolveResourceName(policy, name, type, namingRules) {
91
+ if (name !== undefined) {
92
+ return name;
93
+ }
94
+ return policy.generateName({
95
+ type,
96
+ rules: namingRules ?? MOST_RESTRICTIVE,
97
+ });
98
+ }
99
+ //# sourceMappingURL=naming-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naming-policy.js","sourceRoot":"","sources":["../../src/naming/naming-policy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAA4B,MAAM,mBAAmB,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,gBAAgB;KACvC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,15 @@
1
+ export interface ResourceNamingValidCharacters {
2
+ readonly uppercase: boolean;
3
+ readonly hyphens: boolean;
4
+ readonly underscores: boolean;
5
+ readonly periods: boolean;
6
+ }
7
+ export interface ResourceNamingRules {
8
+ readonly abbreviation: string;
9
+ readonly minLength: number;
10
+ readonly maxLength: number;
11
+ readonly validCharacters: ResourceNamingValidCharacters;
12
+ readonly scope: "global" | "resourceGroup" | "subscription";
13
+ }
14
+ export declare const MOST_RESTRICTIVE: ResourceNamingRules;
15
+ //# sourceMappingURL=naming-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naming-rules.d.ts","sourceRoot":"","sources":["../../src/naming/naming-rules.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,6BAA6B,CAAC;IACxD,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,eAAe,GAAG,cAAc,CAAC;CAC7D;AAED,eAAO,MAAM,gBAAgB,EAAE,mBAW9B,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export const MOST_RESTRICTIVE = {
4
+ abbreviation: "",
5
+ minLength: 1,
6
+ maxLength: 24,
7
+ validCharacters: {
8
+ uppercase: false,
9
+ hyphens: false,
10
+ underscores: false,
11
+ periods: false,
12
+ },
13
+ scope: "global",
14
+ };
15
+ //# sourceMappingURL=naming-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naming-rules.js","sourceRoot":"","sources":["../../src/naming/naming-rules.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiBlC,MAAM,CAAC,MAAM,gBAAgB,GAAwB;IACnD,YAAY,EAAE,EAAE;IAChB,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,eAAe,EAAE;QACf,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,KAAK;QAClB,OAAO,EAAE,KAAK;KACf;IACD,KAAK,EAAE,QAAQ;CAChB,CAAC"}