// Copyright 2016-2018, Pulumi Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. import { OutputInstance } from "../index"; import { Resource } from "../resource"; /** * ResolvedResource is a `Resource` with all fields containing `Output` values fully resolved. This * is useful primarily when we're querying over resource outputs (e.g., using * `pulumi.runtime.listResourceOutputs`), and we expect all values to be present and fully-resolved. */ export type ResolvedResource = Omit, "urn" | "getProvider">; export type Resolved = T extends Promise ? ResolvedSimple : T extends OutputInstance ? ResolvedSimple : ResolvedSimple; type primitive = string | number | boolean | undefined | null; type ResolvedSimple = T extends primitive ? T : T extends Array ? ResolvedArray : T extends Function ? never : T extends object ? ResolvedObject : never; interface ResolvedArray extends Array> {} type ResolvedObject = ModifyOptionalProperties<{ [P in keyof T]: Resolved }>; type RequiredKeys = { [P in keyof T]: undefined extends T[P] ? never : P }[keyof T]; type OptionalKeys = { [P in keyof T]: undefined extends T[P] ? P : never }[keyof T]; type ModifyOptionalProperties = { [P in RequiredKeys]: T[P] } & { [P in OptionalKeys]?: T[P] };