@webiny/pulumi-sdk 5.25.0 → 5.26.0-beta.0
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/ApplicationBuilder.d.ts +39 -0
- package/ApplicationBuilder.js +37 -0
- package/ApplicationBuilder.js.map +1 -0
- package/ApplicationBuilderGeneric.d.ts +10 -0
- package/ApplicationBuilderGeneric.js +104 -0
- package/ApplicationBuilderGeneric.js.map +1 -0
- package/ApplicationBuilderLegacy.d.ts +4 -0
- package/ApplicationBuilderLegacy.js +91 -0
- package/ApplicationBuilderLegacy.js.map +1 -0
- package/ApplicationConfig.d.ts +16 -0
- package/ApplicationConfig.js +5 -0
- package/ApplicationConfig.js.map +1 -0
- package/ApplicationHook.d.ts +4 -0
- package/ApplicationHook.js +11 -0
- package/ApplicationHook.js.map +1 -0
- package/Pulumi.d.ts +40 -0
- package/Pulumi.js +132 -0
- package/Pulumi.js.map +1 -0
- package/PulumiApp.d.ts +76 -0
- package/PulumiApp.js +174 -0
- package/PulumiApp.js.map +1 -0
- package/PulumiAppModule.d.ts +17 -0
- package/PulumiAppModule.js +30 -0
- package/PulumiAppModule.js.map +1 -0
- package/PulumiResource.d.ts +22 -0
- package/PulumiResource.js +48 -0
- package/PulumiResource.js.map +1 -0
- package/index.d.ts +12 -40
- package/index.js +131 -102
- package/index.js.map +1 -1
- package/package.json +7 -6
- package/utils/getPulumiWorkDir.d.ts +1 -0
- package/utils/getPulumiWorkDir.js +14 -0
- package/utils/getPulumiWorkDir.js.map +1 -0
- package/utils/mergeAppHooks.d.ts +2 -0
- package/utils/mergeAppHooks.js +20 -0
- package/utils/mergeAppHooks.js.map +1 -0
- package/utils/tagResources.d.ts +5 -0
- package/utils/tagResources.js +52 -0
- package/utils/tagResources.js.map +1 -0
package/PulumiApp.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.PulumiApp = void 0;
|
|
9
|
+
exports.defineApp = defineApp;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
|
|
14
|
+
|
|
15
|
+
var _tagResources = require("./utils/tagResources");
|
|
16
|
+
|
|
17
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
|
|
21
|
+
class PulumiApp {
|
|
22
|
+
constructor(params) {
|
|
23
|
+
(0, _defineProperty2.default)(this, "name", void 0);
|
|
24
|
+
(0, _defineProperty2.default)(this, "ctx", void 0);
|
|
25
|
+
(0, _defineProperty2.default)(this, "resourceHandlers", []);
|
|
26
|
+
(0, _defineProperty2.default)(this, "afterDeployHandlers", []);
|
|
27
|
+
(0, _defineProperty2.default)(this, "handlers", []);
|
|
28
|
+
(0, _defineProperty2.default)(this, "outputs", {});
|
|
29
|
+
(0, _defineProperty2.default)(this, "modules", new Map());
|
|
30
|
+
this.name = params.name;
|
|
31
|
+
this.ctx = params.ctx;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onResource(handler) {
|
|
35
|
+
this.resourceHandlers.push(handler);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onAfterDeploy(handler) {
|
|
39
|
+
this.afterDeployHandlers.push(handler);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
addResource(ctor, params) {
|
|
43
|
+
const config = params.config ?? {};
|
|
44
|
+
const opts = params.opts ?? {};
|
|
45
|
+
const promise = new Promise(resolve => {
|
|
46
|
+
this.handlers.push(() => {
|
|
47
|
+
this.resourceHandlers.forEach(handler => handler(resourceInstance));
|
|
48
|
+
const resourceInstance = new ctor(resource.name, config, opts);
|
|
49
|
+
resolve(resourceInstance);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
const resource = {
|
|
53
|
+
name: params.name,
|
|
54
|
+
config: createConfigProxy(config),
|
|
55
|
+
opts,
|
|
56
|
+
output: pulumi.output(promise)
|
|
57
|
+
};
|
|
58
|
+
return resource;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
addOutput(name, output) {
|
|
62
|
+
this.outputs[name] = output;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
addOutputs(outputs) {
|
|
66
|
+
Object.assign(this.outputs, outputs);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
addModule(def, config) {
|
|
70
|
+
if (this.modules.has(def.symbol)) {
|
|
71
|
+
throw new Error(`Module "${def.name}" is already present in the "${this.name}" application.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const module = def.run(this, config);
|
|
75
|
+
this.modules.set(def.symbol, module);
|
|
76
|
+
return module;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
addHandler(handler) {
|
|
80
|
+
const promise = new Promise(resolve => {
|
|
81
|
+
this.handlers.push(async () => {
|
|
82
|
+
resolve(await handler());
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
return pulumi.output(promise);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getModule(def, opts) {
|
|
89
|
+
const module = this.modules.get(def.symbol);
|
|
90
|
+
|
|
91
|
+
if (!module) {
|
|
92
|
+
if (opts !== null && opts !== void 0 && opts.optional) {
|
|
93
|
+
return null;
|
|
94
|
+
} else {
|
|
95
|
+
throw new Error(`Module "${def.name}" not found in "${this.name}" app`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return module;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
createController() {
|
|
103
|
+
return {
|
|
104
|
+
run: this.runProgram.bind(this),
|
|
105
|
+
deployFinished: this.deployFinished.bind(this)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async runProgram() {
|
|
110
|
+
(0, _tagResources.tagResources)({
|
|
111
|
+
WbyProjectName: String(process.env["WEBINY_PROJECT_NAME"]),
|
|
112
|
+
WbyEnvironment: String(process.env["WEBINY_ENV"])
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
for (const handler of this.handlers) {
|
|
116
|
+
await handler();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return this.outputs;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async deployFinished(params) {
|
|
123
|
+
for (const handler of this.afterDeployHandlers) {
|
|
124
|
+
await handler(params);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
exports.PulumiApp = PulumiApp;
|
|
131
|
+
|
|
132
|
+
function defineApp(params) {
|
|
133
|
+
const appDef = class App extends PulumiApp {
|
|
134
|
+
constructor(ctx) {
|
|
135
|
+
super({
|
|
136
|
+
name: params.name,
|
|
137
|
+
ctx: ctx
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async setup(config) {
|
|
142
|
+
const output = await params.config(this, config);
|
|
143
|
+
Object.assign(this, output);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
};
|
|
147
|
+
return appDef;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function createConfigProxy(obj) {
|
|
151
|
+
return new Proxy(obj, {
|
|
152
|
+
get(target, p) {
|
|
153
|
+
const key = p;
|
|
154
|
+
|
|
155
|
+
const setter = value => {
|
|
156
|
+
if (typeof value === "function") {
|
|
157
|
+
const modifier = value;
|
|
158
|
+
const currentValue = target[key]; // Wrap a current config with a function.
|
|
159
|
+
|
|
160
|
+
const newValue = pulumi.output(currentValue).apply(v => {
|
|
161
|
+
const newValue = modifier(v);
|
|
162
|
+
return pulumi.output(newValue);
|
|
163
|
+
});
|
|
164
|
+
target[key] = newValue;
|
|
165
|
+
} else {
|
|
166
|
+
target[key] = value;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return setter;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
});
|
|
174
|
+
}
|
package/PulumiApp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["PulumiApp.ts"],"names":["PulumiApp","constructor","params","Map","name","ctx","onResource","handler","resourceHandlers","push","onAfterDeploy","afterDeployHandlers","addResource","ctor","config","opts","promise","Promise","resolve","handlers","forEach","resourceInstance","resource","createConfigProxy","output","pulumi","addOutput","outputs","addOutputs","Object","assign","addModule","def","modules","has","symbol","Error","module","run","set","addHandler","getModule","get","optional","createController","runProgram","bind","deployFinished","WbyProjectName","String","process","env","WbyEnvironment","defineApp","appDef","App","setup","obj","Proxy","target","p","key","setter","value","modifier","currentValue","newValue","apply","v"],"mappings":";;;;;;;;;;;;AAAA;;AAKA;;;;;;AA6CO,MAAeA,SAAf,CAA4C;AAS/CC,EAAAA,WAAW,CAACC,MAAD,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ApD;AAWA,SAAO8B,MAAP;AACH;;AAED,SAAS/B,iBAAT,CAA6CkC,GAA7C,EAAqD;AACjD,SAAO,IAAIC,KAAJ,CAAUD,GAAV,EAAe;AAClBf,IAAAA,GAAG,CAACiB,MAAD,EAASC,CAAT,EAAoB;AAEnB,YAAMC,GAAG,GAAGD,CAAZ;;AACA,YAAME,MAA+B,GAAIC,KAAD,IAA0C;AAC9E,YAAI,OAAOA,KAAP,KAAiB,UAArB,EAAiC;AAC7B,gBAAMC,QAAQ,GAAGD,KAAjB;AACA,gBAAME,YAAY,GAAGN,MAAM,CAACE,GAAD,CAA3B,CAF6B,CAG7B;;AACA,gBAAMK,QAAQ,GAAGzC,MAAM,CAACD,MAAP,CAAcyC,YAAd,EAA4BE,KAA5B,CAAkCC,CAAC,IAAI;AACpD,kBAAMF,QAAQ,GAAGF,QAAQ,CAACI,CAAD,CAAzB;AACA,mBAAO3C,MAAM,CAACD,MAAP,CAAc0C,QAAd,CAAP;AACH,WAHgB,CAAjB;AAKAP,UAAAA,MAAM,CAACE,GAAD,CAAN,GAAcK,QAAd;AACH,SAVD,MAUO;AACHP,UAAAA,MAAM,CAACE,GAAD,CAAN,GAAcE,KAAd;AACH;AACJ,OAdD;;AAgBA,aAAOD,MAAP;AACH;;AArBiB,GAAf,CAAP;AAuBH","sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport { ApplicationContext } from \"./ApplicationConfig\";\nimport { PulumiAppModuleDefinition } from \"./PulumiAppModule\";\nimport { ResourceArgs, ResourceConstructor, ResourceType } from \"./PulumiResource\";\nimport { tagResources } from \"./utils/tagResources\";\n\nexport interface CreateResourceParams<TCtor extends ResourceConstructor> {\n name: string;\n config: ResourceArgs<TCtor>;\n opts?: pulumi.CustomResourceOptions;\n}\n\nexport interface PulumiAppResource<T extends ResourceConstructor> {\n name: string;\n readonly config: ResourceConfigProxy<ResourceArgs<T>>;\n readonly opts: pulumi.CustomResourceOptions;\n readonly output: pulumi.Output<pulumi.Unwrap<ResourceType<T>>>;\n}\n\nexport interface PulumiAppParams {\n name: string;\n ctx: ApplicationContext;\n}\n\nexport interface ResourceHandler {\n (resource: PulumiAppResource<ResourceConstructor>): void;\n}\n\nexport type ResourceConfigProxy<T extends object> = {\n readonly [K in keyof T]-?: ResourceConfigSetter<T[K]>;\n};\n\nexport interface ResourceConfigSetter<T> {\n (value: T): void;\n (fcn: ResourceConfigModifier<T>): void;\n}\n\nexport interface ResourceConfigModifier<T> {\n (value: pulumi.Unwrap<T>): T | void;\n}\n\ninterface DeployEventParams {\n outputs: Record<string, any>;\n}\n\ninterface DeployEventHandler {\n (params: DeployEventParams): Promise<void> | void;\n}\n\nexport abstract class PulumiApp<TConfig = unknown> {\n public readonly name: string;\n public readonly ctx: ApplicationContext;\n private readonly resourceHandlers: ResourceHandler[] = [];\n private readonly afterDeployHandlers: DeployEventHandler[] = [];\n private readonly handlers: (() => void | Promise<void>)[] = [];\n private readonly outputs: Record<string, any> = {};\n private readonly modules = new Map<symbol, unknown>();\n\n constructor(params: PulumiAppParams) {\n this.name = params.name;\n this.ctx = params.ctx;\n }\n\n public abstract setup(config: TConfig): Promise<void> | void;\n\n public onResource(handler: ResourceHandler): void {\n this.resourceHandlers.push(handler);\n }\n\n public onAfterDeploy(handler: DeployEventHandler) {\n this.afterDeployHandlers.push(handler);\n }\n\n public addResource<T extends ResourceConstructor>(ctor: T, params: CreateResourceParams<T>) {\n const config = params.config ?? ({} as ResourceArgs<T>);\n const opts = params.opts ?? {};\n\n const promise = new Promise<ResourceType<T>>(resolve => {\n this.handlers.push(() => {\n this.resourceHandlers.forEach(handler => handler(resourceInstance));\n const resourceInstance = new ctor(resource.name, config, opts);\n resolve(resourceInstance);\n });\n });\n\n const resource: PulumiAppResource<T> = {\n name: params.name,\n config: createConfigProxy(config),\n opts,\n output: pulumi.output(promise)\n };\n\n return resource;\n }\n\n public addOutput<T>(name: string, output: T) {\n this.outputs[name] = output;\n }\n\n public addOutputs(outputs: Record<string, unknown>) {\n Object.assign(this.outputs, outputs);\n }\n\n public addModule<TModule>(def: PulumiAppModuleDefinition<TModule, void>): TModule;\n public addModule<TModule, TConfig>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n config: TConfig\n ): TModule;\n public addModule<TModule, TConfig>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n config?: TConfig\n ) {\n if (this.modules.has(def.symbol)) {\n throw new Error(\n `Module \"${def.name}\" is already present in the \"${this.name}\" application.`\n );\n }\n\n const module = def.run(this, config as TConfig);\n this.modules.set(def.symbol, module);\n\n return module;\n }\n\n public addHandler<T>(handler: () => Promise<T> | T) {\n const promise = new Promise<T>(resolve => {\n this.handlers.push(async () => {\n resolve(await handler());\n });\n });\n\n return pulumi.output(promise);\n }\n\n public getModule<TConfig, TModule>(def: PulumiAppModuleDefinition<TModule, TConfig>): TModule;\n public getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts: { optional: false }\n ): TModule;\n public getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts: { optional: true }\n ): TModule | null;\n public getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts?: { optional: boolean }\n ) {\n const module = this.modules.get(def.symbol);\n\n if (!module) {\n if (opts?.optional) {\n return null;\n } else {\n throw new Error(`Module \"${def.name}\" not found in \"${this.name}\" app`);\n }\n }\n\n return module;\n }\n\n public createController() {\n return {\n run: this.runProgram.bind(this),\n deployFinished: this.deployFinished.bind(this)\n };\n }\n\n private async runProgram() {\n tagResources({\n WbyProjectName: String(process.env[\"WEBINY_PROJECT_NAME\"]),\n WbyEnvironment: String(process.env[\"WEBINY_ENV\"])\n });\n\n for (const handler of this.handlers) {\n await handler();\n }\n\n return this.outputs;\n }\n\n private async deployFinished(params: DeployEventParams) {\n for (const handler of this.afterDeployHandlers) {\n await handler(params);\n }\n }\n}\n\nexport interface CreateAppParams<TOutput extends Record<string, unknown>, TConfig = void> {\n name: string;\n config(app: PulumiApp, config: TConfig): TOutput | Promise<TOutput>;\n}\n\nexport function defineApp<TOutput extends Record<string, unknown>, TConfig = void>(\n params: CreateAppParams<TOutput, TConfig>\n) {\n const appDef = class App extends PulumiApp<TConfig> {\n constructor(ctx: ApplicationContext) {\n super({ name: params.name, ctx: ctx });\n }\n\n public async setup(config: TConfig) {\n const output = await params.config(this, config);\n Object.assign(this, output);\n }\n };\n\n return appDef as new (ctx: ApplicationContext) => PulumiApp<TConfig> & TOutput;\n}\n\nfunction createConfigProxy<T extends object>(obj: T) {\n return new Proxy(obj, {\n get(target, p: string) {\n type V = T[keyof T];\n const key = p as keyof T;\n const setter: ResourceConfigSetter<V> = (value: V | ResourceConfigModifier<V>) => {\n if (typeof value === \"function\") {\n const modifier = value as ResourceConfigModifier<V>;\n const currentValue = target[key];\n // Wrap a current config with a function.\n const newValue = pulumi.output(currentValue).apply(v => {\n const newValue = modifier(v);\n return pulumi.output(newValue);\n });\n\n target[key] = newValue as unknown as V;\n } else {\n target[key] = value;\n }\n };\n\n return setter;\n }\n }) as ResourceConfigProxy<T>;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare type PulumiApp = import("./PulumiApp").PulumiApp;
|
|
2
|
+
export interface PulumiAppModuleCallback<TModule, TConfig> {
|
|
3
|
+
(this: void, app: PulumiApp, config: TConfig): TModule;
|
|
4
|
+
}
|
|
5
|
+
export interface PulumiAppModuleParams<TModule, TConfig> {
|
|
6
|
+
name: string;
|
|
7
|
+
config: PulumiAppModuleCallback<TModule, TConfig>;
|
|
8
|
+
}
|
|
9
|
+
export declare type PulumiAppModule<T extends PulumiAppModuleDefinition<any, any>> = T extends PulumiAppModuleDefinition<infer V, any> ? V : never;
|
|
10
|
+
export declare class PulumiAppModuleDefinition<TModule, TConfig> {
|
|
11
|
+
readonly symbol: symbol;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly run: PulumiAppModuleCallback<TModule, TConfig>;
|
|
14
|
+
constructor(params: PulumiAppModuleParams<TModule, TConfig>);
|
|
15
|
+
}
|
|
16
|
+
export declare function defineAppModule<TModule, TConfig = void>(params: PulumiAppModuleParams<TModule, TConfig>): PulumiAppModuleDefinition<TModule, TConfig>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.PulumiAppModuleDefinition = void 0;
|
|
9
|
+
exports.defineAppModule = defineAppModule;
|
|
10
|
+
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
|
|
13
|
+
// There is a circular dependency between the two.
|
|
14
|
+
// This trick allow us to make it work.
|
|
15
|
+
class PulumiAppModuleDefinition {
|
|
16
|
+
constructor(params) {
|
|
17
|
+
(0, _defineProperty2.default)(this, "symbol", Symbol());
|
|
18
|
+
(0, _defineProperty2.default)(this, "name", void 0);
|
|
19
|
+
(0, _defineProperty2.default)(this, "run", void 0);
|
|
20
|
+
this.name = params.name;
|
|
21
|
+
this.run = params.config;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.PulumiAppModuleDefinition = PulumiAppModuleDefinition;
|
|
27
|
+
|
|
28
|
+
function defineAppModule(params) {
|
|
29
|
+
return new PulumiAppModuleDefinition(params);
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["PulumiAppModule.ts"],"names":["PulumiAppModuleDefinition","constructor","params","Symbol","name","run","config","defineAppModule"],"mappings":";;;;;;;;;;;;AAAA;AACA;AAeO,MAAMA,yBAAN,CAAkD;AAIrDC,EAAAA,WAAW,CAACC,MAAD,EAAkD;AAAA,kDAHpCC,MAAM,EAG8B;AAAA;AAAA;AACzD,SAAKC,IAAL,GAAYF,MAAM,CAACE,IAAnB;AACA,SAAKC,GAAL,GAAWH,MAAM,CAACI,MAAlB;AACH;;AAPoD;;;;AAUlD,SAASC,eAAT,CACHL,MADG,EAEL;AACE,SAAO,IAAIF,yBAAJ,CAA8BE,MAA9B,CAAP;AACH","sourcesContent":["// There is a circular dependency between the two.\n// This trick allow us to make it work.\ntype PulumiApp = import(\"./PulumiApp\").PulumiApp;\n\nexport interface PulumiAppModuleCallback<TModule, TConfig> {\n (this: void, app: PulumiApp, config: TConfig): TModule;\n}\n\nexport interface PulumiAppModuleParams<TModule, TConfig> {\n name: string;\n config: PulumiAppModuleCallback<TModule, TConfig>;\n}\n\nexport type PulumiAppModule<T extends PulumiAppModuleDefinition<any, any>> =\n T extends PulumiAppModuleDefinition<infer V, any> ? V : never;\n\nexport class PulumiAppModuleDefinition<TModule, TConfig> {\n public readonly symbol = Symbol();\n public readonly name: string;\n public readonly run: PulumiAppModuleCallback<TModule, TConfig>;\n constructor(params: PulumiAppModuleParams<TModule, TConfig>) {\n this.name = params.name;\n this.run = params.config;\n }\n}\n\nexport function defineAppModule<TModule, TConfig = void>(\n params: PulumiAppModuleParams<TModule, TConfig>\n) {\n return new PulumiAppModuleDefinition(params);\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
2
|
+
export interface ResourceConstructor<T = any, TArgs = any> {
|
|
3
|
+
new (name: string, args: TArgs, opts?: pulumi.CustomResourceOptions): T;
|
|
4
|
+
}
|
|
5
|
+
export declare type ResourceType<T extends ResourceConstructor> = T extends ResourceConstructor<infer TType> ? TType : never;
|
|
6
|
+
export declare type ResourceArgs<T extends ResourceConstructor> = T extends ResourceConstructor<any, infer TArgs> ? Exclude<TArgs, undefined> : never;
|
|
7
|
+
export interface ResourceOverride<TCtor extends ResourceConstructor> {
|
|
8
|
+
(args: ResourceArgs<TCtor>): void;
|
|
9
|
+
}
|
|
10
|
+
export interface PulumiResourceParams<T extends ResourceConstructor> {
|
|
11
|
+
name: string;
|
|
12
|
+
config: ResourceArgs<T>;
|
|
13
|
+
opts?: pulumi.CustomResourceOptions;
|
|
14
|
+
output: pulumi.Output<pulumi.Unwrap<ResourceType<T>>>;
|
|
15
|
+
}
|
|
16
|
+
export declare class PulumiResource<T extends ResourceConstructor> {
|
|
17
|
+
readonly output: pulumi.Output<pulumi.Unwrap<ResourceType<T>>>;
|
|
18
|
+
config: ResourceArgs<T>;
|
|
19
|
+
opts: pulumi.CustomResourceOptions;
|
|
20
|
+
readonly create: () => void;
|
|
21
|
+
constructor(ctor: T, params: PulumiResourceParams<T>);
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.PulumiResource = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
|
|
13
|
+
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
18
|
+
class PulumiResource {
|
|
19
|
+
constructor(ctor, params) {
|
|
20
|
+
(0, _defineProperty2.default)(this, "output", void 0);
|
|
21
|
+
(0, _defineProperty2.default)(this, "config", void 0);
|
|
22
|
+
(0, _defineProperty2.default)(this, "opts", void 0);
|
|
23
|
+
(0, _defineProperty2.default)(this, "create", void 0);
|
|
24
|
+
this.config = params.config;
|
|
25
|
+
this.opts = params.opts ?? {};
|
|
26
|
+
let resolve;
|
|
27
|
+
let created = false;
|
|
28
|
+
|
|
29
|
+
this.create = () => {
|
|
30
|
+
if (created) {
|
|
31
|
+
// prevent double initialization
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const resource = new ctor(params.name, this.config, this.opts);
|
|
36
|
+
resolve(resource);
|
|
37
|
+
created = false;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const promise = new Promise(r => {
|
|
41
|
+
resolve = r;
|
|
42
|
+
});
|
|
43
|
+
this.output = pulumi.output(promise);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
exports.PulumiResource = PulumiResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["PulumiResource.ts"],"names":["PulumiResource","constructor","ctor","params","config","opts","resolve","created","create","resource","name","promise","Promise","r","output","pulumi"],"mappings":";;;;;;;;;;;AAAA;;;;;;AA4BO,MAAMA,cAAN,CAAoD;AAOvDC,EAAAA,WAAW,CAACC,IAAD,EAAUC,MAAV,EAA2C;AAAA;AAAA;AAAA;AAAA;AAClD,SAAKC,MAAL,GAAcD,MAAM,CAACC,MAArB;AACA,SAAKC,IAAL,GAAYF,MAAM,CAACE,IAAP,IAAe,EAA3B;AAEA,QAAIC,OAAJ;AACA,QAAIC,OAAO,GAAG,KAAd;;AAEA,SAAKC,MAAL,GAAc,MAAM;AAChB,UAAID,OAAJ,EAAa;AACT;AACA;AACH;;AAED,YAAME,QAAQ,GAAG,IAAIP,IAAJ,CAASC,MAAM,CAACO,IAAhB,EAAsB,KAAKN,MAA3B,EAAmC,KAAKC,IAAxC,CAAjB;AACAC,MAAAA,OAAO,CAACG,QAAD,CAAP;AACAF,MAAAA,OAAO,GAAG,KAAV;AACH,KATD;;AAWA,UAAMI,OAAO,GAAG,IAAIC,OAAJ,CAA6BC,CAAC,IAAI;AAC9CP,MAAAA,OAAO,GAAGO,CAAV;AACH,KAFe,CAAhB;AAIA,SAAKC,MAAL,GAAcC,MAAM,CAACD,MAAP,CAAcH,OAAd,CAAd;AACH;;AA9BsD","sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nexport interface ResourceConstructor<T = any, TArgs = any> {\n new (name: string, args: TArgs, opts?: pulumi.CustomResourceOptions): T;\n}\n\nexport type ResourceType<T extends ResourceConstructor> = T extends ResourceConstructor<infer TType>\n ? TType\n : never;\n\nexport type ResourceArgs<T extends ResourceConstructor> = T extends ResourceConstructor<\n any,\n infer TArgs\n>\n ? Exclude<TArgs, undefined>\n : never;\n\nexport interface ResourceOverride<TCtor extends ResourceConstructor> {\n (args: ResourceArgs<TCtor>): void;\n}\n\nexport interface PulumiResourceParams<T extends ResourceConstructor> {\n name: string;\n config: ResourceArgs<T>;\n opts?: pulumi.CustomResourceOptions;\n output: pulumi.Output<pulumi.Unwrap<ResourceType<T>>>;\n}\n\nexport class PulumiResource<T extends ResourceConstructor> {\n public readonly output: pulumi.Output<pulumi.Unwrap<ResourceType<T>>>;\n public config: ResourceArgs<T>;\n public opts: pulumi.CustomResourceOptions;\n\n public readonly create: () => void;\n\n constructor(ctor: T, params: PulumiResourceParams<T>) {\n this.config = params.config;\n this.opts = params.opts ?? {};\n\n let resolve: (res: ResourceType<T>) => void;\n let created = false;\n\n this.create = () => {\n if (created) {\n // prevent double initialization\n return;\n }\n\n const resource = new ctor(params.name, this.config, this.opts);\n resolve(resource);\n created = false;\n };\n\n const promise = new Promise<ResourceType<T>>(r => {\n resolve = r;\n });\n\n this.output = pulumi.output(promise);\n }\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
args?: PulumiArgs;
|
|
14
|
-
execa?: ExecaArgs;
|
|
15
|
-
beforePulumiInstall?: () => any;
|
|
16
|
-
afterPulumiInstall?: () => any;
|
|
17
|
-
pulumiFolder?: string;
|
|
18
|
-
}
|
|
19
|
-
interface RunArgs {
|
|
20
|
-
command: Command;
|
|
21
|
-
args?: PulumiArgs;
|
|
22
|
-
execa?: ExecaArgs;
|
|
23
|
-
beforePulumiInstall?: () => any;
|
|
24
|
-
afterPulumiInstall?: () => any;
|
|
25
|
-
}
|
|
26
|
-
interface InstallArgs {
|
|
27
|
-
beforePulumiInstall?: () => any;
|
|
28
|
-
afterPulumiInstall?: () => any;
|
|
29
|
-
}
|
|
30
|
-
export declare const FLAG_NON_INTERACTIVE = "--non-interactive";
|
|
31
|
-
export declare class Pulumi {
|
|
32
|
-
options: Options;
|
|
33
|
-
pulumiFolder: string;
|
|
34
|
-
pulumiDownloadFolder: string;
|
|
35
|
-
pulumiBinaryPath: string;
|
|
36
|
-
constructor(options?: Options);
|
|
37
|
-
run(rawArgs: RunArgs): execa.ExecaChildProcess<string>;
|
|
38
|
-
install(rawArgs?: InstallArgs): Promise<boolean>;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
1
|
+
export * from "./Pulumi";
|
|
2
|
+
export * from "./PulumiApp";
|
|
3
|
+
export * from "./PulumiAppModule";
|
|
4
|
+
export * from "./PulumiResource";
|
|
5
|
+
export * from "./ApplicationConfig";
|
|
6
|
+
export * from "./ApplicationHook";
|
|
7
|
+
export * from "./ApplicationBuilder";
|
|
8
|
+
export * from "./ApplicationBuilderGeneric";
|
|
9
|
+
export * from "./ApplicationBuilderLegacy";
|
|
10
|
+
export * from "./utils/getPulumiWorkDir";
|
|
11
|
+
export * from "./utils/mergeAppHooks";
|
|
12
|
+
export * from "./utils/tagResources";
|
package/index.js
CHANGED
|
@@ -1,132 +1,161 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.Pulumi = exports.FLAG_NON_INTERACTIVE = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _set2 = _interopRequireDefault(require("lodash/set"));
|
|
13
|
-
|
|
14
|
-
var _kebabCase2 = _interopRequireDefault(require("lodash/kebabCase"));
|
|
15
6
|
|
|
16
|
-
var
|
|
7
|
+
var _Pulumi = require("./Pulumi");
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
Object.keys(_Pulumi).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _Pulumi[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _Pulumi[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
21
19
|
|
|
22
|
-
var
|
|
20
|
+
var _PulumiApp = require("./PulumiApp");
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
Object.keys(_PulumiApp).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _PulumiApp[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _PulumiApp[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
var _PulumiAppModule = require("./PulumiAppModule");
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
Object.keys(_PulumiAppModule).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _PulumiAppModule[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _PulumiAppModule[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
29
45
|
|
|
30
|
-
|
|
46
|
+
var _PulumiResource = require("./PulumiResource");
|
|
31
47
|
|
|
32
|
-
|
|
48
|
+
Object.keys(_PulumiResource).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _PulumiResource[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _PulumiResource[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
33
58
|
|
|
34
|
-
|
|
35
|
-
exports.FLAG_NON_INTERACTIVE = FLAG_NON_INTERACTIVE;
|
|
59
|
+
var _ApplicationConfig = require("./ApplicationConfig");
|
|
36
60
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
61
|
+
Object.keys(_ApplicationConfig).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (key in exports && exports[key] === _ApplicationConfig[key]) return;
|
|
64
|
+
Object.defineProperty(exports, key, {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () {
|
|
67
|
+
return _ApplicationConfig[key];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
48
71
|
|
|
49
|
-
|
|
50
|
-
const args = (0, _merge2.default)({}, this.options, rawArgs);
|
|
72
|
+
var _ApplicationHook = require("./ApplicationHook");
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
Object.keys(_ApplicationHook).forEach(function (key) {
|
|
75
|
+
if (key === "default" || key === "__esModule") return;
|
|
76
|
+
if (key in exports && exports[key] === _ApplicationHook[key]) return;
|
|
77
|
+
Object.defineProperty(exports, key, {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return _ApplicationHook[key];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
55
84
|
|
|
85
|
+
var _ApplicationBuilder = require("./ApplicationBuilder");
|
|
56
86
|
|
|
57
|
-
|
|
87
|
+
Object.keys(_ApplicationBuilder).forEach(function (key) {
|
|
88
|
+
if (key === "default" || key === "__esModule") return;
|
|
89
|
+
if (key in exports && exports[key] === _ApplicationBuilder[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _ApplicationBuilder[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
58
97
|
|
|
59
|
-
|
|
60
|
-
const value = args.args[key];
|
|
98
|
+
var _ApplicationBuilderGeneric = require("./ApplicationBuilderGeneric");
|
|
61
99
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
100
|
+
Object.keys(_ApplicationBuilderGeneric).forEach(function (key) {
|
|
101
|
+
if (key === "default" || key === "__esModule") return;
|
|
102
|
+
if (key in exports && exports[key] === _ApplicationBuilderGeneric[key]) return;
|
|
103
|
+
Object.defineProperty(exports, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _ApplicationBuilderGeneric[key];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
65
110
|
|
|
66
|
-
|
|
67
|
-
for (let i = 0; i < value.length; i++) {
|
|
68
|
-
finalArgs.push(`--${(0, _kebabCase2.default)(key)}`, value[i]);
|
|
69
|
-
}
|
|
111
|
+
var _ApplicationBuilderLegacy = require("./ApplicationBuilderLegacy");
|
|
70
112
|
|
|
71
|
-
|
|
72
|
-
|
|
113
|
+
Object.keys(_ApplicationBuilderLegacy).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (key in exports && exports[key] === _ApplicationBuilderLegacy[key]) return;
|
|
116
|
+
Object.defineProperty(exports, key, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _ApplicationBuilderLegacy[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
73
123
|
|
|
74
|
-
|
|
75
|
-
finalArgs.push(`--${(0, _kebabCase2.default)(key)}`);
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
124
|
+
var _getPulumiWorkDir = require("./utils/getPulumiWorkDir");
|
|
78
125
|
|
|
79
|
-
|
|
126
|
+
Object.keys(_getPulumiWorkDir).forEach(function (key) {
|
|
127
|
+
if (key === "default" || key === "__esModule") return;
|
|
128
|
+
if (key in exports && exports[key] === _getPulumiWorkDir[key]) return;
|
|
129
|
+
Object.defineProperty(exports, key, {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function () {
|
|
132
|
+
return _getPulumiWorkDir[key];
|
|
80
133
|
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
81
136
|
|
|
82
|
-
|
|
83
|
-
args.execa = {};
|
|
84
|
-
} // Prepare execa args.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
(0, _set2.default)(args.execa, "env.PULUMI_SKIP_UPDATE_CHECK", "true");
|
|
88
|
-
(0, _set2.default)(args.execa, "env.PULUMI_HOME", this.pulumiFolder); // Use ";" when on Windows. For Mac and Linux, use ":".
|
|
89
|
-
|
|
90
|
-
const PATH_SEPARATOR = _os.default.platform() === "win32" ? ";" : ":";
|
|
91
|
-
|
|
92
|
-
const execaArgs = _objectSpread(_objectSpread({}, args.execa), {}, {
|
|
93
|
-
env: _objectSpread(_objectSpread({}, args.execa.env || {}), {}, {
|
|
94
|
-
/**
|
|
95
|
-
* Due to an issue with Pulumi https://github.com/pulumi/pulumi/issues/8374, and even though this
|
|
96
|
-
* commit suggests it should already work like that https://github.com/pulumi/pulumi/commit/c878916901a997a9c0ffcbed23560e19e224a6f1,
|
|
97
|
-
* we need to specify the exact location of our Pulumi binaries, using the PATH environment variable, so it can correctly resolve
|
|
98
|
-
* plugins necessary for custom resources and dynamic providers to work.
|
|
99
|
-
*/
|
|
100
|
-
PATH: process.env.PATH + PATH_SEPARATOR + this.pulumiFolder
|
|
101
|
-
})
|
|
102
|
-
}); // We want to keep the "interactive" output format of the Pulumi command when `--preview` flag is passed in.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const flags = args.command && args.command.includes("preview") ? [] : [FLAG_NON_INTERACTIVE];
|
|
106
|
-
return (0, _execa.default)(this.pulumiBinaryPath, [...args.command, ...finalArgs, ...flags], execaArgs);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async install(rawArgs) {
|
|
110
|
-
const args = (0, _merge2.default)({}, this.options, rawArgs);
|
|
111
|
-
const installed = await (0, _downloadBinaries.default)(this.pulumiDownloadFolder, args.beforePulumiInstall, args.afterPulumiInstall);
|
|
112
|
-
|
|
113
|
-
if (installed) {
|
|
114
|
-
const {
|
|
115
|
-
version
|
|
116
|
-
} = require("@pulumi/aws/package.json");
|
|
117
|
-
|
|
118
|
-
await (0, _execa.default)(this.pulumiBinaryPath, ["plugin", "install", "resource", "aws", version], {
|
|
119
|
-
stdio: "inherit",
|
|
120
|
-
env: {
|
|
121
|
-
PULUMI_HOME: this.pulumiFolder,
|
|
122
|
-
PULUMI_SKIP_UPDATE_CHECK: "true"
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
137
|
+
var _mergeAppHooks = require("./utils/mergeAppHooks");
|
|
126
138
|
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
Object.keys(_mergeAppHooks).forEach(function (key) {
|
|
140
|
+
if (key === "default" || key === "__esModule") return;
|
|
141
|
+
if (key in exports && exports[key] === _mergeAppHooks[key]) return;
|
|
142
|
+
Object.defineProperty(exports, key, {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () {
|
|
145
|
+
return _mergeAppHooks[key];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
});
|
|
129
149
|
|
|
130
|
-
|
|
150
|
+
var _tagResources = require("./utils/tagResources");
|
|
131
151
|
|
|
132
|
-
|
|
152
|
+
Object.keys(_tagResources).forEach(function (key) {
|
|
153
|
+
if (key === "default" || key === "__esModule") return;
|
|
154
|
+
if (key in exports && exports[key] === _tagResources[key]) return;
|
|
155
|
+
Object.defineProperty(exports, key, {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
get: function () {
|
|
158
|
+
return _tagResources[key];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|