@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,127 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ // Typed as `Record<ExpressionNode["kind"], true>` so adding a new variant to
4
+ // `ExpressionNode` forces a compile error here until the new kind is listed.
5
+ const EXPRESSION_NODE_KINDS = {
6
+ "fn-call": true,
7
+ "symbolic-value": true,
8
+ identifier: true,
9
+ "property-access": true,
10
+ "array-access": true,
11
+ binary: true,
12
+ unary: true,
13
+ ternary: true,
14
+ "instance-function-call": true,
15
+ "interpolated-string": true,
16
+ };
17
+ /** Tests whether a value structurally matches a raw expression AST node. */
18
+ export function isExpressionNode(value) {
19
+ if (typeof value !== "object" ||
20
+ value === null ||
21
+ !Object.prototype.hasOwnProperty.call(value, "kind") ||
22
+ typeof value.kind !== "string") {
23
+ return false;
24
+ }
25
+ const node = value;
26
+ if (!Object.prototype.hasOwnProperty.call(EXPRESSION_NODE_KINDS, node.kind)) {
27
+ return false;
28
+ }
29
+ switch (node.kind) {
30
+ case "fn-call":
31
+ return typeof node.operator === "string" && Array.isArray(node.args);
32
+ case "symbolic-value":
33
+ return typeof node.path === "string";
34
+ case "identifier":
35
+ return typeof node.id === "string" || typeof node.id === "object";
36
+ case "property-access":
37
+ return (isExpressionNode(node.base) &&
38
+ typeof node.property === "string" &&
39
+ typeof node.nullish === "boolean");
40
+ case "array-access":
41
+ return (isExpressionNode(node.base) &&
42
+ "index" in node &&
43
+ typeof node.nullish === "boolean" &&
44
+ typeof node.fromEnd === "boolean");
45
+ case "binary":
46
+ return (typeof node.operator === "string" && "left" in node && "right" in node);
47
+ case "unary":
48
+ return typeof node.operator === "string" && "argument" in node;
49
+ case "ternary":
50
+ return "condition" in node && "trueValue" in node && "falseValue" in node;
51
+ case "instance-function-call":
52
+ return (isExpressionNode(node.base) &&
53
+ typeof node.name === "string" &&
54
+ Array.isArray(node.args));
55
+ case "interpolated-string":
56
+ return Array.isArray(node.segments);
57
+ default:
58
+ return false;
59
+ }
60
+ }
61
+ // ---------------------------------------------------------------------------
62
+ // Factory functions
63
+ // ---------------------------------------------------------------------------
64
+ export function functionCallExpressionNode(operator, args) {
65
+ return { kind: "fn-call", operator, args };
66
+ }
67
+ export function symbolicValueExpressionNode(path) {
68
+ return { kind: "symbolic-value", path };
69
+ }
70
+ export function identifierExpressionNode(identifier) {
71
+ return { kind: "identifier", id: identifier };
72
+ }
73
+ export function propertyAccessExpressionNode(base, property, options = {}) {
74
+ return {
75
+ kind: "property-access",
76
+ base,
77
+ property,
78
+ nullish: options.nullish ?? false,
79
+ ...(options.armPath === undefined ? {} : { armPath: options.armPath }),
80
+ };
81
+ }
82
+ export function arrayAccessExpressionNode(base, index, options = {}) {
83
+ return {
84
+ kind: "array-access",
85
+ base,
86
+ index,
87
+ nullish: options.nullish ?? false,
88
+ fromEnd: options.fromEnd ?? false,
89
+ };
90
+ }
91
+ export function binaryExpressionNode(operator, left, right) {
92
+ return { kind: "binary", operator, left, right };
93
+ }
94
+ export function unaryExpressionNode(operator, argument) {
95
+ return { kind: "unary", operator, argument };
96
+ }
97
+ export function ternaryExpressionNode(condition, trueValue, falseValue) {
98
+ return {
99
+ kind: "ternary",
100
+ condition,
101
+ trueValue,
102
+ falseValue,
103
+ };
104
+ }
105
+ export function instanceFunctionCallExpressionNode(base, name, args) {
106
+ return {
107
+ kind: "instance-function-call",
108
+ base,
109
+ name,
110
+ args,
111
+ };
112
+ }
113
+ export function interpolatedStringExpressionNode(segments) {
114
+ return { kind: "interpolated-string", segments };
115
+ }
116
+ // ---------------------------------------------------------------------------
117
+ // Helpers
118
+ // ---------------------------------------------------------------------------
119
+ function isIdentifierSegment(segment) {
120
+ return /^[A-Za-z_][A-Za-z0-9_]*$/u.test(segment);
121
+ }
122
+ export function accessExpressionNode(base, member, options = {}) {
123
+ return typeof member === "number" || !isIdentifierSegment(member)
124
+ ? arrayAccessExpressionNode(base, member, options)
125
+ : propertyAccessExpressionNode(base, member, options);
126
+ }
127
+ //# sourceMappingURL=ast-nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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EAAE,SAAS;QACf,SAAS;QACT,SAAS;QACT,UAAU;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,IAAoB,EACpB,IAAY,EACZ,IAAwB;IAExB,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,IAAI;QACJ,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,QAA4B;IAE5B,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AACnD,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,IAAoB,EACpB,MAAuB,EACvB,UAEI,EAAE;IAEN,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;QAC/D,CAAC,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC;QAClD,CAAC,CAAC,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,164 @@
1
+ import { type NavShape } from "../shape/shape.js";
2
+ import { type BinaryOperator, type ExpressionNode, type UnaryOperator } from "./ast-nodes.js";
3
+ /**
4
+ * Runtime symbol key storing the underlying `ExpressionNode` on proxies.
5
+ * Internal to the package — consumers should use `isExpression()` and
6
+ * `unwrapExpression()` instead of accessing this directly.
7
+ */
8
+ export declare const EXPRESSION_BRAND: unique symbol;
9
+ /** Declared symbol type used in the `Expression<T>` interface for branding. */
10
+ declare const __expressionBrand: unique symbol;
11
+ export interface ExpressionBrand<out T> {
12
+ readonly [__expressionBrand]: ExpressionNode<T>;
13
+ }
14
+ declare const __expressionTag: unique symbol;
15
+ export interface ExpressionTag {
16
+ readonly [__expressionTag]?: never;
17
+ }
18
+ /**
19
+ * An opaque deploy-time expression wrapping type `T`.
20
+ *
21
+ * For object types, properties of `T` are accessible as
22
+ * `Expression<Exclude<T[K], undefined>>`. Expression proxies always expose a
23
+ * symbolic property path, so TypeScript's `undefined` omission marker does not
24
+ * belong in the projected value type. Explicit `null` remains intact.
25
+ * For array types, numeric indices return `Expression<element>` and
26
+ * `.length` is an `Expression<number>`.
27
+ *
28
+ * Function-typed keys on `T` are intentionally NOT surfaced — an
29
+ * `Expression<(...)=>R>` isn't callable at the type level or meaningful
30
+ * at emit time. When bicep-level array/object methods are needed
31
+ * (concat, union, etc.), they are added explicitly via dedicated helper
32
+ * types (e.g. a future `ArrayExpression<T>`), not reflectively derived.
33
+ *
34
+ * `NonNullable<T>` is applied at the input boundary, so
35
+ * `Expression<R | undefined>` yields the same structural surface as
36
+ * `Expression<R>` — otherwise the `| undefined` union would distribute
37
+ * and collapse the object branch into `mapped | {}`, erasing the
38
+ * index signature / member projection.
39
+ */
40
+ export type Expression<T = unknown> = ExpressionBrand<T> & ExpressionTag & ExpressionShape<NonNullable<T>>;
41
+ export type ExpressionShape<T> = T extends readonly unknown[] ? number extends T["length"] ? {
42
+ readonly length: Expression<number>;
43
+ readonly [index: number]: Expression<T[number]>;
44
+ } : {
45
+ readonly [K in Exclude<keyof T, keyof any[]>]: Expression<T[K]>;
46
+ } & {
47
+ readonly length: Expression<number>;
48
+ readonly [index: number]: Expression<T[number]>;
49
+ } : T extends object ? {
50
+ readonly [K in keyof T as T[K] extends (...a: any[]) => any ? never : K]-?: Expression<Exclude<T[K], undefined>>;
51
+ } : {};
52
+ /**
53
+ * Carries an *optional* Expression brand on an Input-shaped interface.
54
+ *
55
+ * This is the asymmetric-brand trick that makes the Input type system
56
+ * work without discriminated unions:
57
+ *
58
+ * - Every generated `*Input` interface extends `InputOf<Raw>` and therefore
59
+ * inherits the optional brand. Plain literal values (e.g. `{ foo: 1 }`)
60
+ * trivially satisfy it because the brand property is absent, which is
61
+ * permitted by an optional field.
62
+ * - `Expression<Raw>` carries a *required* brand of the same shape.
63
+ * Required-fields-satisfy-optional is part of TS structural assignability,
64
+ * so any `Expression<Raw>` is assignable where an `InputOf<Raw>`
65
+ * (and thus any `*Input` that extends it) is expected.
66
+ *
67
+ * Net effect: a single `MInput` parameter accepts both literals and
68
+ * whole-subtree `Expression<M>` replacements — no `MInput | Expression<M>`
69
+ * union is needed in the generated signatures. Callers that want to
70
+ * inspect whether a value is a literal or expression use `isExpression()`.
71
+ */
72
+ export interface InputOf<out Raw> {
73
+ readonly [__expressionBrand]?: ExpressionNode<Raw>;
74
+ }
75
+ /**
76
+ * Writable input form for an array container.
77
+ *
78
+ * Accepts literal `T[]`, another `InputArray<T>`, or `Expression<Raw>`.
79
+ * Deliberately NOT a subtype of `T[]` — passing a CDK-backed array to
80
+ * an API that expects a plain `Array<T>` fails at compile time, which
81
+ * is the correct signal (the value may actually be a Proxy wrapping an
82
+ * `ExpressionNode`, not a real JS array).
83
+ */
84
+ export interface InputArray<T, Raw = readonly T[]> extends InputOf<Raw> {
85
+ length: number | Expression<number>;
86
+ [index: number]: T;
87
+ }
88
+ /** Writable input form for a `Record<string, V>` container. */
89
+ export interface InputRecord<V, Raw = Record<string, V>> extends InputOf<Raw> {
90
+ [key: string]: V;
91
+ }
92
+ /** Writable input form for a fixed-length heterogeneous tuple. */
93
+ export type InputTuple<T extends readonly unknown[], Raw extends readonly unknown[] = T> = InputOf<Raw> & {
94
+ length: T["length"] | Expression<number>;
95
+ [index: number]: T[number] | Expression<Raw[number]>;
96
+ } & {
97
+ [K in Exclude<keyof T, keyof any[]>]: T[K];
98
+ };
99
+ /**
100
+ * Accepts either a plain value `T` or an `Expression<T>` substitution.
101
+ *
102
+ * Use this on scalar/leaf Input sites (primitives, enums, literal-only
103
+ * unions) where a full `InputOf<...>` structural extension doesn't apply.
104
+ * The result is a simple discriminated union; call `isExpression()` to
105
+ * branch on the runtime shape.
106
+ */
107
+ export type ExpressionOrValue<T> = T | Expression<T>;
108
+ /**
109
+ * Asserts that a deploy-time expression resolves to a specific literal,
110
+ * so it can be used where a discriminator is expected.
111
+ *
112
+ * Discriminator properties on a `@discriminator` model are typed as bare
113
+ * literals (`kind: "cache"`) rather than `ExpressionOrValue<"cache">`.
114
+ * That is deliberate: TypeScript only treats a property as a discriminant
115
+ * when its type is a *unit* type in every constituent of the union, and a
116
+ * single widened arm disables narrowing for the whole union — completions
117
+ * then offer every variant's properties and excess-property checking
118
+ * degrades to "allowed if the property exists in any variant".
119
+ *
120
+ * When the discriminator genuinely isn't known until deployment, wrap the
121
+ * expression with this to state which variant you mean:
122
+ *
123
+ * ```ts
124
+ * widget.properties.primaryRule = {
125
+ * kind: asDiscriminator(kindParam),
126
+ * cacheKind: "long",
127
+ * days: 7,
128
+ * };
129
+ * ```
130
+ *
131
+ * Every other property is still fully checked — only the discriminator's
132
+ * type safety is waived. Note that the runtime cannot dispatch on a
133
+ * non-literal discriminator, so serialization falls back to structural
134
+ * variant inference; prefer a literal wherever possible.
135
+ *
136
+ * The literal is inferred from the expression's own type argument. If the
137
+ * expression is loosely typed (`Expression<string>`), name the variant
138
+ * explicitly: `asDiscriminator<"cache">(param)`.
139
+ */
140
+ export declare function asDiscriminator<L extends string>(value: ExpressionOrValue<L>): L;
141
+ /**
142
+ * Extracts the underlying `ExpressionNode` from an `Expression<T>` value.
143
+ *
144
+ * `Expression<T>` is the public, typed handle for a deploy-time expression
145
+ * (backed by a Proxy at runtime); `ExpressionNode` is the raw AST node that
146
+ * the proxy wraps. Use this to walk / inspect / serialize the underlying
147
+ * tree without reaching for the brand symbol directly.
148
+ */
149
+ export declare function unwrapExpression<T>(expr: Expression<T>): ExpressionNode<T>;
150
+ /**
151
+ * Tests whether a value is an `Expression<T>` — the typed, branded handle
152
+ * for a deploy-time expression (proxy-backed). Returns false for raw
153
+ * `ExpressionNode` data; use {@link isExpressionNode} from `./ast-nodes.js`
154
+ * for that.
155
+ */
156
+ export declare function isExpression(value: unknown): value is Expression<unknown>;
157
+ export declare function wrapExpression<T = unknown>(expression: ExpressionNode, nav?: NavShape): Expression<T>;
158
+ export declare function wrapExpressionOver<TObject extends object, TValue = unknown>(target: TObject, expression: ExpressionNode): TObject & Expression<TValue>;
159
+ export declare function createBinaryExpression<T>(op: BinaryOperator, left: unknown, right: unknown): Expression<T>;
160
+ export declare function createUnaryExpression<T>(op: UnaryOperator, argument: unknown): Expression<T>;
161
+ export declare function createTernaryExpression<T>(condition: unknown, trueValue: unknown, falseValue: unknown): Expression<T>;
162
+ export declare function createFunctionCallExpression<T>(name: string, args: unknown[]): Expression<T>;
163
+ export {};
164
+ //# sourceMappingURL=expressions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../src/expression/expressions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAEnB,MAAM,gBAAgB,CAAC;AAMxB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,MAAmC,CAAC;AAE1E,+EAA+E;AAC/E,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAC;AAM/C,MAAM,WAAW,eAAe,CAAC,GAAG,CAAC,CAAC;IACpC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACjD;AAKD,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAC7C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,GACtD,aAAa,GACb,eAAe,CA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AG,KAAK,IAAI,UAAU,CAAC,OAAO,CAAC,CAIzE;AAMD,wBAAgB,cAAc,CAAC,CAAC,GAAG,OAAO,EACxC,UAAU,EAAE,cAAc,EAC1B,GAAG,CAAC,EAAE,QAAQ,GACb,UAAU,CAAC,CAAC,CAAC,CAkEf;AAED,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,GAAG,OAAO,EACzE,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,cAAc,GACzB,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CA6D9B;AAMD,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,EAAE,EAAE,cAAc,EAClB,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,OAAO,GACb,UAAU,CAAC,CAAC,CAAC,CAEf;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,OAAO,GAChB,UAAU,CAAC,CAAC,CAAC,CAEf;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EACvC,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,OAAO,GAClB,UAAU,CAAC,CAAC,CAAC,CAIf;AAED,wBAAgB,4BAA4B,CAAC,CAAC,EAC5C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EAAE,GACd,UAAU,CAAC,CAAC,CAAC,CAEf"}
@@ -0,0 +1,211 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { navigateShape } from "../shape/shape.js";
4
+ import { arrayAccessExpressionNode, binaryExpressionNode, functionCallExpressionNode, propertyAccessExpressionNode, ternaryExpressionNode, unaryExpressionNode, } from "./ast-nodes.js";
5
+ // ---------------------------------------------------------------------------
6
+ // Brand symbol (runtime + type-only)
7
+ // ---------------------------------------------------------------------------
8
+ /**
9
+ * Runtime symbol key storing the underlying `ExpressionNode` on proxies.
10
+ * Internal to the package — consumers should use `isExpression()` and
11
+ * `unwrapExpression()` instead of accessing this directly.
12
+ */
13
+ export const EXPRESSION_BRAND = Symbol("expression-brand");
14
+ // ---------------------------------------------------------------------------
15
+ // Discriminator escape hatch
16
+ // ---------------------------------------------------------------------------
17
+ /**
18
+ * Asserts that a deploy-time expression resolves to a specific literal,
19
+ * so it can be used where a discriminator is expected.
20
+ *
21
+ * Discriminator properties on a `@discriminator` model are typed as bare
22
+ * literals (`kind: "cache"`) rather than `ExpressionOrValue<"cache">`.
23
+ * That is deliberate: TypeScript only treats a property as a discriminant
24
+ * when its type is a *unit* type in every constituent of the union, and a
25
+ * single widened arm disables narrowing for the whole union — completions
26
+ * then offer every variant's properties and excess-property checking
27
+ * degrades to "allowed if the property exists in any variant".
28
+ *
29
+ * When the discriminator genuinely isn't known until deployment, wrap the
30
+ * expression with this to state which variant you mean:
31
+ *
32
+ * ```ts
33
+ * widget.properties.primaryRule = {
34
+ * kind: asDiscriminator(kindParam),
35
+ * cacheKind: "long",
36
+ * days: 7,
37
+ * };
38
+ * ```
39
+ *
40
+ * Every other property is still fully checked — only the discriminator's
41
+ * type safety is waived. Note that the runtime cannot dispatch on a
42
+ * non-literal discriminator, so serialization falls back to structural
43
+ * variant inference; prefer a literal wherever possible.
44
+ *
45
+ * The literal is inferred from the expression's own type argument. If the
46
+ * expression is loosely typed (`Expression<string>`), name the variant
47
+ * explicitly: `asDiscriminator<"cache">(param)`.
48
+ */
49
+ export function asDiscriminator(value) {
50
+ return value;
51
+ }
52
+ // ---------------------------------------------------------------------------
53
+ // Unwrap + type guards
54
+ // ---------------------------------------------------------------------------
55
+ // Two distinct concepts, two distinct guards:
56
+ //
57
+ // - `isExpression(x)` — "is `x` a typed `Expression<T>` handle
58
+ // (the value-level, proxy-backed form)?"
59
+ // - `isExpressionNode(x)` — "is `x` a raw `ExpressionNode` data object
60
+ // (one of the AST kinds)?"
61
+ //
62
+ // These are *disjoint* — a value is either a wrapped Expression handle or a
63
+ // raw AST node, never both. To check the AST kind of either form, narrow
64
+ // via the discriminated `kind` field:
65
+ //
66
+ // if (isExpression(value)) {
67
+ // const node = unwrapExpression(value);
68
+ // if (node.kind === "fn-call") { /* node: FunctionCallExpressionNode */ }
69
+ // }
70
+ // if (isExpressionNode(value)) {
71
+ // if (value.kind === "binary") { /* value: BinaryExpressionNode */ }
72
+ // }
73
+ /**
74
+ * Extracts the underlying `ExpressionNode` from an `Expression<T>` value.
75
+ *
76
+ * `Expression<T>` is the public, typed handle for a deploy-time expression
77
+ * (backed by a Proxy at runtime); `ExpressionNode` is the raw AST node that
78
+ * the proxy wraps. Use this to walk / inspect / serialize the underlying
79
+ * tree without reaching for the brand symbol directly.
80
+ */
81
+ export function unwrapExpression(expr) {
82
+ return expr[EXPRESSION_BRAND];
83
+ }
84
+ /**
85
+ * Tests whether a value is an `Expression<T>` — the typed, branded handle
86
+ * for a deploy-time expression (proxy-backed). Returns false for raw
87
+ * `ExpressionNode` data; use {@link isExpressionNode} from `./ast-nodes.js`
88
+ * for that.
89
+ */
90
+ export function isExpression(value) {
91
+ return (typeof value === "object" && value !== null && EXPRESSION_BRAND in value);
92
+ }
93
+ // ---------------------------------------------------------------------------
94
+ // Expression proxy factory
95
+ // ---------------------------------------------------------------------------
96
+ export function wrapExpression(expression, nav) {
97
+ return new Proxy(Object.create(null), {
98
+ get(_target, prop, _receiver) {
99
+ if (prop === EXPRESSION_BRAND) {
100
+ return expression;
101
+ }
102
+ if (prop === Symbol.toPrimitive || prop === "toString") {
103
+ return () => "[Expression]";
104
+ }
105
+ if (prop === "valueOf") {
106
+ return () => expression;
107
+ }
108
+ // Avoid being treated as a thenable / Promise
109
+ if (prop === "then") {
110
+ return undefined;
111
+ }
112
+ if (typeof prop === "symbol") {
113
+ return undefined;
114
+ }
115
+ // Numeric string → array access.
116
+ if (/^\d+$/u.test(prop)) {
117
+ const index = Number(prop);
118
+ const step = navigateShape(nav, index);
119
+ return wrapExpression(arrayAccessExpressionNode(expression, index), step.next);
120
+ }
121
+ // String property → property access. Consult the current nav
122
+ // shape; stamp the access with the wire armPath if an entry
123
+ // exists, otherwise pass through unchanged. Container navs
124
+ // (record/array) yield no stamp but still peel a layer.
125
+ const step = navigateShape(nav, prop);
126
+ return wrapExpression(propertyAccessExpressionNode(expression, prop, {
127
+ armPath: step.stamp?.armPath,
128
+ }), step.next);
129
+ },
130
+ has(_target, prop) {
131
+ return prop === EXPRESSION_BRAND;
132
+ },
133
+ ownKeys() {
134
+ return [];
135
+ },
136
+ getOwnPropertyDescriptor(_target, prop) {
137
+ if (prop === EXPRESSION_BRAND) {
138
+ return {
139
+ configurable: true,
140
+ enumerable: false,
141
+ value: expression,
142
+ };
143
+ }
144
+ return undefined;
145
+ },
146
+ });
147
+ }
148
+ export function wrapExpressionOver(target, expression) {
149
+ return new Proxy(target, {
150
+ get(backing, prop, receiver) {
151
+ if (prop === EXPRESSION_BRAND) {
152
+ return expression;
153
+ }
154
+ if (prop === Symbol.toPrimitive || prop === "toString") {
155
+ return () => "[Expression]";
156
+ }
157
+ if (prop === "valueOf") {
158
+ return () => expression;
159
+ }
160
+ if (prop === "then") {
161
+ return undefined;
162
+ }
163
+ if (Reflect.has(backing, prop)) {
164
+ return Reflect.get(backing, prop, receiver);
165
+ }
166
+ if (typeof prop === "symbol") {
167
+ return undefined;
168
+ }
169
+ if (/^\d+$/u.test(prop)) {
170
+ return wrapExpression(arrayAccessExpressionNode(expression, Number(prop)));
171
+ }
172
+ return wrapExpression(propertyAccessExpressionNode(expression, prop));
173
+ },
174
+ has(backing, prop) {
175
+ return prop === EXPRESSION_BRAND || Reflect.has(backing, prop);
176
+ },
177
+ ownKeys(backing) {
178
+ const keys = Reflect.ownKeys(backing);
179
+ if (!keys.includes(EXPRESSION_BRAND)) {
180
+ keys.push(EXPRESSION_BRAND);
181
+ }
182
+ return keys;
183
+ },
184
+ getOwnPropertyDescriptor(backing, prop) {
185
+ if (prop === EXPRESSION_BRAND) {
186
+ return {
187
+ configurable: true,
188
+ enumerable: false,
189
+ value: expression,
190
+ };
191
+ }
192
+ return Reflect.getOwnPropertyDescriptor(backing, prop);
193
+ },
194
+ });
195
+ }
196
+ // ---------------------------------------------------------------------------
197
+ // Proxied-expression factories (return Expression<T>)
198
+ // ---------------------------------------------------------------------------
199
+ export function createBinaryExpression(op, left, right) {
200
+ return wrapExpression(binaryExpressionNode(op, left, right));
201
+ }
202
+ export function createUnaryExpression(op, argument) {
203
+ return wrapExpression(unaryExpressionNode(op, argument));
204
+ }
205
+ export function createTernaryExpression(condition, trueValue, falseValue) {
206
+ return wrapExpression(ternaryExpressionNode(condition, trueValue, falseValue));
207
+ }
208
+ export function createFunctionCallExpression(name, args) {
209
+ return wrapExpression(functionCallExpressionNode(name, args));
210
+ }
211
+ //# sourceMappingURL=expressions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../src/expression/expressions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAiB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EAIrB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,qCAAqC;AACrC,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB,MAAM,CAAC,kBAAkB,CAAC,CAAC;AA2I1E,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,eAAe,CAC7B,KAA2B;IAE3B,OAAO,KAAU,CAAC;AACpB,CAAC;AAED,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,8CAA8C;AAC9C,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,yEAAyE;AACzE,uDAAuD;AACvD,EAAE;AACF,4EAA4E;A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