@pulumi/pulumi 3.124.1-alpha.xf6bdf03 → 3.125.0-alpha.x584ff1c
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/asset/archive.d.ts +15 -10
- package/asset/archive.js +15 -9
- package/asset/archive.js.map +1 -1
- package/asset/asset.d.ts +14 -11
- package/asset/asset.js +15 -18
- package/asset/asset.js.map +1 -1
- package/automation/stack.d.ts +10 -2
- package/automation/stack.js +10 -2
- package/automation/stack.js.map +1 -1
- package/dynamic/index.d.ts +67 -35
- package/dynamic/index.js +15 -8
- package/dynamic/index.js.map +1 -1
- package/errors.d.ts +16 -12
- package/errors.js +18 -12
- package/errors.js.map +1 -1
- package/invoke.d.ts +6 -2
- package/iterable/index.d.ts +7 -5
- package/iterable/index.js +7 -5
- package/iterable/index.js.map +1 -1
- package/log/index.d.ts +8 -5
- package/log/index.js +8 -5
- package/log/index.js.map +1 -1
- package/metadata.d.ts +3 -3
- package/metadata.js +3 -3
- package/output.d.ts +119 -91
- package/output.js +73 -46
- package/output.js.map +1 -1
- package/package.json +1 -1
- package/provider/internals.js +3 -1
- package/provider/internals.js.map +1 -1
- package/provider/provider.d.ts +75 -39
- package/provider/server.js +13 -7
- package/provider/server.js.map +1 -1
- package/queryable/index.d.ts +5 -3
- package/resource.d.ts +233 -164
- package/resource.js +160 -97
- package/resource.js.map +1 -1
- package/runtime/asyncIterableUtil.js +26 -17
- package/runtime/asyncIterableUtil.js.map +1 -1
- package/runtime/callbacks.js +5 -2
- package/runtime/callbacks.js.map +1 -1
- package/runtime/closure/codePaths.d.ts +32 -27
- package/runtime/closure/codePaths.js +23 -15
- package/runtime/closure/codePaths.js.map +1 -1
- package/runtime/closure/createClosure.js +38 -30
- package/runtime/closure/createClosure.js.map +1 -1
- package/runtime/closure/parseFunction.js +26 -15
- package/runtime/closure/parseFunction.js.map +1 -1
- package/runtime/closure/rewriteSuper.js +3 -1
- package/runtime/closure/rewriteSuper.js.map +1 -1
- package/runtime/closure/serializeClosure.d.ts +52 -32
- package/runtime/closure/serializeClosure.js +34 -22
- package/runtime/closure/serializeClosure.js.map +1 -1
- package/runtime/closure/utils.js +6 -2
- package/runtime/closure/utils.js.map +1 -1
- package/runtime/closure/v8.js +18 -9
- package/runtime/closure/v8.js.map +1 -1
- package/runtime/closure/v8Hooks.js +8 -4
- package/runtime/closure/v8Hooks.js.map +1 -1
- package/runtime/config.d.ts +4 -4
- package/runtime/config.js +22 -18
- package/runtime/config.js.map +1 -1
- package/runtime/debuggable.js +17 -6
- package/runtime/debuggable.js.map +1 -1
- package/runtime/invoke.d.ts +23 -14
- package/runtime/invoke.js +26 -18
- package/runtime/invoke.js.map +1 -1
- package/runtime/mocks.d.ts +37 -23
- package/runtime/mocks.js +11 -6
- package/runtime/mocks.js.map +1 -1
- package/runtime/resource.d.ts +21 -15
- package/runtime/resource.js +48 -29
- package/runtime/resource.js.map +1 -1
- package/runtime/rpc.d.ts +71 -43
- package/runtime/rpc.js +85 -47
- package/runtime/rpc.js.map +1 -1
- package/runtime/settings.d.ts +70 -21
- package/runtime/settings.js +83 -42
- package/runtime/settings.js.map +1 -1
- package/runtime/stack.d.ts +22 -14
- package/runtime/stack.js +22 -14
- package/runtime/stack.js.map +1 -1
- package/runtime/state.js +21 -8
- package/runtime/state.js.map +1 -1
- package/stackReference.d.ts +49 -32
- package/stackReference.js +40 -25
- package/stackReference.js.map +1 -1
- package/tests/automation/localWorkspace.spec.js +20 -0
- package/tests/automation/localWorkspace.spec.js.map +1 -1
- package/tsutils.js +6 -2
- package/tsutils.js.map +1 -1
- package/utils.js +15 -6
- package/utils.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/output.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Resource } from "./resource";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
3
|
+
* @Internal
|
|
4
|
+
*/
|
|
5
|
+
export declare function getAllResources<T>(op: OutputInstance<T>): Promise<Set<Resource>>;
|
|
6
|
+
/**
|
|
7
|
+
* {@link output} takes any {@link Input} value and converts it into an
|
|
8
|
+
* {@link Output}, deeply unwrapping nested {@link Input} values as necessary.
|
|
5
9
|
*
|
|
6
10
|
* The expected way to use this function is like so:
|
|
7
11
|
*
|
|
@@ -19,21 +23,25 @@ import { Resource } from "./resource";
|
|
|
19
23
|
export declare function output<T>(val: Input<T>): Output<Unwrap<T>>;
|
|
20
24
|
export declare function output<T>(val: Input<T> | undefined): Output<Unwrap<T | undefined>>;
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* {@link secret} behaves the same as {@link output} except the returned output
|
|
27
|
+
* is marked as containing sensitive data.
|
|
23
28
|
*/
|
|
24
29
|
export declare function secret<T>(val: Input<T>): Output<Unwrap<T>>;
|
|
25
30
|
export declare function secret<T>(val: Input<T> | undefined): Output<Unwrap<T | undefined>>;
|
|
26
31
|
/**
|
|
27
|
-
*
|
|
32
|
+
* {@link unsecret} behaves the same as {@link output} except the returned
|
|
33
|
+
* output takes the existing output and unwraps the secret.
|
|
28
34
|
*/
|
|
29
35
|
export declare function unsecret<T>(val: Output<T>): Output<T>;
|
|
30
36
|
/**
|
|
31
|
-
*
|
|
37
|
+
* {@link isSecret} returns `true` if and only if the provided {@link Output} is
|
|
38
|
+
* a secret.
|
|
32
39
|
*/
|
|
33
40
|
export declare function isSecret<T>(val: Output<T>): Promise<boolean>;
|
|
34
41
|
/**
|
|
35
|
-
* Allows for multiple Output objects to be combined into a single
|
|
36
|
-
* will depend on the union of
|
|
42
|
+
* Allows for multiple {@link Output} objects to be combined into a single
|
|
43
|
+
* {@link Output} object. The single {@link Output} will depend on the union of
|
|
44
|
+
* {@link Resources} that the individual dependencies depend on.
|
|
37
45
|
*
|
|
38
46
|
* This can be used in the following manner:
|
|
39
47
|
*
|
|
@@ -44,8 +52,8 @@ export declare function isSecret<T>(val: Output<T>): Promise<boolean>;
|
|
|
44
52
|
* var d3: Output<ResultType> = Output.all([d1, d2]).apply(([s, n]) => ...);
|
|
45
53
|
* ```
|
|
46
54
|
*
|
|
47
|
-
* In this example, taking a dependency on d3 means a resource will depend on
|
|
48
|
-
* d1 and d2
|
|
55
|
+
* In this example, taking a dependency on `d3` means a resource will depend on
|
|
56
|
+
* all the resources of `d1` and `d2`.
|
|
49
57
|
*/
|
|
50
58
|
export declare function all<T>(val: Record<string, Input<T>>): Output<Record<string, Unwrap<T>>>;
|
|
51
59
|
export declare function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [Input<T1>, Input<T2>, Input<T3>, Input<T4>, Input<T5>, Input<T6>, Input<T7>, Input<T8>]): Output<[Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>, Unwrap<T6>, Unwrap<T7>, Unwrap<T8>]>;
|
|
@@ -57,26 +65,29 @@ export declare function all<T1, T2, T3>(values: [Input<T1>, Input<T2>, Input<T3>
|
|
|
57
65
|
export declare function all<T1, T2>(values: [Input<T1>, Input<T2>]): Output<[Unwrap<T1>, Unwrap<T2>]>;
|
|
58
66
|
export declare function all<T>(ds: Input<T>[]): Output<Unwrap<T>[]>;
|
|
59
67
|
/**
|
|
60
|
-
*
|
|
68
|
+
* Returns true if the given value is unknown.
|
|
61
69
|
*/
|
|
62
70
|
export declare function isUnknown(val: any): boolean;
|
|
63
71
|
/**
|
|
64
|
-
*
|
|
72
|
+
* Returns true if the given value is or contains unknown values.
|
|
65
73
|
*/
|
|
66
74
|
export declare function containsUnknowns(value: any): boolean;
|
|
67
75
|
/**
|
|
68
|
-
*
|
|
69
|
-
* or the
|
|
76
|
+
* {@link Input} is a property input for a resource. It may be a promptly
|
|
77
|
+
* available `T`, a promise for one, or the {@link Output} from a existing
|
|
78
|
+
* {@link Resource}.
|
|
70
79
|
*/
|
|
71
80
|
export declare type Input<T> = T | Promise<T> | OutputInstance<T>;
|
|
72
81
|
/**
|
|
73
|
-
*
|
|
82
|
+
* {@link Inputs} is a map of property name to property input, one for each
|
|
83
|
+
* resource property value.
|
|
74
84
|
*/
|
|
75
85
|
export declare type Inputs = Record<string, Input<any>>;
|
|
76
86
|
/**
|
|
77
|
-
* The
|
|
78
|
-
*
|
|
79
|
-
*
|
|
87
|
+
* The {@link Unwrap} type allows us to express the operation of taking a type,
|
|
88
|
+
* with potentially deeply nested {@link Promise}s and {@link Output}s and to
|
|
89
|
+
* then get that same type with all the promises and outputs replaced with their
|
|
90
|
+
* wrapped type. Note that this unwrapping is "deep". So if you had:
|
|
80
91
|
*
|
|
81
92
|
* `type X = { A: Promise<{ B: Output<{ c: Input<boolean> }> }> }`
|
|
82
93
|
*
|
|
@@ -84,18 +95,20 @@ export declare type Inputs = Record<string, Input<any>>;
|
|
|
84
95
|
*
|
|
85
96
|
* `... = { A: { B: { C: boolean } } }`
|
|
86
97
|
*
|
|
87
|
-
* Unwrapping sees through
|
|
98
|
+
* Unwrapping sees through promises, outputs, arrays and objects.
|
|
88
99
|
*
|
|
89
|
-
* Note: due to TypeScript limitations there are some things that cannot be
|
|
90
|
-
* if you had a `Promise<Output<T>>` then the
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
100
|
+
* Note: due to TypeScript limitations there are some things that cannot be
|
|
101
|
+
* expressed. Specifically, if you had a `Promise<Output<T>>` then the {@link
|
|
102
|
+
* Unwrap} type would not be able to undo both of those wraps. In practice that
|
|
103
|
+
* should be OK. Values in an object graph should not wrap outputs in promises.
|
|
104
|
+
* Instead, any code that needs to work Outputs and also be async should either
|
|
105
|
+
* create the output with the promise (which will collapse into just an output).
|
|
106
|
+
* Or, it should start with an output and call `apply` on it, passing in an
|
|
107
|
+
* `async` function. This will also collapse and just produce an output.
|
|
96
108
|
*
|
|
97
|
-
* In other words, this should not be used as the shape of an object: `{ a:
|
|
98
|
-
* It should always either be `{ a: Promise<NonOutput>
|
|
109
|
+
* In other words, this should not be used as the shape of an object: `{ a:
|
|
110
|
+
* Promise<Output<...>> }`. It should always either be `{ a: Promise<NonOutput>
|
|
111
|
+
* }` or just `{ a: Output<...> }`.
|
|
99
112
|
*/
|
|
100
113
|
export declare type Unwrap<T> = T extends Promise<infer U1> ? UnwrapSimple<U1> : T extends OutputInstance<infer U2> ? UnwrapSimple<U2> : UnwrapSimple<T>;
|
|
101
114
|
declare type primitive = Function | string | number | boolean | undefined | null;
|
|
@@ -108,35 +121,40 @@ export declare type UnwrappedObject<T> = {
|
|
|
108
121
|
[P in keyof T]: Unwrap<T[P]>;
|
|
109
122
|
};
|
|
110
123
|
/**
|
|
111
|
-
* Instance side of the
|
|
112
|
-
* for working with the underlying value of an
|
|
124
|
+
* Instance side of the {@link Output} type. Exposes the deployment-time and
|
|
125
|
+
* run-time mechanisms for working with the underlying value of an {@link Output}.
|
|
113
126
|
*/
|
|
114
127
|
export interface OutputInstance<T> {
|
|
115
128
|
/**
|
|
116
|
-
* Transforms the data of the output with the provided func
|
|
117
|
-
* Output so that dependent resources can be properly
|
|
129
|
+
* Transforms the data of the output with the provided `func`. The result
|
|
130
|
+
* remains an {@link Output} so that dependent resources can be properly
|
|
131
|
+
* tracked.
|
|
118
132
|
*
|
|
119
|
-
*
|
|
133
|
+
* `func` is not allowed to make resources.
|
|
120
134
|
*
|
|
121
|
-
*
|
|
122
|
-
* and you want to get a transitive dependency of it
|
|
135
|
+
* `func` can return other {@link Output}s. This can be handy if you have an
|
|
136
|
+
* `Output<SomeVal>` and you want to get a transitive dependency of it,
|
|
137
|
+
* i.e.
|
|
123
138
|
*
|
|
124
139
|
* ```ts
|
|
125
140
|
* var d1: Output<SomeVal>;
|
|
126
141
|
* var d2 = d1.apply(v => v.x.y.OtherOutput); // getting an output off of 'v'.
|
|
127
142
|
* ```
|
|
128
143
|
*
|
|
129
|
-
* In this example, taking a dependency on d2 means a resource will depend
|
|
130
|
-
* of d1
|
|
144
|
+
* In this example, taking a dependency on `d2` means a resource will depend
|
|
145
|
+
* on all the resources of `d1`. It will *also* depend on the resources of
|
|
146
|
+
* `v.x.y.OtherDep`.
|
|
131
147
|
*
|
|
132
|
-
* Importantly, the
|
|
133
|
-
* If you need have multiple
|
|
134
|
-
* set of resources, then
|
|
148
|
+
* Importantly, the resources that `d2` feels like it will depend on are the
|
|
149
|
+
* same resources as `d1`. If you need have multiple outputs and a single
|
|
150
|
+
* output is needed that combines both set of resources, then `pulumi.all`
|
|
151
|
+
* should be used instead.
|
|
135
152
|
*
|
|
136
|
-
* This function will be called execution of a
|
|
137
|
-
* will
|
|
138
|
-
* available for functions that end up
|
|
139
|
-
*
|
|
153
|
+
* This function will be called during the execution of a `pulumi up` or
|
|
154
|
+
* `pulumi preview` operation, but it will not run when the values of the
|
|
155
|
+
* output are unknown. It is not available for functions that end up
|
|
156
|
+
* executing in the cloud during runtime. To get the value of the Output
|
|
157
|
+
* during cloud runtime execution, use `get()`.
|
|
140
158
|
*/
|
|
141
159
|
apply<U>(func: (t: T) => Promise<U>): Output<U>;
|
|
142
160
|
apply<U>(func: (t: T) => OutputInstance<U>): Output<U>;
|
|
@@ -144,17 +162,18 @@ export interface OutputInstance<T> {
|
|
|
144
162
|
/**
|
|
145
163
|
* Retrieves the underlying value of this dependency.
|
|
146
164
|
*
|
|
147
|
-
* This function is only callable in code that runs in the cloud
|
|
148
|
-
* point all Output values will be known
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
165
|
+
* This function is only callable in code that runs in the cloud
|
|
166
|
+
* post-deployment. At this point all {@link Output} values will be known
|
|
167
|
+
* and can be safely retrieved. During Pulumi deployment or preview
|
|
168
|
+
* execution this must not be called (and will throw). This is because doing
|
|
169
|
+
* so would allow output values to flow into resources while losing the data
|
|
170
|
+
* that would allow the dependency graph to be changed.
|
|
152
171
|
*/
|
|
153
172
|
get(): T;
|
|
154
173
|
}
|
|
155
174
|
/**
|
|
156
|
-
* Static side of the
|
|
157
|
-
* arbitrary values to see if they are
|
|
175
|
+
* Static side of the {@link Output} type. Can be used to create outputs as well
|
|
176
|
+
* as test arbitrary values to see if they are {@link Output}s.
|
|
158
177
|
*/
|
|
159
178
|
export interface OutputConstructor {
|
|
160
179
|
create<T>(val: Input<T>): Output<Unwrap<T>>;
|
|
@@ -162,30 +181,34 @@ export interface OutputConstructor {
|
|
|
162
181
|
isInstance<T>(obj: any): obj is Output<T>;
|
|
163
182
|
}
|
|
164
183
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* a
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
184
|
+
* {@link Output} helps encode the relationship between {@link Resource}s in a
|
|
185
|
+
* Pulumi application. Specifically, an {@link Output} holds onto a piece of
|
|
186
|
+
* data and the resource it was generated from. An output value can then be
|
|
187
|
+
* provided when constructing new resources, allowing that new resource to know
|
|
188
|
+
* both the value as well as the resource the value came from. This allows for
|
|
189
|
+
* a precise resource dependency graph to be created, which properly tracks the
|
|
190
|
+
* relationship between resources.
|
|
191
|
+
*
|
|
192
|
+
* An output is used in a Pulumi program differently depending on if the
|
|
193
|
+
* application is executing at "deployment time" (i.e. when actually running the
|
|
194
|
+
* `pulumi` executable), or at "run time" (i.e. a piece of code running in some
|
|
195
|
+
* cloud).
|
|
196
|
+
*
|
|
197
|
+
* At "deployment time", the correct way to work with the underlying value is to
|
|
198
|
+
* call {@link Output.apply}. This allows the value to be accessed and
|
|
199
|
+
* manipulated, while still resulting in an output that is keeping track of
|
|
200
|
+
* {@link Resource}s appropriately. At deployment time the underlying value may
|
|
201
|
+
* or may not exist (for example, if a preview is being performed). In this
|
|
202
|
+
* case, the `func` callback will not be executed, and calling `.apply` will
|
|
203
|
+
* immediately return an output that points to the `undefined` value. During a
|
|
204
|
+
* normal update though, the `func` callbacks should always be executed.
|
|
205
|
+
*
|
|
206
|
+
* At "run time", the correct way to work with the underlying value is to simply
|
|
207
|
+
* call {@link Output.get} which will be promptly return the entire value. This
|
|
208
|
+
* will be a simple JavaScript object that can be manipulated as necessary.
|
|
209
|
+
*
|
|
210
|
+
* To ease with using outputs at deployment time, Pulumi will "lift" simple data
|
|
211
|
+
* properties of an underlying value to the output itself. For example:
|
|
189
212
|
*
|
|
190
213
|
* ```ts
|
|
191
214
|
* const o: Output<{ name: string, age: number, orders: Order[] }> = ...;
|
|
@@ -206,9 +229,10 @@ export interface OutputConstructor {
|
|
|
206
229
|
export declare type Output<T> = OutputInstance<T> & Lifted<T>;
|
|
207
230
|
export declare const Output: OutputConstructor;
|
|
208
231
|
/**
|
|
209
|
-
* The
|
|
210
|
-
* nested objects and arrays and to then get a type with
|
|
211
|
-
* types are now
|
|
232
|
+
* The {@link Lifted} type allows us to express the operation of taking a type,
|
|
233
|
+
* with potentially deeply nested objects and arrays and to then get a type with
|
|
234
|
+
* the same properties, except whose property types are now {@link Output}s of the
|
|
235
|
+
* original property type.
|
|
212
236
|
*
|
|
213
237
|
* For example:
|
|
214
238
|
*
|
|
@@ -219,12 +243,13 @@ export declare const Output: OutputConstructor;
|
|
|
219
243
|
*
|
|
220
244
|
* `... = { A: Output<string>, B: Output<{ C: Output<boolean> }> }`
|
|
221
245
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
246
|
+
* {@link Lifted} is somewhat the opposite of {@link Unwrap}. Its primary
|
|
247
|
+
* purpose is to allow an instance of `Output<SomeType>` to provide simple
|
|
248
|
+
* access to the properties of `SomeType` directly on the instance itself
|
|
249
|
+
* (instead of haveing to use {@link Output.apply}).
|
|
225
250
|
*
|
|
226
|
-
* This lifting only happens through simple
|
|
227
|
-
* lifted.
|
|
251
|
+
* This lifting only happens through simple objects and arrays. Functions, for
|
|
252
|
+
* example, are not lifted. So you cannot do:
|
|
228
253
|
*
|
|
229
254
|
* ```ts
|
|
230
255
|
* const o: Output<string> = ...;
|
|
@@ -254,9 +279,10 @@ export declare type LiftedArray<T> = {
|
|
|
254
279
|
readonly [n: number]: Output<T>;
|
|
255
280
|
};
|
|
256
281
|
/**
|
|
257
|
-
*
|
|
258
|
-
* final string. Individual inputs can be any
|
|
259
|
-
*
|
|
282
|
+
* {@link concat} takes a sequence of {@link Input}s, stringifies each one, and
|
|
283
|
+
* concatenates all values into one final string. Individual inputs can be any
|
|
284
|
+
* sort of input value: they can be promises, outputs, or just plain JavaScript
|
|
285
|
+
* values. Use this function like so:
|
|
260
286
|
*
|
|
261
287
|
* ```ts
|
|
262
288
|
* // 'server' and 'loadBalancer' are both resources that expose [Output] properties.
|
|
@@ -266,24 +292,26 @@ export declare type LiftedArray<T> = {
|
|
|
266
292
|
*/
|
|
267
293
|
export declare function concat(...params: Input<any>[]): Output<string>;
|
|
268
294
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
295
|
+
* {@link interpolate} is similar to {@link concat} but is designed to be used
|
|
296
|
+
* as a tagged template expression, e.g.:
|
|
271
297
|
*
|
|
272
298
|
* ```ts
|
|
273
299
|
* // 'server' and 'loadBalancer' are both resources that expose [Output] properties.
|
|
274
300
|
* let val: Output<string> = pulumi.interpolate `http://${server.hostname}:${loadBalancer.port}`
|
|
275
301
|
* ```
|
|
276
302
|
*
|
|
277
|
-
* As with
|
|
278
|
-
*
|
|
303
|
+
* As with {@link concat}, the placeholders between `${}` can be any
|
|
304
|
+
* {@link Input}s: promises, outputs, or just plain JavaScript values.
|
|
279
305
|
*/
|
|
280
306
|
export declare function interpolate(literals: TemplateStringsArray, ...placeholders: Input<any>[]): Output<string>;
|
|
281
307
|
/**
|
|
282
|
-
*
|
|
308
|
+
* {@link jsonStringify} uses {@link JSON.stringify} to serialize the given
|
|
309
|
+
* {@link Input} value into a JSON string.
|
|
283
310
|
*/
|
|
284
311
|
export declare function jsonStringify(obj: Input<any>, replacer?: (this: any, key: string, value: any) => any | (number | string)[], space?: string | number): Output<string>;
|
|
285
312
|
/**
|
|
286
|
-
*
|
|
313
|
+
* {@link jsonParse} Uses {@link JSON.parse} to deserialize the given {@link
|
|
314
|
+
* Input} JSON string into a value.
|
|
287
315
|
*/
|
|
288
316
|
export declare function jsonParse(text: Input<string>, reviver?: (this: any, key: string, value: any) => any): Output<any>;
|
|
289
317
|
export {};
|
package/output.js
CHANGED
|
@@ -33,19 +33,24 @@ const resource_1 = require("./resource");
|
|
|
33
33
|
const utils = __importStar(require("./utils"));
|
|
34
34
|
/* eslint-disable no-shadow, @typescript-eslint/no-shadow */
|
|
35
35
|
/**
|
|
36
|
-
* Output helps encode the relationship between
|
|
37
|
-
* Output holds onto a piece of
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* {@link Output} helps encode the relationship between {@link Resource}s in a
|
|
37
|
+
* Pulumi application. Specifically, an {@link Output} holds onto a piece of
|
|
38
|
+
* data and the resource it was generated from. An output value can then be
|
|
39
|
+
* provided when constructing new resources, allowing that new resource to know
|
|
40
|
+
* both the value as well as the resource the value came from. This allows for
|
|
41
|
+
* a precise resource dependency graph to be created, which properly tracks the
|
|
42
|
+
* relationship between resources.
|
|
41
43
|
*/
|
|
42
44
|
class OutputImpl {
|
|
43
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
*/
|
|
44
48
|
constructor(resources, promise, isKnown, isSecret, allResources) {
|
|
45
49
|
/**
|
|
46
50
|
* A private field to help with RTTI that works in SxS scenarios.
|
|
47
51
|
*
|
|
48
52
|
* This is internal instead of being truly private, to support mixins and our serialization model.
|
|
53
|
+
*
|
|
49
54
|
* @internal
|
|
50
55
|
*/
|
|
51
56
|
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
|
@@ -165,13 +170,16 @@ See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.`;
|
|
|
165
170
|
return output(val);
|
|
166
171
|
}
|
|
167
172
|
/**
|
|
168
|
-
* Returns true if the given object is an
|
|
169
|
-
* multiple copies of the Pulumi SDK have been loaded into
|
|
173
|
+
* Returns true if the given object is an {@link Output}. This is designed
|
|
174
|
+
* to work even when multiple copies of the Pulumi SDK have been loaded into
|
|
175
|
+
* the same process.
|
|
170
176
|
*/
|
|
171
177
|
static isInstance(obj) {
|
|
172
178
|
return utils.isInstance(obj, "__pulumiOutput");
|
|
173
179
|
}
|
|
174
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
175
183
|
static getPromisedValue(promise, withUnknowns) {
|
|
176
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
177
185
|
// If the caller did not explicitly ask to see unknown values and val contains unknowns, return undefined. This
|
|
@@ -203,7 +211,9 @@ To manipulate the value of this Output, use '.apply' instead.`);
|
|
|
203
211
|
return result;
|
|
204
212
|
}
|
|
205
213
|
}
|
|
206
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* @Internal
|
|
216
|
+
*/
|
|
207
217
|
function getAllResources(op) {
|
|
208
218
|
return op.allResources instanceof Function ? op.allResources() : Promise.resolve(op.resources());
|
|
209
219
|
}
|
|
@@ -270,11 +280,13 @@ function applyHelperAsync(allResources, value, isKnown, isSecret, func, runWithU
|
|
|
270
280
|
});
|
|
271
281
|
}
|
|
272
282
|
/**
|
|
273
|
-
* Returns a promise denoting if the output is a secret or not. This is not the
|
|
274
|
-
* because in cases where the output does not
|
|
275
|
-
*
|
|
283
|
+
* Returns a promise denoting if the output is a secret or not. This is not the
|
|
284
|
+
* same as just calling `.isSecret` because in cases where the output does not
|
|
285
|
+
* have a `isSecret` property and it is a Proxy, we need to ignore the `isSecret`
|
|
286
|
+
* member that the proxy reports back.
|
|
276
287
|
*
|
|
277
|
-
* This calls the public implementation so that we only make any calculations in
|
|
288
|
+
* This calls the public implementation so that we only make any calculations in
|
|
289
|
+
* a single place.
|
|
278
290
|
*
|
|
279
291
|
* @internal
|
|
280
292
|
*/
|
|
@@ -283,20 +295,24 @@ function isSecretOutput(o) {
|
|
|
283
295
|
}
|
|
284
296
|
exports.isSecretOutput = isSecretOutput;
|
|
285
297
|
/**
|
|
286
|
-
* Helper function for
|
|
287
|
-
* while also lifting any inner Outputs (with all
|
|
288
|
-
*
|
|
289
|
-
*
|
|
298
|
+
* Helper function for {@link output}. This function trivially recurses through
|
|
299
|
+
* an object, copying it, while also lifting any inner {@link Outputs} (with all
|
|
300
|
+
* their respective state) to a top-level output at the end. If there are no
|
|
301
|
+
* inner outputs, this will not affect the data (except by producing a new copy
|
|
302
|
+
* of it).
|
|
290
303
|
*
|
|
291
304
|
* Importantly:
|
|
292
305
|
*
|
|
293
|
-
* 1. Resources encountered while recursing are not touched. This helps ensure
|
|
294
|
-
* (with an appropriate prototype chain).
|
|
306
|
+
* 1. Resources encountered while recursing are not touched. This helps ensure
|
|
307
|
+
* they stay Resources (with an appropriate prototype chain).
|
|
308
|
+
*
|
|
295
309
|
* 2. Primitive values (string, number, etc.) are returned as is.
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
* Output<Record<string,
|
|
299
|
-
*
|
|
310
|
+
*
|
|
311
|
+
* 3. Arrays and records are recursed into. An `Array<...>` that contains any
|
|
312
|
+
* `Outputs` wil become an `Output<Array<Unwrapped>>`. A `Record<string, ...>`
|
|
313
|
+
* that contains any output values will be an `Output<Record<string Unwrap<...>>`.
|
|
314
|
+
* In both cases of recursion, the outer output's known/secret/resources
|
|
315
|
+
* will be computed from the nested Outputs.
|
|
300
316
|
*/
|
|
301
317
|
function outputRec(val) {
|
|
302
318
|
if (val === null || typeof val !== "object") {
|
|
@@ -394,14 +410,16 @@ function secret(val) {
|
|
|
394
410
|
}
|
|
395
411
|
exports.secret = secret;
|
|
396
412
|
/**
|
|
397
|
-
*
|
|
413
|
+
* {@link unsecret} behaves the same as {@link output} except the returned
|
|
414
|
+
* output takes the existing output and unwraps the secret.
|
|
398
415
|
*/
|
|
399
416
|
function unsecret(val) {
|
|
400
417
|
return new exports.Output(val.resources(), val.promise(/*withUnknowns*/ true), val.isKnown, Promise.resolve(false), val.allResources());
|
|
401
418
|
}
|
|
402
419
|
exports.unsecret = unsecret;
|
|
403
420
|
/**
|
|
404
|
-
*
|
|
421
|
+
* {@link isSecret} returns `true` if and only if the provided {@link Output} is
|
|
422
|
+
* a secret.
|
|
405
423
|
*/
|
|
406
424
|
function isSecret(val) {
|
|
407
425
|
return exports.Output.isInstance(val.isSecret) ? Promise.resolve(false) : val.isSecret;
|
|
@@ -471,12 +489,15 @@ function getResourcesAndDetails(allValues) {
|
|
|
471
489
|
return [syncResources, isKnown, isSecret, allResources];
|
|
472
490
|
}
|
|
473
491
|
/**
|
|
474
|
-
* Unknown represents a value that is unknown. These values correspond to
|
|
475
|
-
* Pulumi engine as part of the result
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
492
|
+
* Unknown represents a value that is unknown. These values correspond to
|
|
493
|
+
* unknown property values received from the Pulumi engine as part of the result
|
|
494
|
+
* of a resource registration (see `runtime/rpc.ts`). User code is not typically
|
|
495
|
+
* exposed to these values: any {@link Output} that contains an {@link Unknown}
|
|
496
|
+
* will itself be unknown, so any user callbacks passed to `apply` will not be
|
|
497
|
+
* run. Internal callers of `apply` can request that they are run even with
|
|
498
|
+
* unknown values; the output proxy takes advantage of this to allow proxied
|
|
499
|
+
* property accesses to return known values even if other properties of the
|
|
500
|
+
* containing object are unknown.
|
|
480
501
|
*/
|
|
481
502
|
class Unknown {
|
|
482
503
|
constructor() {
|
|
@@ -484,33 +505,36 @@ class Unknown {
|
|
|
484
505
|
* A private field to help with RTTI that works in SxS scenarios.
|
|
485
506
|
*
|
|
486
507
|
* This is internal instead of being truly private, to support mixins and our serialization model.
|
|
508
|
+
*
|
|
487
509
|
* @internal
|
|
488
510
|
*/
|
|
489
511
|
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
|
490
512
|
this.__pulumiUnknown = true;
|
|
491
513
|
}
|
|
492
514
|
/**
|
|
493
|
-
* Returns true if the given object is an
|
|
494
|
-
* multiple copies of the Pulumi SDK have been loaded into
|
|
515
|
+
* Returns true if the given object is an {@link Unknown}. This is designed
|
|
516
|
+
* to work even when multiple copies of the Pulumi SDK have been loaded into
|
|
517
|
+
* the same process.
|
|
495
518
|
*/
|
|
496
519
|
static isInstance(obj) {
|
|
497
520
|
return utils.isInstance(obj, "__pulumiUnknown");
|
|
498
521
|
}
|
|
499
522
|
}
|
|
500
523
|
/**
|
|
501
|
-
* unknown is the singleton
|
|
524
|
+
* {@link unknown} is the singleton {@link Unknown} value.
|
|
525
|
+
*
|
|
502
526
|
* @internal
|
|
503
527
|
*/
|
|
504
528
|
exports.unknown = new Unknown();
|
|
505
529
|
/**
|
|
506
|
-
*
|
|
530
|
+
* Returns true if the given value is unknown.
|
|
507
531
|
*/
|
|
508
532
|
function isUnknown(val) {
|
|
509
533
|
return Unknown.isInstance(val);
|
|
510
534
|
}
|
|
511
535
|
exports.isUnknown = isUnknown;
|
|
512
536
|
/**
|
|
513
|
-
*
|
|
537
|
+
* Returns true if the given value is or contains unknown values.
|
|
514
538
|
*/
|
|
515
539
|
function containsUnknowns(value) {
|
|
516
540
|
return impl(value, new Set());
|
|
@@ -537,9 +561,10 @@ exports.containsUnknowns = containsUnknowns;
|
|
|
537
561
|
// eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-redeclare,no-underscore-dangle,id-blacklist,id-match
|
|
538
562
|
exports.Output = OutputImpl;
|
|
539
563
|
/**
|
|
540
|
-
*
|
|
541
|
-
* final string. Individual inputs can be any
|
|
542
|
-
*
|
|
564
|
+
* {@link concat} takes a sequence of {@link Input}s, stringifies each one, and
|
|
565
|
+
* concatenates all values into one final string. Individual inputs can be any
|
|
566
|
+
* sort of input value: they can be promises, outputs, or just plain JavaScript
|
|
567
|
+
* values. Use this function like so:
|
|
543
568
|
*
|
|
544
569
|
* ```ts
|
|
545
570
|
* // 'server' and 'loadBalancer' are both resources that expose [Output] properties.
|
|
@@ -552,16 +577,16 @@ function concat(...params) {
|
|
|
552
577
|
}
|
|
553
578
|
exports.concat = concat;
|
|
554
579
|
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
580
|
+
* {@link interpolate} is similar to {@link concat} but is designed to be used
|
|
581
|
+
* as a tagged template expression, e.g.:
|
|
557
582
|
*
|
|
558
583
|
* ```ts
|
|
559
584
|
* // 'server' and 'loadBalancer' are both resources that expose [Output] properties.
|
|
560
585
|
* let val: Output<string> = pulumi.interpolate `http://${server.hostname}:${loadBalancer.port}`
|
|
561
586
|
* ```
|
|
562
587
|
*
|
|
563
|
-
* As with
|
|
564
|
-
*
|
|
588
|
+
* As with {@link concat}, the placeholders between `${}` can be any
|
|
589
|
+
* {@link Input}s: promises, outputs, or just plain JavaScript values.
|
|
565
590
|
*/
|
|
566
591
|
function interpolate(literals, ...placeholders) {
|
|
567
592
|
return output(placeholders).apply((unwrapped) => {
|
|
@@ -578,7 +603,8 @@ function interpolate(literals, ...placeholders) {
|
|
|
578
603
|
}
|
|
579
604
|
exports.interpolate = interpolate;
|
|
580
605
|
/**
|
|
581
|
-
*
|
|
606
|
+
* {@link jsonStringify} uses {@link JSON.stringify} to serialize the given
|
|
607
|
+
* {@link Input} value into a JSON string.
|
|
582
608
|
*/
|
|
583
609
|
function jsonStringify(obj, replacer, space) {
|
|
584
610
|
return output(obj).apply((o) => {
|
|
@@ -587,7 +613,8 @@ function jsonStringify(obj, replacer, space) {
|
|
|
587
613
|
}
|
|
588
614
|
exports.jsonStringify = jsonStringify;
|
|
589
615
|
/**
|
|
590
|
-
*
|
|
616
|
+
* {@link jsonParse} Uses {@link JSON.parse} to deserialize the given {@link
|
|
617
|
+
* Input} JSON string into a value.
|
|
591
618
|
*/
|
|
592
619
|
function jsonParse(text, reviver) {
|
|
593
620
|
return output(text).apply((t) => {
|