@apimatic/cli 1.4.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,20 +1,22 @@
|
|
|
1
1
|
import { Client, Environment } from "@apimatic/sdk";
|
|
2
2
|
import { envInfo } from "../env-info.js";
|
|
3
3
|
export class ApiClientFactory {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
timeout: this.TIMEOUT
|
|
13
|
-
};
|
|
14
|
-
const baseUrl = envInfo.getBaseUrl();
|
|
15
|
-
return new Client(Object.assign(Object.assign(Object.assign({}, baseConfig), { environment: baseUrl ? Environment.Testing : Environment.Production }), (baseUrl && { customUrl: baseUrl })));
|
|
4
|
+
TIMEOUT = 0;
|
|
5
|
+
createApiClient = (authorizationHeader, shell) => {
|
|
6
|
+
const baseConfig = {
|
|
7
|
+
customHeaderAuthenticationCredentials: {
|
|
8
|
+
Authorization: authorizationHeader
|
|
9
|
+
},
|
|
10
|
+
userAgent: envInfo.getUserAgent(shell),
|
|
11
|
+
timeout: this.TIMEOUT
|
|
16
12
|
};
|
|
17
|
-
|
|
13
|
+
const baseUrl = envInfo.getBaseUrl();
|
|
14
|
+
return new Client({
|
|
15
|
+
...baseConfig,
|
|
16
|
+
environment: baseUrl ? Environment.Testing : Environment.Production,
|
|
17
|
+
...(baseUrl && { customUrl: baseUrl })
|
|
18
|
+
});
|
|
19
|
+
};
|
|
18
20
|
}
|
|
19
21
|
export const apiClientFactory = new ApiClientFactory();
|
|
20
22
|
//# sourceMappingURL=api-client-factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client-factory.js","sourceRoot":"","sources":["../../../src/infrastructure/services/api-client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,OAAO,gBAAgB;
|
|
1
|
+
{"version":3,"file":"api-client-factory.js","sourceRoot":"","sources":["../../../src/infrastructure/services/api-client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,OAAO,gBAAgB;IACV,OAAO,GAAG,CAAC,CAAC;IAEtB,eAAe,GAAG,CAAC,mBAA2B,EAAE,KAAa,EAAU,EAAE;QAC9E,MAAM,UAAU,GAAG;YACjB,qCAAqC,EAAE;gBACrC,aAAa,EAAE,mBAAmB;aACnC;YACD,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC;YACtC,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;QAEF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACrC,OAAO,IAAI,MAAM,CAAC;YAChB,GAAG,UAAU;YACb,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU;YACnE,GAAG,CAAC,OAAO,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;SACvC,CAAC,CAAC;IACL,CAAC,CAAC;CACH;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { DirectoryPath } from
|
|
2
|
-
import { SubscriptionInfo } from
|
|
3
|
-
import { Result } from
|
|
4
|
-
import { ServiceError } from
|
|
1
|
+
import { DirectoryPath } from '../../types/file/directoryPath.js';
|
|
2
|
+
import { SubscriptionInfo } from '../../types/api/account.js';
|
|
3
|
+
import { Result } from 'neverthrow';
|
|
4
|
+
import { ServiceError } from '../service-error.js';
|
|
5
5
|
export declare class ApiService {
|
|
6
6
|
private readonly apiBaseUrl;
|
|
7
|
-
getAccountInfo(configDir: DirectoryPath, shell: string, authKey: string | null): Promise<Result<SubscriptionInfo, ServiceError>>;
|
|
7
|
+
getAccountInfo(configDir: DirectoryPath, shell: string, authKey: string | null, timeoutMs?: number): Promise<Result<SubscriptionInfo, ServiceError>>;
|
|
8
8
|
sendTelemetry(payload: string, authKey: string, shell: string): Promise<Result<string, string | ServiceError>>;
|
|
9
|
+
/** The host requests go to, for a message that names where a check was made. */
|
|
10
|
+
apiHost(): string;
|
|
9
11
|
private axiosInstance;
|
|
10
12
|
}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import axios from
|
|
2
|
-
import { getAuthInfo } from
|
|
3
|
-
import { envInfo } from
|
|
4
|
-
import { err, ok } from
|
|
5
|
-
import { handleServiceError, ServiceError } from
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { getAuthInfo } from '../../client-utils/auth-manager.js';
|
|
3
|
+
import { envInfo } from '../env-info.js';
|
|
4
|
+
import { err, ok } from 'neverthrow';
|
|
5
|
+
import { handleServiceError, ServiceError } from '../service-error.js';
|
|
6
6
|
export class ApiService {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
async getAccountInfo(configDir, shell, authKey) {
|
|
7
|
+
apiBaseUrl = 'https://api.apimatic.io';
|
|
8
|
+
async getAccountInfo(configDir, shell, authKey, timeoutMs) {
|
|
11
9
|
const authInfo = await getAuthInfo(configDir.toString());
|
|
12
10
|
if (authInfo === null && !authKey) {
|
|
13
11
|
return err(ServiceError.UnAuthorized);
|
|
14
12
|
}
|
|
15
13
|
try {
|
|
16
|
-
const token = authKey ||
|
|
17
|
-
const response = await this.axiosInstance(shell, token).get(
|
|
14
|
+
const token = authKey || authInfo?.authKey;
|
|
15
|
+
const response = await this.axiosInstance(shell, token, timeoutMs).get('/account/profile');
|
|
18
16
|
if (response.status === 200) {
|
|
19
17
|
return ok(response.data);
|
|
20
18
|
}
|
|
@@ -26,29 +24,39 @@ export class ApiService {
|
|
|
26
24
|
}
|
|
27
25
|
async sendTelemetry(payload, authKey, shell) {
|
|
28
26
|
try {
|
|
29
|
-
const response = await this.axiosInstance(shell, authKey).post(
|
|
30
|
-
headers: {
|
|
27
|
+
const response = await this.axiosInstance(shell, authKey).post('/telemetry/track', payload, {
|
|
28
|
+
headers: { 'Content-Type': 'application/json' }
|
|
31
29
|
});
|
|
32
30
|
if (response.status === 200) {
|
|
33
|
-
return ok(
|
|
31
|
+
return ok('telemetry sent');
|
|
34
32
|
}
|
|
35
|
-
return err(
|
|
33
|
+
return err('Failed to send telemetry data');
|
|
36
34
|
}
|
|
37
35
|
catch (error) {
|
|
38
36
|
return err(handleServiceError(error));
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
/** The host requests go to, for a message that names where a check was made. */
|
|
40
|
+
apiHost() {
|
|
41
|
+
const baseUrl = envInfo.getBaseUrl() ?? this.apiBaseUrl;
|
|
42
|
+
try {
|
|
43
|
+
return new URL(baseUrl).host;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return baseUrl;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
axiosInstance(shell, apiKey, timeoutMs) {
|
|
43
50
|
const headers = {
|
|
44
|
-
|
|
51
|
+
'User-Agent': envInfo.getUserAgent(shell)
|
|
45
52
|
};
|
|
46
53
|
if (apiKey) {
|
|
47
54
|
headers.Authorization = `X-Auth-Key ${apiKey}`;
|
|
48
55
|
}
|
|
49
56
|
return axios.create({
|
|
50
|
-
baseURL:
|
|
51
|
-
headers
|
|
57
|
+
baseURL: envInfo.getBaseUrl() ?? this.apiBaseUrl,
|
|
58
|
+
headers,
|
|
59
|
+
...(timeoutMs === undefined ? {} : { timeout: timeoutMs })
|
|
52
60
|
});
|
|
53
61
|
}
|
|
54
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/api-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvE,MAAM,OAAO,UAAU;
|
|
1
|
+
{"version":3,"file":"api-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/api-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvE,MAAM,OAAO,UAAU;IACJ,UAAU,GAAG,yBAAkC,CAAC;IAE1D,KAAK,CAAC,cAAc,CACzB,SAAwB,EACxB,KAAa,EACb,OAAsB,EACtB,SAAkB;QAElB,MAAM,QAAQ,GAAoB,MAAM,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC1E,IAAI,QAAQ,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,OAAO,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC;QACxD,IAAI,CAAC;YACH,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,KAAa,EAAE,MAA0B,EAAE,SAAkB;QACjF,MAAM,OAAO,GAA2B;YACtC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC;SAC1C,CAAC;QAEF,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,aAAa,GAAG,cAAc,MAAM,EAAE,CAAC;QACjD,CAAC;QAED,OAAO,KAAK,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,UAAU;YAChD,OAAO;YACP,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;SAC3D,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -3,13 +3,10 @@ import { envInfo } from "../env-info.js";
|
|
|
3
3
|
import { err, ok } from "neverthrow";
|
|
4
4
|
import { ServiceError, handleServiceError } from "../service-error.js";
|
|
5
5
|
export class AuthService {
|
|
6
|
-
|
|
7
|
-
this.apiBaseUrl = "https://auth.apimatic.io";
|
|
8
|
-
}
|
|
6
|
+
apiBaseUrl = "https://auth.apimatic.io";
|
|
9
7
|
axiosInstance(shell) {
|
|
10
|
-
var _a;
|
|
11
8
|
return axios.create({
|
|
12
|
-
baseURL:
|
|
9
|
+
baseURL: envInfo.getAuthBaseUrl() ?? this.apiBaseUrl,
|
|
13
10
|
timeout: 20000,
|
|
14
11
|
headers: {
|
|
15
12
|
"User-Agent": envInfo.getUserAgent(shell)
|
|
@@ -17,14 +14,12 @@ export class AuthService {
|
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
16
|
getDeviceLoginUrl(state) {
|
|
20
|
-
|
|
21
|
-
return `${(_a = envInfo.getAuthBaseUrl()) !== null && _a !== void 0 ? _a : this.apiBaseUrl}/device-auth/login?state=${state}`;
|
|
17
|
+
return `${envInfo.getAuthBaseUrl() ?? this.apiBaseUrl}/device-auth/login?state=${state}`;
|
|
22
18
|
}
|
|
23
19
|
async getDeviceLoginToken(state, shell) {
|
|
24
|
-
var _a;
|
|
25
20
|
try {
|
|
26
21
|
const response = await this.axiosInstance(shell).get(`/device-auth/token?state=${state}`);
|
|
27
|
-
if (response.status === 200 &&
|
|
22
|
+
if (response.status === 200 && response.data?.apiKey) {
|
|
28
23
|
return ok({ apiKey: response.data.apiKey });
|
|
29
24
|
}
|
|
30
25
|
return err(ServiceError.InvalidResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/auth-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMvE,MAAM,OAAO,WAAW;
|
|
1
|
+
{"version":3,"file":"auth-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/auth-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMvE,MAAM,OAAO,WAAW;IACL,UAAU,GAAG,0BAAmC,CAAC;IAE1D,aAAa,CAAC,KAAa;QACjC,OAAO,KAAK,CAAC,MAAM,CAAC;YAClB,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,UAAU;YACpD,OAAO,EAAE,KAAK;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC;aAC1C;SACF,CAAC,CAAC;IACL,CAAC;IAEM,iBAAiB,CAAC,KAAa;QACpC,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,UAAU,4BAA4B,KAAK,EAAE,CAAC;IAC3F,CAAC;IACM,KAAK,CAAC,mBAAmB,CAAC,KAAa,EAAE,KAAa;QAC3D,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,4BAA4B,KAAK,EAAE,CAAC,CAAC;YAC1F,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;gBACrD,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -52,7 +52,7 @@ export class FileDownloadService {
|
|
|
52
52
|
const decoded = decodeURIComponent(encoded);
|
|
53
53
|
return this.sanitizeFilename(decoded);
|
|
54
54
|
}
|
|
55
|
-
catch
|
|
55
|
+
catch {
|
|
56
56
|
// fall through to other strategies
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -73,7 +73,7 @@ export class FileDownloadService {
|
|
|
73
73
|
const decoded = this.safeDecodeURIComponent(last.trim());
|
|
74
74
|
return this.sanitizeFilename(decoded);
|
|
75
75
|
}
|
|
76
|
-
catch
|
|
76
|
+
catch {
|
|
77
77
|
// Fallback for non-URL-safe strings
|
|
78
78
|
const parts = rawUrl.split("/").filter(Boolean);
|
|
79
79
|
const last = parts.pop();
|
|
@@ -86,7 +86,7 @@ export class FileDownloadService {
|
|
|
86
86
|
try {
|
|
87
87
|
return decodeURIComponent(value);
|
|
88
88
|
}
|
|
89
|
-
catch
|
|
89
|
+
catch {
|
|
90
90
|
return value;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-download-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/file-download-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAOxD,MAAM,OAAO,mBAAmB;IACvB,KAAK,CAAC,YAAY,CAAC,GAAY;QACpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;gBAC/C,YAAY,EAAE,QAAQ;aACvB,CAAC,CAAC;YAEH,MAAM,kBAAkB,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;YACnE,IAAI,QAA8B,CAAC;YAEnC,yGAAyG;YACzG,IAAI,kBAAkB,EAAE,CAAC;gBACvB,MAAM,MAAM,GAAG,IAAI,CAAC,mCAAmC,CAAC,kBAAkB,CAAC,CAAC;gBAC5E,IAAI,MAAM,EAAE,CAAC;oBACX,QAAQ,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC;YAED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,14 +2,8 @@ import { Result } from 'neverthrow';
|
|
|
2
2
|
import { CommandMetadata } from '../../types/common/command-metadata.js';
|
|
3
3
|
import { DirectoryPath } from '../../types/file/directoryPath.js';
|
|
4
4
|
import { FilePath } from '../../types/file/filePath.js';
|
|
5
|
+
import { GenerationTimings } from '../generation-status-poller.js';
|
|
5
6
|
import { ServiceError } from '../service-error.js';
|
|
6
|
-
declare const TIMING_DEFAULTS: {
|
|
7
|
-
pollIntervalMs: number;
|
|
8
|
-
generationTimeoutMs: number;
|
|
9
|
-
requestTimeoutMs: number;
|
|
10
|
-
};
|
|
11
|
-
/** Overridable so tests are not paced by the production defaults; nothing else overrides them. */
|
|
12
|
-
export type GenerationTimings = Partial<typeof TIMING_DEFAULTS>;
|
|
13
7
|
export declare class PluginService {
|
|
14
8
|
private readonly apiBaseUrl;
|
|
15
9
|
private readonly fileService;
|
|
@@ -21,4 +15,3 @@ export declare class PluginService {
|
|
|
21
15
|
private downloadPlugin;
|
|
22
16
|
private axiosInstance;
|
|
23
17
|
}
|
|
24
|
-
export {};
|
|
@@ -2,29 +2,24 @@ import axios from 'axios';
|
|
|
2
2
|
import FormData from 'form-data';
|
|
3
3
|
import { err, ok } from 'neverthrow';
|
|
4
4
|
import { getAuthInfo } from '../../client-utils/auth-manager.js';
|
|
5
|
-
import { REQUEST_TIMEOUT_MS } from '../../config/axios-config.js';
|
|
6
5
|
import { PluginGenerationStatus } from '../../types/plugin/generation-status.js';
|
|
7
6
|
import { discardStreamBody } from '../../utils/utils.js';
|
|
8
7
|
import { envInfo } from '../env-info.js';
|
|
9
|
-
import {
|
|
8
|
+
import { formatValidationErrors, pollUntilCompleted, TIMING_DEFAULTS } from '../generation-status-poller.js';
|
|
10
9
|
import { FileService } from '../file-service.js';
|
|
11
10
|
import { mapRequestError, mapTransportError, ServiceError } from '../service-error.js';
|
|
12
|
-
const TIMING_DEFAULTS = {
|
|
13
|
-
pollIntervalMs: STATUS_POLL_INTERVAL_MS,
|
|
14
|
-
generationTimeoutMs: GENERATION_TIMEOUT_MS,
|
|
15
|
-
requestTimeoutMs: REQUEST_TIMEOUT_MS
|
|
16
|
-
};
|
|
17
11
|
export class PluginService {
|
|
12
|
+
apiBaseUrl = 'https://api.apimatic.io';
|
|
13
|
+
fileService = new FileService();
|
|
14
|
+
timings;
|
|
18
15
|
constructor(timings = {}) {
|
|
19
|
-
this.
|
|
20
|
-
this.fileService = new FileService();
|
|
21
|
-
this.timings = Object.assign(Object.assign({}, TIMING_DEFAULTS), timings);
|
|
16
|
+
this.timings = { ...TIMING_DEFAULTS, ...timings };
|
|
22
17
|
}
|
|
23
18
|
async generatePlugin(buildPath, configDir, commandMetadata, authKey) {
|
|
24
19
|
const authInfo = await getAuthInfo(configDir.toString());
|
|
25
20
|
// `auth logout` blanks config.json rather than deleting it, so a logged-out user
|
|
26
21
|
// still has a non-null AuthInfo with an empty key — check the key, not the object.
|
|
27
|
-
const token = authKey ||
|
|
22
|
+
const token = authKey || authInfo?.authKey;
|
|
28
23
|
if (!token) {
|
|
29
24
|
return err(ServiceError.unauthorizedWithHint(null));
|
|
30
25
|
}
|
|
@@ -45,7 +40,6 @@ export class PluginService {
|
|
|
45
40
|
return await this.downloadPlugin(generationId, commandMetadata.shell, token);
|
|
46
41
|
}
|
|
47
42
|
async initiateGeneration(buildPath, commandMetadata, token) {
|
|
48
|
-
var _a;
|
|
49
43
|
const buildFileStream = await this.fileService.getStream(buildPath);
|
|
50
44
|
try {
|
|
51
45
|
const formData = new FormData();
|
|
@@ -55,7 +49,7 @@ export class PluginService {
|
|
|
55
49
|
params: { origin: `APIMATIC CLI ${commandMetadata.commandName}` },
|
|
56
50
|
responseType: 'json'
|
|
57
51
|
});
|
|
58
|
-
const id =
|
|
52
|
+
const id = response.data?.id;
|
|
59
53
|
return id ? ok({ id }) : err(ServiceError.InvalidResponse);
|
|
60
54
|
}
|
|
61
55
|
catch (error) {
|
|
@@ -96,7 +90,6 @@ export class PluginService {
|
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
92
|
async downloadPlugin(generationId, shell, token) {
|
|
99
|
-
var _a;
|
|
100
93
|
try {
|
|
101
94
|
const response = await this.axiosInstance(shell, token).get(`/plugin/${generationId}/download`, {
|
|
102
95
|
responseType: 'stream'
|
|
@@ -107,15 +100,14 @@ export class PluginService {
|
|
|
107
100
|
// The body of a failed streamed response is itself a stream; leaving it open hangs the CLI.
|
|
108
101
|
// Discarding it also rules out reading ProblemDetails here, so only the status code maps.
|
|
109
102
|
if (axios.isAxiosError(error)) {
|
|
110
|
-
discardStreamBody(
|
|
103
|
+
discardStreamBody(error.response?.data);
|
|
111
104
|
}
|
|
112
105
|
return err(mapTransportError(error));
|
|
113
106
|
}
|
|
114
107
|
}
|
|
115
108
|
axiosInstance(shell, apiKey) {
|
|
116
|
-
var _a;
|
|
117
109
|
return axios.create({
|
|
118
|
-
baseURL:
|
|
110
|
+
baseURL: envInfo.getBaseUrl() ?? this.apiBaseUrl,
|
|
119
111
|
timeout: this.timings.requestTimeoutMs,
|
|
120
112
|
headers: {
|
|
121
113
|
'User-Agent': envInfo.getUserAgent(shell),
|
|
@@ -124,15 +116,12 @@ export class PluginService {
|
|
|
124
116
|
});
|
|
125
117
|
}
|
|
126
118
|
}
|
|
127
|
-
const formatPluginValidationError = (errors) =>
|
|
128
|
-
const messages = Object.entries(errors).flatMap(([path, pathMessages]) => pathMessages.map((message) => qualify(path, message)));
|
|
129
|
-
return 'One or more validation errors occurred.' + (messages.length ? '\n- ' + messages.join('\n- ') : '');
|
|
130
|
-
};
|
|
119
|
+
const formatPluginValidationError = (errors) => formatValidationErrors(Object.fromEntries(Object.entries(errors).map(([path, messages]) => [path, messages.map((message) => qualify(path, message))])));
|
|
131
120
|
const qualify = (path, message) => {
|
|
132
121
|
if (!path)
|
|
133
122
|
return message;
|
|
134
123
|
const quotedProperty = /^'([^']+)'/.exec(message);
|
|
135
|
-
const property = quotedProperty
|
|
124
|
+
const property = quotedProperty?.[1];
|
|
136
125
|
if (property && (path === property || path.endsWith(`.${property}`))) {
|
|
137
126
|
return `'${path}'${message.slice(quotedProperty[0].length)}`;
|
|
138
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/plugin-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-service.js","sourceRoot":"","sources":["../../../src/infrastructure/services/plugin-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAY,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAI3E,OAAO,EAEL,sBAAsB,EAEvB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,sBAAsB,EAEtB,kBAAkB,EAClB,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvF,MAAM,OAAO,aAAa;IACP,UAAU,GAAG,yBAAkC,CAAC;IAChD,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IAChC,OAAO,CAAyB;IAEjD,YAAY,OAAO,GAAsB,EAAE;QACzC,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,eAAe,EAA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Ac,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,IAAI,QAAQ,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC;QACrE,OAAO,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Result } from 'neverthrow';
|
|
2
|
+
import { CommandMetadata } from '../../types/common/command-metadata.js';
|
|
3
|
+
import { DirectoryPath } from '../../types/file/directoryPath.js';
|
|
4
|
+
import { PortalArtifacts } from '../../types/portal/portal-artifacts.js';
|
|
5
|
+
import { GenerationTimings } from '../generation-status-poller.js';
|
|
6
|
+
import { ServiceError } from '../service-error.js';
|
|
7
|
+
export declare class PortalArtifactsService {
|
|
8
|
+
private readonly apiBaseUrl;
|
|
9
|
+
private readonly fileService;
|
|
10
|
+
private readonly zipService;
|
|
11
|
+
private readonly timings;
|
|
12
|
+
constructor(timings?: GenerationTimings);
|
|
13
|
+
/**
|
|
14
|
+
* One run of `/portal-artifacts`: the SDKs, the code-sample catalogs and the context plugin,
|
|
15
|
+
* delivered as a single archive and unpacked into `into`.
|
|
16
|
+
*
|
|
17
|
+
* `source` is the `src/` directory, which is zipped and uploaded as the build. What the run
|
|
18
|
+
* produces is decided entirely by the `apimatic.json` inside it — the languages it names, and
|
|
19
|
+
* whether it carries a `plugin` block.
|
|
20
|
+
*/
|
|
21
|
+
generate(source: DirectoryPath, into: DirectoryPath, configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey: string | null): Promise<Result<PortalArtifacts, ServiceError>>;
|
|
22
|
+
private initiateGeneration;
|
|
23
|
+
private getGenerationStatus;
|
|
24
|
+
private download;
|
|
25
|
+
/**
|
|
26
|
+
* The archive holds `sdk/<language>.zip`, `docs/<language>.json`, `code-samples/<language>.json`
|
|
27
|
+
* and, when the config asked for one, `plugin.zip`. Everything is optional: a portal that declares
|
|
28
|
+
* no languages and no plugin is a valid run that delivers an empty zip.
|
|
29
|
+
*/
|
|
30
|
+
private unpack;
|
|
31
|
+
/** An unreadable file fails the run, as an unreadable catalog does, rather than publish a page without its docs. */
|
|
32
|
+
private readSdkDocs;
|
|
33
|
+
/**
|
|
34
|
+
* Keyed by the delivered file's stem rather than parsed into `Language`, so a language the
|
|
35
|
+
* server adds before this CLI models it is still placed rather than dropped.
|
|
36
|
+
*/
|
|
37
|
+
private readSdks;
|
|
38
|
+
/**
|
|
39
|
+
* A catalog this CLI cannot read is an error rather than an omission: silently dropping one
|
|
40
|
+
* would publish a portal missing the samples for a language the user asked for, and say nothing.
|
|
41
|
+
*/
|
|
42
|
+
private readCodeSampleCatalogs;
|
|
43
|
+
private axiosInstance;
|
|
44
|
+
}
|