@adobe/aio-cli-plugin-app 13.1.1 → 13.1.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/README.md +29 -29
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/app/deploy.js +8 -11
- package/src/commands/app/undeploy.js +18 -16
- package/src/lib/app-helper.js +1 -1
- package/src/lib/audit-logger.js +29 -27
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ DESCRIPTION
|
|
|
72
72
|
Create, run, test, and deploy Adobe I/O Apps
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
_See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
75
|
+
_See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/index.js)_
|
|
76
76
|
|
|
77
77
|
## `aio app add`
|
|
78
78
|
|
|
@@ -90,7 +90,7 @@ DESCRIPTION
|
|
|
90
90
|
Add a new component to an existing Adobe I/O App
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
93
|
+
_See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/index.js)_
|
|
94
94
|
|
|
95
95
|
## `aio app add action`
|
|
96
96
|
|
|
@@ -115,7 +115,7 @@ ALIASES
|
|
|
115
115
|
$ aio app add actions
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
_See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
118
|
+
_See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/action.js)_
|
|
119
119
|
|
|
120
120
|
## `aio app add ci`
|
|
121
121
|
|
|
@@ -133,7 +133,7 @@ DESCRIPTION
|
|
|
133
133
|
Add CI files
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
_See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
136
|
+
_See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/ci.js)_
|
|
137
137
|
|
|
138
138
|
## `aio app add event`
|
|
139
139
|
|
|
@@ -158,7 +158,7 @@ ALIASES
|
|
|
158
158
|
$ aio app add events
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
_See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
161
|
+
_See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/event.js)_
|
|
162
162
|
|
|
163
163
|
## `aio app add extension`
|
|
164
164
|
|
|
@@ -184,7 +184,7 @@ ALIASES
|
|
|
184
184
|
$ aio app add extensions
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
_See code: [src/commands/app/add/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
187
|
+
_See code: [src/commands/app/add/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/extension.js)_
|
|
188
188
|
|
|
189
189
|
## `aio app add service`
|
|
190
190
|
|
|
@@ -208,7 +208,7 @@ ALIASES
|
|
|
208
208
|
$ aio app add services
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
-
_See code: [src/commands/app/add/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
211
|
+
_See code: [src/commands/app/add/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/service.js)_
|
|
212
212
|
|
|
213
213
|
## `aio app add web-assets`
|
|
214
214
|
|
|
@@ -229,7 +229,7 @@ DESCRIPTION
|
|
|
229
229
|
Add web assets support
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
_See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
232
|
+
_See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/add/web-assets.js)_
|
|
233
233
|
|
|
234
234
|
## `aio app build`
|
|
235
235
|
|
|
@@ -259,7 +259,7 @@ DESCRIPTION
|
|
|
259
259
|
Use the --force-build flag to force a build even if one already exists.
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
_See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
262
|
+
_See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/build.js)_
|
|
263
263
|
|
|
264
264
|
## `aio app create [PATH]`
|
|
265
265
|
|
|
@@ -281,7 +281,7 @@ DESCRIPTION
|
|
|
281
281
|
Create a new Adobe I/O App with default parameters
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
_See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
284
|
+
_See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/create.js)_
|
|
285
285
|
|
|
286
286
|
## `aio app delete`
|
|
287
287
|
|
|
@@ -299,7 +299,7 @@ DESCRIPTION
|
|
|
299
299
|
Delete a component from an existing Adobe I/O App
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
_See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
302
|
+
_See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/delete/index.js)_
|
|
303
303
|
|
|
304
304
|
## `aio app delete action [ACTION-NAME]`
|
|
305
305
|
|
|
@@ -325,7 +325,7 @@ ALIASES
|
|
|
325
325
|
$ aio app delete actions
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
-
_See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
328
|
+
_See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/delete/action.js)_
|
|
329
329
|
|
|
330
330
|
## `aio app delete ci`
|
|
331
331
|
|
|
@@ -344,7 +344,7 @@ DESCRIPTION
|
|
|
344
344
|
Delete existing CI files
|
|
345
345
|
```
|
|
346
346
|
|
|
347
|
-
_See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
347
|
+
_See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/delete/ci.js)_
|
|
348
348
|
|
|
349
349
|
## `aio app delete extension`
|
|
350
350
|
|
|
@@ -370,7 +370,7 @@ ALIASES
|
|
|
370
370
|
$ aio app delete extensions
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
_See code: [src/commands/app/delete/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
373
|
+
_See code: [src/commands/app/delete/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/delete/extension.js)_
|
|
374
374
|
|
|
375
375
|
## `aio app delete service`
|
|
376
376
|
|
|
@@ -394,7 +394,7 @@ ALIASES
|
|
|
394
394
|
$ aio app delete services
|
|
395
395
|
```
|
|
396
396
|
|
|
397
|
-
_See code: [src/commands/app/delete/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
397
|
+
_See code: [src/commands/app/delete/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/delete/service.js)_
|
|
398
398
|
|
|
399
399
|
## `aio app delete web-assets`
|
|
400
400
|
|
|
@@ -413,7 +413,7 @@ DESCRIPTION
|
|
|
413
413
|
Delete existing web assets
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
_See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
416
|
+
_See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/delete/web-assets.js)_
|
|
417
417
|
|
|
418
418
|
## `aio app deploy`
|
|
419
419
|
|
|
@@ -459,7 +459,7 @@ DESCRIPTION
|
|
|
459
459
|
Use the --force-deploy flag to force deploy changes, regardless of production Workspace being published in Exchange.
|
|
460
460
|
```
|
|
461
461
|
|
|
462
|
-
_See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
462
|
+
_See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/deploy.js)_
|
|
463
463
|
|
|
464
464
|
## `aio app get-url [ACTION]`
|
|
465
465
|
|
|
@@ -482,7 +482,7 @@ DESCRIPTION
|
|
|
482
482
|
Get action URLs
|
|
483
483
|
```
|
|
484
484
|
|
|
485
|
-
_See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
485
|
+
_See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/get-url.js)_
|
|
486
486
|
|
|
487
487
|
## `aio app info`
|
|
488
488
|
|
|
@@ -504,7 +504,7 @@ DESCRIPTION
|
|
|
504
504
|
Display settings/configuration in use by an Adobe I/O App
|
|
505
505
|
```
|
|
506
506
|
|
|
507
|
-
_See code: [src/commands/app/info.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
507
|
+
_See code: [src/commands/app/info.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/info.js)_
|
|
508
508
|
|
|
509
509
|
## `aio app init [PATH]`
|
|
510
510
|
|
|
@@ -543,7 +543,7 @@ DESCRIPTION
|
|
|
543
543
|
Create a new Adobe I/O App
|
|
544
544
|
```
|
|
545
545
|
|
|
546
|
-
_See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
546
|
+
_See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/init.js)_
|
|
547
547
|
|
|
548
548
|
## `aio app install PATH`
|
|
549
549
|
|
|
@@ -566,7 +566,7 @@ DESCRIPTION
|
|
|
566
566
|
This command will support installing apps packaged by 'aio app pack'.
|
|
567
567
|
```
|
|
568
568
|
|
|
569
|
-
_See code: [src/commands/app/install.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
569
|
+
_See code: [src/commands/app/install.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/install.js)_
|
|
570
570
|
|
|
571
571
|
## `aio app list`
|
|
572
572
|
|
|
@@ -584,7 +584,7 @@ DESCRIPTION
|
|
|
584
584
|
List components for Adobe I/O App
|
|
585
585
|
```
|
|
586
586
|
|
|
587
|
-
_See code: [src/commands/app/list/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
587
|
+
_See code: [src/commands/app/list/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/list/index.js)_
|
|
588
588
|
|
|
589
589
|
## `aio app list extension`
|
|
590
590
|
|
|
@@ -609,7 +609,7 @@ ALIASES
|
|
|
609
609
|
$ aio app list extensions
|
|
610
610
|
```
|
|
611
611
|
|
|
612
|
-
_See code: [src/commands/app/list/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
612
|
+
_See code: [src/commands/app/list/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/list/extension.js)_
|
|
613
613
|
|
|
614
614
|
## `aio app logs`
|
|
615
615
|
|
|
@@ -633,7 +633,7 @@ DESCRIPTION
|
|
|
633
633
|
Fetch logs for an Adobe I/O App
|
|
634
634
|
```
|
|
635
635
|
|
|
636
|
-
_See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
636
|
+
_See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/logs.js)_
|
|
637
637
|
|
|
638
638
|
## `aio app pack [PATH]`
|
|
639
639
|
|
|
@@ -655,7 +655,7 @@ DESCRIPTION
|
|
|
655
655
|
This command will support packaging apps for redistribution.
|
|
656
656
|
```
|
|
657
657
|
|
|
658
|
-
_See code: [src/commands/app/pack.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
658
|
+
_See code: [src/commands/app/pack.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/pack.js)_
|
|
659
659
|
|
|
660
660
|
## `aio app run`
|
|
661
661
|
|
|
@@ -679,7 +679,7 @@ DESCRIPTION
|
|
|
679
679
|
Run an Adobe I/O App
|
|
680
680
|
```
|
|
681
681
|
|
|
682
|
-
_See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
682
|
+
_See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/run.js)_
|
|
683
683
|
|
|
684
684
|
## `aio app test`
|
|
685
685
|
|
|
@@ -707,7 +707,7 @@ DESCRIPTION
|
|
|
707
707
|
If the extension has a hook called 'test' in its 'ext.config.yaml', the script specified will be run instead.
|
|
708
708
|
```
|
|
709
709
|
|
|
710
|
-
_See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
710
|
+
_See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/test.js)_
|
|
711
711
|
|
|
712
712
|
## `aio app undeploy`
|
|
713
713
|
|
|
@@ -732,7 +732,7 @@ DESCRIPTION
|
|
|
732
732
|
Undeploys an Adobe I/O App
|
|
733
733
|
```
|
|
734
734
|
|
|
735
|
-
_See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
735
|
+
_See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/undeploy.js)_
|
|
736
736
|
|
|
737
737
|
## `aio app use [CONFIG_FILE_PATH]`
|
|
738
738
|
|
|
@@ -779,5 +779,5 @@ DESCRIPTION
|
|
|
779
779
|
page in https://developer.adobe.com/console/
|
|
780
780
|
```
|
|
781
781
|
|
|
782
|
-
_See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.
|
|
782
|
+
_See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/13.1.2/src/commands/app/use.js)_
|
|
783
783
|
<!-- commandsstop -->
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -64,7 +64,7 @@ class Deploy extends BuildCommand {
|
|
|
64
64
|
const lfConfig = lf.getLocalConfigWithSecrets()
|
|
65
65
|
if (lfConfig.isDefined()) {
|
|
66
66
|
await lf.updateServerConfig(lfConfig)
|
|
67
|
-
spinner.succeed(chalk.green(
|
|
67
|
+
spinner.succeed(chalk.green(`\nLog forwarding is set to '${lfConfig.getDestination()}'`))
|
|
68
68
|
} else {
|
|
69
69
|
if (flags.verbose) {
|
|
70
70
|
spinner.info(chalk.dim('Log forwarding is not updated: no configuration is provided'))
|
|
@@ -93,14 +93,6 @@ class Deploy extends BuildCommand {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// 3. send deploy log event
|
|
97
|
-
const logEvent = getAuditLogEvent(flags, aioConfig.project, 'AB_APP_DEPLOY')
|
|
98
|
-
if (logEvent) {
|
|
99
|
-
await sendAuditLogs(cliDetails.accessToken, logEvent, cliDetails.env)
|
|
100
|
-
} else {
|
|
101
|
-
this.log(chalk.red(chalk.bold('Warning: No valid config data found to send audit log event for deployment.')))
|
|
102
|
-
}
|
|
103
|
-
|
|
104
96
|
// 4. deploy actions and web assets for each extension
|
|
105
97
|
// Possible improvements:
|
|
106
98
|
// - parallelize
|
|
@@ -112,9 +104,14 @@ class Deploy extends BuildCommand {
|
|
|
112
104
|
if (v.app.hasFrontend && flags['web-assets']) {
|
|
113
105
|
const opItems = getFilesCountWithExtension(v.web.distProd)
|
|
114
106
|
const assetDeployedLogEvent = getAuditLogEvent(flags, aioConfig.project, 'AB_APP_ASSETS_DEPLOYED')
|
|
115
|
-
if (assetDeployedLogEvent) {
|
|
107
|
+
if (assetDeployedLogEvent && cliDetails?.accessToken) {
|
|
116
108
|
assetDeployedLogEvent.data.opItems = opItems
|
|
117
|
-
|
|
109
|
+
try {
|
|
110
|
+
// only send logs in case of web-assets deployment
|
|
111
|
+
await sendAuditLogs(cliDetails.accessToken, assetDeployedLogEvent, cliDetails.env)
|
|
112
|
+
} catch (error) {
|
|
113
|
+
this.warn('Error: Audit Log Service Error: Failed to send audit log event for deployment.')
|
|
114
|
+
}
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
}
|
|
@@ -27,16 +27,21 @@ class Undeploy extends BaseCommand {
|
|
|
27
27
|
const { flags } = await this.parse(Undeploy)
|
|
28
28
|
|
|
29
29
|
const undeployConfigs = await this.getAppExtConfigs(flags)
|
|
30
|
+
|
|
31
|
+
// 1. undeploy actions and web assets for each extension
|
|
32
|
+
const keys = Object.keys(undeployConfigs)
|
|
33
|
+
const values = Object.values(undeployConfigs)
|
|
34
|
+
|
|
35
|
+
// if it is standalone app, unpublish it without token
|
|
36
|
+
const isStandaloneApp = (keys.length === 1 && keys[0] === 'application')
|
|
37
|
+
flags.unpublish = flags.unpublish && !isStandaloneApp
|
|
38
|
+
|
|
30
39
|
let libConsoleCLI
|
|
31
40
|
if (flags.unpublish) {
|
|
32
41
|
// force login at beginning (if required)
|
|
33
42
|
libConsoleCLI = await this.getLibConsoleCLI()
|
|
34
43
|
}
|
|
35
44
|
|
|
36
|
-
// 1. undeploy actions and web assets for each extension
|
|
37
|
-
const keys = Object.keys(undeployConfigs)
|
|
38
|
-
const values = Object.values(undeployConfigs)
|
|
39
|
-
|
|
40
45
|
if (
|
|
41
46
|
(!flags.unpublish && !flags['web-assets'] && !flags.actions)
|
|
42
47
|
) {
|
|
@@ -46,28 +51,25 @@ class Undeploy extends BaseCommand {
|
|
|
46
51
|
const spinner = ora()
|
|
47
52
|
try {
|
|
48
53
|
const aioConfig = (await this.getFullConfig()).aio
|
|
49
|
-
const cliDetails = await getCliInfo()
|
|
50
|
-
const logEvent = getAuditLogEvent(flags, aioConfig.project, 'AB_APP_UNDEPLOY')
|
|
51
|
-
|
|
52
|
-
// 1.1. send audit log event for successful undeploy
|
|
53
|
-
if (logEvent) {
|
|
54
|
-
await sendAuditLogs(cliDetails.accessToken, logEvent, cliDetails.env)
|
|
55
|
-
} else {
|
|
56
|
-
this.log(chalk.red(chalk.bold('Warning: No valid config data found to send audit log event for deployment.')))
|
|
57
|
-
}
|
|
54
|
+
const cliDetails = await getCliInfo(flags.unpublish)
|
|
58
55
|
|
|
59
56
|
for (let i = 0; i < keys.length; ++i) {
|
|
60
57
|
const k = keys[i]
|
|
61
58
|
const v = values[i]
|
|
62
59
|
await this.undeployOneExt(k, v, flags, spinner)
|
|
63
60
|
const assetUndeployLogEvent = getAuditLogEvent(flags, aioConfig.project, 'AB_APP_ASSETS_UNDEPLOYED')
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
// send logs for case of web-assets undeployment
|
|
62
|
+
if (assetUndeployLogEvent && cliDetails?.accessToken) {
|
|
63
|
+
try {
|
|
64
|
+
await sendAuditLogs(cliDetails.accessToken, assetUndeployLogEvent, cliDetails.env)
|
|
65
|
+
} catch (error) {
|
|
66
|
+
this.warn('Warning: Audit Log Service Error: Failed to send audit log event for un-deployment.')
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
// 1.2. unpublish extension manifest
|
|
70
|
-
if (flags.unpublish
|
|
72
|
+
if (flags.unpublish) {
|
|
71
73
|
const payload = await this.unpublishExtensionPoints(libConsoleCLI, undeployConfigs, aioConfig, flags['force-unpublish'])
|
|
72
74
|
this.log(chalk.blue(chalk.bold(`New Extension Point(s) in Workspace '${aioConfig.project.workspace.name}': '${Object.keys(payload.endpoints)}'`)))
|
|
73
75
|
} else {
|
package/src/lib/app-helper.js
CHANGED
|
@@ -155,7 +155,7 @@ async function runScript (command, dir, cmdArgs = []) {
|
|
|
155
155
|
aioLogger.debug(`Killing ${command} event hook long-running process (pid: ${pid})`)
|
|
156
156
|
process.kill(pid, 'SIGTERM')
|
|
157
157
|
} catch (_) {
|
|
158
|
-
|
|
158
|
+
// do nothing if pid not found
|
|
159
159
|
}
|
|
160
160
|
})
|
|
161
161
|
}
|
package/src/lib/audit-logger.js
CHANGED
|
@@ -12,18 +12,16 @@ const fetch = require('node-fetch')
|
|
|
12
12
|
const fs = require('fs')
|
|
13
13
|
const path = require('path')
|
|
14
14
|
const chalk = require('chalk')
|
|
15
|
-
const { getCliEnv, PROD_ENV } = require('@adobe/aio-lib-env')
|
|
16
|
-
const aioLogger = require('@adobe/aio-lib-core-logging')('@adobe/aio-cli-plugin-app:lib-audit-logger', { provider: 'debug' })
|
|
17
15
|
|
|
18
16
|
const OPERATIONS = {
|
|
19
17
|
AB_APP_DEPLOY: 'ab_app_deploy',
|
|
20
18
|
AB_APP_UNDEPLOY: 'ab_app_undeploy',
|
|
21
|
-
AB_APP_TEST: 'ab_app_test',
|
|
19
|
+
AB_APP_TEST: 'ab_app_test',
|
|
22
20
|
AB_APP_ASSETS_DEPLOYED: 'ab_app_assets_deployed',
|
|
23
21
|
AB_APP_ASSETS_UNDEPLOYED: 'ab_app_assets_undeployed'
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
const
|
|
24
|
+
const AUDIT_SERVICE_ENDPOINTS = {
|
|
27
25
|
stage: 'https://adp-auditlog-service-stage.adobeioruntime.net/api/v1/web/audit-log-api/event-post',
|
|
28
26
|
prod: 'https://adp-auditlog-service-prod.adobeioruntime.net/api/v1/web/audit-log-api/event-post'
|
|
29
27
|
}
|
|
@@ -35,12 +33,7 @@ const AUDIT_SERVICE_ENPOINTS = {
|
|
|
35
33
|
* @param {string} env valid env stage|prod
|
|
36
34
|
*/
|
|
37
35
|
async function sendAuditLogs (accessToken, logEvent, env = 'prod') {
|
|
38
|
-
|
|
39
|
-
// remove this check once the service is available in prod
|
|
40
|
-
if (env !== 'stage') {
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
const url = AUDIT_SERVICE_ENPOINTS[env]
|
|
36
|
+
const url = AUDIT_SERVICE_ENDPOINTS[env] ?? AUDIT_SERVICE_ENDPOINTS.prod
|
|
44
37
|
const payload = {
|
|
45
38
|
event: logEvent
|
|
46
39
|
}
|
|
@@ -67,11 +60,6 @@ async function sendAuditLogs (accessToken, logEvent, env = 'prod') {
|
|
|
67
60
|
* @returns {object} logEvent
|
|
68
61
|
*/
|
|
69
62
|
function getAuditLogEvent (flags, project, event) {
|
|
70
|
-
if (getCliEnv() === PROD_ENV) {
|
|
71
|
-
aioLogger.debug('Audit logging is currently disabled in production environment')
|
|
72
|
-
return null
|
|
73
|
-
}
|
|
74
|
-
|
|
75
63
|
let logEvent, logStrMsg
|
|
76
64
|
if (project && project.org && project.workspace) {
|
|
77
65
|
if (event === 'AB_APP_DEPLOY') {
|
|
@@ -113,7 +101,7 @@ function getFilesCountWithExtension (directory) {
|
|
|
113
101
|
return log
|
|
114
102
|
}
|
|
115
103
|
|
|
116
|
-
const files = fs.readdirSync(directory)
|
|
104
|
+
const files = fs.readdirSync(directory, { recursive: true })
|
|
117
105
|
|
|
118
106
|
if (files.length === 0) {
|
|
119
107
|
this.log(chalk.red(chalk.bold(`Error: No files found in directory ${directory}.`)))
|
|
@@ -121,7 +109,6 @@ function getFilesCountWithExtension (directory) {
|
|
|
121
109
|
}
|
|
122
110
|
|
|
123
111
|
const fileTypeCounts = {}
|
|
124
|
-
|
|
125
112
|
files.forEach(file => {
|
|
126
113
|
const ext = path.extname(file).toLowerCase() || 'no extension'
|
|
127
114
|
if (fileTypeCounts[ext]) {
|
|
@@ -134,23 +121,38 @@ function getFilesCountWithExtension (directory) {
|
|
|
134
121
|
Object.keys(fileTypeCounts).forEach(ext => {
|
|
135
122
|
const count = fileTypeCounts[ext]
|
|
136
123
|
let description
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
124
|
+
switch (ext) {
|
|
125
|
+
case '.js':
|
|
126
|
+
description = 'Javascript file(s)'
|
|
127
|
+
break
|
|
128
|
+
case '.css':
|
|
129
|
+
description = 'CSS file(s)'
|
|
130
|
+
break
|
|
131
|
+
case '.html':
|
|
132
|
+
description = 'HTML page(s)'
|
|
133
|
+
break
|
|
134
|
+
case '.png':
|
|
135
|
+
case '.jpg':
|
|
136
|
+
case '.jpeg':
|
|
137
|
+
case '.gif':
|
|
138
|
+
case '.svg':
|
|
139
|
+
case '.webp':
|
|
140
|
+
description = `${ext} image(s)`
|
|
141
|
+
break
|
|
142
|
+
case 'no extension':
|
|
143
|
+
description = 'file(s) without extension'
|
|
144
|
+
break
|
|
145
|
+
default:
|
|
146
|
+
description = `${ext} file(s)`
|
|
147
|
+
}
|
|
145
148
|
log.push(`${count} ${description}\n`)
|
|
146
149
|
})
|
|
147
|
-
|
|
148
150
|
return log
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
module.exports = {
|
|
152
154
|
sendAuditLogs,
|
|
153
155
|
getAuditLogEvent,
|
|
154
|
-
|
|
156
|
+
AUDIT_SERVICE_ENDPOINTS,
|
|
155
157
|
getFilesCountWithExtension
|
|
156
158
|
}
|