@apimatic/cli 1.1.0-alpha.21 → 1.1.0-alpha.22
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 +112 -90
- package/lib/actions/action-result.d.ts +8 -3
- package/lib/actions/action-result.js +34 -15
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/transform.d.ts +15 -0
- package/lib/actions/api/transform.js +48 -0
- package/lib/actions/api/transform.js.map +1 -0
- package/lib/actions/api/validate.d.ts +12 -0
- package/lib/actions/api/validate.js +41 -0
- package/lib/actions/api/validate.js.map +1 -0
- package/lib/actions/auth/login.d.ts +6 -5
- package/lib/actions/auth/login.js +25 -33
- package/lib/actions/auth/login.js.map +1 -1
- package/lib/actions/auth/logout.d.ts +8 -0
- package/lib/actions/auth/logout.js +15 -0
- package/lib/actions/auth/logout.js.map +1 -0
- package/lib/actions/auth/status.d.ts +11 -0
- package/lib/actions/auth/status.js +26 -0
- package/lib/actions/auth/status.js.map +1 -0
- package/lib/actions/portal/copilot.d.ts +5 -3
- package/lib/actions/portal/copilot.js +47 -37
- package/lib/actions/portal/copilot.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +4 -5
- package/lib/actions/portal/generate.js +30 -37
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/quickstart.d.ts +16 -0
- package/lib/actions/portal/quickstart.js +145 -0
- package/lib/actions/portal/quickstart.js.map +1 -0
- package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
- package/lib/actions/portal/recipe/new-recipe.js +147 -221
- package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
- package/lib/actions/portal/serve.d.ts +12 -10
- package/lib/actions/portal/serve.js +112 -17
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/portal/toc/new-toc.d.ts +16 -15
- package/lib/actions/portal/toc/new-toc.js +80 -116
- package/lib/actions/portal/toc/new-toc.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +5 -6
- package/lib/actions/sdk/generate.js +22 -47
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
- package/lib/application/portal/recipe/portal-recipe.js +9 -9
- package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
- package/lib/application/portal/recipe/recipe-generator.js +21 -22
- package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
- package/lib/client-utils/auth-manager.d.ts +1 -1
- package/lib/client-utils/auth-manager.js +3 -4
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +6 -3
- package/lib/commands/api/transform.js +43 -94
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.d.ts +6 -3
- package/lib/commands/api/validate.js +27 -66
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.d.ts +2 -1
- package/lib/commands/auth/login.js +15 -9
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.d.ts +3 -1
- package/lib/commands/auth/logout.js +12 -13
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.d.ts +1 -0
- package/lib/commands/auth/status.js +13 -11
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/portal/copilot.d.ts +2 -2
- package/lib/commands/portal/copilot.js +22 -20
- package/lib/commands/portal/copilot.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +3 -4
- package/lib/commands/portal/generate.js +19 -14
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/quickstart.d.ts +3 -4
- package/lib/commands/portal/quickstart.js +24 -101
- package/lib/commands/portal/quickstart.js.map +1 -1
- package/lib/commands/portal/recipe/new.d.ts +3 -1
- package/lib/commands/portal/recipe/new.js +31 -23
- package/lib/commands/portal/recipe/new.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +5 -5
- package/lib/commands/portal/serve.js +31 -57
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/portal/toc/new.d.ts +2 -2
- package/lib/commands/portal/toc/new.js +35 -26
- package/lib/commands/portal/toc/new.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -4
- package/lib/commands/sdk/generate.js +26 -17
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/hooks/not-found.js +1 -1
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/infrastructure/api-utils.js +3 -2
- package/lib/infrastructure/api-utils.js.map +1 -1
- package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
- package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
- package/lib/infrastructure/debounce-service.js.map +1 -0
- package/lib/infrastructure/env-info.d.ts +1 -1
- package/lib/infrastructure/env-info.js +2 -2
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +7 -2
- package/lib/infrastructure/file-service.js +46 -5
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/launcher-service.d.ts +2 -0
- package/lib/infrastructure/launcher-service.js +4 -0
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +7 -0
- package/lib/infrastructure/network-service.js.map +1 -0
- package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
- package/lib/infrastructure/services/api-client-factory.js +20 -0
- package/lib/infrastructure/services/api-client-factory.js.map +1 -0
- package/lib/infrastructure/services/api-service.d.ts +2 -2
- package/lib/infrastructure/services/api-service.js +6 -6
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.d.ts +1 -1
- package/lib/infrastructure/services/auth-service.js +7 -5
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- package/lib/infrastructure/services/file-download-service.d.ts +15 -0
- package/lib/infrastructure/services/file-download-service.js +104 -0
- package/lib/infrastructure/services/file-download-service.js.map +1 -0
- package/lib/infrastructure/services/portal-service.d.ts +11 -13
- package/lib/infrastructure/services/portal-service.js +73 -102
- package/lib/infrastructure/services/portal-service.js.map +1 -1
- package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
- package/lib/infrastructure/services/telemetry-service.js +4 -6
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- package/lib/infrastructure/services/transformation-service.d.ts +23 -0
- package/lib/infrastructure/services/transformation-service.js +56 -0
- package/lib/infrastructure/services/transformation-service.js.map +1 -0
- package/lib/infrastructure/services/validation-service.d.ts +17 -0
- package/lib/infrastructure/services/validation-service.js +49 -0
- package/lib/infrastructure/services/validation-service.js.map +1 -0
- package/lib/prompts/api/transform.d.ts +11 -0
- package/lib/prompts/api/transform.js +30 -0
- package/lib/prompts/api/transform.js.map +1 -0
- package/lib/prompts/api/validate.d.ts +12 -0
- package/lib/prompts/api/validate.js +41 -0
- package/lib/prompts/api/validate.js.map +1 -0
- package/lib/prompts/auth/login.d.ts +6 -1
- package/lib/prompts/auth/login.js +12 -3
- package/lib/prompts/auth/login.js.map +1 -1
- package/lib/prompts/auth/logout.d.ts +3 -0
- package/lib/prompts/auth/logout.js +7 -0
- package/lib/prompts/auth/logout.js.map +1 -0
- package/lib/prompts/auth/status.d.ts +8 -0
- package/lib/prompts/auth/status.js +21 -0
- package/lib/prompts/auth/status.js.map +1 -0
- package/lib/prompts/format.d.ts +33 -0
- package/lib/prompts/format.js +99 -0
- package/lib/prompts/format.js.map +1 -0
- package/lib/prompts/portal/copilot.d.ts +8 -4
- package/lib/prompts/portal/copilot.js +35 -24
- package/lib/prompts/portal/copilot.js.map +1 -1
- package/lib/prompts/portal/generate.d.ts +9 -7
- package/lib/prompts/portal/generate.js +22 -23
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/quickstart.d.ts +30 -29
- package/lib/prompts/portal/quickstart.js +99 -193
- package/lib/prompts/portal/quickstart.js.map +1 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
- package/lib/prompts/portal/recipe/new-recipe.js +70 -108
- package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
- package/lib/prompts/portal/serve.d.ts +10 -3
- package/lib/prompts/portal/serve.js +30 -11
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
- package/lib/prompts/portal/toc/new-toc.js +20 -22
- package/lib/prompts/portal/toc/new-toc.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +7 -7
- package/lib/prompts/sdk/generate.js +17 -23
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/types/api/account.d.ts +1 -1
- package/lib/types/api/transform.d.ts +14 -25
- package/lib/types/api/transform.js +16 -16
- package/lib/types/api/transform.js.map +1 -1
- package/lib/types/build/build.d.ts +9 -1
- package/lib/types/build/build.js +5 -2
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/build-context.d.ts +5 -1
- package/lib/types/build-context.js +21 -4
- package/lib/types/build-context.js.map +1 -1
- package/lib/types/common/command-metadata.d.ts +4 -0
- package/lib/types/common/command-metadata.js +2 -0
- package/lib/types/common/command-metadata.js.map +1 -0
- package/lib/types/events/domain-event.d.ts +1 -1
- package/lib/types/events/domain-event.js.map +1 -1
- package/lib/types/events/quickstart-completed.js +1 -1
- package/lib/types/events/quickstart-initiated.js +1 -1
- package/lib/types/events/recipe-creation-failed.d.ts +1 -1
- package/lib/types/events/recipe-creation-failed.js +1 -1
- package/lib/types/events/recipe-creation-failed.js.map +1 -1
- package/lib/types/events/toc-creation-failed.d.ts +1 -1
- package/lib/types/events/toc-creation-failed.js +1 -1
- package/lib/types/events/toc-creation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +17 -0
- package/lib/types/file/directory.js +86 -0
- package/lib/types/file/directory.js.map +1 -0
- package/lib/types/file/directoryPath.d.ts +3 -1
- package/lib/types/file/directoryPath.js +8 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +2 -0
- package/lib/types/file/fileName.js +12 -0
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +2 -0
- package/lib/types/file/filePath.js +21 -0
- package/lib/types/file/filePath.js.map +1 -1
- package/lib/types/file/resource-input.d.ts +5 -0
- package/lib/types/file/resource-input.js +42 -0
- package/lib/types/file/resource-input.js.map +1 -0
- package/lib/types/file/urlPath.d.ts +6 -0
- package/lib/types/file/urlPath.js +22 -0
- package/lib/types/file/urlPath.js.map +1 -0
- package/lib/types/portal-context.d.ts +3 -1
- package/lib/types/portal-context.js +10 -0
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/recipe/recipe.d.ts +2 -17
- package/lib/types/recipe-context.d.ts +8 -0
- package/lib/types/recipe-context.js +21 -0
- package/lib/types/recipe-context.js.map +1 -0
- package/lib/types/resource-context.d.ts +12 -0
- package/lib/types/resource-context.js +30 -0
- package/lib/types/resource-context.js.map +1 -0
- package/lib/types/sdk/generate.d.ts +2 -15
- package/lib/types/sdk/generate.js +24 -10
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk-context.d.ts +6 -5
- package/lib/types/sdk-context.js +12 -8
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/sdl/sdl.d.ts +9 -0
- package/lib/types/sdl/sdl.js +46 -1
- package/lib/types/sdl/sdl.js.map +1 -1
- package/lib/types/spec-context.d.ts +3 -0
- package/lib/types/spec-context.js +7 -2
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.d.ts +11 -0
- package/lib/types/temp-context.js +27 -0
- package/lib/types/temp-context.js.map +1 -0
- package/lib/types/toc-context.d.ts +12 -0
- package/lib/types/toc-context.js +26 -0
- package/lib/types/toc-context.js.map +1 -0
- package/lib/types/transform-context.d.ts +13 -0
- package/lib/types/transform-context.js +30 -0
- package/lib/types/transform-context.js.map +1 -0
- package/lib/types/utils.d.ts +0 -9
- package/lib/utils/string-utils.d.ts +1 -0
- package/lib/utils/string-utils.js +10 -0
- package/lib/utils/string-utils.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -27
- package/lib/utils/utils.js +6 -145
- package/lib/utils/utils.js.map +1 -1
- package/package.json +4 -4
- package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
- package/lib/application/portal/serve/portal-watcher.js +0 -64
- package/lib/application/portal/serve/portal-watcher.js.map +0 -1
- package/lib/application/portal/serve/serve-handler.d.ts +0 -16
- package/lib/application/portal/serve/serve-handler.js +0 -91
- package/lib/application/portal/serve/serve-handler.js.map +0 -1
- package/lib/application/portal/serve/watcher-handler.js.map +0 -1
- package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
- package/lib/application/portal/toc/sdl-parser.js +0 -90
- package/lib/application/portal/toc/sdl-parser.js.map +0 -1
- package/lib/client-utils/sdk-client.d.ts +0 -18
- package/lib/client-utils/sdk-client.js +0 -41
- package/lib/client-utils/sdk-client.js.map +0 -1
- package/lib/config/env.d.ts +0 -26
- package/lib/config/env.js +0 -27
- package/lib/config/env.js.map +0 -1
- package/lib/controllers/api/transform.d.ts +0 -5
- package/lib/controllers/api/transform.js +0 -50
- package/lib/controllers/api/transform.js.map +0 -1
- package/lib/controllers/api/validate.d.ts +0 -3
- package/lib/controllers/api/validate.js +0 -29
- package/lib/controllers/api/validate.js.map +0 -1
- package/lib/controllers/portal/quickstart.d.ts +0 -13
- package/lib/controllers/portal/quickstart.js +0 -214
- package/lib/controllers/portal/quickstart.js.map +0 -1
- package/lib/infrastructure/api-client-utils.d.ts +0 -6
- package/lib/infrastructure/api-client-utils.js +0 -34
- package/lib/infrastructure/api-client-utils.js.map +0 -1
- package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
- package/lib/prompts/portal/common/base-prompts.js +0 -19
- package/lib/prompts/portal/common/base-prompts.js.map +0 -1
- package/lib/types/api/validate.d.ts +0 -12
- package/lib/types/api/validate.js +0 -2
- package/lib/types/api/validate.js.map +0 -1
- package/lib/types/common/result.d.ts +0 -17
- package/lib/types/common/result.js +0 -32
- package/lib/types/common/result.js.map +0 -1
- package/lib/types/portal/generate.d.ts +0 -13
- package/lib/types/portal/generate.js +0 -3
- package/lib/types/portal/generate.js.map +0 -1
- package/lib/types/portal/quickstart.d.ts +0 -17
- package/lib/types/portal/quickstart.js +0 -2
- package/lib/types/portal/quickstart.js.map +0 -1
- package/lib/types/portal/serve.d.ts +0 -12
- package/lib/types/portal/serve.js +0 -2
- package/lib/types/portal/serve.js.map +0 -1
- package/lib/validators/common/directoryValidator.d.ts +0 -5
- package/lib/validators/common/directoryValidator.js +0 -22
- package/lib/validators/common/directoryValidator.js.map +0 -1
- package/lib/validators/portal/serve-validator.d.ts +0 -6
- package/lib/validators/portal/serve-validator.js +0 -15
- package/lib/validators/portal/serve-validator.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ $ npm install -g @apimatic/cli
|
|
|
24
24
|
$ apimatic COMMAND
|
|
25
25
|
running command...
|
|
26
26
|
$ apimatic (--version)
|
|
27
|
-
@apimatic/cli/1.1.0-alpha.
|
|
27
|
+
@apimatic/cli/1.1.0-alpha.22 win32-x64 node-v23.4.0
|
|
28
28
|
$ apimatic --help [COMMAND]
|
|
29
29
|
USAGE
|
|
30
30
|
$ apimatic COMMAND
|
|
@@ -34,130 +34,137 @@ USAGE
|
|
|
34
34
|
|
|
35
35
|
# Commands
|
|
36
36
|
<!-- commands -->
|
|
37
|
-
* [`apimatic api
|
|
38
|
-
* [`apimatic api
|
|
39
|
-
* [`apimatic auth
|
|
40
|
-
* [`apimatic auth
|
|
41
|
-
* [`apimatic auth
|
|
37
|
+
* [`apimatic api transform`](#apimatic-api-transform)
|
|
38
|
+
* [`apimatic api validate`](#apimatic-api-validate)
|
|
39
|
+
* [`apimatic auth login`](#apimatic-auth-login)
|
|
40
|
+
* [`apimatic auth logout`](#apimatic-auth-logout)
|
|
41
|
+
* [`apimatic auth status`](#apimatic-auth-status)
|
|
42
42
|
* [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
|
|
43
43
|
* [`apimatic help [COMMAND]`](#apimatic-help-command)
|
|
44
|
-
* [`apimatic portal
|
|
45
|
-
* [`apimatic portal
|
|
46
|
-
* [`apimatic portal
|
|
47
|
-
* [`apimatic portal
|
|
48
|
-
* [`apimatic portal
|
|
49
|
-
* [`apimatic portal
|
|
50
|
-
* [`apimatic sdk
|
|
44
|
+
* [`apimatic portal copilot`](#apimatic-portal-copilot)
|
|
45
|
+
* [`apimatic portal generate`](#apimatic-portal-generate)
|
|
46
|
+
* [`apimatic portal quickstart`](#apimatic-portal-quickstart)
|
|
47
|
+
* [`apimatic portal recipe new`](#apimatic-portal-recipe-new)
|
|
48
|
+
* [`apimatic portal serve`](#apimatic-portal-serve)
|
|
49
|
+
* [`apimatic portal toc new`](#apimatic-portal-toc-new)
|
|
50
|
+
* [`apimatic sdk generate`](#apimatic-sdk-generate)
|
|
51
51
|
|
|
52
|
-
## `apimatic api
|
|
52
|
+
## `apimatic api transform`
|
|
53
53
|
|
|
54
|
-
Transform API specifications
|
|
54
|
+
Transform API specifications between different formats.
|
|
55
55
|
|
|
56
56
|
```
|
|
57
57
|
USAGE
|
|
58
|
-
$ apimatic api
|
|
58
|
+
$ apimatic api transform --format
|
|
59
|
+
apimatic|wadl2009|wsdl|swagger10|swagger20|swaggeryaml|oas3|openapi3yaml|apiblueprint|raml|raml10|postman10|postman2
|
|
60
|
+
0|graphqlschema [--file <value>] [--url <value>] [-d <value>] [-f] [-k <value>]
|
|
59
61
|
|
|
60
62
|
FLAGS
|
|
61
|
-
-d, --destination=<value> [default: ./] directory to
|
|
63
|
+
-d, --destination=<value> [default: ./] directory to save the transformed file to
|
|
62
64
|
-f, --force overwrite changes without asking for user consent.
|
|
63
65
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
64
66
|
--file=<value> path to the API specification file to transform
|
|
65
|
-
--format=<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
--url=<value> URL to the API specification file to transform
|
|
69
|
-
if the API specification is publicly available.
|
|
67
|
+
--format=<option> (required) specification format to transform API specification into
|
|
68
|
+
<options: apimatic|wadl2009|wsdl|swagger10|swagger20|swaggeryaml|oas3|openapi3yaml|apibluep
|
|
69
|
+
rint|raml|raml10|postman10|postman20|graphqlschema>
|
|
70
|
+
--url=<value> URL to the API specification file to transform (publicly accessible)
|
|
70
71
|
|
|
71
72
|
DESCRIPTION
|
|
72
|
-
Transform API specifications
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
Transform API specifications between different formats.
|
|
74
|
+
|
|
75
|
+
Transform API specifications from one format to another.
|
|
76
|
+
Supports multiple formats including OpenAPI/Swagger, RAML, WSDL, and Postman Collections.
|
|
75
77
|
|
|
76
78
|
EXAMPLES
|
|
77
|
-
|
|
79
|
+
apimatic api transform --format=OPENAPI3YAML --file=./specs/sample.json --destination=./
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
apimatic api transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination=./
|
|
80
82
|
```
|
|
81
83
|
|
|
82
84
|
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
|
|
83
85
|
|
|
84
|
-
## `apimatic api
|
|
86
|
+
## `apimatic api validate`
|
|
85
87
|
|
|
86
|
-
Validate
|
|
88
|
+
Validate API specification for syntactic and semantic correctness.
|
|
87
89
|
|
|
88
90
|
```
|
|
89
91
|
USAGE
|
|
90
|
-
$ apimatic api
|
|
92
|
+
$ apimatic api validate [--file <value>] [--url <value>] [-k <value>]
|
|
91
93
|
|
|
92
94
|
FLAGS
|
|
93
95
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
94
96
|
--file=<value> Path to the API specification file to validate
|
|
95
|
-
--url=<value> URL to the specification file to validate
|
|
96
|
-
API specification is publicly available.
|
|
97
|
+
--url=<value> URL to the API specification file to validate (publicly accessible)
|
|
97
98
|
|
|
98
99
|
DESCRIPTION
|
|
99
|
-
Validate
|
|
100
|
+
Validate API specification for syntactic and semantic correctness.
|
|
101
|
+
|
|
102
|
+
Validate your API specification to ensure it adheres to syntactic and semantic standards.
|
|
100
103
|
|
|
101
104
|
EXAMPLES
|
|
102
|
-
|
|
105
|
+
apimatic api validate --file=./specs/sample.json
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
apimatic api validate --url="https://petstore.swagger.io/v2/swagger.json"
|
|
105
108
|
```
|
|
106
109
|
|
|
107
110
|
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
|
|
108
111
|
|
|
109
|
-
## `apimatic auth
|
|
112
|
+
## `apimatic auth login`
|
|
110
113
|
|
|
111
|
-
Login
|
|
114
|
+
Login to your APIMatic account.
|
|
112
115
|
|
|
113
116
|
```
|
|
114
117
|
USAGE
|
|
115
|
-
$ apimatic auth
|
|
118
|
+
$ apimatic auth login [-k <value>]
|
|
116
119
|
|
|
117
120
|
FLAGS
|
|
118
121
|
-k, --auth-key=<value> Sets authentication key for all commands.
|
|
119
122
|
|
|
120
123
|
DESCRIPTION
|
|
124
|
+
Login to your APIMatic account.
|
|
125
|
+
|
|
121
126
|
Login using your APIMatic credentials or an API Key
|
|
122
127
|
|
|
123
128
|
EXAMPLES
|
|
124
|
-
|
|
129
|
+
apimatic auth login
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
apimatic auth login --auth-key={api-key}
|
|
127
132
|
```
|
|
128
133
|
|
|
129
134
|
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
|
|
130
135
|
|
|
131
|
-
## `apimatic auth
|
|
136
|
+
## `apimatic auth logout`
|
|
132
137
|
|
|
133
138
|
Clears the local login credentials.
|
|
134
139
|
|
|
135
140
|
```
|
|
136
141
|
USAGE
|
|
137
|
-
$ apimatic auth
|
|
142
|
+
$ apimatic auth logout
|
|
138
143
|
|
|
139
144
|
DESCRIPTION
|
|
140
145
|
Clears the local login credentials.
|
|
141
146
|
|
|
147
|
+
Clears the local login credentials. This will also clear any cached credentials from the CLI.
|
|
148
|
+
|
|
142
149
|
EXAMPLES
|
|
143
|
-
|
|
150
|
+
apimatic auth logout
|
|
144
151
|
```
|
|
145
152
|
|
|
146
153
|
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
|
|
147
154
|
|
|
148
|
-
## `apimatic auth
|
|
155
|
+
## `apimatic auth status`
|
|
149
156
|
|
|
150
157
|
View the currently logged in user.
|
|
151
158
|
|
|
152
159
|
```
|
|
153
160
|
USAGE
|
|
154
|
-
$ apimatic auth
|
|
161
|
+
$ apimatic auth status
|
|
155
162
|
|
|
156
163
|
DESCRIPTION
|
|
157
164
|
View the currently logged in user.
|
|
158
165
|
|
|
159
166
|
EXAMPLES
|
|
160
|
-
|
|
167
|
+
apimatic auth status
|
|
161
168
|
```
|
|
162
169
|
|
|
163
170
|
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
|
|
@@ -213,13 +220,13 @@ DESCRIPTION
|
|
|
213
220
|
|
|
214
221
|
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
|
|
215
222
|
|
|
216
|
-
## `apimatic portal
|
|
223
|
+
## `apimatic portal copilot`
|
|
217
224
|
|
|
218
225
|
Configure API Copilot for your API Documentation portal
|
|
219
226
|
|
|
220
227
|
```
|
|
221
228
|
USAGE
|
|
222
|
-
$ apimatic portal
|
|
229
|
+
$ apimatic portal copilot [-i <value>] [--disable] [-f] [-k <value>]
|
|
223
230
|
|
|
224
231
|
FLAGS
|
|
225
232
|
-f, --force overwrite changes without asking for user consent.
|
|
@@ -233,23 +240,23 @@ DESCRIPTION
|
|
|
233
240
|
|
|
234
241
|
Displays available API Copilots associated with your account and allows you to select which one to integrate with your
|
|
235
242
|
portal. Each APIMatic account includes one Copilot by default. The selected Copilot will be added to your
|
|
236
|
-
APIMATIC-BUILD.json file
|
|
243
|
+
'APIMATIC-BUILD.json' file
|
|
237
244
|
|
|
238
245
|
EXAMPLES
|
|
239
|
-
|
|
246
|
+
apimatic portal copilot --input=./
|
|
240
247
|
|
|
241
|
-
|
|
248
|
+
apimatic portal copilot --input=./ --disable
|
|
242
249
|
```
|
|
243
250
|
|
|
244
251
|
_See code: [src/commands/portal/copilot.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/copilot.ts)_
|
|
245
252
|
|
|
246
|
-
## `apimatic portal
|
|
253
|
+
## `apimatic portal generate`
|
|
247
254
|
|
|
248
|
-
Generate an API Documentation portal.
|
|
255
|
+
Generate an API Documentation portal.
|
|
249
256
|
|
|
250
257
|
```
|
|
251
258
|
USAGE
|
|
252
|
-
$ apimatic portal
|
|
259
|
+
$ apimatic portal generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
|
|
253
260
|
|
|
254
261
|
FLAGS
|
|
255
262
|
-d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
|
|
@@ -260,100 +267,110 @@ FLAGS
|
|
|
260
267
|
--zip download the generated portal as a .zip archive
|
|
261
268
|
|
|
262
269
|
DESCRIPTION
|
|
270
|
+
Generate an API Documentation portal.
|
|
271
|
+
|
|
263
272
|
Generate an API Documentation portal. Requires an input directory containing API specifications, a config file and
|
|
264
273
|
optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/gu
|
|
265
274
|
ides/generating-on-prem-api-portal/build-file-reference)
|
|
266
275
|
|
|
267
276
|
EXAMPLES
|
|
268
|
-
|
|
277
|
+
apimatic portal generate
|
|
269
278
|
|
|
270
|
-
|
|
279
|
+
apimatic portal generate --input="./" --destination="./portal"
|
|
271
280
|
```
|
|
272
281
|
|
|
273
282
|
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
|
|
274
283
|
|
|
275
|
-
## `apimatic portal
|
|
284
|
+
## `apimatic portal quickstart`
|
|
276
285
|
|
|
277
|
-
|
|
286
|
+
Get started with your first API Portal in four easy steps.
|
|
278
287
|
|
|
279
288
|
```
|
|
280
289
|
USAGE
|
|
281
|
-
$ apimatic portal
|
|
290
|
+
$ apimatic portal quickstart
|
|
282
291
|
|
|
283
292
|
DESCRIPTION
|
|
293
|
+
Get started with your first API Portal in four easy steps.
|
|
294
|
+
|
|
284
295
|
Create your first API Portal using APIMatic's Docs as Code offering.
|
|
285
296
|
|
|
286
297
|
EXAMPLES
|
|
287
|
-
|
|
298
|
+
apimatic portal quickstart
|
|
288
299
|
```
|
|
289
300
|
|
|
290
301
|
_See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/quickstart.ts)_
|
|
291
302
|
|
|
292
|
-
## `apimatic portal
|
|
303
|
+
## `apimatic portal recipe new`
|
|
293
304
|
|
|
294
|
-
Add an API Recipe to your API
|
|
305
|
+
Add an API Recipe to your API documentation portal.
|
|
295
306
|
|
|
296
307
|
```
|
|
297
308
|
USAGE
|
|
298
|
-
$ apimatic portal
|
|
309
|
+
$ apimatic portal recipe new [--name <value>] [-i <value>] [-f]
|
|
299
310
|
|
|
300
311
|
FLAGS
|
|
312
|
+
-f, --force overwrite changes without asking for user consent.
|
|
301
313
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
|
|
302
314
|
specifications and configuration files.
|
|
303
315
|
--name=<value> name for the recipe
|
|
304
316
|
|
|
305
317
|
DESCRIPTION
|
|
306
|
-
Add an API Recipe to your API
|
|
318
|
+
Add an API Recipe to your API documentation portal.
|
|
319
|
+
|
|
320
|
+
This command adds a new API Recipe file to your documentation portal.
|
|
307
321
|
|
|
308
322
|
To learn more about API Recipes, visit:
|
|
309
323
|
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
|
|
310
324
|
|
|
311
325
|
EXAMPLES
|
|
312
|
-
|
|
326
|
+
apimatic portal recipe new
|
|
313
327
|
|
|
314
|
-
|
|
328
|
+
apimatic portal recipe new --name="My API Recipe" --input="./"
|
|
315
329
|
```
|
|
316
330
|
|
|
317
331
|
_See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
|
|
318
332
|
|
|
319
|
-
## `apimatic portal
|
|
333
|
+
## `apimatic portal serve`
|
|
320
334
|
|
|
321
|
-
Generate and
|
|
335
|
+
Generate and serve an API Documentation Portal with hot reload.
|
|
322
336
|
|
|
323
337
|
```
|
|
324
338
|
USAGE
|
|
325
|
-
$ apimatic portal
|
|
339
|
+
$ apimatic portal serve [-p 3000] [-i <value>] [-d <value>] [-o] [--no-reload] [-k <value>]
|
|
326
340
|
|
|
327
341
|
FLAGS
|
|
328
342
|
-d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
|
|
329
343
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
|
|
330
344
|
API specifications and configuration files.
|
|
331
345
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
332
|
-
-o, --open
|
|
333
|
-
-p, --port
|
|
334
|
-
--no-reload
|
|
346
|
+
-o, --open open the portal in the default browser.
|
|
347
|
+
-p, --port=3000 [default: 3000] port to serve the portal.
|
|
348
|
+
--no-reload disable hot reload.
|
|
335
349
|
|
|
336
350
|
DESCRIPTION
|
|
337
|
-
Generate and
|
|
351
|
+
Generate and serve an API Documentation Portal with hot reload.
|
|
352
|
+
|
|
353
|
+
Requires an input directory with API specifications, a config file, and optionally markdown guides. Supports disabling
|
|
354
|
+
hot reload and opening the portal in the default browser.
|
|
338
355
|
|
|
339
356
|
EXAMPLES
|
|
340
|
-
|
|
357
|
+
apimatic portal serve
|
|
341
358
|
|
|
342
|
-
|
|
359
|
+
apimatic portal serve --input=./ --destination=./portal --port=3000 --open --no-reload
|
|
343
360
|
```
|
|
344
361
|
|
|
345
362
|
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
|
|
346
363
|
|
|
347
|
-
## `apimatic portal
|
|
364
|
+
## `apimatic portal toc new`
|
|
348
365
|
|
|
349
366
|
Generate a Table of Contents (TOC) file for your API documentation portal
|
|
350
367
|
|
|
351
368
|
```
|
|
352
369
|
USAGE
|
|
353
|
-
$ apimatic portal
|
|
370
|
+
$ apimatic portal toc new [-d <value>] [-i <value>] [-f] [--expand-endpoints] [--expand-models]
|
|
354
371
|
|
|
355
372
|
FLAGS
|
|
356
|
-
-d, --destination=<value> [default: <input>/src/content] path where the
|
|
373
|
+
-d, --destination=<value> [default: <input>/src/content] path where the toc.yml will be generated.
|
|
357
374
|
-f, --force overwrite changes without asking for user consent.
|
|
358
375
|
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
|
|
359
376
|
API specifications and configuration files.
|
|
@@ -374,41 +391,46 @@ DESCRIPTION
|
|
|
374
391
|
https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal
|
|
375
392
|
|
|
376
393
|
EXAMPLES
|
|
377
|
-
|
|
394
|
+
apimatic portal toc new --destination=./src/content/
|
|
378
395
|
|
|
379
|
-
|
|
396
|
+
apimatic portal toc new --input=./
|
|
380
397
|
|
|
381
|
-
|
|
398
|
+
apimatic portal toc new --input=./ --destination=./src/content/
|
|
382
399
|
```
|
|
383
400
|
|
|
384
401
|
_See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
|
|
385
402
|
|
|
386
|
-
## `apimatic sdk
|
|
403
|
+
## `apimatic sdk generate`
|
|
387
404
|
|
|
388
405
|
Generate an SDK for your API
|
|
389
406
|
|
|
390
407
|
```
|
|
391
408
|
USAGE
|
|
392
|
-
$ apimatic sdk
|
|
393
|
-
[
|
|
409
|
+
$ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f] [--zip]
|
|
410
|
+
[-k <value>]
|
|
394
411
|
|
|
395
412
|
FLAGS
|
|
396
|
-
-d, --destination=<value>
|
|
413
|
+
-d, --destination=<value> directory where the SDK will be generated
|
|
397
414
|
-f, --force overwrite changes without asking for user consent.
|
|
398
415
|
-k, --auth-key=<value> override current authentication state with an authentication key.
|
|
399
|
-
|
|
416
|
+
-l, --language=<option> (required) programming language for SDK generation
|
|
400
417
|
<options: csharp|java|php|python|ruby|typescript|go>
|
|
401
|
-
--spec=<value> [default: ./src/spec] path to the folder containing the API specification file
|
|
418
|
+
--spec=<value> [default: ./src/spec] path to the folder containing the API specification file
|
|
402
419
|
--zip download the generated SDK as a .zip archive
|
|
403
420
|
|
|
404
421
|
DESCRIPTION
|
|
405
422
|
Generate an SDK for your API
|
|
406
423
|
|
|
424
|
+
Generate Software Development Kits (SDKs) from API specifications.
|
|
425
|
+
Supports multiple programming languages including Java, C#, Python, JavaScript, and more.
|
|
426
|
+
|
|
407
427
|
EXAMPLES
|
|
408
|
-
|
|
428
|
+
apimatic sdk generate --language=java
|
|
429
|
+
|
|
430
|
+
apimatic sdk generate --language=csharp --spec=./src/spec
|
|
409
431
|
|
|
410
|
-
|
|
432
|
+
apimatic sdk generate --language=python --destination=./sdk --zip
|
|
411
433
|
```
|
|
412
434
|
|
|
413
|
-
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_
|
|
435
|
+
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.1.0-alpha.21/src/commands/sdk/generate.ts)_
|
|
414
436
|
<!-- commandsstop -->
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export declare class ActionResult {
|
|
2
2
|
private readonly message;
|
|
3
|
+
private readonly resultType;
|
|
3
4
|
private constructor();
|
|
4
|
-
static error(message: string): ActionResult;
|
|
5
5
|
static success(): ActionResult;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
static failed(): ActionResult;
|
|
7
|
+
static cancelled(): ActionResult;
|
|
8
|
+
static stopped(): ActionResult;
|
|
9
|
+
getMessage(): string;
|
|
10
|
+
getExitCode(): number;
|
|
11
|
+
isFailed(): boolean;
|
|
12
|
+
mapAll<T>(onSuccess: () => T, onFailure: () => T, onCancel: () => T): T;
|
|
8
13
|
}
|
|
@@ -1,24 +1,43 @@
|
|
|
1
|
+
var ResultType;
|
|
2
|
+
(function (ResultType) {
|
|
3
|
+
ResultType[ResultType["Success"] = 0] = "Success";
|
|
4
|
+
ResultType[ResultType["Cancel"] = 130] = "Cancel";
|
|
5
|
+
ResultType[ResultType["Failure"] = 1] = "Failure";
|
|
6
|
+
})(ResultType || (ResultType = {}));
|
|
1
7
|
export class ActionResult {
|
|
2
|
-
constructor(message) {
|
|
8
|
+
constructor(resultType, message) {
|
|
9
|
+
this.resultType = resultType;
|
|
3
10
|
this.message = message;
|
|
4
11
|
}
|
|
5
|
-
static error(message) {
|
|
6
|
-
return new ActionResult(message);
|
|
7
|
-
}
|
|
8
12
|
static success() {
|
|
9
|
-
return new ActionResult();
|
|
13
|
+
return new ActionResult(ResultType.Success, " Succeeded ");
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
onError(this.message);
|
|
14
|
-
}
|
|
15
|
+
static failed() {
|
|
16
|
+
return new ActionResult(ResultType.Failure, " Failed ");
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
static cancelled() {
|
|
19
|
+
return new ActionResult(ResultType.Cancel, " Cancelled ");
|
|
20
|
+
}
|
|
21
|
+
static stopped() {
|
|
22
|
+
return new ActionResult(ResultType.Cancel, " Stopped ");
|
|
23
|
+
}
|
|
24
|
+
getMessage() {
|
|
25
|
+
return this.message;
|
|
26
|
+
}
|
|
27
|
+
getExitCode() {
|
|
28
|
+
return this.resultType.valueOf();
|
|
29
|
+
}
|
|
30
|
+
isFailed() {
|
|
31
|
+
return this.resultType === ResultType.Failure;
|
|
32
|
+
}
|
|
33
|
+
mapAll(onSuccess, onFailure, onCancel) {
|
|
34
|
+
switch (this.resultType) {
|
|
35
|
+
case ResultType.Success:
|
|
36
|
+
return onSuccess();
|
|
37
|
+
case ResultType.Failure:
|
|
38
|
+
return onFailure();
|
|
39
|
+
case ResultType.Cancel:
|
|
40
|
+
return onCancel();
|
|
22
41
|
}
|
|
23
42
|
}
|
|
24
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,IAAK,UAIJ;AAJD,WAAK,UAAU;IACb,iDAAU,CAAA;IACV,iDAAY,CAAA;IACZ,iDAAU,CAAA;AACZ,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,OAAO,YAAY;IAIvB,YAAoB,UAAsB,EAAE,OAAe;QACzD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,OAAO,CAAC;IAChD,CAAC;IAEM,MAAM,CAAI,SAAkB,EAAE,SAAkB,EAAE,QAAiB;QACxE,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,EAAE,CAAC;YACrB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,EAAE,CAAC;YACrB,KAAK,UAAU,CAAC,MAAM;gBACpB,OAAO,QAAQ,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { ExportFormats } from "@apimatic/sdk";
|
|
4
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
5
|
+
import { ResourceInput } from "../../types/file/resource-input.js";
|
|
6
|
+
export declare class TransformAction {
|
|
7
|
+
private readonly prompts;
|
|
8
|
+
private readonly validatePrompts;
|
|
9
|
+
private readonly transformationService;
|
|
10
|
+
private readonly configDir;
|
|
11
|
+
private readonly commandMetadata;
|
|
12
|
+
private readonly authKey;
|
|
13
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
14
|
+
readonly execute: (resourcePath: ResourceInput, format: ExportFormats, destination: DirectoryPath, force: boolean) => Promise<ActionResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { ApiTransformPrompts } from "../../prompts/api/transform.js";
|
|
3
|
+
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
4
|
+
import { TransformationService } from "../../infrastructure/services/transformation-service.js";
|
|
5
|
+
import { ApiValidatePrompts } from "../../prompts/api/validate.js";
|
|
6
|
+
import { TransformContext } from "../../types/transform-context.js";
|
|
7
|
+
import { ResourceContext } from "../../types/resource-context.js";
|
|
8
|
+
export class TransformAction {
|
|
9
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
10
|
+
this.prompts = new ApiTransformPrompts();
|
|
11
|
+
this.validatePrompts = new ApiValidatePrompts();
|
|
12
|
+
this.transformationService = new TransformationService();
|
|
13
|
+
this.execute = async (resourcePath, format, destination, force) => {
|
|
14
|
+
return await withDirPath(async (tempDirectory) => {
|
|
15
|
+
const resourceContext = new ResourceContext(tempDirectory);
|
|
16
|
+
const specFileDirResult = await resourceContext.resolveTo(resourcePath);
|
|
17
|
+
if (specFileDirResult.isErr()) {
|
|
18
|
+
this.prompts.networkError(specFileDirResult.error);
|
|
19
|
+
return ActionResult.failed();
|
|
20
|
+
}
|
|
21
|
+
const transformContext = new TransformContext(specFileDirResult.value, format, destination);
|
|
22
|
+
if (!force && (await transformContext.exists()) && !(await this.prompts.overwriteApi(destination))) {
|
|
23
|
+
this.prompts.transformedApiAlreadyExists();
|
|
24
|
+
return ActionResult.cancelled();
|
|
25
|
+
}
|
|
26
|
+
const result = await this.prompts.transformApi(this.transformationService.transformViaFile({
|
|
27
|
+
file: specFileDirResult.value,
|
|
28
|
+
format: format,
|
|
29
|
+
configDir: this.configDir,
|
|
30
|
+
commandMetadata: this.commandMetadata,
|
|
31
|
+
authKey: this.authKey
|
|
32
|
+
}));
|
|
33
|
+
if (result.isErr()) {
|
|
34
|
+
this.prompts.logTransformationError(result.error);
|
|
35
|
+
return ActionResult.failed();
|
|
36
|
+
}
|
|
37
|
+
const transformedFilePath = await transformContext.save(result.value.stream);
|
|
38
|
+
this.validatePrompts.displayValidationMessages(result.value.apiValidationSummary);
|
|
39
|
+
this.validatePrompts.transformedApiSaved(transformedFilePath);
|
|
40
|
+
return ActionResult.success();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
this.configDir = configDir;
|
|
44
|
+
this.commandMetadata = commandMetadata;
|
|
45
|
+
this.authKey = authKey;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/actions/api/transform.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
+
import { ActionResult } from "../action-result.js";
|
|
3
|
+
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
4
|
+
import { ResourceInput } from "../../types/file/resource-input.js";
|
|
5
|
+
export declare class ValidateAction {
|
|
6
|
+
private readonly prompts;
|
|
7
|
+
private readonly validationService;
|
|
8
|
+
private readonly authKey;
|
|
9
|
+
private readonly commandMetadata;
|
|
10
|
+
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
|
|
11
|
+
readonly execute: (resourcePath: ResourceInput, displayValidationSummary?: boolean) => Promise<ActionResult>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ActionResult } from "../action-result.js";
|
|
2
|
+
import { ApiValidatePrompts } from "../../prompts/api/validate.js";
|
|
3
|
+
import { ValidationService } from "../../infrastructure/services/validation-service.js";
|
|
4
|
+
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
5
|
+
import { ResourceContext } from "../../types/resource-context.js";
|
|
6
|
+
export class ValidateAction {
|
|
7
|
+
constructor(configDir, commandMetadata, authKey = null) {
|
|
8
|
+
this.prompts = new ApiValidatePrompts();
|
|
9
|
+
this.execute = async (resourcePath, displayValidationSummary = true) => {
|
|
10
|
+
return await withDirPath(async (tempDirectory) => {
|
|
11
|
+
const resourceContext = new ResourceContext(tempDirectory);
|
|
12
|
+
const specFileDirResult = await resourceContext.resolveTo(resourcePath);
|
|
13
|
+
if (specFileDirResult.isErr()) {
|
|
14
|
+
this.prompts.networkError(specFileDirResult.error);
|
|
15
|
+
return ActionResult.failed();
|
|
16
|
+
}
|
|
17
|
+
const validationSummaryResult = await this.prompts.validateApi(this.validationService.validateViaFile({
|
|
18
|
+
file: specFileDirResult.value,
|
|
19
|
+
commandMetadata: this.commandMetadata,
|
|
20
|
+
authKey: this.authKey
|
|
21
|
+
}));
|
|
22
|
+
if (validationSummaryResult.isErr()) {
|
|
23
|
+
this.prompts.logValidationError(validationSummaryResult.error);
|
|
24
|
+
return ActionResult.failed();
|
|
25
|
+
}
|
|
26
|
+
const validationSummary = validationSummaryResult.value;
|
|
27
|
+
if (displayValidationSummary) {
|
|
28
|
+
this.prompts.displayValidationMessages(validationSummary);
|
|
29
|
+
}
|
|
30
|
+
if (!validationSummary.success) {
|
|
31
|
+
return ActionResult.failed();
|
|
32
|
+
}
|
|
33
|
+
return ActionResult.success();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
this.authKey = authKey;
|
|
37
|
+
this.validationService = new ValidationService(configDir);
|
|
38
|
+
this.commandMetadata = commandMetadata;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=validate.js.map
|