@apimatic/cli 1.5.0 → 2.0.0-beta.2
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 +221 -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 +100 -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 +193 -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 +68 -0
- package/lib/types/apimatic-config/document.js +161 -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 +154 -442
- 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,38 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { err, ok } from 'neverthrow';
|
|
2
|
+
import { FileService } from '../infrastructure/file-service.js';
|
|
3
|
+
import { FilePath } from './file/filePath.js';
|
|
4
|
+
import { FileName } from './file/fileName.js';
|
|
5
|
+
import { ZipService } from '../infrastructure/zip-service.js';
|
|
6
|
+
import { errorMessage } from '../utils/error-utils.js';
|
|
7
|
+
/** Emitted even by a failed build, so it never counts as a page. */
|
|
8
|
+
export const SHELL_FILE_NAME = '_shell.html';
|
|
9
|
+
export const NOT_FOUND_FILE_NAME = '404.html';
|
|
10
|
+
export const ZIP_FILE_NAME = 'portal.zip';
|
|
11
|
+
const STAGING_DIRECTORY = '.apimatic-staging';
|
|
5
12
|
export class PortalContext {
|
|
13
|
+
portalDirectory;
|
|
14
|
+
fileService = new FileService();
|
|
15
|
+
zipService = new ZipService();
|
|
6
16
|
constructor(portalDirectory) {
|
|
7
17
|
this.portalDirectory = portalDirectory;
|
|
8
|
-
this.fileService = new FileService();
|
|
9
|
-
this.zipService = new ZipService();
|
|
10
18
|
}
|
|
11
|
-
get
|
|
12
|
-
|
|
13
|
-
return new FilePath(this.portalDirectory, new FileName("portal.zip"));
|
|
19
|
+
get stagingDirectory() {
|
|
20
|
+
return this.portalDirectory.join(STAGING_DIRECTORY);
|
|
14
21
|
}
|
|
15
|
-
get
|
|
16
|
-
|
|
17
|
-
const debugPath = this.portalDirectory.join('apimatic-debug');
|
|
18
|
-
return new FilePath(debugPath, new FileName("apimatic-report.html"));
|
|
22
|
+
get buildLogPath() {
|
|
23
|
+
return new FilePath(this.portalDirectory.join('apimatic-debug'), new FileName('build.log'));
|
|
19
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Whether anything is there to overwrite. A staging directory left by a save that could
|
|
27
|
+
* not finish counts, hidden as it is: it may hold the only complete copy of the site.
|
|
28
|
+
*/
|
|
20
29
|
async exists() {
|
|
21
|
-
return !await this.fileService.directoryEmpty(this.portalDirectory)
|
|
30
|
+
return (!(await this.fileService.directoryEmpty(this.portalDirectory)) ||
|
|
31
|
+
(await this.fileService.directoryExists(this.stagingDirectory)));
|
|
22
32
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Writes the finished site to the portal directory, as files or as a single archive.
|
|
35
|
+
* The site is staged inside the destination first, so the previous portal is only
|
|
36
|
+
* touched once the whole new one is on the same volume and what remains is a rename.
|
|
37
|
+
*/
|
|
38
|
+
async save(builtDirectory, asZip) {
|
|
39
|
+
try {
|
|
40
|
+
await this.addNotFoundPage(builtDirectory);
|
|
41
|
+
await this.fileService.cleanDirectory(this.stagingDirectory);
|
|
42
|
+
if (asZip) {
|
|
43
|
+
await this.zipService.archive(builtDirectory, new FilePath(this.stagingDirectory, new FileName(ZIP_FILE_NAME)));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
await this.fileService.copyDirectoryContents(builtDirectory, this.stagingDirectory);
|
|
47
|
+
}
|
|
27
48
|
}
|
|
28
|
-
|
|
29
|
-
await this.
|
|
49
|
+
catch (error) {
|
|
50
|
+
await this.fileService.deleteDirectory(this.stagingDirectory).catch(() => undefined);
|
|
51
|
+
return err({ kind: 'stagingFailed', reason: errorMessage(error) });
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
await this.fileService.cleanDirectoryExcluding(this.portalDirectory, [new FileName(STAGING_DIRECTORY)]);
|
|
55
|
+
await this.fileService.moveDirectoryContents(this.stagingDirectory, this.portalDirectory);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return err({ kind: 'replaceFailed', reason: errorMessage(error), stagedAt: this.stagingDirectory });
|
|
59
|
+
}
|
|
60
|
+
// Empty by now; a folder that cannot be removed (still open in Explorer) is not a failed save.
|
|
61
|
+
await this.fileService.deleteDirectory(this.stagingDirectory).catch(() => undefined);
|
|
62
|
+
return ok(undefined);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Keeps a failed build's output for the user to inspect after the temp project is gone.
|
|
66
|
+
* Null when the log itself could not be written.
|
|
67
|
+
*/
|
|
68
|
+
async saveBuildLog(log) {
|
|
69
|
+
try {
|
|
70
|
+
await this.fileService.ensurePathExists(this.buildLogPath);
|
|
71
|
+
await this.fileService.writeContents(this.buildLogPath, log);
|
|
72
|
+
return this.buildLogPath;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return null;
|
|
30
76
|
}
|
|
31
77
|
}
|
|
32
|
-
async
|
|
33
|
-
|
|
34
|
-
await this.
|
|
35
|
-
|
|
78
|
+
async addNotFoundPage(builtDirectory) {
|
|
79
|
+
const shell = new FilePath(builtDirectory, new FileName(SHELL_FILE_NAME));
|
|
80
|
+
if (await this.fileService.fileExists(shell)) {
|
|
81
|
+
await this.fileService.copy(shell, new FilePath(builtDirectory, new FileName(NOT_FOUND_FILE_NAME)));
|
|
82
|
+
}
|
|
36
83
|
}
|
|
37
84
|
}
|
|
38
85
|
//# sourceMappingURL=portal-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal-context.js","sourceRoot":"","sources":["../../src/types/portal-context.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Result } from 'neverthrow';
|
|
2
|
+
import { DirectoryPath } from './file/directoryPath.js';
|
|
3
|
+
import { FilePath } from './file/filePath.js';
|
|
4
|
+
import { SuggestedSite } from './portal/config/site-config.js';
|
|
5
|
+
import { AcceptedContent } from './portal/content-tree.js';
|
|
6
|
+
import { GeneratedPages } from './portal/generated-pages.js';
|
|
7
|
+
import { ContentProblem, PortalScaffoldProblem, PortalSettings, PortalSource, PortalSourceProblem, PortalSpec } from './portal/portal-source.js';
|
|
8
|
+
export declare class PortalSourceContext {
|
|
9
|
+
private readonly sourceDirectory;
|
|
10
|
+
private readonly fileService;
|
|
11
|
+
private readonly configContext;
|
|
12
|
+
constructor(sourceDirectory: DirectoryPath);
|
|
13
|
+
private get specDirectory();
|
|
14
|
+
private get contentDirectory();
|
|
15
|
+
private get staticDirectory();
|
|
16
|
+
/** Reads and validates the whole source directory, or reports the first problem found. */
|
|
17
|
+
resolve(): Promise<Result<PortalSource, PortalSourceProblem>>;
|
|
18
|
+
/**
|
|
19
|
+
* The `content/` half of `resolve`, for `portal serve` to run on each save, against the `specs`
|
|
20
|
+
* it found and the generated pages the preview shows.
|
|
21
|
+
*/
|
|
22
|
+
resolveContent(specs: PortalSpec[], generatedPages: GeneratedPages): Promise<Result<AcceptedContent, ContentProblem[]>>;
|
|
23
|
+
private existingContentDirectory;
|
|
24
|
+
/** The content tree, read and handed to the rules the build reads it by. */
|
|
25
|
+
private content;
|
|
26
|
+
private readPages;
|
|
27
|
+
private missingImages;
|
|
28
|
+
private read;
|
|
29
|
+
/**
|
|
30
|
+
* The `apimatic.json` half of `resolve`, for `portal serve` to run on every edit, so an edit
|
|
31
|
+
* is accepted exactly when a build would accept it. `suggested` is what `resolve` found in the
|
|
32
|
+
* specifications, which are not read again; changing them needs a restart anyway.
|
|
33
|
+
*/
|
|
34
|
+
resolveSettings(suggested: SuggestedSite | null): Promise<Result<PortalSettings, PortalSourceProblem>>;
|
|
35
|
+
private settingsFrom;
|
|
36
|
+
private readConfigDocument;
|
|
37
|
+
/**
|
|
38
|
+
* The root and the `languages` block are this command's to judge as well, since the portal
|
|
39
|
+
* documents the project's SDK languages. The `plugin` block is the plugin commands' to judge,
|
|
40
|
+
* so it never fails a build and nothing in it is read: an object gets the context plugin page
|
|
41
|
+
* whatever it holds, and anything else counts as no block.
|
|
42
|
+
*/
|
|
43
|
+
private static parseSettings;
|
|
44
|
+
/** A hosted plugin is installed from its address, whatever the block says; otherwise the block's is bundled. */
|
|
45
|
+
private static pluginSource;
|
|
46
|
+
private missingStaticFiles;
|
|
47
|
+
/** How the build would miss `file`: not there, or there in another case; null when it is there as spelt. */
|
|
48
|
+
private missingFile;
|
|
49
|
+
/**
|
|
50
|
+
* Writes everything `portal generate` and `portal serve` need but the `languages` block,
|
|
51
|
+
* which the user adds by hand until the wizard asks for it. Every fault is reported rather
|
|
52
|
+
* than thrown, the file service's included: the caller is a wizard that has asked its
|
|
53
|
+
* questions already. Answers with the `apimatic.json` it wrote.
|
|
54
|
+
*/
|
|
55
|
+
scaffold(specPath: FilePath, schemaUrl: string): Promise<Result<FilePath, PortalScaffoldProblem>>;
|
|
56
|
+
/** The same tree around a specification the project already carries, which is left where it is. */
|
|
57
|
+
adopt(specPath: FilePath, schemaUrl: string): Promise<Result<FilePath, PortalScaffoldProblem>>;
|
|
58
|
+
/**
|
|
59
|
+
* The document the portal speaks for, and the one quickstart validates when it adopts a
|
|
60
|
+
* project someone downloaded rather than asking for a specification the project has.
|
|
61
|
+
*/
|
|
62
|
+
primarySpec(): Promise<FilePath | null>;
|
|
63
|
+
private writeSourceTree;
|
|
64
|
+
private suggestedSite;
|
|
65
|
+
/**
|
|
66
|
+
* Files at the top of `static/` that the build would otherwise have generated itself. Only
|
|
67
|
+
* the top level is read: nothing below it can land on one of these names, and walking the
|
|
68
|
+
* whole tree let one unreadable entry throw out of `resolve`, which otherwise returns a Result.
|
|
69
|
+
*/
|
|
70
|
+
private shadowedFiles;
|
|
71
|
+
private specs;
|
|
72
|
+
private conversion;
|
|
73
|
+
private specDirectoryListing;
|
|
74
|
+
private endpoints;
|
|
75
|
+
private readDocument;
|
|
76
|
+
private uniqueSlug;
|
|
77
|
+
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
import { ExportFormats } from '@apimatic/sdk';
|
|
2
|
+
import { err, ok } from 'neverthrow';
|
|
3
|
+
import { FileService } from '../infrastructure/file-service.js';
|
|
4
|
+
import { errorMessage } from '../utils/error-utils.js';
|
|
5
|
+
import { ApimaticConfigContext } from './apimatic-config-context.js';
|
|
6
|
+
import { APIMATIC_CONFIG_FILE_NAME, findingSentences } from './apimatic-config/document.js';
|
|
7
|
+
import { Directory } from './file/directory.js';
|
|
8
|
+
import { FileName } from './file/fileName.js';
|
|
9
|
+
import { FilePath } from './file/filePath.js';
|
|
10
|
+
import { NOT_FOUND_FILE_NAME, SHELL_FILE_NAME } from './portal-context.js';
|
|
11
|
+
import { CONTENT_DIRECTORY_NAME, SPEC_DIRECTORY_NAME, STATIC_DIRECTORY_NAME } from './project-layout.js';
|
|
12
|
+
import { PLACEHOLDER_SITE } from './portal/config/site-config.js';
|
|
13
|
+
import { ContentTree } from './portal/content-tree.js';
|
|
14
|
+
import { GeneratedPages } from './portal/generated-pages.js';
|
|
15
|
+
import { OpenApiDocument } from './portal/openapi-document.js';
|
|
16
|
+
import { parsePage } from './portal/page.js';
|
|
17
|
+
import { PortalConfig } from './portal/portal-config.js';
|
|
18
|
+
import { PortalLanguages } from './portal/portal-languages.js';
|
|
19
|
+
import { NAVIGATION_FILE_NAME } from './portal/portal-navigation.js';
|
|
20
|
+
import { SpecContext } from './spec-context.js';
|
|
21
|
+
import { TRANSFORMATIONS_DIRECTORY_NAME, transformedFileName } from './transform-context.js';
|
|
22
|
+
const SPEC_EXTENSIONS = ['.json', '.yaml', '.yml'];
|
|
23
|
+
// Empty on purpose: the portal's own routes under /api/ are files with extensions --
|
|
24
|
+
// /api/search.json -- so none can collide with a spec section, which is always a directory.
|
|
25
|
+
// Pages the user puts under content/api/ share the directory, and `hiddenPages` reports the
|
|
26
|
+
// ones a section's generated metadata keeps out of the sidebar.
|
|
27
|
+
const RESERVED_SPEC_SLUGS = [];
|
|
28
|
+
// Names the build writes at the root of the site. The static directory is copied there
|
|
29
|
+
// first, so a file of the same name replaces the generated one without a word.
|
|
30
|
+
const GENERATED_ROOT_FILES = [
|
|
31
|
+
'robots.txt',
|
|
32
|
+
'sitemap.xml',
|
|
33
|
+
'llms.txt',
|
|
34
|
+
'llms-full.txt',
|
|
35
|
+
'index.html',
|
|
36
|
+
NOT_FOUND_FILE_NAME,
|
|
37
|
+
SHELL_FILE_NAME
|
|
38
|
+
];
|
|
39
|
+
export class PortalSourceContext {
|
|
40
|
+
sourceDirectory;
|
|
41
|
+
fileService = new FileService();
|
|
42
|
+
configContext;
|
|
43
|
+
constructor(sourceDirectory) {
|
|
44
|
+
this.sourceDirectory = sourceDirectory;
|
|
45
|
+
this.configContext = new ApimaticConfigContext(sourceDirectory);
|
|
46
|
+
}
|
|
47
|
+
get specDirectory() {
|
|
48
|
+
return this.sourceDirectory.join(SPEC_DIRECTORY_NAME);
|
|
49
|
+
}
|
|
50
|
+
get contentDirectory() {
|
|
51
|
+
return this.sourceDirectory.join(CONTENT_DIRECTORY_NAME);
|
|
52
|
+
}
|
|
53
|
+
get staticDirectory() {
|
|
54
|
+
return this.sourceDirectory.join(STATIC_DIRECTORY_NAME);
|
|
55
|
+
}
|
|
56
|
+
/** Reads and validates the whole source directory, or reports the first problem found. */
|
|
57
|
+
async resolve() {
|
|
58
|
+
const document = await this.readConfigDocument();
|
|
59
|
+
if (document.isErr()) {
|
|
60
|
+
return err(document.error);
|
|
61
|
+
}
|
|
62
|
+
// Read before the block is parsed: the block's site name and description default to what
|
|
63
|
+
// the only specification says about itself.
|
|
64
|
+
const discovered = await this.specs();
|
|
65
|
+
if (discovered.isErr()) {
|
|
66
|
+
return err(discovered.error);
|
|
67
|
+
}
|
|
68
|
+
const { specs, suggested } = discovered.value;
|
|
69
|
+
const settings = await this.settingsFrom(document.value, suggested);
|
|
70
|
+
if (settings.isErr()) {
|
|
71
|
+
return err(settings.error);
|
|
72
|
+
}
|
|
73
|
+
const staticDirectory = (await this.fileService.directoryExists(this.staticDirectory))
|
|
74
|
+
? this.staticDirectory
|
|
75
|
+
: null;
|
|
76
|
+
const contentDirectory = await this.existingContentDirectory();
|
|
77
|
+
const accepted = await this.content(contentDirectory, specs, settings.value.generatedPages);
|
|
78
|
+
if (accepted.isErr()) {
|
|
79
|
+
return err({ kind: 'invalidContent', problems: accepted.error });
|
|
80
|
+
}
|
|
81
|
+
return ok({
|
|
82
|
+
...settings.value,
|
|
83
|
+
suggestedSite: suggested,
|
|
84
|
+
specs,
|
|
85
|
+
contentDirectory,
|
|
86
|
+
staticDirectory,
|
|
87
|
+
shadowedFiles: staticDirectory === null ? [] : await this.shadowedFiles(staticDirectory),
|
|
88
|
+
contentNotices: accepted.value.notices
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The `content/` half of `resolve`, for `portal serve` to run on each save, against the `specs`
|
|
93
|
+
* it found and the generated pages the preview shows.
|
|
94
|
+
*/
|
|
95
|
+
async resolveContent(specs, generatedPages) {
|
|
96
|
+
return await this.content(await this.existingContentDirectory(), specs, generatedPages);
|
|
97
|
+
}
|
|
98
|
+
async existingContentDirectory() {
|
|
99
|
+
return (await this.fileService.directoryExists(this.contentDirectory)) ? this.contentDirectory : null;
|
|
100
|
+
}
|
|
101
|
+
/** The content tree, read and handed to the rules the build reads it by. */
|
|
102
|
+
async content(contentDirectory, specs, generatedPages) {
|
|
103
|
+
// Walked once, and every check reads the one tree: `getDirectory` stats every entry in it.
|
|
104
|
+
// Not swallowed: a tree that cannot be walked would otherwise pass as one with no files,
|
|
105
|
+
// and a `nav.json` in it would go unvalidated to a build that drops bad entries silently.
|
|
106
|
+
let tree;
|
|
107
|
+
try {
|
|
108
|
+
tree =
|
|
109
|
+
contentDirectory === null
|
|
110
|
+
? new Directory(this.contentDirectory, [])
|
|
111
|
+
: await this.fileService.getDirectory(contentDirectory);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return err([{ kind: 'unreadableContent' }]);
|
|
115
|
+
}
|
|
116
|
+
const content = new ContentTree(tree, this.sourceDirectory);
|
|
117
|
+
const pages = await this.readPages(content.pages());
|
|
118
|
+
const read = {
|
|
119
|
+
pages,
|
|
120
|
+
navigationFiles: await this.read(content.navigationFiles()),
|
|
121
|
+
missingImages: await this.missingImages(pages, content)
|
|
122
|
+
};
|
|
123
|
+
return content.check(read, specs, generatedPages).map((notices) => ({
|
|
124
|
+
notices,
|
|
125
|
+
// Each was read, or the check would have refused the page it could not.
|
|
126
|
+
files: [...read.pages, ...read.navigationFiles].flatMap(({ file, contents }) => contents === undefined ? [] : [{ file, contents }])
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
async readPages(files) {
|
|
130
|
+
const read = await this.read(files);
|
|
131
|
+
return await Promise.all(read.map(async ({ file, contents }) => ({
|
|
132
|
+
file,
|
|
133
|
+
contents,
|
|
134
|
+
parsed: contents === undefined
|
|
135
|
+
? undefined
|
|
136
|
+
: await parsePage(contents, file.name(), file.relativeTo(this.sourceDirectory))
|
|
137
|
+
})));
|
|
138
|
+
}
|
|
139
|
+
// The build imports each one, and fails as a whole over one it cannot find, naming no page.
|
|
140
|
+
async missingImages(pages, content) {
|
|
141
|
+
const missing = [];
|
|
142
|
+
for (const { file: page, parsed } of pages) {
|
|
143
|
+
for (const { url, line, from, path } of parsed?.images ?? []) {
|
|
144
|
+
const file = FilePath.resolve(from === 'static' ? this.staticDirectory : page.directory(), path);
|
|
145
|
+
// One beside its page that `content/`'s copy leaves out is never looked for.
|
|
146
|
+
if (from === 'page' && !content.holds(file)) {
|
|
147
|
+
missing.push({ page, line, url, missing: null });
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const missingFile = await this.missingFile(file);
|
|
151
|
+
if (missingFile !== null) {
|
|
152
|
+
missing.push({ page, line, url, missing: missingFile });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return missing;
|
|
157
|
+
}
|
|
158
|
+
// A file that cannot be read is reported by the check rather than thrown out of `resolve`.
|
|
159
|
+
async read(files) {
|
|
160
|
+
return await Promise.all(files.map(async (file) => ({ file, contents: await this.fileService.getContents(file).catch(() => undefined) })));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The `apimatic.json` half of `resolve`, for `portal serve` to run on every edit, so an edit
|
|
164
|
+
* is accepted exactly when a build would accept it. `suggested` is what `resolve` found in the
|
|
165
|
+
* specifications, which are not read again; changing them needs a restart anyway.
|
|
166
|
+
*/
|
|
167
|
+
async resolveSettings(suggested) {
|
|
168
|
+
const document = await this.readConfigDocument();
|
|
169
|
+
if (document.isErr()) {
|
|
170
|
+
return err(document.error);
|
|
171
|
+
}
|
|
172
|
+
return this.settingsFrom(document.value, suggested);
|
|
173
|
+
}
|
|
174
|
+
async settingsFrom(document, suggested) {
|
|
175
|
+
const settings = PortalSourceContext.parseSettings(document, suggested);
|
|
176
|
+
if (settings.isErr()) {
|
|
177
|
+
return err(settings.error);
|
|
178
|
+
}
|
|
179
|
+
// The block checks the shape of each path, not that the file is there -- and a missing
|
|
180
|
+
// logo renders as a broken image on every page of a build that otherwise reports success.
|
|
181
|
+
const missingFiles = await this.missingStaticFiles(settings.value.config);
|
|
182
|
+
if (missingFiles.length > 0) {
|
|
183
|
+
return err({ kind: 'missingStaticFiles', files: missingFiles });
|
|
184
|
+
}
|
|
185
|
+
return ok(settings.value);
|
|
186
|
+
}
|
|
187
|
+
async readConfigDocument() {
|
|
188
|
+
const state = await this.configContext.read();
|
|
189
|
+
if (state.state === 'missing') {
|
|
190
|
+
return err({ kind: 'missingConfig' });
|
|
191
|
+
}
|
|
192
|
+
if (state.state === 'unparseable') {
|
|
193
|
+
return err({ kind: 'invalidConfig', errors: findingSentences(state.findings), missingPortal: false });
|
|
194
|
+
}
|
|
195
|
+
return ok(state.document);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The root and the `languages` block are this command's to judge as well, since the portal
|
|
199
|
+
* documents the project's SDK languages. The `plugin` block is the plugin commands' to judge,
|
|
200
|
+
* so it never fails a build and nothing in it is read: an object gets the context plugin page
|
|
201
|
+
* whatever it holds, and anything else counts as no block.
|
|
202
|
+
*/
|
|
203
|
+
static parseSettings(document, suggested) {
|
|
204
|
+
const block = document.portal();
|
|
205
|
+
const config = PortalConfig.fromBlock(block, suggested);
|
|
206
|
+
const languages = PortalLanguages.fromBlock(document.languages(), document.findingsFor('languages'));
|
|
207
|
+
const errors = [
|
|
208
|
+
...findingSentences(document.findingsFor('root')),
|
|
209
|
+
...(config.isErr() ? config.error : []),
|
|
210
|
+
...(languages.isErr() ? languages.error : [])
|
|
211
|
+
];
|
|
212
|
+
if (config.isErr() || languages.isErr() || errors.length > 0) {
|
|
213
|
+
return err({ kind: 'invalidConfig', errors, missingPortal: block === undefined });
|
|
214
|
+
}
|
|
215
|
+
return ok({
|
|
216
|
+
config: config.value,
|
|
217
|
+
generatedPages: GeneratedPages.of(languages.value, PortalSourceContext.pluginSource(config.value, document))
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/** A hosted plugin is installed from its address, whatever the block says; otherwise the block's is bundled. */
|
|
221
|
+
static pluginSource(config, document) {
|
|
222
|
+
const url = config.pluginUrl();
|
|
223
|
+
if (url !== null) {
|
|
224
|
+
return { kind: 'hosted', url };
|
|
225
|
+
}
|
|
226
|
+
return document.plugin() === undefined ? null : { kind: 'bundled' };
|
|
227
|
+
}
|
|
228
|
+
async missingStaticFiles(config) {
|
|
229
|
+
const missing = [];
|
|
230
|
+
for (const asset of config.staticFiles()) {
|
|
231
|
+
const missingFile = await this.missingFile(asset.resolveIn(this.sourceDirectory));
|
|
232
|
+
if (missingFile !== null) {
|
|
233
|
+
missing.push({ setting: asset.settingPath(), ...missingFile });
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return missing;
|
|
237
|
+
}
|
|
238
|
+
/** How the build would miss `file`: not there, or there in another case; null when it is there as spelt. */
|
|
239
|
+
async missingFile(file) {
|
|
240
|
+
const found = await this.fileService.spelledOnDisk(this.sourceDirectory, file);
|
|
241
|
+
return found?.isEqual(file) ? null : { file, foundAs: found };
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Writes everything `portal generate` and `portal serve` need but the `languages` block,
|
|
245
|
+
* which the user adds by hand until the wizard asks for it. Every fault is reported rather
|
|
246
|
+
* than thrown, the file service's included: the caller is a wizard that has asked its
|
|
247
|
+
* questions already. Answers with the `apimatic.json` it wrote.
|
|
248
|
+
*/
|
|
249
|
+
async scaffold(specPath, schemaUrl) {
|
|
250
|
+
try {
|
|
251
|
+
await new SpecContext(this.specDirectory).install(specPath);
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
return err({ kind: 'sourceUnwritable', reason: errorMessage(error) });
|
|
255
|
+
}
|
|
256
|
+
return await this.adopt(specPath, schemaUrl);
|
|
257
|
+
}
|
|
258
|
+
/** The same tree around a specification the project already carries, which is left where it is. */
|
|
259
|
+
async adopt(specPath, schemaUrl) {
|
|
260
|
+
try {
|
|
261
|
+
return await this.writeSourceTree(specPath, schemaUrl);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
return err({ kind: 'sourceUnwritable', reason: errorMessage(error) });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The document the portal speaks for, and the one quickstart validates when it adopts a
|
|
269
|
+
* project someone downloaded rather than asking for a specification the project has.
|
|
270
|
+
*/
|
|
271
|
+
async primarySpec() {
|
|
272
|
+
const fileName = (await this.specDirectoryListing()).fileNames.find((name) => SPEC_EXTENSIONS.some((extension) => name.hasExtension(extension)));
|
|
273
|
+
return fileName === undefined ? null : new FilePath(this.specDirectory, fileName);
|
|
274
|
+
}
|
|
275
|
+
async writeSourceTree(specPath, schemaUrl) {
|
|
276
|
+
const site = await this.suggestedSite(specPath);
|
|
277
|
+
const config = PortalConfig.scaffolded(site);
|
|
278
|
+
// A downloaded build carries `spec/` and no config, so the merge creates the file on both
|
|
279
|
+
// paths. Every default is spelled out, so the block shows what can be set, and the schema
|
|
280
|
+
// lets an editor complete and check the rest.
|
|
281
|
+
const written = await this.configContext.merge(['portal'], (document) => document.referencingSchema(schemaUrl).with('portal', config.toJSON()));
|
|
282
|
+
if (written.isErr()) {
|
|
283
|
+
return err({ kind: written.error === 'unreadable' ? 'configUnreadable' : 'configUnwritable' });
|
|
284
|
+
}
|
|
285
|
+
await this.fileService.createDirectoryIfNotExists(this.contentDirectory);
|
|
286
|
+
const summary = `Getting started with ${config.siteTitle()}`;
|
|
287
|
+
await this.fileService.writeContents(new FilePath(this.contentDirectory, new FileName('index.md')), [
|
|
288
|
+
'---',
|
|
289
|
+
'title: Welcome',
|
|
290
|
+
// JSON is valid YAML. Quoting through it keeps a title carrying ': ' or '#' from
|
|
291
|
+
// breaking the front matter, which fails the whole build rather than one page.
|
|
292
|
+
`description: ${JSON.stringify(summary)}`,
|
|
293
|
+
'---',
|
|
294
|
+
'',
|
|
295
|
+
`Welcome to the ${config.siteTitle()} documentation.`,
|
|
296
|
+
'',
|
|
297
|
+
'Replace this page with your own introduction, and add more Markdown pages beside it.',
|
|
298
|
+
''
|
|
299
|
+
].join('\n'));
|
|
300
|
+
// Orders the sidebar: named pages first, then everything else alphabetically.
|
|
301
|
+
await this.fileService.writeContents(new FilePath(this.contentDirectory, new FileName(NAVIGATION_FILE_NAME)), JSON.stringify({ pages: ['index', '...'] }, null, 2) + '\n');
|
|
302
|
+
return ok(new FilePath(this.sourceDirectory, new FileName(APIMATIC_CONFIG_FILE_NAME)));
|
|
303
|
+
}
|
|
304
|
+
// A split specification arrives as an archive, whose parts are left to the build to read.
|
|
305
|
+
async suggestedSite(specPath) {
|
|
306
|
+
if (await this.fileService.isZipFile(specPath)) {
|
|
307
|
+
return PLACEHOLDER_SITE;
|
|
308
|
+
}
|
|
309
|
+
const document = await this.readDocument(specPath);
|
|
310
|
+
return document === undefined ? PLACEHOLDER_SITE : document.suggestedSite();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Files at the top of `static/` that the build would otherwise have generated itself. Only
|
|
314
|
+
* the top level is read: nothing below it can land on one of these names, and walking the
|
|
315
|
+
* whole tree let one unreadable entry throw out of `resolve`, which otherwise returns a Result.
|
|
316
|
+
*/
|
|
317
|
+
async shadowedFiles(staticDirectory) {
|
|
318
|
+
const fileNames = await this.fileService.getFileNames(staticDirectory);
|
|
319
|
+
return fileNames.filter((fileName) => GENERATED_ROOT_FILES.some((generated) => fileName.is(generated)));
|
|
320
|
+
}
|
|
321
|
+
// With several specifications there is no suggested site: no one of them speaks for the portal.
|
|
322
|
+
async specs() {
|
|
323
|
+
const specs = [];
|
|
324
|
+
// Only the first is kept: it is the one that speaks for the portal when it is alone, and
|
|
325
|
+
// specifications run to megabytes.
|
|
326
|
+
let first;
|
|
327
|
+
const usedSlugs = new Set(RESERVED_SPEC_SLUGS);
|
|
328
|
+
const { fileNames, folders } = await this.specDirectoryListing();
|
|
329
|
+
if (fileNames.length === 0) {
|
|
330
|
+
return err({ kind: 'emptySpecDirectory', folders });
|
|
331
|
+
}
|
|
332
|
+
// What each one is, for the conversion a directory without an OpenAPI 3.x document is pointed to.
|
|
333
|
+
const otherFormats = [];
|
|
334
|
+
const documentNames = fileNames.filter((name) => SPEC_EXTENSIONS.some((extension) => name.hasExtension(extension)));
|
|
335
|
+
for (const fileName of documentNames) {
|
|
336
|
+
const file = new FilePath(this.specDirectory, fileName);
|
|
337
|
+
const document = await this.readDocument(file);
|
|
338
|
+
if (document === undefined) {
|
|
339
|
+
return err({ kind: 'unreadableSpec', fileName });
|
|
340
|
+
}
|
|
341
|
+
const format = document.format();
|
|
342
|
+
if (!format.supported) {
|
|
343
|
+
if (format.format !== null) {
|
|
344
|
+
otherFormats.push({ file, format: format.format });
|
|
345
|
+
}
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
specs.push({ slug: this.uniqueSlug(fileName, usedSlugs), file, endpoints: await this.endpoints(document, file) });
|
|
349
|
+
first ??= document;
|
|
350
|
+
}
|
|
351
|
+
if (first === undefined) {
|
|
352
|
+
const [convertible] = otherFormats;
|
|
353
|
+
// No document declares its format: one the portal would read, by extension, is named before any other file.
|
|
354
|
+
const conversion = convertible === undefined
|
|
355
|
+
? this.conversion(new FilePath(this.specDirectory, documentNames[0] ?? fileNames[0]), null, 0)
|
|
356
|
+
: this.conversion(convertible.file, convertible.format, otherFormats.length - 1);
|
|
357
|
+
return err({ kind: 'noOpenApiSpec', conversion });
|
|
358
|
+
}
|
|
359
|
+
return ok({ specs, suggested: specs.length === 1 ? first.suggestedSite() : null });
|
|
360
|
+
}
|
|
361
|
+
conversion(file, format, others) {
|
|
362
|
+
const into = this.specDirectory.join(TRANSFORMATIONS_DIRECTORY_NAME);
|
|
363
|
+
const converted = new FilePath(into, transformedFileName(file, ExportFormats.Openapi3Yaml));
|
|
364
|
+
return { file, format, converted, others };
|
|
365
|
+
}
|
|
366
|
+
async specDirectoryListing() {
|
|
367
|
+
if (!(await this.fileService.directoryExists(this.specDirectory))) {
|
|
368
|
+
return { fileNames: [], folders: [] };
|
|
369
|
+
}
|
|
370
|
+
const directory = await this.fileService.getDirectory(this.specDirectory);
|
|
371
|
+
return {
|
|
372
|
+
// Sorted because this order decides which of two names that normalise to the same slug
|
|
373
|
+
// keeps it, and which document becomes the default server.
|
|
374
|
+
fileNames: directory.items
|
|
375
|
+
.flatMap((item) => ('fileName' in item ? [item.fileName] : []))
|
|
376
|
+
.sort((left, right) => left.compare(right)),
|
|
377
|
+
folders: directory.items.flatMap((item) => (item instanceof Directory ? [item.directoryPath] : []))
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
// A path item in another file is read from it; one that file refers on to again is not followed.
|
|
381
|
+
async endpoints(document, file) {
|
|
382
|
+
const referenced = await Promise.all(document.pathItemReferences(file.directory()).map(async ({ path, file: target, pointer }) => {
|
|
383
|
+
const targetDocument = await this.readDocument(target);
|
|
384
|
+
return targetDocument?.endpointsAt(path, pointer) ?? [];
|
|
385
|
+
}));
|
|
386
|
+
return [...document.endpoints(), ...referenced.flat()];
|
|
387
|
+
}
|
|
388
|
+
async readDocument(file) {
|
|
389
|
+
try {
|
|
390
|
+
return OpenApiDocument.parse(file.name(), await this.fileService.getContents(file));
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
uniqueSlug(fileName, used) {
|
|
397
|
+
const base = fileName.normalize().toString() || 'api';
|
|
398
|
+
let slug = base;
|
|
399
|
+
let suffix = 2;
|
|
400
|
+
while (used.has(slug)) {
|
|
401
|
+
slug = `${base}-${suffix}`;
|
|
402
|
+
suffix += 1;
|
|
403
|
+
}
|
|
404
|
+
used.add(slug);
|
|
405
|
+
return slug;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=portal-source-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal-source-context.js","sourceRoot":"","sources":["../../src/types/portal-source-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAA0B,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,C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