pwrdrvr 0.4.0-alpha.13
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/LICENSE +21 -0
- package/README.md +241 -0
- package/bin/run +5 -0
- package/dist/commands/delete.d.ts +18 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +125 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/nextjs-version-restore.d.ts +14 -0
- package/dist/commands/nextjs-version-restore.d.ts.map +1 -0
- package/dist/commands/nextjs-version-restore.js +53 -0
- package/dist/commands/nextjs-version-restore.js.map +1 -0
- package/dist/commands/nextjs-version.d.ts +18 -0
- package/dist/commands/nextjs-version.d.ts.map +1 -0
- package/dist/commands/nextjs-version.js +103 -0
- package/dist/commands/nextjs-version.js.map +1 -0
- package/dist/commands/preflight.d.ts +19 -0
- package/dist/commands/preflight.d.ts.map +1 -0
- package/dist/commands/preflight.js +135 -0
- package/dist/commands/preflight.js.map +1 -0
- package/dist/commands/publish-static.d.ts +25 -0
- package/dist/commands/publish-static.d.ts.map +1 -0
- package/dist/commands/publish-static.js +361 -0
- package/dist/commands/publish-static.js.map +1 -0
- package/dist/commands/publish.d.ts +39 -0
- package/dist/commands/publish.d.ts.map +1 -0
- package/dist/commands/publish.js +565 -0
- package/dist/commands/publish.js.map +1 -0
- package/dist/config/Application.d.ts +26 -0
- package/dist/config/Application.d.ts.map +1 -0
- package/dist/config/Application.js +99 -0
- package/dist/config/Application.js.map +1 -0
- package/dist/config/Config.d.ts +18 -0
- package/dist/config/Config.d.ts.map +1 -0
- package/dist/config/Config.js +71 -0
- package/dist/config/Config.js.map +1 -0
- package/dist/config/Deployer.d.ts +10 -0
- package/dist/config/Deployer.d.ts.map +1 -0
- package/dist/config/Deployer.js +17 -0
- package/dist/config/Deployer.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/DeployClient.d.ts +102 -0
- package/dist/lib/DeployClient.d.ts.map +1 -0
- package/dist/lib/DeployClient.js +233 -0
- package/dist/lib/DeployClient.js.map +1 -0
- package/dist/lib/FilesExist.d.ts +5 -0
- package/dist/lib/FilesExist.d.ts.map +1 -0
- package/dist/lib/FilesExist.js +26 -0
- package/dist/lib/FilesExist.js.map +1 -0
- package/dist/lib/S3TransferUtility.d.ts +19 -0
- package/dist/lib/S3TransferUtility.d.ts.map +1 -0
- package/dist/lib/S3TransferUtility.js +94 -0
- package/dist/lib/S3TransferUtility.js.map +1 -0
- package/dist/lib/S3Uploader.d.ts +27 -0
- package/dist/lib/S3Uploader.d.ts.map +1 -0
- package/dist/lib/S3Uploader.js +77 -0
- package/dist/lib/S3Uploader.js.map +1 -0
- package/dist/lib/Versions.d.ts +33 -0
- package/dist/lib/Versions.d.ts.map +1 -0
- package/dist/lib/Versions.js +76 -0
- package/dist/lib/Versions.js.map +1 -0
- package/package.json +83 -0
- package/src/commands/delete.ts +135 -0
- package/src/commands/nextjs-version-restore.ts +70 -0
- package/src/commands/nextjs-version.ts +123 -0
- package/src/commands/preflight.ts +148 -0
- package/src/commands/publish-static.ts +416 -0
- package/src/commands/publish.ts +662 -0
- package/src/commands-deprecated/nextjs-docker-auto.skip +590 -0
- package/src/config/Application.ts +98 -0
- package/src/config/Config.ts +81 -0
- package/src/config/Deployer.ts +17 -0
- package/src/index.ts +1 -0
- package/src/lib/DeployClient.ts +334 -0
- package/src/lib/FilesExist.ts +25 -0
- package/src/lib/S3TransferUtility.spec.ts +15 -0
- package/src/lib/S3TransferUtility.ts +113 -0
- package/src/lib/S3Uploader.ts +94 -0
- package/src/lib/Versions.ts +101 -0
- package/src/lib/__snapshots__/S3TransferUtility.spec.ts.snap +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 PwrDrvr LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
`pwrdrvr` is the CLI used to deploy new MicroApps and new versions for existing MicroApps using the [MicroApps framework](https://github.com/pwrdrvr/microapps-core/).
|
|
4
|
+
|
|
5
|
+
# Table of Contents <!-- omit in toc -->
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Video Preview of Deploying an App](#video-preview-of-deploying-an-app)
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [Command - help](#command---help)
|
|
12
|
+
- [Command - preflight](#command---preflight)
|
|
13
|
+
- [Command - publish](#command---publish)
|
|
14
|
+
- [Command - publish-static](#command---publish-static)
|
|
15
|
+
- [Command - nextjs-version](#command---nextjs-version)
|
|
16
|
+
- [Command - nextjs-version-restore](#command---nextjs-version-restore)
|
|
17
|
+
- [Command - delete](#command---delete)
|
|
18
|
+
|
|
19
|
+
# Video Preview of Deploying an App
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
# Installation
|
|
24
|
+
|
|
25
|
+
`npm i -g pwrdrvr`
|
|
26
|
+
|
|
27
|
+
# Usage
|
|
28
|
+
|
|
29
|
+
## Command - help
|
|
30
|
+
|
|
31
|
+
`npx pwrdrvr help`
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
Publish tool for deploying apps and updates
|
|
35
|
+
|
|
36
|
+
VERSION
|
|
37
|
+
pwrdrvr/0.0.0 darwin-arm64 node-v18.12.1
|
|
38
|
+
|
|
39
|
+
USAGE
|
|
40
|
+
$ pwrdrvr [COMMAND]
|
|
41
|
+
|
|
42
|
+
COMMANDS
|
|
43
|
+
delete Delete app/version
|
|
44
|
+
help display help for pwrdrvr
|
|
45
|
+
nextjs-version Apply version to next.config.js overtop of 0.0.0 placeholder
|
|
46
|
+
nextjs-version-restore Restore next.config.js
|
|
47
|
+
preflight Check if app/version are available
|
|
48
|
+
publish Publish arbitrary framework app - deploy static assets to S3, alias the $LATEST Lambda
|
|
49
|
+
function, and add integration/route to API Gateway.
|
|
50
|
+
publish-static Publish arbitrary framework static app - deploy static assets to S3 only.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Command - preflight
|
|
54
|
+
|
|
55
|
+
`npx pwrdrvr preflight help`
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
Check if app/version are available
|
|
59
|
+
|
|
60
|
+
USAGE
|
|
61
|
+
$ pwrdrvr preflight
|
|
62
|
+
|
|
63
|
+
OPTIONS
|
|
64
|
+
-a, --app-name=app-name MicroApps app name (this becomes the path the app is rooted at)
|
|
65
|
+
-d, --deployer-lambda-name=deployer-lambda-name Name of the deployer lambda function
|
|
66
|
+
-n, --new-version=new-version New semantic version to apply
|
|
67
|
+
|
|
68
|
+
-o, --overwrite Allow overwrite - Warn but do not fail if version exists.
|
|
69
|
+
Discouraged outside of test envs if cacheable static files have
|
|
70
|
+
changed.
|
|
71
|
+
|
|
72
|
+
-v, --version show CLI version
|
|
73
|
+
|
|
74
|
+
--help show CLI help
|
|
75
|
+
|
|
76
|
+
EXAMPLE
|
|
77
|
+
$ pwrdrvr preflight -d microapps-deployer-dev -a release -n 0.0.13
|
|
78
|
+
✔ Preflight Version Check [0.2s]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Command - publish
|
|
82
|
+
|
|
83
|
+
`npx pwrdrvr publish help`
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
Publish arbitrary framework app - deploy static assets to S3, alias the $LATEST Lambda function, and add integration/route to API Gateway.
|
|
87
|
+
|
|
88
|
+
USAGE
|
|
89
|
+
$ pwrdrvr publish
|
|
90
|
+
|
|
91
|
+
OPTIONS
|
|
92
|
+
-a, --app-name=app-name MicroApps app name (this becomes the path the app is rooted at)
|
|
93
|
+
-d, --deployer-lambda-name=deployer-lambda-name Name of the deployer lambda function
|
|
94
|
+
|
|
95
|
+
-i, --default-file=default-file Default file to return when the app is loaded via the router
|
|
96
|
+
without a version (e.g. when app/ is requested).
|
|
97
|
+
|
|
98
|
+
-l, --app-lambda-name=app-lambda-name ARN of lambda version, alias, or function (name or ARN) to deploy
|
|
99
|
+
|
|
100
|
+
-n, --new-version=new-version New semantic version to apply
|
|
101
|
+
|
|
102
|
+
-o, --overwrite Allow overwrite - Warn but do not fail if version exists.
|
|
103
|
+
Discouraged outside of test envs if cacheable static files have
|
|
104
|
+
changed.
|
|
105
|
+
|
|
106
|
+
-s, --static-assets-path=static-assets-path Path to files to be uploaded to S3 static bucket at app/version/
|
|
107
|
+
path. Do include app/version/ in path if files are already
|
|
108
|
+
"rooted" under that path locally.
|
|
109
|
+
|
|
110
|
+
-t, --type=(apigwy|lambda-url|url|static) [default: lambda-url] Type of the application and how its
|
|
111
|
+
requests are routed
|
|
112
|
+
|
|
113
|
+
-u, --url=url URL for `url` type applications
|
|
114
|
+
|
|
115
|
+
-v, --version show CLI version
|
|
116
|
+
|
|
117
|
+
--help show CLI help
|
|
118
|
+
|
|
119
|
+
--no-cache Force revalidation of CloudFront and browser caching of static
|
|
120
|
+
assets
|
|
121
|
+
|
|
122
|
+
--startup-type=(iframe|direct) [default: iframe] How the app should be loaded
|
|
123
|
+
|
|
124
|
+
EXAMPLE
|
|
125
|
+
$ pwrdrvr publish -d microapps-deployer-dev -l microapps-app-release-dev -a release -n 0.0.21
|
|
126
|
+
✔ Get S3 Temp Credentials [1s]
|
|
127
|
+
✔ Deploy to Lambda [0.6s]
|
|
128
|
+
✔ Confirm Static Assets Folder Exists [0.0s]
|
|
129
|
+
✔ Copy Static Files to Local Upload Dir [0.0s]
|
|
130
|
+
✔ Enumerate Files to Upload to S3 [0.0s]
|
|
131
|
+
✔ Upload Static Files to S3 [1s]
|
|
132
|
+
✔ Creating MicroApp Application: release [0.0s]
|
|
133
|
+
✔ Creating MicroApp Version: 0.0.21 [1s]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Command - publish-static
|
|
137
|
+
|
|
138
|
+
`npx pwrdrvr publish-static help`
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Publish arbitrary framework static app - deploy static assets to S3 only.
|
|
142
|
+
|
|
143
|
+
USAGE
|
|
144
|
+
$ pwrdrvr publish-static
|
|
145
|
+
|
|
146
|
+
OPTIONS
|
|
147
|
+
-a, --app-name=app-name MicroApps app name (this becomes the path the app is rooted at)
|
|
148
|
+
-d, --deployer-lambda-name=deployer-lambda-name Name of the deployer lambda function
|
|
149
|
+
|
|
150
|
+
-i, --default-file=default-file Default file to return when the app is loaded via the router
|
|
151
|
+
without a version (e.g. when app/ is requested).
|
|
152
|
+
|
|
153
|
+
-n, --new-version=new-version New semantic version to apply
|
|
154
|
+
|
|
155
|
+
-o, --overwrite Allow overwrite - Warn but do not fail if version exists.
|
|
156
|
+
Discouraged outside of test envs if cacheable static files have
|
|
157
|
+
changed.
|
|
158
|
+
|
|
159
|
+
-s, --static-assets-path=static-assets-path Path to files to be uploaded to S3 static bucket at app/version/
|
|
160
|
+
path. Do include app/version/ in path if files are already
|
|
161
|
+
"rooted" under that path locally.
|
|
162
|
+
|
|
163
|
+
-v, --version show CLI version
|
|
164
|
+
|
|
165
|
+
--help show CLI help
|
|
166
|
+
|
|
167
|
+
--no-cache Force revalidation of CloudFront and browser caching of static
|
|
168
|
+
assets
|
|
169
|
+
|
|
170
|
+
EXAMPLE
|
|
171
|
+
$ pwrdrvr publish-static -d microapps-deployer-dev -l microapps-app-release-dev -a release -n 0.0.21
|
|
172
|
+
✔ Get S3 Temp Credentials [1s]
|
|
173
|
+
✔ Confirm Static Assets Folder Exists [0.0s]
|
|
174
|
+
✔ Copy Static Files to Local Upload Dir [0.0s]
|
|
175
|
+
✔ Enumerate Files to Upload to S3 [0.0s]
|
|
176
|
+
✔ Upload Static Files to S3 [1s]
|
|
177
|
+
✔ Creating MicroApp Application: release [0.0s]
|
|
178
|
+
✔ Creating MicroApp Version: 0.0.21 [1s]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Command - nextjs-version
|
|
182
|
+
|
|
183
|
+
`npx pwrdrvr nextjs-version help`
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
Apply version to next.config.js overtop of 0.0.0 placeholder
|
|
187
|
+
|
|
188
|
+
USAGE
|
|
189
|
+
$ pwrdrvr nextjs-version
|
|
190
|
+
|
|
191
|
+
OPTIONS
|
|
192
|
+
-l, --leave-copy Leave a copy of the modifed files as .modified
|
|
193
|
+
-n, --new-version=new-version New semantic version to apply
|
|
194
|
+
-v, --version show CLI version
|
|
195
|
+
--help show CLI help
|
|
196
|
+
|
|
197
|
+
EXAMPLE
|
|
198
|
+
$ pwrdrvr nextjs-version -n 0.0.13
|
|
199
|
+
✔ Modifying Config Files [0.0s]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Command - nextjs-version-restore
|
|
203
|
+
|
|
204
|
+
`npx pwrdrvr nextjs-version-restore help`
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Restore next.config.js
|
|
208
|
+
|
|
209
|
+
USAGE
|
|
210
|
+
$ pwrdrvr nextjs-version-restore
|
|
211
|
+
|
|
212
|
+
OPTIONS
|
|
213
|
+
-v, --version show CLI version
|
|
214
|
+
--help show CLI help
|
|
215
|
+
|
|
216
|
+
EXAMPLE
|
|
217
|
+
$ pwrdrvr nextjs-version-restore
|
|
218
|
+
✔ Restoring Modified Config Files [0.0s]
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Command - delete
|
|
222
|
+
|
|
223
|
+
`npx pwrdrvr delete help`
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Delete app/version
|
|
227
|
+
|
|
228
|
+
USAGE
|
|
229
|
+
$ pwrdrvr delete
|
|
230
|
+
|
|
231
|
+
OPTIONS
|
|
232
|
+
-a, --app-name=app-name MicroApps app name (this becomes the path the app is rooted at)
|
|
233
|
+
-d, --deployer-lambda-name=deployer-lambda-name Name of the deployer lambda function
|
|
234
|
+
-n, --new-version=new-version New semantic version to apply
|
|
235
|
+
-v, --version show CLI version
|
|
236
|
+
--help show CLI help
|
|
237
|
+
|
|
238
|
+
EXAMPLE
|
|
239
|
+
$ pwrdrvr delete -d microapps-deployer-dev -a release -n 0.0.13
|
|
240
|
+
✔ App/Version deleted: release/0.0.13 [1.2s]
|
|
241
|
+
```
|
package/bin/run
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Command, flags as flagsParser } from '@oclif/command';
|
|
3
|
+
export declare class DeleteCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
version: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
appName: flagsParser.IOptionFlag<string>;
|
|
10
|
+
'app-name': flagsParser.IOptionFlag<string>;
|
|
11
|
+
newVersion: flagsParser.IOptionFlag<string>;
|
|
12
|
+
'new-version': flagsParser.IOptionFlag<string>;
|
|
13
|
+
deployerLambdaName: flagsParser.IOptionFlag<string>;
|
|
14
|
+
'deployer-lambda-name': flagsParser.IOptionFlag<string>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK/D,qBAAa,aAAc,SAAQ,OAAO;IACxC,MAAM,CAAC,WAAW,SAAwB;IAE1C,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;MAyCV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA2E3B"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
const sts = tslib_1.__importStar(require("@aws-sdk/client-sts"));
|
|
7
|
+
const command_1 = require("@oclif/command");
|
|
8
|
+
const listr2_1 = require("listr2");
|
|
9
|
+
const Config_1 = require("../config/Config");
|
|
10
|
+
const DeployClient_1 = tslib_1.__importDefault(require("../lib/DeployClient"));
|
|
11
|
+
class DeleteCommand extends command_1.Command {
|
|
12
|
+
async run() {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
|
+
const config = Config_1.Config.instance;
|
|
15
|
+
// const RUNNING_TEXT = ' RUNS ';
|
|
16
|
+
// const RUNNING = chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
|
|
17
|
+
const RUNNING = ''; //chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
|
|
18
|
+
const { flags: parsedFlags } = this.parse(DeleteCommand);
|
|
19
|
+
const semVer = (_b = (_a = parsedFlags.newVersion) !== null && _a !== void 0 ? _a : parsedFlags['new-version']) !== null && _b !== void 0 ? _b : config.app.semVer;
|
|
20
|
+
const appName = (_d = (_c = parsedFlags.appName) !== null && _c !== void 0 ? _c : parsedFlags['app-name']) !== null && _d !== void 0 ? _d : config.app.name;
|
|
21
|
+
const deployerLambdaName = (_f = (_e = parsedFlags.deployerLambdaName) !== null && _e !== void 0 ? _e : parsedFlags['deployer-lambda-name']) !== null && _f !== void 0 ? _f : config.deployer.lambdaName;
|
|
22
|
+
// Override the config value
|
|
23
|
+
config.deployer.lambdaName = deployerLambdaName;
|
|
24
|
+
config.app.name = appName;
|
|
25
|
+
config.app.semVer = semVer;
|
|
26
|
+
// TODO: Pick and validate the appname/semver from the config and flags
|
|
27
|
+
// Get the account ID and region from STS
|
|
28
|
+
// TODO: Move this to the right place
|
|
29
|
+
if (config.app.awsAccountID === '' || config.app.awsRegion === '') {
|
|
30
|
+
const stsClient = new sts.STSClient({
|
|
31
|
+
maxAttempts: 8,
|
|
32
|
+
});
|
|
33
|
+
const stsResponse = await stsClient.send(new sts.GetCallerIdentityCommand({}));
|
|
34
|
+
if (config.app.awsAccountID === '') {
|
|
35
|
+
config.app.awsAccountID = stsResponse.Account;
|
|
36
|
+
}
|
|
37
|
+
if (config.app.awsRegion === '') {
|
|
38
|
+
config.app.awsRegion = stsClient.config.region;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//
|
|
42
|
+
// Setup Tasks
|
|
43
|
+
//
|
|
44
|
+
const tasks = new listr2_1.Listr([
|
|
45
|
+
{
|
|
46
|
+
title: 'Deleting Version',
|
|
47
|
+
task: async (ctx, task) => {
|
|
48
|
+
const origTitle = task.title;
|
|
49
|
+
task.title = RUNNING + origTitle;
|
|
50
|
+
// Confirm the Version Does Not Exist in Published State
|
|
51
|
+
task.output = `Deleting app/version ${config.app.name}/${semVer}`;
|
|
52
|
+
const result = await DeployClient_1.default.DeleteVersion({
|
|
53
|
+
config,
|
|
54
|
+
output: (message) => (task.output = message),
|
|
55
|
+
});
|
|
56
|
+
if (result.statusCode === 200) {
|
|
57
|
+
task.title = `App/Version deleted: ${config.app.name}/${config.app.semVer}`;
|
|
58
|
+
}
|
|
59
|
+
else if (result.statusCode === 404) {
|
|
60
|
+
task.title = `App/Version does not exist: ${config.app.name}/${config.app.semVer}`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
task.title = `App/Version delete failed: ${config.app.name}/${config.app.semVer}`;
|
|
64
|
+
throw new Error(`App/Version delete failed: ${config.app.name}/${config.app.semVer}`);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
], {
|
|
69
|
+
rendererOptions: {
|
|
70
|
+
showTimer: true,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
await tasks.run();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.DeleteCommand = DeleteCommand;
|
|
77
|
+
DeleteCommand.description = 'Delete app/version';
|
|
78
|
+
DeleteCommand.examples = [
|
|
79
|
+
`$ pwrdrvr delete -d microapps-deployer-dev -a release -n 0.0.13
|
|
80
|
+
✔ App/Version deleted: release/0.0.13 [1.2s]
|
|
81
|
+
`,
|
|
82
|
+
];
|
|
83
|
+
DeleteCommand.flags = {
|
|
84
|
+
version: command_1.flags.version({
|
|
85
|
+
char: 'v',
|
|
86
|
+
}),
|
|
87
|
+
help: command_1.flags.help(),
|
|
88
|
+
// Deprecated
|
|
89
|
+
appName: command_1.flags.string({
|
|
90
|
+
multiple: false,
|
|
91
|
+
required: false,
|
|
92
|
+
hidden: true,
|
|
93
|
+
}),
|
|
94
|
+
'app-name': command_1.flags.string({
|
|
95
|
+
char: 'a',
|
|
96
|
+
multiple: false,
|
|
97
|
+
exactlyOne: ['app-name', 'appName'],
|
|
98
|
+
description: 'MicroApps app name (this becomes the path the app is rooted at)',
|
|
99
|
+
}),
|
|
100
|
+
// Deprecated
|
|
101
|
+
newVersion: command_1.flags.string({
|
|
102
|
+
multiple: false,
|
|
103
|
+
required: false,
|
|
104
|
+
hidden: true,
|
|
105
|
+
}),
|
|
106
|
+
'new-version': command_1.flags.string({
|
|
107
|
+
char: 'n',
|
|
108
|
+
multiple: false,
|
|
109
|
+
exactlyOne: ['new-version', 'newVersion'],
|
|
110
|
+
description: 'New semantic version to apply',
|
|
111
|
+
}),
|
|
112
|
+
// Deprecated
|
|
113
|
+
deployerLambdaName: command_1.flags.string({
|
|
114
|
+
multiple: false,
|
|
115
|
+
required: false,
|
|
116
|
+
hidden: true,
|
|
117
|
+
}),
|
|
118
|
+
'deployer-lambda-name': command_1.flags.string({
|
|
119
|
+
char: 'd',
|
|
120
|
+
multiple: false,
|
|
121
|
+
exactlyOne: ['deployer-lambda-name', 'deployerLambdaName'],
|
|
122
|
+
description: 'Name of the deployer lambda function',
|
|
123
|
+
}),
|
|
124
|
+
};
|
|
125
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":";;;;AAAA,4BAA0B;AAC1B,iEAA2C;AAC3C,4CAA+D;AAC/D,mCAA+B;AAC/B,6CAA0C;AAC1C,+EAA+C;AAE/C,MAAa,aAAc,SAAQ,iBAAO;IAoDxC,KAAK,CAAC,GAAG;;QACP,MAAM,MAAM,GAAG,eAAM,CAAC,QAAQ,CAAC;QAE/B,iCAAiC;QACjC,uEAAuE;QACvE,MAAM,OAAO,GAAG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CAAC;QACzC,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;QAC1D,WAAW,EAAE,sCAAsC;KACpD,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Command } from '@oclif/command';
|
|
3
|
+
export declare class NextJSVersionRestoreCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
version: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
};
|
|
10
|
+
private VersionAndAlias;
|
|
11
|
+
private FILES_TO_MODIFY;
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=nextjs-version-restore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs-version-restore.d.ts","sourceRoot":"","sources":["../../src/commands/nextjs-version-restore.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAwB,MAAM,gBAAgB,CAAC;AAI/D,qBAAa,2BAA4B,SAAQ,OAAO;IACtD,MAAM,CAAC,WAAW,SAA4B;IAE9C,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;MAKV;IAEF,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,eAAe,CAGnB;IAEE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA0C3B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextJSVersionRestoreCommand = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const command_1 = require("@oclif/command");
|
|
6
|
+
const listr2_1 = require("listr2");
|
|
7
|
+
const Versions_1 = require("../lib/Versions");
|
|
8
|
+
class NextJSVersionRestoreCommand extends command_1.Command {
|
|
9
|
+
async run() {
|
|
10
|
+
// const RUNNING_TEXT = ' RUNS ';
|
|
11
|
+
// const RUNNING = chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
|
|
12
|
+
const RUNNING = ''; //chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
|
|
13
|
+
// const { flags: parsedFlags } =
|
|
14
|
+
this.parse(NextJSVersionRestoreCommand);
|
|
15
|
+
this.VersionAndAlias = (0, Versions_1.createVersions)('0.0.0');
|
|
16
|
+
const versionOnly = { version: this.VersionAndAlias.version };
|
|
17
|
+
this.FILES_TO_MODIFY = [{ path: 'next.config.js', versions: versionOnly }];
|
|
18
|
+
// TODO: Pick and validate the appname/semver from the config and flags
|
|
19
|
+
//
|
|
20
|
+
// Setup Tasks
|
|
21
|
+
//
|
|
22
|
+
const tasks = new listr2_1.Listr([
|
|
23
|
+
{
|
|
24
|
+
title: 'Restoring Modified Config Files',
|
|
25
|
+
task: async (ctx, task) => {
|
|
26
|
+
const origTitle = task.title;
|
|
27
|
+
task.title = RUNNING + origTitle;
|
|
28
|
+
await (0, Versions_1.restoreFiles)(this.FILES_TO_MODIFY);
|
|
29
|
+
task.title = origTitle;
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
], {
|
|
33
|
+
rendererOptions: {
|
|
34
|
+
showTimer: true,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
await tasks.run();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.NextJSVersionRestoreCommand = NextJSVersionRestoreCommand;
|
|
41
|
+
NextJSVersionRestoreCommand.description = 'Restore next.config.js';
|
|
42
|
+
NextJSVersionRestoreCommand.examples = [
|
|
43
|
+
`$ pwrdrvr nextjs-version-restore
|
|
44
|
+
✔ Restoring Modified Config Files [0.0s]
|
|
45
|
+
`,
|
|
46
|
+
];
|
|
47
|
+
NextJSVersionRestoreCommand.flags = {
|
|
48
|
+
version: command_1.flags.version({
|
|
49
|
+
char: 'v',
|
|
50
|
+
}),
|
|
51
|
+
help: command_1.flags.help(),
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=nextjs-version-restore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs-version-restore.js","sourceRoot":"","sources":["../../src/commands/nextjs-version-restore.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,4CAA+D;AAC/D,mCAA+B;AAC/B,8CAA0E;AAE1E,MAAa,2BAA4B,SAAQ,iBAAO;IAsBtD,KAAK,CAAC,GAAG;QACP,iCAAiC;QACjC,uEAAuE;QACvE,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,sDAAsD;QAE1E,iCAAiC;QACjC,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAExC,IAAI,CAAC,eAAe,GAAG,IAAA,yBAAc,EAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAE9D,IAAI,CAAC,eAAe,GAAG,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QAE3E,uEAAuE;QAEvE,EAAE;QACF,cAAc;QACd,EAAE;QAEF,MAAM,KAAK,GAAG,IAAI,cAAK,CACrB;YACE;gBACE,KAAK,EAAE,iCAAiC;gBACxC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;oBACxB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;oBAC7B,IAAI,CAAC,KAAK,GAAG,OAAO,GAAG,SAAS,CAAC;oBAEjC,MAAM,IAAA,uBAAY,EAAC,IAAI,CAAC,eAAe,CAAC,CAAC;oBAEzC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;gBACzB,CAAC;aACF;SACF,EACD;YACE,eAAe,EAAE;gBACf,SAAS,EAAE,IAAI;aAChB;SACF,CACF,CAAC;QAEF,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;;AA/DH,kEAgEC;AA/DQ,uCAAW,GAAG,wBAAwB,CAAC;AAEvC,oCAAQ,GAAG;IAChB;;CAEH;CACE,CAAC;AAEK,iCAAK,GAAG;IACb,OAAO,EAAE,eAAW,CAAC,OAAO,CAAC;QAC3B,IAAI,EAAE,GAAG;KACV,CAAC;IACF,IAAI,EAAE,eAAW,CAAC,IAAI,EAAE;CACzB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Command, flags as flagsParser } from '@oclif/command';
|
|
3
|
+
export declare class NextJSVersionCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
version: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
newVersion: flagsParser.IOptionFlag<string>;
|
|
10
|
+
'new-version': flagsParser.IOptionFlag<string>;
|
|
11
|
+
leaveCopy: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
12
|
+
'leave-copy': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
13
|
+
};
|
|
14
|
+
private VersionAndAlias;
|
|
15
|
+
private FILES_TO_MODIFY;
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=nextjs-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs-version.d.ts","sourceRoot":"","sources":["../../src/commands/nextjs-version.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK/D,qBAAa,oBAAqB,SAAQ,OAAO;IAC/C,MAAM,CAAC,WAAW,SAAkE;IAEpF,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;MA+BV;IAEF,OAAO,CAAC,eAAe,CAAY;IACnC,OAAO,CAAC,eAAe,CAGnB;IAEE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAoE3B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextJSVersionCommand = void 0;
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const command_1 = require("@oclif/command");
|
|
6
|
+
const listr2_1 = require("listr2");
|
|
7
|
+
const Versions_1 = require("../lib/Versions");
|
|
8
|
+
const Config_1 = require("../config/Config");
|
|
9
|
+
class NextJSVersionCommand extends command_1.Command {
|
|
10
|
+
async run() {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
// const RUNNING_TEXT = ' RUNS ';
|
|
13
|
+
// const RUNNING = chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
|
|
14
|
+
const RUNNING = ''; //chalk.reset.inverse.yellow.bold(RUNNING_TEXT) + ' ';
|
|
15
|
+
const { flags: parsedFlags } = this.parse(NextJSVersionCommand);
|
|
16
|
+
const semVer = (_a = parsedFlags.newVersion) !== null && _a !== void 0 ? _a : parsedFlags['new-version'];
|
|
17
|
+
const leaveFiles = (_b = parsedFlags.leaveCopy) !== null && _b !== void 0 ? _b : parsedFlags['leave-copy'];
|
|
18
|
+
// Override the config value
|
|
19
|
+
const config = Config_1.Config.instance;
|
|
20
|
+
config.app.semVer = semVer;
|
|
21
|
+
this.VersionAndAlias = (0, Versions_1.createVersions)(semVer);
|
|
22
|
+
const versionOnly = { version: this.VersionAndAlias.version };
|
|
23
|
+
this.FILES_TO_MODIFY = [{ path: 'next.config.js', versions: versionOnly }];
|
|
24
|
+
// TODO: Pick and validate the appname/semver from the config and flags
|
|
25
|
+
if (config === undefined) {
|
|
26
|
+
this.error('Failed to load the config file');
|
|
27
|
+
}
|
|
28
|
+
//
|
|
29
|
+
// Setup Tasks
|
|
30
|
+
//
|
|
31
|
+
const tasks = new listr2_1.Listr([
|
|
32
|
+
{
|
|
33
|
+
title: 'Restoring Modified Config Files',
|
|
34
|
+
task: async (ctx, task) => {
|
|
35
|
+
const origTitle = task.title;
|
|
36
|
+
task.title = RUNNING + origTitle;
|
|
37
|
+
await (0, Versions_1.restoreFiles)(this.FILES_TO_MODIFY);
|
|
38
|
+
task.title = origTitle;
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: 'Modifying Config Files',
|
|
43
|
+
task: async (ctx, task) => {
|
|
44
|
+
const origTitle = task.title;
|
|
45
|
+
task.title = RUNNING + origTitle;
|
|
46
|
+
// Modify the existing files with the new version
|
|
47
|
+
for (const fileToModify of this.FILES_TO_MODIFY) {
|
|
48
|
+
task.output = `Patching version (${this.VersionAndAlias.version}) into ${fileToModify.path}`;
|
|
49
|
+
if (!(await (0, Versions_1.writeNewVersions)(fileToModify.path, fileToModify.versions, leaveFiles))) {
|
|
50
|
+
task.output = `Failed modifying file: ${fileToModify.path}`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
task.title = origTitle;
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
], {
|
|
57
|
+
rendererOptions: {
|
|
58
|
+
showTimer: true,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
await tasks.run();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.NextJSVersionCommand = NextJSVersionCommand;
|
|
65
|
+
NextJSVersionCommand.description = 'Apply version to next.config.js overtop of 0.0.0 placeholder';
|
|
66
|
+
NextJSVersionCommand.examples = [
|
|
67
|
+
`$ pwrdrvr nextjs-version -n 0.0.13
|
|
68
|
+
✔ Modifying Config Files [0.0s]
|
|
69
|
+
`,
|
|
70
|
+
];
|
|
71
|
+
NextJSVersionCommand.flags = {
|
|
72
|
+
version: command_1.flags.version({
|
|
73
|
+
char: 'v',
|
|
74
|
+
}),
|
|
75
|
+
help: command_1.flags.help(),
|
|
76
|
+
// Deprecated
|
|
77
|
+
newVersion: command_1.flags.string({
|
|
78
|
+
multiple: false,
|
|
79
|
+
required: false,
|
|
80
|
+
hidden: true,
|
|
81
|
+
}),
|
|
82
|
+
'new-version': command_1.flags.string({
|
|
83
|
+
char: 'n',
|
|
84
|
+
multiple: false,
|
|
85
|
+
exactlyOne: ['new-version', 'newVersion'],
|
|
86
|
+
description: 'New semantic version to apply',
|
|
87
|
+
}),
|
|
88
|
+
// Deprecated
|
|
89
|
+
leaveCopy: command_1.flags.boolean({
|
|
90
|
+
char: 'l',
|
|
91
|
+
default: false,
|
|
92
|
+
required: false,
|
|
93
|
+
hidden: true,
|
|
94
|
+
exclusive: ['leave-copy'],
|
|
95
|
+
}),
|
|
96
|
+
'leave-copy': command_1.flags.boolean({
|
|
97
|
+
char: 'l',
|
|
98
|
+
default: false,
|
|
99
|
+
required: false,
|
|
100
|
+
description: 'Leave a copy of the modifed files as .modified',
|
|
101
|
+
}),
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=nextjs-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs-version.js","sourceRoot":"","sources":["../../src/commands/nextjs-version.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,4CAA+D;AAC/D,mCAA+B;AAC/B,8CAA4F;AAC5F,6CAA0C;AAE1C,MAAa,oBAAqB,SAAQ,iBAAO;IAgD/C,KAAK,CAAC,GAAG;;QACP,iCAAiC;QACjC,uEAAuE;QACvE,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,sDAAsD;QAE1E,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,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,GAAG;QACT,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,KAAK;QACf,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,CAAC,YAAY,CAAC;KAC1B,CAAC;IACF,YAAY,EAAE,eAAW,CAAC,OAAO,CAAC;QAChC,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,gDAAgD;KAC9D,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { Command, flags as flagsParser } from '@oclif/command';
|
|
3
|
+
export declare class PreflightCommand extends Command {
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
6
|
+
static flags: {
|
|
7
|
+
version: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
8
|
+
help: import("@oclif/parser/lib/flags").IBooleanFlag<void>;
|
|
9
|
+
appName: flagsParser.IOptionFlag<string>;
|
|
10
|
+
'app-name': flagsParser.IOptionFlag<string>;
|
|
11
|
+
newVersion: flagsParser.IOptionFlag<string>;
|
|
12
|
+
'new-version': flagsParser.IOptionFlag<string>;
|
|
13
|
+
deployerLambdaName: flagsParser.IOptionFlag<string>;
|
|
14
|
+
'deployer-lambda-name': flagsParser.IOptionFlag<string>;
|
|
15
|
+
overwrite: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/commands/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK/D,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,MAAM,CAAC,WAAW,SAAwC;IAE1D,MAAM,CAAC,QAAQ,WAIb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;MAgDV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiF3B"}
|