@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,78 +0,0 @@
|
|
|
1
|
-
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
2
|
-
import { MergeSourceTreePrompts } from "../../prompts/sdk/merge-source-tree.js";
|
|
3
|
-
import { ActionResult } from "../action-result.js";
|
|
4
|
-
import isInCi from "is-in-ci";
|
|
5
|
-
import { MergeSourceTreeContext } from "../../types/merge-source-tree-context.js";
|
|
6
|
-
import { SdkContext } from "../../types/sdk-context.js";
|
|
7
|
-
export class MergeSourceTreeAction {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.prompts = new MergeSourceTreePrompts();
|
|
10
|
-
this.launcherService = new LauncherService();
|
|
11
|
-
this.execute = async (sdkWithSourceTree, sdkWithoutSourceTree, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree, language, outputSdkDirectory, version, zipSdk) => {
|
|
12
|
-
const mergeSourceTreeContext = new MergeSourceTreeContext(sdkWithSourceTree, sdkWithoutSourceTree, destinationSourceTreePath, trackChanges, skipChanges, hasSdkSourceTree);
|
|
13
|
-
const sdkContext = new SdkContext(language, outputSdkDirectory, skipChanges && hasSdkSourceTree, version);
|
|
14
|
-
const saveSdk = async () => await sdkContext.save(sdkWithoutSourceTree, zipSdk);
|
|
15
|
-
const { hasSkippedChangesEnabled, hasSkippedCustomizations } = await mergeSourceTreeContext.saveSkippingChanges();
|
|
16
|
-
if (hasSkippedCustomizations) {
|
|
17
|
-
this.prompts.successfullySkippedChanges(language);
|
|
18
|
-
this.prompts.sdkGenerated(await saveSdk());
|
|
19
|
-
return ActionResult.success();
|
|
20
|
-
}
|
|
21
|
-
if (hasSkippedChangesEnabled) {
|
|
22
|
-
this.prompts.sdkGenerated(await saveSdk());
|
|
23
|
-
return ActionResult.success();
|
|
24
|
-
}
|
|
25
|
-
const { hasSourceTreeTracked, hasSourceTreeAlreadyTracked, hasAppliedCustomizations } = await mergeSourceTreeContext.saveWithoutConflicts();
|
|
26
|
-
if (hasAppliedCustomizations) {
|
|
27
|
-
this.prompts.successfullyAppliedChanges(language);
|
|
28
|
-
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
29
|
-
return ActionResult.success();
|
|
30
|
-
}
|
|
31
|
-
if (hasSourceTreeAlreadyTracked) {
|
|
32
|
-
this.prompts.changeTrackingAlreadyEnabled(language);
|
|
33
|
-
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
34
|
-
return ActionResult.success();
|
|
35
|
-
}
|
|
36
|
-
if (hasSourceTreeTracked) {
|
|
37
|
-
this.prompts.sdkGenerated(await saveSdk());
|
|
38
|
-
this.prompts.changeTrackingEnabled(language, destinationSourceTreePath);
|
|
39
|
-
return ActionResult.success({ sourceTreeTrackingInitiated: true, conflictsResolved: false });
|
|
40
|
-
}
|
|
41
|
-
this.prompts.startApplyingConflictedChanges(language);
|
|
42
|
-
let conflictedFilesDirectory = await mergeSourceTreeContext.getConflictedFilesDirectory();
|
|
43
|
-
if (isInCi) {
|
|
44
|
-
this.prompts.conflictsDetectedInCi(language, conflictedFilesDirectory);
|
|
45
|
-
return ActionResult.failed();
|
|
46
|
-
}
|
|
47
|
-
while (!conflictedFilesDirectory.isEmpty()) {
|
|
48
|
-
this.prompts.conflictsDetected(conflictedFilesDirectory);
|
|
49
|
-
if (!await this.prompts.resolveNowOrAbandon()) {
|
|
50
|
-
this.prompts.mergeAbandoned(language);
|
|
51
|
-
return ActionResult.failed();
|
|
52
|
-
}
|
|
53
|
-
if (await this.launcherService.isIdeAvailable()) {
|
|
54
|
-
this.prompts.openingVsCodeForConflictResolution(language);
|
|
55
|
-
await this.launcherService.openFolderInIdeWithWait(sdkWithSourceTree, conflictedFilesDirectory.getAllFiles());
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
this.prompts.openFilesForConflictResolution(language, sdkWithSourceTree);
|
|
59
|
-
}
|
|
60
|
-
const response = await this.prompts.confirmConflictsResolved();
|
|
61
|
-
if (response === "cancelled") {
|
|
62
|
-
this.prompts.mergeAbandoned(language);
|
|
63
|
-
return ActionResult.failed();
|
|
64
|
-
}
|
|
65
|
-
if (response === "resolved") {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
conflictedFilesDirectory = await mergeSourceTreeContext.getConflictedFilesDirectory();
|
|
69
|
-
}
|
|
70
|
-
await mergeSourceTreeContext.saveWithResolvedConflicts();
|
|
71
|
-
this.prompts.conflictsResolved(language);
|
|
72
|
-
this.prompts.sdkGeneratedWithSourceTree(await saveSdk(), destinationSourceTreePath);
|
|
73
|
-
await mergeSourceTreeContext.cleanUp(() => this.prompts.directoryStillOpen(sdkWithSourceTree));
|
|
74
|
-
return ActionResult.success({ sourceTreeTrackingInitiated: false, conflictsResolved: true });
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=merge-source-tree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge-source-tree.js","sourceRoot":"","sources":["../../../src/actions/sdk/merge-source-tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,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AC,MAAM,OAAO,EAAE,EAAE,yBAAyB,CAAC,CAAC;YAEpF,MAAM,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAC,CAAC;YAC/F,OAAO,YAAY,CAAC,OAAO,CAAC,EAAC,2BAA2B,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAC,CAAC,CAAC;QAC7F,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ActionResult } from '../action-result.js';
|
|
2
|
-
import { CommandMetadata } from '../../types/common/command-metadata.js';
|
|
3
|
-
import { DirectoryPath } from '../../types/file/directoryPath.js';
|
|
4
|
-
export declare class SdkQuickstartAction {
|
|
5
|
-
private readonly configDir;
|
|
6
|
-
private readonly commandMetadata;
|
|
7
|
-
private readonly prompts;
|
|
8
|
-
private readonly fileDownloadService;
|
|
9
|
-
private readonly fileService;
|
|
10
|
-
private readonly launcherService;
|
|
11
|
-
private readonly zipService;
|
|
12
|
-
private readonly apiService;
|
|
13
|
-
private readonly validationService;
|
|
14
|
-
private readonly metadataFileUrl;
|
|
15
|
-
private readonly defaultSpecUrl;
|
|
16
|
-
constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
|
|
17
|
-
readonly execute: () => Promise<ActionResult>;
|
|
18
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { SdkQuickstartPrompts } from '../../prompts/sdk/quickstart.js';
|
|
2
|
-
import { ActionResult } from '../action-result.js';
|
|
3
|
-
import { UrlPath } from '../../types/file/urlPath.js';
|
|
4
|
-
import { LoginAction } from '../auth/login.js';
|
|
5
|
-
import { getAuthInfo } from '../../client-utils/auth-manager.js';
|
|
6
|
-
import { withDirPath } from '../../infrastructure/tmp-extensions.js';
|
|
7
|
-
import { FilePath } from '../../types/file/filePath.js';
|
|
8
|
-
import { SpecContext } from '../../types/spec-context.js';
|
|
9
|
-
import { ValidateAction } from '../api/validate.js';
|
|
10
|
-
import { FileDownloadService } from '../../infrastructure/services/file-download-service.js';
|
|
11
|
-
import { FileService } from '../../infrastructure/file-service.js';
|
|
12
|
-
import { GenerateAction } from './generate.js';
|
|
13
|
-
import { CodegenOption, mapLanguages } from '../../types/sdk/generate.js';
|
|
14
|
-
import { LauncherService } from '../../infrastructure/launcher-service.js';
|
|
15
|
-
import { ZipService } from '../../infrastructure/zip-service.js';
|
|
16
|
-
import { FileName } from '../../types/file/fileName.js';
|
|
17
|
-
import { ValidationService } from '../../infrastructure/services/validation-service.js';
|
|
18
|
-
import { ApiService } from '../../infrastructure/services/api-service.js';
|
|
19
|
-
export class SdkQuickstartAction {
|
|
20
|
-
constructor(configDir, commandMetadata) {
|
|
21
|
-
this.configDir = configDir;
|
|
22
|
-
this.commandMetadata = commandMetadata;
|
|
23
|
-
this.prompts = new SdkQuickstartPrompts();
|
|
24
|
-
this.fileDownloadService = new FileDownloadService();
|
|
25
|
-
this.fileService = new FileService();
|
|
26
|
-
this.launcherService = new LauncherService();
|
|
27
|
-
this.zipService = new ZipService();
|
|
28
|
-
this.apiService = new ApiService();
|
|
29
|
-
this.validationService = new ValidationService(this.configDir);
|
|
30
|
-
this.metadataFileUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/APIMATIC-META.json`);
|
|
31
|
-
this.defaultSpecUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/openapi.json`);
|
|
32
|
-
this.execute = async () => {
|
|
33
|
-
const storedAuth = await getAuthInfo(this.configDir.toString());
|
|
34
|
-
if (!(storedAuth === null || storedAuth === void 0 ? void 0 : storedAuth.authKey)) {
|
|
35
|
-
const loginResult = await new LoginAction(this.configDir, this.commandMetadata).execute();
|
|
36
|
-
if (loginResult.isFailed()) {
|
|
37
|
-
return ActionResult.failed();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return await withDirPath(async (tempDirectory) => {
|
|
41
|
-
var _a;
|
|
42
|
-
// Fetch account info before anything else so the plan is known up front: it
|
|
43
|
-
// gates the free-plan exit below and feeds the language step the allowed SDK
|
|
44
|
-
// languages. A lookup failure is fatal.
|
|
45
|
-
const accountInfo = await this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, null);
|
|
46
|
-
if (accountInfo.isErr()) {
|
|
47
|
-
this.prompts.accountInfoFetchFailed(accountInfo.error);
|
|
48
|
-
return ActionResult.failed();
|
|
49
|
-
}
|
|
50
|
-
// An SDK needs a language; with none on the plan (e.g. the free plan) there's
|
|
51
|
-
// nothing to generate, so stop before importing or pruning a spec.
|
|
52
|
-
if (mapLanguages(accountInfo.value.allowedLanguages).length === 0) {
|
|
53
|
-
this.prompts.noLanguagesAvailableOnPlan();
|
|
54
|
-
return ActionResult.cancelled();
|
|
55
|
-
}
|
|
56
|
-
// Step 1/4
|
|
57
|
-
this.prompts.importSpecStep();
|
|
58
|
-
let specPath;
|
|
59
|
-
while (!specPath) {
|
|
60
|
-
const inputPath = await this.prompts.specPathPrompt(this.defaultSpecUrl);
|
|
61
|
-
if (!inputPath) {
|
|
62
|
-
this.prompts.noSpecSpecified();
|
|
63
|
-
return ActionResult.cancelled();
|
|
64
|
-
}
|
|
65
|
-
if (inputPath instanceof UrlPath) {
|
|
66
|
-
const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(inputPath));
|
|
67
|
-
if (downloadFileResult.isErr()) {
|
|
68
|
-
this.prompts.serviceError(downloadFileResult.error);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
const specContext = new SpecContext(tempDirectory);
|
|
72
|
-
specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
const fileExists = await this.fileService.fileExists(inputPath);
|
|
77
|
-
if (!fileExists) {
|
|
78
|
-
this.prompts.specFileDoesNotExist();
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
specPath = inputPath;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// Step 2/4
|
|
86
|
-
this.prompts.validateSpecStep();
|
|
87
|
-
const validateAction = new ValidateAction(this.configDir, this.commandMetadata);
|
|
88
|
-
const validationResult = await validateAction.execute(specPath, false);
|
|
89
|
-
if (validationResult.isFailed()) {
|
|
90
|
-
this.prompts.specValidationFailed();
|
|
91
|
-
if (!(await this.prompts.useDefaultSpecPrompt())) {
|
|
92
|
-
this.prompts.fixYourSpec();
|
|
93
|
-
return ActionResult.cancelled();
|
|
94
|
-
}
|
|
95
|
-
const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(this.defaultSpecUrl));
|
|
96
|
-
if (downloadFileResult.isErr()) {
|
|
97
|
-
this.prompts.serviceError(downloadFileResult.error);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
const specContext = new SpecContext(tempDirectory);
|
|
101
|
-
specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (validationResult.isSuccess()) {
|
|
105
|
-
const unallowed = validationResult.getValue();
|
|
106
|
-
if (unallowed && (((_a = unallowed.Features) === null || _a === void 0 ? void 0 : _a.length) > 0 || unallowed.EndpointCount > unallowed.EndpointLimit)) {
|
|
107
|
-
const config = {
|
|
108
|
-
features: unallowed.Features.filter((name) => !!name),
|
|
109
|
-
endpointsToKeep: unallowed.EndpointLimit
|
|
110
|
-
};
|
|
111
|
-
const stripUnallowedFeaturesResult = await this.validationService.stripUnallowedFeatures(specPath, config);
|
|
112
|
-
if (stripUnallowedFeaturesResult.isErr()) {
|
|
113
|
-
this.prompts.splitSpecDetected(unallowed);
|
|
114
|
-
return ActionResult.failed();
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
this.prompts.stripUnallowedFeaturesStep(unallowed);
|
|
118
|
-
const specContext = new SpecContext(tempDirectory);
|
|
119
|
-
specPath = await specContext.save(stripUnallowedFeaturesResult.value, new FileName('pruned-spec.zip'));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Step 3/4
|
|
124
|
-
this.prompts.selectLanguageStep();
|
|
125
|
-
const language = await this.prompts.selectLanguagePrompt(mapLanguages(accountInfo.value.allowedLanguages));
|
|
126
|
-
if (!language) {
|
|
127
|
-
this.prompts.noLanguageSelected();
|
|
128
|
-
return ActionResult.cancelled();
|
|
129
|
-
}
|
|
130
|
-
// Step 4/4
|
|
131
|
-
this.prompts.selectInputDirectoryStep();
|
|
132
|
-
let inputDirectory;
|
|
133
|
-
while (true) {
|
|
134
|
-
inputDirectory = await this.prompts.inputDirectoryPathPrompt();
|
|
135
|
-
if (!inputDirectory) {
|
|
136
|
-
this.prompts.noInputDirectoryProvided();
|
|
137
|
-
return ActionResult.cancelled();
|
|
138
|
-
}
|
|
139
|
-
if (!(await this.fileService.directoryExists(inputDirectory))) {
|
|
140
|
-
this.prompts.inputDirectoryPathDoesNotExist(inputDirectory);
|
|
141
|
-
// TODO: Prompt user if he wants to create the directory
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
if (!(await this.fileService.directoryEmpty(inputDirectory))) {
|
|
145
|
-
this.prompts.inputDirectoryNotEmpty(inputDirectory);
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
// Setup source directory with the spec folder
|
|
151
|
-
const apimaticMetaFile = await this.prompts.downloadMetadataFile(this.fileDownloadService.downloadFile(this.metadataFileUrl));
|
|
152
|
-
if (apimaticMetaFile.isErr()) {
|
|
153
|
-
this.prompts.serviceError(apimaticMetaFile.error);
|
|
154
|
-
return ActionResult.failed();
|
|
155
|
-
}
|
|
156
|
-
const tempSpecDirectory = tempDirectory.join('spec');
|
|
157
|
-
await this.fileService.createDirectoryIfNotExists(tempSpecDirectory);
|
|
158
|
-
const metadataFilePath = new FilePath(tempSpecDirectory, apimaticMetaFile.value.filename);
|
|
159
|
-
await this.fileService.writeFile(metadataFilePath, apimaticMetaFile.value.stream);
|
|
160
|
-
if (await this.fileService.isZipFile(specPath)) {
|
|
161
|
-
await this.zipService.unArchive(specPath, tempSpecDirectory);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
await this.fileService.copyToDir(specPath, tempSpecDirectory);
|
|
165
|
-
}
|
|
166
|
-
const sourceDirectory = inputDirectory.join('src');
|
|
167
|
-
const specDirectory = sourceDirectory.join('spec');
|
|
168
|
-
await this.fileService.copyDirectoryContents(tempSpecDirectory, specDirectory);
|
|
169
|
-
const srcDirectoryStructure = await this.fileService.getDirectory(sourceDirectory);
|
|
170
|
-
this.prompts.printDirectoryStructure(inputDirectory, srcDirectoryStructure);
|
|
171
|
-
const sdkDirectory = inputDirectory.join('sdk');
|
|
172
|
-
const sdkGenerateAction = new GenerateAction(this.configDir, this.commandMetadata);
|
|
173
|
-
const result = await sdkGenerateAction.execute(sourceDirectory, sdkDirectory, language, true, false, false, false, CodegenOption.v3, false);
|
|
174
|
-
if (result.isFailed()) {
|
|
175
|
-
return ActionResult.failed();
|
|
176
|
-
}
|
|
177
|
-
const languageDirectory = sdkDirectory.join(language);
|
|
178
|
-
const readmeFilePath = new FilePath(languageDirectory, new FileName('README.md'));
|
|
179
|
-
if (await this.launcherService.openFolderInIde(languageDirectory, readmeFilePath)) {
|
|
180
|
-
this.prompts.sdkOpenedInEditor();
|
|
181
|
-
}
|
|
182
|
-
this.prompts.nextSteps(language, inputDirectory);
|
|
183
|
-
return ActionResult.success();
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
//# sourceMappingURL=quickstart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/actions/sdk/quickstart.ts"],"names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BACnF,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,eAAe,EAC5D,YAAY,EACZ,QAAoB,EACpB,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,aAAa,CAAC,EAAE,EAChB,KAAK,CAAC,CAAC;gBACT,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACtB,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,iBAAiB,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtD,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,iBAAiB,EAAE,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;gBAClF,IAAI,MAAM,IAAI,CAAC,eAAe,CAAC,eAAe,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAAE,CAAC;oBAClF,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;gBACnC,CAAC;gBAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;gBACjD,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAtLyG,CAAC;CAuL7G"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DirectoryPath } from "../../types/file/directoryPath.js";
|
|
2
|
-
import { ActionResult } from "../action-result.js";
|
|
3
|
-
import { Language } from "../../types/sdk/generate.js";
|
|
4
|
-
export declare class SaveChangesAction {
|
|
5
|
-
private readonly prompts;
|
|
6
|
-
private readonly launcherService;
|
|
7
|
-
readonly execute: (workingDirectory: DirectoryPath, buildDirectory: DirectoryPath, sdkDirectory: DirectoryPath | undefined, language: Language, apiVersion?: string) => Promise<ActionResult>;
|
|
8
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { ActionResult } from "../action-result.js";
|
|
2
|
-
import { withDirPath } from "../../infrastructure/tmp-extensions.js";
|
|
3
|
-
import { SaveChangesPrompts } from "../../prompts/sdk/save-changes.js";
|
|
4
|
-
import { SaveChangesContext } from "../../types/save-changes-context.js";
|
|
5
|
-
import { BuildContext } from "../../types/build-context.js";
|
|
6
|
-
import { LauncherService } from "../../infrastructure/launcher-service.js";
|
|
7
|
-
export class SaveChangesAction {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.prompts = new SaveChangesPrompts();
|
|
10
|
-
this.launcherService = new LauncherService();
|
|
11
|
-
this.execute = async (workingDirectory, buildDirectory, sdkDirectory, language, apiVersion) => {
|
|
12
|
-
const rootBuildContext = new BuildContext(buildDirectory);
|
|
13
|
-
if (!(await rootBuildContext.exists())) {
|
|
14
|
-
this.prompts.srcDirectoryEmpty(buildDirectory);
|
|
15
|
-
return ActionResult.failed();
|
|
16
|
-
}
|
|
17
|
-
const versionedContextGetter = async () => {
|
|
18
|
-
if (!await rootBuildContext.isVersionedBuild()) {
|
|
19
|
-
if (apiVersion)
|
|
20
|
-
this.prompts.apiVersionOnlyApplicableWithVersionedBuild();
|
|
21
|
-
return { version: undefined, buildContext: rootBuildContext };
|
|
22
|
-
}
|
|
23
|
-
const versionedBuildDirectory = await rootBuildContext.getVersionedBuildDirectory();
|
|
24
|
-
if (!versionedBuildDirectory) {
|
|
25
|
-
this.prompts.invalidVersionedDocsDirectory(buildDirectory);
|
|
26
|
-
return ActionResult.failed();
|
|
27
|
-
}
|
|
28
|
-
const singleVersionedBuildDirectory = await rootBuildContext.getSingleVersionedBuildDirectory();
|
|
29
|
-
if (!apiVersion && singleVersionedBuildDirectory) {
|
|
30
|
-
return {
|
|
31
|
-
version: singleVersionedBuildDirectory.leafName(),
|
|
32
|
-
buildContext: new BuildContext(singleVersionedBuildDirectory)
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const selectedVersionedBuildDirectory = await rootBuildContext.getSelectedVersionedBuildDirectory(apiVersion ? async () => apiVersion : this.prompts.selectVersion);
|
|
36
|
-
if (!selectedVersionedBuildDirectory) {
|
|
37
|
-
this.prompts.versionNotFound();
|
|
38
|
-
return ActionResult.failed();
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
version: selectedVersionedBuildDirectory.leafName(),
|
|
42
|
-
buildContext: new BuildContext(selectedVersionedBuildDirectory)
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const versionedContext = await versionedContextGetter();
|
|
46
|
-
if (versionedContext instanceof ActionResult) {
|
|
47
|
-
return versionedContext;
|
|
48
|
-
}
|
|
49
|
-
if (!(await versionedContext.buildContext.hasSdkSourceTree(language))) {
|
|
50
|
-
this.prompts.sdkSourceTreeNotFound(language);
|
|
51
|
-
return ActionResult.failed();
|
|
52
|
-
}
|
|
53
|
-
return await withDirPath(async (tempDirectory) => {
|
|
54
|
-
const sdkReviewDirectory = tempDirectory.join(language);
|
|
55
|
-
const sdkSourceTree = versionedContext.buildContext.getSdkSourceTree(language);
|
|
56
|
-
const saveChangesContext = new SaveChangesContext(sdkSourceTree, sdkReviewDirectory, sdkDirectory, workingDirectory, language, versionedContext.version);
|
|
57
|
-
if (await saveChangesContext.isSdkInputDirectoryMissing(this.prompts.invalidSdkDirectory)) {
|
|
58
|
-
return ActionResult.failed();
|
|
59
|
-
}
|
|
60
|
-
const updatedFilesDirectory = await saveChangesContext.getChangesForReviewDirectory();
|
|
61
|
-
if (updatedFilesDirectory.isEmpty()) {
|
|
62
|
-
this.prompts.noChangesDetected();
|
|
63
|
-
return ActionResult.cancelled();
|
|
64
|
-
}
|
|
65
|
-
this.prompts.modifiedFilesDetected(updatedFilesDirectory);
|
|
66
|
-
if (!await this.prompts.confirmReviewChanges()) {
|
|
67
|
-
await saveChangesContext.saveSourceTree();
|
|
68
|
-
this.prompts.changesSaved(sdkSourceTree);
|
|
69
|
-
return ActionResult.success();
|
|
70
|
-
}
|
|
71
|
-
if (await this.launcherService.isIdeAvailable()) {
|
|
72
|
-
this.prompts.openingDirectoryToReviewChanges();
|
|
73
|
-
const nonDeletedFilesDirectory = await updatedFilesDirectory.mapFilesInDirectory(async (_, fileItem) => {
|
|
74
|
-
return fileItem.description === "# Deleted" ? undefined : fileItem;
|
|
75
|
-
});
|
|
76
|
-
await this.launcherService.openFolderInIdeWithWait(sdkReviewDirectory, nonDeletedFilesDirectory.getAllFiles());
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.prompts.reviewChangesManually(sdkReviewDirectory);
|
|
80
|
-
}
|
|
81
|
-
if (await this.prompts.confirmSaveChanges()) {
|
|
82
|
-
await saveChangesContext.saveSourceTree();
|
|
83
|
-
this.prompts.changesSaved(sdkSourceTree);
|
|
84
|
-
await saveChangesContext.cleanUpSdkReviewDirectory(() => this.prompts.directoryStillOpen(sdkReviewDirectory));
|
|
85
|
-
return ActionResult.success();
|
|
86
|
-
}
|
|
87
|
-
this.prompts.operationCancelled();
|
|
88
|
-
return ActionResult.cancelled();
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=save-changes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"save-changes.js","sourceRoot":"","sources":["../../../src/actions/sdk/save-changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,MAAM,OAAO,iBAAiB;IAA9B;QACmB,YAAO,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACnC,oBAAe,GAAG,IAAI,eAAe,EAAE,CAAC;QAEzC,YAAO,GAAG,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C,YAAY,CAAC,aAAa,CAAC,CAAC;oBACzC,MAAM,kBAAkB,CAAC,yBAAyB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,CAAC;oBAC9G,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;gBAChC,CAAC;gBAED,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;gBAClC,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SerializableRecipe } from "../../../types/recipe/recipe.js";
|
|
2
|
-
export declare class PortalRecipe {
|
|
3
|
-
private readonly recipe;
|
|
4
|
-
constructor(name: string);
|
|
5
|
-
addContentStep(key: string, content: string): void;
|
|
6
|
-
addEndpointStep(key: string, description: string, endpointGroupName: string, endpointName: string): void;
|
|
7
|
-
toSerializableRecipe(): SerializableRecipe;
|
|
8
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { StepType } from "../../../types/recipe/recipe.js";
|
|
2
|
-
export class PortalRecipe {
|
|
3
|
-
constructor(name) {
|
|
4
|
-
this.recipe = {
|
|
5
|
-
name,
|
|
6
|
-
steps: []
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
addContentStep(key, content) {
|
|
10
|
-
this.recipe.steps.push({
|
|
11
|
-
key,
|
|
12
|
-
name: key, //TODO: Check if key is required
|
|
13
|
-
type: StepType.Content,
|
|
14
|
-
config: { content }
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
addEndpointStep(key, description, endpointGroupName, endpointName) {
|
|
18
|
-
const endpointPermalink = `$e/${[endpointGroupName, endpointName].map(encodeURIComponent).join("/")}`;
|
|
19
|
-
this.recipe.steps.push({
|
|
20
|
-
key,
|
|
21
|
-
name: key, //TODO: Check if key is required
|
|
22
|
-
type: StepType.Endpoint,
|
|
23
|
-
config: {
|
|
24
|
-
description,
|
|
25
|
-
endpointPermalink
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
toSerializableRecipe() {
|
|
30
|
-
return this.recipe;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=portal-recipe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portal-recipe.js","sourceRoot":"","sources":["../../../../src/application/portal/recipe/portal-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,OAAO,YAAY;IAGvB,YAAY,IAAY;QACtB,IAAI,CAAC,MAAM,GAAG;YACZ,IAAI;YACJ,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,GAAW,EAAE,OAAe;QACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACrB,GAAG;YACH,IAAI,EAAE,GAAG,EAAE,gCAAgC;YAC3C,IAAI,EAAE,QAAQ,CAAC,OAAO;YACtB,MAAM,EAAE,EAAE,OAAO,EAAE;SACpB,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,GAAW,EAAE,WAAmB,EAAE,iBAAyB,EAAE,YAAoB;QAC/F,MAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACtG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACrB,GAAG;YACH,IAAI,EAAE,GAAG,EAAE,gCAAgC;YAC3C,IAAI,EAAE,QAAQ,CAAC,QAAQ;YACvB,MAAM,EAAE;gBACN,WAAW;gBACX,iBAAiB;aAClB;SACF,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SerializableRecipe } from "../../../types/recipe/recipe.js";
|
|
2
|
-
import { DirectoryPath } from "../../../types/file/directoryPath.js";
|
|
3
|
-
import { Toc } from "../../../types/toc/toc.js";
|
|
4
|
-
import { FilePath } from "../../../types/file/filePath.js";
|
|
5
|
-
import { FileName } from "../../../types/file/fileName.js";
|
|
6
|
-
import { BuildContext } from "../../../types/build-context.js";
|
|
7
|
-
export declare class PortalRecipeGenerator {
|
|
8
|
-
private readonly fileService;
|
|
9
|
-
createRecipe(recipe: SerializableRecipe, tocFileContent: Toc, tocFilePath: FilePath, recipeName: string, recipeScriptFileName: FileName, recipeMarkdownFileName: FileName, buildContext: BuildContext, buildDirectory: DirectoryPath): Promise<void>;
|
|
10
|
-
private addRecipeToToc;
|
|
11
|
-
private registerRecipeInBuildConfigFile;
|
|
12
|
-
private createMarkdownFile;
|
|
13
|
-
private createScriptFromRecipe;
|
|
14
|
-
private saveGeneratedRecipeScriptToBuildDirectory;
|
|
15
|
-
private generateVerifyFunction;
|
|
16
|
-
private addContentStepToScript;
|
|
17
|
-
private addEndpointStepToScript;
|
|
18
|
-
private getMarkdownFileContent;
|
|
19
|
-
private formatScript;
|
|
20
|
-
private toPascalCase;
|
|
21
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import prettier from "prettier";
|
|
2
|
-
import { stringify } from "yaml";
|
|
3
|
-
import { FileService } from "../../../infrastructure/file-service.js";
|
|
4
|
-
import { FilePath } from "../../../types/file/filePath.js";
|
|
5
|
-
export class PortalRecipeGenerator {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.fileService = new FileService();
|
|
8
|
-
}
|
|
9
|
-
async createRecipe(recipe, tocFileContent, tocFilePath, recipeName, recipeScriptFileName, recipeMarkdownFileName, buildContext, buildDirectory) {
|
|
10
|
-
await this.addRecipeToToc(tocFileContent, tocFilePath, recipeName, recipeMarkdownFileName);
|
|
11
|
-
await this.registerRecipeInBuildConfigFile(buildContext, recipeName, recipeScriptFileName);
|
|
12
|
-
await this.createMarkdownFile(recipeMarkdownFileName, buildDirectory.join("content"));
|
|
13
|
-
const generatedRecipeScript = await this.createScriptFromRecipe(recipe);
|
|
14
|
-
const generatedRecipeScriptsDirectoryPath = buildDirectory.join("static", "scripts", "recipes");
|
|
15
|
-
await this.saveGeneratedRecipeScriptToBuildDirectory(generatedRecipeScript, generatedRecipeScriptsDirectoryPath, recipeScriptFileName);
|
|
16
|
-
}
|
|
17
|
-
async addRecipeToToc(tocData, tocFilePath, recipeName, recipeMarkdownFileName) {
|
|
18
|
-
const toc = tocData.toc;
|
|
19
|
-
const isGroup = (item) => "group" in item;
|
|
20
|
-
let apiRecipesGroup = toc.find((item) => isGroup(item) && item.group === "API Recipes");
|
|
21
|
-
if (!apiRecipesGroup) {
|
|
22
|
-
// If the group doesn't exist, create and insert it after the last group
|
|
23
|
-
apiRecipesGroup = {
|
|
24
|
-
group: "API Recipes",
|
|
25
|
-
items: []
|
|
26
|
-
};
|
|
27
|
-
// Insert after the last group section, before generate sections
|
|
28
|
-
let lastGroupIdx = -1;
|
|
29
|
-
for (let i = 0; i < toc.length; i++) {
|
|
30
|
-
const item = toc[i];
|
|
31
|
-
// `&& item.group` preserves the original truthiness check (a group with
|
|
32
|
-
// an empty name is not treated as a section boundary).
|
|
33
|
-
if (isGroup(item) && item.group)
|
|
34
|
-
lastGroupIdx = i;
|
|
35
|
-
}
|
|
36
|
-
toc.splice(lastGroupIdx + 1, 0, apiRecipesGroup);
|
|
37
|
-
}
|
|
38
|
-
const recipeFile = `recipes/${recipeMarkdownFileName}`;
|
|
39
|
-
// Only add the recipe if it doesn't already exist
|
|
40
|
-
const existingRecipe = apiRecipesGroup.items.find((item) => "page" in item && (item.page === recipeName || item.file === recipeFile));
|
|
41
|
-
if (!existingRecipe) {
|
|
42
|
-
// `items` is declared readonly on the Toc model, but recipe registration
|
|
43
|
-
// intentionally appends a custom page before persisting the whole TOC.
|
|
44
|
-
apiRecipesGroup.items.push({
|
|
45
|
-
page: recipeName,
|
|
46
|
-
file: recipeFile
|
|
47
|
-
});
|
|
48
|
-
await this.fileService.writeContents(tocFilePath, stringify(tocData));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async registerRecipeInBuildConfigFile(buildContext, recipeName, recipeScriptFileName) {
|
|
52
|
-
const buildConfig = await buildContext.getBuildFileContents();
|
|
53
|
-
const updatedBuildConfig = buildConfig.withRecipeWorkflow(recipeName, this.toPascalCase(recipeName), `./static/scripts/recipes/${recipeScriptFileName}`);
|
|
54
|
-
await buildContext.updateBuildFileContents(updatedBuildConfig);
|
|
55
|
-
}
|
|
56
|
-
async createMarkdownFile(recipeMarkdownFileName, contentFolder) {
|
|
57
|
-
const directory = contentFolder.join("recipes");
|
|
58
|
-
const markdownFileContent = this.getMarkdownFileContent();
|
|
59
|
-
await this.fileService.createDirectoryIfNotExists(directory);
|
|
60
|
-
await this.fileService.writeContents(new FilePath(directory, recipeMarkdownFileName), markdownFileContent);
|
|
61
|
-
}
|
|
62
|
-
async createScriptFromRecipe(recipe) {
|
|
63
|
-
let script = `export default function ${this.toPascalCase(recipe.name)}(workflowCtx, portal) {`;
|
|
64
|
-
script += "return {";
|
|
65
|
-
recipe.steps.forEach((step, index) => {
|
|
66
|
-
script += `"${step.key}": {`;
|
|
67
|
-
script += `name: "${step.name}",`;
|
|
68
|
-
script += "stepCallback: async () => {";
|
|
69
|
-
if (step.type === "content") {
|
|
70
|
-
script += this.addContentStepToScript(step.config);
|
|
71
|
-
}
|
|
72
|
-
else if (step.type === "endpoint") {
|
|
73
|
-
script += this.addEndpointStepToScript(step.config);
|
|
74
|
-
}
|
|
75
|
-
script += "},";
|
|
76
|
-
script += "}";
|
|
77
|
-
if (index < recipe.steps.length - 1) {
|
|
78
|
-
script += ",";
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
script += "};";
|
|
82
|
-
script += "}";
|
|
83
|
-
return script;
|
|
84
|
-
}
|
|
85
|
-
async saveGeneratedRecipeScriptToBuildDirectory(generatedRecipeScript, generatedRecipeScriptsDirectoryPath, recipeScriptFileName, format = false) {
|
|
86
|
-
if (format) {
|
|
87
|
-
generatedRecipeScript = await this.formatScript(generatedRecipeScript);
|
|
88
|
-
}
|
|
89
|
-
await this.fileService.createDirectoryIfNotExists(generatedRecipeScriptsDirectoryPath);
|
|
90
|
-
await this.fileService.writeContents(new FilePath(generatedRecipeScriptsDirectoryPath, recipeScriptFileName), generatedRecipeScript);
|
|
91
|
-
}
|
|
92
|
-
generateVerifyFunction() {
|
|
93
|
-
return `if (response.StatusCode == 200) { return true; } else { setError("API Call wasn't able to get a valid response. Please try again."); return false; }`;
|
|
94
|
-
}
|
|
95
|
-
addContentStepToScript(contentConfig) {
|
|
96
|
-
return `return workflowCtx.showContent(${JSON.stringify(contentConfig.content)});`;
|
|
97
|
-
}
|
|
98
|
-
addEndpointStepToScript(endpointConfig) {
|
|
99
|
-
let script = "return workflowCtx.showEndpoint({";
|
|
100
|
-
if (endpointConfig.description !== "") {
|
|
101
|
-
script += `description: ${JSON.stringify(endpointConfig.description)},`;
|
|
102
|
-
}
|
|
103
|
-
script += `endpointPermalink: "${endpointConfig.endpointPermalink}",`;
|
|
104
|
-
script += "verify: (response, setError) => {";
|
|
105
|
-
script += this.generateVerifyFunction();
|
|
106
|
-
script += "},";
|
|
107
|
-
script += "});";
|
|
108
|
-
return script;
|
|
109
|
-
}
|
|
110
|
-
getMarkdownFileContent() {
|
|
111
|
-
return `# This is a Guided Walkthrough File
|
|
112
|
-
This is the starter content`;
|
|
113
|
-
}
|
|
114
|
-
async formatScript(code) {
|
|
115
|
-
return prettier.format(code, {
|
|
116
|
-
parser: "babel",
|
|
117
|
-
semi: true,
|
|
118
|
-
singleQuote: false,
|
|
119
|
-
tabWidth: 2,
|
|
120
|
-
trailingComma: "es5"
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
toPascalCase(str) {
|
|
124
|
-
return str
|
|
125
|
-
.split(" ")
|
|
126
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
127
|
-
.join("");
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=recipe-generator.js.map
|