swaggerhub-cli 0.13.0 → 0.15.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.
Files changed (72) hide show
  1. package/README.md +209 -122
  2. package/bin/run +5 -4
  3. package/oclif.manifest.json +283 -122
  4. package/package.json +14 -12
  5. package/src/check-node-version.js +3 -2
  6. package/src/commands/api/clone.js +66 -0
  7. package/src/commands/api/create.js +10 -10
  8. package/src/commands/api/delete.js +7 -7
  9. package/src/commands/api/get.js +9 -9
  10. package/src/commands/api/publish.js +7 -7
  11. package/src/commands/api/rename.js +8 -10
  12. package/src/commands/api/setdefault.js +6 -6
  13. package/src/commands/api/unpublish.js +5 -5
  14. package/src/commands/api/update.js +11 -11
  15. package/src/commands/api/validate/download-rules.js +11 -11
  16. package/src/commands/api/validate/index.js +10 -10
  17. package/src/commands/api/validate/local.js +11 -11
  18. package/src/commands/configure.js +8 -8
  19. package/src/commands/domain/clone.js +66 -0
  20. package/src/commands/domain/create.js +14 -14
  21. package/src/commands/domain/delete.js +7 -7
  22. package/src/commands/domain/get.js +8 -8
  23. package/src/commands/domain/publish.js +6 -6
  24. package/src/commands/domain/rename.js +78 -0
  25. package/src/commands/domain/setdefault.js +6 -6
  26. package/src/commands/domain/unpublish.js +6 -6
  27. package/src/commands/domain/update.js +11 -11
  28. package/src/commands/integration/create.js +7 -7
  29. package/src/commands/integration/delete.js +6 -6
  30. package/src/commands/integration/execute.js +6 -6
  31. package/src/commands/integration/get.js +9 -9
  32. package/src/commands/integration/list.js +7 -7
  33. package/src/commands/integration/update.js +6 -6
  34. package/src/commands/project/api/add.js +7 -9
  35. package/src/commands/project/api/remove.js +10 -13
  36. package/src/commands/project/create.js +9 -13
  37. package/src/commands/project/delete.js +7 -7
  38. package/src/commands/project/domain/add.js +7 -9
  39. package/src/commands/project/domain/remove.js +10 -13
  40. package/src/commands/project/get.js +8 -8
  41. package/src/commands/project/list.js +6 -6
  42. package/src/commands/project/member/list.js +8 -8
  43. package/src/commands/spectral/download.js +9 -9
  44. package/src/commands/spectral/upload.js +11 -11
  45. package/src/config/index.js +18 -4
  46. package/src/format-readme.js +3 -2
  47. package/src/help.js +2 -2
  48. package/src/hooks/setup-config.js +9 -5
  49. package/src/index.js +2 -2
  50. package/src/requests/api.js +3 -3
  51. package/src/requests/domain.js +3 -3
  52. package/src/requests/project.js +2 -2
  53. package/src/requests/spec.js +5 -5
  54. package/src/requests/spectral.js +3 -3
  55. package/src/requests/standardization.js +4 -4
  56. package/src/support/command/base-command.js +11 -12
  57. package/src/support/command/base-validate-command.js +3 -3
  58. package/src/support/command/handle-response.js +7 -5
  59. package/src/support/command/parse-input.js +8 -6
  60. package/src/support/command/update-command.js +5 -5
  61. package/src/support/http/default-headers.js +1 -1
  62. package/src/support/http/header-templates.js +2 -2
  63. package/src/support/http/index.js +7 -7
  64. package/src/support/http/proxy-agent.js +4 -4
  65. package/src/support/inquirer/index.js +4 -4
  66. package/src/support/inquirer/prompt-templates.js +3 -3
  67. package/src/support/isOnPrem.js +3 -3
  68. package/src/template-strings/errors.js +6 -6
  69. package/src/template-strings/index.js +3 -3
  70. package/src/template-strings/info.js +10 -4
  71. package/src/utils/definitions.js +8 -6
  72. package/src/utils/general.js +3 -3
@@ -1,10 +1,10 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { readFileSync } = require('fs-extra')
3
- const { getDomain, postDomain } = require('../../requests/domain')
4
- const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
5
- const { getVersion, parseDefinition } = require('../../utils/definitions')
6
- const BaseCommand = require('../../support/command/base-command')
7
- const UpdateCommand = require('../../support/command/update-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { readFileSync } from 'node:fs'
3
+ import { getDomain, postDomain } from '../../requests/domain.js'
4
+ import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
5
+ import { getVersion, parseDefinition } from '../../utils/definitions.js'
6
+ import BaseCommand from '../../support/command/base-command.js'
7
+ import UpdateCommand from '../../support/command/update-command.js'
8
8
 
9
9
  const isDomainNameAvailable = response => response.status === 404
10
10
 
@@ -62,8 +62,8 @@ class CreateDomainCommand extends UpdateCommand {
62
62
  const { args, flags } = await this.parse(CreateDomainCommand)
63
63
  const definition = parseDefinition(flags.file)
64
64
  const domainVersion = getVersion(definition)
65
- const doaminPath = getDomainIdentifierArg(args)
66
- const [owner, name, version = domainVersion] = splitPathParams(doaminPath)
65
+ const domainPath = getDomainIdentifierArg(args)
66
+ const [owner, name, version = domainVersion] = splitPathParams(domainPath)
67
67
  const type = 'domains'
68
68
 
69
69
  const argsObj = {
@@ -96,15 +96,15 @@ An error will occur if the domain version already exists.
96
96
  CreateDomainCommand.examples = [
97
97
  'swaggerhub domain:create organization/domain/1.0.0 --file domain.yaml --visibility public',
98
98
  'swaggerhub domain:create organization/domain --file domain.yaml',
99
- 'swaggerhub domain:create organization/domain/1.0.0 --publish --file domain.json',
99
+ 'swaggerhub domain:create organization/domain/1.0.0 --published=publish --file domain.json',
100
100
  'swaggerhub domain:create organization/domain/1.0.0 --setdefault --file domain.json',
101
- 'swaggerhub domain:create organization/domain/1.0.0 --publish --setdefault --file domain.json'
101
+ 'swaggerhub domain:create organization/domain/1.0.0 --published=publish --setdefault --file domain.json'
102
102
  ]
103
103
 
104
104
  CreateDomainCommand.args = {
105
105
  'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
106
106
  required: true,
107
- description: 'Domain to create on SwaggerHub'
107
+ description: 'Domain to create on Swagger'
108
108
  })
109
109
  }
110
110
 
@@ -115,7 +115,7 @@ CreateDomainCommand.flags = {
115
115
  required: true
116
116
  }),
117
117
  visibility: Flags.string({
118
- description: 'visibility of domain in SwaggerHub',
118
+ description: 'visibility of domain in Swagger',
119
119
  options: ['public', 'private'],
120
120
  default: 'private'
121
121
  }),
@@ -135,4 +135,4 @@ CreateDomainCommand.flags = {
135
135
  ...BaseCommand.flags
136
136
  }
137
137
 
138
- module.exports = CreateDomainCommand
138
+ export default CreateDomainCommand
@@ -1,8 +1,8 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { deleteDomain } = require('../../requests/domain')
3
- const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
- const BaseCommand = require('../../support/command/base-command')
5
- const inquirer = require('inquirer')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { deleteDomain } from '../../requests/domain.js'
3
+ import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
5
+ import inquirer from 'inquirer'
6
6
 
7
7
  class DeleteDomainCommand extends BaseCommand {
8
8
 
@@ -49,7 +49,7 @@ DeleteDomainCommand.examples = [
49
49
  DeleteDomainCommand.args = {
50
50
  'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
51
51
  required: true,
52
- description: 'Domain to delete on SwaggerHub'
52
+ description: 'Domain to delete on Swagger'
53
53
  })
54
54
  }
55
55
 
@@ -61,4 +61,4 @@ DeleteDomainCommand.flags = {
61
61
  ...BaseCommand.flags
62
62
  }
63
63
 
64
- module.exports = DeleteDomainCommand
64
+ export default DeleteDomainCommand
@@ -1,9 +1,9 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { getDomainIdentifierArg, reqType, resolvedParam, splitPathParams } = require('../../support/command/parse-input')
3
- const { hasJsonStructure, prettyPrintJSON } = require('../../utils/general')
4
- const { getDomain } = require('../../requests/domain')
5
- const { getResponseContent } = require('../../support/command/handle-response')
6
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { getDomainIdentifierArg, reqType, resolvedParam, splitPathParams } from '../../support/command/parse-input.js'
3
+ import { hasJsonStructure, prettyPrintJSON } from '../../utils/general.js'
4
+ import { getDomain } from '../../requests/domain.js'
5
+ import { getResponseContent } from '../../support/command/handle-response.js'
6
+ import BaseCommand from '../../support/command/base-command.js'
7
7
 
8
8
  class GetDomainCommand extends BaseCommand {
9
9
  constructor(...props) {
@@ -54,7 +54,7 @@ GetDomainCommand.examples = [
54
54
  GetDomainCommand.args = {
55
55
  'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
56
56
  required: true,
57
- description: 'Domain to fetch from SwaggerHub'
57
+ description: 'Domain to fetch from Swagger'
58
58
  })
59
59
  }
60
60
 
@@ -66,4 +66,4 @@ GetDomainCommand.flags = {
66
66
  ...BaseCommand.flags
67
67
  }
68
68
 
69
- module.exports = GetDomainCommand
69
+ export default GetDomainCommand
@@ -1,7 +1,7 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
- const BaseCommand = require('../../support/command/base-command')
4
- const UpdateCommand = require('../../support/command/update-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
3
+ import BaseCommand from '../../support/command/base-command.js'
4
+ import UpdateCommand from '../../support/command/update-command.js'
5
5
 
6
6
  class PublishCommand extends UpdateCommand {
7
7
 
@@ -24,7 +24,7 @@ PublishCommand.examples = [
24
24
  PublishCommand.args = {
25
25
  'OWNER/DOMAIN_NAME/VERSION': Args.string({
26
26
  required: true,
27
- description: 'Domain to publish on SwaggerHub'
27
+ description: 'Domain to publish on Swagger'
28
28
  })
29
29
  }
30
30
 
@@ -36,4 +36,4 @@ PublishCommand.flags = {
36
36
  ...BaseCommand.flags
37
37
  }
38
38
 
39
- module.exports = PublishCommand
39
+ export default PublishCommand
@@ -0,0 +1,78 @@
1
+ import BaseCommand from '../../support/command/base-command.js'
2
+ import { Args, Flags, Errors } from '@oclif/core'
3
+ import {
4
+ noVersionRegex,
5
+ apiNameRegex
6
+ } from '../../support/command/parse-input.js'
7
+ import { errorMsg } from '../../template-strings/index.js'
8
+ import { postDomain } from '../../requests/domain.js'
9
+
10
+ const { CLIError } = Errors
11
+
12
+ const getDomainToRename = args => {
13
+ const domainPath = args['OWNER/DOMAIN_NAME']
14
+ if (!noVersionRegex.test(domainPath)) {
15
+ throw new CLIError(errorMsg.argsMustMatchFormat({ format: 'OWNER/DOMAIN_NAME' }))
16
+ }
17
+ return domainPath
18
+ }
19
+
20
+ const getDomainNewName = args => {
21
+ const newName = args['DOMAIN_NEW_NAME']
22
+ if (!apiNameRegex.test(newName)) {
23
+ throw new CLIError(errorMsg.argsMustMatchFormat({ format: 'DOMAIN_NEW_NAME' }))
24
+ }
25
+ return newName
26
+ }
27
+
28
+ class RenameDomainCommand extends BaseCommand {
29
+
30
+ async run() {
31
+ const { args, flags } = await this.parse(RenameDomainCommand)
32
+
33
+ const domainPath = getDomainToRename(args)
34
+ const newName = getDomainNewName(args)
35
+ const queryParams = { newName }
36
+ if (flags.force) queryParams.force = 'true'
37
+
38
+ this.log(`Renaming domain: '${domainPath}' to '${newName}'`)
39
+
40
+ await this.executeHttp({
41
+ execute: () => postDomain({
42
+ pathParams: [domainPath, 'rename'],
43
+ queryParams,
44
+ body: '{}'
45
+ }),
46
+ onResolve: this.logCommandSuccess({ domainPath, newName }),
47
+ options: {}
48
+ })
49
+ }
50
+ }
51
+
52
+ RenameDomainCommand.description = 'rename a domain'
53
+
54
+ RenameDomainCommand.examples = [
55
+ 'swaggerhub domain:rename organization/domainOldName domainNewName',
56
+ 'swaggerhub domain:rename organization/domainOldName domainNewName --force'
57
+ ]
58
+
59
+ RenameDomainCommand.args = {
60
+ 'OWNER/DOMAIN_NAME': Args.string({
61
+ required: true,
62
+ description: 'Domain to be renamed'
63
+ }),
64
+ 'DOMAIN_NEW_NAME': Args.string({
65
+ required: true,
66
+ description: 'New name for the domain'
67
+ })
68
+ }
69
+
70
+ RenameDomainCommand.flags = {
71
+ force: Flags.boolean({
72
+ char: 'f',
73
+ description: 'rename the domain even if it is referenced by APIs or other domains'
74
+ }),
75
+ ...BaseCommand.flags
76
+ }
77
+
78
+ export default RenameDomainCommand
@@ -1,7 +1,7 @@
1
- const { Args } = require('@oclif/core')
2
- const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
- const BaseCommand = require('../../support/command/base-command')
4
- const UpdateCommand = require('../../support/command/update-command')
1
+ import { Args } from '@oclif/core'
2
+ import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
3
+ import BaseCommand from '../../support/command/base-command.js'
4
+ import UpdateCommand from '../../support/command/update-command.js'
5
5
 
6
6
  class SetDefaultDomainCommand extends UpdateCommand {
7
7
 
@@ -23,10 +23,10 @@ SetDefaultDomainCommand.examples = [
23
23
  SetDefaultDomainCommand.args = {
24
24
  'OWNER/DOMAIN_NAME/VERSION': Args.string({
25
25
  required: true,
26
- description: 'Domain to set as default on SwaggerHub'
26
+ description: 'Domain to set as default on Swagger'
27
27
  })
28
28
  }
29
29
 
30
30
  SetDefaultDomainCommand.flags = BaseCommand.flags
31
31
 
32
- module.exports = SetDefaultDomainCommand
32
+ export default SetDefaultDomainCommand
@@ -1,7 +1,7 @@
1
- const { Args } = require('@oclif/core')
2
- const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
- const BaseCommand = require('../../support/command/base-command')
4
- const UpdateCommand = require('../../support/command/update-command')
1
+ import { Args } from '@oclif/core'
2
+ import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
3
+ import BaseCommand from '../../support/command/base-command.js'
4
+ import UpdateCommand from '../../support/command/update-command.js'
5
5
 
6
6
  class UnpublishCommand extends UpdateCommand {
7
7
 
@@ -23,10 +23,10 @@ UnpublishCommand.examples = [
23
23
  UnpublishCommand.args = {
24
24
  'OWNER/DOMAIN_NAME/VERSION': Args.string({
25
25
  required: true,
26
- description: 'Domain to unpublish on SwaggerHub'
26
+ description: 'Domain to unpublish on Swagger'
27
27
  })
28
28
  }
29
29
 
30
30
  UnpublishCommand.flags = BaseCommand.flags
31
31
 
32
- module.exports = UnpublishCommand
32
+ export default UnpublishCommand
@@ -1,10 +1,10 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { readFileSync } = require('fs-extra')
3
- const { getDomain, postDomain } = require('../../requests/domain')
4
- const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
5
- const { getVersion, parseDefinition } = require('../../utils/definitions')
6
- const BaseCommand = require('../../support/command/base-command')
7
- const UpdateCommand = require('../../support/command/update-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { readFileSync } from 'node:fs'
3
+ import { getDomain, postDomain } from '../../requests/domain.js'
4
+ import { getDomainIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
5
+ import { getVersion, parseDefinition } from '../../utils/definitions.js'
6
+ import BaseCommand from '../../support/command/base-command.js'
7
+ import UpdateCommand from '../../support/command/update-command.js'
8
8
 
9
9
  class UpdateDomainCommand extends UpdateCommand {
10
10
 
@@ -65,7 +65,7 @@ class UpdateDomainCommand extends UpdateCommand {
65
65
  UpdateDomainCommand.description = `update a domain
66
66
  The domain version from the file will be used unless the version is specified in the command argument.
67
67
  When no file is specified then the default domain version will be updated.
68
- The domain visibility can be changed by using visibility flag.
68
+ The domain visibility can be changed by using the --visibility flag.
69
69
  `
70
70
 
71
71
  UpdateDomainCommand.examples = [
@@ -80,7 +80,7 @@ UpdateDomainCommand.examples = [
80
80
  UpdateDomainCommand.args = {
81
81
  'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
82
82
  required: true,
83
- description: 'Domain to update on SwaggerHub'
83
+ description: 'Domain to update on Swagger'
84
84
  })
85
85
  }
86
86
 
@@ -92,7 +92,7 @@ UpdateDomainCommand.flags = {
92
92
  multiple: false
93
93
  }),
94
94
  visibility: Flags.string({
95
- description: 'visibility of domain in SwaggerHub',
95
+ description: 'visibility of domain in Swagger',
96
96
  options: ['public', 'private']
97
97
  }),
98
98
  published: Flags.string({
@@ -107,4 +107,4 @@ UpdateDomainCommand.flags = {
107
107
  ...BaseCommand.flags
108
108
  }
109
109
 
110
- module.exports = UpdateDomainCommand
110
+ export default UpdateDomainCommand
@@ -1,7 +1,7 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { postApi } = require('../../requests/api')
3
- const { getApiIdentifierArg, readConfigFile } = require('../../support/command/parse-input')
4
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { postApi } from '../../requests/api.js'
3
+ import { getApiIdentifierArg, readConfigFile } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
5
5
 
6
6
  class CreateIntegrationCommand extends BaseCommand {
7
7
 
@@ -30,7 +30,7 @@ class CreateIntegrationCommand extends BaseCommand {
30
30
 
31
31
  CreateIntegrationCommand.description = `creates a new API integration from a JSON configuration file.
32
32
  See the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/main/examples/integrations
33
- When VERSION is not included in the argument, the integration will be added to be default API version.
33
+ When VERSION is not included in the argument, the integration will be added to the default API version.
34
34
  `
35
35
 
36
36
  CreateIntegrationCommand.examples = [
@@ -40,7 +40,7 @@ CreateIntegrationCommand.examples = [
40
40
  CreateIntegrationCommand.args = {
41
41
  'OWNER/API_NAME/[VERSION]': Args.string({
42
42
  required: true,
43
- description: 'API to add integration to on SwaggerHub'
43
+ description: 'API to add integration to on Swagger'
44
44
  })
45
45
  }
46
46
 
@@ -53,4 +53,4 @@ CreateIntegrationCommand.flags = {
53
53
  ...BaseCommand.flags
54
54
  }
55
55
 
56
- module.exports = CreateIntegrationCommand
56
+ export default CreateIntegrationCommand
@@ -1,7 +1,7 @@
1
- const { Args } = require('@oclif/core')
2
- const { deleteApi } = require('../../requests/api')
3
- const { getIntegrationIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Args } from '@oclif/core'
2
+ import { deleteApi } from '../../requests/api.js'
3
+ import { getIntegrationIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
5
5
 
6
6
  class DeleteIntegrationCommand extends BaseCommand {
7
7
 
@@ -31,7 +31,7 @@ DeleteIntegrationCommand.examples = [
31
31
  DeleteIntegrationCommand.args = {
32
32
  'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
33
33
  required: true,
34
- description: 'Integration to delete for given API on Swaggerhub'
34
+ description: 'Integration to delete for given API on Swagger'
35
35
  })
36
36
  }
37
37
 
@@ -39,4 +39,4 @@ DeleteIntegrationCommand.flags = {
39
39
  ...BaseCommand.flags
40
40
  }
41
41
 
42
- module.exports = DeleteIntegrationCommand
42
+ export default DeleteIntegrationCommand
@@ -1,7 +1,7 @@
1
- const { Args } = require('@oclif/core')
2
- const { postApi } = require('../../requests/api')
3
- const { getIntegrationIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Args } from '@oclif/core'
2
+ import { postApi } from '../../requests/api.js'
3
+ import { getIntegrationIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
5
5
 
6
6
  class ExecuteIntegrationCommand extends BaseCommand {
7
7
 
@@ -31,7 +31,7 @@ ExecuteIntegrationCommand.examples = [
31
31
  ExecuteIntegrationCommand.args = {
32
32
  'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
33
33
  required: true,
34
- description: 'Integration to execute for given API on Swaggerhub'
34
+ description: 'Integration to execute for given API on Swagger'
35
35
  })
36
36
  }
37
37
 
@@ -39,4 +39,4 @@ ExecuteIntegrationCommand.flags = {
39
39
  ...BaseCommand.flags
40
40
  }
41
41
 
42
- module.exports = ExecuteIntegrationCommand
42
+ export default ExecuteIntegrationCommand
@@ -1,9 +1,9 @@
1
- const { Args } = require('@oclif/core')
2
- const { getApi } = require('../../requests/api')
3
- const { getIntegrationIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
- const { getResponseContent } = require('../../support/command/handle-response')
5
- const { prettyPrintJSON } = require('../../utils/general')
6
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Args } from '@oclif/core'
2
+ import { getApi } from '../../requests/api.js'
3
+ import { getIntegrationIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
4
+ import { getResponseContent } from '../../support/command/handle-response.js'
5
+ import { prettyPrintJSON } from '../../utils/general.js'
6
+ import BaseCommand from '../../support/command/base-command.js'
7
7
 
8
8
  class GetIntegrationCommand extends BaseCommand {
9
9
  constructor(...props) {
@@ -33,7 +33,7 @@ class GetIntegrationCommand extends BaseCommand {
33
33
  }
34
34
  }
35
35
 
36
- GetIntegrationCommand.description = 'retieves an integration for the given API.'
36
+ GetIntegrationCommand.description = 'retrieves an integration for the given API.'
37
37
 
38
38
  GetIntegrationCommand.examples = [
39
39
  'swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704'
@@ -42,7 +42,7 @@ GetIntegrationCommand.examples = [
42
42
  GetIntegrationCommand.args = {
43
43
  'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
44
44
  required: true,
45
- description: 'Integration to fetch for given API on Swaggerhub'
45
+ description: 'Integration to fetch for given API on Swagger'
46
46
  })
47
47
  }
48
48
 
@@ -50,4 +50,4 @@ GetIntegrationCommand.flags = {
50
50
  ...BaseCommand.flags
51
51
  }
52
52
 
53
- module.exports = GetIntegrationCommand
53
+ export default GetIntegrationCommand
@@ -1,8 +1,8 @@
1
- const { ux, Args } = require('@oclif/core')
2
- const { getApi } = require('../../requests/api')
3
- const { getResponseContent } = require('../../support/command/handle-response')
4
- const { getApiIdentifierArg } = require('../../support/command/parse-input')
5
- const BaseCommand = require('../../support/command/base-command')
1
+ import { ux, Args } from '@oclif/core'
2
+ import { getApi } from '../../requests/api.js'
3
+ import { getResponseContent } from '../../support/command/handle-response.js'
4
+ import { getApiIdentifierArg } from '../../support/command/parse-input.js'
5
+ import BaseCommand from '../../support/command/base-command.js'
6
6
 
7
7
  class ListIntegrationCommand extends BaseCommand {
8
8
  constructor(...props) {
@@ -52,7 +52,7 @@ ListIntegrationCommand.examples = [
52
52
  ListIntegrationCommand.args = {
53
53
  'OWNER/API_NAME/[VERSION]': Args.string({
54
54
  required: true,
55
- description: 'API to list integrations for on Swaggerhub'
55
+ description: 'API to list integrations for'
56
56
  })
57
57
  }
58
58
 
@@ -60,4 +60,4 @@ ListIntegrationCommand.flags = {
60
60
  ...BaseCommand.flags
61
61
  }
62
62
 
63
- module.exports = ListIntegrationCommand
63
+ export default ListIntegrationCommand
@@ -1,7 +1,7 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { putApi } = require('../../requests/api')
3
- const { getIntegrationIdentifierArg, readConfigFile, splitPathParams } = require('../../support/command/parse-input')
4
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { putApi } from '../../requests/api.js'
3
+ import { getIntegrationIdentifierArg, readConfigFile, splitPathParams } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
5
5
 
6
6
  class UpdateIntegrationCommand extends BaseCommand {
7
7
 
@@ -36,7 +36,7 @@ UpdateIntegrationCommand.examples = [
36
36
  UpdateIntegrationCommand.args = {
37
37
  'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
38
38
  required: true,
39
- description: 'Integration to update for given API on Swaggerhub'
39
+ description: 'Integration to update for given API on Swagger'
40
40
  })
41
41
  }
42
42
 
@@ -49,4 +49,4 @@ UpdateIntegrationCommand.flags = {
49
49
  ...BaseCommand.flags
50
50
  }
51
51
 
52
- module.exports = UpdateIntegrationCommand
52
+ export default UpdateIntegrationCommand
@@ -1,9 +1,7 @@
1
- const { Args } = require('@oclif/core')
2
- const { putProject } = require('../../../requests/project')
3
- const {
4
- getProjectIdentifierArg
5
- } = require('../../../support/command/parse-input')
6
- const BaseCommand = require('../../../support/command/base-command')
1
+ import { Args } from '@oclif/core'
2
+ import { putProject } from '../../../requests/project.js'
3
+ import { getProjectIdentifierArg } from '../../../support/command/parse-input.js'
4
+ import BaseCommand from '../../../support/command/base-command.js'
7
5
 
8
6
  class ProjectApiAddCommand extends BaseCommand {
9
7
 
@@ -35,12 +33,12 @@ ProjectApiAddCommand.examples = [
35
33
  ProjectApiAddCommand.args = {
36
34
  'OWNER/PROJECT_NAME': Args.string({
37
35
  required: true,
38
- description: 'The project to add the API to on Swaggerhub'
36
+ description: 'The project to add the API to on Swagger'
39
37
  }),
40
38
  'API': Args.string({
41
39
  required: true,
42
- description: 'The name of the API on Swaggerhub to add'
40
+ description: 'The name of the API on Swagger to add'
43
41
  })
44
42
  }
45
43
 
46
- module.exports = ProjectApiAddCommand
44
+ export default ProjectApiAddCommand
@@ -1,12 +1,9 @@
1
- const { Args } = require('@oclif/core')
2
- const { putProject, getProject } = require('../../../requests/project')
3
- const {
4
- getProjectIdentifierArg,
5
- splitPathParams,
6
- } = require('../../../support/command/parse-input')
7
- const BaseCommand = require('../../../support/command/base-command')
8
- const { getResponseContent } = require('../../../support/command/handle-response')
9
- const { pipeAsync } = require('../../../utils/general')
1
+ import { Args } from '@oclif/core'
2
+ import { putProject, getProject } from '../../../requests/project.js'
3
+ import { getProjectIdentifierArg, splitPathParams } from '../../../support/command/parse-input.js'
4
+ import BaseCommand from '../../../support/command/base-command.js'
5
+ import { getResponseContent } from '../../../support/command/handle-response.js'
6
+ import { pipeAsync } from '../../../utils/general.js'
10
7
 
11
8
  class ProjectApiRemoveCommand extends BaseCommand {
12
9
 
@@ -48,7 +45,7 @@ class ProjectApiRemoveCommand extends BaseCommand {
48
45
  }
49
46
  }
50
47
 
51
- ProjectApiRemoveCommand.description = 'Removes an API from a project in SwaggerHub.'
48
+ ProjectApiRemoveCommand.description = 'Removes an API from a project in Swagger.'
52
49
 
53
50
  ProjectApiRemoveCommand.examples = [
54
51
  'swaggerhub project:api:remove organization/project_name my_api',
@@ -57,12 +54,12 @@ ProjectApiRemoveCommand.examples = [
57
54
  ProjectApiRemoveCommand.args = {
58
55
  'OWNER/PROJECT_NAME': Args.string({
59
56
  required: true,
60
- description: 'The project to remove the API from on Swaggerhub'
57
+ description: 'The project to remove the API from on Swagger'
61
58
  }),
62
59
  'API': Args.string({
63
60
  required: true,
64
- description: 'The name of the API on Swaggerhub to remove'
61
+ description: 'The name of the API on Swagger to remove'
65
62
  })
66
63
  }
67
64
 
68
- module.exports = ProjectApiRemoveCommand
65
+ export default ProjectApiRemoveCommand
@@ -1,11 +1,7 @@
1
- const { Flags, Args } = require('@oclif/core')
2
- const { postProject } = require('../../requests/project')
3
- const {
4
- getProjectIdentifierArg,
5
- splitPathParams,
6
- splitFlagParams
7
- } = require('../../support/command/parse-input')
8
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Flags, Args } from '@oclif/core'
2
+ import { postProject } from '../../requests/project.js'
3
+ import { getProjectIdentifierArg, splitPathParams, splitFlagParams } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
9
5
 
10
6
  class CreateProjectCommand extends BaseCommand {
11
7
 
@@ -39,7 +35,7 @@ class CreateProjectCommand extends BaseCommand {
39
35
  }
40
36
  }
41
37
 
42
- CreateProjectCommand.description = 'Creates a new project in SwaggerHub.'
38
+ CreateProjectCommand.description = 'Creates a new project in Swagger.'
43
39
 
44
40
  CreateProjectCommand.examples = [
45
41
  'swaggerhub project:create organization/new_project_name --description "project description"',
@@ -53,7 +49,7 @@ CreateProjectCommand.examples = [
53
49
  CreateProjectCommand.args = {
54
50
  'OWNER/PROJECT_NAME': Args.string({
55
51
  required: true,
56
- description: 'The new project to create on Swaggerhub'
52
+ description: 'The new project to create on Swagger'
57
53
  })
58
54
  }
59
55
 
@@ -64,15 +60,15 @@ CreateProjectCommand.flags = {
64
60
  }),
65
61
  apis: Flags.string({
66
62
  char: 'a',
67
- description: 'Comma separated list of api names to include in project',
63
+ description: 'Comma-separated list of API names to include in project',
68
64
  required: false
69
65
  }),
70
66
  domains: Flags.string({
71
67
  char: 'd',
72
- description: 'Comma separated list of domain names to include in project',
68
+ description: 'Comma-separated list of domain names to include in project',
73
69
  required: false
74
70
  }),
75
71
  ...BaseCommand.flags
76
72
  }
77
73
 
78
- module.exports = CreateProjectCommand
74
+ export default CreateProjectCommand