@apimatic/cli 1.5.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +128 -212
- package/apimatic.schema.json +550 -0
- package/lib/actions/action-result.js +3 -0
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/transform.js +36 -33
- package/lib/actions/api/transform.js.map +1 -1
- package/lib/actions/api/validate.d.ts +9 -6
- package/lib/actions/api/validate.js +44 -38
- package/lib/actions/api/validate.js.map +1 -1
- package/lib/actions/auth/login.js +7 -4
- package/lib/actions/auth/login.js.map +1 -1
- package/lib/actions/auth/logout.js +2 -1
- package/lib/actions/auth/logout.js.map +1 -1
- package/lib/actions/auth/status.js +5 -3
- package/lib/actions/auth/status.js.map +1 -1
- package/lib/actions/plugin/generate.d.ts +5 -1
- package/lib/actions/plugin/generate.js +83 -56
- package/lib/actions/plugin/generate.js.map +1 -1
- package/lib/actions/plugin/publish.d.ts +2 -1
- package/lib/actions/plugin/publish.js +34 -37
- package/lib/actions/plugin/publish.js.map +1 -1
- package/lib/actions/plugin/record-metadata.d.ts +3 -2
- package/lib/actions/plugin/record-metadata.js +33 -30
- package/lib/actions/plugin/record-metadata.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +8 -6
- package/lib/actions/portal/generate.js +50 -61
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/prepare-project.d.ts +25 -0
- package/lib/actions/portal/prepare-project.js +68 -0
- package/lib/actions/portal/prepare-project.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +21 -6
- package/lib/actions/portal/serve.js +170 -153
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/publishing/profile/list.js +4 -2
- package/lib/actions/publishing/profile/list.js.map +1 -1
- package/lib/actions/quickstart.d.ts +23 -5
- package/lib/actions/quickstart.js +222 -21
- package/lib/actions/quickstart.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +4 -7
- package/lib/actions/sdk/generate.js +53 -93
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/actions/sdk/publish/interactive.d.ts +4 -3
- package/lib/actions/sdk/publish/interactive.js +96 -97
- package/lib/actions/sdk/publish/interactive.js.map +1 -1
- package/lib/actions/sdk/publish/non-interactive.d.ts +4 -2
- package/lib/actions/sdk/publish/non-interactive.js +91 -90
- package/lib/actions/sdk/publish/non-interactive.js.map +1 -1
- package/lib/actions/sdk/publish.d.ts +3 -2
- package/lib/actions/sdk/publish.js +55 -53
- package/lib/actions/sdk/publish.js.map +1 -1
- package/lib/actions/sdk/record-published-sdk.d.ts +14 -0
- package/lib/actions/sdk/record-published-sdk.js +57 -0
- package/lib/actions/sdk/record-published-sdk.js.map +1 -0
- package/lib/client-utils/auth-manager.js +1 -1
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +1 -1
- package/lib/commands/api/transform.js +44 -40
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.js +16 -16
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.js +14 -15
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.js +5 -6
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.js +4 -5
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/plugin/generate.d.ts +3 -3
- package/lib/commands/plugin/generate.js +20 -20
- package/lib/commands/plugin/generate.js.map +1 -1
- package/lib/commands/plugin/publish.js +18 -18
- package/lib/commands/plugin/publish.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +9 -8
- package/lib/commands/portal/generate.js +36 -27
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +7 -9
- package/lib/commands/portal/serve.js +41 -44
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/publishing/profile/list.js +8 -12
- package/lib/commands/publishing/profile/list.js.map +1 -1
- package/lib/commands/quickstart.d.ts +5 -5
- package/lib/commands/quickstart.js +18 -24
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -7
- package/lib/commands/sdk/generate.js +58 -70
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/commands/sdk/publish.d.ts +6 -7
- package/lib/commands/sdk/publish.js +66 -60
- package/lib/commands/sdk/publish.js.map +1 -1
- package/lib/hooks/node-version.d.ts +3 -0
- package/lib/hooks/node-version.js +12 -0
- package/lib/hooks/node-version.js.map +1 -0
- package/lib/hooks/not-found.js +2 -3
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/hooks/utils.d.ts +4 -2
- package/lib/hooks/utils.js +2 -2
- package/lib/hooks/utils.js.map +1 -1
- package/lib/infrastructure/env-info.d.ts +3 -0
- package/lib/infrastructure/env-info.js +13 -6
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +35 -8
- package/lib/infrastructure/file-service.js +149 -53
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/file-watch-service.d.ts +40 -0
- package/lib/infrastructure/file-watch-service.js +167 -0
- package/lib/infrastructure/file-watch-service.js.map +1 -0
- package/lib/infrastructure/generation-status-poller.d.ts +8 -7
- package/lib/infrastructure/generation-status-poller.js +20 -12
- package/lib/infrastructure/generation-status-poller.js.map +1 -1
- package/lib/infrastructure/launcher-service.js +6 -6
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +15 -1
- package/lib/infrastructure/network-service.js.map +1 -1
- package/lib/infrastructure/portal-build-service.d.ts +19 -0
- package/lib/infrastructure/portal-build-service.js +58 -0
- package/lib/infrastructure/portal-build-service.js.map +1 -0
- package/lib/infrastructure/portal-dev-server-service.d.ts +29 -0
- package/lib/infrastructure/portal-dev-server-service.js +135 -0
- package/lib/infrastructure/portal-dev-server-service.js.map +1 -0
- package/lib/infrastructure/portal-pages-service.d.ts +17 -0
- package/lib/infrastructure/portal-pages-service.js +103 -0
- package/lib/infrastructure/portal-pages-service.js.map +1 -0
- package/lib/infrastructure/portal-project-service.d.ts +77 -0
- package/lib/infrastructure/portal-project-service.js +309 -0
- package/lib/infrastructure/portal-project-service.js.map +1 -0
- package/lib/infrastructure/service-error.d.ts +1 -0
- package/lib/infrastructure/service-error.js +39 -41
- package/lib/infrastructure/service-error.js.map +1 -1
- package/lib/infrastructure/services/api-client-factory.js +15 -13
- package/lib/infrastructure/services/api-client-factory.js.map +1 -1
- package/lib/infrastructure/services/api-service.d.ts +7 -5
- package/lib/infrastructure/services/api-service.js +28 -20
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.js +4 -9
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- package/lib/infrastructure/services/file-download-service.js +3 -3
- package/lib/infrastructure/services/file-download-service.js.map +1 -1
- package/lib/infrastructure/services/plugin-service.d.ts +1 -8
- package/lib/infrastructure/services/plugin-service.js +11 -22
- package/lib/infrastructure/services/plugin-service.js.map +1 -1
- package/lib/infrastructure/services/portal-artifacts-service.d.ts +44 -0
- package/lib/infrastructure/services/portal-artifacts-service.js +268 -0
- package/lib/infrastructure/services/portal-artifacts-service.js.map +1 -0
- package/lib/infrastructure/services/portal-authorization-service.d.ts +22 -0
- package/lib/infrastructure/services/portal-authorization-service.js +23 -0
- package/lib/infrastructure/services/portal-authorization-service.js.map +1 -0
- package/lib/infrastructure/services/publishing-api-service.d.ts +1 -1
- package/lib/infrastructure/services/publishing-api-service.js +11 -15
- package/lib/infrastructure/services/publishing-api-service.js.map +1 -1
- package/lib/infrastructure/services/sdk-generation-service.d.ts +21 -0
- package/lib/infrastructure/services/sdk-generation-service.js +118 -0
- package/lib/infrastructure/services/sdk-generation-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.js +5 -4
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- package/lib/infrastructure/services/transformation-service.js +29 -32
- package/lib/infrastructure/services/transformation-service.js.map +1 -1
- package/lib/infrastructure/services/validation-service.d.ts +12 -53
- package/lib/infrastructure/services/validation-service.js +24 -199
- package/lib/infrastructure/services/validation-service.js.map +1 -1
- package/lib/infrastructure/timer-extensions.d.ts +2 -0
- package/lib/infrastructure/timer-extensions.js +10 -0
- package/lib/infrastructure/timer-extensions.js.map +1 -0
- package/lib/infrastructure/tmp-extensions.d.ts +31 -1
- package/lib/infrastructure/tmp-extensions.js +86 -3
- package/lib/infrastructure/tmp-extensions.js.map +1 -1
- package/lib/infrastructure/zip-service.js +2 -2
- package/lib/infrastructure/zip-service.js.map +1 -1
- package/lib/prompts/api/validate.d.ts +6 -7
- package/lib/prompts/api/validate.js +12 -12
- package/lib/prompts/api/validate.js.map +1 -1
- package/lib/prompts/format.d.ts +4 -0
- package/lib/prompts/format.js +5 -0
- package/lib/prompts/format.js.map +1 -1
- package/lib/prompts/plugin/generate.d.ts +17 -12
- package/lib/prompts/plugin/generate.js +94 -44
- package/lib/prompts/plugin/generate.js.map +1 -1
- package/lib/prompts/plugin/publish.d.ts +2 -1
- package/lib/prompts/plugin/publish.js +8 -7
- package/lib/prompts/plugin/publish.js.map +1 -1
- package/lib/prompts/plugin/record-metadata.d.ts +1 -0
- package/lib/prompts/plugin/record-metadata.js +10 -7
- package/lib/prompts/plugin/record-metadata.js.map +1 -1
- package/lib/prompts/portal/artifacts.d.ts +8 -0
- package/lib/prompts/portal/artifacts.js +26 -0
- package/lib/prompts/portal/artifacts.js.map +1 -0
- package/lib/prompts/portal/authorization.d.ts +6 -0
- package/lib/prompts/portal/authorization.js +29 -0
- package/lib/prompts/portal/authorization.js.map +1 -0
- package/lib/prompts/portal/code-samples.d.ts +1 -0
- package/lib/prompts/portal/code-samples.js +9 -0
- package/lib/prompts/portal/code-samples.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +14 -9
- package/lib/prompts/portal/generate.js +48 -26
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/prepare-project.d.ts +20 -0
- package/lib/prompts/portal/prepare-project.js +36 -0
- package/lib/prompts/portal/prepare-project.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +32 -12
- package/lib/prompts/portal/serve.js +102 -39
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/source.d.ts +26 -0
- package/lib/prompts/portal/source.js +253 -0
- package/lib/prompts/portal/source.js.map +1 -0
- package/lib/prompts/prompt.d.ts +11 -3
- package/lib/prompts/prompt.js +39 -15
- package/lib/prompts/prompt.js.map +1 -1
- package/lib/prompts/quickstart.d.ts +46 -3
- package/lib/prompts/quickstart.js +199 -12
- package/lib/prompts/quickstart.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +15 -13
- package/lib/prompts/sdk/generate.js +29 -32
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/prompts/sdk/publish/interactive.d.ts +10 -6
- package/lib/prompts/sdk/publish/interactive.js +26 -24
- package/lib/prompts/sdk/publish/interactive.js.map +1 -1
- package/lib/prompts/sdk/publish/non-interactive.d.ts +2 -1
- package/lib/prompts/sdk/publish/non-interactive.js +5 -4
- package/lib/prompts/sdk/publish/non-interactive.js.map +1 -1
- package/lib/prompts/sdk/publish.d.ts +3 -3
- package/lib/prompts/sdk/publish.js +13 -17
- package/lib/prompts/sdk/publish.js.map +1 -1
- package/lib/prompts/sdk/record-published-sdk.d.ts +7 -0
- package/lib/prompts/sdk/record-published-sdk.js +26 -0
- package/lib/prompts/sdk/record-published-sdk.js.map +1 -0
- package/lib/types/apimatic-config/document.d.ts +70 -0
- package/lib/types/apimatic-config/document.js +167 -0
- package/lib/types/apimatic-config/document.js.map +1 -0
- package/lib/types/apimatic-config/languages-block.d.ts +39 -0
- package/lib/types/apimatic-config/languages-block.js +58 -0
- package/lib/types/apimatic-config/languages-block.js.map +1 -0
- package/lib/types/apimatic-config-context.d.ts +48 -0
- package/lib/types/apimatic-config-context.js +121 -0
- package/lib/types/apimatic-config-context.js.map +1 -0
- package/lib/types/build/build.d.ts +1 -89
- package/lib/types/build/build.js +6 -161
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/events/domain-event.js +3 -0
- package/lib/types/events/domain-event.js.map +1 -1
- package/lib/types/events/quickstart-completed.js +3 -3
- package/lib/types/events/quickstart-completed.js.map +1 -1
- package/lib/types/events/quickstart-initiated.js +3 -3
- package/lib/types/events/quickstart-initiated.js.map +1 -1
- package/lib/types/events/sdk-publish-validation-failed.js +1 -1
- package/lib/types/events/sdk-publish-validation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +4 -9
- package/lib/types/file/directory.js +17 -65
- package/lib/types/file/directory.js.map +1 -1
- package/lib/types/file/directoryPath.d.ts +17 -0
- package/lib/types/file/directoryPath.js +47 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +8 -0
- package/lib/types/file/fileName.js +28 -6
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +18 -2
- package/lib/types/file/filePath.js +39 -4
- package/lib/types/file/filePath.js.map +1 -1
- package/lib/types/file/resource-input.js +1 -2
- package/lib/types/file/resource-input.js.map +1 -1
- package/lib/types/file/urlPath.js +2 -1
- package/lib/types/file/urlPath.js.map +1 -1
- package/lib/types/flags-provider.js +22 -22
- package/lib/types/flags-provider.js.map +1 -1
- package/lib/types/package-settings-context.js +2 -1
- package/lib/types/package-settings-context.js.map +1 -1
- package/lib/types/plugin/plugin-config.d.ts +10 -50
- package/lib/types/plugin/plugin-config.js +7 -1
- package/lib/types/plugin/plugin-config.js.map +1 -1
- package/lib/types/plugin-config-context.d.ts +30 -37
- package/lib/types/plugin-config-context.js +108 -139
- package/lib/types/plugin-config-context.js.map +1 -1
- package/lib/types/plugin-context.js +3 -2
- package/lib/types/plugin-context.js.map +1 -1
- package/lib/types/portal/code-samples.d.ts +27 -0
- package/lib/types/portal/code-samples.js +67 -0
- package/lib/types/portal/code-samples.js.map +1 -0
- package/lib/types/portal/config/ai-config.d.ts +15 -0
- package/lib/types/portal/config/ai-config.js +26 -0
- package/lib/types/portal/config/ai-config.js.map +1 -0
- package/lib/types/portal/config/brand-config.d.ts +55 -0
- package/lib/types/portal/config/brand-config.js +105 -0
- package/lib/types/portal/config/brand-config.js.map +1 -0
- package/lib/types/portal/config/color.d.ts +19 -0
- package/lib/types/portal/config/color.js +43 -0
- package/lib/types/portal/config/color.js.map +1 -0
- package/lib/types/portal/config/fields.d.ts +23 -0
- package/lib/types/portal/config/fields.js +67 -0
- package/lib/types/portal/config/fields.js.map +1 -0
- package/lib/types/portal/config/link.d.ts +18 -0
- package/lib/types/portal/config/link.js +72 -0
- package/lib/types/portal/config/link.js.map +1 -0
- package/lib/types/portal/config/navigation-config.d.ts +13 -0
- package/lib/types/portal/config/navigation-config.js +30 -0
- package/lib/types/portal/config/navigation-config.js.map +1 -0
- package/lib/types/portal/config/site-config.d.ts +32 -0
- package/lib/types/portal/config/site-config.js +88 -0
- package/lib/types/portal/config/site-config.js.map +1 -0
- package/lib/types/portal/config/static-asset.d.ts +25 -0
- package/lib/types/portal/config/static-asset.js +77 -0
- package/lib/types/portal/config/static-asset.js.map +1 -0
- package/lib/types/portal/content-notices.d.ts +20 -0
- package/lib/types/portal/content-notices.js +2 -0
- package/lib/types/portal/content-notices.js.map +1 -0
- package/lib/types/portal/content-tree.d.ts +103 -0
- package/lib/types/portal/content-tree.js +344 -0
- package/lib/types/portal/content-tree.js.map +1 -0
- package/lib/types/portal/endpoint.d.ts +6 -0
- package/lib/types/portal/endpoint.js +12 -0
- package/lib/types/portal/endpoint.js.map +1 -0
- package/lib/types/portal/generated-pages.d.ts +68 -0
- package/lib/types/portal/generated-pages.js +111 -0
- package/lib/types/portal/generated-pages.js.map +1 -0
- package/lib/types/portal/generation-status.d.ts +31 -0
- package/lib/types/portal/generation-status.js +26 -0
- package/lib/types/portal/generation-status.js.map +1 -0
- package/lib/types/portal/openapi-document.d.ts +48 -0
- package/lib/types/portal/openapi-document.js +138 -0
- package/lib/types/portal/openapi-document.js.map +1 -0
- package/lib/types/portal/page-fragments.d.ts +13 -0
- package/lib/types/portal/page-fragments.js +24 -0
- package/lib/types/portal/page-fragments.js.map +1 -0
- package/lib/types/portal/page-template.d.ts +15 -0
- package/lib/types/portal/page-template.js +64 -0
- package/lib/types/portal/page-template.js.map +1 -0
- package/lib/types/portal/page.d.ts +24 -0
- package/lib/types/portal/page.js +100 -0
- package/lib/types/portal/page.js.map +1 -0
- package/lib/types/portal/portal-artifacts.d.ts +25 -0
- package/lib/types/portal/portal-artifacts.js +30 -0
- package/lib/types/portal/portal-artifacts.js.map +1 -0
- package/lib/types/portal/portal-config.d.ts +69 -0
- package/lib/types/portal/portal-config.js +105 -0
- package/lib/types/portal/portal-config.js.map +1 -0
- package/lib/types/portal/portal-downloads.d.ts +8 -0
- package/lib/types/portal/portal-downloads.js +14 -0
- package/lib/types/portal/portal-downloads.js.map +1 -0
- package/lib/types/portal/portal-languages.d.ts +15 -0
- package/lib/types/portal/portal-languages.js +45 -0
- package/lib/types/portal/portal-languages.js.map +1 -0
- package/lib/types/portal/portal-navigation.d.ts +65 -0
- package/lib/types/portal/portal-navigation.js +217 -0
- package/lib/types/portal/portal-navigation.js.map +1 -0
- package/lib/types/portal/portal-sdk.d.ts +15 -0
- package/lib/types/portal/portal-sdk.js +28 -0
- package/lib/types/portal/portal-sdk.js.map +1 -0
- package/lib/types/portal/portal-source.d.ts +129 -0
- package/lib/types/portal/portal-source.js +2 -0
- package/lib/types/portal/portal-source.js.map +1 -0
- package/lib/types/portal/portal-stylesheet.d.ts +19 -0
- package/lib/types/portal/portal-stylesheet.js +40 -0
- package/lib/types/portal/portal-stylesheet.js.map +1 -0
- package/lib/types/portal/portal-tabs.d.ts +33 -0
- package/lib/types/portal/portal-tabs.js +38 -0
- package/lib/types/portal/portal-tabs.js.map +1 -0
- package/lib/types/portal/preview-config.d.ts +20 -0
- package/lib/types/portal/preview-config.js +32 -0
- package/lib/types/portal/preview-config.js.map +1 -0
- package/lib/types/portal/preview-content.d.ts +18 -0
- package/lib/types/portal/preview-content.js +50 -0
- package/lib/types/portal/preview-content.js.map +1 -0
- package/lib/types/portal/published-package.d.ts +12 -0
- package/lib/types/portal/published-package.js +35 -0
- package/lib/types/portal/published-package.js.map +1 -0
- package/lib/types/portal/unknown-fields.d.ts +5 -0
- package/lib/types/portal/unknown-fields.js +10 -0
- package/lib/types/portal/unknown-fields.js.map +1 -0
- package/lib/types/portal-context.d.ts +38 -6
- package/lib/types/portal-context.js +71 -24
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/portal-source-context.d.ts +77 -0
- package/lib/types/portal-source-context.js +408 -0
- package/lib/types/portal-source-context.js.map +1 -0
- package/lib/types/project-context.d.ts +49 -0
- package/lib/types/project-context.js +151 -0
- package/lib/types/project-context.js.map +1 -0
- package/lib/types/project-layout.d.ts +9 -0
- package/lib/types/project-layout.js +10 -0
- package/lib/types/project-layout.js.map +1 -0
- package/lib/types/publish/package-settings-configuration.d.ts +2 -0
- package/lib/types/publish/profile-id.js +1 -0
- package/lib/types/publish/profile-id.js.map +1 -1
- package/lib/types/publish/publishing-profile.d.ts +3 -1
- package/lib/types/publish/publishing-profile.js +33 -15
- package/lib/types/publish/publishing-profile.js.map +1 -1
- package/lib/types/publish/publishing-profiles.js +2 -1
- package/lib/types/publish/publishing-profiles.js.map +1 -1
- package/lib/types/publish/version.js +1 -0
- package/lib/types/publish/version.js.map +1 -1
- package/lib/types/resource-context.js +3 -2
- package/lib/types/resource-context.js.map +1 -1
- package/lib/types/sdk/generate.d.ts +22 -16
- package/lib/types/sdk/generate.js +64 -41
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk/stability-choice.d.ts +12 -0
- package/lib/types/sdk/stability-choice.js +24 -0
- package/lib/types/sdk/stability-choice.js.map +1 -0
- package/lib/types/sdk-context.d.ts +4 -5
- package/lib/types/sdk-context.js +10 -18
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/spec-context.d.ts +5 -4
- package/lib/types/spec-context.js +9 -8
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.d.ts +1 -1
- package/lib/types/temp-context.js +5 -4
- package/lib/types/temp-context.js.map +1 -1
- package/lib/types/transform-context.d.ts +9 -5
- package/lib/types/transform-context.js +21 -18
- package/lib/types/transform-context.js.map +1 -1
- package/lib/utils/error-utils.d.ts +2 -0
- package/lib/utils/error-utils.js +5 -0
- package/lib/utils/error-utils.js.map +1 -0
- package/lib/utils/json-utils.d.ts +2 -0
- package/lib/utils/json-utils.js +4 -0
- package/lib/utils/json-utils.js.map +1 -0
- package/lib/utils/string-utils.d.ts +8 -1
- package/lib/utils/string-utils.js +13 -26
- package/lib/utils/string-utils.js.map +1 -1
- package/lib/utils/utils.d.ts +1 -3
- package/lib/utils/utils.js +12 -40
- package/lib/utils/utils.js.map +1 -1
- package/oclif.manifest.json +69 -357
- package/package.json +47 -25
- package/portal-pages/context-plugin.mdx +26 -0
- package/portal-pages/sdk.mdx +8 -0
- package/portal-pages/sdks.mdx +11 -0
- package/portal-template/NOTICE +37 -0
- package/portal-template/downloads.ts +41 -0
- package/portal-template/generated-pages-reload.ts +51 -0
- package/portal-template/package.json +11 -0
- package/portal-template/portal-config.ts +32 -0
- package/portal-template/prerender-pages.ts +81 -0
- package/portal-template/spec-reload.ts +26 -0
- package/portal-template/src/components/api-page.tsx +15 -0
- package/portal-template/src/components/code-block.tsx +9 -0
- package/portal-template/src/components/command-block.tsx +50 -0
- package/portal-template/src/components/example-layout.tsx +99 -0
- package/portal-template/src/components/logos.tsx +127 -0
- package/portal-template/src/components/mdx.tsx +28 -0
- package/portal-template/src/components/not-found.tsx +11 -0
- package/portal-template/src/components/plugin-install.tsx +22 -0
- package/portal-template/src/components/plugin-support.tsx +53 -0
- package/portal-template/src/components/sdk-actions.tsx +79 -0
- package/portal-template/src/components/sdk-cards.tsx +100 -0
- package/portal-template/src/components/search.tsx +41 -0
- package/portal-template/src/components/usage-tabs.tsx +92 -0
- package/portal-template/src/lib/code-samples.server.ts +40 -0
- package/portal-template/src/lib/code-samples.ts +43 -0
- package/portal-template/src/lib/code-titles.ts +29 -0
- package/portal-template/src/lib/install-command.ts +13 -0
- package/portal-template/src/lib/json.ts +5 -0
- package/portal-template/src/lib/layout.shared.tsx +41 -0
- package/portal-template/src/lib/layout.tsx +16 -0
- package/portal-template/src/lib/llms.server.ts +54 -0
- package/portal-template/src/lib/media-adapters.ts +34 -0
- package/portal-template/src/lib/navigation.ts +406 -0
- package/portal-template/src/lib/openapi-bundle.server.ts +343 -0
- package/portal-template/src/lib/openapi-filter.ts +191 -0
- package/portal-template/src/lib/openapi-labels.ts +15 -0
- package/portal-template/src/lib/openapi-methods.ts +12 -0
- package/portal-template/src/lib/openapi-section.server.ts +280 -0
- package/portal-template/src/lib/openapi-slim.ts +202 -0
- package/portal-template/src/lib/openapi.server.ts +16 -0
- package/portal-template/src/lib/portal-types.ts +36 -0
- package/portal-template/src/lib/portal.server.ts +13 -0
- package/portal-template/src/lib/portal.ts +11 -0
- package/portal-template/src/lib/rehype-code-titles.ts +53 -0
- package/portal-template/src/lib/request-examples.ts +72 -0
- package/portal-template/src/lib/seo.ts +21 -0
- package/portal-template/src/lib/shared.ts +51 -0
- package/portal-template/src/lib/shiki-bundle.ts +104 -0
- package/portal-template/src/lib/sitemap.server.ts +20 -0
- package/portal-template/src/lib/source.server.ts +27 -0
- package/portal-template/src/lib/source.ts +49 -0
- package/portal-template/src/lib/tabs.ts +37 -0
- package/portal-template/src/router.tsx +12 -0
- package/portal-template/src/routes/$.tsx +194 -0
- package/portal-template/src/routes/__root.tsx +56 -0
- package/portal-template/src/routes/api/search[.]json.ts +9 -0
- package/portal-template/src/routes/llms-full[.]txt.ts +10 -0
- package/portal-template/src/routes/llms[.]txt.ts +10 -0
- package/portal-template/src/routes/robots[.]txt.ts +10 -0
- package/portal-template/src/routes/sitemap[.]xml.ts +10 -0
- package/portal-template/src/routes/spa-shell.tsx +7 -0
- package/portal-template/src/routes/{$}[.]md.ts +21 -0
- package/portal-template/src/styles/app.css +33 -0
- package/portal-template/tsconfig.json +26 -0
- package/portal-template/vite.config.ts +68 -0
- package/lib/actions/plugin/record-sdk.d.ts +0 -14
- package/lib/actions/plugin/record-sdk.js +0 -60
- package/lib/actions/plugin/record-sdk.js.map +0 -1
- package/lib/actions/portal/copilot.d.ts +0 -17
- package/lib/actions/portal/copilot.js +0 -89
- package/lib/actions/portal/copilot.js.map +0 -1
- package/lib/actions/portal/quickstart.d.ts +0 -18
- package/lib/actions/portal/quickstart.js +0 -238
- package/lib/actions/portal/quickstart.js.map +0 -1
- package/lib/actions/portal/recipe/new-recipe.d.ts +0 -15
- package/lib/actions/portal/recipe/new-recipe.js +0 -177
- package/lib/actions/portal/recipe/new-recipe.js.map +0 -1
- package/lib/actions/portal/toc/new-toc.d.ts +0 -21
- package/lib/actions/portal/toc/new-toc.js +0 -95
- package/lib/actions/portal/toc/new-toc.js.map +0 -1
- package/lib/actions/sdk/merge-source-tree.d.ts +0 -12
- package/lib/actions/sdk/merge-source-tree.js +0 -78
- package/lib/actions/sdk/merge-source-tree.js.map +0 -1
- package/lib/actions/sdk/quickstart.d.ts +0 -18
- package/lib/actions/sdk/quickstart.js +0 -188
- package/lib/actions/sdk/quickstart.js.map +0 -1
- package/lib/actions/sdk/save-changes.d.ts +0 -8
- package/lib/actions/sdk/save-changes.js +0 -93
- package/lib/actions/sdk/save-changes.js.map +0 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +0 -8
- package/lib/application/portal/recipe/portal-recipe.js +0 -33
- package/lib/application/portal/recipe/portal-recipe.js.map +0 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +0 -21
- package/lib/application/portal/recipe/recipe-generator.js +0 -130
- package/lib/application/portal/recipe/recipe-generator.js.map +0 -1
- package/lib/application/portal/toc/toc-content-parser.d.ts +0 -5
- package/lib/application/portal/toc/toc-content-parser.js +0 -44
- package/lib/application/portal/toc/toc-content-parser.js.map +0 -1
- package/lib/application/portal/toc/toc-structure-generator.d.ts +0 -11
- package/lib/application/portal/toc/toc-structure-generator.js +0 -165
- package/lib/application/portal/toc/toc-structure-generator.js.map +0 -1
- package/lib/commands/portal/copilot.d.ts +0 -13
- package/lib/commands/portal/copilot.js +0 -34
- package/lib/commands/portal/copilot.js.map +0 -1
- package/lib/commands/portal/recipe/new.d.ts +0 -12
- package/lib/commands/portal/recipe/new.js +0 -45
- package/lib/commands/portal/recipe/new.js.map +0 -1
- package/lib/commands/portal/toc/new.d.ts +0 -16
- package/lib/commands/portal/toc/new.js +0 -68
- package/lib/commands/portal/toc/new.js.map +0 -1
- package/lib/commands/sdk/save-changes.d.ts +0 -14
- package/lib/commands/sdk/save-changes.js +0 -51
- package/lib/commands/sdk/save-changes.js.map +0 -1
- package/lib/infrastructure/debounce-service.d.ts +0 -10
- package/lib/infrastructure/debounce-service.js +0 -55
- package/lib/infrastructure/debounce-service.js.map +0 -1
- package/lib/infrastructure/services/portal-service.d.ts +0 -43
- package/lib/infrastructure/services/portal-service.js +0 -337
- package/lib/infrastructure/services/portal-service.js.map +0 -1
- package/lib/prompts/plugin/record-sdk.d.ts +0 -9
- package/lib/prompts/plugin/record-sdk.js +0 -40
- package/lib/prompts/plugin/record-sdk.js.map +0 -1
- package/lib/prompts/portal/copilot.d.ts +0 -18
- package/lib/prompts/portal/copilot.js +0 -82
- package/lib/prompts/portal/copilot.js.map +0 -1
- package/lib/prompts/portal/quickstart.d.ts +0 -42
- package/lib/prompts/portal/quickstart.js +0 -243
- package/lib/prompts/portal/quickstart.js.map +0 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +0 -29
- package/lib/prompts/portal/recipe/new-recipe.js +0 -165
- package/lib/prompts/portal/recipe/new-recipe.js.map +0 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +0 -16
- package/lib/prompts/portal/toc/new-toc.js +0 -50
- package/lib/prompts/portal/toc/new-toc.js.map +0 -1
- package/lib/prompts/sdk/merge-source-tree.d.ts +0 -22
- package/lib/prompts/sdk/merge-source-tree.js +0 -90
- package/lib/prompts/sdk/merge-source-tree.js.map +0 -1
- package/lib/prompts/sdk/quickstart.d.ts +0 -38
- package/lib/prompts/sdk/quickstart.js +0 -196
- package/lib/prompts/sdk/quickstart.js.map +0 -1
- package/lib/prompts/sdk/save-changes.d.ts +0 -21
- package/lib/prompts/sdk/save-changes.js +0 -84
- package/lib/prompts/sdk/save-changes.js.map +0 -1
- package/lib/types/build-context.d.ts +0 -26
- package/lib/types/build-context.js +0 -111
- package/lib/types/build-context.js.map +0 -1
- package/lib/types/events/recipe-creation-failed.d.ts +0 -5
- package/lib/types/events/recipe-creation-failed.js +0 -8
- package/lib/types/events/recipe-creation-failed.js.map +0 -1
- package/lib/types/events/sdk-changes-saved.d.ts +0 -8
- package/lib/types/events/sdk-changes-saved.js +0 -11
- package/lib/types/events/sdk-changes-saved.js.map +0 -1
- package/lib/types/events/sdk-changes-tracked.d.ts +0 -8
- package/lib/types/events/sdk-changes-tracked.js +0 -11
- package/lib/types/events/sdk-changes-tracked.js.map +0 -1
- package/lib/types/events/sdk-conflicts-resolved.d.ts +0 -8
- package/lib/types/events/sdk-conflicts-resolved.js +0 -11
- package/lib/types/events/sdk-conflicts-resolved.js.map +0 -1
- package/lib/types/events/toc-creation-failed.d.ts +0 -5
- package/lib/types/events/toc-creation-failed.js +0 -8
- package/lib/types/events/toc-creation-failed.js.map +0 -1
- package/lib/types/merge-source-tree-context.d.ts +0 -28
- package/lib/types/merge-source-tree-context.js +0 -63
- package/lib/types/merge-source-tree-context.js.map +0 -1
- package/lib/types/plugin/language-entry.d.ts +0 -9
- package/lib/types/plugin/language-entry.js +0 -64
- package/lib/types/plugin/language-entry.js.map +0 -1
- package/lib/types/recipe/recipe.d.ts +0 -22
- package/lib/types/recipe/recipe.js +0 -6
- package/lib/types/recipe/recipe.js.map +0 -1
- package/lib/types/recipe-context.d.ts +0 -9
- package/lib/types/recipe-context.js +0 -26
- package/lib/types/recipe-context.js.map +0 -1
- package/lib/types/save-changes-context.d.ts +0 -17
- package/lib/types/save-changes-context.js +0 -42
- package/lib/types/save-changes-context.js.map +0 -1
- package/lib/types/sdl/sdl.d.ts +0 -10
- package/lib/types/sdl/sdl.js +0 -18
- package/lib/types/sdl/sdl.js.map +0 -1
- package/lib/types/toc/toc-components.d.ts +0 -36
- package/lib/types/toc/toc-components.js +0 -94
- package/lib/types/toc/toc-components.js.map +0 -1
- package/lib/types/toc/toc.d.ts +0 -67
- package/lib/types/toc/toc.js +0 -2
- package/lib/types/toc/toc.js.map +0 -1
- package/lib/types/toc-context.d.ts +0 -12
- package/lib/types/toc-context.js +0 -26
- package/lib/types/toc-context.js.map +0 -1
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ReadStream } from "fs";
|
|
2
|
-
import { Sdl } from "../../types/sdl/sdl.js";
|
|
3
|
-
import { FilePath } from "../../types/file/filePath.js";
|
|
4
|
-
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
5
|
-
import { CommandMetadata } from "../../types/common/command-metadata.js";
|
|
6
|
-
import { Result } from "neverthrow";
|
|
7
|
-
import { Language, Stability } from "../../types/sdk/generate.js";
|
|
8
|
-
import { ServiceError } from "../service-error.js";
|
|
9
|
-
import { SemVersion } from "../../types/publish/version.js";
|
|
10
|
-
import { TocData } from "../../types/toc/toc-components.js";
|
|
11
|
-
export interface GeneratedSdkResult {
|
|
12
|
-
sdk: NodeJS.ReadableStream;
|
|
13
|
-
sdkSourceTree: NodeJS.ReadableStream;
|
|
14
|
-
}
|
|
15
|
-
declare const TIMING_DEFAULTS: {
|
|
16
|
-
pollIntervalMs: number;
|
|
17
|
-
generationTimeoutMs: number;
|
|
18
|
-
requestTimeoutMs: number;
|
|
19
|
-
};
|
|
20
|
-
/** Overridable so tests are not paced by the production defaults; nothing else overrides them. */
|
|
21
|
-
export type GenerationTimings = Partial<typeof TIMING_DEFAULTS>;
|
|
22
|
-
export declare class PortalService {
|
|
23
|
-
private readonly CONTENT_TYPE;
|
|
24
|
-
private readonly apiBaseUrl;
|
|
25
|
-
private readonly fileService;
|
|
26
|
-
private readonly timings;
|
|
27
|
-
constructor(timings?: GenerationTimings);
|
|
28
|
-
generatePortal(buildPath: FilePath, configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey: string | null): Promise<Result<NodeJS.ReadableStream, ServiceError | NodeJS.ReadableStream>>;
|
|
29
|
-
generateSdk(buildPath: FilePath, language: Language, configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey: string | null, version?: SemVersion): Promise<Result<GeneratedSdkResult, ServiceError>>;
|
|
30
|
-
generateV4Sdk(buildPath: FilePath, language: Language, stability: Stability, configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey: string | null): Promise<Result<NodeJS.ReadableStream, ServiceError>>;
|
|
31
|
-
generateSdl(specFileStream: ReadStream, configDir: DirectoryPath, commandMetadata: CommandMetadata): Promise<Result<Sdl, ServiceError>>;
|
|
32
|
-
generateTocData(specFileStream: ReadStream, configDir: DirectoryPath, commandMetadata: CommandMetadata): Promise<Result<TocData, ServiceError>>;
|
|
33
|
-
private createAuthorizationHeader;
|
|
34
|
-
private resolveToken;
|
|
35
|
-
private getPortalGenerationStatus;
|
|
36
|
-
private getSdkGenerationStatus;
|
|
37
|
-
private getV4SdkGenerationStatus;
|
|
38
|
-
private axiosInstance;
|
|
39
|
-
private createOriginQueryParameter;
|
|
40
|
-
private readonly languageSdk;
|
|
41
|
-
private readonly stabilityTag;
|
|
42
|
-
}
|
|
43
|
-
export {};
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import { ApiError, SdkGenerationAsyncController, ContentType, DocsPortalGenerationAsyncController, SdkSourceTreeGenerationAsyncController, FileWrapper, TransformationController, ExportFormats, SdkLanguages, Status, TableOfContentsController, StabilityLevelTag, V2SdkGenerationController, } from "@apimatic/sdk";
|
|
3
|
-
import { getAuthInfo } from "../../client-utils/auth-manager.js";
|
|
4
|
-
import { parseStreamBodyToJson } from "../../utils/utils.js";
|
|
5
|
-
import { FileService } from "../file-service.js";
|
|
6
|
-
import { apiClientFactory } from "./api-client-factory.js";
|
|
7
|
-
import { err, ok } from "neverthrow";
|
|
8
|
-
import { Language, Stability } from "../../types/sdk/generate.js";
|
|
9
|
-
import { handleServiceError, ServiceError } from "../service-error.js";
|
|
10
|
-
import { formatValidationErrors, GENERATION_TIMEOUT_MS, pollUntilCompleted, STATUS_POLL_INTERVAL_MS } from "../generation-status-poller.js";
|
|
11
|
-
import { envInfo } from "../env-info.js";
|
|
12
|
-
import { REQUEST_TIMEOUT_MS } from "../../config/axios-config.js";
|
|
13
|
-
const TIMING_DEFAULTS = {
|
|
14
|
-
pollIntervalMs: STATUS_POLL_INTERVAL_MS,
|
|
15
|
-
generationTimeoutMs: GENERATION_TIMEOUT_MS,
|
|
16
|
-
requestTimeoutMs: REQUEST_TIMEOUT_MS
|
|
17
|
-
};
|
|
18
|
-
export class PortalService {
|
|
19
|
-
constructor(timings = {}) {
|
|
20
|
-
this.CONTENT_TYPE = ContentType.EnumMultipartformdata;
|
|
21
|
-
this.apiBaseUrl = "https://api.apimatic.io";
|
|
22
|
-
this.fileService = new FileService();
|
|
23
|
-
this.createAuthorizationHeader = (authInfo, overrideAuthKey) => {
|
|
24
|
-
var _a;
|
|
25
|
-
return `X-Auth-Key ${(_a = this.resolveToken(authInfo, overrideAuthKey)) !== null && _a !== void 0 ? _a : ""}`;
|
|
26
|
-
};
|
|
27
|
-
this.resolveToken = (authInfo, overrideAuthKey) => {
|
|
28
|
-
return overrideAuthKey || (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authKey);
|
|
29
|
-
};
|
|
30
|
-
this.createOriginQueryParameter = (commandName) => {
|
|
31
|
-
return {
|
|
32
|
-
origin: `APIMATIC CLI ${commandName}`
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
this.languageSdk = {
|
|
36
|
-
[Language.CSHARP]: SdkLanguages.Csharp,
|
|
37
|
-
[Language.JAVA]: SdkLanguages.Java,
|
|
38
|
-
[Language.PHP]: SdkLanguages.Php,
|
|
39
|
-
[Language.PYTHON]: SdkLanguages.Python,
|
|
40
|
-
[Language.RUBY]: SdkLanguages.Ruby,
|
|
41
|
-
[Language.TYPESCRIPT]: SdkLanguages.Typescript,
|
|
42
|
-
[Language.GO]: SdkLanguages.Go
|
|
43
|
-
};
|
|
44
|
-
this.stabilityTag = {
|
|
45
|
-
[Stability.STABLE]: StabilityLevelTag.Stable,
|
|
46
|
-
[Stability.BETA]: StabilityLevelTag.Beta
|
|
47
|
-
};
|
|
48
|
-
this.timings = Object.assign(Object.assign({}, TIMING_DEFAULTS), timings);
|
|
49
|
-
}
|
|
50
|
-
// TODO: Pass stream as parameter instead of file path.
|
|
51
|
-
async generatePortal(buildPath, configDir, commandMetadata, authKey) {
|
|
52
|
-
const buildFileStream = await this.fileService.getStream(buildPath);
|
|
53
|
-
const file = new FileWrapper(buildFileStream);
|
|
54
|
-
const authInfo = await getAuthInfo(configDir.toString());
|
|
55
|
-
const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey);
|
|
56
|
-
const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
|
|
57
|
-
const docsPortalAsyncController = new DocsPortalGenerationAsyncController(client);
|
|
58
|
-
let generationId;
|
|
59
|
-
try {
|
|
60
|
-
const portalInstance = await docsPortalAsyncController.generateOnPremPortalViaBuildInputAsync(this.CONTENT_TYPE, file);
|
|
61
|
-
generationId = portalInstance.result.id;
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
// ProblemDetails (400/403), 401 and other SDK statuses are mapped centrally.
|
|
65
|
-
return err(handleServiceError(error));
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
buildFileStream.close();
|
|
69
|
-
}
|
|
70
|
-
const statusResult = await pollUntilCompleted({
|
|
71
|
-
pollIntervalMs: this.timings.pollIntervalMs,
|
|
72
|
-
fetchStatus: () => this.getPortalGenerationStatus(generationId, commandMetadata.shell, this.resolveToken(authInfo, authKey)),
|
|
73
|
-
timeout: { budgetMs: this.timings.generationTimeoutMs, label: "Portal generation" }
|
|
74
|
-
});
|
|
75
|
-
if (statusResult.isErr()) {
|
|
76
|
-
return err(statusResult.error);
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const portalDownloadResponse = await docsPortalAsyncController.downloadGeneratedPortal(generationId);
|
|
80
|
-
return ok(portalDownloadResponse.result);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
if (error instanceof ApiError && error.statusCode === 422) {
|
|
84
|
-
return err(error.body);
|
|
85
|
-
}
|
|
86
|
-
return err(handleServiceError(error));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// TODO: Pass stream as parameter instead of file path.
|
|
90
|
-
async generateSdk(buildPath, language, configDir, commandMetadata, authKey, version) {
|
|
91
|
-
const buildFileStream = await this.fileService.getStream(buildPath);
|
|
92
|
-
const file = new FileWrapper(buildFileStream);
|
|
93
|
-
const authInfo = await getAuthInfo(configDir.toString());
|
|
94
|
-
const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey);
|
|
95
|
-
const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
|
|
96
|
-
const sdkGenerationController = new SdkGenerationAsyncController(client);
|
|
97
|
-
let generationId;
|
|
98
|
-
try {
|
|
99
|
-
const response = await sdkGenerationController.generateSdkViaBuildInputAsync(this.CONTENT_TYPE, file, this.languageSdk[language], undefined, version === null || version === void 0 ? void 0 : version.toString());
|
|
100
|
-
generationId = response.result.id;
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
return err(handleServiceError(error));
|
|
104
|
-
}
|
|
105
|
-
finally {
|
|
106
|
-
buildFileStream.close();
|
|
107
|
-
}
|
|
108
|
-
const statusResult = await pollUntilCompleted({
|
|
109
|
-
pollIntervalMs: this.timings.pollIntervalMs,
|
|
110
|
-
fetchStatus: () => this.getSdkGenerationStatus(generationId, commandMetadata.shell, this.resolveToken(authInfo, authKey)),
|
|
111
|
-
timeout: { budgetMs: this.timings.generationTimeoutMs, label: "SDK generation" },
|
|
112
|
-
formatValidationError: formatSdkValidationError
|
|
113
|
-
});
|
|
114
|
-
if (statusResult.isErr()) {
|
|
115
|
-
return err(statusResult.error);
|
|
116
|
-
}
|
|
117
|
-
try {
|
|
118
|
-
const sdkResponse = await sdkGenerationController.downloadGeneratedSdk(generationId);
|
|
119
|
-
const sdkSourceTreeController = new SdkSourceTreeGenerationAsyncController(client);
|
|
120
|
-
const sdkSourceTreeResponse = await sdkSourceTreeController.downloadGeneratedSdkSourceTree(generationId);
|
|
121
|
-
return ok({
|
|
122
|
-
sdk: sdkResponse.result,
|
|
123
|
-
sdkSourceTree: sdkSourceTreeResponse.result
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
return err(handleServiceError(error));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
async generateV4Sdk(buildPath, language, stability, configDir, commandMetadata, authKey) {
|
|
131
|
-
const buildFileStream = await this.fileService.getStream(buildPath);
|
|
132
|
-
const file = new FileWrapper(buildFileStream);
|
|
133
|
-
const authInfo = await getAuthInfo(configDir.toString());
|
|
134
|
-
const authorizationHeader = this.createAuthorizationHeader(authInfo, authKey);
|
|
135
|
-
const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
|
|
136
|
-
const v2sdkGenerationController = new V2SdkGenerationController(client);
|
|
137
|
-
let generationId;
|
|
138
|
-
try {
|
|
139
|
-
const response = await v2sdkGenerationController.generateV2SdkViaBuildInputAsync(this.CONTENT_TYPE, file, this.languageSdk[language], this.stabilityTag[stability]);
|
|
140
|
-
generationId = response.result.id;
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
return err(handleServiceError(error));
|
|
144
|
-
}
|
|
145
|
-
finally {
|
|
146
|
-
buildFileStream.close();
|
|
147
|
-
}
|
|
148
|
-
const statusResult = await pollUntilCompleted({
|
|
149
|
-
pollIntervalMs: this.timings.pollIntervalMs,
|
|
150
|
-
fetchStatus: () => this.getV4SdkGenerationStatus(generationId, commandMetadata.shell, this.resolveToken(authInfo, authKey)),
|
|
151
|
-
timeout: { budgetMs: this.timings.generationTimeoutMs, label: "SDK generation" }
|
|
152
|
-
});
|
|
153
|
-
if (statusResult.isErr()) {
|
|
154
|
-
return err(statusResult.error);
|
|
155
|
-
}
|
|
156
|
-
try {
|
|
157
|
-
const sdkResponse = await v2sdkGenerationController.downloadGeneratedV2Sdk(generationId);
|
|
158
|
-
return ok(sdkResponse.result);
|
|
159
|
-
}
|
|
160
|
-
catch (error) {
|
|
161
|
-
return err(handleServiceError(error));
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async generateSdl(specFileStream, configDir, commandMetadata) {
|
|
165
|
-
const file = new FileWrapper(specFileStream);
|
|
166
|
-
const authInfo = await getAuthInfo(configDir.toString());
|
|
167
|
-
const authorizationHeader = this.createAuthorizationHeader(authInfo, null);
|
|
168
|
-
const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
|
|
169
|
-
const transformationController = new TransformationController(client);
|
|
170
|
-
try {
|
|
171
|
-
const generation = await transformationController.transformViaFile(ContentType.EnumMultipartformdata, file, ExportFormats.Apimatic, this.createOriginQueryParameter(commandMetadata.commandName));
|
|
172
|
-
if (!generation.result.success) {
|
|
173
|
-
return err(ServiceError.InvalidResponse);
|
|
174
|
-
}
|
|
175
|
-
const transformationId = generation.result.id;
|
|
176
|
-
const { result } = await transformationController.downloadTransformedFile(transformationId);
|
|
177
|
-
if (result.readable) {
|
|
178
|
-
return ok((await parseStreamBodyToJson(result)));
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
return err(ServiceError.InvalidResponse);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
return err(handleServiceError(error));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
async generateTocData(specFileStream, configDir, commandMetadata) {
|
|
189
|
-
const file = new FileWrapper(specFileStream);
|
|
190
|
-
const authInfo = await getAuthInfo(configDir.toString());
|
|
191
|
-
const authorizationHeader = this.createAuthorizationHeader(authInfo, null);
|
|
192
|
-
const client = apiClientFactory.createApiClient(authorizationHeader, commandMetadata.shell);
|
|
193
|
-
const tableOfContentsController = new TableOfContentsController(client);
|
|
194
|
-
try {
|
|
195
|
-
const response = await tableOfContentsController.generateTocData(ContentType.EnumMultipartformdata, file, this.createOriginQueryParameter(commandMetadata.commandName));
|
|
196
|
-
if (response.result.readable) {
|
|
197
|
-
return ok((await parseStreamBodyToJson(response.result)));
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
return err(ServiceError.InvalidResponse);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
catch (error) {
|
|
204
|
-
return err(handleServiceError(error));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
async getPortalGenerationStatus(requestId, shell, token) {
|
|
208
|
-
if (!token) {
|
|
209
|
-
return err(ServiceError.UnAuthorized);
|
|
210
|
-
}
|
|
211
|
-
try {
|
|
212
|
-
const response = await this.axiosInstance(shell, token).get(`/portal/v2/${requestId}/status`, {
|
|
213
|
-
headers: { Accept: "application/json" },
|
|
214
|
-
maxRedirects: 0,
|
|
215
|
-
validateStatus: () => true
|
|
216
|
-
});
|
|
217
|
-
if (response.status === 200) {
|
|
218
|
-
return ok(response.data);
|
|
219
|
-
}
|
|
220
|
-
// Once generation finishes, the API redirects to the download location.
|
|
221
|
-
if (response.status === 302) {
|
|
222
|
-
return ok({ status: Status.Completed });
|
|
223
|
-
}
|
|
224
|
-
// `validateStatus` above stops axios throwing, so nothing reaches the
|
|
225
|
-
// catch block — classify the status here, or a mistyped endpoint path and
|
|
226
|
-
// an expired auth key both surface as a generic "unexpected error".
|
|
227
|
-
if (response.status === 401) {
|
|
228
|
-
return err(ServiceError.UnAuthorized);
|
|
229
|
-
}
|
|
230
|
-
if (response.status === 404) {
|
|
231
|
-
return err(ServiceError.NotFound);
|
|
232
|
-
}
|
|
233
|
-
if (response.status === 500) {
|
|
234
|
-
return err(ServiceError.ServerError);
|
|
235
|
-
}
|
|
236
|
-
return err(ServiceError.InvalidResponse);
|
|
237
|
-
}
|
|
238
|
-
catch (error) {
|
|
239
|
-
return err(handleServiceError(error));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
async getSdkGenerationStatus(requestId, shell, token) {
|
|
243
|
-
if (!token) {
|
|
244
|
-
return err(ServiceError.UnAuthorized);
|
|
245
|
-
}
|
|
246
|
-
try {
|
|
247
|
-
const response = await this.axiosInstance(shell, token).get(`/sdk/${requestId}/status`, {
|
|
248
|
-
headers: { Accept: "application/json" },
|
|
249
|
-
maxRedirects: 0,
|
|
250
|
-
validateStatus: () => true
|
|
251
|
-
});
|
|
252
|
-
if (response.status === 200) {
|
|
253
|
-
return ok(response.data);
|
|
254
|
-
}
|
|
255
|
-
// Once generation finishes, the API redirects to the download location.
|
|
256
|
-
if (response.status === 302) {
|
|
257
|
-
return ok({ status: Status.Completed });
|
|
258
|
-
}
|
|
259
|
-
// `validateStatus` above stops axios throwing, so nothing reaches the
|
|
260
|
-
// catch block — classify the status here, or a mistyped endpoint path and
|
|
261
|
-
// an expired auth key both surface as a generic "unexpected error".
|
|
262
|
-
if (response.status === 401) {
|
|
263
|
-
return err(ServiceError.UnAuthorized);
|
|
264
|
-
}
|
|
265
|
-
if (response.status === 404) {
|
|
266
|
-
return err(ServiceError.NotFound);
|
|
267
|
-
}
|
|
268
|
-
if (response.status === 500) {
|
|
269
|
-
return err(ServiceError.ServerError);
|
|
270
|
-
}
|
|
271
|
-
return err(ServiceError.InvalidResponse);
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
return err(handleServiceError(error));
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
async getV4SdkGenerationStatus(requestId, shell, token) {
|
|
278
|
-
if (!token) {
|
|
279
|
-
return err(ServiceError.UnAuthorized);
|
|
280
|
-
}
|
|
281
|
-
try {
|
|
282
|
-
const response = await this.axiosInstance(shell, token).get(`/sdk/v2/${requestId}/status`, {
|
|
283
|
-
headers: { Accept: "application/json" },
|
|
284
|
-
maxRedirects: 0,
|
|
285
|
-
validateStatus: () => true
|
|
286
|
-
});
|
|
287
|
-
if (response.status === 200) {
|
|
288
|
-
return ok(response.data);
|
|
289
|
-
}
|
|
290
|
-
// Once generation finishes, the API redirects to the download location.
|
|
291
|
-
if (response.status === 302) {
|
|
292
|
-
return ok({ status: Status.Completed });
|
|
293
|
-
}
|
|
294
|
-
// `validateStatus` above stops axios throwing, so nothing reaches the
|
|
295
|
-
// catch block — classify the status here, or a mistyped endpoint path and
|
|
296
|
-
// an expired auth key both surface as a generic "unexpected error".
|
|
297
|
-
if (response.status === 401) {
|
|
298
|
-
return err(ServiceError.UnAuthorized);
|
|
299
|
-
}
|
|
300
|
-
if (response.status === 404) {
|
|
301
|
-
return err(ServiceError.NotFound);
|
|
302
|
-
}
|
|
303
|
-
if (response.status === 500) {
|
|
304
|
-
return err(ServiceError.ServerError);
|
|
305
|
-
}
|
|
306
|
-
return err(ServiceError.InvalidResponse);
|
|
307
|
-
}
|
|
308
|
-
catch (error) {
|
|
309
|
-
return err(handleServiceError(error));
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
axiosInstance(shell, apiKey) {
|
|
313
|
-
var _a;
|
|
314
|
-
return axios.create({
|
|
315
|
-
baseURL: (_a = envInfo.getBaseUrl()) !== null && _a !== void 0 ? _a : this.apiBaseUrl,
|
|
316
|
-
timeout: this.timings.requestTimeoutMs,
|
|
317
|
-
headers: {
|
|
318
|
-
"User-Agent": envInfo.getUserAgent(shell),
|
|
319
|
-
Authorization: `X-Auth-Key ${apiKey}`
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* SDK generation reports per-language merge conflicts under a dedicated `sdkMergeFailed`
|
|
326
|
-
* key, which needs its own wording. Everything else falls back to the shared format.
|
|
327
|
-
*/
|
|
328
|
-
const formatSdkValidationError = (errors) => {
|
|
329
|
-
const sdkMergeFailedLanguages = errors.sdkMergeFailed;
|
|
330
|
-
if (sdkMergeFailedLanguages === null || sdkMergeFailedLanguages === void 0 ? void 0 : sdkMergeFailedLanguages.length) {
|
|
331
|
-
return ("SDK generation failed for these languages due to merge conflict." +
|
|
332
|
-
"\n- " +
|
|
333
|
-
sdkMergeFailedLanguages.join("\n- "));
|
|
334
|
-
}
|
|
335
|
-
return formatValidationErrors(errors);
|
|
336
|
-
};
|
|
337
|
-
//# sourceMappingURL=portal-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portal-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/portal-service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EAER,4BAA4B,EAC5B,WAAW,EACX,mCAAmC,EACnC,sCAAsC,EACtC,WAAW,EACX,wBAAwB,EAExB,aAAa,EACb,YAAY,EACZ,MAAM,EACN,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EAExB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CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,KAAa,EAAE,MAAc;;QACjD,OAAO,KAAK,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,MAAA,OAAO,CAAC,UAAU,EAAE,mCAAI,IAAI,CAAC,UAAU;YAChD,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB;YACtC,OAAO,EAAE;gBACP,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC;gBACzC,aAAa,EAAE,cAAc,MAAM,EAAE;aACtC;SACF,CAAC,CAAC;IACL,CAAC;CAsBF;AAED;;;GAGG;AACH,MAAM,wBAAwB,GAA6B,CAAC,MAAM,EAAE,EAAE;IACpE,MAAM,uBAAuB,GAAG,MAAM,CAAC,cAAc,CAAC;IACtD,IAAI,uBAAuB,aAAvB,uBAAuB,uBAAvB,uBAAuB,CAAE,MAAM,EAAE,CAAC;QACpC,OAAO,CACL,kEAAkE;YAClE,MAAM;YACN,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CACrC,CAAC;IACJ,CAAC;IACD,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CodeGenerationVersion, Language } from '../../types/sdk/generate.js';
|
|
2
|
-
export declare class PluginRecordSdkPrompts {
|
|
3
|
-
sdkRecorded(language: Language, configExists: boolean): void;
|
|
4
|
-
codegenVersionMismatch(language: Language, actual: CodeGenerationVersion, expected: CodeGenerationVersion): void;
|
|
5
|
-
confirmCodegenVersionOverwrite(): Promise<boolean>;
|
|
6
|
-
noSourceRepository(language: Language): void;
|
|
7
|
-
pluginConfigUnreadable(reason?: string): void;
|
|
8
|
-
pluginConfigNotWritten(): void;
|
|
9
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { confirm, isCancel, log } from '@clack/prompts';
|
|
2
|
-
import { format as f } from '../format.js';
|
|
3
|
-
const PLUGIN_CONFIG_FILE = 'plugin-config.json';
|
|
4
|
-
export class PluginRecordSdkPrompts {
|
|
5
|
-
sdkRecorded(language, configExists) {
|
|
6
|
-
const message = (configExists
|
|
7
|
-
? `Updated ${f.var(PLUGIN_CONFIG_FILE)} for ${f.var(language)}. `
|
|
8
|
-
: `Created ${f.var(PLUGIN_CONFIG_FILE)} and added ${f.var(language)}. `) +
|
|
9
|
-
`Run '${f.cmdAlt('apimatic', 'plugin', 'generate')}' to build your context plugin.`;
|
|
10
|
-
log.info(message);
|
|
11
|
-
}
|
|
12
|
-
codegenVersionMismatch(language, actual, expected) {
|
|
13
|
-
const message = `${f.var(PLUGIN_CONFIG_FILE)} records ${f.var(language)} against ${f.var(actual)}, ` +
|
|
14
|
-
`but this SDK was generated with ${f.var(expected)}. ` +
|
|
15
|
-
`Recording it overwrites ${f.var(actual)} with ${f.var(expected)}.`;
|
|
16
|
-
log.warn(message);
|
|
17
|
-
}
|
|
18
|
-
async confirmCodegenVersionOverwrite() {
|
|
19
|
-
const overwrite = await confirm({ message: 'Do you want to proceed?', initialValue: true });
|
|
20
|
-
if (isCancel(overwrite)) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
return overwrite;
|
|
24
|
-
}
|
|
25
|
-
noSourceRepository(language) {
|
|
26
|
-
const message = `Context plugin generation needs a source repository, and none was published for ${f.var(language)}. ` +
|
|
27
|
-
`Publish the SDK's source code to complete its ${f.var(PLUGIN_CONFIG_FILE)} entry.`;
|
|
28
|
-
log.warn(message);
|
|
29
|
-
}
|
|
30
|
-
pluginConfigUnreadable(reason) {
|
|
31
|
-
const cause = reason ? `: ${reason}` : '';
|
|
32
|
-
const message = `${f.var(PLUGIN_CONFIG_FILE)} cannot be used${cause}, so this published SDK's details were not added to it. ` +
|
|
33
|
-
`Fix or delete it and try again.`;
|
|
34
|
-
log.warn(message);
|
|
35
|
-
}
|
|
36
|
-
pluginConfigNotWritten() {
|
|
37
|
-
log.warn(`${f.var(PLUGIN_CONFIG_FILE)} could not be written, so this published SDK's details were not added to it.`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=record-sdk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record-sdk.js","sourceRoot":"","sources":["../../../src/prompts/plugin/record-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD,MAAM,OAAO,sBAAsB;IAC1B,WAAW,CAAC,QAAkB,EAAE,YAAqB;QAC1D,MAAM,OAAO,GAAG,CAAC,YAAY;YAC3B,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI;YACjE,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;YACxE,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC,iCAAiC,CAAC;QACtF,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAEM,sBAAsB,CAAC,QAAkB,EAAE,MAA6B,EAAE,QAA+B;QAC9G,MAAM,OAAO,GACX,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI;YACpF,mCAAmC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI;YACtD,2BAA2B,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QACtE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAEM,KAAK,CAAC,8BAA8B;QACzC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAE5F,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,kBAAkB,CAAC,QAAkB;QAC1C,MAAM,OAAO,GACX,mFAAmF,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI;YACtG,iDAAiD,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,SAAS,CAAC;QACtF,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAEM,sBAAsB,CAAC,MAAe;QAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,MAAM,OAAO,GACX,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,kBAAkB,KAAK,0DAA0D;YAC7G,iCAAiC,CAAC;QACpC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAEM,sBAAsB;QAC3B,GAAG,CAAC,IAAI,CACN,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,8EAA8E,CAC3G,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Result } from "neverthrow";
|
|
2
|
-
import { SubscriptionInfo } from "../../types/api/account.js";
|
|
3
|
-
import { ServiceError } from "../../infrastructure/service-error.js";
|
|
4
|
-
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
5
|
-
export declare class PortalCopilotPrompts {
|
|
6
|
-
displayApiCopilotKeyUsageWarning(): Promise<void>;
|
|
7
|
-
openWelcomeMessageEditor(): void;
|
|
8
|
-
selectCopilotKey(keys: string[]): Promise<string | null>;
|
|
9
|
-
copilotConfigured(status: boolean, copilotId: string): void;
|
|
10
|
-
confirmOverwrite(): Promise<boolean>;
|
|
11
|
-
spinnerAccountInfo(fn: Promise<Result<SubscriptionInfo, ServiceError>>): Promise<Result<SubscriptionInfo, ServiceError>>;
|
|
12
|
-
confirmSingleKeyUsage(apiCopilotKey: string): Promise<boolean>;
|
|
13
|
-
srcDirectoryEmpty(directory: DirectoryPath): void;
|
|
14
|
-
cancelled(): void;
|
|
15
|
-
serviceError(serviceError: ServiceError): void;
|
|
16
|
-
noCopilotKeyFound(): void;
|
|
17
|
-
noCopilotKeySelected(): void;
|
|
18
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { confirm, isCancel, log, select } from "@clack/prompts";
|
|
2
|
-
import { format as f } from "../format.js";
|
|
3
|
-
import { noteWrapped, withSpinner } from "../prompt.js";
|
|
4
|
-
export class PortalCopilotPrompts {
|
|
5
|
-
async displayApiCopilotKeyUsageWarning() {
|
|
6
|
-
log.warn("API Copilot can only be active on one Portal at a time. Configuring it on this Portal will disable it on any previously configured Portal.");
|
|
7
|
-
}
|
|
8
|
-
openWelcomeMessageEditor() {
|
|
9
|
-
log.step("Opening markdown editor for you to enter welcome message in...");
|
|
10
|
-
}
|
|
11
|
-
async selectCopilotKey(keys) {
|
|
12
|
-
const selectedKey = await select({
|
|
13
|
-
message: "Select the ID for the API Copilot you would like to add to this API Portal:",
|
|
14
|
-
maxItems: 10,
|
|
15
|
-
options: keys.map((key) => ({
|
|
16
|
-
value: key,
|
|
17
|
-
label: key
|
|
18
|
-
}))
|
|
19
|
-
});
|
|
20
|
-
if (isCancel(selectedKey)) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return selectedKey;
|
|
24
|
-
}
|
|
25
|
-
copilotConfigured(status, copilotId) {
|
|
26
|
-
log.info(`API Copilot configured successfully!
|
|
27
|
-
|
|
28
|
-
Copilot ID: ${f.var(copilotId)}
|
|
29
|
-
Status: ${f.var(status ? "Enabled" : "Disabled")}
|
|
30
|
-
|
|
31
|
-
Configuration saved to: ${f.var("APIMATIC-BUILD.json")}`);
|
|
32
|
-
noteWrapped(`API Copilot will index your content the next time you run
|
|
33
|
-
'${f.cmdAlt("apimatic", "portal", "generate")}' or '${f.cmdAlt("apimatic", "portal", "serve")}'.
|
|
34
|
-
This process can take up to 10 minutes, depending on your API’s size.
|
|
35
|
-
|
|
36
|
-
To see your copilot: If your portal is already running, refresh the page.
|
|
37
|
-
Otherwise, run '${f.cmdAlt("apimatic", "portal", "serve")}',
|
|
38
|
-
select any programming language in the Portal and
|
|
39
|
-
look for the chat icon in the bottom-right corner.`, "Next Steps");
|
|
40
|
-
}
|
|
41
|
-
async confirmOverwrite() {
|
|
42
|
-
const shouldOverwrite = await confirm({
|
|
43
|
-
message: "API Copilot is already configured for this Portal, do you want to overwrite it?",
|
|
44
|
-
initialValue: false
|
|
45
|
-
});
|
|
46
|
-
if (isCancel(shouldOverwrite)) {
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
return shouldOverwrite;
|
|
50
|
-
}
|
|
51
|
-
async spinnerAccountInfo(fn) {
|
|
52
|
-
return withSpinner("Retrieving your subscription info", "Subscription info retrieved", "Subscription info retrieval failed", fn);
|
|
53
|
-
}
|
|
54
|
-
async confirmSingleKeyUsage(apiCopilotKey) {
|
|
55
|
-
const confirmKeyUsage = await confirm({
|
|
56
|
-
message: "API Copilot can only be active on one Portal at a time. Configuring it on this Portal will disable it on any previously configured Portal.\n" +
|
|
57
|
-
`Do you want to use this key: ${f.var(apiCopilotKey)}?`,
|
|
58
|
-
initialValue: true
|
|
59
|
-
});
|
|
60
|
-
if (isCancel(confirmKeyUsage)) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return confirmKeyUsage;
|
|
64
|
-
}
|
|
65
|
-
srcDirectoryEmpty(directory) {
|
|
66
|
-
const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
|
|
67
|
-
log.error(message);
|
|
68
|
-
}
|
|
69
|
-
cancelled() {
|
|
70
|
-
log.warning("Exiting without making any change.");
|
|
71
|
-
}
|
|
72
|
-
serviceError(serviceError) {
|
|
73
|
-
log.error(serviceError.errorMessage);
|
|
74
|
-
}
|
|
75
|
-
noCopilotKeyFound() {
|
|
76
|
-
log.error(`No copilot key found for the current subscription. Please contact support at ${f.var("support@apimatic.io")}.`);
|
|
77
|
-
}
|
|
78
|
-
noCopilotKeySelected() {
|
|
79
|
-
log.error("No API Copilot key was selected.");
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=copilot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/prompts/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAKhE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,OAAO,oBAAoB;IACxB,KAAK,CAAC,gCAAgC;QAC3C,GAAG,CAAC,IAAI,CACN,4IAA4I,CAC7I,CAAC;IACJ,CAAC;IAEM,wBAAwB;QAC7B,GAAG,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IAC7E,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,IAAc;QAC1C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC;YAC/B,OAAO,EAAE,6EAA6E;YACtF,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GA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MAAM,OAAO,CAAC;YACpC,OAAO,EACL,8IAA8I;gBAC9I,gCAAgC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG;YACzD,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,iBAAiB,CAAC,SAAwB;QAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACjG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,SAAS;QACd,GAAG,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC;IACpD,CAAC;IAEM,YAAY,CAAC,YAA0B;QAC5C,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAEM,iBAAiB;QACtB,GAAG,CAAC,KAAK,CACP,gFAAgF,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAChH,CAAC;IACJ,CAAC;IAEM,oBAAoB;QACzB,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Result } from "neverthrow";
|
|
2
|
-
import { Language } from "../../types/sdk/generate.js";
|
|
3
|
-
import { UrlPath } from "../../types/file/urlPath.js";
|
|
4
|
-
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
5
|
-
import { ServiceError } from "../../infrastructure/service-error.js";
|
|
6
|
-
import { Directory } from "../../types/file/directory.js";
|
|
7
|
-
import { ResourceInput } from "../../types/file/resource-input.js";
|
|
8
|
-
import { FileDownloadResponse } from "../../infrastructure/services/file-download-service.js";
|
|
9
|
-
import { BuildFilePruneReport, UnallowedFeaturesResponse } from "../../infrastructure/services/validation-service.js";
|
|
10
|
-
export declare class PortalQuickstartPrompts {
|
|
11
|
-
importSpecStep(): void;
|
|
12
|
-
specPathPrompt(defaultSpecUrl: UrlPath): Promise<ResourceInput | undefined>;
|
|
13
|
-
specFileDoesNotExist(): void;
|
|
14
|
-
noSpecSpecified(): void;
|
|
15
|
-
useDefaultSpecPrompt(): Promise<boolean>;
|
|
16
|
-
fixYourSpec(): void;
|
|
17
|
-
validateSpecStep(): void;
|
|
18
|
-
splitSpecDetected(unallowed: UnallowedFeaturesResponse): void;
|
|
19
|
-
stripUnallowedFeaturesStep(unallowed: UnallowedFeaturesResponse): void;
|
|
20
|
-
selectLanguagesStep(): void;
|
|
21
|
-
selectLanguagesPrompt(allowedLanguages: Language[]): Promise<string[] | undefined>;
|
|
22
|
-
httpOnlyPortalOnPlan(): void;
|
|
23
|
-
onPremGenerationNotAllowedOnPlan(): void;
|
|
24
|
-
private languagesNotOnPlanNote;
|
|
25
|
-
noLanguagesSelected(): void;
|
|
26
|
-
buildFilePruned(report: BuildFilePruneReport): void;
|
|
27
|
-
selectInputDirectoryStep(): void;
|
|
28
|
-
inputDirectoryPathPrompt(): Promise<DirectoryPath | undefined>;
|
|
29
|
-
inputDirectoryPathDoesNotExist(inputDirectory: DirectoryPath): void;
|
|
30
|
-
inputDirectoryNotEmpty(inputDirectory: DirectoryPath): void;
|
|
31
|
-
noInputDirectoryProvided(): void;
|
|
32
|
-
downloadBuildDirectory(fn: Promise<Result<FileDownloadResponse, ServiceError>>): Promise<Result<FileDownloadResponse, ServiceError>>;
|
|
33
|
-
downloadSpecFile(fn: Promise<Result<FileDownloadResponse, ServiceError>>): Promise<Result<FileDownloadResponse, ServiceError>>;
|
|
34
|
-
nextSteps(hasAiIntegration: boolean): void;
|
|
35
|
-
serviceError(serviceError: ServiceError): void;
|
|
36
|
-
selectCopilotKey(keys: string[]): Promise<string | undefined>;
|
|
37
|
-
noCopilotKeySelected(): void;
|
|
38
|
-
accountInfoFetchFailed(serviceError: ServiceError): void;
|
|
39
|
-
copilotEnabled(key: string): void;
|
|
40
|
-
printDirectoryStructure(inputDirectory: DirectoryPath, directory: Directory): void;
|
|
41
|
-
specValidationFailed(): void;
|
|
42
|
-
}
|