@webiny/pulumi-sdk 5.28.0 → 5.29.0-beta.2
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/Pulumi.d.ts +6 -5
- package/Pulumi.js +24 -11
- package/Pulumi.js.map +1 -1
- package/README.md +0 -13
- package/index.d.ts +0 -9
- package/index.js +0 -117
- package/index.js.map +1 -1
- package/package.json +9 -9
- package/ApplicationBuilder.d.ts +0 -40
- package/ApplicationBuilder.js +0 -37
- package/ApplicationBuilder.js.map +0 -1
- package/ApplicationBuilderGeneric.d.ts +0 -10
- package/ApplicationBuilderGeneric.js +0 -108
- package/ApplicationBuilderGeneric.js.map +0 -1
- package/ApplicationBuilderLegacy.d.ts +0 -4
- package/ApplicationBuilderLegacy.js +0 -91
- package/ApplicationBuilderLegacy.js.map +0 -1
- package/ApplicationConfig.d.ts +0 -17
- package/ApplicationConfig.js +0 -5
- package/ApplicationConfig.js.map +0 -1
- package/ApplicationHook.d.ts +0 -4
- package/ApplicationHook.js +0 -11
- package/ApplicationHook.js.map +0 -1
- package/PulumiApp.d.ts +0 -118
- package/PulumiApp.js +0 -216
- package/PulumiApp.js.map +0 -1
- package/PulumiAppModule.d.ts +0 -17
- package/PulumiAppModule.js +0 -30
- package/PulumiAppModule.js.map +0 -1
- package/PulumiResource.d.ts +0 -22
- package/PulumiResource.js +0 -48
- package/PulumiResource.js.map +0 -1
- package/utils/getPulumiWorkDir.d.ts +0 -1
- package/utils/getPulumiWorkDir.js +0 -14
- package/utils/getPulumiWorkDir.js.map +0 -1
- package/utils/getStackName.d.ts +0 -5
- package/utils/getStackName.js +0 -11
- package/utils/getStackName.js.map +0 -1
- package/utils/index.d.ts +0 -5
- package/utils/index.js +0 -70
- package/utils/index.js.map +0 -1
- package/utils/mergeAppHooks.d.ts +0 -2
- package/utils/mergeAppHooks.js +0 -20
- package/utils/mergeAppHooks.js.map +0 -1
- package/utils/stagedRollouts.d.ts +0 -15
- package/utils/stagedRollouts.js +0 -58
- package/utils/stagedRollouts.js.map +0 -1
- package/utils/tagResources.d.ts +0 -5
- package/utils/tagResources.js +0 -52
- package/utils/tagResources.js.map +0 -1
package/Pulumi.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import execa from "execa";
|
|
2
2
|
declare type Command = string | string[];
|
|
3
|
-
interface PulumiArgs {
|
|
3
|
+
export interface PulumiArgs {
|
|
4
4
|
[key: string]: string | boolean;
|
|
5
5
|
}
|
|
6
|
-
interface ExecaArgs {
|
|
6
|
+
export interface ExecaArgs {
|
|
7
7
|
env?: {
|
|
8
8
|
[key: string]: string | undefined;
|
|
9
9
|
};
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
|
-
interface Options {
|
|
12
|
+
export interface Options {
|
|
13
13
|
args?: PulumiArgs;
|
|
14
14
|
execa?: ExecaArgs;
|
|
15
15
|
beforePulumiInstall?: () => any;
|
|
16
16
|
afterPulumiInstall?: () => any;
|
|
17
17
|
pulumiFolder?: string;
|
|
18
18
|
}
|
|
19
|
-
interface RunArgs {
|
|
19
|
+
export interface RunArgs {
|
|
20
20
|
command: Command;
|
|
21
21
|
args?: PulumiArgs;
|
|
22
22
|
execa?: ExecaArgs;
|
|
23
23
|
beforePulumiInstall?: () => any;
|
|
24
24
|
afterPulumiInstall?: () => any;
|
|
25
25
|
}
|
|
26
|
-
interface InstallArgs {
|
|
26
|
+
export interface InstallArgs {
|
|
27
27
|
beforePulumiInstall?: () => any;
|
|
28
28
|
afterPulumiInstall?: () => any;
|
|
29
29
|
}
|
|
@@ -36,5 +36,6 @@ export declare class Pulumi {
|
|
|
36
36
|
constructor(options?: Options);
|
|
37
37
|
run(rawArgs: RunArgs): execa.ExecaChildProcess<string>;
|
|
38
38
|
install(rawArgs?: InstallArgs): Promise<boolean>;
|
|
39
|
+
ensureAwsPluginIsInstalled(): execa.ExecaSyncReturnValue<string> | undefined;
|
|
39
40
|
}
|
|
40
41
|
export {};
|
package/Pulumi.js
CHANGED
|
@@ -21,6 +21,8 @@ var _execa = _interopRequireDefault(require("execa"));
|
|
|
21
21
|
|
|
22
22
|
var path = _interopRequireWildcard(require("path"));
|
|
23
23
|
|
|
24
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
25
|
+
|
|
24
26
|
var _downloadBinaries = _interopRequireDefault(require("./downloadBinaries"));
|
|
25
27
|
|
|
26
28
|
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); }
|
|
@@ -47,6 +49,7 @@ class Pulumi {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
run(rawArgs) {
|
|
52
|
+
this.ensureAwsPluginIsInstalled();
|
|
50
53
|
const args = (0, _merge2.default)({}, this.options, rawArgs);
|
|
51
54
|
|
|
52
55
|
if (!Array.isArray(args.command)) {
|
|
@@ -111,22 +114,32 @@ class Pulumi {
|
|
|
111
114
|
const installed = await (0, _downloadBinaries.default)(this.pulumiDownloadFolder, args.beforePulumiInstall, args.afterPulumiInstall);
|
|
112
115
|
|
|
113
116
|
if (installed) {
|
|
114
|
-
|
|
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
|
-
});
|
|
117
|
+
this.ensureAwsPluginIsInstalled();
|
|
125
118
|
}
|
|
126
119
|
|
|
127
120
|
return installed;
|
|
128
121
|
}
|
|
129
122
|
|
|
123
|
+
ensureAwsPluginIsInstalled() {
|
|
124
|
+
const {
|
|
125
|
+
version
|
|
126
|
+
} = require("@pulumi/aws/package.json");
|
|
127
|
+
|
|
128
|
+
const pluginExists = _fsExtra.default.pathExistsSync(path.join(this.pulumiFolder, "plugins", `resource-aws-${version}`, "pulumi-resource-aws"));
|
|
129
|
+
|
|
130
|
+
if (pluginExists) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return _execa.default.sync(this.pulumiBinaryPath, ["plugin", "install", "resource", "aws", version], {
|
|
135
|
+
stdio: "inherit",
|
|
136
|
+
env: {
|
|
137
|
+
PULUMI_HOME: this.pulumiFolder,
|
|
138
|
+
PULUMI_SKIP_UPDATE_CHECK: "true"
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
exports.Pulumi = Pulumi;
|
package/Pulumi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FLAG_NON_INTERACTIVE","Pulumi","constructor","options","pulumiDownloadFolder","path","join","pulumiFolder","process","cwd","os","platform","pulumiBinaryPath","run","rawArgs","args","Array","isArray","command","finalArgs","key","value","i","length","push","execa","PATH_SEPARATOR","execaArgs","env","PATH","flags","includes","install","installed","downloadBinaries","beforePulumiInstall","afterPulumiInstall","version","require","stdio","PULUMI_HOME","PULUMI_SKIP_UPDATE_CHECK"],"sources":["Pulumi.ts"],"sourcesContent":["import os from \"os\";\nimport execa from \"execa\";\nimport * as path from \"path\";\nimport { merge, kebabCase, set } from \"lodash\";\nimport downloadBinaries from \"./downloadBinaries\";\n\ntype Command = string | string[];\
|
|
1
|
+
{"version":3,"names":["FLAG_NON_INTERACTIVE","Pulumi","constructor","options","pulumiDownloadFolder","path","join","pulumiFolder","process","cwd","os","platform","pulumiBinaryPath","run","rawArgs","ensureAwsPluginIsInstalled","args","Array","isArray","command","finalArgs","key","value","i","length","push","execa","PATH_SEPARATOR","execaArgs","env","PATH","flags","includes","install","installed","downloadBinaries","beforePulumiInstall","afterPulumiInstall","version","require","pluginExists","fs","pathExistsSync","sync","stdio","PULUMI_HOME","PULUMI_SKIP_UPDATE_CHECK"],"sources":["Pulumi.ts"],"sourcesContent":["import os from \"os\";\nimport execa from \"execa\";\nimport * as path from \"path\";\nimport fs from \"fs-extra\";\nimport { merge, kebabCase, set } from \"lodash\";\nimport downloadBinaries from \"./downloadBinaries\";\n\ntype Command = string | string[];\n\nexport interface PulumiArgs {\n [key: string]: string | boolean;\n}\n\nexport interface ExecaArgs {\n env?: {\n [key: string]: string | undefined;\n };\n [key: string]: any;\n}\n\nexport interface Options {\n args?: PulumiArgs;\n execa?: ExecaArgs;\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n\n // A folder into which the Pulumi CLI, along with all of its meta data and config files, will be set up.\n // It's recommended this folder is not checked in into a code repository, since the Pulumi CLI can store\n // sensitive information here, for example - user's Pulumi Service credentials.\n pulumiFolder?: string;\n}\n\nexport interface RunArgs {\n command: Command;\n\n args?: PulumiArgs;\n execa?: ExecaArgs;\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n}\n\nexport interface InstallArgs {\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n}\n\nexport const FLAG_NON_INTERACTIVE = \"--non-interactive\";\n\nexport class Pulumi {\n options: Options;\n pulumiFolder: string;\n pulumiDownloadFolder: string;\n pulumiBinaryPath: string;\n constructor(options: Options = {}) {\n this.options = options;\n\n this.pulumiDownloadFolder = path.join(\n options.pulumiFolder || process.cwd(),\n \"pulumi-cli\",\n os.platform()\n );\n\n this.pulumiFolder = path.join(this.pulumiDownloadFolder, \"pulumi\");\n this.pulumiBinaryPath = path.join(this.pulumiFolder, \"pulumi\");\n }\n\n run(rawArgs: RunArgs) {\n this.ensureAwsPluginIsInstalled();\n\n const args = merge({}, this.options, rawArgs);\n\n if (!Array.isArray(args.command)) {\n args.command = [args.command];\n }\n\n // 1. Prepare Pulumi args.\n const finalArgs = [];\n for (const key in args.args) {\n const value = args.args[key];\n if (!value) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n finalArgs.push(`--${kebabCase(key)}`, value[i]);\n }\n continue;\n }\n\n if (typeof value === \"boolean\") {\n finalArgs.push(`--${kebabCase(key)}`);\n continue;\n }\n\n finalArgs.push(`--${kebabCase(key)}`, value);\n }\n\n // Prepare execa args.\n if (!args.execa) {\n args.execa = {};\n }\n\n set(args.execa, \"env.PULUMI_SKIP_UPDATE_CHECK\", \"true\");\n set(args.execa, \"env.PULUMI_HOME\", this.pulumiFolder);\n\n // Use \";\" when on Windows. For Mac and Linux, use \":\".\n const PATH_SEPARATOR = os.platform() === \"win32\" ? \";\" : \":\";\n\n const execaArgs = {\n ...args.execa,\n env: {\n ...(args.execa.env || {}),\n /**\n * Due to an issue with Pulumi https://github.com/pulumi/pulumi/issues/8374, and even though this\n * commit suggests it should already work like that https://github.com/pulumi/pulumi/commit/c878916901a997a9c0ffcbed23560e19e224a6f1,\n * we need to specify the exact location of our Pulumi binaries, using the PATH environment variable, so it can correctly resolve\n * plugins necessary for custom resources and dynamic providers to work.\n */\n PATH: process.env.PATH + PATH_SEPARATOR + this.pulumiFolder\n }\n };\n\n // We want to keep the \"interactive\" output format of the Pulumi command when `--preview` flag is passed in.\n const flags =\n args.command && args.command.includes(\"preview\") ? [] : [FLAG_NON_INTERACTIVE];\n\n return execa(this.pulumiBinaryPath, [...args.command, ...finalArgs, ...flags], execaArgs);\n }\n\n async install(rawArgs?: InstallArgs): Promise<boolean> {\n const args = merge({}, this.options, rawArgs);\n\n const installed = await downloadBinaries(\n this.pulumiDownloadFolder,\n args.beforePulumiInstall,\n args.afterPulumiInstall\n );\n\n if (installed) {\n this.ensureAwsPluginIsInstalled();\n }\n\n return installed;\n }\n\n ensureAwsPluginIsInstalled() {\n const { version } = require(\"@pulumi/aws/package.json\");\n\n const pluginExists = fs.pathExistsSync(\n path.join(\n this.pulumiFolder,\n \"plugins\",\n `resource-aws-${version}`,\n \"pulumi-resource-aws\"\n )\n );\n\n if (pluginExists) {\n return;\n }\n\n return execa.sync(\n this.pulumiBinaryPath,\n [\"plugin\", \"install\", \"resource\", \"aws\", version],\n {\n stdio: \"inherit\",\n env: {\n PULUMI_HOME: this.pulumiFolder,\n PULUMI_SKIP_UPDATE_CHECK: \"true\"\n }\n }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAyCO,MAAMA,oBAAoB,GAAG,mBAA7B;;;AAEA,MAAMC,MAAN,CAAa;EAKhBC,WAAW,CAACC,OAAgB,GAAG,EAApB,EAAwB;IAAA;IAAA;IAAA;IAAA;IAC/B,KAAKA,OAAL,GAAeA,OAAf;IAEA,KAAKC,oBAAL,GAA4BC,IAAI,CAACC,IAAL,CACxBH,OAAO,CAACI,YAAR,IAAwBC,OAAO,CAACC,GAAR,EADA,EAExB,YAFwB,EAGxBC,WAAA,CAAGC,QAAH,EAHwB,CAA5B;IAMA,KAAKJ,YAAL,GAAoBF,IAAI,CAACC,IAAL,CAAU,KAAKF,oBAAf,EAAqC,QAArC,CAApB;IACA,KAAKQ,gBAAL,GAAwBP,IAAI,CAACC,IAAL,CAAU,KAAKC,YAAf,EAA6B,QAA7B,CAAxB;EACH;;EAEDM,GAAG,CAACC,OAAD,EAAmB;IAClB,KAAKC,0BAAL;IAEA,MAAMC,IAAI,GAAG,qBAAM,EAAN,EAAU,KAAKb,OAAf,EAAwBW,OAAxB,CAAb;;IAEA,IAAI,CAACG,KAAK,CAACC,OAAN,CAAcF,IAAI,CAACG,OAAnB,CAAL,EAAkC;MAC9BH,IAAI,CAACG,OAAL,GAAe,CAACH,IAAI,CAACG,OAAN,CAAf;IACH,CAPiB,CASlB;;;IACA,MAAMC,SAAS,GAAG,EAAlB;;IACA,KAAK,MAAMC,GAAX,IAAkBL,IAAI,CAACA,IAAvB,EAA6B;MACzB,MAAMM,KAAK,GAAGN,IA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
}
|
|
76
76
|
```
|
|
77
|
-
|
|
78
|
-
### Development
|
|
79
|
-
|
|
80
|
-
#### Updating versions
|
|
81
|
-
Currently, versions of the Pulumi code are hard-coded. For example, the version of Pulumi CLI we're currently downloading is set to `2.16.2`, the AWS plugin `3.22.0`. We define these in a couple of places:
|
|
82
|
-
|
|
83
|
-
1. In `src/index.ts`, check `AWS_PLUGIN_VERSION`.
|
|
84
|
-
2. In `src/downloadBinaries.ts`, check `PULUMI_VERSION`.
|
|
85
|
-
3. Finally, in `package.json`, we have the `@pulumi/aws` and `@pulumi/pulumi` in `dependencies`.
|
|
86
|
-
|
|
87
|
-
When updating versions, make sure the versions in `package.json` and in files mentioned in `1` and `2`, are synced.
|
|
88
|
-
|
|
89
|
-
And of course, once you change the version, please test with current dev repo at least. Everything should still be deployable from scratch.
|
package/index.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
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";
|
package/index.js
CHANGED
|
@@ -15,121 +15,4 @@ Object.keys(_Pulumi).forEach(function (key) {
|
|
|
15
15
|
return _Pulumi[key];
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
var _PulumiApp = require("./PulumiApp");
|
|
21
|
-
|
|
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
|
-
});
|
|
32
|
-
|
|
33
|
-
var _PulumiAppModule = require("./PulumiAppModule");
|
|
34
|
-
|
|
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
|
-
});
|
|
45
|
-
|
|
46
|
-
var _PulumiResource = require("./PulumiResource");
|
|
47
|
-
|
|
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
|
-
});
|
|
58
|
-
|
|
59
|
-
var _ApplicationConfig = require("./ApplicationConfig");
|
|
60
|
-
|
|
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
|
-
});
|
|
71
|
-
|
|
72
|
-
var _ApplicationHook = require("./ApplicationHook");
|
|
73
|
-
|
|
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
|
-
});
|
|
84
|
-
|
|
85
|
-
var _ApplicationBuilder = require("./ApplicationBuilder");
|
|
86
|
-
|
|
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
|
-
});
|
|
97
|
-
|
|
98
|
-
var _ApplicationBuilderGeneric = require("./ApplicationBuilderGeneric");
|
|
99
|
-
|
|
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
|
-
});
|
|
110
|
-
|
|
111
|
-
var _ApplicationBuilderLegacy = require("./ApplicationBuilderLegacy");
|
|
112
|
-
|
|
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
|
-
});
|
|
123
|
-
|
|
124
|
-
var _utils = require("./utils");
|
|
125
|
-
|
|
126
|
-
Object.keys(_utils).forEach(function (key) {
|
|
127
|
-
if (key === "default" || key === "__esModule") return;
|
|
128
|
-
if (key in exports && exports[key] === _utils[key]) return;
|
|
129
|
-
Object.defineProperty(exports, key, {
|
|
130
|
-
enumerable: true,
|
|
131
|
-
get: function () {
|
|
132
|
-
return _utils[key];
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
18
|
});
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Pulumi\";\
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Pulumi\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/pulumi-sdk",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.29.0-beta.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"directory": "dist"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pulumi/aws": "^
|
|
18
|
-
"@pulumi/pulumi": "^3.
|
|
17
|
+
"@pulumi/aws": "^5.8.0",
|
|
18
|
+
"@pulumi/pulumi": "^3.34.0",
|
|
19
19
|
"decompress": "4.2.1",
|
|
20
20
|
"download": "5.0.3",
|
|
21
|
-
"execa": "
|
|
21
|
+
"execa": "5.1.1",
|
|
22
|
+
"fs-extra": "9.1.0",
|
|
22
23
|
"lodash": "4.17.21",
|
|
23
24
|
"semver": "7.3.7",
|
|
24
|
-
"tar": "6.1.11"
|
|
25
|
-
"trim-newlines": "3.0.1"
|
|
25
|
+
"tar": "6.1.11"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/cli": "^7.16.0",
|
|
29
29
|
"@babel/core": "^7.16.0",
|
|
30
30
|
"@types/lodash": "^4.14.178",
|
|
31
31
|
"@types/node": "^10.0.0",
|
|
32
|
-
"@webiny/cli": "^5.
|
|
33
|
-
"@webiny/project-utils": "^5.
|
|
32
|
+
"@webiny/cli": "^5.29.0-beta.2",
|
|
33
|
+
"@webiny/project-utils": "^5.29.0-beta.2",
|
|
34
34
|
"rimraf": "^3.0.2",
|
|
35
35
|
"typescript": "4.5.5"
|
|
36
36
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"build": "yarn webiny run build",
|
|
47
47
|
"watch": "yarn webiny run watch"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "3a8c701139cca39dc1316d2452c6a3afdd7c1867"
|
|
50
50
|
}
|
package/ApplicationBuilder.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { PreviewResult, RefreshResult, UpResult } from "@pulumi/pulumi/automation";
|
|
2
|
-
import { ApplicationHooks } from "./ApplicationConfig";
|
|
3
|
-
import { ApplicationHook } from "./ApplicationHook";
|
|
4
|
-
import { Pulumi } from "./Pulumi";
|
|
5
|
-
import { PulumiApp } from "./PulumiApp";
|
|
6
|
-
export interface ApplicationStackArgs {
|
|
7
|
-
/** Root path of the application */
|
|
8
|
-
appDir: string;
|
|
9
|
-
/** Root dir of the project */
|
|
10
|
-
projectDir: string;
|
|
11
|
-
pulumi: Pulumi;
|
|
12
|
-
debug?: boolean;
|
|
13
|
-
env: string;
|
|
14
|
-
variant?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface ApplicationBuilderConfig extends Partial<ApplicationHooks> {
|
|
17
|
-
id: string;
|
|
18
|
-
name: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
cli?: Record<string, any>;
|
|
21
|
-
}
|
|
22
|
-
export interface ApplicationStack {
|
|
23
|
-
app?: PulumiApp;
|
|
24
|
-
refresh(): Promise<RefreshResult | undefined>;
|
|
25
|
-
preview(): Promise<PreviewResult | undefined>;
|
|
26
|
-
up(): Promise<UpResult | undefined>;
|
|
27
|
-
}
|
|
28
|
-
export declare abstract class ApplicationBuilder<TConfig extends ApplicationBuilderConfig = ApplicationBuilderConfig> implements ApplicationBuilderConfig {
|
|
29
|
-
readonly config: TConfig;
|
|
30
|
-
readonly id: string;
|
|
31
|
-
readonly name: string;
|
|
32
|
-
readonly description?: string;
|
|
33
|
-
readonly cli?: Record<string, any>;
|
|
34
|
-
readonly onBeforeBuild?: ApplicationHook;
|
|
35
|
-
readonly onAfterBuild?: ApplicationHook;
|
|
36
|
-
readonly onBeforeDeploy?: ApplicationHook;
|
|
37
|
-
readonly onAfterDeploy?: ApplicationHook;
|
|
38
|
-
constructor(config: TConfig);
|
|
39
|
-
abstract createOrSelectStack(args: ApplicationStackArgs): Promise<ApplicationStack>;
|
|
40
|
-
}
|
package/ApplicationBuilder.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ApplicationBuilder = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
class ApplicationBuilder {
|
|
13
|
-
// It needs to duplicate configuration props for backwards compatibility.
|
|
14
|
-
// There is a lot of CLI code, that depends on it.
|
|
15
|
-
constructor(config) {
|
|
16
|
-
this.config = config;
|
|
17
|
-
(0, _defineProperty2.default)(this, "id", void 0);
|
|
18
|
-
(0, _defineProperty2.default)(this, "name", void 0);
|
|
19
|
-
(0, _defineProperty2.default)(this, "description", void 0);
|
|
20
|
-
(0, _defineProperty2.default)(this, "cli", void 0);
|
|
21
|
-
(0, _defineProperty2.default)(this, "onBeforeBuild", void 0);
|
|
22
|
-
(0, _defineProperty2.default)(this, "onAfterBuild", void 0);
|
|
23
|
-
(0, _defineProperty2.default)(this, "onBeforeDeploy", void 0);
|
|
24
|
-
(0, _defineProperty2.default)(this, "onAfterDeploy", void 0);
|
|
25
|
-
this.id = config.id;
|
|
26
|
-
this.name = config.name;
|
|
27
|
-
this.description = config.description;
|
|
28
|
-
this.cli = config.cli;
|
|
29
|
-
this.onBeforeBuild = config.onBeforeBuild;
|
|
30
|
-
this.onAfterBuild = config.onAfterBuild;
|
|
31
|
-
this.onBeforeDeploy = config.onBeforeDeploy;
|
|
32
|
-
this.onAfterDeploy = config.onAfterDeploy;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
exports.ApplicationBuilder = ApplicationBuilder;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ApplicationBuilder","constructor","config","id","name","description","cli","onBeforeBuild","onAfterBuild","onBeforeDeploy","onAfterDeploy"],"sources":["ApplicationBuilder.ts"],"sourcesContent":["import { PreviewResult, RefreshResult, UpResult } from \"@pulumi/pulumi/automation\";\nimport { ApplicationHooks } from \"./ApplicationConfig\";\nimport { ApplicationHook } from \"./ApplicationHook\";\nimport { Pulumi } from \"./Pulumi\";\nimport { PulumiApp } from \"./PulumiApp\";\n\nexport interface ApplicationStackArgs {\n /** Root path of the application */\n appDir: string;\n /** Root dir of the project */\n projectDir: string;\n pulumi: Pulumi;\n debug?: boolean;\n env: string;\n variant?: string;\n}\n\nexport interface ApplicationBuilderConfig extends Partial<ApplicationHooks> {\n id: string;\n name: string;\n description?: string;\n cli?: Record<string, any>;\n}\n\nexport interface ApplicationStack {\n app?: PulumiApp;\n refresh(): Promise<RefreshResult | undefined>;\n preview(): Promise<PreviewResult | undefined>;\n up(): Promise<UpResult | undefined>;\n}\n\nexport abstract class ApplicationBuilder<\n TConfig extends ApplicationBuilderConfig = ApplicationBuilderConfig\n> implements ApplicationBuilderConfig\n{\n // It needs to duplicate configuration props for backwards compatibility.\n // There is a lot of CLI code, that depends on it.\n public readonly id: string;\n public readonly name: string;\n public readonly description?: string;\n public readonly cli?: Record<string, any>;\n public readonly onBeforeBuild?: ApplicationHook;\n public readonly onAfterBuild?: ApplicationHook;\n public readonly onBeforeDeploy?: ApplicationHook;\n public readonly onAfterDeploy?: ApplicationHook;\n\n constructor(public readonly config: TConfig) {\n this.id = config.id;\n this.name = config.name;\n this.description = config.description;\n this.cli = config.cli;\n this.onBeforeBuild = config.onBeforeBuild;\n this.onAfterBuild = config.onAfterBuild;\n this.onBeforeDeploy = config.onBeforeDeploy;\n this.onAfterDeploy = config.onAfterDeploy;\n }\n\n public abstract createOrSelectStack(args: ApplicationStackArgs): Promise<ApplicationStack>;\n}\n"],"mappings":";;;;;;;;;;;AA+BO,MAAeA,kBAAf,CAGP;EACI;EACA;EAUAC,WAAW,CAAiBC,MAAjB,EAAkC;IAAA,KAAjBA,MAAiB,GAAjBA,MAAiB;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IACzC,KAAKC,EAAL,GAAUD,MAAM,CAACC,EAAjB;IACA,KAAKC,IAAL,GAAYF,MAAM,CAACE,IAAnB;IACA,KAAKC,WAAL,GAAmBH,MAAM,CAACG,WAA1B;IACA,KAAKC,GAAL,GAAWJ,MAAM,CAACI,GAAlB;IACA,KAAKC,aAAL,GAAqBL,MAAM,CAACK,aAA5B;IACA,KAAKC,YAAL,GAAoBN,MAAM,CAACM,YAA3B;IACA,KAAKC,cAAL,GAAsBP,MAAM,CAACO,cAA7B;IACA,KAAKC,aAAL,GAAqBR,MAAM,CAACQ,aAA5B;EACH;;AArBL"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PulumiApp } from "./PulumiApp";
|
|
2
|
-
import { ApplicationBuilder, ApplicationBuilderConfig, ApplicationStack, ApplicationStackArgs } from "./ApplicationBuilder";
|
|
3
|
-
import { ApplicationContext } from "./ApplicationConfig";
|
|
4
|
-
export interface ApplicationGenericConfig extends ApplicationBuilderConfig {
|
|
5
|
-
app(ctx: ApplicationContext): Promise<PulumiApp> | PulumiApp;
|
|
6
|
-
}
|
|
7
|
-
export declare class ApplicationBuilderGeneric extends ApplicationBuilder<ApplicationGenericConfig> {
|
|
8
|
-
createOrSelectStack(args: ApplicationStackArgs): Promise<ApplicationStack>;
|
|
9
|
-
}
|
|
10
|
-
export declare function createGenericApplication(config: ApplicationGenericConfig): ApplicationBuilderGeneric;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ApplicationBuilderGeneric = void 0;
|
|
9
|
-
exports.createGenericApplication = createGenericApplication;
|
|
10
|
-
|
|
11
|
-
var _os = _interopRequireDefault(require("os"));
|
|
12
|
-
|
|
13
|
-
var _path = _interopRequireDefault(require("path"));
|
|
14
|
-
|
|
15
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
16
|
-
|
|
17
|
-
var _trimNewlines = _interopRequireDefault(require("trim-newlines"));
|
|
18
|
-
|
|
19
|
-
var _automation = require("@pulumi/pulumi/automation");
|
|
20
|
-
|
|
21
|
-
var _utils = require("./utils");
|
|
22
|
-
|
|
23
|
-
var _ApplicationBuilder = require("./ApplicationBuilder");
|
|
24
|
-
|
|
25
|
-
class ApplicationBuilderGeneric extends _ApplicationBuilder.ApplicationBuilder {
|
|
26
|
-
async createOrSelectStack(args) {
|
|
27
|
-
const PULUMI_SECRETS_PROVIDER = process.env["PULUMI_SECRETS_PROVIDER"]; // Use ";" when on Windows. For Mac and Linux, use ":".
|
|
28
|
-
|
|
29
|
-
const PATH_SEPARATOR = _os.default.platform() === "win32" ? ";" : ":";
|
|
30
|
-
|
|
31
|
-
const relativePath = _path.default.relative(args.projectDir, args.appDir);
|
|
32
|
-
|
|
33
|
-
const pulumiWorkDir = (0, _utils.getPulumiWorkDir)(args.projectDir, relativePath);
|
|
34
|
-
|
|
35
|
-
if (!_fs.default.existsSync(pulumiWorkDir)) {
|
|
36
|
-
_fs.default.mkdirSync(pulumiWorkDir, {
|
|
37
|
-
recursive: true
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const app = await this.config.app({
|
|
42
|
-
env: args.env,
|
|
43
|
-
variant: args.variant,
|
|
44
|
-
appDir: args.appDir,
|
|
45
|
-
projectDir: args.projectDir
|
|
46
|
-
});
|
|
47
|
-
const appController = app.createController();
|
|
48
|
-
const workspace = await _automation.LocalWorkspace.create({
|
|
49
|
-
program: () => appController.run(),
|
|
50
|
-
workDir: pulumiWorkDir,
|
|
51
|
-
projectSettings: {
|
|
52
|
-
name: this.config.name,
|
|
53
|
-
runtime: "nodejs",
|
|
54
|
-
description: this.config.description
|
|
55
|
-
},
|
|
56
|
-
secretsProvider: PULUMI_SECRETS_PROVIDER,
|
|
57
|
-
pulumiHome: args.pulumi.pulumiFolder,
|
|
58
|
-
envVars: {
|
|
59
|
-
WEBINY_ENV: args.env,
|
|
60
|
-
WEBINY_PROJECT_NAME: this.config.name,
|
|
61
|
-
// Add Pulumi CLI path to env variable, so the CLI would be properly resolved.
|
|
62
|
-
PATH: args.pulumi.pulumiFolder + PATH_SEPARATOR + (process.env.PATH ?? "")
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const stackName = (0, _utils.getStackName)({
|
|
66
|
-
env: args.env,
|
|
67
|
-
variant: args.variant
|
|
68
|
-
});
|
|
69
|
-
const stack = await _automation.Stack.createOrSelect(stackName, workspace);
|
|
70
|
-
const options = {
|
|
71
|
-
onOutput: line => console.log((0, _trimNewlines.default)(line)),
|
|
72
|
-
color: "always"
|
|
73
|
-
};
|
|
74
|
-
return {
|
|
75
|
-
app,
|
|
76
|
-
|
|
77
|
-
async refresh() {
|
|
78
|
-
return await stack.refresh(options);
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
async preview() {
|
|
82
|
-
return await stack.preview(options);
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
async up() {
|
|
86
|
-
const result = await stack.up(options);
|
|
87
|
-
const outputs = {};
|
|
88
|
-
|
|
89
|
-
for (const key of Object.keys(result.outputs)) {
|
|
90
|
-
outputs[key] = result.outputs[key].value;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
await appController.deployFinished({
|
|
94
|
-
outputs
|
|
95
|
-
});
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
exports.ApplicationBuilderGeneric = ApplicationBuilderGeneric;
|
|
105
|
-
|
|
106
|
-
function createGenericApplication(config) {
|
|
107
|
-
return new ApplicationBuilderGeneric(config);
|
|
108
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ApplicationBuilderGeneric","ApplicationBuilder","createOrSelectStack","args","PULUMI_SECRETS_PROVIDER","process","env","PATH_SEPARATOR","os","platform","relativePath","path","relative","projectDir","appDir","pulumiWorkDir","getPulumiWorkDir","fs","existsSync","mkdirSync","recursive","app","config","variant","appController","createController","workspace","LocalWorkspace","create","program","run","workDir","projectSettings","name","runtime","description","secretsProvider","pulumiHome","pulumi","pulumiFolder","envVars","WEBINY_ENV","WEBINY_PROJECT_NAME","PATH","stackName","getStackName","stack","Stack","createOrSelect","options","onOutput","line","console","log","trimNewlines","color","refresh","preview","up","result","outputs","key","Object","keys","value","deployFinished","createGenericApplication"],"sources":["ApplicationBuilderGeneric.ts"],"sourcesContent":["import os from \"os\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport trimNewlines from \"trim-newlines\";\nimport { LocalWorkspace, Stack, UpOptions } from \"@pulumi/pulumi/automation\";\n\nimport { PulumiApp } from \"./PulumiApp\";\nimport { getPulumiWorkDir, getStackName } from \"./utils\";\nimport {\n ApplicationBuilder,\n ApplicationBuilderConfig,\n ApplicationStack,\n ApplicationStackArgs\n} from \"./ApplicationBuilder\";\nimport { ApplicationContext } from \"./ApplicationConfig\";\n\nexport interface ApplicationGenericConfig extends ApplicationBuilderConfig {\n app(ctx: ApplicationContext): Promise<PulumiApp> | PulumiApp;\n}\n\nexport class ApplicationBuilderGeneric extends ApplicationBuilder<ApplicationGenericConfig> {\n public async createOrSelectStack(args: ApplicationStackArgs): Promise<ApplicationStack> {\n const PULUMI_SECRETS_PROVIDER = process.env[\"PULUMI_SECRETS_PROVIDER\"];\n\n // Use \";\" when on Windows. For Mac and Linux, use \":\".\n const PATH_SEPARATOR = os.platform() === \"win32\" ? \";\" : \":\";\n\n const relativePath = path.relative(args.projectDir, args.appDir);\n const pulumiWorkDir = getPulumiWorkDir(args.projectDir, relativePath);\n\n if (!fs.existsSync(pulumiWorkDir)) {\n fs.mkdirSync(pulumiWorkDir, { recursive: true });\n }\n\n const app = await this.config.app({\n env: args.env,\n variant: args.variant,\n appDir: args.appDir,\n projectDir: args.projectDir\n });\n\n const appController = app.createController();\n\n const workspace = await LocalWorkspace.create({\n program: () => appController.run(),\n workDir: pulumiWorkDir,\n projectSettings: {\n name: this.config.name,\n runtime: \"nodejs\",\n description: this.config.description\n },\n secretsProvider: PULUMI_SECRETS_PROVIDER,\n pulumiHome: args.pulumi.pulumiFolder,\n envVars: {\n WEBINY_ENV: args.env,\n WEBINY_PROJECT_NAME: this.config.name,\n // Add Pulumi CLI path to env variable, so the CLI would be properly resolved.\n PATH: args.pulumi.pulumiFolder + PATH_SEPARATOR + (process.env.PATH ?? \"\")\n }\n });\n\n const stackName = getStackName({\n env: args.env,\n variant: args.variant\n });\n\n const stack = await Stack.createOrSelect(stackName, workspace);\n\n type SharedOptions = Pick<UpOptions, \"onOutput\" | \"color\" | \"onEvent\">;\n const options: SharedOptions = {\n onOutput: line => console.log(trimNewlines(line)),\n color: \"always\"\n };\n\n return {\n app,\n async refresh() {\n return await stack.refresh(options);\n },\n async preview() {\n return await stack.preview(options);\n },\n async up() {\n const result = await stack.up(options);\n\n const outputs: Record<string, any> = {};\n for (const key of Object.keys(result.outputs)) {\n outputs[key] = result.outputs[key].value;\n }\n\n await appController.deployFinished({ outputs });\n return result;\n }\n };\n }\n}\n\nexport function createGenericApplication(config: ApplicationGenericConfig) {\n return new ApplicationBuilderGeneric(config);\n}\n"],"mappings":";;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AACA;;AAYO,MAAMA,yBAAN,SAAwCC,sCAAxC,CAAqF;EACxD,MAAnBC,mBAAmB,CAACC,IAAD,EAAwD;IACpF,MAAMC,uBAAuB,GAAGC,OAAO,CAACC,GAAR,CAAY,yBAAZ,CAAhC,CADoF,CAGpF;;IACA,MAAMC,cAAc,GAAGC,WAAA,CAAGC,QAAH,OAAkB,OAAlB,GAA4B,GAA5B,GAAkC,GAAzD;;IAEA,MAAMC,YAAY,GAAGC,aAAA,CAAKC,QAAL,CAAcT,IAAI,CAACU,UAAnB,EAA+BV,IAAI,CAACW,MAApC,CAArB;;IACA,MAAMC,aAAa,GAAG,IAAAC,uBAAA,EAAiBb,IAAI,CAACU,UAAtB,EAAkCH,YAAlC,CAAtB;;IAEA,IAAI,CAACO,WAAA,CAAGC,UAAH,CAAcH,aAAd,CAAL,EAAmC;MAC/BE,WAAA,CAAGE,SAAH,CAAaJ,aAAb,EAA4B;QAAEK,SAAS,EAAE;MAAb,CAA5B;IACH;;IAED,MAAMC,GAAG,GAAG,MAAM,KAAKC,MAAL,CAAYD,GAAZ,CAAgB;MAC9Bf,GAAG,EAAEH,IAAI,CAACG,GADoB;MAE9BiB,OAAO,EAAEpB,IAAI,CAACoB,OAFgB;MAG9BT,MAAM,EAAEX,IAAI,CAACW,MAHiB;MAI9BD,UAA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