@redocly/realm 0.137.0-next.9 → 0.138.0-next.0

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.
Files changed (207) hide show
  1. package/CHANGELOG.md +248 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/build/index.js +1 -1
  4. package/dist/cli/eject/themeOperations.js +1 -1
  5. package/dist/cli/generate/generate-tag.js +1 -1
  6. package/dist/cli/generate/generate.js +1 -1
  7. package/dist/client/app/Sidebar/useActions.js +1 -1
  8. package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
  9. package/dist/client/app/hooks/catalog/useCatalog.d.ts +1 -2
  10. package/dist/client/app/hooks/catalog/useCatalogClassic.js +1 -1
  11. package/dist/client/app/hooks/catalog/useCatalogFilter.js +1 -1
  12. package/dist/client/app/l10n/hooks/useL10n.js +1 -1
  13. package/dist/client/app/l10n/index.js +1 -1
  14. package/dist/client/app/search/sse-parser.d.ts +5 -2
  15. package/dist/client/app/search/sse-parser.js +2 -2
  16. package/dist/client/app/search/useFacets.js +1 -1
  17. package/dist/client/app/seo/SeoTags.js +1 -1
  18. package/dist/client/app/utils/loadAndNavigate.js +1 -1
  19. package/dist/client/constants/ai-search.d.ts +8 -0
  20. package/dist/client/constants/ai-search.js +1 -1
  21. package/dist/constants/l10n/langs/ar.js +1 -1
  22. package/dist/constants/l10n/langs/de.js +1 -1
  23. package/dist/constants/l10n/langs/en.js +1 -1
  24. package/dist/constants/l10n/langs/es.js +1 -1
  25. package/dist/constants/l10n/langs/fr.js +1 -1
  26. package/dist/constants/l10n/langs/hi.js +1 -1
  27. package/dist/constants/l10n/langs/it.js +1 -1
  28. package/dist/constants/l10n/langs/ja.js +1 -1
  29. package/dist/constants/l10n/langs/ko.js +1 -1
  30. package/dist/constants/l10n/langs/pl.js +1 -1
  31. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  32. package/dist/constants/l10n/langs/pt.js +1 -1
  33. package/dist/constants/l10n/langs/ru.js +1 -1
  34. package/dist/constants/l10n/langs/uk.js +1 -1
  35. package/dist/constants/l10n/langs/zh.js +1 -1
  36. package/dist/markdoc/helpers/guards/is-example-node.d.ts +2 -1
  37. package/dist/markdoc/helpers/guards/is-example-node.js +1 -1
  38. package/dist/markdoc/nodes/fence/index.js +1 -1
  39. package/dist/server/config/env-config.d.ts +2 -0
  40. package/dist/server/config/env-schema.d.ts +5 -0
  41. package/dist/server/config/env-schemas/feature-flags.d.ts +4 -0
  42. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  43. package/dist/server/constants/entitlements.d.ts +1 -2
  44. package/dist/server/constants/plugins/search.js +1 -1
  45. package/dist/server/esbuild/esbuild-logger.d.ts +2 -2
  46. package/dist/server/esbuild/esbuild-logger.js +3 -3
  47. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  48. package/dist/server/esbuild/plugins/themes-resolver.js +2 -2
  49. package/dist/server/fs/cache.js +1 -1
  50. package/dist/server/fs/fs.js +1 -1
  51. package/dist/server/fs/utils/remove-l10n-prefix.js +1 -1
  52. package/dist/server/persistence/file-hashes/repositories/file-hashes-repository.d.ts +1 -2
  53. package/dist/server/persistence/file-hashes/services/file-hashes-service.d.ts +1 -2
  54. package/dist/server/plugins/analytics/rudderstack/browser-hooks.js +1 -1
  55. package/dist/server/plugins/analytics/segment/browser-hooks.js +1 -1
  56. package/dist/server/plugins/analytics/segment/build-script.js +3 -3
  57. package/dist/server/plugins/api-docs/loader.d.ts +2 -3
  58. package/dist/server/plugins/api-docs/options.d.ts +1 -1
  59. package/dist/server/plugins/api-docs/options.js +1 -1
  60. package/dist/server/plugins/api-docs/search/create-indexer.d.ts +5 -0
  61. package/dist/server/plugins/api-docs/search/create-indexer.js +1 -0
  62. package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +2 -2
  63. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +41 -41
  64. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -1
  65. package/dist/server/plugins/api-docs/utils/decorators.js +1 -1
  66. package/dist/server/plugins/api-functions/index.js +1 -1
  67. package/dist/server/plugins/catalog-entities/database/repositories/common/revision-repository.js +1 -1
  68. package/dist/server/plugins/catalog-entities/database/repositories/common/version-repository.js +1 -1
  69. package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-write-repository.js +1 -1
  70. package/dist/server/plugins/catalog-entities/database/repositories/utils/normalize-revision-flags.js +1 -1
  71. package/dist/server/plugins/catalog-entities/types/extractors.d.ts +1 -2
  72. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.d.ts +1 -2
  73. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.d.ts +1 -2
  74. package/dist/server/plugins/config-parser/format-error.js +4 -4
  75. package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
  76. package/dist/server/plugins/config-parser/loaders/versions-config-loader.js +1 -1
  77. package/dist/server/plugins/dev-onboarding/template/components/EditAppDescriptionDialog.js +1 -1
  78. package/dist/server/plugins/dev-onboarding/template/components/EditAppDialog.js +1 -1
  79. package/dist/server/plugins/dev-onboarding/template/components/EditCallbackUrlDialog.js +1 -1
  80. package/dist/server/plugins/l10n/index.js +1 -1
  81. package/dist/server/plugins/lifecycle.js +2 -2
  82. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  83. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  84. package/dist/server/plugins/markdown/compiler.js +1 -1
  85. package/dist/server/plugins/markdown/errors.js +1 -1
  86. package/dist/server/plugins/markdown/is-partial.js +1 -1
  87. package/dist/server/plugins/markdown/markdoc/reparse-example-fences.d.ts +7 -0
  88. package/dist/server/plugins/markdown/markdoc/reparse-example-fences.js +1 -0
  89. package/dist/server/plugins/markdown/markdoc/resolve-raw-partials.js +1 -1
  90. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  91. package/dist/server/plugins/markdown/search/to-markdown.js +20 -20
  92. package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +5 -4
  93. package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +5 -2
  94. package/dist/server/plugins/mcp/codemode/capabilities/utils.js +4 -4
  95. package/dist/server/plugins/mcp/codemode/code-execution-audit.js +1 -1
  96. package/dist/server/plugins/mcp/codemode/code-execution-telemetry.d.ts +7 -2
  97. package/dist/server/plugins/mcp/codemode/code-execution-telemetry.js +1 -1
  98. package/dist/server/plugins/mcp/codemode/invoke-tool.js +1 -1
  99. package/dist/server/plugins/mcp/codemode/prompts.d.ts +1 -1
  100. package/dist/server/plugins/mcp/codemode/prompts.js +7 -6
  101. package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.d.ts +2 -2
  102. package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.js +1 -11
  103. package/dist/server/plugins/mcp/codemode/sandbox/polyfills/console.d.ts +2 -0
  104. package/dist/server/plugins/mcp/codemode/sandbox/polyfills/console.js +7 -0
  105. package/dist/server/plugins/mcp/codemode/sandbox/polyfills/index.d.ts +1 -0
  106. package/dist/server/plugins/mcp/codemode/sandbox/polyfills/index.js +2 -2
  107. package/dist/server/plugins/mcp/codemode/sandbox/tool-input-validator.d.ts +5 -0
  108. package/dist/server/plugins/mcp/codemode/sandbox/tool-input-validator.js +1 -0
  109. package/dist/server/plugins/mcp/codemode/sandbox/unknown-tool-hint.d.ts +12 -0
  110. package/dist/server/plugins/mcp/codemode/sandbox/unknown-tool-hint.js +2 -0
  111. package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +3 -1
  112. package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -1
  113. package/dist/server/plugins/mcp/codemode/tools/manage-credentials.d.ts +2 -2
  114. package/dist/server/plugins/mcp/codemode/tools/manage-credentials.js +2 -2
  115. package/dist/server/plugins/mcp/codemode/tools/tool-errors.d.ts +4 -0
  116. package/dist/server/plugins/mcp/codemode/tools/tool-errors.js +1 -1
  117. package/dist/server/plugins/mcp/constants.d.ts +1 -0
  118. package/dist/server/plugins/mcp/constants.js +1 -1
  119. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
  120. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  121. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -1
  122. package/dist/server/plugins/mcp/docs-mcp/tools/core/search.js +2 -2
  123. package/dist/server/plugins/mcp/docs-mcp/tools/core/submit-feedback.d.ts +7 -0
  124. package/dist/server/plugins/mcp/docs-mcp/tools/core/submit-feedback.js +3 -0
  125. package/dist/server/plugins/mcp/docs-mcp/tools/core/types.d.ts +8 -2
  126. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +5 -5
  127. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +2 -1
  128. package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +1 -0
  129. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  130. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoint-info.js +1 -1
  131. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-endpoints.js +1 -1
  132. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-full-api-description.js +1 -1
  133. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/get-security-schemes.js +1 -1
  134. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
  135. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +17 -3
  136. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.js +1 -1
  137. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/types.d.ts +6 -2
  138. package/dist/server/plugins/mcp/docs-mcp/utils/api-name-matching.d.ts +6 -1
  139. package/dist/server/plugins/mcp/docs-mcp/utils/api-name-matching.js +1 -1
  140. package/dist/server/plugins/mcp/docs-mcp/utils/api-titles.d.ts +14 -0
  141. package/dist/server/plugins/mcp/docs-mcp/utils/api-titles.js +1 -0
  142. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +11 -0
  143. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +5 -5
  144. package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -1
  145. package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.d.ts +5 -0
  146. package/dist/server/plugins/mcp/gateway-mcp/fetch/url-placeholders.js +1 -0
  147. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  148. package/dist/server/plugins/mcp/index.js +1 -1
  149. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  150. package/dist/server/plugins/mcp/servers/mcp-server.js +3 -3
  151. package/dist/server/plugins/mcp/types.d.ts +1 -0
  152. package/dist/server/plugins/mcp/utils/available-sandbox-tools.js +1 -1
  153. package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
  154. package/dist/server/plugins/nav-utils.js +1 -1
  155. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -1
  156. package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
  157. package/dist/server/plugins/search/engines/flexsearch/search-index.d.ts +8 -4
  158. package/dist/server/plugins/search/engines/flexsearch/search-index.js +1 -1
  159. package/dist/server/plugins/search/llmstxt/create-llms-txt-generator.js +1 -1
  160. package/dist/server/plugins/search/llmstxt/index.d.ts +3 -1
  161. package/dist/server/plugins/search/llmstxt/index.js +9 -9
  162. package/dist/server/plugins/search/llmstxt/is-included-in-llms-txt.d.ts +1 -2
  163. package/dist/server/sandbox/constants/host-functions.d.ts +3 -0
  164. package/dist/server/sandbox/constants/host-functions.js +1 -1
  165. package/dist/server/sandbox/constants/sandbox.d.ts +10 -0
  166. package/dist/server/sandbox/constants/sandbox.js +1 -1
  167. package/dist/server/sandbox/sandbox.js +3 -3
  168. package/dist/server/sandbox/types.d.ts +12 -0
  169. package/dist/server/sandbox/utils/execution-budget.js +1 -1
  170. package/dist/server/sandbox/utils/read-result.d.ts +8 -0
  171. package/dist/server/sandbox/utils/read-result.js +1 -0
  172. package/dist/server/sandbox/utils/return-last-expression.d.ts +6 -0
  173. package/dist/server/sandbox/utils/return-last-expression.js +1 -0
  174. package/dist/server/sandbox/utils/returns-from-top-level.d.ts +1 -2
  175. package/dist/server/sandbox/utils/returns-from-top-level.js +1 -1
  176. package/dist/server/sandbox/utils/setup-host-functions.d.ts +1 -0
  177. package/dist/server/sandbox/utils/setup-host-functions.js +3 -3
  178. package/dist/server/ssr/index.js +1 -1
  179. package/dist/server/ssr/render.js +1 -1
  180. package/dist/server/store.d.ts +1 -1
  181. package/dist/server/store.js +1 -1
  182. package/dist/server/tools/notifiers/helpers/privacy/remove-pii.js +1 -1
  183. package/dist/server/types/plugins/common.d.ts +1 -2
  184. package/dist/server/types/plugins/search.d.ts +7 -2
  185. package/dist/server/utils/globs.d.ts +4 -0
  186. package/dist/server/utils/globs.js +1 -1
  187. package/dist/server/utils/rbac.js +1 -1
  188. package/dist/server/utils/search/highlight-text-for-search.js +1 -1
  189. package/dist/server/web-server/middleware/ensureSearchData.js +1 -1
  190. package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +1 -1
  191. package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.js +1 -1
  192. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  193. package/dist/server/web-server/routes/feedback.d.ts +3 -1
  194. package/dist/server/web-server/routes/feedback.js +1 -1
  195. package/dist/server/web-server/routes/mcp-routes/mcp-oauth.js +1 -1
  196. package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -1
  197. package/dist/server/web-server/routes/otel/otel.js +1 -1
  198. package/dist/server/web-server/utils/legacy-openapi-redirects.js +1 -1
  199. package/dist/types/global-data.d.ts +1 -2
  200. package/dist/utils/slugger.js +1 -1
  201. package/dist/utils/url/sanitize-redirect-pathname.js +1 -1
  202. package/dist/{server/plugins/catalog-entities/utils/version-compare.d.ts → utils/version/compare-versions.d.ts} +1 -16
  203. package/dist/utils/version/compare-versions.js +1 -0
  204. package/package.json +11 -10
  205. package/dist/server/plugins/api-docs/search/search-indexer.d.ts +0 -9
  206. package/dist/server/plugins/api-docs/search/search-indexer.js +0 -1
  207. package/dist/server/plugins/catalog-entities/utils/version-compare.js +0 -1
@@ -59,6 +59,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
59
59
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
60
60
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
61
61
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
62
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
62
63
  } & {
63
64
  SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
64
65
  SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
@@ -139,6 +140,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
139
140
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
140
141
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
141
142
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
143
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
142
144
  SEARCH_DEV_REINIT?: string | undefined;
143
145
  SEARCH_DEV_DEBUG: boolean;
144
146
  REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
@@ -212,6 +214,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
212
214
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
213
215
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
214
216
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
217
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
215
218
  SEARCH_DEV_REINIT?: string | undefined;
216
219
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
217
220
  REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
@@ -285,6 +288,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
285
288
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
286
289
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
287
290
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
291
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
288
292
  SEARCH_DEV_REINIT?: string | undefined;
289
293
  SEARCH_DEV_DEBUG: boolean;
290
294
  REDOCLY_SKIP_TYPESENSE_INDEXING: boolean;
@@ -358,6 +362,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
358
362
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
359
363
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
360
364
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
365
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
361
366
  SEARCH_DEV_REINIT?: string | undefined;
362
367
  SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
363
368
  REDOCLY_SKIP_TYPESENSE_INDEXING?: "false" | "true" | undefined;
@@ -21,6 +21,8 @@ export declare const featureFlagsSchema: z.ZodObject<{
21
21
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
22
22
  /** Experimental: register custom MCP tools from `@mcp` folders. */
23
23
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
24
+ /** Experimental: enables the GraphQL request body in Try It and embedded Replay. */
25
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
24
26
  }, "strip", z.ZodTypeAny, {
25
27
  NEW_CATALOG_ENABLED?: boolean | undefined;
26
28
  NEW_SCORECARDS_ENABLED?: boolean | undefined;
@@ -34,6 +36,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
34
36
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: boolean | undefined;
35
37
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: boolean | undefined;
36
38
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: boolean | undefined;
39
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: boolean | undefined;
37
40
  }, {
38
41
  NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
39
42
  NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
@@ -47,5 +50,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
47
50
  REDOCLY_DISABLE_API_FUNCTION_SANDBOX?: "false" | "true" | undefined;
48
51
  REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE?: "false" | "true" | undefined;
49
52
  REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED?: "false" | "true" | undefined;
53
+ REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED?: "false" | "true" | undefined;
50
54
  }>;
51
55
  //# sourceMappingURL=feature-flags.d.ts.map
@@ -1 +1 @@
1
- import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const N=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_DISABLE_API_FUNCTION_SANDBOX:E(),REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE:E(),REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED:E()});export{N as featureFlagsSchema};
1
+ import{z as _}from"zod";import{envBooleanStringOptional as E}from"../../utils/envs/env-boolean-string.js";const D=_.object({NEW_CATALOG_ENABLED:E(),NEW_SCORECARDS_ENABLED:E(),ENABLE_COMMENTS:_.string().optional(),REDOCLY_EXP_DISABLE_MD_VALIDATION:E(),ENABLE_SOURCE_MAPS:E(),PLAN_GATES:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_ENABLED:E(),REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL:_.string().optional(),REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT:_.string().optional(),REDOCLY_DISABLE_API_FUNCTION_SANDBOX:E(),REDOCLY_MCP_ENFORCE_TOKEN_AUDIENCE:E(),REDOCLY_EXP_MCP_CUSTOM_TOOLS_ENABLED:E(),REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED:E()});export{D as featureFlagsSchema};
@@ -1,5 +1,4 @@
1
- import type { PlanGates, ProductPlan } from '../../types/index.js';
2
- import type { Feature } from '../../types/index.js';
1
+ import type { PlanGates, ProductPlan, Feature } from '../../types/index.js';
3
2
  export declare const PLAN_GATES_DEFAULTS: {
4
3
  [key in ProductPlan]: PlanGates;
5
4
  };
@@ -1 +1 @@
1
- const t=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"],_="Documentation",E="API Reference",e="search",o=100,A=10,r=25,p=100,I=150,s="ai-search",c=50,R=250,S=Symbol("metadata"),a=!0,n=["title"];export{s as AI_INDEX_EXPORT_FOLDER,c as AI_SEARCH_CHUNK_SIZE,R as AI_SEARCH_DOCUMENT_CHUNK_SIZE,a as DEFAULT_AI_SEARCH_ENABLED,n as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,I as HIGHLIGHTED_TEXT_MAX_LENGTH,e as SEARCH_DATA_EXPORT_FOLDER,S as SEARCH_DOCUMENT_METADATA_KEY,A as SEARCH_GROUP_LIMIT,E as SEARCH_GROUP_NAME_API,_ as SEARCH_GROUP_NAME_DOCUMENTATION,t as SEARCH_INDEX_FIELDS,o as SEARCH_LIMIT,r as SEARCH_MAX_FACET_VALUES,p as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
1
+ const t=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:path"],_="Documentation",E="API Reference",e="search",o=100,A=10,r=25,I=100,p=150,s="ai-search",R=50,S=250,c=Symbol("metadata"),n=!0,C=["title"];export{s as AI_INDEX_EXPORT_FOLDER,R as AI_SEARCH_CHUNK_SIZE,S as AI_SEARCH_DOCUMENT_CHUNK_SIZE,n as DEFAULT_AI_SEARCH_ENABLED,C as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,p as HIGHLIGHTED_TEXT_MAX_LENGTH,e as SEARCH_DATA_EXPORT_FOLDER,c as SEARCH_DOCUMENT_METADATA_KEY,A as SEARCH_GROUP_LIMIT,E as SEARCH_GROUP_NAME_API,_ as SEARCH_GROUP_NAME_DOCUMENTATION,t as SEARCH_INDEX_FIELDS,o as SEARCH_LIMIT,r as SEARCH_MAX_FACET_VALUES,I as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
@@ -8,9 +8,9 @@ export type Location = {
8
8
  export declare class EsbuildError extends Error {
9
9
  errors: BuildFailure['errors'];
10
10
  warnings: BuildFailure['warnings'];
11
- constructor({ errors, warnings }: Partial<BuildFailure>);
11
+ constructor(failure: Partial<BuildFailure>);
12
12
  }
13
- export declare function esbuildLogger({ errors, warnings }: EsbuildError): Promise<void>;
13
+ export declare function esbuildLogger({ errors, warnings, message }: EsbuildError): Promise<void>;
14
14
  export declare function reportEsbuildError(message: string, sourceFileRelativePath: string, fileContent: string, location?: Location | null): {
15
15
  message: string;
16
16
  sourceFileRelativePath: string;
@@ -1,3 +1,3 @@
1
- import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as u}from"../tools/notifiers/reporter.js";import{envConfig as f}from"../config/env-config.js";import{telemetry as d}from"../../cli/telemetry/index.js";import{stopAllCompilers as y}from"./esbuild.js";import{getCodeframe as C}from"../utils/codeframes/codeframes.js";import{shutdowner as M}from"../tools/shutdowner.js";class S extends Error{errors;warnings;constructor({errors:r=[],warnings:e=[]}){super(),this.errors=r,this.warnings=e}}async function T({errors:n,warnings:r}){const e=await m(n,"error"),s=await m(r,"warning");r.forEach((t,o)=>{c.warn(s[o])}),n.forEach((t,o)=>{const i=t.location?.file||"";i&&i.includes("node_modules/")?(c.error(e[o]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(t)}])):(c.contentError(e[o]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(t),scope:"content"}]))}),n.length&&f.isBuildMode&&(await y(),await M.exitWithCode(1))}async function m(n,r){return f.REDOCLY_LOG_FORMAT==="JSON"?n.map(e=>JSON.stringify(e)):await E.formatMessages(n,{kind:r,color:!1,terminalWidth:0})}function w(n,r){if(!r?.lineText)return{line:1,column:1,lines:n.split(`
2
- `),hasMatched:!1};const e=n.split(`
3
- `),{lineText:s}=r,t=i=>{const l=i.indexOf(s);return l===-1?null:l};if(r.line&&r.line<=e.length&&t(e[r.line-1]))return{line:r.line,column:r.column||1,lines:e,hasMatched:!0};const o=e.findIndex(i=>t(i)!==null);if(o>=0){const i=t(e[o]);return{line:o+1,column:(i??0)+1,lines:e,hasMatched:!0}}return{line:1,column:1,lines:e,hasMatched:!1}}function _(n,r,e,s){const{line:t,column:o,lines:i,hasMatched:l}=w(e,s),{frame:h,start:p}=C({start:{line:t,character:o},end:{line:t,character:o+(s?.lineText?.length||0)},lines:i},!0),g=`${n}::${r}::${t}`,a={message:n,sourceFileRelativePath:r,sourceFileLocation:p,codeframe:h,hasMatched:l};return u.getCompilationProblem(g)||u.reportCompilationError({type:"ERROR",severity:"ERROR",...a}),a}export{S as EsbuildError,T as esbuildLogger,_ as reportEsbuildError};
1
+ import*as E from"esbuild";import{logger as c}from"../tools/notifiers/logger.js";import{reporter as f}from"../tools/notifiers/reporter.js";import{envConfig as m}from"../config/env-config.js";import{telemetry as d}from"../../cli/telemetry/index.js";import{stopAllCompilers as y}from"./esbuild.js";import{getCodeframe as C}from"../utils/codeframes/codeframes.js";import{shutdowner as M}from"../tools/shutdowner.js";class N extends Error{errors;warnings;constructor(r){super(r.message,r instanceof Error?{cause:r}:void 0),this.errors=r.errors??[],this.warnings=r.warnings??[]}}async function T({errors:n,warnings:r,message:t}){const s=await h(n,"error"),o=await h(r,"warning");if(r.forEach((e,i)=>{c.warn(o[i])}),n.forEach((e,i)=>{const a=e.location?.file||"";a&&a.includes("node_modules/")?(c.error(s[i]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(e)}])):(c.contentError(s[i]),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:JSON.stringify(e),scope:"content"}]))}),!n.length&&t){const e=`JavaScript compilation failed: ${t}`;c.error(e),d.sendCliErrorCaughtMessage([{id:"cli",object:"error",uri:"urn:redocly:realm:cli:error:cli",message:e}])}(n.length>0||t)&&m.isBuildMode&&(await y(),await M.exitWithCode(1))}async function h(n,r){return n.length?m.REDOCLY_LOG_FORMAT==="JSON"?n.map(t=>JSON.stringify(t)):await E.formatMessages(n,{kind:r,color:!1,terminalWidth:0}):[]}function w(n,r){if(!r?.lineText)return{line:1,column:1,lines:n.split(`
2
+ `),hasMatched:!1};const t=n.split(`
3
+ `),{lineText:s}=r,o=e=>{const i=e.indexOf(s);return i===-1?null:i};if(r.line&&r.line<=t.length&&o(t[r.line-1]))return{line:r.line,column:r.column||1,lines:t,hasMatched:!0};const l=t.findIndex(e=>o(e)!==null);if(l>=0){const e=o(t[l]);return{line:l+1,column:(e??0)+1,lines:t,hasMatched:!0}}return{line:1,column:1,lines:t,hasMatched:!1}}function _(n,r,t,s){const{line:o,column:l,lines:e,hasMatched:i}=w(t,s),{frame:a,start:g}=C({start:{line:o,character:l},end:{line:o,character:l+(s?.lineText?.length||0)},lines:e},!0),p=`${n}::${r}::${o}`,u={message:n,sourceFileRelativePath:r,sourceFileLocation:g,codeframe:a,hasMatched:i};return f.getCompilationProblem(p)||f.reportCompilationError({type:"ERROR",severity:"ERROR",...u}),u}export{N as EsbuildError,T as esbuildLogger,_ as reportEsbuildError};
@@ -1 +1 @@
1
- import f from"@babel/core";import h from"node:fs";import r from"node:path";import d from"babel-plugin-styled-components";import u from"crypto";import{envConfig as m}from"../../config/env-config.js";import{babelCache as i}from"../babel-cache.js";const A=()=>({name:"styled-components-ssr",setup:c=>{const l=process.cwd();c.onLoad({filter:/\.[tj]sx?$/},async t=>{if(new RegExp(`${r.sep}replay-[A-Za-z0-9_-]+.js$`).test(t.path)||t.path.endsWith(`${r.sep}replay.js`)||t.path.includes(`${r.sep}replay-index-`)&&t.path.endsWith(".js")||t.path.includes(`${r.sep}replay-tauri-path-`)&&t.path.endsWith(".js"))return;let e=t.path.split(".").pop();const s=i.get(t.path);if(s&&t.path.includes("/node_modules/"))return{contents:s.contents,loader:e};let p=["importMeta","topLevelAwait","classProperties","classPrivateProperties","classPrivateMethods","jsx"];(e==="tsx"||e==="ts")&&p.push("typescript");let o=await h.promises.readFile(t.path,"utf8");if(o.indexOf("styled-components")===-1)return{contents:o,loader:e};const a=u.createHash("sha1").update(o).digest("base64");if(s&&s.hash===a)return{contents:s.contents,loader:e};try{const n=(await f.transformAsync(o,{babelrc:!1,configFile:!1,ast:!1,root:l,filename:t.path,parserOpts:{allowAwaitOutsideFunction:!0,plugins:p},generatorOpts:{decoratorsBeforeExport:!0},plugins:[d],sourceMaps:!1}))?.code||void 0;return i.set(t.path,{contents:n,hash:a}),{contents:n,loader:e}}catch(n){if(!m.isDevelopMode)throw n;return{contents:o,loader:e}}})}});export{A as StyledComponentsSSR};
1
+ import f from"@babel/core";import h from"node:fs";import r from"node:path";import d from"babel-plugin-styled-components";import u from"crypto";import{envConfig as m}from"../../config/env-config.js";import{babelCache as i}from"../babel-cache.js";const A=()=>({name:"styled-components-ssr",setup:c=>{const l=process.cwd();c.onLoad({filter:/\.[tj]sx?$/},async t=>{if(new RegExp(`${r.sep}replay-[A-Za-z0-9_-]+\\.js$`).test(t.path)||t.path.endsWith(`${r.sep}replay.js`)||t.path.includes(`${r.sep}replay-index-`)&&t.path.endsWith(".js")||t.path.includes(`${r.sep}replay-tauri-path-`)&&t.path.endsWith(".js"))return;let e=t.path.split(".").pop();const s=i.get(t.path);if(s&&t.path.includes("/node_modules/"))return{contents:s.contents,loader:e};let p=["importMeta","topLevelAwait","classProperties","classPrivateProperties","classPrivateMethods","jsx"];(e==="tsx"||e==="ts")&&p.push("typescript");let o=await h.promises.readFile(t.path,"utf8");if(o.indexOf("styled-components")===-1)return{contents:o,loader:e};const a=u.createHash("sha1").update(o).digest("base64");if(s&&s.hash===a)return{contents:s.contents,loader:e};try{const n=(await f.transformAsync(o,{babelrc:!1,configFile:!1,ast:!1,root:l,filename:t.path,parserOpts:{allowAwaitOutsideFunction:!0,plugins:p},generatorOpts:{decoratorsBeforeExport:!0},plugins:[d],sourceMaps:!1}))?.code||void 0;return i.set(t.path,{contents:n,hash:a}),{contents:n,loader:e}}catch(n){if(!m.isDevelopMode)throw n;return{contents:o,loader:e}}})}});export{A as StyledComponentsSSR};
@@ -1,4 +1,4 @@
1
- import*as c from"node:path";import{CONFIG_FILE_NAME as x}from"../../../constants/common.js";import{DEFAULT_THEME_NAME as $,USER_THEME_ALIAS as y}from"../../../constants/common.js";import{isDefined as g}from"../../../utils/guards/is-defined.js";import{slash as D}from"../../../utils/path/slash.js";import{resolveExternalPlugins as p}from"../../external-plugins/resolve-external-plugins.js";import{generateMarkdocComponentsEntry as L,generateMarkdocSchemasEntry as M}from"./codegen/index.js";const d=new Map,N=(a,o)=>{const h=c.resolve(o,y),i=c.resolve(o,x),k=["components","core","layouts","markdoc","icons","config","ext"],R="@redocly\\/theme\\/",w=k.map(s=>`${R}${s}`).join("|"),E=new RegExp(`^(@redocly/theme$|${w})`);return{name:"esbuild-redocly-custom-themes-resolver",setup:s=>{s.onResolve({filter:/@redocly-markdoc\/schema/},async e=>{const r=(await p(o,a.config.plugins)).flatMap(n=>n.markdoc?.schemaFile).filter(g);return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...r,i],watchDirs:[c.resolve(h,"markdoc")],pluginData:{schemaFiles:r}}}),s.onLoad({filter:/@redocly-markdoc\/schema/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:M(e),resolveDir:"/",loader:"ts"})),s.onResolve({filter:/@redocly-markdoc\/components/},async e=>{const r=[...(await p(o,a.config.plugins)).map(n=>n.markdoc?.componentsFile).filter(g)];return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...r,i],pluginData:{componentsFiles:r},watchDirs:[c.resolve(h,"markdoc")]}}),s.onLoad({filter:/@redocly-markdoc\/components/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:L(e),resolveDir:"/",loader:"ts"})),s.onResolve({filter:/@styles/},async e=>{const r=(await p(o,a.config.plugins)).map(n=>n.stylesFile).filter(Boolean);return{namespace:"user-styles-ns",path:e.path,watchFiles:[...r,i],pluginData:{styleFiles:r},watchDirs:[h]}}),s.onLoad({filter:/@styles/,namespace:"user-styles-ns"},async({pluginData:e})=>{const{styleFiles:t}=e;return{contents:t.map(n=>`@import url("${D(c.relative(o,n))}");`).join(`
1
+ import*as c from"node:path";import{CONFIG_FILE_NAME as x,DEFAULT_THEME_NAME as $,USER_THEME_ALIAS as y}from"../../../constants/common.js";import{isDefined as g}from"../../../utils/guards/is-defined.js";import{slash as D}from"../../../utils/path/slash.js";import{resolveExternalPlugins as p}from"../../external-plugins/resolve-external-plugins.js";import{generateMarkdocComponentsEntry as L,generateMarkdocSchemasEntry as M}from"./codegen/index.js";const d=new Map,S=(a,o)=>{const h=c.resolve(o,y),i=c.resolve(o,x),k=["components","core","layouts","markdoc","icons","config","ext"],R="@redocly\\/theme\\/",w=k.map(s=>`${R}${s}`).join("|"),E=new RegExp(`^(@redocly/theme$|${w})`);return{name:"esbuild-redocly-custom-themes-resolver",setup:s=>{s.onResolve({filter:/@redocly-markdoc\/schema/},async e=>{const r=(await p(o,a.config.plugins)).flatMap(n=>n.markdoc?.schemaFile).filter(g);return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...r,i],watchDirs:[c.resolve(h,"markdoc")],pluginData:{schemaFiles:r}}}),s.onLoad({filter:/@redocly-markdoc\/schema/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:M(e),resolveDir:"/",loader:"ts"})),s.onResolve({filter:/@redocly-markdoc\/components/},async e=>{const r=[...(await p(o,a.config.plugins)).map(n=>n.markdoc?.componentsFile).filter(g)];return{namespace:"markdoc-schema-ns",path:e.path,watchFiles:[...r,i],pluginData:{componentsFiles:r},watchDirs:[c.resolve(h,"markdoc")]}}),s.onLoad({filter:/@redocly-markdoc\/components/,namespace:"markdoc-schema-ns"},({pluginData:e})=>({contents:L(e),resolveDir:"/",loader:"ts"})),s.onResolve({filter:/@styles/},async e=>{const r=(await p(o,a.config.plugins)).map(n=>n.stylesFile).filter(Boolean);return{namespace:"user-styles-ns",path:e.path,watchFiles:[...r,i],pluginData:{styleFiles:r},watchDirs:[h]}}),s.onLoad({filter:/@styles/,namespace:"user-styles-ns"},async({pluginData:e})=>{const{styleFiles:t}=e;return{contents:t.map(n=>`@import url("${D(c.relative(o,n))}");`).join(`
2
2
  `),loader:"css",resolveDir:o}}),s.onResolve({filter:/(^|\/)styles\.css$/},async({path:e,...t})=>{if(t.pluginData==="missing-styles-ns")return;const r=await s.resolve(e,{...t,pluginData:"missing-styles-ns"});return r.errors.length&&r.errors.some(n=>n.text.match(/^Could not resolve .*?\bstyles.css\b/))?{namespace:"missing-styles-ns",path:e}:r}),s.onLoad({filter:/(^|\/)styles\.css$/,namespace:"missing-styles-ns"},async()=>({contents:"",loader:"css"})),s.onResolve({filter:/^react-router-dom$/},()=>({namespace:"react-router-dom-ns",path:"react-router-dom"})),s.onLoad({filter:/^react-router-dom$/,namespace:"react-router-dom-ns"},async()=>{const e=await s.resolve("@redocly/theme/package.json",{resolveDir:o,kind:"require-resolve"});return{contents:`import * as ReactRouter from 'react-router';
3
3
  export const useLocation = ReactRouter.useLocation;
4
- export const useInRouterContext = ReactRouter.useInRouterContext;`,loader:"js",resolveDir:e.errors.length?o:c.dirname(e.path)}}),s.onResolve({filter:E},async e=>{if(e.resolveDir==="")return;const t=`${e.path}:${e.importer}`;if(d.has(t))return d.get(t);const{path:r,...n}=e,l=await p(o,a.config.plugins),u=e.path.replace($,"")||"index";for(let m=l.length-1;m>=0;m--){const F=l[m].isNpmPackage?[c.join(l[m].name,"src",u),{...n,resolveDir:o}]:[`./${u}`,{...n,resolveDir:l[m].pluginDirAbsolutePath}],f=C(await s.resolve(...F));if("path"in f&&f.path!==e.importer){const v={...f,watchFiles:[i,c.join(o,y,u+".tsx")]};return l[m].name===y||d.set(t,v),v}}})}}};function C(a){return a.errors.length?{errors:a.errors}:a}export{N as ThemesResolver,d as resolveCache};
4
+ export const useInRouterContext = ReactRouter.useInRouterContext;`,loader:"js",resolveDir:e.errors.length?o:c.dirname(e.path)}}),s.onResolve({filter:E},async e=>{if(e.resolveDir==="")return;const t=`${e.path}:${e.importer}`;if(d.has(t))return d.get(t);const{path:r,...n}=e,l=await p(o,a.config.plugins),u=e.path.replace($,"")||"index";for(let m=l.length-1;m>=0;m--){const F=l[m].isNpmPackage?[c.join(l[m].name,"src",u),{...n,resolveDir:o}]:[`./${u}`,{...n,resolveDir:l[m].pluginDirAbsolutePath}],f=C(await s.resolve(...F));if("path"in f&&f.path!==e.importer){const v={...f,watchFiles:[i,c.join(o,y,u+".tsx")]};return l[m].name===y||d.set(t,v),v}}})}}};function C(a){return a.errors.length?{errors:a.errors}:a}export{S as ThemesResolver,d as resolveCache};
@@ -1 +1 @@
1
- import{LRUCache as H}from"lru-cache";import{sha1 as M}from"../utils/crypto/sha1.js";import{envConfig as S}from"../config/env-config.js";import{NestedMap as x}from"./utils/nested-map.js";import{trackAccessStore as w}from"./utils/async-storage.js";import{isLoaderCacheEnabled as k}from"./utils/is-loader-cache-enabled.js";import{LoadError as v}from"./load-error.js";import{createLifecycleContext as D}from"../plugins/lifecycle.js";function f(y,t){return y+":"+t}class J{fs;errors=new Map;#t=new Map;#i=new Map;#e=new Map;#s=new Map;#a=new x;#r;#o={};#n=new Map;constructor(t){this.fs=t,this.#r=D(t,this),this.#f()}#c(t){let e=this.#t.get(t);return e||(e=new H({max:S.isBuildMode?1e3:1e6}),this.#t.set(t,e)),e}async load(t,e,i){let s,h;typeof e=="string"?(s=e,h=this.#o[e]):(s=e.name,h=e.loader);const a=f(s,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),r=n!==void 0?n.length>30?M(n):n:void 0,c=w.getStore()??[],F=!this.#h(t,s,r),p=this.#c(s),g=p.get(t);if(F&&g)return c.push({type:"load",loaderId:s,resource:t,hash:g.compoundHash}),g;const d=Promise.withResolvers();this.#n.set(a,d.promise),r!==void 0&&this.#e.set(a,r);const{status:L,value:l}=await this.#p(t,s,async()=>{let m;const I=w.getStore()||[],u=[],P=o=>u.push(o);try{m=await h(t,this.#r,P),u.length>0?this.errors.set(a,u):this.errors.delete(a)}catch(o){const R=p.get(t)?.data,E=s==="redocly-config"||s==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(o instanceof v)&&!E&&this.errors.set(a,[o]),!R)return{status:"error",value:o instanceof v?o:new v(o.message,{cause:o,loaderId:s})};m=R}const C=M(t+(r??"")+I.map(o=>o.hash).join(""));return c.push({type:"load",loaderId:s,resource:t,hash:C}),{status:"success",value:{data:m,compoundHash:C}}});return L==="error"?d.reject(l):(this.#l(t),k(s)&&p.set(t,l),this.#i.set(a,l.compoundHash),d.resolve(l)),this.#n.delete(a),d.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,e){if(e){const i=f(e,t);this.#d(t,e),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const s=this.#s.get(t);if(s){for(const h of s)this.delete(h,e);this.#s.delete(t)}this.#a.delete(e,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t,e){const i=this.#t.get(e);i&&i.delete(t)}#l(t){const[e,i]=t.split("#");if(!i)return;const s=this.#s.get(e);s?s.add(t):this.#s.set(e,new Set([t]))}#f(){this.fs.watch(async t=>{for(const e of t)e.event==="unlink"&&this.delete(e.path)})}#h(t,e,i){const s=f(e,t);return i!==void 0&&this.#e.get(s)!==i?!0:(this.#a.get(e,t)??[]).some(n=>{switch(n.type){case"load":const r=f(n.loaderId,n.resource);return this.#i.get(r)!==n.hash||this.#h(n.resource,n.loaderId,this.#e.get(r));case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":const c=this.fs.getFileInfo(n.path);return n.hash!==(c&&!c.isVirtual?"t":"f");case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#p(t,e,i){const s=[];return this.#a.set(e,t,s),w.run(s,i)}}export{J as Cache};
1
+ import{LRUCache as H}from"lru-cache";import{sha1 as M}from"../utils/crypto/sha1.js";import{envConfig as S}from"../config/env-config.js";import{NestedMap as x}from"./utils/nested-map.js";import{trackAccessStore as u}from"./utils/async-storage.js";import{isLoaderCacheEnabled as k}from"./utils/is-loader-cache-enabled.js";import{LoadError as w}from"./load-error.js";import{createLifecycleContext as D}from"../plugins/lifecycle.js";function l(v,t){return v+":"+t}class J{fs;errors=new Map;#t=new Map;#i=new Map;#e=new Map;#s=new Map;#a=new x;#r;#o={};#n=new Map;constructor(t){this.fs=t,this.#r=D(t,this),this.#f()}#c(t){let e=this.#t.get(t);return e||(e=new H({max:S.isBuildMode?1e3:1e6}),this.#t.set(t,e)),e}async load(t,e,i){let s,h;typeof e=="string"?(s=e,h=this.#o[e]):(s=e.name,h=e.loader);const a=l(s,t);if(this.#n.has(a))return this.#n.get(a);const n=i?.join(""),o=n!==void 0?n.length>30?M(n):n:void 0,y=u.getStore()??[],F=!this.#h(t,s,o),f=this.#c(s),p=f.get(t);if(F&&p)return y.push({type:"load",loaderId:s,resource:t,hash:p.compoundHash}),p;const c=Promise.withResolvers();this.#n.set(a,c.promise),o!==void 0&&this.#e.set(a,o);const{status:L,value:d}=await this.#p(t,s,async()=>{let g;const I=u.getStore()||[],m=[],P=r=>m.push(r);try{g=await h(t,this.#r,P),m.length>0?this.errors.set(a,m):this.errors.delete(a)}catch(r){const R=f.get(t)?.data,E=s==="redocly-config"||s==="nearest-redocly-config"?!1:(await this.load(t,"is-ignored")).data;if(!(r instanceof w)&&!E&&this.errors.set(a,[r]),!R)return{status:"error",value:r instanceof w?r:new w(r.message,{cause:r,loaderId:s})};g=R}const C=M(t+(o??"")+I.map(r=>r.hash).join(""));return y.push({type:"load",loaderId:s,resource:t,hash:C}),{status:"success",value:{data:g,compoundHash:C}}});return L==="error"?c.reject(d):(this.#l(t),k(s)&&f.set(t,d),this.#i.set(a,d.compoundHash),c.resolve(d)),this.#n.delete(a),c.promise}setLoaders(t){this.#o={...this.#o,...t}}delete(t,e){if(e){const i=l(e,t);this.#d(t,e),this.errors.delete(i),this.#i.delete(i),this.#e.delete(i);const s=this.#s.get(t);if(s){for(const h of s)this.delete(h,e);this.#s.delete(t)}this.#a.delete(e,t)}else for(const i of this.#t.keys())this.delete(t,i)}#d(t,e){const i=this.#t.get(e);i&&i.delete(t)}#l(t){const[e,i]=t.split("#");if(!i)return;const s=this.#s.get(e);s?s.add(t):this.#s.set(e,new Set([t]))}#f(){this.fs.watch(async t=>{for(const e of t)e.event==="unlink"&&this.delete(e.path)})}#h(t,e,i){const s=l(e,t);return i!==void 0&&this.#e.get(s)!==i?!0:(this.#a.get(e,t)??[]).some(n=>{switch(n.type){case"load":{const o=l(n.loaderId,n.resource);return this.#i.get(o)!==n.hash||this.#h(n.resource,n.loaderId,this.#e.get(o))}case"read":return n.hash!==this.fs.getFileInfo(n.path)?.hash;case"exists":{const o=this.fs.getFileInfo(n.path);return n.hash!==(o&&!o.isVirtual?"t":"f")}case"scan":return n.hash!==this.fs.getPatternScanHash(n.pattern)}})}#p(t,e,i){const s=[];return this.#a.set(e,t,s),u.run(s,i)}}export{J as Cache};
@@ -1 +1 @@
1
- import*as f from"chokidar";import h from"path";import*as p from"node:fs/promises";import{createHash as l}from"node:crypto";import{slash as o}from"../../utils/path/slash.js";import{logger as c}from"../tools/notifiers/logger.js";import{sha1 as m}from"../utils/crypto/sha1.js";import{USER_THEME_ALIAS as u,USER_SKILLS_ALIAS as g,USER_SKILL_FILENAME as w}from"../../constants/common.js";import{debouncedEmit as L}from"./utils/debounced-emit.js";import{trackAccessStore as r}from"./utils/async-storage.js";import{removeBom as S}from"./utils/string-utils.js";const E=`${g}(/.*)?`,y=w.replace(".","\\."),v=new RegExp(`^(${E}|${y})$`);class j{cwd;ignored;filesList=new Map;watcher;#t=new Map;#e=[];constructor(t,e=[]){this.cwd=t,this.ignored=e,this.watcher=this.#i()}get ready(){return this.watcher.then(()=>!0)}getFileInfo(t){return this.filesList.get(t)}watch(t){this.#e.push(t)}async dispose(){(await this.watcher).close()}exists(t){const e=this.filesList.has(t);return r.getStore()?.push({type:"exists",path:t,hash:e?"t":"f"}),e}async read(t,e="utf-8"){try{let i=await p.readFile(h.join(this.cwd,t),e);i=S(i);const s=m(i);r.getStore()?.push({type:"read",path:t,hash:s});const a=this.filesList.get(t);return a&&(a.hash=s),i}catch(i){throw r.getStore()?.push({type:"read",path:t,hash:"error"}),i}}scan(t){const e=[],i=l("sha1");this.filesList.forEach(a=>{(!t||t.test(a.relativePath))&&(e.push(a),i.update(a.relativePath))});const s=i.digest("base64");return this.#t.set(t,s),r.getStore()?.push({type:"scan",hash:s,pattern:t}),e}emitCodeUpdated(){this.emit({event:"code-updated"})}addVirtualFile(t,e){this.filesList.set(t,{relativePath:t,realRelativePath:e.realRelativePath,hash:e.hash,isVirtual:!0}),r.getStore()?.push({type:"read",path:t,hash:e.hash??""})}getPatternScanHash(t){return this.#t.get(t)}#s(t){return v.test(t)}emit=L(async t=>{for(const e of t)if(!("path"in e&&this.#s(e.path)))switch(e.event){case"add":this.filesList.set(e.path,{relativePath:e.path,realRelativePath:e.path,hash:void 0,isVirtual:!1});for(const s of this.#t.keys())s&&s.test(e.path)&&this.#t.set(s,void 0),s||this.#t.set(s,void 0);break;case"change":const i=this.filesList.get(e.path);i&&(i.hash=void 0);break;case"unlink":this.filesList.delete(e.path);for(const s of this.#t.keys())s&&s.test(e.path)&&this.#t.delete(s),s||this.#t.delete(s);break}for(const e of this.#e)await e(t)});async#i(){return c.startTiming("init-fs"),new Promise((t,e)=>{const i=f.watch(this.cwd,{usePolling:!1,ignoreInitial:!0,ignored:[new RegExp(`(/.git/|/node_modules/|${u})`),h.join(this.cwd,"public"),h.join(this.cwd,"README.md"),...this.ignored]});i.on("ready",()=>{this.filesList=this.#a(i.getWatched()),t(i),c.infoTime("init-fs","File system scan completed")}).on("error",e).on("add",(s,a)=>{this.emit({event:"add",path:o(h.relative(this.cwd,s)),stats:a})}).on("change",(s,a)=>{this.emit({event:"change",path:o(h.relative(this.cwd,s)),stats:a})}).on("unlink",s=>{this.emit({event:"unlink",path:o(h.relative(this.cwd,s))})})})}#a(t){const e=new Map;for(const i of Object.keys(t))for(const s of t[i]){const a=h.join(i,s);if(t[a])continue;const d=o(h.dirname(h.relative(this.cwd,a))),n=h.posix.join(d,s);this.#s(n)||e.set(n,{relativePath:n,realRelativePath:n,isVirtual:!1,hash:void 0})}return e}}export{j as Fs};
1
+ import*as f from"chokidar";import h from"path";import*as p from"node:fs/promises";import{createHash as l}from"node:crypto";import{slash as o}from"../../utils/path/slash.js";import{logger as c}from"../tools/notifiers/logger.js";import{sha1 as m}from"../utils/crypto/sha1.js";import{USER_THEME_ALIAS as u,USER_SKILLS_ALIAS as g,USER_SKILL_FILENAME as w}from"../../constants/common.js";import{debouncedEmit as L}from"./utils/debounced-emit.js";import{trackAccessStore as r}from"./utils/async-storage.js";import{removeBom as S}from"./utils/string-utils.js";const E=`${g}(/.*)?`,y=w.replace(".","\\."),v=new RegExp(`^(${E}|${y})$`);class j{cwd;ignored;filesList=new Map;watcher;#t=new Map;#e=[];constructor(t,e=[]){this.cwd=t,this.ignored=e,this.watcher=this.#i()}get ready(){return this.watcher.then(()=>!0)}getFileInfo(t){return this.filesList.get(t)}watch(t){this.#e.push(t)}async dispose(){(await this.watcher).close()}exists(t){const e=this.filesList.has(t);return r.getStore()?.push({type:"exists",path:t,hash:e?"t":"f"}),e}async read(t,e="utf-8"){try{let s=await p.readFile(h.join(this.cwd,t),e);s=S(s);const i=m(s);r.getStore()?.push({type:"read",path:t,hash:i});const a=this.filesList.get(t);return a&&(a.hash=i),s}catch(s){throw r.getStore()?.push({type:"read",path:t,hash:"error"}),s}}scan(t){const e=[],s=l("sha1");this.filesList.forEach(a=>{(!t||t.test(a.relativePath))&&(e.push(a),s.update(a.relativePath))});const i=s.digest("base64");return this.#t.set(t,i),r.getStore()?.push({type:"scan",hash:i,pattern:t}),e}emitCodeUpdated(){this.emit({event:"code-updated"})}addVirtualFile(t,e){this.filesList.set(t,{relativePath:t,realRelativePath:e.realRelativePath,hash:e.hash,isVirtual:!0}),r.getStore()?.push({type:"read",path:t,hash:e.hash??""})}getPatternScanHash(t){return this.#t.get(t)}#s(t){return v.test(t)}emit=L(async t=>{for(const e of t)if(!("path"in e&&this.#s(e.path)))switch(e.event){case"add":this.filesList.set(e.path,{relativePath:e.path,realRelativePath:e.path,hash:void 0,isVirtual:!1});for(const s of this.#t.keys())s&&s.test(e.path)&&this.#t.set(s,void 0),s||this.#t.set(s,void 0);break;case"change":{const s=this.filesList.get(e.path);s&&(s.hash=void 0);break}case"unlink":this.filesList.delete(e.path);for(const s of this.#t.keys())s&&s.test(e.path)&&this.#t.delete(s),s||this.#t.delete(s);break}for(const e of this.#e)await e(t)});async#i(){return c.startTiming("init-fs"),new Promise((t,e)=>{const s=f.watch(this.cwd,{usePolling:!1,ignoreInitial:!0,ignored:[new RegExp(`(/.git/|/node_modules/|${u})`),h.join(this.cwd,"public"),h.join(this.cwd,"README.md"),...this.ignored]});s.on("ready",()=>{this.filesList=this.#a(s.getWatched()),t(s),c.infoTime("init-fs","File system scan completed")}).on("error",e).on("add",(i,a)=>{this.emit({event:"add",path:o(h.relative(this.cwd,i)),stats:a})}).on("change",(i,a)=>{this.emit({event:"change",path:o(h.relative(this.cwd,i)),stats:a})}).on("unlink",i=>{this.emit({event:"unlink",path:o(h.relative(this.cwd,i))})})})}#a(t){const e=new Map;for(const s of Object.keys(t))for(const i of t[s]){const a=h.join(s,i);if(t[a])continue;const d=o(h.dirname(h.relative(this.cwd,a))),n=h.posix.join(d,i);this.#s(n)||e.set(n,{relativePath:n,realRelativePath:n,isVirtual:!1,hash:void 0})}return e}}export{j as Fs};
@@ -1 +1 @@
1
- function n(e){return e.replace(/^((\/|)(@i18n|@l10n)\/[^\/]+)\//,"")}export{n as removeL10nPrefix};
1
+ function n(e){return e.replace(/^((\/|)(@i18n|@l10n)\/[^/]+)\//,"")}export{n as removeL10nPrefix};
@@ -1,6 +1,5 @@
1
- import type { FileHashReadModelSchema } from '../types.js';
1
+ import type { FileHashReadModelSchema, FileHashStatus, UpsertFileHashParams } from '../types.js';
2
2
  import type { Filter } from '../../../providers/database/pagination/types.js';
3
- import type { FileHashStatus, UpsertFileHashParams } from '../types.js';
4
3
  import type { DatabaseConnection, RepositoryInstanceOptions } from '../../../providers/database/types.js';
5
4
  import { BaseRepository } from '../../../providers/database/base-repository.js';
6
5
  export declare class FileHashesRepository extends BaseRepository {
@@ -1,7 +1,6 @@
1
1
  import type { ServiceInstanceOptions } from '../../../providers/database/types.js';
2
2
  import type { Filter } from '../../../providers/database/pagination/types.js';
3
- import type { FileHashStatus, UpsertFileHashParams } from '../types.js';
4
- import type { FileHashReadModelSchema } from '../types.js';
3
+ import type { FileHashStatus, UpsertFileHashParams, FileHashReadModelSchema } from '../types.js';
5
4
  import { FileHashesRepository } from '../repositories/file-hashes-repository.js';
6
5
  export declare class FileHashesService {
7
6
  #private;
@@ -1 +1 @@
1
- const a=(n,i)=>{const d=i?.analytics?.rudderstack;if(!d)return;const{trackPage:t}=d;function e(){t!==!1&&window.rudderanalytics?.page(document.title)}window.rudderSnippetLoaded===!1?window.rudderSnippetLoading===!0?window.rudderSnippetLoadedCallback=function(){e()}:n.prevLocation?(window.rudderSnippetLoadedCallback=void 0,window.rudderSnippetLoader(function(){e()})):window.rudderSnippetLoadedCallback=function(){e()}:e()};export{a as onRouteChange};
1
+ const r=(n,i)=>{const d=i?.analytics?.rudderstack;if(!d)return;const{trackPage:t}=d;function e(){t===!0&&window.rudderanalytics?.page(document.title)}window.rudderSnippetLoaded===!1?window.rudderSnippetLoading===!0?window.rudderSnippetLoadedCallback=function(){e()}:n.prevLocation?(window.rudderSnippetLoadedCallback=void 0,window.rudderSnippetLoader(function(){e()})):window.rudderSnippetLoadedCallback=function(){e()}:e()};export{r as onRouteChange};
@@ -1 +1 @@
1
- const a=(t,o)=>{const e=o?.analytics?.segment;if(!e||e?.trackPage===!1)return;function n(){window.segmentPageviewCaller?.(!!t.prevLocation)}window.portalPluginSegmentSnippetLoader?window.portalPluginSegmentSnippetLoader(n):n()};export{a as onRouteChange};
1
+ const o=(n,t)=>{if(t?.analytics?.segment?.trackPage!==!0)return;function e(){window.segmentPageviewCaller?.(!!n.prevLocation)}window.portalPluginSegmentSnippetLoader?window.portalPluginSegmentSnippetLoader(e):e()};export{o as onRouteChange};
@@ -1,8 +1,8 @@
1
- import c from"react";const d=n=>{const{writeKey:t,trackPage:a,host:i="https://cdn.segment.io",includeTitleInPageCall:r=!0}=n,l=`(function () {
1
+ import c from"react";const d=n=>{const{writeKey:t,trackPage:a,host:i="https://cdn.segment.io",includeTitleInPageCall:r=!1}=n,l=`(function () {
2
2
  let segmentPageviewCalledAlready = false;
3
3
  window.segmentPageviewCaller = function (force) {
4
4
 
5
- ${a!==!1?"":"return;"}
5
+ ${a===!0?"":"return;"}
6
6
 
7
7
  if (!window.analytics) {
8
8
  return
@@ -15,7 +15,7 @@ import c from"react";const d=n=>{const{writeKey:t,trackPage:a,host:i="https://cd
15
15
  };
16
16
  })();`;let e=`(function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="${i}/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="${t}";analytics.SNIPPET_VERSION="4.15.3";
17
17
  analytics.load('${t}');
18
- `;a!==!1&&(e+="window.segmentPageviewCaller();"),e+="}})();";const s=`
18
+ `;a===!0&&(e+="window.segmentPageviewCaller();"),e+="}})();";const s=`
19
19
  (function () {
20
20
  ${l}
21
21
  ${e}
@@ -1,8 +1,7 @@
1
- import type { OpenAPIDefinition, AsyncApiDefinition, ApiSpecType } from '@redocly/api-docs';
1
+ import { type ASTNode, type DocumentNode } from 'graphql';
2
+ import type { OpenAPIDefinition, AsyncApiDefinition, ApiSpecType, RawApiDocsOptions } from '@redocly/api-docs';
2
3
  import type { Node as MarkdocNode } from '@markdoc/markdoc';
3
- import type { ASTNode, DocumentNode } from 'graphql';
4
4
  import type { LifecycleContext } from '../../types';
5
- import type { RawApiDocsOptions } from '@redocly/api-docs';
6
5
  import type { RedoclyConfig } from '@redocly/config';
7
6
  export type MarkdocChunk = {
8
7
  node: Record<string, unknown> & {
@@ -1,4 +1,4 @@
1
- import type { ApiSpecType, OpenAPIDefinition, AsyncApiDefinition, DownloadUrl, RawApiDocsOptions } from '@redocly/api-docs';
1
+ import { type ApiSpecType, type OpenAPIDefinition, type AsyncApiDefinition, type DownloadUrl, type RawApiDocsOptions } from '@redocly/api-docs';
2
2
  import type { DocumentNode } from 'graphql';
3
3
  export type DocumentBuildContext = {
4
4
  rootConfig: Record<string, unknown> | null;
@@ -1 +1 @@
1
- import*as w from"node:path";import{findFirstBinding as M,markdocParser as P}from"@redocly/api-docs";import{combineUrls as i}from"@redocly/theme/core/openapi";import{withPathPrefix as h}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as _}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{deepMerge as B}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as E}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as u}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as I}from"./utils/relative-path-to-base-slug.js";const U={tags:{},nodes:{},components:{}};function A(o,r){if(!(o?.off!==!0))return o;const t=I(r);return{url:h(`/_mock${t}`),position:"first",description:"Mock server",...o}}function L(o,r){return(r==="graphql"?[i(_,`${u(o,w.posix.extname(o))}?download`)]:[i(f,`${u(o,".json")}?download`),i(f,`${u(o,".yaml")}?download`)]).map(t=>({url:h(t)}))}function H(o,r,m){const{rootConfig:t,config:c,apiConfig:s,mergedConfig:e,relativePath:d}=m,a=B(t?.[o]||{},c[o]||{},s[o]||s.theme?.[o]||{}),b=r["x-feedback"]||a.feedback||c.feedback,S=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!t?.[o]?.excludeFromSearch||!!t?.theme?.[o]?.excludeFromSearch,x=e.rbac||s.rbac,g=E(b),k=c.metadata,O={...g&&{feedback:g},mockServer:A(e?.mockServer||t?.mockServer,d),disableRouter:!0,downloadUrls:a.downloadUrls||L(d,o),excludeFromSearch:S,rbac:x,markdownParser:P};let l;if(o==="graphql"){const n=a;l={title:n.info?.title,...k,...n.metadata??{}}}else{const n=r.info,F=n?.["x-metadata"];l={title:n?.title,description:n?.description,...o==="openapi"&&{summary:n?.summary},...k,...F}}o==="openapi"&&a.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,d));const C=a.markdocOptions??U,p={...a,...O,specType:o,markdocOptions:C,metadata:l};return o==="asyncapi"&&(p.protocol=M(r)??void 0),p}export{L as buildDownloadUrls,H as createOptions};
1
+ import*as F from"node:path";import{findFirstBinding as P,markdocParser as _}from"@redocly/api-docs";import{combineUrls as i}from"@redocly/theme/core/openapi";import{withPathPrefix as k}from"@redocly/theme/core/utils";import{GRAPHQL_SPEC_SLUG as w}from"../../../constants/common.js";import{PUBLIC_API_DEFINITIONS_FOLDER as f}from"../../constants/common.js";import{envConfig as L}from"../../config/env-config.js";import{deepMerge as M}from"../../../utils/object/deep-merge.js";import{normalizeFeedbackOptions as A}from"./utils/normalize-feedback-options.js";import{replaceFileExtension as g}from"./utils/replace-file-extension.js";import{relativePathToBaseSlug as B}from"./utils/relative-path-to-base-slug.js";const R={tags:{},nodes:{},components:{}};function D(o,r){if(!(o?.off!==!0))return o;const t=B(r);return{url:k(`/_mock${t}`),position:"first",description:"Mock server",...o}}function I(o,r){return(r==="graphql"?[i(w,`${g(o,F.posix.extname(o))}?download`)]:[i(f,`${g(o,".json")}?download`),i(f,`${g(o,".yaml")}?download`)]).map(t=>({url:k(t)}))}function j(o,r,m){const{rootConfig:t,config:c,apiConfig:s,mergedConfig:e,relativePath:l}=m,a=M(t?.[o]||{},c[o]||{},s[o]||s.theme?.[o]||{}),b=r["x-feedback"]||a.feedback||c.feedback,S=!!e[o]?.excludeFromSearch||!!e.theme?.[o]?.excludeFromSearch||!!t?.[o]?.excludeFromSearch||!!t?.theme?.[o]?.excludeFromSearch,x=e.rbac||s.rbac,p=A(b),u=c.metadata,C={...p&&{feedback:p},mockServer:D(e?.mockServer||t?.mockServer,l),disableRouter:!0,downloadUrls:a.downloadUrls||I(l,o),excludeFromSearch:S,rbac:x,markdownParser:_,replayFeatures:{graphql:L.REDOCLY_EXP_REPLAY_GRAPHQL_ENABLED??!1}};let d;if(o==="graphql"){const n=a;d={title:n.info?.title,...u,...n.metadata??{}}}else{const n=r.info,E=n?.["x-metadata"];d={title:n?.title,description:n?.description,...o==="openapi"&&{summary:n?.summary},...u,...E}}o==="openapi"&&a.showSchemaCatalogLinks&&(r["x-schema-catalog-link"]=i(f,l));const O=a.markdocOptions??R,h={...a,...C,specType:o,markdocOptions:O,metadata:d};return o==="asyncapi"&&(h.protocol=P(r)??void 0),h}export{I as buildDownloadUrls,j as createOptions};
@@ -0,0 +1,5 @@
1
+ import { ApiDocsSearchIndexer } from '@redocly/api-docs';
2
+ import type { ExampleEntry, SchemaEntry } from '@redocly/api-docs';
3
+ /** The shared api-docs indexer with Markdown descriptions — AI search documents and llms.txt need Markdown. */
4
+ export declare function createApiDocsSearchIndexer(basePath: string, schemaStore?: Record<string, SchemaEntry>, document?: Record<string, unknown>, exampleStore?: Record<string, ExampleEntry>): ApiDocsSearchIndexer;
5
+ //# sourceMappingURL=create-indexer.d.ts.map
@@ -0,0 +1 @@
1
+ import{ApiDocsSearchIndexer as e}from"@redocly/api-docs";import{toMarkdown as i}from"../../markdown/search/to-markdown.js";function a(r){if(typeof r=="string")return r;const t=Array.isArray(r)?r:[r];return i(t).trim()}function f(r,t,o,n){return new e(r,t,o,{formatDescription:a,exampleStore:n})}export{f as createApiDocsSearchIndexer};
@@ -1,5 +1,5 @@
1
+ import { type ApiItem, type ApiDocsMetadata, type ApiStore, type ApiSpecType, type OpenAPIDefinition, type AsyncApiDefinition } from '@redocly/api-docs';
1
2
  import type { SearchFacet } from '@redocly/theme/core/types';
2
- import type { ApiItem, ApiDocsMetadata, ApiStore, ApiSpecType, OpenAPIDefinition, AsyncApiDefinition } from '@redocly/api-docs';
3
3
  import type { AfterRoutesCreatedActions, AfterRoutesCreatedLifecycleContext, PageRouteDetails } from '../../../types';
4
4
  import type { MarkdocTagSchema } from '@redocly/theme/markdoc/tags/types';
5
5
  import type { AiDocumentsStore } from '../../../plugins/search/types.js';
@@ -15,6 +15,6 @@ type AiDocumentsStoreParams = {
15
15
  getSearchFacets: () => Map<string, SearchFacet>;
16
16
  markdocTags?: Record<string, MarkdocTagSchema>;
17
17
  };
18
- export declare function getAiDocumentsStore({ items, metadata, store, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown, context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions) => Promise<AiDocumentsStore | undefined>;
18
+ export declare function getAiDocumentsStore({ items, metadata, store, document, specType, excludeFromSearch, basePath, getSearchFacets, markdocTags, }: AiDocumentsStoreParams): (route: PageRouteDetails, _staticData: unknown, _context: AfterRoutesCreatedLifecycleContext, actions: AfterRoutesCreatedActions) => Promise<AiDocumentsStore | undefined>;
19
19
  export {};
20
20
  //# sourceMappingURL=get-ai-search-documents.d.ts.map
@@ -1,34 +1,34 @@
1
- import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as g}from"@redocly/api-docs";import{normalizeApiVersion as sn}from"../utils/normalize-api-version.js";import{replaceFileExtension as v}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as cn,canDownloadApiDefinition as ln,extractTeamsFromScopeItems as fn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as J}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Q}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as an}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as pn}from"../../../constants/rbac.js";import{toMarkdown as N}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as un}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as dn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as hn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as w}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as mn}from"../../search/utils.js";import{extractDocumentSearchFacets as $n}from"./search-facets.js";import{ApiDocsSearchIndexer as gn}from"./search-indexer.js";function A(t,r){return r==="openapi"&&"openapi"in t}function H(t,r){return r==="asyncapi"&&"asyncapi"in t}function Qn({items:t,metadata:r,store:c,document:n,specType:o,excludeFromSearch:i,basePath:e,getSearchFacets:l,markdocTags:s}){return async(f,a,u,d)=>{if(i)return;const m={...d.markdocOptions?.tags,...s},{locale:X,translate:Z}=await hn(f.slug,d.getGlobalData?.().l10n),C=un(m,X,Z),x=await u.getConfig(),L=dn(f.fsPath),j=new gn(e,c?.schemaStore,n),M=y=>{for(const p of y)j.addItem(p),p.items?.length&&M(p.items)};M(t);const nn=j.getResult(),V=new Map;for(const y of nn)V.set(y.url,y);const R=typeof r.title=="string"?r.title:void 0,_=sn(r.version),D=$n(f.metadata||{},R,_,l),I=[],S=[],q=yn(r,n,o),F=bn(o,r,f.fsPath,x),tn=Sn(t,x,C),en=q+F+`
2
- `+tn,on=q+F;S.push({title:R||"API Overview",description:typeof r.description=="string"?r.description:void 0,content:en,slug:e,fsPath:f.fsPath,includeInLLMsTxt:!0}),I.push({title:R||"API Overview",content:on,url:e,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D});const rn=n&&A(n,o)?n.security:void 0,E=y=>{for(const p of y){if(!p.content||!p.link){p.items?.length&&E(p.items);continue}const k=V.get(p.link),G=p.content.contentType,z=p[O],W=z?fn(z):void 0,B=W?.length?W:void 0;if(G===g.ITEM){const $=Pn(p,n,o)??Y(p,k,o,_,rn,C);if($){const b=p.label||"";S.push({title:b,description:void 0,content:$,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),I.push({title:b,content:$,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}else if(G===g.GROUP){const $=On(p,x,o,C);if($){const b=p.label||"";S.push({title:b,description:k?Rn(k.text):void 0,content:$.llmstxt,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),I.push({title:b,content:$.aiSearch,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}p.items?.length&&E(p.items)}};return E(t),{async getLLMsTxts(){return S},async getSearchDocuments(){return I}}}}function yn(t,r,c){const n=typeof t.title=="string"?t.title:"",o=typeof t.description=="string"?t.description:"",i=typeof t.summary=="string"?t.summary:"",e=typeof t.version=="string"?t.version:"";let l=n?`# ${n}
1
+ import P from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{nodeTypes as h,contentType as y}from"@redocly/api-docs";import{normalizeApiVersion as sn}from"../utils/normalize-api-version.js";import{replaceFileExtension as U}from"../utils/replace-file-extension.js";import{isResourcePubliclyAccessible as cn,canDownloadApiDefinition as ln,extractTeamsFromScopeItems as fn}from"../../../utils/rbac.js";import{getLlmsTxtMdPathBySlug as J}from"../../../utils/llmstxt/get-llms-txt-md-path-by-slug.js";import{PUBLIC_API_DEFINITIONS_FOLDER as Q}from"../../../constants/common.js";import{GRAPHQL_SPEC_SLUG as an}from"../../../../constants/common.js";import{ANONYMOUS_AUTH_DETAILS as pn}from"../../../constants/rbac.js";import{toMarkdown as v}from"../../markdown/search/to-markdown.js";import{createRenderTagFn as un}from"../../markdown/search/create-render-tag-fn.js";import{getLocaleFromRelativePath as dn}from"../../../fs/utils/get-locale-from-relative-path.js";import{getBuildTranslateContext as hn}from"../../../utils/l10n/get-build-translate-context.js";import{llmsTxtLink as N}from"../../search/llmstxt/index.js";import{formatDocumentMetadata as mn}from"../../search/utils.js";import{extractDocumentSearchFacets as $n}from"./search-facets.js";import{createApiDocsSearchIndexer as yn}from"./create-indexer.js";function A(t,o){return o==="openapi"&&"openapi"in t}function H(t,o){return o==="asyncapi"&&"asyncapi"in t}function Qn({items:t,metadata:o,store:s,document:n,specType:r,excludeFromSearch:i,basePath:e,getSearchFacets:l,markdocTags:c}){return async(f,a,u,d)=>{if(i)return;const m={...d.markdocOptions?.tags,...c},{locale:X,translate:Z}=await hn(f.slug,d.getGlobalData?.().l10n),x=un(m,X,Z),C=d.getConfig(),L=dn(f.fsPath),j=yn(e,s?.schemaStore,n,s?.exampleStore),M=g=>{for(const p of g)j.addItem(p),p.items?.length&&M(p.items)};M(t);const nn=j.getResult(),V=new Map;for(const g of nn)V.set(g.url,g);const R=typeof o.title=="string"?o.title:void 0,_=sn(o.version),D=$n(f.metadata||{},R,_,l),S=[],I=[],q=gn(o,n,r),F=bn(r,o,f.fsPath,C),tn=In(t,C,x),en=q+F+`
2
+ `+tn,on=q+F;I.push({title:R||"API Overview",description:typeof o.description=="string"?o.description:void 0,content:en,slug:e,fsPath:f.fsPath,includeInLLMsTxt:!0}),S.push({title:R||"API Overview",content:on,url:e,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D});const rn=n&&A(n,r)?n.security:void 0,E=g=>{for(const p of g){if(!p.content||!p.link){p.items?.length&&E(p.items);continue}const k=V.get(p.link),G=p.content.contentType,z=p[O],W=z?fn(z):void 0,B=W?.length?W:void 0;if(G===y.ITEM){const $=Pn(p,n,r)??Y(p,k,r,_,rn,x);if($){const b=p.label||"";I.push({title:b,description:void 0,content:$,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}else if(G===y.GROUP){const $=On(p,C,r,x);if($){const b=p.label||"";I.push({title:b,description:k?Rn(k.text):void 0,content:$.llmstxt,slug:p.link,fsPath:f.fsPath,includeInLLMsTxt:!1}),S.push({title:b,content:$.aiSearch,url:p.link,fsPath:f.fsPath,locale:L,product:f.product?.name,facets:D,rbacTeams:B})}}p.items?.length&&E(p.items)}};return E(t),{async getLLMsTxts(){return I},async getSearchDocuments(){return S}}}}function gn(t,o,s){const n=typeof t.title=="string"?t.title:"",r=typeof t.description=="string"?t.description:"",i=typeof t.summary=="string"?t.summary:"",e=typeof t.version=="string"?t.version:"";let l=n?`# ${n}
3
3
 
4
- `:"";if(l+=o?`${o}
4
+ `:"";if(l+=r?`${r}
5
5
 
6
6
  `:"",l+=i?`${i}
7
7
 
8
8
  `:"",l+=e?`Version: ${e}
9
- `:"",r){if(A(r,c)){const{info:s}=r;s?.license?.name&&(l+=`License: ${s.license.name}
10
- `);const f=s["x-metadata"],a=mn(f);a&&(l+=`
9
+ `:"",o){if(A(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
10
+ `);const f=c["x-metadata"],a=mn(f);a&&(l+=`
11
11
  Metadata:
12
12
  ${a}
13
- `)}else if(H(r,c)){const{info:s}=r;s?.license?.name&&(l+=`License: ${s.license.name}
13
+ `)}else if(H(o,s)){const{info:c}=o;c?.license?.name&&(l+=`License: ${c.license.name}
14
14
  `)}}return l+=`
15
- `,l+=An(r,c),l+=In(r,c),l}function bn(t,r,c,n){if(!c)return"";let o,i,e;if(t==="openapi")o=P.posix.join(Q,v(c,".yaml")),i="## Download OpenAPI description",e="OpenAPI definition";else if(t==="asyncapi")o=P.posix.join(Q,v(c,".yaml")),i="## Download AsyncAPI description",e="AsyncAPI definition";else if(t==="graphql"){const f=P.posix.extname(c)||".graphql";o=P.posix.join(an,v(c,f)),i="## Download GraphQL schema",e="GraphQL schema"}else return"";if(!ln(o,n.access?.rbac??{},n.access?.requiresLogin??!1,pn))return"";const s=typeof r.title=="string"&&r.title||e;return`${i}
15
+ `,l+=An(o,s),l+=Sn(o,s),l}function bn(t,o,s,n){if(!s)return"";let r,i,e;if(t==="openapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download OpenAPI description",e="OpenAPI definition";else if(t==="asyncapi")r=P.posix.join(Q,U(s,".yaml")),i="## Download AsyncAPI description",e="AsyncAPI definition";else if(t==="graphql"){const f=P.posix.extname(s)||".graphql";r=P.posix.join(an,U(s,f)),i="## Download GraphQL schema",e="GraphQL schema"}else return"";if(!ln(r,n.access?.rbac??{},n.access?.requiresLogin??!1,pn))return"";const c=typeof o.title=="string"&&o.title||e;return`${i}
16
16
 
17
- - ${w({title:s,description:void 0,slug:o})}`}function An(t,r){if(!t)return"";if(A(t,r)){const{servers:c}=t;if(!c?.length)return"";let n=`## Servers
17
+ - ${N({title:c,description:void 0,slug:r,siteUrl:n.seo?.siteUrl})}`}function An(t,o){if(!t)return"";if(A(t,o)){const{servers:s}=t;if(!s?.length)return"";let n=`## Servers
18
18
 
19
- `;for(const o of c)if(o.description&&(n+=`${o.description}
19
+ `;for(const r of s)if(r.description&&(n+=`${r.description}
20
20
  `),n+=`\`\`\`
21
- ${o.url}
21
+ ${r.url}
22
22
  \`\`\`
23
23
 
24
- `,o.variables){n+=`Variables:
25
- `;for(const[i,e]of Object.entries(o.variables))n+=`- \`${i}\`${e.description?`: ${e.description}`:""}
24
+ `,r.variables){n+=`Variables:
25
+ `;for(const[i,e]of Object.entries(r.variables))n+=`- \`${i}\`${e.description?`: ${e.description}`:""}
26
26
  `,e.default&&(n+=` Default: ${JSON.stringify(e.default)}
27
27
  `),e.enum&&(n+=` Enum: ${e.enum.map(l=>JSON.stringify(l)).join(", ")}
28
28
  `);n+=`
29
- `}return n}if(H(t,r)){const{servers:c}=t;if(!c||!Object.keys(c).length)return"";let n=`## Servers
29
+ `}return n}if(H(t,o)){const{servers:s}=t;if(!s||!Object.keys(s).length)return"";let n=`## Servers
30
30
 
31
- `;for(const[o,i]of Object.entries(c))n+=`### ${o}
31
+ `;for(const[r,i]of Object.entries(s))n+=`### ${r}
32
32
 
33
33
  `,i.description&&(n+=`${i.description}
34
34
  `),i.host&&(n+=`Host: ${i.host}
@@ -36,9 +36,9 @@ ${o.url}
36
36
  `),i.protocolVersion&&(n+=`Protocol Version: ${i.protocolVersion}
37
37
  `),i.pathname&&(n+=`Pathname: ${i.pathname}
38
38
  `),n+=`
39
- `;return n}return""}function In(t,r){if(!t||!A(t,r))return"";const c=t.components?.securitySchemes;if(!c)return"";let n=`## Security
39
+ `;return n}return""}function Sn(t,o){if(!t||!A(t,o))return"";const s=t.components?.securitySchemes;if(!s)return"";let n=`## Security
40
40
 
41
- `;for(const[o,i]of Object.entries(c)){if(!i||"$ref"in i)continue;const e=i;n+=`### ${o}
41
+ `;for(const[r,i]of Object.entries(s)){if(!i||"$ref"in i)continue;const e=i;n+=`### ${r}
42
42
 
43
43
  `,e.description&&(n+=`${e.description}
44
44
 
@@ -48,58 +48,58 @@ ${o.url}
48
48
  `),e.scheme&&(n+=`Scheme: ${e.scheme}
49
49
  `),e.bearerFormat&&(n+=`Bearer Format: ${e.bearerFormat}
50
50
  `),e.openIdConnectUrl&&(n+=`OpenID Connect URL: ${e.openIdConnectUrl}
51
- `);const l=e.flows,s=l?.implicit||l?.password||l?.clientCredentials||l?.authorizationCode;if(s&&("authorizationUrl"in s&&s.authorizationUrl&&(n+=`Authorization URL: ${s.authorizationUrl}
52
- `),"tokenUrl"in s&&s.tokenUrl&&(n+=`Token URL: ${s.tokenUrl}
53
- `),s.scopes)){n+=`Scopes:
54
- `;for(const[f,a]of Object.entries(s.scopes))n+=`- \`${f}\`: ${a}
51
+ `);const l=e.flows,c=l?.implicit||l?.password||l?.clientCredentials||l?.authorizationCode;if(c&&("authorizationUrl"in c&&c.authorizationUrl&&(n+=`Authorization URL: ${c.authorizationUrl}
52
+ `),"tokenUrl"in c&&c.tokenUrl&&(n+=`Token URL: ${c.tokenUrl}
53
+ `),c.scopes)){n+=`Scopes:
54
+ `;for(const[f,a]of Object.entries(c.scopes))n+=`- \`${f}\`: ${a}
55
55
  `}n+=`
56
- `}return n}function Sn(t,r,c){let n="";const o=(i,e)=>{for(const l of i)if(l.link){if(l.content?.contentType===g.GROUP)n+=`${e} ${l.label||""}
56
+ `}return n}function In(t,o,s){let n="";const r=(i,e)=>{for(const l of i)if(l.link){if(l.content?.contentType===y.GROUP)n+=`${e} ${l.label||""}
57
57
 
58
- `,l.items?.length&&o(l.items,e+"#");else if(l.content?.contentType===g.ITEM){if(!U(l,r))continue;const s=l,f=s.httpVerb,a=s.httpPath,u=f&&a?`${f.toUpperCase()} ${a}`:l.label||"",d=l.content?T(l.content.children,c):void 0;n+=` - ${w({title:u,description:d?d.slice(0,200):void 0,slug:J(l.link)})}`}}};return o(t,"##"),n}function Y(t,r,c,n,o,i){if(!t.content)return;const e=t,l=t.label||"",s=T(t.content.children,i),f=t.content.meta?.deprecated;let a=`# ${l}${f?" (deprecated)":""}
58
+ `,l.items?.length&&r(l.items,e+"#");else if(l.content?.contentType===y.ITEM){if(!w(l,o))continue;const c=l,f=c.httpVerb,a=c.httpPath,u=f&&a?`${f.toUpperCase()} ${a}`:l.label||"",d=l.content?T(l.content.children,s):void 0;n+=` - ${N({title:u,description:d?d.slice(0,200):void 0,slug:J(l.link),siteUrl:o.seo?.siteUrl})}`}}};return r(t,"##"),n}function Y(t,o,s,n,r,i){if(!t.content)return;const e=t,l=t.label||"",c=T(t.content.children,i),f=t.content.meta?.deprecated;let a=`# ${l}${f?" (deprecated)":""}
59
59
 
60
- `;if(s&&(a+=`${s}
60
+ `;if(c&&(a+=`${c}
61
61
 
62
- `),c==="openapi"||c==="asyncapi"){const u=e.httpVerb,d=e.httpPath;u&&d?a+=`Endpoint: ${u.toUpperCase()} ${d}
62
+ `),s==="openapi"||s==="asyncapi"){const u=e.httpVerb,d=e.httpPath;u&&d?a+=`Endpoint: ${u.toUpperCase()} ${d}
63
63
  `:u&&(a+=`Method: ${u.toUpperCase()}
64
64
  `),n&&(a+=`Version: ${n}
65
- `);const m=Tn(t.content.children,o);m&&(a+=`Security: ${m}
66
- `)}return r?.parameters?.length&&c!=="graphql"&&(a+=`
67
- `+Cn(r.parameters)+`
68
- `),c==="graphql"&&(a+=xn(t.content.children)),a}function Pn(t,r,c){if(t.httpVerb!=="tool"||!r||!A(r,c))return;const n=t.content?.meta?.name,o=n?r["x-mcp"]?.tools?.find(e=>e.name===n):void 0;if(!o)return;let i=`# ${t.label||o.name}
65
+ `);const m=Tn(t.content.children,r);m&&(a+=`Security: ${m}
66
+ `)}return o?.parameters?.length&&s!=="graphql"&&(a+=`
67
+ `+xn(o.parameters)+`
68
+ `),s==="graphql"&&(a+=Cn(t.content.children)),a}function Pn(t,o,s){if(t.httpVerb!=="tool"||!o||!A(o,s))return;const n=t.content?.meta?.name,r=n?o["x-mcp"]?.tools?.find(e=>e.name===n):void 0;if(!r)return;let i=`# ${t.label||r.name}
69
69
 
70
- `;return typeof o.description=="string"&&o.description&&(i+=`${o.description}
70
+ `;return typeof r.description=="string"&&r.description&&(i+=`${r.description}
71
71
 
72
72
  `),i+=`## Input schema:
73
73
 
74
74
  `,i+=`\`\`\`json
75
- ${JSON.stringify(o.inputSchema,null,2)}
75
+ ${JSON.stringify(r.inputSchema,null,2)}
76
76
  \`\`\`
77
77
 
78
- `,o.outputSchema&&(i+=`## Output schema:
78
+ `,r.outputSchema&&(i+=`## Output schema:
79
79
 
80
80
  `,i+=`\`\`\`json
81
- ${JSON.stringify(o.outputSchema,null,2)}
81
+ ${JSON.stringify(r.outputSchema,null,2)}
82
82
  \`\`\`
83
83
 
84
- `),i}function On(t,r,c,n){if(!t.content)return;const o=t.label||"",i=T(t.content.children,n);let e=`# ${o}
84
+ `),i}function On(t,o,s,n){if(!t.content)return;const r=t.label||"",i=T(t.content.children,n);let e=`# ${r}
85
85
 
86
86
  `;if(i&&(e+=`${i}
87
87
 
88
- `),c==="graphql"){let s="";const f=a=>{for(const u of a??[])if(!(!u.content||!U(u,r)))if(u.content.contentType===g.ITEM){const d=Y(u,void 0,c,void 0,void 0,n);d&&(s+=`${d}
88
+ `),s==="graphql"){let c="";const f=a=>{for(const u of a??[])if(!(!u.content||!w(u,o)))if(u.content.contentType===y.ITEM){const d=Y(u,void 0,s,void 0,void 0,n);d&&(c+=`${d}
89
89
 
90
90
  ---
91
91
 
92
- `)}else u.content.contentType===g.GROUP&&f(u.items)};return f(t.items),{llmstxt:e+s,aiSearch:e}}let l="";if(t.items?.length)for(const s of t.items){if(!s.link||!s.content||s.content.contentType!==g.ITEM||!U(s,r))continue;const f=s,a=f.httpVerb,u=f.httpPath,d=a&&u?`${a.toUpperCase()} ${u}`:s.label||"",m=s.content?T(s.content.children,n):void 0;l+=` - ${w({title:d,description:m?m.slice(0,200):void 0,slug:J(s.link)})}`}return{llmstxt:e+l,aiSearch:e}}function Tn(t,r){const c=[],n=o=>{for(const i of o)if(i.nodeType===h.SECURITY){const e=i;for(const l of e.requirements)for(const s of l.schemes)s[O]||s.name&&!c.includes(s.name)&&c.push(s.name)}else(i.nodeType===h.CONTAINER||i.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(i.children)};if(n(t),c.length)return c.join(", ");if(r?.length){const o=r.flatMap(i=>Object.keys(i));if(o.length)return[...new Set(o)].join(", ")}}function Cn(t){const r={};for(const n of t){const o=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;r[o]||(r[o]=[]),r[o].push(n)}return Object.entries(r).map(([n,o])=>{const i=o.map(e=>{const l=[...e.path||[],e.name],s=Array.isArray(e.description)?e.description.join(" "):e.description;let f=` - \`${l.join(".")}\` (${e.type}${e.required?", required":""})
93
- `;return s&&(f+=` ${s.trim()}
92
+ `)}else u.content.contentType===y.GROUP&&f(u.items)};return f(t.items),{llmstxt:e+c,aiSearch:e}}let l="";if(t.items?.length)for(const c of t.items){if(!c.link||!c.content||c.content.contentType!==y.ITEM||!w(c,o))continue;const f=c,a=f.httpVerb,u=f.httpPath,d=a&&u?`${a.toUpperCase()} ${u}`:c.label||"",m=c.content?T(c.content.children,n):void 0;l+=` - ${N({title:d,description:m?m.slice(0,200):void 0,slug:J(c.link),siteUrl:o.seo?.siteUrl})}`}return{llmstxt:e+l,aiSearch:e}}function Tn(t,o){const s=[],n=r=>{for(const i of r)if(i.nodeType===h.SECURITY){const e=i;for(const l of e.requirements)for(const c of l.schemes)c[O]||c.name&&!s.includes(c.name)&&s.push(c.name)}else(i.nodeType===h.CONTAINER||i.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(i.children)};if(n(t),s.length)return s.join(", ");if(o?.length){const r=o.flatMap(i=>Object.keys(i));if(r.length)return[...new Set(r)].join(", ")}}function xn(t){const o={};for(const n of t){const r=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;o[r]||(o[r]=[]),o[r].push(n)}return Object.entries(o).map(([n,r])=>{const i=r.map(e=>{const l=[...e.path||[],e.name],c=Array.isArray(e.description)?e.description.join(" "):e.description;let f=` - \`${l.join(".")}\` (${e.type}${e.required?", required":""})
93
+ `;return c&&(f+=` ${c.trim()}
94
94
  `),e.enum?f+=` Enum: ${e.enum.map(a=>JSON.stringify(a)).join(", ")}
95
95
  `:e.example&&(f+=` Example: ${e.example}
96
96
  `),f});return`## ${K(n)}:
97
97
 
98
98
  ${i.join(`
99
99
  `)}`}).join(`
100
- `)}function xn(t){let r="";const c=n=>{for(const o of n)if(o.nodeType===h.ITEM){const i=o;i.graphqlSchema&&(r+=Ln(i.graphqlSchema,i.variant))}else(o.nodeType===h.CONTAINER||o.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&c(o.children)};return c(t),r}function Ln(t,r){let n=`
101
- ## ${K(r==="return-type"?"Return type":r==="graphql-args"||r==="arguments"?"Arguments":r==="graphql-fields"?"Fields":r)}:
100
+ `)}function Cn(t){let o="";const s=n=>{for(const r of n)if(r.nodeType===h.ITEM){const i=r;i.graphqlSchema&&(o+=Ln(i.graphqlSchema,i.variant))}else(r.nodeType===h.CONTAINER||r.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&s(r.children)};return s(t),o}function Ln(t,o){let n=`
101
+ ## ${K(o==="return-type"?"Return type":o==="graphql-args"||o==="arguments"?"Arguments":o==="graphql-fields"?"Fields":o)}:
102
102
 
103
- `;const o=i=>{const e=i.description?N(Array.isArray(i.description)?i.description:[i.description]).trim():"";return` - \`${i.name}\` (${i.type})${e?`: ${e}`:""}
104
- `};if(!Array.isArray(t)){const i=t.description?N(Array.isArray(t.description)?t.description:[t.description]).trim():"";n+=` Type: ${t.type}`,i&&(n+=` - ${i}`),n+=`
105
- `;for(const e of t.fields??[])n+=o(e);return n}if(!t.length)return"";for(const i of t)n+=o(i);return n}function T(t,r){const c=[],n=i=>{for(const e of i)if(e.nodeType===h.MARKDOC){const l=e.content,s=Array.isArray(l)?l:[l],f=N(s,{renderTag:r}).trim();f&&c.push(f)}else(e.nodeType===h.CONTAINER||e.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(e.children)};return n(t),c.join(" ").trim()||void 0}function Rn(t){return(Array.isArray(t)?t.join(" "):t)||void 0}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}function U(t,r){return r.access?.requiresLogin?!0:cn({slug:t.link||"",[O]:t[O]},r)}export{Qn as getAiDocumentsStore};
103
+ `;const r=i=>{const e=i.description?v(Array.isArray(i.description)?i.description:[i.description]).trim():"";return` - \`${i.name}\` (${i.type})${e?`: ${e}`:""}
104
+ `};if(!Array.isArray(t)){const i=t.description?v(Array.isArray(t.description)?t.description:[t.description]).trim():"";n+=` Type: ${t.type}`,i&&(n+=` - ${i}`),n+=`
105
+ `;for(const e of t.fields??[])n+=r(e);return n}if(!t.length)return"";for(const i of t)n+=r(i);return n}function T(t,o){const s=[],n=i=>{for(const e of i)if(e.nodeType===h.MARKDOC){const l=e.content,c=Array.isArray(l)?l:[l],f=v(c,{renderTag:o}).trim();f&&s.push(f)}else(e.nodeType===h.CONTAINER||e.nodeType===h.OVERVIEW_SECTION_WRAPPER)&&n(e.children)};return n(t),s.join(" ").trim()||void 0}function Rn(t){return(Array.isArray(t)?t.join(" "):t)||void 0}function K(t){return t.charAt(0).toUpperCase()+t.slice(1)}function w(t,o){return o.access?.requiresLogin?!0:cn({slug:t.link||"",[O]:t[O]},o)}export{Qn as getAiDocumentsStore};
@@ -1 +1 @@
1
- import{REDOCLY_ROUTE_RBAC as p,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as A,setDocumentSearchFacets as D}from"./search-facets.js";import{ApiDocsSearchIndexer as d}from"./search-indexer.js";import{normalizeApiVersion as x}from"../utils/normalize-api-version.js";function O(h,i,c,u,R,g,S){return async e=>{if(R)return[];const a=e.baseSlug||e.slug,m=new d(a,g?.schemaStore,S),f=t=>{for(const r of t)m.addItem(r),r.items?.length&&f(r.items)};f(h);const s=typeof i.title=="string"?i.title:void 0,n=x(i.version),l=A(e.metadata||{},s,n,c);return D(l,c,u),m.getResult().map(t=>({...t,...t.url===a&&s&&{title:n?`${s} (${n})`:s},[o]:t[o]??e[o],[p]:e[p]??{slug:e.slug,fsPath:e.fsPath},facets:l}))}}export{O as searchResolver};
1
+ import{REDOCLY_ROUTE_RBAC as h,REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{extractDocumentSearchFacets as x,setDocumentSearchFacets as A}from"./search-facets.js";import{ApiDocsSearchIndexer as D}from"@redocly/api-docs";import{normalizeApiVersion as d}from"../utils/normalize-api-version.js";function O(u,i,c,S,R,a,g){return async e=>{if(R)return[];const m=e.baseSlug||e.slug,l=new D(m,a?.schemaStore,g,{exampleStore:a?.exampleStore}),f=t=>{for(const r of t)l.addItem(r),r.items?.length&&f(r.items)};f(u);const s=typeof i.title=="string"?i.title:void 0,n=d(i.version),p=x(e.metadata||{},s,n,c);return A(p,c,S),l.getResult().map(t=>({...t,...t.url===m&&s&&{title:n?`${s} (${n})`:s},[o]:t[o]??e[o],[h]:e[h]??{slug:e.slug,fsPath:e.fsPath},facets:p}))}}export{O as searchResolver};
@@ -1 +1 @@
1
- import b from"node:path";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{slash as k}from"../../../../utils/path/slash.js";function f(t,r,a){if(!r)throw new Error("Visitor required");if(t){t.description&&r(t,"description",a.location.absolutePointer+"/description",a);for(const o in t["x-enumDescriptions"])r(t["x-enumDescriptions"],o,a.location.absolutePointer+"/x-enumDescriptions/"+o,a)}}const x=/^[a-zA-Z0-9\s\-,.!\?:;'"()/]+$/,d=/^\s*(?:[-+*]\s|\d+[.)]\s)/m;function g(t){return x.test(t)&&!d.test(t)}const s=({outputRelativePath:t,cwd:r})=>{const a=function(e,m,l,u){const{node:n}=u.resolve(e[m]);if(!n||typeof n!="string"||g(n))return;const i=u.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:e,pointer:k(b.relative(r,l)),markdown:n,relativePath:t,key:m})};return{any:{leave(o,e){f(o,a,e)}},ref:{leave(o,e){f(o,a,e)}}}},c=()=>{const t={};return{Tag:{enter(r){r?.["x-rbac"]&&(t[String(r.name)]=r["x-rbac"])}},any:{leave(r,a){if((a.type.name==="Operation"||a.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)t[o]&&(r["x-rbac"]=r["x-rbac"]||t[o]);r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}}}};function D(t,r,a){const o={id:"markdown",decorators:{oas2:{markdown:s,rbac:c},oas3:{markdown:s,rbac:c},async3:{markdown:s,rbac:c}}};return{...t,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:a},...t.decorators||{}},plugins:[...t.plugins||[],o]}}export{s as MarkdownParserDecorator,c as RbacDecorator,D as injectDecoratorIntoConfig,g as isPlainNonMarkdownText};
1
+ import b from"node:path";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{slash as k}from"../../../../utils/path/slash.js";function f(t,r,a){if(!r)throw new Error("Visitor required");if(t){t.description&&r(t,"description",a.location.absolutePointer+"/description",a);for(const o in t["x-enumDescriptions"])r(t["x-enumDescriptions"],o,a.location.absolutePointer+"/x-enumDescriptions/"+o,a)}}const x=/^[a-zA-Z0-9\s\-,.!?:;'"()/]+$/,d=/^\s*(?:[-+*]\s|\d+[.)]\s)/m;function g(t){return x.test(t)&&!d.test(t)}const s=({outputRelativePath:t,cwd:r})=>{const a=function(e,m,l,u){const{node:n}=u.resolve(e[m]);if(!n||typeof n!="string"||g(n))return;const i=u.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:e,pointer:k(b.relative(r,l)),markdown:n,relativePath:t,key:m})};return{any:{leave(o,e){f(o,a,e)}},ref:{leave(o,e){f(o,a,e)}}}},c=()=>{const t={};return{Tag:{enter(r){r?.["x-rbac"]&&(t[String(r.name)]=r["x-rbac"])}},any:{leave(r,a){if((a.type.name==="Operation"||a.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)t[o]&&(r["x-rbac"]=r["x-rbac"]||t[o]);r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[p]=r["x-rbac"],delete r["x-rbac"])}}}};function D(t,r,a){const o={id:"markdown",decorators:{oas2:{markdown:s,rbac:c},oas3:{markdown:s,rbac:c},async3:{markdown:s,rbac:c}}};return{...t,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:a},...t.decorators||{}},plugins:[...t.plugins||[],o]}}export{s as MarkdownParserDecorator,c as RbacDecorator,D as injectDecoratorIntoConfig,g as isPlainNonMarkdownText};
@@ -1 +1 @@
1
- import{join as c}from"path";import{transformSync as l}from"esbuild";import{REDOCLY_ROUTE_RBAC as p}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{logger as u}from"../../tools/notifiers/logger.js";import{envConfig as g}from"../../config/env-config.js";import{USER_DEFINED_API_FUNCTIONS_COUNTER_KEY as h}from"../../../server/store.js";import{parseRouteFsPathForHono as F}from"./helpers/parse-route-fs-path-for-hono.js";import{telemetryTraceStep as A}from"../../../cli/telemetry/helpers/trace-step.js";const f="api-functions",P=/\bexport\s+default\b|\bexport\s*\{[^}]*\b(?:default\s*[,}]|\w+\s+as\s+default\b)/;async function E(t,o){let r;try{r=await o.fs.read(t),l(r,{loader:t.endsWith(".js")?"js":"ts"})}catch(e){const a=e instanceof Error?e.message:String(e);return u.warn(`Skipping API function ${t} because it cannot be parsed: ${a}`),!1}if(!P.test(r)){const e=`API function ${t} does not export a default function. Add 'export default function (request, context) { ... }' to define an API function.`;return g.isDevelopMode?(u.warn(e),!0):(u.warn(`Skipping ${e}`),!1)}return!0}function R(t){return m(d(t))}function I(t){return`^${R(t)}`}function b(t){const o=t.map(I);return o.push(".*@api"),new RegExp(`(${o.join("|")})/.*.(ts|js)$`)}async function H(){return{id:"ApiFunctions",requiredEntitlements:["apiFunctions"],async processContent(t,o){await A("com.redocly.build.plugin.apiFunctions",async r=>{const e=await o.getConfig();r?.setAttribute("config",JSON.stringify(e.apiFunctions||{}));const a=b(e.apiFunctions?.folders||[]),s=[];for(const n of o.fs.scan(a)){if(n.isVirtual)continue;const i=F(n.relativePath);i&&await E(n.relativePath,o)&&s.push({requestHandlerId:`${f}:${i.handler}`,fullPath:c(t.contentDir,i.handler),slug:i.path,httpMethod:i.method,fsPath:n.relativePath})}t.clearRequestHandlersByPrefix(`${f}:`);for(const n of s)t.createRequestHandler(n.requestHandlerId,n.fullPath),t.addApiRoute({requestHandlerId:n.requestHandlerId,slug:n.slug,fsPath:n.fsPath,httpMethod:n.httpMethod,[p]:{fsPath:n.fsPath,slug:n.slug}});r?.setAttribute("definedApiFunctions",String(s.length)),t.setGlobalConfig({[h]:s.length})})}}}export{f as API_FUNCTIONS_REQUEST_HANDLER_ID,H as apiFunctionsPlugin};
1
+ import{join as c}from"path";import{transformSync as l}from"esbuild";import{REDOCLY_ROUTE_RBAC as p}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{logger as u}from"../../tools/notifiers/logger.js";import{envConfig as g}from"../../config/env-config.js";import{USER_DEFINED_API_FUNCTIONS_COUNTER_KEY as h}from"../../../server/store.js";import{parseRouteFsPathForHono as F}from"./helpers/parse-route-fs-path-for-hono.js";import{telemetryTraceStep as A}from"../../../cli/telemetry/helpers/trace-step.js";const f="api-functions",P=/\bexport\s+default\b|\bexport\s*\{[^}]*\b(?:default\s*[,}]|\w+\s+as\s+default\b)/;async function E(t,o){let r;try{r=await o.fs.read(t),l(r,{loader:t.endsWith(".js")?"js":"ts"})}catch(e){const a=e instanceof Error?e.message:String(e);return u.warn(`Skipping API function ${t} because it cannot be parsed: ${a}`),!1}if(!P.test(r)){const e=`API function ${t} does not export a default function. Add 'export default function (request, context) { ... }' to define an API function.`;return g.isDevelopMode?(u.warn(e),!0):(u.warn(`Skipping ${e}`),!1)}return!0}function R(t){return m(d(t))}function I(t){return`^${R(t)}`}function b(t){const o=t.map(I);return o.push(".*@api"),new RegExp(`(${o.join("|")})/.*\\.(ts|js)$`)}async function H(){return{id:"ApiFunctions",requiredEntitlements:["apiFunctions"],async processContent(t,o){await A("com.redocly.build.plugin.apiFunctions",async r=>{const e=await o.getConfig();r?.setAttribute("config",JSON.stringify(e.apiFunctions||{}));const a=b(e.apiFunctions?.folders||[]),s=[];for(const n of o.fs.scan(a)){if(n.isVirtual)continue;const i=F(n.relativePath);i&&await E(n.relativePath,o)&&s.push({requestHandlerId:`${f}:${i.handler}`,fullPath:c(t.contentDir,i.handler),slug:i.path,httpMethod:i.method,fsPath:n.relativePath})}t.clearRequestHandlersByPrefix(`${f}:`);for(const n of s)t.createRequestHandler(n.requestHandlerId,n.fullPath),t.addApiRoute({requestHandlerId:n.requestHandlerId,slug:n.slug,fsPath:n.fsPath,httpMethod:n.httpMethod,[p]:{fsPath:n.fsPath,slug:n.slug}});r?.setAttribute("definedApiFunctions",String(s.length)),t.setGlobalConfig({[h]:s.length})})}}}export{f as API_FUNCTIONS_REQUEST_HANDLER_ID,H as apiFunctionsPlugin};
@@ -1 +1 @@
1
- import{and as u,desc as v,eq as n,isNull as c,sql as d}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersions as h}from"../../../utils/version-compare.js";import{VersionRepository as m}from"./version-repository.js";import{buildSemanticVersionSortExpr as C}from"../utils/semantic-version-sort.js";import{normalizeRevisionFlags as y}from"../utils/normalize-revision-flags.js";class g{#i;#e;constructor(i){this.#e=i,this.#i=new m(i)}async getCurrentRevisionInfo({key:i,version:t,revision:r}){const o=await this.#t(i);if(!o)return{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!1};if(t){const a=await this.#i.doesVersionExist(i,t),s=h(t,o.version)>0,l=o.version===f&&t!==f;if(!a&&(s||l))return{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!0}}return t&&r&&t===o.version&&r>=o.revision?{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!0}:{shouldSetNewCurrentRevision:!1,hasCurrentRevision:!0}}async markAllRevisionsAsNotCurrent(i){await this.#e.client.update(e).set({isCurrent:!1}).where(n(e.key,i)).run()}async ensureDefaultAndCurrentRevisionForKey(i){const t=await this.#i.getOrderedVersionListForKey(i),r=this.#i.getLatestVersion(t);r&&await this.#e.client.update(e).set({isDefaultVersion:!0,isCurrent:!0}).where(u(n(e.key,i),n(e.revision,r.revision),r.version?n(e.version,r.version):c(e.version))).run()}async shouldSkipRevisionCreation(i,t,r,o,a){if(o||a)return!1;const s=await this.#e.client.select({hash:e.hash,isDeleted:e.isDeleted}).from(e).where(u(n(e.key,i),t?n(e.version,t):c(e.version))).orderBy(v(e.revision)).limit(1).get();return!s||!!s.isDeleted?!1:s.hash===r}async#t(i){return await this.#e.client.select({version:e.version,revision:e.revision}).from(e).where(u(n(e.key,i),n(e.isCurrent,!0))).orderBy(v(e.revision)).limit(1).get()??null}async listEntityRevisions(i,t){const r=[n(e.key,i),n(e.isDeleted,!1),...t?[n(e.version,t)]:[]],a=(await this.#e.client.select({version:e.version,revision:e.revision,isCurrent:e.isCurrent,createdAt:e.createdAt,updatedAt:e.updatedAt,isDefaultVersion:e.isDefaultVersion}).from(e).where(u(...r)).orderBy(d`${C("version")} DESC`,d.raw("revision DESC")).all()).map(s=>({version:s.version,revision:s.revision??"",isCurrent:s.isCurrent!==null?s.isCurrent:!1,createdAt:s.createdAt,updatedAt:s.updatedAt,isDefaultVersion:s.isDefaultVersion!==null?s.isDefaultVersion:!1}));return y(a),a}}export{g as RevisionRepository};
1
+ import{and as u,desc as v,eq as n,isNull as c,sql as d}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersions as h}from"../../../../../../utils/version/compare-versions.js";import{VersionRepository as m}from"./version-repository.js";import{buildSemanticVersionSortExpr as C}from"../utils/semantic-version-sort.js";import{normalizeRevisionFlags as y}from"../utils/normalize-revision-flags.js";class g{#i;#e;constructor(i){this.#e=i,this.#i=new m(i)}async getCurrentRevisionInfo({key:i,version:t,revision:r}){const o=await this.#t(i);if(!o)return{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!1};if(t){const a=await this.#i.doesVersionExist(i,t),s=h(t,o.version)>0,l=o.version===f&&t!==f;if(!a&&(s||l))return{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!0}}return t&&r&&t===o.version&&r>=o.revision?{shouldSetNewCurrentRevision:!0,hasCurrentRevision:!0}:{shouldSetNewCurrentRevision:!1,hasCurrentRevision:!0}}async markAllRevisionsAsNotCurrent(i){await this.#e.client.update(e).set({isCurrent:!1}).where(n(e.key,i)).run()}async ensureDefaultAndCurrentRevisionForKey(i){const t=await this.#i.getOrderedVersionListForKey(i),r=this.#i.getLatestVersion(t);r&&await this.#e.client.update(e).set({isDefaultVersion:!0,isCurrent:!0}).where(u(n(e.key,i),n(e.revision,r.revision),r.version?n(e.version,r.version):c(e.version))).run()}async shouldSkipRevisionCreation(i,t,r,o,a){if(o||a)return!1;const s=await this.#e.client.select({hash:e.hash,isDeleted:e.isDeleted}).from(e).where(u(n(e.key,i),t?n(e.version,t):c(e.version))).orderBy(v(e.revision)).limit(1).get();return!s||!!s.isDeleted?!1:s.hash===r}async#t(i){return await this.#e.client.select({version:e.version,revision:e.revision}).from(e).where(u(n(e.key,i),n(e.isCurrent,!0))).orderBy(v(e.revision)).limit(1).get()??null}async listEntityRevisions(i,t){const r=[n(e.key,i),n(e.isDeleted,!1),...t?[n(e.version,t)]:[]],a=(await this.#e.client.select({version:e.version,revision:e.revision,isCurrent:e.isCurrent,createdAt:e.createdAt,updatedAt:e.updatedAt,isDefaultVersion:e.isDefaultVersion}).from(e).where(u(...r)).orderBy(d`${C("version")} DESC`,d.raw("revision DESC")).all()).map(s=>({version:s.version,revision:s.revision??"",isCurrent:s.isCurrent!==null?s.isCurrent:!1,createdAt:s.createdAt,updatedAt:s.updatedAt,isDefaultVersion:s.isDefaultVersion!==null?s.isDefaultVersion:!1}));return y(a),a}}export{g as RevisionRepository};
@@ -1 +1 @@
1
- import{eq as a,and as u,desc as c}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersionsDescending as m}from"../../../utils/version-compare.js";class p{db;constructor(t){this.db=t}async markAllVersionsAsNotDefault(t){await this.db.client.update(e).set({isDefaultVersion:!1}).where(u(a(e.key,t),a(e.isDefaultVersion,!0))).run()}async doesVersionExist(t,n){return await this.db.client.select().from(e).where(u(a(e.key,t),a(e.version,n))).get()!==void 0}async getOrderedVersionListForKey(t){return(await this.db.client.select({version:e.version,isDefaultVersion:e.isDefaultVersion,revision:e.revision,createdAt:e.createdAt}).from(e).where(u(a(e.key,t))).orderBy(c(e.createdAt)).all()).map(i=>({version:i.version,isDefaultVersion:!!i.isDefaultVersion,revision:i.revision,createdAt:new Date(i.createdAt)}))}getLatestVersion(t){const n=t.find(r=>r.isDefaultVersion);if(n)return n;const{versionedEntities:i,unversionedEntities:d}=t.reduce((r,s)=>(s.version!==null&&s.version!==f?r.versionedEntities.push(s):r.unversionedEntities.push(s),r),{versionedEntities:[],unversionedEntities:[]});if(i.length>0){i.sort((o,l)=>m(o.version,l.version));const r=i[0].version,s=i.filter(o=>o.version===r);return s.sort((o,l)=>l.createdAt.getTime()-o.createdAt.getTime()),s[0]}return d.length>0?(d.sort((r,s)=>s.createdAt.getTime()-r.createdAt.getTime()),d[0]):null}}export{p as VersionRepository};
1
+ import{eq as a,and as u,desc as c}from"drizzle-orm";import{VERSION_NOT_SPECIFIED as f}from"@redocly/theme/core/constants";import{entitiesTable as e}from"../../../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{compareVersions as m}from"../../../../../../utils/version/compare-versions.js";class A{db;constructor(t){this.db=t}async markAllVersionsAsNotDefault(t){await this.db.client.update(e).set({isDefaultVersion:!1}).where(u(a(e.key,t),a(e.isDefaultVersion,!0))).run()}async doesVersionExist(t,n){return await this.db.client.select().from(e).where(u(a(e.key,t),a(e.version,n))).get()!==void 0}async getOrderedVersionListForKey(t){return(await this.db.client.select({version:e.version,isDefaultVersion:e.isDefaultVersion,revision:e.revision,createdAt:e.createdAt}).from(e).where(u(a(e.key,t))).orderBy(c(e.createdAt)).all()).map(i=>({version:i.version,isDefaultVersion:!!i.isDefaultVersion,revision:i.revision,createdAt:new Date(i.createdAt)}))}getLatestVersion(t){const n=t.find(r=>r.isDefaultVersion);if(n)return n;const{versionedEntities:i,unversionedEntities:d}=t.reduce((r,s)=>(s.version!==null&&s.version!==f?r.versionedEntities.push(s):r.unversionedEntities.push(s),r),{versionedEntities:[],unversionedEntities:[]});if(i.length>0){i.sort((o,l)=>m(l.version,o.version));const r=i[0].version,s=i.filter(o=>o.version===r);return s.sort((o,l)=>l.createdAt.getTime()-o.createdAt.getTime()),s[0]}return d.length>0?(d.sort((r,s)=>s.createdAt.getTime()-r.createdAt.getTime()),d[0]):null}}export{A as VersionRepository};