@webiny/pulumi 0.0.0-unstable.e3f4727c56 → 0.0.0-unstable.eb196ccd2f

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.
@@ -1,4 +1,4 @@
1
- import { PulumiApp } from "./types";
1
+ import type { PulumiApp } from "./types";
2
2
  export interface PulumiAppModuleCallback<TModule, TConfig> {
3
3
  (this: void, app: PulumiApp, config: TConfig): TModule;
4
4
  }
@@ -6,7 +6,7 @@ export interface PulumiAppModuleParams<TModule, TConfig> {
6
6
  name: string;
7
7
  config: PulumiAppModuleCallback<TModule, TConfig>;
8
8
  }
9
- export declare type PulumiAppModule<T extends PulumiAppModuleDefinition<any, any>> = T extends PulumiAppModuleDefinition<infer V, any> ? V : never;
9
+ export type PulumiAppModule<T extends PulumiAppModuleDefinition<any, any>> = T extends PulumiAppModuleDefinition<infer V, any> ? V : never;
10
10
  export declare class PulumiAppModuleDefinition<TModule, TConfig> {
11
11
  readonly symbol: symbol;
12
12
  readonly name: string;
@@ -1,28 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.PulumiAppModuleDefinition = void 0;
9
7
  exports.createAppModule = createAppModule;
10
-
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
-
13
8
  class PulumiAppModuleDefinition {
9
+ symbol = Symbol();
14
10
  constructor(params) {
15
- (0, _defineProperty2.default)(this, "symbol", Symbol());
16
- (0, _defineProperty2.default)(this, "name", void 0);
17
- (0, _defineProperty2.default)(this, "run", void 0);
18
11
  this.name = params.name;
19
12
  this.run = params.config;
20
13
  }
21
-
22
14
  }
23
-
24
15
  exports.PulumiAppModuleDefinition = PulumiAppModuleDefinition;
25
-
26
16
  function createAppModule(params) {
27
17
  return new PulumiAppModuleDefinition(params);
28
- }
18
+ }
19
+
20
+ //# sourceMappingURL=PulumiAppModule.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PulumiAppModuleDefinition","constructor","params","Symbol","name","run","config","createAppModule"],"sources":["PulumiAppModule.ts"],"sourcesContent":["import { PulumiApp } from \"./types\";\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 createAppModule<TModule, TConfig = void>(\n params: PulumiAppModuleParams<TModule, TConfig>\n) {\n return new PulumiAppModuleDefinition(params);\n}\n"],"mappings":";;;;;;;;;;;;AAcO,MAAMA,yBAAN,CAAkD;EAIrDC,WAAW,CAACC,MAAD,EAAkD;IAAA,8CAHpCC,MAAM,EAG8B;IAAA;IAAA;IACzD,KAAKC,IAAL,GAAYF,MAAM,CAACE,IAAnB;IACA,KAAKC,GAAL,GAAWH,MAAM,CAACI,MAAlB;EACH;;AAPoD;;;;AAUlD,SAASC,eAAT,CACHL,MADG,EAEL;EACE,OAAO,IAAIF,yBAAJ,CAA8BE,MAA9B,CAAP;AACH"}
1
+ {"version":3,"names":["PulumiAppModuleDefinition","symbol","Symbol","constructor","params","name","run","config","exports","createAppModule"],"sources":["PulumiAppModule.ts"],"sourcesContent":["import type { PulumiApp } from \"./types\";\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 createAppModule<TModule, TConfig = void>(\n params: PulumiAppModuleParams<TModule, TConfig>\n) {\n return new PulumiAppModuleDefinition(params);\n}\n"],"mappings":";;;;;;;AAcO,MAAMA,yBAAyB,CAAmB;EACrCC,MAAM,GAAGC,MAAM,CAAC,CAAC;EAGjCC,WAAWA,CAACC,MAA+C,EAAE;IACzD,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,GAAG,GAAGF,MAAM,CAACG,MAAM;EAC5B;AACJ;AAACC,OAAA,CAAAR,yBAAA,GAAAA,yBAAA;AAEM,SAASS,eAAeA,CAC3BL,MAA+C,EACjD;EACE,OAAO,IAAIJ,yBAAyB,CAACI,MAAM,CAAC;AAChD","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import * as pulumi from "@pulumi/pulumi";
1
+ import type * as pulumi from "@pulumi/pulumi";
2
2
  export interface PulumiAppRemoteResource<T> {
3
3
  name: string;
4
4
  readonly output: pulumi.Output<pulumi.Unwrap<T>>;
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=PulumiAppRemoteResource.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["PulumiAppRemoteResource.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nexport interface PulumiAppRemoteResource<T> {\n name: string;\n readonly output: pulumi.Output<pulumi.Unwrap<T>>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["PulumiAppRemoteResource.ts"],"sourcesContent":["import type * as pulumi from \"@pulumi/pulumi\";\n\nexport interface PulumiAppRemoteResource<T> {\n name: string;\n readonly output: pulumi.Output<pulumi.Unwrap<T>>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import * as pulumi from "@pulumi/pulumi";
1
+ import type * as pulumi from "@pulumi/pulumi";
2
2
  export interface PulumiAppResourceConstructor<T = any, TArgs = any> {
3
3
  new (name: string, args: TArgs, opts?: pulumi.CustomResourceOptions): T;
4
4
  }
5
- export declare type PulumiAppResourceType<T extends PulumiAppResourceConstructor> = T extends PulumiAppResourceConstructor<infer TType> ? TType : never;
6
- export declare type PulumiAppResourceArgs<T extends PulumiAppResourceConstructor> = T extends PulumiAppResourceConstructor<any, infer TArgs> ? Exclude<TArgs, undefined> : never;
5
+ export type PulumiAppResourceType<T extends PulumiAppResourceConstructor> = T extends PulumiAppResourceConstructor<infer TType> ? TType : never;
6
+ export type PulumiAppResourceArgs<T extends PulumiAppResourceConstructor> = T extends PulumiAppResourceConstructor<any, infer TArgs> ? Exclude<TArgs, undefined> : never;
7
7
  export interface CreatePulumiAppResourceParams<TConstructor extends PulumiAppResourceConstructor> {
8
8
  name: string;
9
9
  config: PulumiAppResourceArgs<TConstructor>;
@@ -17,8 +17,10 @@ export interface PulumiAppResourceConfigSetter<T> {
17
17
  (value: T): void;
18
18
  (fcn: PulumiAppResourceConfigModifier<T>): void;
19
19
  }
20
- export declare type PulumiAppResourceConfigProxy<T extends object> = {
20
+ export type PulumiAppResourceConfigProxy<T extends object> = {
21
21
  readonly [K in keyof T]-?: PulumiAppResourceConfigSetter<T[K]>;
22
+ } & {
23
+ clone(): T;
22
24
  };
23
25
  export interface PulumiAppResource<T extends PulumiAppResourceConstructor> {
24
26
  name: string;
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=PulumiAppResource.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["PulumiAppResource.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nexport interface PulumiAppResourceConstructor<T = any, TArgs = any> {\n new (name: string, args: TArgs, opts?: pulumi.CustomResourceOptions): T;\n}\n\nexport type PulumiAppResourceType<T extends PulumiAppResourceConstructor> =\n T extends PulumiAppResourceConstructor<infer TType> ? TType : never;\n\nexport type PulumiAppResourceArgs<T extends PulumiAppResourceConstructor> =\n T extends PulumiAppResourceConstructor<any, infer TArgs> ? Exclude<TArgs, undefined> : never;\n\nexport interface CreatePulumiAppResourceParams<TConstructor extends PulumiAppResourceConstructor> {\n name: string;\n config: PulumiAppResourceArgs<TConstructor>;\n opts?: pulumi.CustomResourceOptions;\n meta?: Record<string, any>;\n}\n\nexport interface PulumiAppResourceConfigModifier<T> {\n (value: pulumi.Unwrap<T>): T | void;\n}\n\nexport interface PulumiAppResourceConfigSetter<T> {\n (value: T): void;\n (fcn: PulumiAppResourceConfigModifier<T>): void;\n}\n\nexport type PulumiAppResourceConfigProxy<T extends object> = {\n readonly [K in keyof T]-?: PulumiAppResourceConfigSetter<T[K]>;\n};\n\nexport interface PulumiAppResource<T extends PulumiAppResourceConstructor> {\n name: string;\n type: T;\n readonly config: PulumiAppResourceConfigProxy<PulumiAppResourceArgs<T>>;\n readonly opts: pulumi.CustomResourceOptions;\n readonly meta: Record<string, any>;\n readonly output: pulumi.Output<pulumi.Unwrap<PulumiAppResourceType<T>>>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["PulumiAppResource.ts"],"sourcesContent":["import type * as pulumi from \"@pulumi/pulumi\";\n\nexport interface PulumiAppResourceConstructor<T = any, TArgs = any> {\n new (name: string, args: TArgs, opts?: pulumi.CustomResourceOptions): T;\n}\n\nexport type PulumiAppResourceType<T extends PulumiAppResourceConstructor> =\n T extends PulumiAppResourceConstructor<infer TType> ? TType : never;\n\nexport type PulumiAppResourceArgs<T extends PulumiAppResourceConstructor> =\n T extends PulumiAppResourceConstructor<any, infer TArgs> ? Exclude<TArgs, undefined> : never;\n\nexport interface CreatePulumiAppResourceParams<TConstructor extends PulumiAppResourceConstructor> {\n name: string;\n config: PulumiAppResourceArgs<TConstructor>;\n opts?: pulumi.CustomResourceOptions;\n meta?: Record<string, any>;\n}\n\nexport interface PulumiAppResourceConfigModifier<T> {\n (value: pulumi.Unwrap<T>): T | void;\n}\n\nexport interface PulumiAppResourceConfigSetter<T> {\n (value: T): void;\n (fcn: PulumiAppResourceConfigModifier<T>): void;\n}\n\nexport type PulumiAppResourceConfigProxy<T extends object> = {\n readonly [K in keyof T]-?: PulumiAppResourceConfigSetter<T[K]>;\n} & {\n clone(): T;\n};\n\nexport interface PulumiAppResource<T extends PulumiAppResourceConstructor> {\n name: string;\n type: T;\n readonly config: PulumiAppResourceConfigProxy<PulumiAppResourceArgs<T>>;\n readonly opts: pulumi.CustomResourceOptions;\n readonly meta: Record<string, any>;\n readonly output: pulumi.Output<pulumi.Unwrap<PulumiAppResourceType<T>>>;\n}\n"],"mappings":"","ignoreList":[]}
package/constants.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_PROD_ENV_NAMES: string[];
package/constants.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DEFAULT_PROD_ENV_NAMES = void 0;
7
+ const DEFAULT_PROD_ENV_NAMES = exports.DEFAULT_PROD_ENV_NAMES = ["prod", "production"];
8
+
9
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_PROD_ENV_NAMES","exports"],"sources":["constants.ts"],"sourcesContent":["export const DEFAULT_PROD_ENV_NAMES = [\"prod\", \"production\"];\n"],"mappings":";;;;;;AAAO,MAAMA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CreatePulumiAppParams, PulumiApp } from "./types";
1
+ import type { CreatePulumiAppParams, PulumiApp } from "./types";
2
2
  export declare function createPulumiApp<TResources extends Record<string, unknown>>(params: CreatePulumiAppParams<TResources>): PulumiApp<TResources>;
@@ -1,35 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.createPulumiApp = createPulumiApp;
11
-
12
9
  var _findUp = _interopRequireDefault(require("find-up"));
13
-
14
10
  var _path = _interopRequireDefault(require("path"));
15
-
16
11
  var pulumi = _interopRequireWildcard(require("@pulumi/pulumi"));
17
-
12
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
13
+ var _constants = require("./constants");
18
14
  function createPulumiApp(params) {
19
15
  let projectRootPath = _findUp.default.sync("webiny.project.ts");
20
-
21
16
  if (projectRootPath) {
22
17
  projectRootPath = _path.default.dirname(projectRootPath).replace(/\\/g, "/");
23
18
  } else {
24
19
  throw new Error("Couldn't detect Webiny project.");
25
20
  }
26
-
27
21
  const appRelativePath = params.path;
28
-
29
22
  const appRootPath = _path.default.join(projectRootPath, appRelativePath);
30
-
31
23
  const projectAppWorkspacePath = _path.default.join(projectRootPath, ".webiny", "workspaces", appRelativePath);
32
-
24
+ const programDecorators = [];
33
25
  const app = {
34
26
  resourceHandlers: [],
35
27
  handlers: [],
@@ -45,25 +37,44 @@ function createPulumiApp(params) {
45
37
  program: params.program,
46
38
  params: {
47
39
  create: params.config || {},
48
- run: {}
40
+ run: {
41
+ env: "",
42
+ variant: ""
43
+ }
44
+ },
45
+ env: {
46
+ name: "",
47
+ isProduction: false
48
+ },
49
+ decorateProgram: cb => {
50
+ programDecorators.push(cb);
49
51
  },
50
-
51
52
  async run(config) {
52
53
  app.params.run = config;
53
- Object.assign(app.resources, await app.program(app));
54
54
 
55
+ // Add environment-related variables.
56
+ const productionEnvironments = app.params.create.productionEnvironments || _constants.DEFAULT_PROD_ENV_NAMES;
57
+ const isProduction = productionEnvironments.includes(app.params.run.env);
58
+ app.env = {
59
+ name: app.params.run.env,
60
+ isProduction
61
+ };
62
+ const programOutput = programDecorators.reduce((program, decorator) => {
63
+ return app => decorator(program, app);
64
+ }, input => app.program(input));
65
+ Object.assign(app.resources, await programOutput(app));
55
66
  for (const handler of app.handlers) {
56
67
  await handler();
57
68
  }
58
-
59
- app.params.run = {};
69
+ app.params.run = {
70
+ env: "",
71
+ variant: ""
72
+ };
60
73
  return app.outputs;
61
74
  },
62
-
63
75
  onResource(handler) {
64
76
  app.resourceHandlers.push(handler);
65
77
  },
66
-
67
78
  /**
68
79
  * Adds a resource to pulumi app.
69
80
  * It's not running the script immediately, but enqueues the call.
@@ -92,7 +103,6 @@ function createPulumiApp(params) {
92
103
  };
93
104
  return resource;
94
105
  },
95
-
96
106
  addRemoteResource(name, getter) {
97
107
  const promise = getter();
98
108
  const resource = {
@@ -101,7 +111,6 @@ function createPulumiApp(params) {
101
111
  };
102
112
  return resource;
103
113
  },
104
-
105
114
  /**
106
115
  * Registers output value within pulumi app.
107
116
  * @param name Name of the output value
@@ -110,7 +119,6 @@ function createPulumiApp(params) {
110
119
  addOutput(name, output) {
111
120
  app.outputs[name] = output;
112
121
  },
113
-
114
122
  /**
115
123
  * Registers one or more output values.
116
124
  * @param outputs Dictionary containing output values.
@@ -118,7 +126,6 @@ function createPulumiApp(params) {
118
126
  addOutputs(outputs) {
119
127
  Object.assign(app.outputs, outputs);
120
128
  },
121
-
122
129
  /**
123
130
  * Registers an app module within app.
124
131
  * Allows to decompose application into smaller pieces.
@@ -130,12 +137,10 @@ function createPulumiApp(params) {
130
137
  if (app.modules.has(module.symbol)) {
131
138
  throw new Error(`Module "${module.name}" is already present in the "${app.name}" application.`);
132
139
  }
133
-
134
140
  const createdModule = module.run(app, config);
135
141
  app.modules.set(module.symbol, createdModule);
136
142
  return createdModule;
137
143
  },
138
-
139
144
  /**
140
145
  * Returns a module by its definition
141
146
  * @param def
@@ -143,18 +148,15 @@ function createPulumiApp(params) {
143
148
  */
144
149
  getModule(def, opts) {
145
150
  const module = app.modules.get(def.symbol);
146
-
147
151
  if (!module) {
148
- if (opts !== null && opts !== void 0 && opts.optional) {
152
+ if (opts?.optional) {
149
153
  return null;
150
154
  } else {
151
155
  throw new Error(`Module "${def.name}" not found in "${app.name}" app`);
152
156
  }
153
157
  }
154
-
155
158
  return module;
156
159
  },
157
-
158
160
  /**
159
161
  * Schedules a handler to be executed when running pulumi script.
160
162
  * Anything, that is returned from handler will be wrapped in pulumi.Output
@@ -170,29 +172,27 @@ function createPulumiApp(params) {
170
172
  });
171
173
  return pulumi.output(promise);
172
174
  },
173
-
174
175
  getParam(param) {
175
176
  if (typeof param === "function") {
176
177
  return param(app);
177
178
  }
178
-
179
179
  return param;
180
180
  }
181
-
182
181
  };
183
182
  return app;
184
183
  }
185
-
186
184
  function createPulumiAppResourceConfigProxy(obj) {
187
185
  return new Proxy(obj, {
188
186
  get(target, p) {
187
+ if (p === "clone") {
188
+ return () => (0, _cloneDeep.default)(obj);
189
+ }
189
190
  const key = p;
190
-
191
191
  const setter = value => {
192
192
  if (typeof value === "function") {
193
193
  const modifier = value;
194
- const currentValue = target[key]; // Wrap a current config with a function.
195
-
194
+ const currentValue = target[key];
195
+ // Wrap a current config with a function.
196
196
  const newValue = pulumi.output(currentValue).apply(v => {
197
197
  const newValue = modifier(v);
198
198
  return pulumi.output(newValue);
@@ -202,9 +202,9 @@ function createPulumiAppResourceConfigProxy(obj) {
202
202
  target[key] = value;
203
203
  }
204
204
  };
205
-
206
205
  return setter;
207
206
  }
208
-
209
207
  });
210
- }
208
+ }
209
+
210
+ //# sourceMappingURL=createPulumiApp.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createPulumiApp","params","projectRootPath","findUp","sync","path","dirname","replace","Error","appRelativePath","appRootPath","join","projectAppWorkspacePath","app","resourceHandlers","handlers","outputs","modules","Map","paths","absolute","relative","workspace","resources","name","program","create","config","run","Object","assign","handler","onResource","push","addResource","resourceConstructor","opts","meta","promise","Promise","resolve","forEach","resource","type","createPulumiAppResourceConfigProxy","output","pulumi","addRemoteResource","getter","addOutput","addOutputs","addModule","module","has","symbol","createdModule","set","getModule","def","get","optional","addHandler","getParam","param","obj","Proxy","target","p","key","setter","value","modifier","currentValue","newValue","apply","v"],"sources":["createPulumiApp.ts"],"sourcesContent":["import findUp from \"find-up\";\nimport path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport { PulumiAppModuleDefinition } from \"./PulumiAppModule\";\nimport {\n PulumiAppResourceArgs,\n PulumiAppResourceConstructor,\n PulumiAppResourceType,\n PulumiAppResource,\n CreatePulumiAppResourceParams,\n PulumiAppResourceConfigSetter,\n PulumiAppResourceConfigModifier,\n PulumiAppResourceConfigProxy\n} from \"./PulumiAppResource\";\nimport {\n CreatePulumiAppParams,\n PulumiApp,\n PulumiAppParam,\n PulumiAppParamCallback,\n ResourceHandler\n} from \"~/types\";\nimport { PulumiAppRemoteResource } from \"~/PulumiAppRemoteResource\";\n\nexport function createPulumiApp<TResources extends Record<string, unknown>>(\n params: CreatePulumiAppParams<TResources>\n): PulumiApp<TResources> {\n let projectRootPath = findUp.sync(\"webiny.project.ts\");\n if (projectRootPath) {\n projectRootPath = path.dirname(projectRootPath).replace(/\\\\/g, \"/\");\n } else {\n throw new Error(\"Couldn't detect Webiny project.\");\n }\n\n const appRelativePath = params.path;\n const appRootPath = path.join(projectRootPath, appRelativePath);\n\n const projectAppWorkspacePath = path.join(\n projectRootPath,\n \".webiny\",\n \"workspaces\",\n appRelativePath\n );\n\n const app: PulumiApp<TResources> = {\n resourceHandlers: [],\n handlers: [],\n outputs: {},\n modules: new Map<symbol, unknown>(),\n paths: {\n absolute: appRootPath,\n relative: appRelativePath,\n workspace: projectAppWorkspacePath\n },\n\n resources: {} as TResources,\n name: params.name,\n program: params.program,\n params: {\n create: params.config || {},\n run: {}\n },\n\n async run(config) {\n app.params.run = config;\n\n Object.assign(app.resources, await app.program(app));\n\n for (const handler of app.handlers) {\n await handler();\n }\n\n app.params.run = {};\n\n return app.outputs;\n },\n\n onResource(handler: ResourceHandler) {\n app.resourceHandlers.push(handler);\n },\n\n /**\n * Adds a resource to pulumi app.\n * It's not running the script immediately, but enqueues the call.\n * This way we are still able to modify the config of the resource.\n * @param resourceConstructor Resource to be added, ie aws.s3.Bucket\n * @param params Parameters to configure the resource\n * @returns Object giving access to both resource outputs and its config.\n */\n addResource<T extends PulumiAppResourceConstructor>(\n resourceConstructor: T,\n params: CreatePulumiAppResourceParams<T>\n ) {\n const config = params.config ?? ({} as PulumiAppResourceArgs<T>);\n const opts = params.opts ?? {};\n const meta = params.meta ?? {};\n\n const promise = new Promise<PulumiAppResourceType<T>>(resolve => {\n app.handlers.push(() => {\n app.resourceHandlers.forEach(handler => handler(resource));\n\n resolve(new resourceConstructor(resource.name, config, opts));\n });\n });\n\n const resource: PulumiAppResource<T> = {\n name: params.name,\n type: resourceConstructor,\n config: createPulumiAppResourceConfigProxy(config),\n opts,\n meta,\n output: pulumi.output(promise)\n };\n\n return resource;\n },\n\n addRemoteResource<T>(name: string, getter: () => Promise<T>) {\n const promise = getter();\n\n const resource: PulumiAppRemoteResource<T> = {\n name,\n output: pulumi.output(promise)\n };\n\n return resource;\n },\n\n /**\n * Registers output value within pulumi app.\n * @param name Name of the output value\n * @param output Value of the output\n */\n addOutput<T>(name: string, output: T) {\n app.outputs[name] = output;\n },\n\n /**\n * Registers one or more output values.\n * @param outputs Dictionary containing output values.\n */\n addOutputs(outputs: Record<string, unknown>) {\n Object.assign(app.outputs, outputs);\n },\n\n /**\n * Registers an app module within app.\n * Allows to decompose application into smaller pieces.\n * Added module can be then retrieved with `getModule`.\n * @param module\n * @param config\n */\n addModule<TModule, TConfig>(\n module: PulumiAppModuleDefinition<TModule, TConfig>,\n config?: TConfig\n ) {\n if (app.modules.has(module.symbol)) {\n throw new Error(\n `Module \"${module.name}\" is already present in the \"${app.name}\" application.`\n );\n }\n\n const createdModule = module.run(app, config as TConfig);\n app.modules.set(module.symbol, createdModule);\n\n return createdModule;\n },\n\n /**\n * Returns a module by its definition\n * @param def\n * @param opts\n */\n getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts?: { optional: boolean }\n ) {\n const module = app.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 \"${app.name}\" app`);\n }\n }\n\n return module;\n },\n\n /**\n * Schedules a handler to be executed when running pulumi script.\n * Anything, that is returned from handler will be wrapped in pulumi.Output\n * so it can be used in other places.\n * @param handler Handler to be executed.\n * @returns Result of the handler wrapped with pulumi.Output\n */\n addHandler<T>(handler: () => Promise<T> | T) {\n const promise = new Promise<T>(resolve => {\n app.handlers.push(async () => {\n resolve(await handler());\n });\n });\n\n return pulumi.output(promise);\n },\n\n getParam<T>(param: PulumiAppParam<T>) {\n if (typeof param === \"function\") {\n return (param as PulumiAppParamCallback<T>)(app);\n }\n\n return param;\n }\n };\n\n return app;\n}\n\nfunction createPulumiAppResourceConfigProxy<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: PulumiAppResourceConfigSetter<V> = (\n value: V | PulumiAppResourceConfigModifier<V>\n ) => {\n if (typeof value === \"function\") {\n const modifier = value as PulumiAppResourceConfigModifier<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 PulumiAppResourceConfigProxy<T>;\n}\n"],"mappings":";;;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GAAGF,QAAQ,CAACI,CAAD,CAAzB;YACA,OAAO7B,MAAM,CAACD,MAAP,CAAc4B,QAAd,CAAP;UACH,CAHgB,CAAjB;UAKAP,MAAM,CAACE,GAAD,CAAN,GAAcK,QAAd;QACH,CAVD,MAUO;UACHP,MAAM,CAACE,GAAD,CAAN,GAAcE,KAAd;QACH;MACJ,CAhBD;;MAkBA,OAAOD,MAAP;IACH;;EAvBiB,CAAf,CAAP;AAyBH"}
1
+ {"version":3,"names":["_findUp","_interopRequireDefault","require","_path","pulumi","_interopRequireWildcard","_cloneDeep","_constants","createPulumiApp","params","projectRootPath","findUp","sync","path","dirname","replace","Error","appRelativePath","appRootPath","join","projectAppWorkspacePath","programDecorators","app","resourceHandlers","handlers","outputs","modules","Map","paths","absolute","relative","workspace","resources","name","program","create","config","run","env","variant","isProduction","decorateProgram","cb","push","productionEnvironments","DEFAULT_PROD_ENV_NAMES","includes","programOutput","reduce","decorator","input","Object","assign","handler","onResource","addResource","resourceConstructor","opts","meta","promise","Promise","resolve","forEach","resource","type","createPulumiAppResourceConfigProxy","output","addRemoteResource","getter","addOutput","addOutputs","addModule","module","has","symbol","createdModule","set","getModule","def","get","optional","addHandler","getParam","param","obj","Proxy","target","p","cloneDeep","key","setter","value","modifier","currentValue","newValue","apply","v"],"sources":["createPulumiApp.ts"],"sourcesContent":["import findUp from \"find-up\";\nimport path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiAppModuleDefinition } from \"./PulumiAppModule\";\nimport type {\n CreatePulumiAppResourceParams,\n PulumiAppResource,\n PulumiAppResourceArgs,\n PulumiAppResourceConfigModifier,\n PulumiAppResourceConfigProxy,\n PulumiAppResourceConfigSetter,\n PulumiAppResourceConstructor,\n PulumiAppResourceType\n} from \"./PulumiAppResource\";\nimport type {\n CreatePulumiAppParams,\n ProgramDecorator,\n PulumiApp,\n PulumiAppParam,\n PulumiAppParamCallback,\n PulumiProgram,\n ResourceHandler\n} from \"~/types\";\nimport type { PulumiAppRemoteResource } from \"~/PulumiAppRemoteResource\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport { DEFAULT_PROD_ENV_NAMES } from \"./constants\";\n\nexport function createPulumiApp<TResources extends Record<string, unknown>>(\n params: CreatePulumiAppParams<TResources>\n): PulumiApp<TResources> {\n let projectRootPath = findUp.sync(\"webiny.project.ts\");\n if (projectRootPath) {\n projectRootPath = path.dirname(projectRootPath).replace(/\\\\/g, \"/\");\n } else {\n throw new Error(\"Couldn't detect Webiny project.\");\n }\n\n const appRelativePath = params.path;\n const appRootPath = path.join(projectRootPath, appRelativePath);\n\n const projectAppWorkspacePath = path.join(\n projectRootPath,\n \".webiny\",\n \"workspaces\",\n appRelativePath\n );\n\n const programDecorators: ProgramDecorator<any, any>[] = [];\n\n const app: PulumiApp<TResources> = {\n resourceHandlers: [],\n handlers: [],\n outputs: {},\n modules: new Map<symbol, unknown>(),\n paths: {\n absolute: appRootPath,\n relative: appRelativePath,\n workspace: projectAppWorkspacePath\n },\n\n resources: {} as TResources,\n name: params.name,\n program: params.program,\n params: {\n create: params.config || {},\n run: {\n env: \"\",\n variant: \"\"\n }\n },\n env: {\n name: \"\",\n isProduction: false\n },\n decorateProgram: cb => {\n programDecorators.push(cb);\n },\n\n async run(config) {\n app.params.run = config;\n\n // Add environment-related variables.\n const productionEnvironments =\n app.params.create.productionEnvironments || DEFAULT_PROD_ENV_NAMES;\n const isProduction = productionEnvironments.includes(app.params.run.env);\n\n app.env = {\n name: app.params.run.env,\n isProduction\n };\n\n const programOutput = programDecorators.reduce<PulumiProgram<PulumiApp<TResources>>>(\n (program, decorator) => {\n return app => decorator(program, app);\n },\n (input: PulumiApp<any>) => app.program(input)\n );\n\n Object.assign(app.resources, await programOutput(app));\n\n for (const handler of app.handlers) {\n await handler();\n }\n\n app.params.run = {\n env: \"\",\n variant: \"\"\n };\n\n return app.outputs;\n },\n\n onResource(handler: ResourceHandler) {\n app.resourceHandlers.push(handler);\n },\n\n /**\n * Adds a resource to pulumi app.\n * It's not running the script immediately, but enqueues the call.\n * This way we are still able to modify the config of the resource.\n * @param resourceConstructor Resource to be added, ie aws.s3.Bucket\n * @param params Parameters to configure the resource\n * @returns Object giving access to both resource outputs and its config.\n */\n addResource<T extends PulumiAppResourceConstructor>(\n resourceConstructor: T,\n params: CreatePulumiAppResourceParams<T>\n ) {\n const config = params.config ?? ({} as PulumiAppResourceArgs<T>);\n const opts = params.opts ?? {};\n const meta = params.meta ?? {};\n\n const promise = new Promise<PulumiAppResourceType<T>>(resolve => {\n app.handlers.push(() => {\n app.resourceHandlers.forEach(handler => handler(resource));\n\n resolve(new resourceConstructor(resource.name, config, opts));\n });\n });\n\n const resource: PulumiAppResource<T> = {\n name: params.name,\n type: resourceConstructor,\n config: createPulumiAppResourceConfigProxy(config),\n opts,\n meta,\n output: pulumi.output(promise)\n };\n\n return resource;\n },\n\n addRemoteResource<T>(name: string, getter: () => Promise<T>) {\n const promise = getter();\n\n const resource: PulumiAppRemoteResource<T> = {\n name,\n output: pulumi.output(promise)\n };\n\n return resource;\n },\n\n /**\n * Registers output value within pulumi app.\n * @param name Name of the output value\n * @param output Value of the output\n */\n addOutput<T>(name: string, output: T) {\n app.outputs[name] = output;\n },\n\n /**\n * Registers one or more output values.\n * @param outputs Dictionary containing output values.\n */\n addOutputs(outputs: Record<string, unknown>) {\n Object.assign(app.outputs, outputs);\n },\n\n /**\n * Registers an app module within app.\n * Allows to decompose application into smaller pieces.\n * Added module can be then retrieved with `getModule`.\n * @param module\n * @param config\n */\n addModule<TModule, TConfig>(\n module: PulumiAppModuleDefinition<TModule, TConfig>,\n config?: TConfig\n ) {\n if (app.modules.has(module.symbol)) {\n throw new Error(\n `Module \"${module.name}\" is already present in the \"${app.name}\" application.`\n );\n }\n\n const createdModule = module.run(app, config as TConfig);\n app.modules.set(module.symbol, createdModule);\n\n return createdModule;\n },\n\n /**\n * Returns a module by its definition\n * @param def\n * @param opts\n */\n getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts?: { optional: boolean }\n ) {\n const module = app.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 \"${app.name}\" app`);\n }\n }\n\n return module;\n },\n\n /**\n * Schedules a handler to be executed when running pulumi script.\n * Anything, that is returned from handler will be wrapped in pulumi.Output\n * so it can be used in other places.\n * @param handler Handler to be executed.\n * @returns Result of the handler wrapped with pulumi.Output\n */\n addHandler<T>(handler: () => Promise<T> | T) {\n const promise = new Promise<T>(resolve => {\n app.handlers.push(async () => {\n resolve(await handler());\n });\n });\n\n return pulumi.output(promise);\n },\n\n getParam<T>(param: PulumiAppParam<T>) {\n if (typeof param === \"function\") {\n return (param as PulumiAppParamCallback<T>)(app);\n }\n\n return param;\n }\n };\n\n return app;\n}\n\nfunction createPulumiAppResourceConfigProxy<T extends object>(obj: T) {\n return new Proxy(obj, {\n get(target, p: string) {\n if (p === \"clone\") {\n return () => cloneDeep(obj);\n }\n\n type V = T[keyof T];\n const key = p as keyof T;\n const setter: PulumiAppResourceConfigSetter<V> = (\n value: V | PulumiAppResourceConfigModifier<V>\n ) => {\n if (typeof value === \"function\") {\n const modifier = value as PulumiAppResourceConfigModifier<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 PulumiAppResourceConfigProxy<T>;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAsBA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAEO,SAASM,eAAeA,CAC3BC,MAA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AC;IACjC,CAAC;IAEDuB,QAAQA,CAAIC,KAAwB,EAAE;MAClC,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;QAC7B,OAAQA,KAAK,CAA+B7D,GAAG,CAAC;MACpD;MAEA,OAAO6D,KAAK;IAChB;EACJ,CAAC;EAED,OAAO7D,GAAG;AACd;AAEA,SAAS2C,kCAAkCA,CAAmBmB,GAAM,EAAE;EAClE,OAAO,IAAIC,KAAK,CAACD,GAAG,EAAE;IAClBL,GAAGA,CAACO,MAAM,EAAEC,CAAS,EAAE;MACnB,IAAIA,CAAC,KAAK,OAAO,EAAE;QACf,OAAO,MAAM,IAAAC,kBAAS,EAACJ,GAAG,CAAC;MAC/B;MAGA,MAAMK,GAAG,GAAGF,CAAY;MACxB,MAAMG,MAAwC,GAC1CC,KAA6C,IAC5C;QACD,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;UAC7B,MAAMC,QAAQ,GAAGD,KAA2C;UAC5D,MAAME,YAAY,GAAGP,MAAM,CAACG,GAAG,CAAC;UAChC;UACA,MAAMK,QAAQ,GAAG1F,MAAM,CAAC8D,MAAM,CAAC2B,YAAY,CAAC,CAACE,KAAK,CAACC,CAAC,IAAI;YACpD,MAAMF,QAAQ,GAAGF,QAAQ,CAACI,CAAC,CAAC;YAC5B,OAAO5F,MAAM,CAAC8D,MAAM,CAAC4B,QAAQ,CAAC;UAClC,CAAC,CAAC;UAEFR,MAAM,CAACG,GAAG,CAAC,GAAGK,QAAwB;QAC1C,CAAC,MAAM;UACHR,MAAM,CAACG,GAAG,CAAC,GAAGE,KAAK;QACvB;MACJ,CAAC;MAED,OAAOD,MAAM;IACjB;EACJ,CAAC,CAAC;AACN","ignoreList":[]}
package/index.js CHANGED
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  var _createPulumiApp = require("./createPulumiApp");
8
-
9
7
  Object.keys(_createPulumiApp).forEach(function (key) {
10
8
  if (key === "default" || key === "__esModule") return;
11
9
  if (key in exports && exports[key] === _createPulumiApp[key]) return;
@@ -16,9 +14,7 @@ Object.keys(_createPulumiApp).forEach(function (key) {
16
14
  }
17
15
  });
18
16
  });
19
-
20
17
  var _isResourceOfType = require("./isResourceOfType");
21
-
22
18
  Object.keys(_isResourceOfType).forEach(function (key) {
23
19
  if (key === "default" || key === "__esModule") return;
24
20
  if (key in exports && exports[key] === _isResourceOfType[key]) return;
@@ -29,9 +25,7 @@ Object.keys(_isResourceOfType).forEach(function (key) {
29
25
  }
30
26
  });
31
27
  });
32
-
33
28
  var _PulumiAppModule = require("./PulumiAppModule");
34
-
35
29
  Object.keys(_PulumiAppModule).forEach(function (key) {
36
30
  if (key === "default" || key === "__esModule") return;
37
31
  if (key in exports && exports[key] === _PulumiAppModule[key]) return;
@@ -42,9 +36,7 @@ Object.keys(_PulumiAppModule).forEach(function (key) {
42
36
  }
43
37
  });
44
38
  });
45
-
46
39
  var _PulumiAppResource = require("./PulumiAppResource");
47
-
48
40
  Object.keys(_PulumiAppResource).forEach(function (key) {
49
41
  if (key === "default" || key === "__esModule") return;
50
42
  if (key in exports && exports[key] === _PulumiAppResource[key]) return;
@@ -55,9 +47,7 @@ Object.keys(_PulumiAppResource).forEach(function (key) {
55
47
  }
56
48
  });
57
49
  });
58
-
59
50
  var _PulumiAppRemoteResource = require("./PulumiAppRemoteResource");
60
-
61
51
  Object.keys(_PulumiAppRemoteResource).forEach(function (key) {
62
52
  if (key === "default" || key === "__esModule") return;
63
53
  if (key in exports && exports[key] === _PulumiAppRemoteResource[key]) return;
@@ -68,9 +58,7 @@ Object.keys(_PulumiAppRemoteResource).forEach(function (key) {
68
58
  }
69
59
  });
70
60
  });
71
-
72
61
  var _types = require("./types");
73
-
74
62
  Object.keys(_types).forEach(function (key) {
75
63
  if (key === "default" || key === "__esModule") return;
76
64
  if (key in exports && exports[key] === _types[key]) return;
@@ -80,4 +68,6 @@ Object.keys(_types).forEach(function (key) {
80
68
  return _types[key];
81
69
  }
82
70
  });
83
- });
71
+ });
72
+
73
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createPulumiApp\";\nexport * from \"./isResourceOfType\";\nexport * from \"./PulumiAppModule\";\nexport * from \"./PulumiAppResource\";\nexport * from \"./PulumiAppRemoteResource\";\nexport * from \"./types\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_createPulumiApp","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_isResourceOfType","_PulumiAppModule","_PulumiAppResource","_PulumiAppRemoteResource","_types"],"sources":["index.ts"],"sourcesContent":["export * from \"./createPulumiApp\";\nexport * from \"./isResourceOfType\";\nexport * from \"./PulumiAppModule\";\nexport * from \"./PulumiAppResource\";\nexport * from \"./PulumiAppRemoteResource\";\nexport * from \"./types\";\n"],"mappings":";;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA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AA;AAAAC,MAAA,CAAAC,IAAA,CAAAU,wBAAA,EAAAT,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAQ,wBAAA,CAAAR,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,wBAAA,CAAAR,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,MAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,MAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,MAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAK,MAAA,CAAAT,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { PulumiAppResource, PulumiAppResourceConstructor } from "./PulumiAppResource";
1
+ import type { PulumiAppResource, PulumiAppResourceConstructor } from "./PulumiAppResource";
2
2
  export declare function isResourceOfType<T extends PulumiAppResourceConstructor>(resource: PulumiAppResource<PulumiAppResourceConstructor>, type: T): resource is PulumiAppResource<T>;
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isResourceOfType = isResourceOfType;
7
-
8
7
  function isResourceOfType(resource, type) {
9
8
  return resource.type === type;
10
- }
9
+ }
10
+
11
+ //# sourceMappingURL=isResourceOfType.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isResourceOfType","resource","type"],"sources":["isResourceOfType.ts"],"sourcesContent":["import { PulumiAppResource, PulumiAppResourceConstructor } from \"~/PulumiAppResource\";\n\nexport function isResourceOfType<T extends PulumiAppResourceConstructor>(\n resource: PulumiAppResource<PulumiAppResourceConstructor>,\n type: T\n): resource is PulumiAppResource<T> {\n return resource.type === type;\n}\n"],"mappings":";;;;;;;AAEO,SAASA,gBAAT,CACHC,QADG,EAEHC,IAFG,EAG6B;EAChC,OAAOD,QAAQ,CAACC,IAAT,KAAkBA,IAAzB;AACH"}
1
+ {"version":3,"names":["isResourceOfType","resource","type"],"sources":["isResourceOfType.ts"],"sourcesContent":["import type { PulumiAppResource, PulumiAppResourceConstructor } from \"~/PulumiAppResource\";\n\nexport function isResourceOfType<T extends PulumiAppResourceConstructor>(\n resource: PulumiAppResource<PulumiAppResourceConstructor>,\n type: T\n): resource is PulumiAppResource<T> {\n return resource.type === type;\n}\n"],"mappings":";;;;;;AAEO,SAASA,gBAAgBA,CAC5BC,QAAyD,EACzDC,IAAO,EACyB;EAChC,OAAOD,QAAQ,CAACC,IAAI,KAAKA,IAAI;AACjC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/pulumi",
3
- "version": "0.0.0-unstable.e3f4727c56",
3
+ "version": "0.0.0-unstable.eb196ccd2f",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,21 +14,19 @@
14
14
  "directory": "dist"
15
15
  },
16
16
  "dependencies": {
17
- "@pulumi/pulumi": "^3.34.0",
18
- "find-up": "5.0.0"
17
+ "@pulumi/pulumi": "3.147.0",
18
+ "find-up": "5.0.0",
19
+ "lodash": "4.17.21"
19
20
  },
20
21
  "devDependencies": {
21
- "@babel/cli": "^7.19.3",
22
- "@babel/core": "^7.19.3",
23
- "@types/lodash": "^4.14.190",
24
- "@webiny/cli": "^0.0.0-unstable.e3f4727c56",
25
- "@webiny/project-utils": "^0.0.0-unstable.e3f4727c56",
26
- "rimraf": "^3.0.2",
27
- "typescript": "4.7.4"
22
+ "@types/lodash": "4.17.13",
23
+ "@webiny/project-utils": "0.0.0-unstable.eb196ccd2f",
24
+ "rimraf": "6.0.1",
25
+ "typescript": "5.3.3"
28
26
  },
29
27
  "scripts": {
30
- "build": "yarn webiny run build",
31
- "watch": "yarn webiny run watch"
28
+ "build": "node ../cli/bin.js run build",
29
+ "watch": "node ../cli/bin.js run watch"
32
30
  },
33
- "gitHead": "e3f4727c567484dc53e1efceacfb37dbacd7f4de"
31
+ "gitHead": "eb196ccd2f32296e10f7add6dd7220d4e3abece4"
34
32
  }
package/types.d.ts CHANGED
@@ -1,21 +1,28 @@
1
- import * as pulumi from "@pulumi/pulumi";
2
- import { PulumiAppModuleDefinition } from "./PulumiAppModule";
3
- import { PulumiAppResourceConstructor, PulumiAppResource, CreatePulumiAppResourceParams } from "./PulumiAppResource";
4
- import { PulumiAppRemoteResource } from "./PulumiAppRemoteResource";
1
+ import type * as pulumi from "@pulumi/pulumi";
2
+ import type { PulumiAppModuleDefinition } from "./PulumiAppModule";
3
+ import type { CreatePulumiAppResourceParams, PulumiAppResource, PulumiAppResourceConstructor } from "./PulumiAppResource";
4
+ import type { PulumiAppRemoteResource } from "./PulumiAppRemoteResource";
5
5
  export interface ResourceHandler {
6
6
  (resource: PulumiAppResource<PulumiAppResourceConstructor>): void;
7
7
  }
8
- export declare type PulumiAppParamCallback<T> = (app: PulumiApp) => T | undefined;
9
- export declare type PulumiAppParam<T> = T | PulumiAppParamCallback<T>;
10
- export declare type PulumiProgram<TResources = Record<string, any>> = (app: PulumiApp) => TResources | Promise<TResources>;
11
- export declare type CreateConfig = Record<string, any>;
12
- export declare type RunConfig = Record<string, any>;
8
+ export type PulumiAppParamCallback<T> = (app: PulumiApp) => T | undefined;
9
+ export type PulumiAppParam<T> = T | PulumiAppParamCallback<T>;
10
+ export type PulumiProgram<TApp = PulumiApp, TResources = Record<string, any>> = (app: TApp) => TResources | Promise<TResources>;
11
+ export type CreateConfig = Record<string, any>;
12
+ export type RunConfig = {
13
+ env: string;
14
+ variant: string | undefined;
15
+ [key: string]: string | number | undefined | boolean | Record<string, string | number | boolean | undefined>;
16
+ };
13
17
  export interface CreatePulumiAppParams<TResources extends Record<string, unknown>> {
14
18
  name: string;
15
19
  path: string;
16
20
  config?: CreateConfig;
17
21
  program(app: PulumiApp): TResources | Promise<TResources>;
18
22
  }
23
+ export interface ProgramDecorator<TApp, TResources> {
24
+ (program: PulumiProgram<TApp, TResources>, app: TApp): ReturnType<PulumiProgram<TResources>>;
25
+ }
19
26
  export interface PulumiApp<TResources = Record<string, unknown>> {
20
27
  resourceHandlers: ResourceHandler[];
21
28
  handlers: (() => void | Promise<void>)[];
@@ -27,12 +34,17 @@ export interface PulumiApp<TResources = Record<string, unknown>> {
27
34
  workspace: string;
28
35
  };
29
36
  name: string;
30
- program: PulumiProgram<TResources>;
37
+ decorateProgram: <T>(decorator: ProgramDecorator<PulumiApp<TResources> & T, TResources>) => void;
38
+ program: PulumiProgram;
31
39
  resources: TResources;
32
40
  params: {
33
41
  create: CreateConfig;
34
42
  run: RunConfig;
35
43
  };
44
+ env: {
45
+ name: string;
46
+ isProduction: boolean;
47
+ };
36
48
  run(params: RunConfig): Record<string, any>;
37
49
  onResource(handler: ResourceHandler): void;
38
50
  addResource<T extends PulumiAppResourceConstructor>(resourceConstructor: T, params: CreatePulumiAppResourceParams<T>): PulumiAppResource<T>;
package/types.js CHANGED
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { PulumiAppModuleDefinition } from \"./PulumiAppModule\";\nimport {\n PulumiAppResourceConstructor,\n PulumiAppResource,\n CreatePulumiAppResourceParams\n} from \"./PulumiAppResource\";\nimport { PulumiAppRemoteResource } from \"~/PulumiAppRemoteResource\";\n\nexport interface ResourceHandler {\n (resource: PulumiAppResource<PulumiAppResourceConstructor>): void;\n}\n\nexport type PulumiAppParamCallback<T> = (app: PulumiApp) => T | undefined;\nexport type PulumiAppParam<T> = T | PulumiAppParamCallback<T>;\n\nexport type PulumiProgram<TResources = Record<string, any>> = (\n app: PulumiApp\n) => TResources | Promise<TResources>;\n\nexport type CreateConfig = Record<string, any>;\nexport type RunConfig = Record<string, any>;\n\nexport interface CreatePulumiAppParams<TResources extends Record<string, unknown>> {\n name: string;\n path: string;\n config?: CreateConfig;\n program(app: PulumiApp): TResources | Promise<TResources>;\n}\n\nexport interface PulumiApp<TResources = Record<string, unknown>> {\n resourceHandlers: ResourceHandler[];\n handlers: (() => void | Promise<void>)[];\n outputs: Record<string, any>;\n modules: Map<symbol, unknown>;\n\n paths: { absolute: string; relative: string; workspace: string };\n name: string;\n program: PulumiProgram<TResources>;\n resources: TResources;\n params: {\n create: CreateConfig;\n run: RunConfig;\n };\n\n run(params: RunConfig): Record<string, any>;\n\n onResource(handler: ResourceHandler): void;\n\n addResource<T extends PulumiAppResourceConstructor>(\n resourceConstructor: T,\n params: CreatePulumiAppResourceParams<T>\n ): PulumiAppResource<T>;\n\n addRemoteResource<T>(name: string, getter: () => Promise<T>): PulumiAppRemoteResource<T>;\n\n addOutput<T>(name: string, output: T): void;\n addOutputs(outputs: Record<string, unknown>): void;\n\n addModule<TModule>(def: PulumiAppModuleDefinition<TModule, void>): TModule;\n addModule<TModule, TConfig>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n config: TConfig\n ): TModule;\n\n getModule<TConfig, TModule>(def: PulumiAppModuleDefinition<TModule, TConfig>): TModule;\n getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts: { optional: false }\n ): TModule;\n getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts: { optional: true }\n ): TModule | null;\n\n addHandler<T>(handler: () => Promise<T> | T): pulumi.Output<pulumi.Unwrap<T>>;\n\n getParam<T>(param: T | ((app: PulumiApp) => T)): T | undefined;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type * as pulumi from \"@pulumi/pulumi\";\nimport type { PulumiAppModuleDefinition } from \"./PulumiAppModule\";\nimport type {\n CreatePulumiAppResourceParams,\n PulumiAppResource,\n PulumiAppResourceConstructor\n} from \"./PulumiAppResource\";\nimport type { PulumiAppRemoteResource } from \"~/PulumiAppRemoteResource\";\n\nexport interface ResourceHandler {\n (resource: PulumiAppResource<PulumiAppResourceConstructor>): void;\n}\n\nexport type PulumiAppParamCallback<T> = (app: PulumiApp) => T | undefined;\nexport type PulumiAppParam<T> = T | PulumiAppParamCallback<T>;\n\nexport type PulumiProgram<TApp = PulumiApp, TResources = Record<string, any>> = (\n app: TApp\n) => TResources | Promise<TResources>;\n\nexport type CreateConfig = Record<string, any>;\nexport type RunConfig = {\n env: string;\n variant: string | undefined;\n [key: string]:\n | string\n | number\n | undefined\n | boolean\n | Record<string, string | number | boolean | undefined>;\n};\n\nexport interface CreatePulumiAppParams<TResources extends Record<string, unknown>> {\n name: string;\n path: string;\n config?: CreateConfig;\n\n program(app: PulumiApp): TResources | Promise<TResources>;\n}\n\nexport interface ProgramDecorator<TApp, TResources> {\n (program: PulumiProgram<TApp, TResources>, app: TApp): ReturnType<PulumiProgram<TResources>>;\n}\n\nexport interface PulumiApp<TResources = Record<string, unknown>> {\n resourceHandlers: ResourceHandler[];\n handlers: (() => void | Promise<void>)[];\n outputs: Record<string, any>;\n modules: Map<symbol, unknown>;\n\n paths: { absolute: string; relative: string; workspace: string };\n name: string;\n decorateProgram: <T>(\n decorator: ProgramDecorator<PulumiApp<TResources> & T, TResources>\n ) => void;\n program: PulumiProgram;\n resources: TResources;\n params: {\n create: CreateConfig;\n run: RunConfig;\n };\n env: {\n name: string;\n\n // Set to `true` if the environment into which the application is being deployed\n // is considered a production environment. The list of environment names\n // that are considered production environments is defined via the\n // `productionEnvironments` parameter. Learn more:\n // https://www.webiny.com/docs/infrastructure/basics/modify-cloud-infrastructure#defining-multiple-production-environments\n isProduction: boolean;\n };\n\n run(params: RunConfig): Record<string, any>;\n\n onResource(handler: ResourceHandler): void;\n\n addResource<T extends PulumiAppResourceConstructor>(\n resourceConstructor: T,\n params: CreatePulumiAppResourceParams<T>\n ): PulumiAppResource<T>;\n\n addRemoteResource<T>(name: string, getter: () => Promise<T>): PulumiAppRemoteResource<T>;\n\n addOutput<T>(name: string, output: T): void;\n\n addOutputs(outputs: Record<string, unknown>): void;\n\n addModule<TModule>(def: PulumiAppModuleDefinition<TModule, void>): TModule;\n\n addModule<TModule, TConfig>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n config: TConfig\n ): TModule;\n\n getModule<TConfig, TModule>(def: PulumiAppModuleDefinition<TModule, TConfig>): TModule;\n\n getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts: { optional: false }\n ): TModule;\n\n getModule<TConfig, TModule>(\n def: PulumiAppModuleDefinition<TModule, TConfig>,\n opts: { optional: true }\n ): TModule | null;\n\n addHandler<T>(handler: () => Promise<T> | T): pulumi.Output<pulumi.Unwrap<T>>;\n\n getParam<T>(param: T | ((app: PulumiApp) => T)): T | undefined;\n}\n"],"mappings":"","ignoreList":[]}