@redocly/redoc 0.129.0-next.1 → 0.129.0-next.3
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/CHANGELOG.md +52 -0
- package/dist/bin.js +1 -1
- package/dist/cli/develop.d.ts +1 -1
- package/dist/cli/develop.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-file-extensions-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-frontmatter-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-markdoc-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-nested-configs-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-refs-usage.js +1 -1
- package/dist/cli/prepare/index.d.ts +1 -1
- package/dist/cli/translations/collect-config-translations.js +1 -1
- package/dist/cli/translations/update-translations.js +1 -1
- package/dist/client/TestProvider.js +1 -1
- package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
- package/dist/client/app/Sidebar/Sidebar.js +7 -2
- package/dist/client/app/Sidebar/useSidebarItems.d.ts +1 -0
- package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntities.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.d.ts +10 -0
- package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.js +1 -0
- package/dist/client/app/hooks/index.d.ts +1 -0
- package/dist/client/app/hooks/index.js +1 -1
- package/dist/client/app/hooks/useBanner.d.ts +4 -0
- package/dist/client/app/hooks/useBanner.js +1 -1
- package/dist/client/app/hooks/useLoginUrl.js +1 -1
- package/dist/client/app/pages/DevLogin/DevLogin.js +1 -1
- package/dist/client/app/pages/Login/Login.js +1 -1
- package/dist/client/app/utils/loadAndNavigate.js +1 -1
- package/dist/client/browser-entry.js +2 -2
- package/dist/client/providers/page-data/hooks.d.ts +2 -1
- package/dist/client/providers/page-data/hooks.js +1 -1
- package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
- package/dist/client/runtime/loader.js +1 -1
- package/dist/client/types/post-message.d.ts +2 -1
- package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
- package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
- package/dist/constants/common.d.ts +0 -4
- package/dist/constants/common.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/api-routes/execute-api-route.d.ts +0 -7
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/helpers/setup-logger.d.ts +2 -2
- package/dist/server/api-routes/helpers/setup-logger.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/fs/cache.d.ts +1 -2
- package/dist/server/fs/cache.js +1 -1
- package/dist/server/fs/content-fs.d.ts +9 -4
- package/dist/server/fs/content-fs.js +1 -1
- package/dist/server/fs/fs.d.ts +6 -6
- package/dist/server/fs/fs.js +1 -3
- package/dist/server/fs/load-error.d.ts +2 -2
- package/dist/server/fs/load-error.js +1 -1
- package/dist/server/fs/utils/async-storage.d.ts +0 -8
- package/dist/server/fs/utils/async-storage.js +1 -1
- package/dist/server/fs/utils/isVirtualFile.d.ts +1 -1
- package/dist/server/fs/utils/isVirtualFile.js +1 -1
- package/dist/server/persistence/kv/helpers/decode-cursor.d.ts +2 -0
- package/dist/server/persistence/kv/helpers/decode-cursor.js +1 -0
- package/dist/server/persistence/kv/helpers/encode-cursor.d.ts +2 -0
- package/dist/server/persistence/kv/helpers/encode-cursor.js +1 -0
- package/dist/server/persistence/kv/mappers/create-kv-list-entry.d.ts +5 -0
- package/dist/server/persistence/kv/mappers/create-kv-list-entry.js +1 -0
- package/dist/server/persistence/kv/mappers/create-kv-value.d.ts +4 -0
- package/dist/server/persistence/kv/mappers/create-kv-value.js +1 -0
- package/dist/server/persistence/kv/repositories/kv-remote-repository.d.ts +5 -5
- package/dist/server/persistence/kv/repositories/kv-remote-repository.js +1 -1
- package/dist/server/persistence/kv/schemas/kv-schemas.d.ts +10 -0
- package/dist/server/persistence/kv/schemas/kv-schemas.js +1 -0
- package/dist/server/persistence/kv/services/kv-service.d.ts +6 -6
- package/dist/server/persistence/kv/services/kv-service.js +1 -1
- package/dist/server/plugins/api-functions/index.js +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
- package/dist/server/plugins/arazzo-docs/index.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.d.ts +1 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.js +2 -2
- package/dist/server/plugins/asyncapi-docs/index.d.ts +1 -1
- package/dist/server/plugins/asyncapi-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +23 -18
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-entity.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.d.ts +9 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.d.ts +1 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-read-model.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-dto.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-file-schema.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/map-entity-relation-row.d.ts +12 -0
- package/dist/server/plugins/catalog-entities/database/mappers/map-entity-relation-row.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.d.ts +15 -4
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +67 -55
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +21 -15
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.d.ts +16 -3
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-relations-repository.d.ts +17 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-relations-repository.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/utils.d.ts +4 -4
- package/dist/server/plugins/catalog-entities/database/repositories/utils.js +1 -1
- package/dist/server/plugins/catalog-entities/entities/{extract-entities-content.d.ts → extract-file-content.d.ts} +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/get-server-props.d.ts +1 -2
- package/dist/server/plugins/catalog-entities/get-server-props.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/database-schemas.d.ts +64 -0
- package/dist/server/plugins/catalog-entities/schemas/database-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/dto-schemas.d.ts +6 -12
- package/dist/server/plugins/catalog-entities/schemas/dto-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.d.ts +4 -8
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/catalog-data-collector.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/read-string.d.ts +7 -0
- package/dist/server/plugins/catalog-entities/utils/read-string.js +1 -0
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/nearest-redocly-config-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/config-parser/loaders/yaml-parser.js +1 -1
- package/dist/server/plugins/default-theme/resolve-products-config.js +1 -1
- package/dist/server/plugins/ensure-frontmatter-theme-compatibility.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/graphql-docs/index.js +1 -1
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/dereference-json-schema-refs.d.ts +14 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/dereference-json-schema-refs.js +1 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/generate-sample-from-schema.d.ts +62 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/generate-sample-from-schema.js +2 -0
- package/dist/server/plugins/markdown/attribute-resolvers/index.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +4 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +4 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
- package/dist/server/plugins/markdown/compiler.js +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/attributes/index.d.ts +2 -0
- package/dist/server/plugins/markdown/markdoc/attributes/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/attributes/json-example-ref.d.ts +6 -0
- package/dist/server/plugins/markdown/markdoc/attributes/json-example-ref.js +1 -0
- package/dist/server/plugins/markdown/markdoc/attributes/sample-from-json-schema.d.ts +6 -0
- package/dist/server/plugins/markdown/markdoc/attributes/sample-from-json-schema.js +1 -0
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/index.d.ts +1 -0
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/json-example.d.ts +8 -0
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/json-example.js +7 -0
- package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
- package/dist/server/plugins/markdown/markdoc/resolve-raw-partials.js +1 -1
- package/dist/server/plugins/markdown/markdoc/tags/index.d.ts +4 -0
- package/dist/server/plugins/markdown/markdoc/tags/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +3 -0
- package/dist/server/plugins/markdown/markdoc/tags/json-example.js +1 -0
- package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.d.ts +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.d.ts +5 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.js +6 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/whoami.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +3 -3
- package/dist/server/plugins/mcp/docs-mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +10 -3
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +26 -2
- package/dist/server/plugins/mcp/utils.d.ts +9 -8
- package/dist/server/plugins/mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/workers/run-api-routes-worker.js +1 -1
- package/dist/server/plugins/nav-utils.js +1 -1
- package/dist/server/plugins/openapi-docs/decorators.d.ts +3 -2
- package/dist/server/plugins/openapi-docs/decorators.js +1 -1
- package/dist/server/plugins/openapi-docs/index.d.ts +2 -2
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/is-openapi-doc.js +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.d.ts +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.js +3 -3
- package/dist/server/plugins/pages/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/get-scorecard-config.d.ts +11 -0
- package/dist/server/plugins/scorecard-classic/loaders/scorecard.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +5 -5
- package/dist/server/plugins/sidebars/index.js +3 -3
- package/dist/server/plugins/utils.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.d.ts +25 -46
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.d.ts +20 -3
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.js +1 -1
- package/dist/server/providers/database/pagination/combined-filters.d.ts +4 -1
- package/dist/server/providers/database/pagination/combined-filters.js +1 -1
- package/dist/server/providers/database/pagination/filter.d.ts +1 -0
- package/dist/server/providers/database/pagination/filter.js +1 -1
- package/dist/server/providers/database/pagination/index.d.ts +4 -1
- package/dist/server/providers/database/pagination/utils/decode-cursor.js +1 -1
- package/dist/server/ssr/index.js +1 -1
- package/dist/server/ssr/render.js +1 -1
- package/dist/server/ssr/template.d.ts +1 -1
- package/dist/server/ssr/template.js +13 -13
- package/dist/server/ssr/utils.js +27 -13
- package/dist/server/store.js +1 -1
- package/dist/server/tools/notifiers/formatter.d.ts +2 -0
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/logger.d.ts +18 -39
- package/dist/server/tools/notifiers/logger.js +2 -6
- package/dist/server/tools/notifiers/reporter.js +9 -9
- package/dist/server/tools/notifiers/terminal-manager.d.ts +8 -0
- package/dist/server/tools/notifiers/terminal-manager.js +5 -0
- package/dist/server/types/fs.d.ts +5 -10
- package/dist/server/types/plugins/api-routes.d.ts +0 -3
- package/dist/server/types/plugins/common.d.ts +0 -1
- package/dist/server/utils/is-valid-iso-date.d.ts +5 -0
- package/dist/server/utils/is-valid-iso-date.js +1 -0
- package/dist/server/utils/lifecycle-hooks.js +1 -1
- package/dist/server/utils/queue.js +1 -1
- package/dist/server/utils/redirects/find-redirect.d.ts +4 -2
- package/dist/server/utils/redirects/find-redirect.js +1 -1
- package/dist/server/utils/resolve-asset-path.js +1 -1
- package/dist/server/utils/safe-parse.d.ts +6 -0
- package/dist/server/utils/safe-parse.js +1 -0
- package/dist/server/utils/validate-and-sanitize-string.d.ts +29 -0
- package/dist/server/utils/validate-and-sanitize-string.js +1 -0
- package/dist/server/web-server/auth.d.ts +5 -0
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/http.js +2 -2
- package/dist/server/web-server/middleware/loggerMiddleware.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/catalog/bff-catalog-related-entities.js +1 -1
- package/dist/server/web-server/routes/catalog/bff-catalog.js +1 -1
- package/dist/server/web-server/routes/catalog/catalog-relations.js +1 -1
- package/dist/server/web-server/routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/search.js +1 -1
- package/dist/server/web-server/utils/get-redirect-login-url.js +1 -1
- package/dist/types/ssr.d.ts +3 -1
- package/dist/utils/auth/build-login-url.d.ts +1 -3
- package/dist/utils/auth/build-login-url.js +1 -1
- package/dist/utils/env/is-local-development.d.ts +13 -0
- package/dist/utils/env/is-local-development.js +1 -0
- package/dist/utils/env/is-production.d.ts +13 -0
- package/dist/utils/env/is-production.js +1 -0
- package/dist/utils/env/is-web-view.d.ts +14 -0
- package/dist/utils/env/is-web-view.js +1 -0
- package/dist/utils/path/remove-fragment.d.ts +16 -0
- package/dist/utils/path/remove-fragment.js +1 -0
- package/package.json +12 -11
- package/dist/server/persistence/kv/mappers/create-kv-read-record.d.ts +0 -4
- package/dist/server/persistence/kv/mappers/create-kv-read-record.js +0 -1
- package/dist/server/web-server/routes/otel/types.d.ts +0 -61
- package/dist/server/web-server/routes/otel/types.js +0 -1
- /package/dist/server/plugins/catalog-entities/entities/{extract-entities-content.js → extract-file-content.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class a extends Error{constructor(o,{cause:r,
|
|
1
|
+
class a extends Error{constructor(o,{cause:r,loaderId:s}){super(`Error in "${s}" loader: ${o}`),this.name="LoadError",r instanceof Error&&(this.stack=`${r.stack}
|
|
2
2
|
Load stack:
|
|
3
3
|
${this.stack}
|
|
4
4
|
`)}}export{a as LoadError};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import type { AccessRecord } from '../../types';
|
|
3
3
|
export declare const trackAccessStore: AsyncLocalStorage<AccessRecord[]>;
|
|
4
|
-
export declare const touchedCacheRecordsStore: AsyncLocalStorage<Set<string>>;
|
|
5
|
-
export declare const fsChangesStore: AsyncLocalStorage<({
|
|
6
|
-
event: "add" | "change" | "unlink";
|
|
7
|
-
path: string;
|
|
8
|
-
} | {
|
|
9
|
-
event: "code-updated";
|
|
10
|
-
})[]>;
|
|
11
|
-
export declare const wasChangedCacheStore: AsyncLocalStorage<Map<string, boolean>>;
|
|
12
4
|
//# sourceMappingURL=async-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AsyncLocalStorage as
|
|
1
|
+
import{AsyncLocalStorage as o}from"node:async_hooks";const r=new o;export{r as trackAccessStore};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ContentFs } from '../content-fs';
|
|
2
|
-
export declare function isVirtualFile(relativePath: string, fs: ContentFs):
|
|
2
|
+
export declare function isVirtualFile(relativePath: string, fs: ContentFs): boolean | undefined;
|
|
3
3
|
//# sourceMappingURL=isVirtualFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function t(i,e){return e.getFileInfo(i)?.isVirtual}export{t as isVirtualFile};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(r){return Buffer.from(r,"base64url").toString()}export{e as decodeCursor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(r){return Buffer.from(r).toString("base64url")}export{e as encodeCursor};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { KvKey, KvListEntry, KvValue } from '@redocly/config';
|
|
2
|
+
import type { DatabaseKvDbSchema } from '../../../providers/database/databases/sqld-sqlite/schemas/kv-table.js';
|
|
3
|
+
export declare function createKvListEntry<T extends KvValue>(kvDbEntry: Pick<DatabaseKvDbSchema, 'encodedKey' | 'value'>): KvListEntry<T>;
|
|
4
|
+
export declare function decodeKvKey(encodedKey: string): KvKey;
|
|
5
|
+
//# sourceMappingURL=create-kv-list-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{KV_KEY_SEPARATOR as r}from"./create-kv-db-record.js";import{createKvValue as o}from"./create-kv-value.js";function u(e){const t=o(e);return{key:n(e.encodedKey),value:t}}function n(e){return e.split(r).map(String)}export{u as createKvListEntry,n as decodeKvKey};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { KvValue } from '@redocly/config';
|
|
2
|
+
import type { DatabaseKvDbSchema } from '../../../providers/database/databases/sqld-sqlite/schemas/kv-table.js';
|
|
3
|
+
export declare function createKvValue<T extends KvValue>(kvDbEntry: Pick<DatabaseKvDbSchema, 'encodedKey' | 'value'>): T | null;
|
|
4
|
+
//# sourceMappingURL=create-kv-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{safeParse as a}from"../../../utils/safe-parse.js";function n(r){const e=a(r.value);return"error"in e?null:e.value}export{n as createKvValue};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KvKey,
|
|
1
|
+
import type { KvKey, KvListEntry, KvSetOptions, KvValue, KvListSelector, KvListOptions, KvListResponse, KvTransaction } from '@redocly/config';
|
|
2
2
|
import type { DatabaseConnection, RepositoryInstanceOptions } from '../../../providers/database/types.js';
|
|
3
3
|
import { BaseRepository } from '../../../providers/database/base-repository.js';
|
|
4
4
|
export declare const KV_KEY_END_BOUNDARY = "\u0002";
|
|
@@ -6,11 +6,11 @@ export declare class KvRemoteRepository extends BaseRepository {
|
|
|
6
6
|
#private;
|
|
7
7
|
constructor(dbConnection: DatabaseConnection);
|
|
8
8
|
static getInstance(options: RepositoryInstanceOptions): Promise<KvRemoteRepository | null>;
|
|
9
|
-
get<T extends KvValue = KvValue>(key: KvKey): Promise<
|
|
10
|
-
getMany<T extends KvValue = KvValue>(keys: KvKey[]): Promise<(
|
|
9
|
+
get<T extends KvValue = KvValue>(key: KvKey): Promise<T | null>;
|
|
10
|
+
getMany<T extends KvValue = KvValue>(keys: KvKey[]): Promise<(KvListEntry<T> | null)[]>;
|
|
11
11
|
list<T extends KvValue = KvValue>(selector: KvListSelector, options?: KvListOptions): Promise<KvListResponse<T>>;
|
|
12
|
-
set<T extends KvValue = KvValue>(key: KvKey, value: T, options?: KvSetOptions): Promise<
|
|
13
|
-
delete(key: KvKey): Promise<
|
|
12
|
+
set<T extends KvValue = KvValue>(key: KvKey, value: T, options?: KvSetOptions): Promise<KvListEntry<T> | null>;
|
|
13
|
+
delete(key: KvKey): Promise<void>;
|
|
14
14
|
clearExpired(): Promise<void>;
|
|
15
15
|
transaction<T>(operation: (tx: KvTransaction) => Promise<T>): Promise<T>;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{eq as
|
|
1
|
+
import{eq as E,and as g,gte as m,gt as M,lt as f,asc as B,desc as D,or as K,isNull as C,sql as c,inArray as q,count as $}from"drizzle-orm";import{logger as l}from"../../../tools/notifiers/logger.js";import{kvTable as t}from"../../../providers/database/databases/sqld-sqlite/schemas/kv-table.js";import{BaseRepository as I}from"../../../providers/database/base-repository.js";import{DatabaseConnectionFactory as N}from"../../../providers/database/database-connection-factory.js";import{createKvValue as S}from"../mappers/create-kv-value.js";import{createKvDbRecord as Q,encodeKvKey as d}from"../mappers/create-kv-db-record.js";import{decodeCursor as U}from"../helpers/decode-cursor.js";import{encodeCursor as V}from"../helpers/encode-cursor.js";import{createKvListEntry as b}from"../mappers/create-kv-list-entry.js";const Y="";class u extends I{static#e;constructor(e){super(e)}static async getInstance(e){if(!u.#e)try{const r=await N.create("sqld-remote",e);if(!r)return u.#e=null,null;u.#e=new u(r)}catch(r){return l.error("Error creating kv remote repository",r),u.#e=null,null}return u.#e}async get(e){try{const r=d(e),n=await this.databaseClient.client.select().from(t).where(g(E(t.encodedKey,r),K(C(t.expiresAt),m(c`datetime(${t.expiresAt})`,c`datetime('now')`)))).get();return n?S(n):null}catch(r){return l.error("Error getting kv entry by key",r),null}}async getMany(e){try{if(e.length===0)return[];const r=e.map(i=>d(i)),n=K(C(t.expiresAt),m(c`datetime(${t.expiresAt})`,c`datetime('now')`)),s=await this.databaseClient.client.select().from(t).where(g(q(t.encodedKey,r),n)).all(),o=new Map(s.map(i=>[i.encodedKey,i]));return e.map((i,x)=>{const p=r[x],w=o.get(p);return w?b(w):null})}catch(r){return l.error("Error getting multiple kv entries",r),[]}}async list(e,r){try{const n=r?.limit??100,s=r?.reverse??!1,o=[],v=K(C(t.expiresAt),m(c`datetime(${t.expiresAt})`,c`datetime('now')`));if(o.push(v),"prefix"in e){const a=d(e.prefix),y="start"in e?d(e.start):a,k="end"in e?d(e.end):a+Y;o.push(m(t.encodedKey,y)),o.push(f(t.encodedKey,k))}else if("start"in e&&"end"in e){const a=d(e.start),y=d(e.end);o.push(m(t.encodedKey,a)),o.push(f(t.encodedKey,y))}if(r?.cursor){const a=U(r.cursor),y=s?f(t.encodedKey,a):M(t.encodedKey,a);o.push(y)}const i=this.databaseClient.client.select().from(t),x=o.length>0?i.where(g(...o)):i,p=this.databaseClient.client.select({count:$()}).from(t),A=(await(o.length>0?p.where(g(...o)):p).get())?.count??0,h=await x.orderBy(s?D(t.encodedKey):B(t.encodedKey)).limit(n).all();return{items:h.map(a=>b(a)),total:A,cursor:A>h.length?V(h[h.length-1]?.encodedKey):null}}catch(n){return l.error("Error listing kv entries",n),{items:[],total:0,cursor:null}}}async set(e,r,n){try{const s=Q({key:e,value:r,ttlInSeconds:n?.ttlInSeconds});return await this.databaseClient.client.insert(t).values(s).onConflictDoUpdate({target:[t.encodedKey],set:{value:s.value,expiresAt:s.expiresAt,updatedAt:s.updatedAt}}),b(s)}catch(s){return l.error("Error saving kv entry",s),null}}async delete(e){try{const r=d(e);await this.databaseClient.client.delete(t).where(E(t.encodedKey,r))}catch(r){l.error("Error deleting kv entry by key",r)}}async clearExpired(){try{await this.databaseClient.client.delete(t).where(f(c`datetime(${t.expiresAt})`,c`datetime('now')`))}catch(e){l.error("Error clearing expired kv entries",e)}}async transaction(e){return this.databaseClient.transactionsManager.transaction(async()=>e({get:async n=>this.get(n),getMany:async n=>this.getMany(n),set:async(n,s,o)=>this.set(n,s,o),delete:async n=>this.delete(n)}))}}export{Y as KV_KEY_END_BOUNDARY,u as KvRemoteRepository};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { KvKey, KvListOptions, KvListSelector, KvSetOptions } from '@redocly/config';
|
|
2
|
+
type Validator<T> = {
|
|
3
|
+
parse: (data: unknown) => T;
|
|
4
|
+
};
|
|
5
|
+
export declare const kvKeyValidator: Validator<KvKey>;
|
|
6
|
+
export declare const kvListOptionsValidator: Validator<KvListOptions>;
|
|
7
|
+
export declare const kvListSelectorValidator: Validator<KvListSelector>;
|
|
8
|
+
export declare const kvSetOptionsValidator: Validator<KvSetOptions>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=kv-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import s from"@redocly/ajv";const a=new s({coerceTypes:!1,removeAdditional:!0,strictSchema:!1,allowUnionTypes:!0,useDefaults:!0,allErrors:!0,strictTypes:!1}),n=t=>t?.map(e=>`${e.instancePath} ${e.message}`.trim())||["Validation failed"],r={title:"KV key",type:"array",items:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"}]},minItems:1},l={title:"KV list options",type:"object",properties:{limit:{type:"number",minimum:1,maximum:1e3},reverse:{type:"boolean"},cursor:{type:"string"}},additionalProperties:!1,required:[]},p={title:"KV list selector",type:"object",properties:{prefix:r,start:r,end:r},anyOf:[{required:["prefix"]},{required:["start","end"]}],additionalProperties:!1},c={title:"KV set arguments",type:"object",properties:{ttlInSeconds:{type:"number",minimum:1}},additionalProperties:!1,required:[]};function i(t){const e=a.compile(t);return{parse:o=>{if(!e(o))throw new Error(`Invalid ${t.title}: ${n(e.errors).join(", ")}`);return o}}}const u=i(r),y=i(l),f=i(p),v=i(c);export{u as kvKeyValidator,y as kvListOptionsValidator,f as kvListSelectorValidator,v as kvSetOptionsValidator};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { KvValue, KvKey, KvListEntry, KvSetOptions, KvListOptions, KvListResponse, KvListSelector, KvTransaction } from '@redocly/config';
|
|
1
2
|
import type { ServiceInstanceOptions } from '../../../providers/database/types.js';
|
|
2
|
-
import type { KvValue, KvKey, KvReadSchema, KvSetOptions, KvListOptions, KvListResponse, KvListSelector, KvTransaction } from '@redocly/config';
|
|
3
3
|
import { KvRemoteRepository } from '../repositories/kv-remote-repository.js';
|
|
4
4
|
export declare class KvService {
|
|
5
5
|
#private;
|
|
@@ -8,23 +8,23 @@ export declare class KvService {
|
|
|
8
8
|
/**
|
|
9
9
|
* Get a kv entry by key
|
|
10
10
|
*/
|
|
11
|
-
get<T extends KvValue = KvValue>(
|
|
11
|
+
get<T extends KvValue = KvValue>(rawKey: KvKey): Promise<T | null>;
|
|
12
12
|
/**
|
|
13
13
|
* Get multiple kv entries by keys
|
|
14
14
|
*/
|
|
15
|
-
getMany<T extends KvValue = KvValue>(
|
|
15
|
+
getMany<T extends KvValue = KvValue>(rawKeys: KvKey[]): Promise<(KvListEntry<T> | null)[]>;
|
|
16
16
|
/**
|
|
17
17
|
* List kv entries by prefix
|
|
18
18
|
*/
|
|
19
|
-
list<T extends KvValue = KvValue>(
|
|
19
|
+
list<T extends KvValue = KvValue>(rawSelector: KvListSelector, rawOptions?: KvListOptions): Promise<KvListResponse<T>>;
|
|
20
20
|
/**
|
|
21
21
|
* Set a kv entry with optional TTL
|
|
22
22
|
*/
|
|
23
|
-
set(
|
|
23
|
+
set<T extends KvValue = KvValue>(rawKey: KvKey, value: T, rawOptions?: KvSetOptions): Promise<KvListEntry<T> | null>;
|
|
24
24
|
/**
|
|
25
25
|
* Delete a specific kv entry by key
|
|
26
26
|
*/
|
|
27
|
-
delete(
|
|
27
|
+
delete(rawKey: KvKey): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Clear all expired kv entries
|
|
30
30
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{KvRemoteRepository as l}from"../repositories/kv-remote-repository.js";import{kvKeyValidator as a,kvListOptionsValidator as h,kvListSelectorValidator as u,kvSetOptionsValidator as c}from"../schemas/kv-schemas.js";class i{static#s;#t;constructor(t){this.#t=t}static async#r(t){const s=await l.getInstance(t),n=new i(s);i.#s=n}static async getInstance(t){return i.#s||await i.#r(t),i.#s}async get(t){const s=a.parse(t);return await this.#t?.sync(),await this.#t?.get(s)??null}async getMany(t){if(t.length===0)return[];const s=t.map(n=>a.parse(n));return await this.#t?.sync(),await this.#t?.getMany(s)??[]}async list(t,s){const n=u.parse(t),e=h.parse(s??{});return await this.#t?.sync(),await this.#t?.list(n,e)??{items:[],total:0,cursor:null}}async set(t,s,n){const e=a.parse(t),r=c.parse(n??{});return this.#e(s),this.#n(s),await this.#t?.set(e,s,r)??null}async delete(t){const s=a.parse(t);return this.#t?.delete(s)}async clearExpired(){return await this.#t?.clearExpired()}async transaction(t){if(!this.#t)throw new Error("Remote repository not available for transactions");return await this.#t.sync(),this.#t.transaction(async s=>t({get:async e=>{const r=a.parse(e);return s.get(r)},getMany:async e=>{const r=e.map(o=>a.parse(o));return s.getMany(r)},set:async(e,r,o)=>{const y=a.parse(e),p=c.parse(o);return this.#e(r),this.#n(r),s.set(y,r,p)},delete:async e=>{const r=a.parse(e);return s.delete(r)}}))}#e(t){try{JSON.stringify(t)}catch(s){const n=s instanceof Error?s.message:"Unknown error";throw new Error(`Value is not JSON serializable: ${n}`)}}#n(t){const n=JSON.stringify(t),e=Buffer.byteLength(n,"utf8");if(e>1048576){const r=(e/1024).toFixed(2);throw new Error(`Value size (${r} KB) exceeds the maximum allowed size of 1 MB (1024 KB)`)}}}export{i as KvService};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as f}from"path";import{REDOCLY_ROUTE_RBAC as c}from"@redocly/config";import{removeTrailingSlash as d}from"../../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as m}from"../../../utils/url/remove-leading-slash.js";import{USER_DEFINED_API_FUNCTIONS_COUNTER_KEY as h}from"../../../server/store.js";import{parseRouteFsPathForHono as g}from"./helpers/parse-route-fs-path-for-hono.js";import{telemetryTraceStep as F}from"../../../cli/telemetry/helpers/trace-step.js";const R="api-functions";async function S(){return{id:"ApiFunctions",requiredEntitlements:["apiFunctions"],async processContent(n,i){await F("build.plugin.api_functions",async r=>{const s=await i.getConfig(),a=(s.apiFunctions?.folders||[]).map(e=>`^${m(d(e))}`);r?.setAttribute("config",JSON.stringify(s.apiFunctions||{})),a.push(".*@api");const l=new RegExp(`(${a.join("|")})/.*.(ts|js)$`);let o=0;for(const e of
|
|
1
|
+
import{join as f}from"path";import{REDOCLY_ROUTE_RBAC as c}from"@redocly/config";import{removeTrailingSlash as d}from"../../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as m}from"../../../utils/url/remove-leading-slash.js";import{USER_DEFINED_API_FUNCTIONS_COUNTER_KEY as h}from"../../../server/store.js";import{parseRouteFsPathForHono as g}from"./helpers/parse-route-fs-path-for-hono.js";import{telemetryTraceStep as F}from"../../../cli/telemetry/helpers/trace-step.js";const R="api-functions";async function S(){return{id:"ApiFunctions",requiredEntitlements:["apiFunctions"],async processContent(n,i){await F("build.plugin.api_functions",async r=>{const s=await i.getConfig(),a=(s.apiFunctions?.folders||[]).map(e=>`^${m(d(e))}`);r?.setAttribute("config",JSON.stringify(s.apiFunctions||{})),a.push(".*@api");const l=new RegExp(`(${a.join("|")})/.*.(ts|js)$`);let o=0;for(const e of i.fs.scan(l)){if(e.isVirtual)continue;const t=g(e.relativePath);if(!t)continue;const u=`${R}:${t.handler}`,p=f(n.contentDir,t.handler);n.createRequestHandler(u,p),n.addApiRoute({requestHandlerId:u,slug:t.path,fsPath:e.relativePath,httpMethod:t.method,[c]:{fsPath:e.relativePath,slug:t.path}}),o++}r?.setAttribute("definedApiFunctions",String(o)),n.setGlobalConfig({[h]:o})})}}}export{R as API_FUNCTIONS_REQUEST_HANDLER_ID,S as apiFunctionsPlugin};
|
|
@@ -14,7 +14,7 @@ export type BundledDefinition = {
|
|
|
14
14
|
markdocChunks: MarkdocChunk[];
|
|
15
15
|
realRelativePath: string;
|
|
16
16
|
relativePath: string;
|
|
17
|
-
isVirtual
|
|
17
|
+
isVirtual: boolean;
|
|
18
18
|
hash: string;
|
|
19
19
|
};
|
|
20
20
|
export declare function arazzoDocLoader(relativePath: string, { fs, logger, cache, getConfig, isPathIgnored }: LifecycleContext): Promise<Omit<BundledDefinition, 'hash'>[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../openapi-docs/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],
|
|
1
|
+
import s from"node:path";import{bundle as R,createConfig as I,getTotals as B}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as J}from"../../../constants/common.js";import{deepMerge as L}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as M}from"../get-api-config.js";import{injectDecoratorIntoConfig as W}from"../openapi-docs/decorators.js";import{ExternalResolver as _}from"../../fs/utils/external-ref-resolver.js";async function Y(o,{fs:n,logger:d,cache:u,getConfig:l,isPathIgnored:f}){let i;try{i=(await u.load(o,"yaml")).data}catch{return[]}if(!i?.arazzo)return d.verbose(`${o} file is not Arazzo document. Skipping`),[];const p=[],r=n.getFileInfo(o),t=await l(s.posix.dirname(o)),x=M(t?.apis,o,t.configPath),D=await f(o);for(const c of x){if(!c.output&&D)continue;const k=t.configPath?s.posix.dirname(t.configPath):".",a=c.output?s.posix.join(k,c.output):o;r&&c.output&&!await n.exists(a)&&n.addVirtualFile(a,r);const m=L(t,{rbac:void 0},c),v=s.resolve(n.cwd,t.realConfigPath||J),w=new _(n),O=await I(W(m,a,n.cwd),{configPath:v,externalRefResolver:w}),h=s.resolve(n.cwd,o),g={config:O,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(i))}},{bundle:{parsed:N},problems:z,visitorsData:P}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:S}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(i))}}),V=P["markdown/markdown"]?.markdocChunks??[],e=B(z);let b=[e.errors&&`${e.errors} ${$(e.errors,"error","errors")}`,e.warnings&&`${e.warnings} ${$(e.warnings,"warning","warnings")}`,e.ignored&&`${e.ignored} ignored`].filter(Boolean).join(", ");if(e.errors){const C=z.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${a} definition.
|
|
2
2
|
|
|
3
3
|
${C?.message} at ${C?.location?.[0]?.pointer}
|
|
4
4
|
|
|
5
|
-
`)}
|
|
5
|
+
`)}e.warnings&&d.warn(`${b} while bundling %rp definition`,a);const j=y(N,t.metadata),A=y(S,t.metadata),E={document:j,documentWithReferences:A,config:m,relativePath:a,realRelativePath:r?.realRelativePath||a,customOutputRelativeFile:c.output&&a,markdocChunks:V,isVirtual:r?.isVirtual??!1};p.push(E)}return p}async function Z(o,n){const{fs:d,cache:u,getConfig:l}=n,f=[];for(const i of await d.scan(/(\.ya?ml|\.json)$/)){if(!await l(s.posix.dirname(i.relativePath)))continue;let r;try{r=await u.load(i.relativePath,"arazzo-doc")}catch{continue}r.data?.length&&f.push(...r.data.map(t=>({...t,isVirtual:i.isVirtual||t.isVirtual,hash:r.compoundHash})))}return f}function y(o,n){return n?{...o,info:{...o.info,...n}}:o}export{Y as arazzoDocLoader,Z as arazzoDocsLoader};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LifecyclePluginInstance, PluginOptions } from '../../types';
|
|
2
|
-
export declare function arazzoDocsPlugin(
|
|
2
|
+
export declare function arazzoDocsPlugin(_pluginOptions: PluginOptions): Promise<LifecyclePluginInstance>;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{simplifyAstStructure as h}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{storeDefinitionBundles as p}from"./store-definition-bundles.js";import{arazzoDocLoader as y,arazzoDocsLoader as P}from"./arazzo-doc-loader.js";import{telemetryTraceStep as k}from"../../../cli/telemetry/helpers/trace-step.js";const u="arazzo-docs-";async function $(w){let l=[];return{id:"arazzo",loaders:{"arazzo-doc":y,"arazzo-docs":P},processContent:async(e,o)=>{await k("build.plugin.arazzo_docs",async()=>{for(const t of await o.fs.scan(/(\.ya?ml|\.json)$/))if(!await o.isPathIgnored(t.relativePath))try{const{data:a,compoundHash:i}=await o.cache.load(t.realRelativePath,"arazzo-doc");if(!a?.length)continue;l=a.map(({markdocChunks:r,relativePath:c,isVirtual:n,customOutputRelativeFile:s,realRelativePath:d})=>({chunks:r,relativePath:c,realRelativePath:d,isVirtual:s!=null||t.isVirtual||n})),p(a,e.outdir,i);for(const r of a){const c=`${u}${r.relativePath}`;await e.createSharedData(c,{document:r.document})}}catch(a){console.error(a)}})},afterRoutesCreated:async(e,o)=>{for(const{chunks:t,relativePath:a,isVirtual:i,realRelativePath:r}of l)await o.cache.load(a,{loader:async function(){await o.cache.load(r,"arazzo-doc");for(const{node:n,markdown:s,pointer:d,key:z,relativePath:m}of t){const{ast:f}=await e.parseMarkdoc({content:s,relativePath:d,isVirtual:i},o,{sharedDataIds:[`${u}${m}`]});n[`x-parsed-md-${z}`]={result:h(f)}}},name:"arazzo-markdoc-inline-parser"})}}}export{$ as arazzoDocsPlugin};
|
|
@@ -10,7 +10,7 @@ export type BundledDefinition = {
|
|
|
10
10
|
markdocChunks: MarkdocChunk[];
|
|
11
11
|
realRelativePath: string;
|
|
12
12
|
relativePath: string;
|
|
13
|
-
isVirtual
|
|
13
|
+
isVirtual: boolean;
|
|
14
14
|
hash: string;
|
|
15
15
|
};
|
|
16
16
|
export declare function asyncapiDocLoader(relativePath: string, { fs, logger, cache, getConfig, isPathIgnored }: LifecycleContext): Promise<Omit<BundledDefinition, 'hash'>[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import s from"node:path";import{bundle as R,createConfig as B,getTotals as J}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as L}from"../../../constants/common.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as W}from"../get-api-config.js";import{injectDecoratorIntoConfig as _}from"../openapi-docs/decorators.js";import{ExternalResolver as T}from"../../fs/utils/external-ref-resolver.js";async function Z(n,{fs:o,logger:f,cache:u,getConfig:p,isPathIgnored:d}){let a;try{a=(await u.load(n,"yaml")).data}catch{return[]}if(!a?.asyncapi)return f.verbose(`${n} file is not AsyncAPI document. Skipping`),[];const l=[],e=
|
|
1
|
+
import s from"node:path";import{bundle as R,createConfig as B,getTotals as J}from"@redocly/openapi-core";import{CONFIG_FILE_NAME as L}from"../../../constants/common.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{pluralize as $}from"../../../utils/string/pluralize.js";import{getAllApiConfigsByPath as W}from"../get-api-config.js";import{injectDecoratorIntoConfig as _}from"../openapi-docs/decorators.js";import{ExternalResolver as T}from"../../fs/utils/external-ref-resolver.js";async function Z(n,{fs:o,logger:f,cache:u,getConfig:p,isPathIgnored:d}){let a;try{a=(await u.load(n,"yaml")).data}catch{return[]}if(!a?.asyncapi)return f.verbose(`${n} file is not AsyncAPI document. Skipping`),[];const l=[],e=o.getFileInfo(n),t=await p(s.posix.dirname(n)),A=W(t?.apis,n,t.configPath),D=await d(n);for(const c of A){if(!c.output&&D)continue;const O=t.configPath?s.posix.dirname(t.configPath):".",r=c.output?s.posix.join(O,c.output):n;if(await d(r))continue;e&&c.output&&!await o.exists(r)&&o.addVirtualFile(r,e);const m=M(t,{rbac:void 0},c),k=s.resolve(o.cwd,t.realConfigPath||L),w=new T(o),v=await B(_(m,r,o.cwd),{configPath:k,externalRefResolver:w}),h=s.resolve(o.cwd,n),g={config:v,base:s.dirname(h),doc:{source:{absoluteRef:h},parsed:JSON.parse(JSON.stringify(a))}},{bundle:{parsed:I},problems:y,visitorsData:N}=await R({...g,dereference:!0,externalRefResolver:w}),{bundle:{parsed:P}}=await R({...g,doc:{...g.doc,parsed:JSON.parse(JSON.stringify(a))}}),S=N["markdown/markdown"]?.markdocChunks??[],i=J(y);let b=[i.errors&&`${i.errors} ${$(i.errors,"error","errors")}`,i.warnings&&`${i.warnings} ${$(i.warnings,"warning","warnings")}`,i.ignored&&`${i.ignored} ignored`].filter(Boolean).join(", ");if(i.errors){const C=y.find(F=>F.severity==="error");throw new Error(`${b} while bundling ${r} definition.
|
|
2
2
|
|
|
3
3
|
${C?.message} at ${C?.location?.[0].pointer}
|
|
4
4
|
|
|
5
|
-
`)}i.warnings&&f.warn(`${b} while bundling %rp definition`,r);const V=x(I,t.metadata),j=x(P,t.metadata),E={document:V,documentWithReferences:j,config:m,relativePath:r,realRelativePath:e?.realRelativePath||r,customOutputRelativeFile:c.output&&r,markdocChunks:S,isVirtual:e?.isVirtual};l.push(E)}return l}async function nn(n,o){const{fs:f,cache:u,getConfig:p}=o,d=[];for(const a of await f.scan(/(\.ya?ml|\.json)$/)){if(!await p(s.posix.dirname(a.relativePath)))continue;let e;try{e=await u.load(a.relativePath,"asyncapi-doc")}catch{continue}e.data?.length&&d.push(...e.data.map(t=>({...t,isVirtual:a.isVirtual||t.isVirtual,hash:e.compoundHash})))}return d}function x(n,o){return o?{...n,info:{...n.info,"x-metadata":{...n.info["x-metadata"],...o}}}:n}export{Z as asyncapiDocLoader,nn as asyncapiDocsLoader};
|
|
5
|
+
`)}i.warnings&&f.warn(`${b} while bundling %rp definition`,r);const V=x(I,t.metadata),j=x(P,t.metadata),E={document:V,documentWithReferences:j,config:m,relativePath:r,realRelativePath:e?.realRelativePath||r,customOutputRelativeFile:c.output&&r,markdocChunks:S,isVirtual:e?.isVirtual??!1};l.push(E)}return l}async function nn(n,o){const{fs:f,cache:u,getConfig:p}=o,d=[];for(const a of await f.scan(/(\.ya?ml|\.json)$/)){if(!await p(s.posix.dirname(a.relativePath)))continue;let e;try{e=await u.load(a.relativePath,"asyncapi-doc")}catch{continue}e.data?.length&&d.push(...e.data.map(t=>({...t,isVirtual:a.isVirtual||t.isVirtual,hash:e.compoundHash})))}return d}function x(n,o){return o?{...n,info:{...n.info,"x-metadata":{...n.info["x-metadata"],...o}}}:n}export{Z as asyncapiDocLoader,nn as asyncapiDocsLoader};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { LifecyclePluginInstance, PluginOptions } from '../../types';
|
|
2
|
-
export declare function asyncAPIDocsPlugin(
|
|
2
|
+
export declare function asyncAPIDocsPlugin(_pluginOptions: PluginOptions): Promise<LifecyclePluginInstance>;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import g from"path";import{simplifyAstStructure as E}from"@redocly/openapi-docs/lib/utils/simplifyAstStructure.js";import{buildMenuItems as $}from"@redocly/asyncapi-docs/lib/utils/build-menu-items.js";import{findFirstBinding as T}from"@redocly/asyncapi-docs/lib/utils/find-first-binding.js";import{ASYNC_API_DOCS_TEMPLATE_ID as v}from"../../../constants/common.js";import{combineUrls as A}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as b}from"../../constants/common.js";import{logger as x}from"../../tools/notifiers/logger.js";import{getTemplatePath as _}from"./get-template-path.js";import{storeDefinitionBundles as O}from"./store-definition-bundles.js";import{asyncapiDocLoader as F,asyncapiDocsLoader as N}from"./asyncapi-doc-loader.js";import{searchResolver as j}from"./search/search-resolver.js";import{getAiDocumentsStore as L}from"./search/get-ai-search-documents.js";import{telemetryTraceStep as G}from"../../../cli/telemetry/helpers/trace-step.js";const R="asyncapi-docs-";async function tt(l){let d=[],p=new Set;return{id:"asyncapi",requiredEntitlements:["asyncapi"],loaders:{"asyncapi-doc":F,"asyncapi-docs":N},processContent:async(e,a)=>{await G("build.plugin.asyncapi_docs",async()=>{if((await a.getConfig()).plugins?.some(n=>n.startsWith("@redocly/portal-plugin-async-api/"))){x.warn("The plugin '@redocly/portal-plugin-async-api' is deprecated. Please remove it from your config to use built-in AsyncAPI docs.");return}const s=e.createTemplate(v,_("./template/AsyncApiDocs.js")),S=e.registerServerPropsGetter(v,_("./get-server-props.js"));for(const n of await a.fs.scan(/(\.ya?ml|\.json)$/))if(!await a.isPathIgnored(n.relativePath))try{const{data:r,compoundHash:w}=await a.cache.load(n.realRelativePath,"asyncapi-doc");if(!r?.length)continue;d=r.map(({markdocChunks:t,relativePath:c,isVirtual:u,customOutputRelativeFile:m,realRelativePath:y})=>({chunks:t,relativePath:c,realRelativePath:y,isVirtual:m!=null||n.isVirtual||u})),O(r,e.outdir,w);for(const t of r){const c=`${R}${t.relativePath}`,u=T(t.document),{navItems:m,apiItems:y}=$({asyncApiDoc:t.document,protocol:u||""}),I=[{url:A(b,`${C(t.relativePath,".json")}?download`)},{url:A(b,`${C(t.relativePath,".yaml")}?download`)}];await e.createSharedData(c,{document:t.document,apiItems:y,protocol:u,downloadUrls:I}),m.forEach(i=>{const f={fsPath:t.relativePath,slugSuffix:`/${i.link}`,templateId:s,sharedData:[{key:"AsyncApiDefinition",id:c}],getStaticData:D(a.withPathPrefix,i.label),serverPropsGetterIds:[S]};e.addRoute(f),i.items&&i.items.forEach(o=>{e.addRoute({...f,slugSuffix:`/${o.link}`,getStaticData:D(a.withPathPrefix,o.label)}),o.items&&o.items.forEach(h=>{e.addRoute({...f,slugSuffix:`/${h.link}`,getStaticData:D(a.withPathPrefix,o.label)})})})}),e.addRoute({fsPath:t.customOutputRelativeFile||t.relativePath,templateId:s,hasClientRoutes:!0,getSidebar:i=>{const f=o=>{const h={...o};return o.link&&(h.routeSlug=A(i.slug,o.link),h.link=A(i.slug,o.link)),o.items&&(h.items=o.items.map(f)),h};return[{type:"link",label:t.document.info?.title??"AsyncAPI Overview",routeSlug:i.slug,link:i.slug},...m.map(f)]},getSearchDocuments:j(e,t.document),getStaticData:D(a.withPathPrefix,t.document.info?.title??"AsyncAPI Docs"),getAiDocumentsStore:L({actions:e,document:t.document,metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}}}),metadata:{type:"asyncapi",title:t.document.info?.title??"AsyncAPI Docs",description:t.document.info?.description??"",...t.document.info?.["x-metadata"]??{}},sharedData:[{key:"AsyncApiDefinition",id:c}]})}}catch(r){console.error(r)}})},afterRoutesCreated:async(e,a)=>{const P=new Set;for(const{chunks:s,relativePath:S,isVirtual:n,realRelativePath:r}of d){const w=(await a.cache.load(r,"asyncapi-doc")).compoundHash;await a.cache.load(S,{loader:async function(){for(const{node:c,markdown:u,pointer:m,key:y,relativePath:I}of s){const{ast:i}=await e.parseMarkdoc({content:u,relativePath:m,isVirtual:n},a,{sharedDataIds:[`${R}${I}`]});c[`x-parsed-md-${y}`]={result:E(i)}}},name:"asyncapi-markdoc-inline-parser"},[w]);for(const{pointer:t}of s)P.add(t)}const k=p.difference(P);for(const s of k)a.cache.delete(s);p=P}}}function D(l,d){return async function(p,e){return{props:{settings:{baseUrlPath:l(p.baseSlug)},disableAutoScroll:!0,seo:{title:d}}}}}function C(l,d){const p=g.posix.dirname(l),e=g.posix.basename(l,g.posix.extname(l))+d;return g.posix.join(p,e)}export{tt as asyncAPIDocsPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import f from"node:path";import{CONFIG_FILE_NAME as n}from"../../../constants/common.js";const o=async(a,r)=>{if(!a.match(/(\.ya?ml|\.json)$/)||f.posix.basename(a)===n||await r.isPathIgnored(a))return!1;const s=
|
|
1
|
+
import f from"node:path";import{CONFIG_FILE_NAME as n}from"../../../constants/common.js";const o=async(a,r)=>{if(!a.match(/(\.ya?ml|\.json)$/)||f.posix.basename(a)===n||await r.isPathIgnored(a))return!1;const s=r.fs.getFileInfo(a);if(!s)return!1;try{const{data:e}=await r.cache.load(s.realRelativePath,"yaml");return!!e?.asyncapi}catch{return!1}};export{o as isAsyncapiDoc};
|
|
@@ -27,6 +27,7 @@ export declare class CatalogEntitiesService {
|
|
|
27
27
|
transaction<T>(...args: Parameters<TransactionsManager['transaction']>): Promise<T>;
|
|
28
28
|
getEntities(paginationParams: PaginationParams): Promise<ListResponseResult<EntityReadModelSchema>>;
|
|
29
29
|
getEntityByKey(key: string): Promise<EntityReadModelSchema | null>;
|
|
30
|
+
getEntityKeysAndVersionsBySourceFile(sourceFile: string): Promise<Set<string>>;
|
|
30
31
|
getEntitiesCountByTypes(): Promise<{
|
|
31
32
|
type: string;
|
|
32
33
|
count: number;
|
|
@@ -34,12 +35,12 @@ export declare class CatalogEntitiesService {
|
|
|
34
35
|
getCatalogFilters(params: CatalogFiltersParams): Promise<Record<string, import("./repositories/local/catalog-entities-local-read-repository.js").FilterOption[]>>;
|
|
35
36
|
createEntity(entity: EntityDtoSchema): Promise<EntityReadModelSchema | null>;
|
|
36
37
|
createEntities(entities: EntityDtoSchema[]): Promise<BulkSyncResult<EntityReadModelSchema>>;
|
|
37
|
-
getEntitySources(): Record<string,
|
|
38
|
+
getEntitySources(): Record<string, import("@redocly/theme").SidebarConnectedEntity>;
|
|
38
39
|
/**
|
|
39
40
|
* Use only internally, everything that is created via API should be created in the remote database.
|
|
40
41
|
* @param entity - The entity to create.
|
|
41
42
|
*/
|
|
42
|
-
createEntityInLocalDatabase(createEntityParams: CreateEntityParams): Promise<
|
|
43
|
+
createEntityInLocalDatabase(createEntityParams: CreateEntityParams): Promise<import("./repositories/local/catalog-entities-local-write-repository.js").CreateEntityResult>;
|
|
43
44
|
/**
|
|
44
45
|
* Use only internally, everything that is created via API should be created in the remote database.
|
|
45
46
|
* @param entities - The entities to create.
|
|
@@ -78,24 +79,21 @@ export declare class CatalogEntitiesService {
|
|
|
78
79
|
projectId: string;
|
|
79
80
|
sourceKey: string;
|
|
80
81
|
targetKey: string;
|
|
81
|
-
sourceId: string;
|
|
82
|
-
targetId: string;
|
|
83
82
|
}>>;
|
|
84
83
|
createEntityRelation(relation: EntityRelationDtoSchema): Promise<{
|
|
85
84
|
id: string;
|
|
86
85
|
organizationId: string;
|
|
87
86
|
projectId: string;
|
|
88
87
|
sourceFile: string | null;
|
|
88
|
+
isDeleted: boolean | null;
|
|
89
89
|
createdAt: string;
|
|
90
90
|
updatedAt: string;
|
|
91
91
|
sourceKey: string;
|
|
92
92
|
targetKey: string;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
targetVersion: string | null;
|
|
98
|
-
targetRevision: string | null;
|
|
93
|
+
sourceVersion: string;
|
|
94
|
+
sourceRevision: string;
|
|
95
|
+
targetVersion: string;
|
|
96
|
+
targetRevision: string;
|
|
99
97
|
fileHash: string | null;
|
|
100
98
|
sourceToTargetRelation: string;
|
|
101
99
|
targetToSourceRelation: string;
|
|
@@ -106,16 +104,15 @@ export declare class CatalogEntitiesService {
|
|
|
106
104
|
organizationId: string;
|
|
107
105
|
projectId: string;
|
|
108
106
|
sourceFile: string | null;
|
|
107
|
+
isDeleted: boolean | null;
|
|
109
108
|
createdAt: string;
|
|
110
109
|
updatedAt: string;
|
|
111
110
|
sourceKey: string;
|
|
112
111
|
targetKey: string;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
targetVersion: string | null;
|
|
118
|
-
targetRevision: string | null;
|
|
112
|
+
sourceVersion: string;
|
|
113
|
+
sourceRevision: string;
|
|
114
|
+
targetVersion: string;
|
|
115
|
+
targetRevision: string;
|
|
119
116
|
fileHash: string | null;
|
|
120
117
|
sourceToTargetRelation: string;
|
|
121
118
|
targetToSourceRelation: string;
|
|
@@ -127,9 +124,17 @@ export declare class CatalogEntitiesService {
|
|
|
127
124
|
*/
|
|
128
125
|
deleteEntityRelationsInLocalDatabase(filter: Filter): Promise<void>;
|
|
129
126
|
getEntitiesWithRelations(paginationParams?: PaginationParams): Promise<BffCatalogEntityList>;
|
|
130
|
-
getEntityWithRelationsByKey(entityKey: string,
|
|
127
|
+
getEntityWithRelationsByKey(entityKey: string, filter?: {
|
|
128
|
+
revision?: string | null;
|
|
129
|
+
version?: string | null;
|
|
130
|
+
}): Promise<BffCatalogEntity | null>;
|
|
131
131
|
getRelatedEntities(entityKey: string, paginationParams?: PaginationParams): Promise<BffCatalogRelatedEntityList>;
|
|
132
|
-
|
|
132
|
+
softDeleteEntitiesInLocalDatabase({ filter, revision, fileHash, }: {
|
|
133
|
+
filter: Filter;
|
|
134
|
+
revision: string;
|
|
135
|
+
fileHash: string;
|
|
136
|
+
}): Promise<void>;
|
|
137
|
+
listEntityRevisions(entityKey: string, version?: string | null): Promise<import("../schemas/read-model-schemas.js").EntityRevisionSummary[]>;
|
|
133
138
|
updateEntityScorecardsStatus(entityId: string, status: ScorecardsStatus): Promise<boolean>;
|
|
134
139
|
updateEntityScorecardsStatusIfCalculating(entityId: string, status: Extract<ScorecardsStatus, 'UP_TO_DATE' | 'OUTDATED'>): Promise<boolean>;
|
|
135
140
|
getOutdatedEntity(): Promise<EntityReadModelSchema | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{entityFileSchema as d}from"@redocly/config";import{deepMerge as y}from"../../../../utils/object/deep-merge.js";import{promiseMapLimit as c}from"../../../utils/async/promise-map-limit.js";import{logger as r}from"../../../tools/notifiers/logger.js";import{entityRelationDtoSchema as h}from"../schemas/dto-schemas.js";import{CatalogEntitiesLocalRepository as m}from"./repositories/local/catalog-entities-local-repository.js";import{CatalogEntitiesRemoteRepository as R}from"./repositories/remote/catalog-entities-remote-repository.js";import{prepareListResponse as o}from"../../../web-server/utils/prepare-list-response.js";import{ENTITY_RELATION_FROM_DATABASE as l}from"./mappers/field-transformations.js";import{createValidator as u}from"../utils/ajv-validator.js";import{hasOptionsChanged as w}from"../utils/has-options-changed.js";const E=15,f=u(h,{errorPrefix:"Entity relation validation failed:",dataVar:"entity relation"}),p=u(d,{errorPrefix:"Entity file validation failed:",dataVar:"entity"});class n{static#a;static#i;#t;#e;constructor(t,e){this.#t=t,this.#e=e}static async#n(t){const[e,a]=await Promise.all([m.getInstance(t),t.runOnlyLocalDatabase?null:R.getInstance(t)]),i=new n(e,a);a&&(process.env.NODE_ENV==="development"&&r.info("Attaching remote database to local database"),await i.#t.attachDatabase(a.path)),n.#a=i,n.#i=t}static async getInstance(t){return t.runOnlyLocalDatabase===void 0&&(t.runOnlyLocalDatabase=process.env.REDOCLY_LOCAL_DEV==="true"||process.env.CI==="true"),t.removeExisting===void 0&&(t.removeExisting=!1),(!n.#a||w(n.#i,t))&&await n.#n(t),n.#a}async transaction(...t){return this.#t.transactionsManager.transaction(...t)}async getEntities(t){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntities(t);return o({data:e,params:t,totalCount:a,hasMore:i})}async getEntityByKey(t){return await this.#e?.sync(),await this.#t.getEntityByKey(t)}async getEntitiesCountByTypes(){return await this.#e?.sync(),this.#t.getEntitiesCountByTypes()}async getCatalogFilters(t){return await this.#e?.sync(),this.#t.getCatalogFilters(t)}async createEntity(t){return this.#e?this.#e.createEntity(t):(r.warn("No remote database found"),null)}async createEntities(t){const e=this.#e;return e?await c(t,E,async a=>e.createEntity(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.key,status:"error",error:i}))):(r.warn("No remote database found"),[])}getEntitySources(){return this.#t.getEntitySources()}async createEntityInLocalDatabase(t){
|
|
1
|
+
import{entityFileSchema as d}from"@redocly/config";import{deepMerge as y}from"../../../../utils/object/deep-merge.js";import{promiseMapLimit as c}from"../../../utils/async/promise-map-limit.js";import{logger as r}from"../../../tools/notifiers/logger.js";import{entityRelationDtoSchema as h}from"../schemas/dto-schemas.js";import{CatalogEntitiesLocalRepository as m}from"./repositories/local/catalog-entities-local-repository.js";import{CatalogEntitiesRemoteRepository as R}from"./repositories/remote/catalog-entities-remote-repository.js";import{prepareListResponse as o}from"../../../web-server/utils/prepare-list-response.js";import{ENTITY_RELATION_FROM_DATABASE as l}from"./mappers/field-transformations.js";import{createValidator as u}from"../utils/ajv-validator.js";import{hasOptionsChanged as w}from"../utils/has-options-changed.js";const E=15,f=u(h,{errorPrefix:"Entity relation validation failed:",dataVar:"entity relation"}),p=u(d,{errorPrefix:"Entity file validation failed:",dataVar:"entity"});class n{static#a;static#i;#t;#e;constructor(t,e){this.#t=t,this.#e=e}static async#n(t){const[e,a]=await Promise.all([m.getInstance(t),t.runOnlyLocalDatabase?null:R.getInstance(t)]),i=new n(e,a);a&&(process.env.NODE_ENV==="development"&&r.info("Attaching remote database to local database"),await i.#t.attachDatabase(a.path)),n.#a=i,n.#i=t}static async getInstance(t){return t.runOnlyLocalDatabase===void 0&&(t.runOnlyLocalDatabase=process.env.REDOCLY_LOCAL_DEV==="true"||process.env.CI==="true"),t.removeExisting===void 0&&(t.removeExisting=!1),(!n.#a||w(n.#i,t))&&await n.#n(t),n.#a}async transaction(...t){return this.#t.transactionsManager.transaction(...t)}async getEntities(t){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntities(t);return o({data:e,params:t,totalCount:a,hasMore:i})}async getEntityByKey(t){return await this.#e?.sync(),await this.#t.getEntityByKey(t)}async getEntityKeysAndVersionsBySourceFile(t){return await this.#e?.sync(),this.#t.getEntityKeysAndVersionsBySourceFile(t)}async getEntitiesCountByTypes(){return await this.#e?.sync(),this.#t.getEntitiesCountByTypes()}async getCatalogFilters(t){return await this.#e?.sync(),this.#t.getCatalogFilters(t)}async createEntity(t){return this.#e?this.#e.createEntity(t):(r.warn("No remote database found"),null)}async createEntities(t){const e=this.#e;return e?await c(t,E,async a=>e.createEntity(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.key,status:"error",error:i}))):(r.warn("No remote database found"),[])}getEntitySources(){return this.#t.getEntitySources()}async createEntityInLocalDatabase(t){return this.#t.createEntity(t)}async createEntitiesInLocalDatabase(t){await this.#t.createEntities(t)}async createEntityRelationInLocalDatabase(t){await this.#t.createEntityRelation(t)}async createEntityRelationsInLocalDatabase(t){await this.#t.createEntityRelations(t)}async updateEntityByKey(t,e){const a=await this.#t.getEntityByKey(t);if(!a)throw new Error(`Entity with key ${t} not found`);const i=y(a,e),s=p(i);return await this.#e?.updateEntity({...s,id:a.id,createdAt:a.createdAt||""})}async deleteEntityByKey(t){const e=await this.#e?.deleteEntity(t);return await this.#s(t),e}async deleteEntitiesInLocalDatabase(t){await this.#t.deleteEntities(t)}async getEntityRelationById(t){return await this.#e?.sync(),await this.#t.getEntityRelationById(t)}async getEntitiesRelations(t={}){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntitiesRelations(t);return o({data:e,params:t,totalCount:a,nameTransformationsFromDatabase:l,hasMore:i})}async createEntityRelation(t){return this.#e?.createEntityRelation(t)}async createEntitiesRelations(t){const e=this.#e;return e?await c(t,E,async a=>e.createEntityRelation(a).then(i=>({status:"ok",resource:i})).catch(i=>({key:a.sourceKey,status:"error",error:i}))):(r.warn("No remote database found"),[])}async updateEntityRelation(t,e){const a=await this.#t.getEntityRelationById(t);if(!a)throw new Error(`Entity relation with id ${t} not found`);const i=y(a,e),s=f(i);return this.#e?.createEntityRelation(s)}async deleteEntityRelation(t){let e=await this.#e?.deleteEntityRelation(t);return e||(e=await this.#t.deleteEntityRelation(t)),e}async deleteEntityRelationsInLocalDatabase(t){await this.#t.deleteEntityRelations(t)}async getEntitiesWithRelations(t={}){await this.#e?.sync();const{items:e,total:a,hasMore:i}=await this.#t.getEntitiesWithRelations(t);return o({data:e,params:t,totalCount:a,hasMore:i})}async getEntityWithRelationsByKey(t,e){return this.#t.getEntityWithRelationsByKey(t,e)}async getRelatedEntities(t,e={}){await this.#e?.sync();const{items:a,total:i,hasMore:s}=await this.#t.getRelatedEntities(t,e);return o({data:a,params:e,totalCount:i,nameTransformationsFromDatabase:l,hasMore:s})}async#s(t){await this.#e?.deleteEntitiesRelations({op:"OR",conditions:[{field:"source_key",operator:"equal",value:t},{field:"target_key",operator:"equal",value:t}]})}async softDeleteEntitiesInLocalDatabase({filter:t,revision:e,fileHash:a}){await this.#t.softDeleteEntities({filter:t,revision:e,fileHash:a})}async listEntityRevisions(t,e){return await this.#e?.sync(),this.#t.listEntityRevisions(t,e)}async updateEntityScorecardsStatus(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatus(t,e)}async updateEntityScorecardsStatusIfCalculating(t,e){return await this.#e?.sync(),this.#t.updateEntityScorecardsStatusIfCalculating(t,e)}async getOutdatedEntity(){return await this.#e?.sync(),this.#t.getOneOutdatedEntity()}}export{n as CatalogEntitiesService};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as o}from"../../../../tools/notifiers/logger.js";import{entityDatabaseSchema as s}from"../../schemas/database-schemas.js";import{validateWithResult as l}from"../../utils/ajv-validator.js";import{createBffRelatedEntities as
|
|
1
|
+
import{logger as o}from"../../../../tools/notifiers/logger.js";import{entityDatabaseSchema as s}from"../../schemas/database-schemas.js";import{validateWithResult as l}from"../../utils/ajv-validator.js";import{createBffRelatedEntities as n}from"./create-bff-related-entities.js";function m(t){const{domains:r,owners:i}=t,a=l(s,t);if(!a.success)return o.warn(`Invalid database catalog entity for entity ${t.key}, error: ${a.error}`),null;const e=a.data||{};return{id:e.id,organizationId:e.organization_id,projectId:e.project_id,type:e.type,key:e.key,title:e.title,summary:e.summary??void 0,tags:e.tags?JSON.parse(e.tags):null,metadata:e.metadata?JSON.parse(e.metadata):null,git:e.git?JSON.parse(e.git):null,contact:e.contact?JSON.parse(e.contact):null,links:e.links?JSON.parse(e.links):null,source:e.source,sourceFile:e.source_file??void 0,createdAt:e.created_at,updatedAt:e.updated_at,version:e.version??void 0,revision:e.revision,isCurrent:e.is_current!==null?!!e.is_current:null,isDefaultVersion:e.is_default_version!==null?!!e.is_default_version:null,isDeleted:e.is_deleted!==null?!!e.is_deleted:null,object:"catalogEntityView",domains:n(r),owners:n(i)}}export{m as createBffEntity};
|
package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { BffCatalogRelatedEntity } from '@redocly/theme/core/types';
|
|
2
2
|
import type { Row } from '@libsql/client';
|
|
3
|
+
/**
|
|
4
|
+
* Creates BffCatalogRelatedEntity from validated schema data (e.g., from JSON fields in database).
|
|
5
|
+
* This is used when the data has already been validated against relatedEntityDatabaseSchema.
|
|
6
|
+
*/
|
|
3
7
|
export declare function createBffRelatedEntity(relationRow: Row): BffCatalogRelatedEntity | null;
|
|
8
|
+
/**
|
|
9
|
+
* Creates BffCatalogRelatedEntity from raw query results (e.g., from SQL joins).
|
|
10
|
+
* This handles raw database rows with snake_case field names and computes relationRole/relationType.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createBffRelatedEntityFromQueryRow(row: Record<string, unknown>): BffCatalogRelatedEntity | null;
|
|
4
13
|
//# sourceMappingURL=create-bff-related-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as
|
|
1
|
+
import{logger as i}from"../../../../tools/notifiers/logger.js";import{relatedEntityDatabaseSchema as y,relatedEntityQueryRowDatabaseSchema as s}from"../../schemas/database-schemas.js";import{validateWithResult as u}from"../../utils/ajv-validator.js";import{readString as t}from"../../utils/read-string.js";function o(e){return!e.id||!e.type||!e.key||!e.title?(i.warn(`Invalid database bff catalog related entity: missing required fields (id: ${e.id}, type: ${e.type}, key: ${e.key}, title: ${e.title})`),null):{id:e.id,type:e.type,key:e.key,title:e.title,summary:e.summary,source:e.source,sourceFile:e.sourceFile,relationRole:e.relationRole,relationType:e.relationType,createdAt:e.createdAt,updatedAt:e.updatedAt,metadata:e.metadata,version:e.version,...e.revision!==null&&{revision:e.revision}}}function l(e){if(e){if(typeof e=="string")try{return e?JSON.parse(e):void 0}catch{return}if(typeof e=="object"&&e!==null)return e}}function p(e){return typeof e=="string"||e===null||typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}function m(e){const a=t(e.source_to_target_relation)??t(e.target_to_source_relation)??t(e.relationType)??t(e.relation_type)??t(e.relationName)??t(e.relation_name)??"";return{id:t(e.id)??"",type:t(e.type)??"",key:t(e.key)??"",title:t(e.title)??"",summary:t(e.summary,!0)??null,source:t(e.source)??"",source_file:t(e.source_file,!0)??t(e.sourceFile,!0)??null,direction:t(e.direction)??"",relation_field:a,created_at:t(e.created_at,!0)??null,updated_at:t(e.updated_at,!0)??null,metadata:p(e.metadata),version:t(e.version,!0)??null,revision:t(e.revision,!0)??null}}function k(e){const a=u(y,e);if(!a.success)return i.warn(`Invalid database bff catalog related entity, error: ${a.error}`),null;const r=a.data||{};return o({id:r.id,type:r.type,key:r.key,title:r.title,summary:r.summary||null,source:r.source,sourceFile:r.source_file||null,relationRole:r.relation_role||"source",relationType:r.relation_type||"",createdAt:r.created_at||null,updatedAt:r.updated_at||null,metadata:l(r.metadata),version:r.version||null,revision:null})}function R(e){const a=m(e),r=u(s,a);if(!r.success)return i.warn(`Invalid database bff catalog related entity query row (key: ${a.key||"unknown"}), error: ${r.error}`),null;const n=r.data||{},c=n.direction==="outgoing"?"source":"target",d=n.relation_field.replace("reverse:","");return o({id:n.id,type:n.type,key:n.key,title:n.title,summary:n.summary??null,source:n.source,sourceFile:n.source_file??null,relationRole:c,relationType:d,createdAt:n.created_at??null,updatedAt:n.updated_at??null,metadata:l(n.metadata),version:n.version??null,revision:n.revision??null})}export{k as createBffRelatedEntity,R as createBffRelatedEntityFromQueryRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ulid as
|
|
1
|
+
import{ulid as u}from"ulid";import{VERSION_NOT_SPECIFIED as c}from"@redocly/theme/core/constants";function n({entity:s,organizationId:a,projectId:l,source:e,sourceFile:i,fileHash:o}){const r=new Date().toISOString();return{id:s.id||`ce_${u()}`,organizationId:a,projectId:l,key:s.key,type:s.type,title:s.title,summary:s.summary||null,tags:s.tags?JSON.stringify(s.tags):null,metadata:s.metadata?JSON.stringify(s.metadata):null,git:s.git?JSON.stringify(s.git):null,contact:s.contact?JSON.stringify(s.contact):null,links:s.links?JSON.stringify(s.links):null,createdAt:s.createdAt||r,updatedAt:r,source:e||"file",sourceFile:i||null,fileHash:o||null,version:s.version??c,revision:s.revision??"",hash:s.hash,isCurrent:s.isCurrent,isDefaultVersion:s.isDefaultVersion??!1,isDeleted:s.isDeleted??!1,scorecardsStatus:"OUTDATED"}}export{n as createEntityDbRecord};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as
|
|
1
|
+
import{logger as l}from"../../../../tools/notifiers/logger.js";import{entityDatabaseSchema as r}from"../../schemas/database-schemas.js";import{validateWithResult as t}from"../../utils/ajv-validator.js";const o=a=>"project_id"in a&&"organization_id"in a&&"created_at"in a;function d(a){if(o(a)){const s=t(r,a);if(!s.success)return l.warn(`Invalid database catalog entity for entity ${a.key}, error: ${s.error}`),null;const e=s.data||{};return{id:e.id,type:e.type,key:e.key||"",title:e.title||"",summary:e.summary||null,tags:e.tags?JSON.parse(e.tags):null,metadata:e.metadata?JSON.parse(e.metadata):null,git:e.git?JSON.parse(e.git):null,contact:e.contact?JSON.parse(e.contact):null,links:e.links?JSON.parse(e.links):null,source:e.source||"file",sourceFile:e.source_file||null,version:e.version||null,revision:e.revision??"",hash:e.hash||null,isCurrent:e.is_current,isDefaultVersion:e.is_default_version??!1,createdAt:e.created_at||null,updatedAt:e.updated_at||null,isDeleted:e.is_deleted??!1,object:"catalogEntity"}}return{...a,tags:a.tags?JSON.parse(a.tags):null,metadata:a.metadata?JSON.parse(a.metadata):null,git:a.git?JSON.parse(a.git):null,contact:a.contact?JSON.parse(a.contact):null,links:a.links?JSON.parse(a.links):null,source:a.source||"file",version:a.version||null,revision:a.revision??"",hash:a.hash||null,isCurrent:a.isCurrent,isDefaultVersion:a.isDefaultVersion??!1,isDeleted:a.isDeleted??!1,object:"catalogEntity"}}export{d as createEntityReadModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ulid as
|
|
1
|
+
import{ulid as o}from"ulid";function i(e,r,s){const t=new Date().toISOString();return{id:e.id||`cer_${o()}`,organizationId:r,projectId:s,sourceKey:e.sourceKey,sourceVersion:e.sourceVersion??"",sourceRevision:e.sourceRevision??"",sourceToTargetRelation:e.type,targetKey:e.targetKey,targetVersion:e.targetVersion??"",targetRevision:e.targetRevision??"",targetToSourceRelation:`reverse:${e.type}`,sourceFile:e.sourceFile||null,fileHash:e.fileHash||null,isDeleted:e.isDeleted??!1,createdAt:e.createdAt||t,updatedAt:t}}export{i as createEntityRelationDbRecordFromDto};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ulid as
|
|
1
|
+
import{ulid as v}from"ulid";function g({relation:e,sourceFile:o,fileHash:n,sourceKey:s,sourceVersion:t,sourceRevision:r,organizationId:c,projectId:d}){const i=new Date().toISOString();return{id:`cer_${v()}`,organizationId:c,projectId:d,sourceKey:s,sourceVersion:t&&e.version?t:"",sourceRevision:r&&e.revision?r:"",sourceToTargetRelation:e.type,targetKey:e.key,targetVersion:t&&e.version?e.version:"",targetRevision:r&&e.revision?e.revision:"",targetToSourceRelation:`reverse:${e.type}`,sourceFile:o,fileHash:n,isDeleted:!1,createdAt:i,updatedAt:i}}export{g as createEntityRelationDbRecordFromFileSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as o}from"../../../../tools/notifiers/logger.js";import{entityRelationDatabaseSchema as a}from"../../schemas/database-schemas.js";import{validateWithResult as i}from"../../utils/ajv-validator.js";function c(r){const e=i(a,r);if(!e.success)return o.warn(`Invalid database catalog entity relation, error: ${e.error}`),null;const t=e.data||{};return{id:t.id,organizationId:t.organization_id,projectId:t.project_id,sourceKey:t.source_key,targetKey:t.target_key,
|
|
1
|
+
import{logger as o}from"../../../../tools/notifiers/logger.js";import{entityRelationDatabaseSchema as a}from"../../schemas/database-schemas.js";import{validateWithResult as i}from"../../utils/ajv-validator.js";function c(r){const e=i(a,r);if(!e.success)return o.warn(`Invalid database catalog entity relation, error: ${e.error}`),null;const t=e.data||{};return{id:t.id,organizationId:t.organization_id,projectId:t.project_id,sourceKey:t.source_key,targetKey:t.target_key,sourceVersion:t.source_version??null,sourceRevision:t.source_revision??null,targetVersion:t.target_version??null,targetRevision:t.target_revision??null,type:t.source_to_target_relation,createdAt:t.created_at??null,updatedAt:t.updated_at??null,object:"catalogEntityRelation"}}export{c as createEntityRelation};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a database row to a normalized relation structure.
|
|
3
|
+
* Handles field name variations (snake_case vs camelCase) from query results.
|
|
4
|
+
*/
|
|
5
|
+
export declare function mapEntityRelationRow(row: Record<string, unknown>): {
|
|
6
|
+
targetKey: string;
|
|
7
|
+
targetRevision: string;
|
|
8
|
+
sourceToTargetRelation: string;
|
|
9
|
+
direction: 'outgoing' | 'incoming';
|
|
10
|
+
priority: number;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=map-entity-relation-row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readString as e}from"../../utils/read-string.js";function s(t,n=0){return typeof t=="number"?t:n}function g(t){const n=e(t.target_key)??e(t.entityKey)??e(t.entity_key)??"",o=e(t.target_revision)??e(t.entityRevision)??e(t.entity_revision)??"",i=e(t.source_to_target_relation)??e(t.relationName)??e(t.relation_name)??"",r=e(t.direction)??"outgoing",a=s(t.priority,0),c=r==="incoming"?`reverse:${i}`:i;return{targetKey:n,targetRevision:o,sourceToTargetRelation:c,direction:r,priority:a}}export{g as mapEntityRelationRow};
|