@adobe/aio-cli-plugin-app 14.5.2 → 14.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -75,7 +75,7 @@ DESCRIPTION
75
75
  Create, run, test, and deploy Adobe I/O Apps
76
76
  ```
77
77
 
78
- _See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/index.js)_
78
+ _See code: [src/commands/app/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/index.js)_
79
79
 
80
80
  ## `aio app add`
81
81
 
@@ -94,7 +94,7 @@ DESCRIPTION
94
94
  Add a new component to an existing Adobe I/O App
95
95
  ```
96
96
 
97
- _See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/index.js)_
97
+ _See code: [src/commands/app/add/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/index.js)_
98
98
 
99
99
  ## `aio app add action`
100
100
 
@@ -120,7 +120,7 @@ ALIASES
120
120
  $ aio app add actions
121
121
  ```
122
122
 
123
- _See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/action.js)_
123
+ _See code: [src/commands/app/add/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/action.js)_
124
124
 
125
125
  ## `aio app add ci`
126
126
 
@@ -139,7 +139,7 @@ DESCRIPTION
139
139
  Add CI files
140
140
  ```
141
141
 
142
- _See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/ci.js)_
142
+ _See code: [src/commands/app/add/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/ci.js)_
143
143
 
144
144
  ## `aio app add event`
145
145
 
@@ -165,7 +165,7 @@ ALIASES
165
165
  $ aio app add events
166
166
  ```
167
167
 
168
- _See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/event.js)_
168
+ _See code: [src/commands/app/add/event.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/event.js)_
169
169
 
170
170
  ## `aio app add extension`
171
171
 
@@ -192,7 +192,7 @@ ALIASES
192
192
  $ aio app add extensions
193
193
  ```
194
194
 
195
- _See code: [src/commands/app/add/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/extension.js)_
195
+ _See code: [src/commands/app/add/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/extension.js)_
196
196
 
197
197
  ## `aio app add service`
198
198
 
@@ -217,7 +217,7 @@ ALIASES
217
217
  $ aio app add services
218
218
  ```
219
219
 
220
- _See code: [src/commands/app/add/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/service.js)_
220
+ _See code: [src/commands/app/add/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/service.js)_
221
221
 
222
222
  ## `aio app add web-assets`
223
223
 
@@ -239,7 +239,7 @@ DESCRIPTION
239
239
  Add web assets support
240
240
  ```
241
241
 
242
- _See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/add/web-assets.js)_
242
+ _See code: [src/commands/app/add/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/add/web-assets.js)_
243
243
 
244
244
  ## `aio app build`
245
245
 
@@ -270,7 +270,7 @@ DESCRIPTION
270
270
  Use the --force-build flag to force a build even if one already exists.
271
271
  ```
272
272
 
273
- _See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/build.js)_
273
+ _See code: [src/commands/app/build.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/build.js)_
274
274
 
275
275
  ## `aio app clean`
276
276
 
@@ -296,7 +296,7 @@ DESCRIPTION
296
296
  Note that this will require a full rebuild on your next build command.
297
297
  ```
298
298
 
299
- _See code: [src/commands/app/clean.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/clean.js)_
299
+ _See code: [src/commands/app/clean.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/clean.js)_
300
300
 
301
301
  ## `aio app create [PATH]`
302
302
 
@@ -319,7 +319,7 @@ DESCRIPTION
319
319
  Create a new Adobe I/O App with default parameters
320
320
  ```
321
321
 
322
- _See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/create.js)_
322
+ _See code: [src/commands/app/create.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/create.js)_
323
323
 
324
324
  ## `aio app delete`
325
325
 
@@ -338,7 +338,7 @@ DESCRIPTION
338
338
  Delete a component from an existing Adobe I/O App
339
339
  ```
340
340
 
341
- _See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/delete/index.js)_
341
+ _See code: [src/commands/app/delete/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/delete/index.js)_
342
342
 
343
343
  ## `aio app delete action [ACTION-NAME]`
344
344
 
@@ -365,7 +365,7 @@ ALIASES
365
365
  $ aio app delete actions
366
366
  ```
367
367
 
368
- _See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/delete/action.js)_
368
+ _See code: [src/commands/app/delete/action.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/delete/action.js)_
369
369
 
370
370
  ## `aio app delete ci`
371
371
 
@@ -385,7 +385,7 @@ DESCRIPTION
385
385
  Delete existing CI files
386
386
  ```
387
387
 
388
- _See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/delete/ci.js)_
388
+ _See code: [src/commands/app/delete/ci.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/delete/ci.js)_
389
389
 
390
390
  ## `aio app delete extension`
391
391
 
@@ -412,7 +412,7 @@ ALIASES
412
412
  $ aio app delete extensions
413
413
  ```
414
414
 
415
- _See code: [src/commands/app/delete/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/delete/extension.js)_
415
+ _See code: [src/commands/app/delete/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/delete/extension.js)_
416
416
 
417
417
  ## `aio app delete service`
418
418
 
@@ -437,7 +437,7 @@ ALIASES
437
437
  $ aio app delete services
438
438
  ```
439
439
 
440
- _See code: [src/commands/app/delete/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/delete/service.js)_
440
+ _See code: [src/commands/app/delete/service.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/delete/service.js)_
441
441
 
442
442
  ## `aio app delete web-assets`
443
443
 
@@ -457,7 +457,7 @@ DESCRIPTION
457
457
  Delete existing web assets
458
458
  ```
459
459
 
460
- _See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/delete/web-assets.js)_
460
+ _See code: [src/commands/app/delete/web-assets.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/delete/web-assets.js)_
461
461
 
462
462
  ## `aio app deploy`
463
463
 
@@ -504,7 +504,7 @@ DESCRIPTION
504
504
  Use the --force-deploy flag to force deploy changes, regardless of production Workspace being published in Exchange.
505
505
  ```
506
506
 
507
- _See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/deploy.js)_
507
+ _See code: [src/commands/app/deploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/deploy.js)_
508
508
 
509
509
  ## `aio app get-url [ACTION]`
510
510
 
@@ -527,7 +527,7 @@ DESCRIPTION
527
527
  Get action URLs
528
528
  ```
529
529
 
530
- _See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/get-url.js)_
530
+ _See code: [src/commands/app/get-url.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/get-url.js)_
531
531
 
532
532
  ## `aio app info`
533
533
 
@@ -550,7 +550,7 @@ DESCRIPTION
550
550
  Display settings/configuration in use by an Adobe I/O App
551
551
  ```
552
552
 
553
- _See code: [src/commands/app/info.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/info.js)_
553
+ _See code: [src/commands/app/info.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/info.js)_
554
554
 
555
555
  ## `aio app init [PATH]`
556
556
 
@@ -594,7 +594,7 @@ DESCRIPTION
594
594
  Create a new Adobe I/O App
595
595
  ```
596
596
 
597
- _See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/init.js)_
597
+ _See code: [src/commands/app/init.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/init.js)_
598
598
 
599
599
  ## `aio app install PATH`
600
600
 
@@ -619,7 +619,7 @@ DESCRIPTION
619
619
  This command will support installing apps packaged by 'aio app pack'.
620
620
  ```
621
621
 
622
- _See code: [src/commands/app/install.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/install.js)_
622
+ _See code: [src/commands/app/install.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/install.js)_
623
623
 
624
624
  ## `aio app list`
625
625
 
@@ -638,7 +638,7 @@ DESCRIPTION
638
638
  List components for Adobe I/O App
639
639
  ```
640
640
 
641
- _See code: [src/commands/app/list/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/list/index.js)_
641
+ _See code: [src/commands/app/list/index.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/list/index.js)_
642
642
 
643
643
  ## `aio app list extension`
644
644
 
@@ -664,7 +664,7 @@ ALIASES
664
664
  $ aio app list extensions
665
665
  ```
666
666
 
667
- _See code: [src/commands/app/list/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/list/extension.js)_
667
+ _See code: [src/commands/app/list/extension.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/list/extension.js)_
668
668
 
669
669
  ## `aio app logs`
670
670
 
@@ -689,7 +689,7 @@ DESCRIPTION
689
689
  Fetch logs for an Adobe I/O App
690
690
  ```
691
691
 
692
- _See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/logs.js)_
692
+ _See code: [src/commands/app/logs.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/logs.js)_
693
693
 
694
694
  ## `aio app pack [PATH]`
695
695
 
@@ -714,7 +714,7 @@ DESCRIPTION
714
714
  This command will support packaging apps for redistribution.
715
715
  ```
716
716
 
717
- _See code: [src/commands/app/pack.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/pack.js)_
717
+ _See code: [src/commands/app/pack.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/pack.js)_
718
718
 
719
719
  ## `aio app run`
720
720
 
@@ -738,7 +738,7 @@ DESCRIPTION
738
738
  Run an Adobe I/O App
739
739
  ```
740
740
 
741
- _See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/run.js)_
741
+ _See code: [src/commands/app/run.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/run.js)_
742
742
 
743
743
  ## `aio app test`
744
744
 
@@ -768,7 +768,7 @@ DESCRIPTION
768
768
  If the extension has a hook called 'test' in its 'ext.config.yaml', the script specified will be run instead.
769
769
  ```
770
770
 
771
- _See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/test.js)_
771
+ _See code: [src/commands/app/test.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/test.js)_
772
772
 
773
773
  ## `aio app undeploy`
774
774
 
@@ -794,7 +794,7 @@ DESCRIPTION
794
794
  Undeploys an Adobe I/O App
795
795
  ```
796
796
 
797
- _See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/undeploy.js)_
797
+ _See code: [src/commands/app/undeploy.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/undeploy.js)_
798
798
 
799
799
  ## `aio app use [CONFIG_FILE_PATH]`
800
800
 
@@ -842,5 +842,5 @@ DESCRIPTION
842
842
  page in https://developer.adobe.com/console/
843
843
  ```
844
844
 
845
- _See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.5.2/src/commands/app/use.js)_
845
+ _See code: [src/commands/app/use.js](https://github.com/adobe/aio-cli-plugin-app/blob/14.7.0/src/commands/app/use.js)_
846
846
  <!-- commandsstop -->
@@ -2434,5 +2434,5 @@
2434
2434
  ]
2435
2435
  }
2436
2436
  },
2437
- "version": "14.5.2"
2437
+ "version": "14.7.0"
2438
2438
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-plugin-app",
3
3
  "description": "Create, Build and Deploy Adobe I/O Applications",
4
- "version": "14.5.2",
4
+ "version": "14.7.0",
5
5
  "author": "Adobe Inc.",
6
6
  "bugs": "https://github.com/adobe/aio-cli-plugin-app/issues",
7
7
  "dependencies": {
@@ -10,6 +10,7 @@
10
10
  "@adobe/aio-lib-core-config": "^5",
11
11
  "@adobe/aio-lib-core-logging": "^3",
12
12
  "@adobe/aio-lib-core-networking": "^5",
13
+ "@adobe/aio-lib-db": "^1.0.0",
13
14
  "@adobe/aio-lib-env": "^3",
14
15
  "@adobe/aio-lib-ims": "^7",
15
16
  "@adobe/aio-lib-runtime": "^7.1.3",
@@ -24,6 +24,8 @@ const {
24
24
  getFilesCountWithExtension
25
25
  } = require('../../lib/app-helper')
26
26
  const rtLib = require('@adobe/aio-lib-runtime')
27
+ const dbLib = require('@adobe/aio-lib-db')
28
+ const { DB_STATUS } = require('../../lib/defaults')
27
29
  const LogForwarding = require('../../lib/log-forwarding')
28
30
  const { sendAppAssetsDeployedAuditLog, sendAppDeployAuditLog } = require('../../lib/audit-logger')
29
31
  const { setRuntimeApiHostAndAuthHandler, getAccessToken } = require('../../lib/auth-helper')
@@ -133,7 +135,7 @@ class Deploy extends BuildCommand {
133
135
  const v = {
134
136
  ...setRuntimeApiHostAndAuthHandler(values[i])
135
137
  }
136
- await this.deploySingleConfig({ name: k, config: v, originalConfig: values[i], flags, spinner })
138
+ await this.deploySingleConfig({ name: k, config: v, originalConfig: values[i], flags, spinner, accessToken: cliDetails?.accessToken })
137
139
  if (cliDetails?.accessToken && v.app.hasFrontend && flags['web-assets']) {
138
140
  const opItems = getFilesCountWithExtension(v.web.distProd)
139
141
  try {
@@ -172,7 +174,7 @@ class Deploy extends BuildCommand {
172
174
  this.log(chalk.green(chalk.bold('Successful deployment 🏄')))
173
175
  }
174
176
 
175
- async deploySingleConfig ({ name, config, originalConfig, flags, spinner }) {
177
+ async deploySingleConfig ({ name, config, originalConfig, flags, spinner, accessToken }) {
176
178
  const onProgress = !flags.verbose
177
179
  ? info => {
178
180
  spinner.text = info
@@ -204,6 +206,11 @@ class Deploy extends BuildCommand {
204
206
  this.error(err)
205
207
  }
206
208
 
209
+ // provision database if configured
210
+ if (config.manifest?.full?.database?.['auto-provision'] === true) {
211
+ await this.provisionDatabase(config, spinner, flags, accessToken)
212
+ }
213
+
207
214
  if (flags.actions) {
208
215
  if (config.app.hasBackend) {
209
216
  let filterEntities
@@ -300,6 +307,79 @@ class Deploy extends BuildCommand {
300
307
  }
301
308
  }
302
309
 
310
+ async provisionDatabase (config, spinner, flags, accessToken) {
311
+ const { namespace } = config.ow || {}
312
+ if (!(namespace)) {
313
+ throw new Error('Database deployment requires OW namespace configuration.')
314
+ }
315
+ if (!accessToken) {
316
+ throw new Error('Database deployment requires an IMS access token.')
317
+ }
318
+
319
+ const region = config.manifest?.full?.database?.region
320
+ const regionMess = region ? `'${region}'` : 'default'
321
+
322
+ const progress = ({ next = undefined, status = undefined, verboseOnly = false }, statusMethod = spinner.info) => {
323
+ if (flags.verbose) {
324
+ const method = statusMethod.bind(spinner)
325
+ method(status)
326
+ spinner.start(next)
327
+ } else if (next && !verboseOnly) {
328
+ spinner.text = next
329
+ }
330
+ }
331
+
332
+ let provRes
333
+ try {
334
+ spinner.start(`Deploying database in the ${regionMess} region...`)
335
+
336
+ const db = await dbLib.init({ ow: { namespace }, region, token: accessToken })
337
+
338
+ progress({ next: 'Checking existing database deployment status...', verboseOnly: true })
339
+
340
+ let prevStatus
341
+ let statusRegion
342
+ const next = `Submitting database provisioning request in the ${regionMess} region...`
343
+ try {
344
+ const statusRes = await db.provisionStatus()
345
+ prevStatus = statusRes.status.toUpperCase()
346
+ statusRegion = statusRes.region
347
+ const regionMessage = statusRegion ? ` in region '${statusRegion}'` : ''
348
+ progress({ status: chalk.dim(`Existing database provisioning status: ${prevStatus}${regionMessage}`), next })
349
+ } catch (err) {
350
+ progress({ status: chalk.red(`Database status check failed: ${err.message}`), next }, spinner.warn)
351
+ prevStatus = null
352
+ }
353
+
354
+ if (prevStatus === DB_STATUS.PROVISIONED) {
355
+ spinner.succeed(chalk.green(`Database is deployed and ready for use in the '${statusRegion}' region`))
356
+ return
357
+ } else if (prevStatus === DB_STATUS.REQUESTED || prevStatus === DB_STATUS.PROCESSING) {
358
+ spinner.succeed(chalk.green(`Database provisioning request has already been submitted in the '${statusRegion}' region and is pending`))
359
+ return
360
+ }
361
+
362
+ provRes = await db.provisionRequest()
363
+ progress({ status: chalk.dim(`Database provisioning result:\n${JSON.stringify(provRes, null, 2)}`) })
364
+ } catch (error) {
365
+ spinner.fail(chalk.red('Database deployment failed'))
366
+ throw error
367
+ }
368
+
369
+ const resultStatus = provRes?.status?.toUpperCase() || DB_STATUS.UNKNOWN
370
+ if (resultStatus === DB_STATUS.PROVISIONED) {
371
+ spinner.succeed(chalk.green(`Database is deployed and ready for use in the '${provRes.region}' region`))
372
+ } else if (resultStatus === DB_STATUS.REQUESTED || resultStatus === DB_STATUS.PROCESSING) {
373
+ spinner.succeed(chalk.green(`Database provisioning request submitted in the '${provRes.region}' region, database deployment is now pending`))
374
+ } else if (resultStatus === DB_STATUS.FAILED || resultStatus === DB_STATUS.REJECTED) {
375
+ const message = `Database provisioning request failed with status '${resultStatus}'`
376
+ spinner.fail(chalk.red(message))
377
+ throw new Error(`${message}: ${provRes.message || 'Unknown error'}`)
378
+ } else {
379
+ spinner.warn(chalk.yellow(`Database provisioning request returned unexpected status '${resultStatus}', an update to the aio cli tool may be necessary.`))
380
+ }
381
+ }
382
+
303
383
  async publishExtensionPoints (deployConfigs, aioConfig, force) {
304
384
  const libConsoleCLI = await this.getLibConsoleCLI()
305
385
 
@@ -41,5 +41,16 @@ module.exports = {
41
41
  EXTENSIONS_CONFIG_KEY: 'extensions',
42
42
  // Adding tracking file constants
43
43
  LAST_BUILT_ACTIONS_FILENAME: 'last-built-actions.json',
44
- LAST_DEPLOYED_ACTIONS_FILENAME: 'last-deployed-actions.json'
44
+ LAST_DEPLOYED_ACTIONS_FILENAME: 'last-deployed-actions.json',
45
+ // Database constants
46
+ DB_STATUS: {
47
+ PROVISIONED: 'PROVISIONED',
48
+ REQUESTED: 'REQUESTED',
49
+ PROCESSING: 'PROCESSING',
50
+ FAILED: 'FAILED',
51
+ REJECTED: 'REJECTED',
52
+ NOT_PROVISIONED: 'NOT_PROVISIONED',
53
+ DELETED: 'DELETED',
54
+ UNKNOWN: 'UNKNOWN'
55
+ }
45
56
  }