@apimatic/cli 1.5.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +128 -212
- package/apimatic.schema.json +550 -0
- package/lib/actions/action-result.js +3 -0
- package/lib/actions/action-result.js.map +1 -1
- package/lib/actions/api/transform.js +36 -33
- package/lib/actions/api/transform.js.map +1 -1
- package/lib/actions/api/validate.d.ts +9 -6
- package/lib/actions/api/validate.js +44 -38
- package/lib/actions/api/validate.js.map +1 -1
- package/lib/actions/auth/login.js +7 -4
- package/lib/actions/auth/login.js.map +1 -1
- package/lib/actions/auth/logout.js +2 -1
- package/lib/actions/auth/logout.js.map +1 -1
- package/lib/actions/auth/status.js +5 -3
- package/lib/actions/auth/status.js.map +1 -1
- package/lib/actions/plugin/generate.d.ts +5 -1
- package/lib/actions/plugin/generate.js +83 -56
- package/lib/actions/plugin/generate.js.map +1 -1
- package/lib/actions/plugin/publish.d.ts +2 -1
- package/lib/actions/plugin/publish.js +34 -37
- package/lib/actions/plugin/publish.js.map +1 -1
- package/lib/actions/plugin/record-metadata.d.ts +3 -2
- package/lib/actions/plugin/record-metadata.js +33 -30
- package/lib/actions/plugin/record-metadata.js.map +1 -1
- package/lib/actions/portal/generate.d.ts +8 -6
- package/lib/actions/portal/generate.js +50 -61
- package/lib/actions/portal/generate.js.map +1 -1
- package/lib/actions/portal/prepare-project.d.ts +25 -0
- package/lib/actions/portal/prepare-project.js +68 -0
- package/lib/actions/portal/prepare-project.js.map +1 -0
- package/lib/actions/portal/serve.d.ts +21 -6
- package/lib/actions/portal/serve.js +170 -153
- package/lib/actions/portal/serve.js.map +1 -1
- package/lib/actions/publishing/profile/list.js +4 -2
- package/lib/actions/publishing/profile/list.js.map +1 -1
- package/lib/actions/quickstart.d.ts +23 -5
- package/lib/actions/quickstart.js +222 -21
- package/lib/actions/quickstart.js.map +1 -1
- package/lib/actions/sdk/generate.d.ts +4 -7
- package/lib/actions/sdk/generate.js +53 -93
- package/lib/actions/sdk/generate.js.map +1 -1
- package/lib/actions/sdk/publish/interactive.d.ts +4 -3
- package/lib/actions/sdk/publish/interactive.js +96 -97
- package/lib/actions/sdk/publish/interactive.js.map +1 -1
- package/lib/actions/sdk/publish/non-interactive.d.ts +4 -2
- package/lib/actions/sdk/publish/non-interactive.js +91 -90
- package/lib/actions/sdk/publish/non-interactive.js.map +1 -1
- package/lib/actions/sdk/publish.d.ts +3 -2
- package/lib/actions/sdk/publish.js +55 -53
- package/lib/actions/sdk/publish.js.map +1 -1
- package/lib/actions/sdk/record-published-sdk.d.ts +14 -0
- package/lib/actions/sdk/record-published-sdk.js +57 -0
- package/lib/actions/sdk/record-published-sdk.js.map +1 -0
- package/lib/client-utils/auth-manager.js +1 -1
- package/lib/client-utils/auth-manager.js.map +1 -1
- package/lib/commands/api/transform.d.ts +1 -1
- package/lib/commands/api/transform.js +44 -40
- package/lib/commands/api/transform.js.map +1 -1
- package/lib/commands/api/validate.js +16 -16
- package/lib/commands/api/validate.js.map +1 -1
- package/lib/commands/auth/login.js +14 -15
- package/lib/commands/auth/login.js.map +1 -1
- package/lib/commands/auth/logout.js +5 -6
- package/lib/commands/auth/logout.js.map +1 -1
- package/lib/commands/auth/status.js +4 -5
- package/lib/commands/auth/status.js.map +1 -1
- package/lib/commands/plugin/generate.d.ts +3 -3
- package/lib/commands/plugin/generate.js +20 -20
- package/lib/commands/plugin/generate.js.map +1 -1
- package/lib/commands/plugin/publish.js +18 -18
- package/lib/commands/plugin/publish.js.map +1 -1
- package/lib/commands/portal/generate.d.ts +9 -8
- package/lib/commands/portal/generate.js +36 -27
- package/lib/commands/portal/generate.js.map +1 -1
- package/lib/commands/portal/serve.d.ts +7 -9
- package/lib/commands/portal/serve.js +41 -44
- package/lib/commands/portal/serve.js.map +1 -1
- package/lib/commands/publishing/profile/list.js +8 -12
- package/lib/commands/publishing/profile/list.js.map +1 -1
- package/lib/commands/quickstart.d.ts +5 -5
- package/lib/commands/quickstart.js +18 -24
- package/lib/commands/quickstart.js.map +1 -1
- package/lib/commands/sdk/generate.d.ts +5 -7
- package/lib/commands/sdk/generate.js +58 -70
- package/lib/commands/sdk/generate.js.map +1 -1
- package/lib/commands/sdk/publish.d.ts +6 -7
- package/lib/commands/sdk/publish.js +66 -60
- package/lib/commands/sdk/publish.js.map +1 -1
- package/lib/hooks/node-version.d.ts +3 -0
- package/lib/hooks/node-version.js +12 -0
- package/lib/hooks/node-version.js.map +1 -0
- package/lib/hooks/not-found.js +2 -3
- package/lib/hooks/not-found.js.map +1 -1
- package/lib/hooks/utils.d.ts +4 -2
- package/lib/hooks/utils.js +2 -2
- package/lib/hooks/utils.js.map +1 -1
- package/lib/infrastructure/env-info.d.ts +3 -0
- package/lib/infrastructure/env-info.js +13 -6
- package/lib/infrastructure/env-info.js.map +1 -1
- package/lib/infrastructure/file-service.d.ts +35 -8
- package/lib/infrastructure/file-service.js +149 -53
- package/lib/infrastructure/file-service.js.map +1 -1
- package/lib/infrastructure/file-watch-service.d.ts +40 -0
- package/lib/infrastructure/file-watch-service.js +167 -0
- package/lib/infrastructure/file-watch-service.js.map +1 -0
- package/lib/infrastructure/generation-status-poller.d.ts +8 -7
- package/lib/infrastructure/generation-status-poller.js +20 -12
- package/lib/infrastructure/generation-status-poller.js.map +1 -1
- package/lib/infrastructure/launcher-service.js +6 -6
- package/lib/infrastructure/launcher-service.js.map +1 -1
- package/lib/infrastructure/network-service.d.ts +3 -0
- package/lib/infrastructure/network-service.js +15 -1
- package/lib/infrastructure/network-service.js.map +1 -1
- package/lib/infrastructure/portal-build-service.d.ts +19 -0
- package/lib/infrastructure/portal-build-service.js +58 -0
- package/lib/infrastructure/portal-build-service.js.map +1 -0
- package/lib/infrastructure/portal-dev-server-service.d.ts +29 -0
- package/lib/infrastructure/portal-dev-server-service.js +135 -0
- package/lib/infrastructure/portal-dev-server-service.js.map +1 -0
- package/lib/infrastructure/portal-pages-service.d.ts +17 -0
- package/lib/infrastructure/portal-pages-service.js +103 -0
- package/lib/infrastructure/portal-pages-service.js.map +1 -0
- package/lib/infrastructure/portal-project-service.d.ts +77 -0
- package/lib/infrastructure/portal-project-service.js +309 -0
- package/lib/infrastructure/portal-project-service.js.map +1 -0
- package/lib/infrastructure/service-error.d.ts +1 -0
- package/lib/infrastructure/service-error.js +39 -41
- package/lib/infrastructure/service-error.js.map +1 -1
- package/lib/infrastructure/services/api-client-factory.js +15 -13
- package/lib/infrastructure/services/api-client-factory.js.map +1 -1
- package/lib/infrastructure/services/api-service.d.ts +7 -5
- package/lib/infrastructure/services/api-service.js +28 -20
- package/lib/infrastructure/services/api-service.js.map +1 -1
- package/lib/infrastructure/services/auth-service.js +4 -9
- package/lib/infrastructure/services/auth-service.js.map +1 -1
- package/lib/infrastructure/services/file-download-service.js +3 -3
- package/lib/infrastructure/services/file-download-service.js.map +1 -1
- package/lib/infrastructure/services/plugin-service.d.ts +1 -8
- package/lib/infrastructure/services/plugin-service.js +11 -22
- package/lib/infrastructure/services/plugin-service.js.map +1 -1
- package/lib/infrastructure/services/portal-artifacts-service.d.ts +44 -0
- package/lib/infrastructure/services/portal-artifacts-service.js +268 -0
- package/lib/infrastructure/services/portal-artifacts-service.js.map +1 -0
- package/lib/infrastructure/services/portal-authorization-service.d.ts +22 -0
- package/lib/infrastructure/services/portal-authorization-service.js +23 -0
- package/lib/infrastructure/services/portal-authorization-service.js.map +1 -0
- package/lib/infrastructure/services/publishing-api-service.d.ts +1 -1
- package/lib/infrastructure/services/publishing-api-service.js +11 -15
- package/lib/infrastructure/services/publishing-api-service.js.map +1 -1
- package/lib/infrastructure/services/sdk-generation-service.d.ts +21 -0
- package/lib/infrastructure/services/sdk-generation-service.js +118 -0
- package/lib/infrastructure/services/sdk-generation-service.js.map +1 -0
- package/lib/infrastructure/services/telemetry-service.js +5 -4
- package/lib/infrastructure/services/telemetry-service.js.map +1 -1
- package/lib/infrastructure/services/transformation-service.js +29 -32
- package/lib/infrastructure/services/transformation-service.js.map +1 -1
- package/lib/infrastructure/services/validation-service.d.ts +12 -53
- package/lib/infrastructure/services/validation-service.js +24 -199
- package/lib/infrastructure/services/validation-service.js.map +1 -1
- package/lib/infrastructure/timer-extensions.d.ts +2 -0
- package/lib/infrastructure/timer-extensions.js +10 -0
- package/lib/infrastructure/timer-extensions.js.map +1 -0
- package/lib/infrastructure/tmp-extensions.d.ts +31 -1
- package/lib/infrastructure/tmp-extensions.js +86 -3
- package/lib/infrastructure/tmp-extensions.js.map +1 -1
- package/lib/infrastructure/zip-service.js +2 -2
- package/lib/infrastructure/zip-service.js.map +1 -1
- package/lib/prompts/api/validate.d.ts +6 -7
- package/lib/prompts/api/validate.js +12 -12
- package/lib/prompts/api/validate.js.map +1 -1
- package/lib/prompts/format.d.ts +4 -0
- package/lib/prompts/format.js +5 -0
- package/lib/prompts/format.js.map +1 -1
- package/lib/prompts/plugin/generate.d.ts +17 -12
- package/lib/prompts/plugin/generate.js +94 -44
- package/lib/prompts/plugin/generate.js.map +1 -1
- package/lib/prompts/plugin/publish.d.ts +2 -1
- package/lib/prompts/plugin/publish.js +8 -7
- package/lib/prompts/plugin/publish.js.map +1 -1
- package/lib/prompts/plugin/record-metadata.d.ts +1 -0
- package/lib/prompts/plugin/record-metadata.js +10 -7
- package/lib/prompts/plugin/record-metadata.js.map +1 -1
- package/lib/prompts/portal/artifacts.d.ts +8 -0
- package/lib/prompts/portal/artifacts.js +26 -0
- package/lib/prompts/portal/artifacts.js.map +1 -0
- package/lib/prompts/portal/authorization.d.ts +6 -0
- package/lib/prompts/portal/authorization.js +29 -0
- package/lib/prompts/portal/authorization.js.map +1 -0
- package/lib/prompts/portal/code-samples.d.ts +1 -0
- package/lib/prompts/portal/code-samples.js +9 -0
- package/lib/prompts/portal/code-samples.js.map +1 -0
- package/lib/prompts/portal/generate.d.ts +14 -9
- package/lib/prompts/portal/generate.js +48 -26
- package/lib/prompts/portal/generate.js.map +1 -1
- package/lib/prompts/portal/prepare-project.d.ts +20 -0
- package/lib/prompts/portal/prepare-project.js +36 -0
- package/lib/prompts/portal/prepare-project.js.map +1 -0
- package/lib/prompts/portal/serve.d.ts +32 -12
- package/lib/prompts/portal/serve.js +102 -39
- package/lib/prompts/portal/serve.js.map +1 -1
- package/lib/prompts/portal/source.d.ts +26 -0
- package/lib/prompts/portal/source.js +253 -0
- package/lib/prompts/portal/source.js.map +1 -0
- package/lib/prompts/prompt.d.ts +11 -3
- package/lib/prompts/prompt.js +39 -15
- package/lib/prompts/prompt.js.map +1 -1
- package/lib/prompts/quickstart.d.ts +46 -3
- package/lib/prompts/quickstart.js +199 -12
- package/lib/prompts/quickstart.js.map +1 -1
- package/lib/prompts/sdk/generate.d.ts +15 -13
- package/lib/prompts/sdk/generate.js +29 -32
- package/lib/prompts/sdk/generate.js.map +1 -1
- package/lib/prompts/sdk/publish/interactive.d.ts +10 -6
- package/lib/prompts/sdk/publish/interactive.js +26 -24
- package/lib/prompts/sdk/publish/interactive.js.map +1 -1
- package/lib/prompts/sdk/publish/non-interactive.d.ts +2 -1
- package/lib/prompts/sdk/publish/non-interactive.js +5 -4
- package/lib/prompts/sdk/publish/non-interactive.js.map +1 -1
- package/lib/prompts/sdk/publish.d.ts +3 -3
- package/lib/prompts/sdk/publish.js +13 -17
- package/lib/prompts/sdk/publish.js.map +1 -1
- package/lib/prompts/sdk/record-published-sdk.d.ts +7 -0
- package/lib/prompts/sdk/record-published-sdk.js +26 -0
- package/lib/prompts/sdk/record-published-sdk.js.map +1 -0
- package/lib/types/apimatic-config/document.d.ts +70 -0
- package/lib/types/apimatic-config/document.js +167 -0
- package/lib/types/apimatic-config/document.js.map +1 -0
- package/lib/types/apimatic-config/languages-block.d.ts +39 -0
- package/lib/types/apimatic-config/languages-block.js +58 -0
- package/lib/types/apimatic-config/languages-block.js.map +1 -0
- package/lib/types/apimatic-config-context.d.ts +48 -0
- package/lib/types/apimatic-config-context.js +121 -0
- package/lib/types/apimatic-config-context.js.map +1 -0
- package/lib/types/build/build.d.ts +1 -89
- package/lib/types/build/build.js +6 -161
- package/lib/types/build/build.js.map +1 -1
- package/lib/types/events/domain-event.js +3 -0
- package/lib/types/events/domain-event.js.map +1 -1
- package/lib/types/events/quickstart-completed.js +3 -3
- package/lib/types/events/quickstart-completed.js.map +1 -1
- package/lib/types/events/quickstart-initiated.js +3 -3
- package/lib/types/events/quickstart-initiated.js.map +1 -1
- package/lib/types/events/sdk-publish-validation-failed.js +1 -1
- package/lib/types/events/sdk-publish-validation-failed.js.map +1 -1
- package/lib/types/file/directory.d.ts +4 -9
- package/lib/types/file/directory.js +17 -65
- package/lib/types/file/directory.js.map +1 -1
- package/lib/types/file/directoryPath.d.ts +17 -0
- package/lib/types/file/directoryPath.js +47 -2
- package/lib/types/file/directoryPath.js.map +1 -1
- package/lib/types/file/fileName.d.ts +8 -0
- package/lib/types/file/fileName.js +28 -6
- package/lib/types/file/fileName.js.map +1 -1
- package/lib/types/file/filePath.d.ts +18 -2
- package/lib/types/file/filePath.js +39 -4
- package/lib/types/file/filePath.js.map +1 -1
- package/lib/types/file/resource-input.js +1 -2
- package/lib/types/file/resource-input.js.map +1 -1
- package/lib/types/file/urlPath.js +2 -1
- package/lib/types/file/urlPath.js.map +1 -1
- package/lib/types/flags-provider.js +22 -22
- package/lib/types/flags-provider.js.map +1 -1
- package/lib/types/package-settings-context.js +2 -1
- package/lib/types/package-settings-context.js.map +1 -1
- package/lib/types/plugin/plugin-config.d.ts +10 -50
- package/lib/types/plugin/plugin-config.js +7 -1
- package/lib/types/plugin/plugin-config.js.map +1 -1
- package/lib/types/plugin-config-context.d.ts +30 -37
- package/lib/types/plugin-config-context.js +108 -139
- package/lib/types/plugin-config-context.js.map +1 -1
- package/lib/types/plugin-context.js +3 -2
- package/lib/types/plugin-context.js.map +1 -1
- package/lib/types/portal/code-samples.d.ts +27 -0
- package/lib/types/portal/code-samples.js +67 -0
- package/lib/types/portal/code-samples.js.map +1 -0
- package/lib/types/portal/config/ai-config.d.ts +15 -0
- package/lib/types/portal/config/ai-config.js +26 -0
- package/lib/types/portal/config/ai-config.js.map +1 -0
- package/lib/types/portal/config/brand-config.d.ts +55 -0
- package/lib/types/portal/config/brand-config.js +105 -0
- package/lib/types/portal/config/brand-config.js.map +1 -0
- package/lib/types/portal/config/color.d.ts +19 -0
- package/lib/types/portal/config/color.js +43 -0
- package/lib/types/portal/config/color.js.map +1 -0
- package/lib/types/portal/config/fields.d.ts +23 -0
- package/lib/types/portal/config/fields.js +67 -0
- package/lib/types/portal/config/fields.js.map +1 -0
- package/lib/types/portal/config/link.d.ts +18 -0
- package/lib/types/portal/config/link.js +72 -0
- package/lib/types/portal/config/link.js.map +1 -0
- package/lib/types/portal/config/navigation-config.d.ts +13 -0
- package/lib/types/portal/config/navigation-config.js +30 -0
- package/lib/types/portal/config/navigation-config.js.map +1 -0
- package/lib/types/portal/config/site-config.d.ts +32 -0
- package/lib/types/portal/config/site-config.js +88 -0
- package/lib/types/portal/config/site-config.js.map +1 -0
- package/lib/types/portal/config/static-asset.d.ts +25 -0
- package/lib/types/portal/config/static-asset.js +77 -0
- package/lib/types/portal/config/static-asset.js.map +1 -0
- package/lib/types/portal/content-notices.d.ts +20 -0
- package/lib/types/portal/content-notices.js +2 -0
- package/lib/types/portal/content-notices.js.map +1 -0
- package/lib/types/portal/content-tree.d.ts +103 -0
- package/lib/types/portal/content-tree.js +344 -0
- package/lib/types/portal/content-tree.js.map +1 -0
- package/lib/types/portal/endpoint.d.ts +6 -0
- package/lib/types/portal/endpoint.js +12 -0
- package/lib/types/portal/endpoint.js.map +1 -0
- package/lib/types/portal/generated-pages.d.ts +68 -0
- package/lib/types/portal/generated-pages.js +111 -0
- package/lib/types/portal/generated-pages.js.map +1 -0
- package/lib/types/portal/generation-status.d.ts +31 -0
- package/lib/types/portal/generation-status.js +26 -0
- package/lib/types/portal/generation-status.js.map +1 -0
- package/lib/types/portal/openapi-document.d.ts +48 -0
- package/lib/types/portal/openapi-document.js +138 -0
- package/lib/types/portal/openapi-document.js.map +1 -0
- package/lib/types/portal/page-fragments.d.ts +13 -0
- package/lib/types/portal/page-fragments.js +24 -0
- package/lib/types/portal/page-fragments.js.map +1 -0
- package/lib/types/portal/page-template.d.ts +15 -0
- package/lib/types/portal/page-template.js +64 -0
- package/lib/types/portal/page-template.js.map +1 -0
- package/lib/types/portal/page.d.ts +24 -0
- package/lib/types/portal/page.js +100 -0
- package/lib/types/portal/page.js.map +1 -0
- package/lib/types/portal/portal-artifacts.d.ts +25 -0
- package/lib/types/portal/portal-artifacts.js +30 -0
- package/lib/types/portal/portal-artifacts.js.map +1 -0
- package/lib/types/portal/portal-config.d.ts +69 -0
- package/lib/types/portal/portal-config.js +105 -0
- package/lib/types/portal/portal-config.js.map +1 -0
- package/lib/types/portal/portal-downloads.d.ts +8 -0
- package/lib/types/portal/portal-downloads.js +14 -0
- package/lib/types/portal/portal-downloads.js.map +1 -0
- package/lib/types/portal/portal-languages.d.ts +15 -0
- package/lib/types/portal/portal-languages.js +45 -0
- package/lib/types/portal/portal-languages.js.map +1 -0
- package/lib/types/portal/portal-navigation.d.ts +65 -0
- package/lib/types/portal/portal-navigation.js +217 -0
- package/lib/types/portal/portal-navigation.js.map +1 -0
- package/lib/types/portal/portal-sdk.d.ts +15 -0
- package/lib/types/portal/portal-sdk.js +28 -0
- package/lib/types/portal/portal-sdk.js.map +1 -0
- package/lib/types/portal/portal-source.d.ts +129 -0
- package/lib/types/portal/portal-source.js +2 -0
- package/lib/types/portal/portal-source.js.map +1 -0
- package/lib/types/portal/portal-stylesheet.d.ts +19 -0
- package/lib/types/portal/portal-stylesheet.js +40 -0
- package/lib/types/portal/portal-stylesheet.js.map +1 -0
- package/lib/types/portal/portal-tabs.d.ts +33 -0
- package/lib/types/portal/portal-tabs.js +38 -0
- package/lib/types/portal/portal-tabs.js.map +1 -0
- package/lib/types/portal/preview-config.d.ts +20 -0
- package/lib/types/portal/preview-config.js +32 -0
- package/lib/types/portal/preview-config.js.map +1 -0
- package/lib/types/portal/preview-content.d.ts +18 -0
- package/lib/types/portal/preview-content.js +50 -0
- package/lib/types/portal/preview-content.js.map +1 -0
- package/lib/types/portal/published-package.d.ts +12 -0
- package/lib/types/portal/published-package.js +35 -0
- package/lib/types/portal/published-package.js.map +1 -0
- package/lib/types/portal/unknown-fields.d.ts +5 -0
- package/lib/types/portal/unknown-fields.js +10 -0
- package/lib/types/portal/unknown-fields.js.map +1 -0
- package/lib/types/portal-context.d.ts +38 -6
- package/lib/types/portal-context.js +71 -24
- package/lib/types/portal-context.js.map +1 -1
- package/lib/types/portal-source-context.d.ts +77 -0
- package/lib/types/portal-source-context.js +408 -0
- package/lib/types/portal-source-context.js.map +1 -0
- package/lib/types/project-context.d.ts +49 -0
- package/lib/types/project-context.js +151 -0
- package/lib/types/project-context.js.map +1 -0
- package/lib/types/project-layout.d.ts +9 -0
- package/lib/types/project-layout.js +10 -0
- package/lib/types/project-layout.js.map +1 -0
- package/lib/types/publish/package-settings-configuration.d.ts +2 -0
- package/lib/types/publish/profile-id.js +1 -0
- package/lib/types/publish/profile-id.js.map +1 -1
- package/lib/types/publish/publishing-profile.d.ts +3 -1
- package/lib/types/publish/publishing-profile.js +33 -15
- package/lib/types/publish/publishing-profile.js.map +1 -1
- package/lib/types/publish/publishing-profiles.js +2 -1
- package/lib/types/publish/publishing-profiles.js.map +1 -1
- package/lib/types/publish/version.js +1 -0
- package/lib/types/publish/version.js.map +1 -1
- package/lib/types/resource-context.js +3 -2
- package/lib/types/resource-context.js.map +1 -1
- package/lib/types/sdk/generate.d.ts +22 -16
- package/lib/types/sdk/generate.js +64 -41
- package/lib/types/sdk/generate.js.map +1 -1
- package/lib/types/sdk/stability-choice.d.ts +12 -0
- package/lib/types/sdk/stability-choice.js +24 -0
- package/lib/types/sdk/stability-choice.js.map +1 -0
- package/lib/types/sdk-context.d.ts +4 -5
- package/lib/types/sdk-context.js +10 -18
- package/lib/types/sdk-context.js.map +1 -1
- package/lib/types/spec-context.d.ts +5 -4
- package/lib/types/spec-context.js +9 -8
- package/lib/types/spec-context.js.map +1 -1
- package/lib/types/temp-context.d.ts +1 -1
- package/lib/types/temp-context.js +5 -4
- package/lib/types/temp-context.js.map +1 -1
- package/lib/types/transform-context.d.ts +9 -5
- package/lib/types/transform-context.js +21 -18
- package/lib/types/transform-context.js.map +1 -1
- package/lib/utils/error-utils.d.ts +2 -0
- package/lib/utils/error-utils.js +5 -0
- package/lib/utils/error-utils.js.map +1 -0
- package/lib/utils/json-utils.d.ts +2 -0
- package/lib/utils/json-utils.js +4 -0
- package/lib/utils/json-utils.js.map +1 -0
- package/lib/utils/string-utils.d.ts +8 -1
- package/lib/utils/string-utils.js +13 -26
- package/lib/utils/string-utils.js.map +1 -1
- package/lib/utils/utils.d.ts +1 -3
- package/lib/utils/utils.js +12 -40
- package/lib/utils/utils.js.map +1 -1
- package/oclif.manifest.json +69 -357
- package/package.json +47 -25
- package/portal-pages/context-plugin.mdx +26 -0
- package/portal-pages/sdk.mdx +8 -0
- package/portal-pages/sdks.mdx +11 -0
- package/portal-template/NOTICE +37 -0
- package/portal-template/downloads.ts +41 -0
- package/portal-template/generated-pages-reload.ts +51 -0
- package/portal-template/package.json +11 -0
- package/portal-template/portal-config.ts +32 -0
- package/portal-template/prerender-pages.ts +81 -0
- package/portal-template/spec-reload.ts +26 -0
- package/portal-template/src/components/api-page.tsx +15 -0
- package/portal-template/src/components/code-block.tsx +9 -0
- package/portal-template/src/components/command-block.tsx +50 -0
- package/portal-template/src/components/example-layout.tsx +99 -0
- package/portal-template/src/components/logos.tsx +127 -0
- package/portal-template/src/components/mdx.tsx +28 -0
- package/portal-template/src/components/not-found.tsx +11 -0
- package/portal-template/src/components/plugin-install.tsx +22 -0
- package/portal-template/src/components/plugin-support.tsx +53 -0
- package/portal-template/src/components/sdk-actions.tsx +79 -0
- package/portal-template/src/components/sdk-cards.tsx +100 -0
- package/portal-template/src/components/search.tsx +41 -0
- package/portal-template/src/components/usage-tabs.tsx +92 -0
- package/portal-template/src/lib/code-samples.server.ts +40 -0
- package/portal-template/src/lib/code-samples.ts +43 -0
- package/portal-template/src/lib/code-titles.ts +29 -0
- package/portal-template/src/lib/install-command.ts +13 -0
- package/portal-template/src/lib/json.ts +5 -0
- package/portal-template/src/lib/layout.shared.tsx +41 -0
- package/portal-template/src/lib/layout.tsx +16 -0
- package/portal-template/src/lib/llms.server.ts +54 -0
- package/portal-template/src/lib/media-adapters.ts +34 -0
- package/portal-template/src/lib/navigation.ts +406 -0
- package/portal-template/src/lib/openapi-bundle.server.ts +343 -0
- package/portal-template/src/lib/openapi-filter.ts +191 -0
- package/portal-template/src/lib/openapi-labels.ts +15 -0
- package/portal-template/src/lib/openapi-methods.ts +12 -0
- package/portal-template/src/lib/openapi-section.server.ts +280 -0
- package/portal-template/src/lib/openapi-slim.ts +202 -0
- package/portal-template/src/lib/openapi.server.ts +16 -0
- package/portal-template/src/lib/portal-types.ts +36 -0
- package/portal-template/src/lib/portal.server.ts +13 -0
- package/portal-template/src/lib/portal.ts +11 -0
- package/portal-template/src/lib/rehype-code-titles.ts +53 -0
- package/portal-template/src/lib/request-examples.ts +72 -0
- package/portal-template/src/lib/seo.ts +21 -0
- package/portal-template/src/lib/shared.ts +51 -0
- package/portal-template/src/lib/shiki-bundle.ts +104 -0
- package/portal-template/src/lib/sitemap.server.ts +20 -0
- package/portal-template/src/lib/source.server.ts +27 -0
- package/portal-template/src/lib/source.ts +49 -0
- package/portal-template/src/lib/tabs.ts +37 -0
- package/portal-template/src/router.tsx +12 -0
- package/portal-template/src/routes/$.tsx +194 -0
- package/portal-template/src/routes/__root.tsx +56 -0
- package/portal-template/src/routes/api/search[.]json.ts +9 -0
- package/portal-template/src/routes/llms-full[.]txt.ts +10 -0
- package/portal-template/src/routes/llms[.]txt.ts +10 -0
- package/portal-template/src/routes/robots[.]txt.ts +10 -0
- package/portal-template/src/routes/sitemap[.]xml.ts +10 -0
- package/portal-template/src/routes/spa-shell.tsx +7 -0
- package/portal-template/src/routes/{$}[.]md.ts +21 -0
- package/portal-template/src/styles/app.css +33 -0
- package/portal-template/tsconfig.json +26 -0
- package/portal-template/vite.config.ts +68 -0
- package/lib/actions/plugin/record-sdk.d.ts +0 -14
- package/lib/actions/plugin/record-sdk.js +0 -60
- package/lib/actions/plugin/record-sdk.js.map +0 -1
- package/lib/actions/portal/copilot.d.ts +0 -17
- package/lib/actions/portal/copilot.js +0 -89
- package/lib/actions/portal/copilot.js.map +0 -1
- package/lib/actions/portal/quickstart.d.ts +0 -18
- package/lib/actions/portal/quickstart.js +0 -238
- package/lib/actions/portal/quickstart.js.map +0 -1
- package/lib/actions/portal/recipe/new-recipe.d.ts +0 -15
- package/lib/actions/portal/recipe/new-recipe.js +0 -177
- package/lib/actions/portal/recipe/new-recipe.js.map +0 -1
- package/lib/actions/portal/toc/new-toc.d.ts +0 -21
- package/lib/actions/portal/toc/new-toc.js +0 -95
- package/lib/actions/portal/toc/new-toc.js.map +0 -1
- package/lib/actions/sdk/merge-source-tree.d.ts +0 -12
- package/lib/actions/sdk/merge-source-tree.js +0 -78
- package/lib/actions/sdk/merge-source-tree.js.map +0 -1
- package/lib/actions/sdk/quickstart.d.ts +0 -18
- package/lib/actions/sdk/quickstart.js +0 -188
- package/lib/actions/sdk/quickstart.js.map +0 -1
- package/lib/actions/sdk/save-changes.d.ts +0 -8
- package/lib/actions/sdk/save-changes.js +0 -93
- package/lib/actions/sdk/save-changes.js.map +0 -1
- package/lib/application/portal/recipe/portal-recipe.d.ts +0 -8
- package/lib/application/portal/recipe/portal-recipe.js +0 -33
- package/lib/application/portal/recipe/portal-recipe.js.map +0 -1
- package/lib/application/portal/recipe/recipe-generator.d.ts +0 -21
- package/lib/application/portal/recipe/recipe-generator.js +0 -130
- package/lib/application/portal/recipe/recipe-generator.js.map +0 -1
- package/lib/application/portal/toc/toc-content-parser.d.ts +0 -5
- package/lib/application/portal/toc/toc-content-parser.js +0 -44
- package/lib/application/portal/toc/toc-content-parser.js.map +0 -1
- package/lib/application/portal/toc/toc-structure-generator.d.ts +0 -11
- package/lib/application/portal/toc/toc-structure-generator.js +0 -165
- package/lib/application/portal/toc/toc-structure-generator.js.map +0 -1
- package/lib/commands/portal/copilot.d.ts +0 -13
- package/lib/commands/portal/copilot.js +0 -34
- package/lib/commands/portal/copilot.js.map +0 -1
- package/lib/commands/portal/recipe/new.d.ts +0 -12
- package/lib/commands/portal/recipe/new.js +0 -45
- package/lib/commands/portal/recipe/new.js.map +0 -1
- package/lib/commands/portal/toc/new.d.ts +0 -16
- package/lib/commands/portal/toc/new.js +0 -68
- package/lib/commands/portal/toc/new.js.map +0 -1
- package/lib/commands/sdk/save-changes.d.ts +0 -14
- package/lib/commands/sdk/save-changes.js +0 -51
- package/lib/commands/sdk/save-changes.js.map +0 -1
- package/lib/infrastructure/debounce-service.d.ts +0 -10
- package/lib/infrastructure/debounce-service.js +0 -55
- package/lib/infrastructure/debounce-service.js.map +0 -1
- package/lib/infrastructure/services/portal-service.d.ts +0 -43
- package/lib/infrastructure/services/portal-service.js +0 -337
- package/lib/infrastructure/services/portal-service.js.map +0 -1
- package/lib/prompts/plugin/record-sdk.d.ts +0 -9
- package/lib/prompts/plugin/record-sdk.js +0 -40
- package/lib/prompts/plugin/record-sdk.js.map +0 -1
- package/lib/prompts/portal/copilot.d.ts +0 -18
- package/lib/prompts/portal/copilot.js +0 -82
- package/lib/prompts/portal/copilot.js.map +0 -1
- package/lib/prompts/portal/quickstart.d.ts +0 -42
- package/lib/prompts/portal/quickstart.js +0 -243
- package/lib/prompts/portal/quickstart.js.map +0 -1
- package/lib/prompts/portal/recipe/new-recipe.d.ts +0 -29
- package/lib/prompts/portal/recipe/new-recipe.js +0 -165
- package/lib/prompts/portal/recipe/new-recipe.js.map +0 -1
- package/lib/prompts/portal/toc/new-toc.d.ts +0 -16
- package/lib/prompts/portal/toc/new-toc.js +0 -50
- package/lib/prompts/portal/toc/new-toc.js.map +0 -1
- package/lib/prompts/sdk/merge-source-tree.d.ts +0 -22
- package/lib/prompts/sdk/merge-source-tree.js +0 -90
- package/lib/prompts/sdk/merge-source-tree.js.map +0 -1
- package/lib/prompts/sdk/quickstart.d.ts +0 -38
- package/lib/prompts/sdk/quickstart.js +0 -196
- package/lib/prompts/sdk/quickstart.js.map +0 -1
- package/lib/prompts/sdk/save-changes.d.ts +0 -21
- package/lib/prompts/sdk/save-changes.js +0 -84
- package/lib/prompts/sdk/save-changes.js.map +0 -1
- package/lib/types/build-context.d.ts +0 -26
- package/lib/types/build-context.js +0 -111
- package/lib/types/build-context.js.map +0 -1
- package/lib/types/events/recipe-creation-failed.d.ts +0 -5
- package/lib/types/events/recipe-creation-failed.js +0 -8
- package/lib/types/events/recipe-creation-failed.js.map +0 -1
- package/lib/types/events/sdk-changes-saved.d.ts +0 -8
- package/lib/types/events/sdk-changes-saved.js +0 -11
- package/lib/types/events/sdk-changes-saved.js.map +0 -1
- package/lib/types/events/sdk-changes-tracked.d.ts +0 -8
- package/lib/types/events/sdk-changes-tracked.js +0 -11
- package/lib/types/events/sdk-changes-tracked.js.map +0 -1
- package/lib/types/events/sdk-conflicts-resolved.d.ts +0 -8
- package/lib/types/events/sdk-conflicts-resolved.js +0 -11
- package/lib/types/events/sdk-conflicts-resolved.js.map +0 -1
- package/lib/types/events/toc-creation-failed.d.ts +0 -5
- package/lib/types/events/toc-creation-failed.js +0 -8
- package/lib/types/events/toc-creation-failed.js.map +0 -1
- package/lib/types/merge-source-tree-context.d.ts +0 -28
- package/lib/types/merge-source-tree-context.js +0 -63
- package/lib/types/merge-source-tree-context.js.map +0 -1
- package/lib/types/plugin/language-entry.d.ts +0 -9
- package/lib/types/plugin/language-entry.js +0 -64
- package/lib/types/plugin/language-entry.js.map +0 -1
- package/lib/types/recipe/recipe.d.ts +0 -22
- package/lib/types/recipe/recipe.js +0 -6
- package/lib/types/recipe/recipe.js.map +0 -1
- package/lib/types/recipe-context.d.ts +0 -9
- package/lib/types/recipe-context.js +0 -26
- package/lib/types/recipe-context.js.map +0 -1
- package/lib/types/save-changes-context.d.ts +0 -17
- package/lib/types/save-changes-context.js +0 -42
- package/lib/types/save-changes-context.js.map +0 -1
- package/lib/types/sdl/sdl.d.ts +0 -10
- package/lib/types/sdl/sdl.js +0 -18
- package/lib/types/sdl/sdl.js.map +0 -1
- package/lib/types/toc/toc-components.d.ts +0 -36
- package/lib/types/toc/toc-components.js +0 -94
- package/lib/types/toc/toc-components.js.map +0 -1
- package/lib/types/toc/toc.d.ts +0 -67
- package/lib/types/toc/toc.js +0 -2
- package/lib/types/toc/toc.js.map +0 -1
- package/lib/types/toc-context.d.ts +0 -12
- package/lib/types/toc-context.js +0 -26
- package/lib/types/toc-context.js.map +0 -1
|
@@ -1,57 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CodeGenerationVersion, Language } from '../sdk/generate.js';
|
|
1
|
+
import { PluginLanguages } from '../apimatic-config/languages-block.js';
|
|
3
2
|
/** Written unprompted: the backend consumes it, and nothing in the CLI asks for it. */
|
|
4
3
|
export declare const DEFAULT_PLUGIN_LICENSE = "MIT";
|
|
4
|
+
/** Also the rule the metadata prompt validates against, so a plugin ID is legal as a repository name. */
|
|
5
|
+
export declare const PLUGIN_ID_PATTERN: RegExp;
|
|
5
6
|
export interface PluginAuthor {
|
|
6
7
|
name: string;
|
|
7
8
|
email?: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
branch?: string;
|
|
12
|
-
}
|
|
13
|
-
interface CSharpPackageConfig {
|
|
14
|
-
packageId: string;
|
|
15
|
-
version: SemVersionString;
|
|
16
|
-
}
|
|
17
|
-
interface JavaPackageConfig {
|
|
18
|
-
groupId: string;
|
|
19
|
-
artifactId: string;
|
|
20
|
-
version: SemVersionString;
|
|
21
|
-
}
|
|
22
|
-
interface PhpPackageConfig {
|
|
23
|
-
vendorName: string;
|
|
24
|
-
projectName: string;
|
|
25
|
-
version: SemVersionString;
|
|
26
|
-
}
|
|
27
|
-
interface NamedPackageConfig {
|
|
28
|
-
name: string;
|
|
29
|
-
version: SemVersionString;
|
|
30
|
-
}
|
|
31
|
-
type PythonPackageConfig = NamedPackageConfig;
|
|
32
|
-
type RubyPackageConfig = NamedPackageConfig;
|
|
33
|
-
type TypeScriptPackageConfig = NamedPackageConfig;
|
|
34
|
-
interface GoPackageConfig {
|
|
35
|
-
packageName: string;
|
|
36
|
-
version: SemVersionString;
|
|
37
|
-
}
|
|
38
|
-
interface PluginConfig<TPackage> {
|
|
39
|
-
source?: LanguageSource;
|
|
40
|
-
package?: TPackage;
|
|
41
|
-
codegenVersion: CodeGenerationVersion;
|
|
42
|
-
}
|
|
43
|
-
interface PluginConfigForLanguage {
|
|
44
|
-
[Language.CSHARP]: PluginConfig<CSharpPackageConfig>;
|
|
45
|
-
[Language.JAVA]: PluginConfig<JavaPackageConfig>;
|
|
46
|
-
[Language.PHP]: PluginConfig<PhpPackageConfig>;
|
|
47
|
-
[Language.PYTHON]: PluginConfig<PythonPackageConfig>;
|
|
48
|
-
[Language.RUBY]: PluginConfig<RubyPackageConfig>;
|
|
49
|
-
[Language.TYPESCRIPT]: PluginConfig<TypeScriptPackageConfig>;
|
|
50
|
-
[Language.GO]: PluginConfig<GoPackageConfig>;
|
|
51
|
-
}
|
|
52
|
-
export type PluginLanguageEntry<L extends Language> = PluginConfigForLanguage[L];
|
|
53
|
-
export type PluginLanguages = Partial<PluginConfigForLanguage>;
|
|
54
|
-
export interface PluginConfigData {
|
|
10
|
+
/** The `plugin` block of `apimatic.json`: the identity `plugin generate` records. */
|
|
11
|
+
export interface PluginIdentityData {
|
|
55
12
|
pluginId?: string;
|
|
56
13
|
pluginName?: string;
|
|
57
14
|
pluginVersion?: string;
|
|
@@ -60,13 +17,16 @@ export interface PluginConfigData {
|
|
|
60
17
|
license?: string;
|
|
61
18
|
homepage?: string;
|
|
62
19
|
repository?: string;
|
|
63
|
-
languages: PluginLanguages;
|
|
64
20
|
[key: string]: unknown;
|
|
65
21
|
}
|
|
22
|
+
/** The identity with `languages` beside it: the one configuration the plugin commands judge. */
|
|
23
|
+
export interface PluginConfigData extends PluginIdentityData {
|
|
24
|
+
languages: PluginLanguages;
|
|
25
|
+
}
|
|
66
26
|
/** The fields the CLI asks for; everything else is derived, resolved or constant. */
|
|
67
27
|
export interface PluginMetadata {
|
|
68
28
|
pluginId: string;
|
|
69
29
|
pluginName: string;
|
|
70
30
|
pluginVersion: string;
|
|
71
31
|
}
|
|
72
|
-
export
|
|
32
|
+
export declare const PLACEHOLDER_METADATA: Readonly<PluginMetadata>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { Language } from '../sdk/generate.js';
|
|
2
1
|
/** Written unprompted: the backend consumes it, and nothing in the CLI asks for it. */
|
|
3
2
|
export const DEFAULT_PLUGIN_LICENSE = 'MIT';
|
|
3
|
+
/** Also the rule the metadata prompt validates against, so a plugin ID is legal as a repository name. */
|
|
4
|
+
export const PLUGIN_ID_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
5
|
+
export const PLACEHOLDER_METADATA = Object.freeze({
|
|
6
|
+
pluginId: 'my-api-plugin',
|
|
7
|
+
pluginName: 'My API Plugin',
|
|
8
|
+
pluginVersion: '0.1.0'
|
|
9
|
+
});
|
|
4
10
|
//# sourceMappingURL=plugin-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-config.js","sourceRoot":"","sources":["../../../src/types/plugin/plugin-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-config.js","sourceRoot":"","sources":["../../../src/types/plugin/plugin-config.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE5C,yGAAyG;AACzG,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAoC5D,MAAM,CAAC,MAAM,oBAAoB,GAA6B,MAAM,CAAC,MAAM,CAAC;IAC1E,QAAQ,EAAE,eAAe;IACzB,UAAU,EAAE,eAAe;IAC3B,aAAa,EAAE,OAAO;CACvB,CAAC,CAAC"}
|
|
@@ -1,63 +1,56 @@
|
|
|
1
|
+
import { Result } from 'neverthrow';
|
|
2
|
+
import { ApimaticConfigWriteFailure } from './apimatic-config-context.js';
|
|
1
3
|
import { DirectoryPath } from './file/directoryPath.js';
|
|
2
4
|
import { FilePath } from './file/filePath.js';
|
|
3
|
-
import {
|
|
4
|
-
import { PluginAuthor, PluginConfigData, PluginLanguageEntry, PluginMetadata } from './plugin/plugin-config.js';
|
|
5
|
+
import { PluginAuthor, PluginConfigData, PluginMetadata } from './plugin/plugin-config.js';
|
|
5
6
|
import { SemVersion } from './publish/version.js';
|
|
6
|
-
import {
|
|
7
|
-
/** Also the rule the metadata prompt validates against, so a plugin ID is legal as a repository name. */
|
|
8
|
-
export declare const PLUGIN_ID_PATTERN: RegExp;
|
|
7
|
+
import { Language } from './sdk/generate.js';
|
|
9
8
|
export type PluginReleaseData = {
|
|
10
9
|
pluginId: string;
|
|
11
10
|
version: SemVersion;
|
|
12
11
|
};
|
|
13
|
-
/**
|
|
14
|
-
* What a caller needs to know before generating. Metadata and languages are written by different
|
|
15
|
-
* commands — `plugin generate` owns the first, `sdk publish` the second — so they are reported
|
|
16
|
-
* separately. `path` rides on `unreadable` purely so the prompt can say where to fix the file.
|
|
17
|
-
*/
|
|
18
12
|
export type PluginConfigState = {
|
|
19
13
|
state: 'missing';
|
|
20
14
|
} | {
|
|
21
15
|
state: 'unreadable';
|
|
22
16
|
reason: string;
|
|
23
17
|
path: FilePath;
|
|
24
|
-
} |
|
|
25
|
-
export declare class
|
|
18
|
+
} | PluginConfig;
|
|
19
|
+
export declare class PluginConfig {
|
|
26
20
|
private readonly config;
|
|
27
|
-
readonly
|
|
21
|
+
private readonly entries;
|
|
22
|
+
private readonly unsupported;
|
|
23
|
+
readonly state: 'present';
|
|
24
|
+
/** What a project without `apimatic.json` has recorded: nothing. */
|
|
25
|
+
static readonly empty: PluginConfig;
|
|
28
26
|
private constructor();
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/** The one place `languages` is sorted into what a plugin can carry and what it cannot. */
|
|
28
|
+
static create(config: PluginConfigData): PluginConfig;
|
|
29
|
+
publishedLanguages(): readonly Language[];
|
|
30
|
+
/** What `languages` names that a plugin can carry. */
|
|
31
|
+
recordedLanguages(): readonly Language[];
|
|
32
|
+
hasRecordedLanguages(): boolean;
|
|
33
|
+
unsupportedLanguages(): readonly string[];
|
|
31
34
|
hasMetadata(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
* they reach this class through a cast of parsed JSON, so a hand-edited config can hold a number
|
|
35
|
-
* where the type promises a string.
|
|
36
|
-
*/
|
|
35
|
+
/** Nothing is left for `plugin generate` to ask: the identity and the languages are both recorded. */
|
|
36
|
+
isSetUp(): boolean;
|
|
37
37
|
getRelease(): PluginReleaseData | undefined;
|
|
38
38
|
hasNoSourceRepository(language: Language): boolean;
|
|
39
|
-
assertNoCodegenVersionMismatch(codegenVersion: CodeGenerationVersion, language: Language, entry: PluginLanguageEntry<Language>): Result<void, {
|
|
40
|
-
expected: CodeGenerationVersion;
|
|
41
|
-
actual: CodeGenerationVersion;
|
|
42
|
-
}>;
|
|
43
39
|
}
|
|
44
|
-
export type PluginConfigWriteFailure =
|
|
40
|
+
export type PluginConfigWriteFailure = ApimaticConfigWriteFailure;
|
|
45
41
|
export declare class PluginConfigContext {
|
|
46
|
-
private readonly
|
|
42
|
+
private readonly sourceDirectory;
|
|
43
|
+
private readonly configContext;
|
|
47
44
|
private readonly fileService;
|
|
48
|
-
constructor(
|
|
49
|
-
private get configPath();
|
|
45
|
+
constructor(sourceDirectory: DirectoryPath);
|
|
50
46
|
getPluginConfigState(): Promise<PluginConfigState>;
|
|
51
|
-
upsertMetadata(metadata: PluginMetadata, author?: PluginAuthor): Promise<Result<
|
|
52
|
-
|
|
47
|
+
upsertMetadata(metadata: PluginMetadata, author?: PluginAuthor): Promise<Result<PluginConfig, PluginConfigWriteFailure>>;
|
|
48
|
+
recordLanguages(languages: readonly Language[]): Promise<Result<PluginConfig, PluginConfigWriteFailure>>;
|
|
53
49
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* nothing here may turn that into a crash. A success carries the config as it now stands, so a
|
|
57
|
-
* caller that has to decide something after writing does not have to read the file back.
|
|
50
|
+
* The `src/` to upload: a copy whose `languages` names exactly what the plugin covers. The
|
|
51
|
+
* user's file keeps the published entries this run leaves out; the service reads the copy.
|
|
58
52
|
*/
|
|
53
|
+
stageUpload(into: DirectoryPath, languages: readonly Language[]): Promise<Result<DirectoryPath, PluginConfigWriteFailure>>;
|
|
59
54
|
private merge;
|
|
60
|
-
private
|
|
61
|
-
private parse;
|
|
62
|
-
private write;
|
|
55
|
+
private static configOf;
|
|
63
56
|
}
|
|
@@ -1,38 +1,60 @@
|
|
|
1
|
+
import { ResultAsync } from 'neverthrow';
|
|
1
2
|
import { FileService } from '../infrastructure/file-service.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
3
|
+
import { ApimaticConfigContext } from './apimatic-config-context.js';
|
|
4
|
+
import { findingClause } from './apimatic-config/document.js';
|
|
5
|
+
import { isPublished, languagesOf } from './apimatic-config/languages-block.js';
|
|
4
6
|
import { DEFAULT_PLUGIN_LICENSE } from './plugin/plugin-config.js';
|
|
5
7
|
import { SemVersion } from './publish/version.js';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { isAvailableLanguage } from './sdk/generate.js';
|
|
9
|
+
export class PluginConfig {
|
|
10
|
+
config;
|
|
11
|
+
entries;
|
|
12
|
+
unsupported;
|
|
13
|
+
state = 'present';
|
|
14
|
+
/** What a project without `apimatic.json` has recorded: nothing. */
|
|
15
|
+
static empty = PluginConfig.create({ languages: {} });
|
|
16
|
+
constructor(config, entries, unsupported) {
|
|
14
17
|
this.config = config;
|
|
15
|
-
this.
|
|
18
|
+
this.entries = entries;
|
|
19
|
+
this.unsupported = unsupported;
|
|
16
20
|
}
|
|
21
|
+
/** The one place `languages` is sorted into what a plugin can carry and what it cannot. */
|
|
17
22
|
static create(config) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const entries = [];
|
|
24
|
+
const unsupported = [];
|
|
25
|
+
for (const [language, entry] of Object.entries(config.languages)) {
|
|
26
|
+
if (isAvailableLanguage(language)) {
|
|
27
|
+
entries.push([language, entry]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
unsupported.push(language);
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
|
-
return
|
|
33
|
+
return new PluginConfig(config, entries, unsupported);
|
|
34
|
+
}
|
|
35
|
+
publishedLanguages() {
|
|
36
|
+
return this.entries.filter(([, entry]) => isPublished(entry)).map(([language]) => language);
|
|
37
|
+
}
|
|
38
|
+
/** What `languages` names that a plugin can carry. */
|
|
39
|
+
recordedLanguages() {
|
|
40
|
+
return this.entries.map(([language]) => language);
|
|
26
41
|
}
|
|
42
|
+
hasRecordedLanguages() {
|
|
43
|
+
return this.entries.length > 0;
|
|
44
|
+
}
|
|
45
|
+
unsupportedLanguages() {
|
|
46
|
+
return this.unsupported;
|
|
47
|
+
}
|
|
48
|
+
// Checked, not trusted: the config arrives through a cast of parsed JSON, so a hand-edited
|
|
49
|
+
// file can hold a number where the type promises a string.
|
|
27
50
|
hasMetadata() {
|
|
28
51
|
const isNonBlankString = (value) => typeof value === 'string' && value.trim() !== '';
|
|
29
52
|
return isNonBlankString(this.config.pluginId) && isNonBlankString(this.config.pluginName);
|
|
30
53
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
54
|
+
/** Nothing is left for `plugin generate` to ask: the identity and the languages are both recorded. */
|
|
55
|
+
isSetUp() {
|
|
56
|
+
return this.hasMetadata() && this.hasRecordedLanguages();
|
|
57
|
+
}
|
|
36
58
|
getRelease() {
|
|
37
59
|
const pluginId = typeof this.config.pluginId === 'string' ? this.config.pluginId.trim() : '';
|
|
38
60
|
const rawVersion = typeof this.config.pluginVersion === 'string' ? this.config.pluginVersion.trim() : '';
|
|
@@ -42,138 +64,85 @@ export class PluginConfigPresent {
|
|
|
42
64
|
return SemVersion.tryCreate(rawVersion).match((version) => ({ pluginId, version }), () => undefined);
|
|
43
65
|
}
|
|
44
66
|
hasNoSourceRepository(language) {
|
|
45
|
-
|
|
46
|
-
return !((_b = (_a = this.config.languages) === null || _a === void 0 ? void 0 : _a[language]) === null || _b === void 0 ? void 0 : _b.source);
|
|
47
|
-
}
|
|
48
|
-
assertNoCodegenVersionMismatch(codegenVersion, language, entry) {
|
|
49
|
-
var _a, _b, _c;
|
|
50
|
-
if (entry.package && entry.source) {
|
|
51
|
-
return ok(); // if both package and source are given, there is no possible mismatch
|
|
52
|
-
}
|
|
53
|
-
const existingEntry = (_a = this.config.languages) === null || _a === void 0 ? void 0 : _a[language];
|
|
54
|
-
if (!existingEntry) {
|
|
55
|
-
return ok();
|
|
56
|
-
}
|
|
57
|
-
if (!existingEntry.package && !existingEntry.source) {
|
|
58
|
-
return ok();
|
|
59
|
-
}
|
|
60
|
-
const extractedVersion = (_c = (_b = this.config.languages) === null || _b === void 0 ? void 0 : _b[language]) === null || _c === void 0 ? void 0 : _c.codegenVersion;
|
|
61
|
-
if (!extractedVersion) {
|
|
62
|
-
return ok();
|
|
63
|
-
}
|
|
64
|
-
if (extractedVersion === codegenVersion) {
|
|
65
|
-
return ok();
|
|
66
|
-
}
|
|
67
|
-
return err({ expected: codegenVersion, actual: extractedVersion });
|
|
67
|
+
return !this.config.languages?.[language]?.publishing?.source;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
const OWNED_BLOCKS = ['plugin', 'languages'];
|
|
71
|
+
/**
|
|
72
|
+
* A `languages` block holding what the selection covers plus every entry `keep` speaks for.
|
|
73
|
+
* Existing keys stay in place, so a merge that changes nothing writes nothing.
|
|
74
|
+
*/
|
|
75
|
+
const recorded = (document, languages, keep) => {
|
|
76
|
+
const existing = languagesOf(document);
|
|
77
|
+
const covered = new Set(languages);
|
|
78
|
+
const kept = Object.entries(existing).filter(([language, entry]) => covered.has(language) || keep(language, entry));
|
|
79
|
+
const added = languages.filter((language) => !(language in existing)).map((language) => [language, {}]);
|
|
80
|
+
return Object.fromEntries([...kept, ...added]);
|
|
81
|
+
};
|
|
82
|
+
/** In the user's file a cleared language goes, unless its entry records where an SDK was published. */
|
|
83
|
+
const keepsRecord = (language, entry) => !isAvailableLanguage(language) || isPublished(entry);
|
|
84
|
+
const isUnavailableLanguage = (language) => !isAvailableLanguage(language);
|
|
73
85
|
export class PluginConfigContext {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
sourceDirectory;
|
|
87
|
+
configContext;
|
|
88
|
+
fileService = new FileService();
|
|
89
|
+
constructor(sourceDirectory) {
|
|
90
|
+
this.sourceDirectory = sourceDirectory;
|
|
91
|
+
this.configContext = new ApimaticConfigContext(this.sourceDirectory);
|
|
80
92
|
}
|
|
81
93
|
async getPluginConfigState() {
|
|
82
|
-
|
|
94
|
+
const state = await this.configContext.read();
|
|
95
|
+
if (state.state === 'missing') {
|
|
83
96
|
return { state: 'missing' };
|
|
84
97
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return { state: 'unreadable', reason: parsed.reason, path: this.configPath };
|
|
98
|
+
if (state.state === 'unparseable') {
|
|
99
|
+
return { state: 'unreadable', reason: findingClause(state.findings), path: state.path };
|
|
88
100
|
}
|
|
89
|
-
|
|
101
|
+
const findings = state.document.findingsFor('root', ...OWNED_BLOCKS);
|
|
102
|
+
if (findings.length > 0) {
|
|
103
|
+
return { state: 'unreadable', reason: findingClause(findings), path: state.path };
|
|
104
|
+
}
|
|
105
|
+
return PluginConfig.create(PluginConfigContext.configOf(state.document));
|
|
90
106
|
}
|
|
91
107
|
async upsertMetadata(metadata, author) {
|
|
92
|
-
return await this.merge((
|
|
93
|
-
|
|
94
|
-
return
|
|
108
|
+
return await this.merge((document) => {
|
|
109
|
+
const plugin = (document.plugin() ?? {});
|
|
110
|
+
return document.with('plugin', {
|
|
111
|
+
...plugin,
|
|
112
|
+
pluginId: metadata.pluginId,
|
|
113
|
+
pluginName: metadata.pluginName,
|
|
114
|
+
pluginVersion: metadata.pluginVersion,
|
|
115
|
+
...(!plugin.author && author && { author }),
|
|
116
|
+
license: plugin.license ?? DEFAULT_PLUGIN_LICENSE
|
|
117
|
+
});
|
|
95
118
|
});
|
|
96
119
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const languages = Object.assign({}, config.languages);
|
|
101
|
-
const existingEntry = (_a = config.languages) === null || _a === void 0 ? void 0 : _a[language];
|
|
102
|
-
languages[language] = Object.assign(Object.assign(Object.assign({}, existingEntry), entry), { source: (_b = entry.source) !== null && _b !== void 0 ? _b : existingEntry === null || existingEntry === void 0 ? void 0 : existingEntry.source, package: (_c = entry.package) !== null && _c !== void 0 ? _c : existingEntry === null || existingEntry === void 0 ? void 0 : existingEntry.package });
|
|
103
|
-
return Object.assign(Object.assign({}, config), { languages });
|
|
104
|
-
});
|
|
120
|
+
// A published entry survives a cleared checkbox: only `sdk publish` can write that record.
|
|
121
|
+
async recordLanguages(languages) {
|
|
122
|
+
return await this.merge((document) => document.with('languages', recorded(document, languages, keepsRecord)));
|
|
105
123
|
}
|
|
106
124
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* nothing here may turn that into a crash. A success carries the config as it now stands, so a
|
|
110
|
-
* caller that has to decide something after writing does not have to read the file back.
|
|
125
|
+
* The `src/` to upload: a copy whose `languages` names exactly what the plugin covers. The
|
|
126
|
+
* user's file keeps the published entries this run leaves out; the service reads the copy.
|
|
111
127
|
*/
|
|
112
|
-
async
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
catch (_a) {
|
|
122
|
-
return err('unwritable');
|
|
123
|
-
}
|
|
124
|
-
return ok(PluginConfigPresent.create(merged));
|
|
128
|
+
async stageUpload(into, languages) {
|
|
129
|
+
const staged = into.join('build');
|
|
130
|
+
await this.fileService.copyDirectoryContents(this.sourceDirectory, staged);
|
|
131
|
+
const config = new ApimaticConfigContext(staged);
|
|
132
|
+
const covered = await config.merge(OWNED_BLOCKS, (document) => document.with('languages', recorded(document, languages, isUnavailableLanguage)));
|
|
133
|
+
// The merge writes nothing when it changes nothing, so a mark on the copy can outlive it —
|
|
134
|
+
// and the service reads this file with a parser that will not look past one.
|
|
135
|
+
return await covered.asyncAndThen(() => new ResultAsync(config.removeByteOrderMark())).map(() => staged);
|
|
125
136
|
}
|
|
126
|
-
async
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
// TODO: JSON Parsing/Stringify should be in a dedicated JSON infra layer which preferably uses zod
|
|
136
|
-
const contents = await this.fileService.getContents(this.configPath);
|
|
137
|
-
if (contents.trim() === '') {
|
|
138
|
-
return { reason: 'it is empty' };
|
|
139
|
-
}
|
|
140
|
-
if (contents.codePointAt(0) === BYTE_ORDER_MARK) {
|
|
141
|
-
return { reason: 'it starts with a byte-order mark, which JSON does not allow' };
|
|
142
|
-
}
|
|
143
|
-
const parsed = JSON.parse(contents);
|
|
144
|
-
if (!isJsonObject(parsed)) {
|
|
145
|
-
return { reason: 'it is not a JSON object' };
|
|
146
|
-
}
|
|
147
|
-
// Every write merges these by spreading them, which turns a string into `{"0":"a"}` and a
|
|
148
|
-
// number into nothing, so a wrong shape has to be refused before it can corrupt the file.
|
|
149
|
-
const languages = parsed.languages;
|
|
150
|
-
if (languages !== undefined) {
|
|
151
|
-
if (!isJsonObject(languages)) {
|
|
152
|
-
return { reason: `its 'languages' field is not a JSON object` };
|
|
153
|
-
}
|
|
154
|
-
for (const [language, entry] of Object.entries(languages)) {
|
|
155
|
-
if (!isJsonObject(entry)) {
|
|
156
|
-
return { reason: `its 'languages.${language}' entry is not a JSON object` };
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const id = parsed.pluginId;
|
|
161
|
-
if (typeof id === 'string' && (id.trim() === '' || !PLUGIN_ID_PATTERN.test(id))) {
|
|
162
|
-
return { reason: MALFORMED_PLUGIN_ID };
|
|
163
|
-
}
|
|
164
|
-
const rawVersion = parsed.pluginVersion;
|
|
165
|
-
if (typeof rawVersion === 'string' && (rawVersion.trim() === '' || SemVersion.tryCreate(rawVersion).isErr())) {
|
|
166
|
-
return { reason: MALFORMED_PLUGIN_VERSION };
|
|
167
|
-
}
|
|
168
|
-
return { config: parsed };
|
|
169
|
-
}
|
|
170
|
-
catch (error) {
|
|
171
|
-
return { reason: error instanceof Error ? error.message : String(error) };
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
async write(config) {
|
|
175
|
-
await this.fileService.ensurePathExists(this.configPath);
|
|
176
|
-
await this.fileService.writeContents(this.configPath, JSON.stringify(config, null, 2));
|
|
137
|
+
async merge(apply) {
|
|
138
|
+
const merged = await this.configContext.merge(OWNED_BLOCKS, apply);
|
|
139
|
+
return merged.map((document) => PluginConfig.create(PluginConfigContext.configOf(document)));
|
|
140
|
+
}
|
|
141
|
+
static configOf(document) {
|
|
142
|
+
return {
|
|
143
|
+
...document.plugin(),
|
|
144
|
+
languages: languagesOf(document)
|
|
145
|
+
};
|
|
177
146
|
}
|
|
178
147
|
}
|
|
179
148
|
//# sourceMappingURL=plugin-config-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-config-context.js","sourceRoot":"","sources":["../../src/types/plugin-config-context.ts"],"names":[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{ FileName } from './file/fileName.js';
|
|
4
4
|
const GIT_DIRECTORY_NAME = '.git';
|
|
5
5
|
export class PluginContext {
|
|
6
|
+
pluginDirectory;
|
|
7
|
+
fileService = new FileService();
|
|
8
|
+
zipService = new ZipService();
|
|
6
9
|
constructor(pluginDirectory) {
|
|
7
10
|
this.pluginDirectory = pluginDirectory;
|
|
8
|
-
this.fileService = new FileService();
|
|
9
|
-
this.zipService = new ZipService();
|
|
10
11
|
}
|
|
11
12
|
async exists() {
|
|
12
13
|
return !(await this.fileService.directoryEmpty(this.pluginDirectory));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-context.js","sourceRoot":"","sources":["../../src/types/plugin-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"plugin-context.js","sourceRoot":"","sources":["../../src/types/plugin-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,aAAa;IAIK,eAAe;IAH3B,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IAChC,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAE/C,YAA6B,eAA8B;+BAA9B,eAAe;IAAkB,CAAC;IAExD,KAAK,CAAC,MAAM;QACjB,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC3B,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5E,MAAM,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAE5E,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,UAAU,EAAE,EAAE,cAAc,EAAE,WAAW,CAAC,gBAAgB,EAAE,EAAE,CAAC;IACjG,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC3B,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,kBAA4B;QAC5C,4GAA4G;QAC5G,MAAM,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;QACzG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Language } from '../sdk/generate.js';
|
|
2
|
+
import { Endpoint } from './endpoint.js';
|
|
3
|
+
type Sources = Record<string, string>;
|
|
4
|
+
export interface CodeSample {
|
|
5
|
+
lang: Language;
|
|
6
|
+
label: string;
|
|
7
|
+
sources: Sources;
|
|
8
|
+
}
|
|
9
|
+
/** Each endpoint's samples, keyed by path and then by upper-case method: what the portal template reads. */
|
|
10
|
+
export type CodeSamplesByEndpoint = Record<string, Record<string, CodeSample[]>>;
|
|
11
|
+
export declare class CodeSampleCatalog {
|
|
12
|
+
private readonly samplesByEndpoint;
|
|
13
|
+
private constructor();
|
|
14
|
+
static fromJson(language: Language, json: unknown): CodeSampleCatalog | undefined;
|
|
15
|
+
sampleFor(endpoint: Endpoint): CodeSample | undefined;
|
|
16
|
+
endpoints(): Endpoint[];
|
|
17
|
+
}
|
|
18
|
+
export declare class CodeSampleCatalogs {
|
|
19
|
+
private readonly catalogs;
|
|
20
|
+
constructor(catalogs: CodeSampleCatalog[]);
|
|
21
|
+
isEmpty(): boolean;
|
|
22
|
+
samplesFor(endpoint: Endpoint): CodeSample[];
|
|
23
|
+
unplacedIn(documented: Endpoint[]): string[];
|
|
24
|
+
toJson(): CodeSamplesByEndpoint;
|
|
25
|
+
private endpoints;
|
|
26
|
+
}
|
|
27
|
+
export {};
|