import * as aws from "@pulumi/aws" ; import * as pulumi from "@pulumi/pulumi" ; import * as crypto from "crypto" ; type Diff < T extends string | number | symbol , U extends string | number | symbol > = ( { [ P in T ] : P ; } & { [ P in U ] : never ; } & { [ x ] : never ; } ) [ T ] ; export type Overwrite < T , U > = Pick < T , Diff < keyof T , keyof U > > & U ; internal export type Mutable < T > = { - readonly [ P in keyof T ] : T [ P ] ; } ; internal export type Capture < T > = { [ P in keyof T ] : T [ P ] extends Function ? { doNotCapture : boolean ; } : never ; } ; internal export function Capture < T > ( t ) { return < any > t ; } internal export function sha1hash ( s ) { const shasum = crypto . createHash ( "sha1" ) ; shasum . update ( s ) ; return shasum . digest ( "hex" ) . substring ( 0 , 8 ) ; } internal export function combineArrays < T > ( e1 , e2 ) { const result = pulumi . all ( [ e1 , e2 ] ) . apply ( ( [ e1 , e2 ] ) => { e1 = e1 || [ ] ; e2 = e2 || [ ] ; return [ ... e1 , ... e2 ] ; } ) ; return < pulumi . Output < T [ ] > > < unknown > result ; } type WithoutUndefined < T > = T extends undefined ? never : T ; internal export function ifUndefined < T > ( input , value ) { return < any > pulumi . all ( [ input , value ] ) . apply ( ( [ input , value ] ) => input !== undefined ? input : value ) ; } internal export type Compatible < T , U > = T extends U ? U extends T ? any : void : void ; internal export function checkCompat < T , U > ( ) { return undefined ! ; } internal export function mergeTags ( tags1 , tags2 ) { return pulumi . all ( [ tags1 , tags2 ] ) . apply ( ( [ tags1 , tags2 ] ) => ( { ... ( tags1 || { } ) , ... ( tags2 || { } ) , } ) ) ; } /**
 * Common code for doing RTTI typechecks.  RTTI is done by having a boolean property on an object
 * with a special name (like "__resource" or "__asset").  This function checks that the object
 * exists, has a **boolean** property with that name, and that that boolean property has the value
 * of 'true'.  Checking that property is 'boolean' helps ensure that this test works even on proxies
 * that synthesize properties dynamically (like Output).  Checking that the property has the 'true'
 * value isn't strictly necessary, but works to make sure that the impls are following a common
 * pattern.
 */ internal export function isInstance < T > ( obj , name ) { return hasTrueBooleanMember ( obj , name ) ; } internal export function hasTrueBooleanMember ( obj , memberName ) { if ( obj === undefined || obj === null ) { return false ; } const val = obj [ memberName ] ; if ( typeof val !== "boolean" ) { return false ; } return val === true ; } internal export function getRegionFromOpts ( opts ) { if ( opts . parent ) { return getRegion ( opts . parent ) ; } return getRegionFromProvider ( opts . provider ) ; } internal export function getRegion ( res ) { const provider = res . getProvider ? res . getProvider ( "aws::" ) : undefined ; return getRegionFromProvider ( provider ) ; } function getRegionFromProvider ( provider ) { const region = provider ? ( < any > provider ) . region : undefined ; return region || aws . config . region ; }