@redocly/realm 0.135.0 → 0.136.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/cli/build/analytics/collect-analytics.js +1 -1
- package/dist/cli/build/analytics/collectors/get-skills-usage.d.ts +3 -0
- package/dist/cli/build/analytics/collectors/get-skills-usage.js +1 -0
- package/dist/client/templates/openapi-docs/helpers.js +1 -1
- package/dist/constants/common.d.ts +8 -0
- package/dist/constants/common.js +1 -1
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/helpers/enhance-context.d.ts +3 -1
- package/dist/server/api-routes/helpers/enhance-context.js +1 -1
- package/dist/server/api-routes/helpers/is-mock-server.d.ts +2 -0
- package/dist/server/api-routes/helpers/is-mock-server.js +1 -0
- package/dist/server/api-routes/mock-server/kv-state-store.d.ts +3 -0
- package/dist/server/api-routes/mock-server/kv-state-store.js +1 -0
- package/dist/server/api-routes/mock-server/mock-js-executor.d.ts +3 -0
- package/dist/server/api-routes/mock-server/mock-js-executor.js +13 -0
- package/dist/server/config/env-config.d.ts +4 -0
- package/dist/server/config/env-schema.d.ts +10 -0
- package/dist/server/config/env-schemas/catalog.d.ts +3 -0
- package/dist/server/config/env-schemas/catalog.js +1 -1
- package/dist/server/config/env-schemas/feature-flags.d.ts +4 -0
- package/dist/server/config/env-schemas/feature-flags.js +1 -1
- package/dist/server/constants/plugins/search.d.ts +1 -2
- package/dist/server/constants/plugins/search.js +1 -1
- package/dist/server/esbuild/plugins/on-rebuild.js +1 -1
- package/dist/server/fs/fs.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-diff-publisher.d.ts +27 -0
- package/dist/server/plugins/catalog-entities/database/catalog-entities-diff-publisher.js +12 -0
- package/dist/server/plugins/catalog-entities/database/catalog-entities-publisher.js +1 -12
- package/dist/server/plugins/catalog-entities/database/catalog-entities-revisions-pruner.d.ts +20 -0
- package/dist/server/plugins/catalog-entities/database/catalog-entities-revisions-pruner.js +42 -0
- package/dist/server/plugins/catalog-entities/database/consts.d.ts +5 -0
- package/dist/server/plugins/catalog-entities/database/consts.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/plugin.js +1 -1
- package/dist/server/plugins/config-parser/loaders/redocly-config-loader.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/mcp/{docs-mcp/codemode → codemode}/build-tool-type-declarations.d.ts +1 -1
- package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.d.ts +4 -0
- package/dist/server/plugins/mcp/codemode/capabilities/fetch/index.js +4 -0
- package/dist/server/plugins/mcp/codemode/capabilities/index.d.ts +3 -0
- package/dist/server/plugins/mcp/codemode/capabilities/index.js +1 -0
- package/dist/server/plugins/mcp/codemode/capabilities/registry.d.ts +4 -0
- package/dist/server/plugins/mcp/codemode/capabilities/registry.js +1 -0
- package/dist/server/plugins/mcp/codemode/capabilities/types.d.ts +13 -0
- package/dist/server/plugins/mcp/codemode/capabilities/utils.d.ts +13 -0
- package/dist/server/plugins/mcp/codemode/capabilities/utils.js +7 -0
- package/dist/server/plugins/mcp/codemode/constants.d.ts +8 -0
- package/dist/server/plugins/mcp/codemode/constants.js +1 -0
- package/dist/server/plugins/mcp/codemode/invoke-tool.d.ts +4 -0
- package/dist/server/plugins/mcp/codemode/invoke-tool.js +1 -0
- package/dist/server/plugins/mcp/codemode/prompts.d.ts +6 -0
- package/dist/server/plugins/mcp/codemode/prompts.js +4 -0
- package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.d.ts +10 -0
- package/dist/server/plugins/mcp/codemode/sandbox/create-sandbox-setup.js +11 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills.d.ts +2 -0
- package/dist/server/plugins/mcp/codemode/sandbox/polyfills.js +99 -0
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.d.ts +7 -0
- package/dist/server/plugins/mcp/codemode/tools/describe-tools.js +1 -0
- package/dist/server/plugins/mcp/codemode/tools/execute-schema.d.ts +5 -0
- package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -0
- package/dist/server/plugins/mcp/codemode/tools/execute.js +1 -0
- package/dist/server/plugins/mcp/codemode/types.d.ts +16 -0
- package/dist/server/plugins/mcp/codemode/types.js +0 -0
- package/dist/server/plugins/mcp/constants.d.ts +2 -0
- package/dist/server/plugins/mcp/constants.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +0 -4
- package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/openapi/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +30 -0
- package/dist/server/plugins/mcp/gateway-mcp/eligibility.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.d.ts +13 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.d.ts +12 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/fetch-bridge.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.d.ts +9 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch/ssrf-guard.js +1 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.d.ts +6 -0
- package/dist/server/plugins/mcp/gateway-mcp/fetch-capability.js +1 -0
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/errors.d.ts +3 -21
- package/dist/server/plugins/mcp/handlers/errors.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +5 -10
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -3
- package/dist/server/plugins/mcp/servers/mcp-server.d.ts +18 -0
- package/dist/server/plugins/mcp/servers/mcp-server.js +1 -0
- package/dist/server/plugins/mcp/types.d.ts +23 -8
- package/dist/server/plugins/mcp/utils/mode.d.ts +7 -0
- package/dist/server/plugins/mcp/utils/mode.js +1 -0
- package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +12 -60
- package/dist/server/plugins/mcp/utils/xmcp-utils.js +1 -1
- package/dist/server/plugins/mcp/utils.d.ts +8 -0
- package/dist/server/plugins/mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/workers/execute-mcp-tool.js +1 -1
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.d.ts +15 -3
- package/dist/server/plugins/mcp/workers/mcp-tool-telemetry.js +1 -1
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/search/engines/search-engine.d.ts +2 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/skills/discover-skills.d.ts +17 -0
- package/dist/server/plugins/skills/discover-skills.js +1 -0
- package/dist/server/plugins/skills/index.d.ts +3 -0
- package/dist/server/plugins/skills/index.js +1 -0
- package/dist/server/plugins/skills/utils/parse-skill.d.ts +18 -0
- package/dist/server/plugins/skills/utils/parse-skill.js +1 -0
- package/dist/server/plugins/sso/index.js +1 -1
- package/dist/server/sandbox/constants/host-functions.d.ts +3 -0
- package/dist/server/sandbox/constants/host-functions.js +1 -0
- package/dist/server/sandbox/constants/sandbox.d.ts +6 -0
- package/dist/server/sandbox/constants/sandbox.js +1 -0
- package/dist/server/sandbox/sandbox.d.ts +8 -0
- package/dist/server/sandbox/sandbox.js +3 -0
- package/dist/server/sandbox/types.d.ts +24 -0
- package/dist/server/sandbox/types.js +0 -0
- package/dist/server/sandbox/utils/eval-guest-code.d.ts +15 -0
- package/dist/server/sandbox/utils/eval-guest-code.js +1 -0
- package/dist/server/sandbox/utils/execution-budget.d.ts +11 -0
- package/dist/server/sandbox/utils/execution-budget.js +1 -0
- package/dist/server/sandbox/utils/setup-host-functions.d.ts +18 -0
- package/dist/server/sandbox/utils/setup-host-functions.js +5 -0
- package/dist/server/store.d.ts +4 -0
- package/dist/server/store.js +1 -1
- package/dist/server/types/plugins/common.d.ts +3 -0
- package/dist/server/types/plugins/search.d.ts +0 -1
- package/dist/server/types/plugins/skills.d.ts +16 -0
- package/dist/server/types/plugins/skills.js +0 -0
- package/dist/server/utils/cookie.d.ts +3 -0
- package/dist/server/utils/cookie.js +1 -1
- package/dist/server/utils/fetch-with-client.d.ts +10 -0
- package/dist/server/utils/fetch-with-client.js +1 -0
- package/dist/server/utils/skills/can-access-skill.d.ts +9 -0
- package/dist/server/utils/skills/can-access-skill.js +1 -0
- package/dist/server/utils/skills/get-accessible-skills.d.ts +5 -0
- package/dist/server/utils/skills/get-accessible-skills.js +1 -0
- package/dist/server/utils/skills/get-skill-url.d.ts +2 -0
- package/dist/server/utils/skills/get-skill-url.js +1 -0
- package/dist/server/web-server/auth.js +4 -4
- package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
- package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
- package/dist/server/web-server/middleware/corsMiddleware.d.ts +1 -0
- package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
- package/dist/server/web-server/middleware/ensureSearchData.js +1 -1
- package/dist/server/web-server/routes/ask-ai.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/catalog/helpers/create-entity-schema.d.ts +305 -256
- package/dist/server/web-server/routes/catalog/helpers/create-entity-update-schema.d.ts +46 -39
- package/dist/server/web-server/routes/catalog/helpers/upsert-pages-stats.js +1 -1
- package/dist/server/web-server/routes/feedback.js +1 -1
- package/dist/server/web-server/routes/health.js +1 -1
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/a2a.d.ts +10 -0
- package/dist/server/web-server/routes/mcp-routes/a2a.js +1 -0
- package/dist/server/web-server/routes/mcp-routes/agent-card.d.ts +4 -0
- package/dist/server/web-server/routes/mcp-routes/agent-card.js +1 -0
- package/dist/server/web-server/routes/mcp-routes/constants.d.ts +14 -0
- package/dist/server/web-server/routes/mcp-routes/constants.js +1 -0
- package/dist/server/web-server/routes/mcp-routes/mcp-routes.d.ts +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-routes.js +1 -1
- package/dist/server/web-server/routes/mcp-routes/mcp-server-card.d.ts +4 -0
- package/dist/server/web-server/routes/mcp-routes/mcp-server-card.js +1 -0
- package/dist/server/web-server/routes/mcp-routes/types.d.ts +34 -0
- package/dist/server/web-server/routes/mcp-routes/types.js +0 -0
- package/dist/server/web-server/routes/mcp-routes/utils/build-agent-card.d.ts +10 -0
- package/dist/server/web-server/routes/mcp-routes/utils/build-agent-card.js +1 -0
- package/dist/server/web-server/routes/page-data.js +1 -1
- package/dist/server/web-server/routes/semantic-search.js +1 -1
- package/dist/server/web-server/routes/skills/build-skills-index.d.ts +4 -0
- package/dist/server/web-server/routes/skills/build-skills-index.js +1 -0
- package/dist/server/web-server/routes/skills/constants.d.ts +4 -0
- package/dist/server/web-server/routes/skills/constants.js +1 -0
- package/dist/server/web-server/routes/skills/skill-markdown.d.ts +4 -0
- package/dist/server/web-server/routes/skills/skill-markdown.js +1 -0
- package/dist/server/web-server/routes/skills/skills-index.d.ts +4 -0
- package/dist/server/web-server/routes/skills/skills-index.js +1 -0
- package/dist/server/web-server/routes/skills/skills-routes.d.ts +4 -0
- package/dist/server/web-server/routes/skills/skills-routes.js +1 -0
- package/dist/server/web-server/routes/skills/types.d.ts +12 -0
- package/dist/server/web-server/routes/skills/types.js +0 -0
- package/dist/server/web-server/utils/resolve-public-base-url.d.ts +4 -0
- package/dist/server/web-server/utils/resolve-public-base-url.js +1 -0
- package/dist/server/web-server/utils.js +1 -1
- package/dist/server/workers/api-routes-worker-pool.js +1 -1
- package/dist/server/workers/mcp-tool-worker-pool.js +1 -1
- package/dist/server/workers/scorecards-worker-pool.js +1 -1
- package/dist/server/workers/worker-pool.d.ts +1 -0
- package/dist/server/workers/worker-pool.js +1 -1
- package/package.json +10 -10
- package/dist/server/plugins/mcp/docs-mcp/codemode/prompts.d.ts +0 -5
- package/dist/server/plugins/mcp/docs-mcp/codemode/prompts.js +0 -4
- package/dist/server/plugins/mcp/docs-mcp/codemode/sandbox.d.ts +0 -3
- package/dist/server/plugins/mcp/docs-mcp/codemode/sandbox.js +0 -7
- package/dist/server/plugins/mcp/docs-mcp/codemode/types.d.ts +0 -9
- package/dist/server/plugins/mcp/docs-mcp/tools/execute.js +0 -1
- package/dist/server/plugins/mcp/mode.d.ts +0 -9
- package/dist/server/plugins/mcp/mode.js +0 -1
- /package/dist/server/plugins/mcp/{docs-mcp/codemode → codemode}/build-tool-type-declarations.js +0 -0
- /package/dist/server/plugins/mcp/{docs-mcp/codemode → codemode/capabilities}/types.js +0 -0
- /package/dist/server/plugins/mcp/{docs-mcp → codemode}/tools/execute.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @redocly/realm
|
|
2
2
|
|
|
3
|
+
## 0.136.0-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 42547a5a76a: Improved rendering of schema property examples: object and array example values are now displayed as pretty-printed JSON with syntax highlighting and a copy button, instead of a single-line text string.
|
|
8
|
+
- Updated dependencies [42547a5a76a]
|
|
9
|
+
- @redocly/openapi-docs@3.24.0-next.1
|
|
10
|
+
- @redocly/asyncapi-docs@1.13.0-next.1
|
|
11
|
+
- @redocly/graphql-docs@1.13.0-next.1
|
|
12
|
+
- @redocly/portal-plugin-mock-server@0.21.0-next.1
|
|
13
|
+
|
|
14
|
+
## 0.136.0-next.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- a749e28ae3c: Added support for agent skills placed under the `@skills` folder.
|
|
19
|
+
- a749e28ae3c: Added support for A2A agent card and MCP server card.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 56e4931831a: Allowed the `redocly` special value in the `access.idps` config option to offer the standard Redocly login (email/password and Social Login providers) alongside specific identity providers.
|
|
24
|
+
- 6e91bb8a540: Fixed SSO logout to require re-authentication with the identity provider, preventing automatic login immediately after logout.
|
|
25
|
+
Session expiry continues to re-authenticate silently.
|
|
26
|
+
- d05d0e5d302: Updated `@redocly/openapi-core` to version `2.39.0`.
|
|
27
|
+
- Updated dependencies [7630938561e]
|
|
28
|
+
- Updated dependencies [83d149073d]
|
|
29
|
+
- Updated dependencies [d05d0e5d302]
|
|
30
|
+
- Updated dependencies [a749e28ae3c]
|
|
31
|
+
- @redocly/theme@0.68.0-next.0
|
|
32
|
+
- @redocly/openapi-docs@3.24.0-next.0
|
|
33
|
+
- @redocly/realm-asyncapi-sdk@0.14.0-next.0
|
|
34
|
+
- @redocly/asyncapi-docs@1.13.0-next.0
|
|
35
|
+
- @redocly/graphql-docs@1.13.0-next.0
|
|
36
|
+
- @redocly/portal-plugin-mock-server@0.21.0-next.0
|
|
37
|
+
|
|
3
38
|
## 0.135.0
|
|
4
39
|
|
|
5
40
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getApiFunctionsUsage as f}from"./collectors/get-api-functions-usage.js";import{getAsyncApiUsage as
|
|
1
|
+
import{getApiFunctionsUsage as f}from"./collectors/get-api-functions-usage.js";import{getAsyncApiUsage as c}from"./collectors/get-async-api-usage.js";import{getConfigStatsUsage as U}from"./collectors/get-config-stats-usage.js";import{getFileExtensionsUsage as d}from"./collectors/get-file-extensions-usage.js";import{getFrontmatterUsage as p}from"./collectors/get-frontmatter-usage.js";import{getMarkdocUsage as u}from"./collectors/get-markdoc-usage.js";import{getNestedConfigsUsage as S}from"./collectors/get-nested-configs-usage.js";import{getProcessedConfigStatsUsage as C}from"./collectors/get-processed-config-stats-usage.js";import{getRefsUsage as x}from"./collectors/get-refs-usage.js";import{getSkillsUsage as y}from"./collectors/get-skills-usage.js";import{getThemeFolderUsage as k}from"./collectors/get-theme-folder-usage.js";import{telemetry as v}from"../../telemetry/index.js";async function O(i,r){const g=[f,c,U,d,p,u,S,C,x,y,k],n=await Promise.allSettled(g.map(t=>t({store:i,context:r}))),e={},s={};for(const t of n)if(t.status==="fulfilled"){const{name:o,value:a,version:l}=t.value;a&&(e[o]=a,s[o]=l)}const m={usageStats:e.usageStats,asyncApiUsage:e.asyncApiUsage,buildContext:e.buildContext,fileExtensions:e.fileExtensions,frontmatterUsage:e.frontmatterUsage,markdocUsage:e.markdocUsage,processedBuildContext:e.processedBuildContext,nestedConfigStats:e.nestedConfigStats,refsUsageStats:e.refsUsageStats,skillsUsage:e.skillsUsage,themeFolderUsage:e.themeFolderUsage,versions:JSON.stringify(s)};v.sendBuildMessage(m)}export{O as collectAnalytics};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"node:path";import{stat as n}from"node:fs/promises";import{AGENT_CARD_SLUG as s}from"../../../../constants/common.js";import{PUBLIC_STATIC_FOLDER as o}from"../../../../server/constants/common.js";const g=async({store:t})=>{const i=t.getSkills().length.toString(),r=await a(e.join(t.contentDir,o,...s.split("/").filter(Boolean)));return{version:"1",name:"skillsUsage",value:JSON.stringify({skills:i,agentCardOverride:r})}};async function a(t){try{return(await n(t)).isFile()}catch{return!1}}export{g as getSkillsUsage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useMemo as f}from"react";import{components as
|
|
1
|
+
import{useMemo as f}from"react";import{components as d}from"@redocly-markdoc/components";import{schema as c}from"@redocly-markdoc/schema";import{Ast as g}from"@markdoc/markdoc";import{PageNavigation as h}from"@redocly/theme/components/PageNavigation/PageNavigation";import{tags as _,components as y}from"@redocly/theme/markdoc/default";import{Breadcrumbs as P}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{withPathPrefix as m}from"@redocly/theme/core/utils";import{ServerRoutes as u}from"../../../constants/api.js";import{OPENAPI_DOCS_TEMPLATE_ID as w}from"../../../constants/common.js";import{isBrowser as S}from"../../../utils/env/is-browser.js";import*as O from"../../../markdoc/nodes/index.js";import v from"../../../markdoc/tags/index.js";import{normalizeCustomTags as C}from"../../../markdoc/helpers/normalize-custom-tags.js";import*as T from"../../app/markdoc/custom-components/index.js";import{usePageData as x,useSidebarSiblingsData as A}from"../../providers/page-data/hooks";import{telemetry as E}from"../../app/telemetry/index.js";import{getMockServerDocsConfig as R}from"./mock-server-config.js";function X(o="",r="",t="/"){return o.endsWith(t)&&(o=o.slice(0,-t.length)),r.startsWith(t)&&(r=r.slice(t.length)),!o||!r?o+r:o+t+r}function b(o){if(o)return Object.entries(o).reduce((r,[t,n])=>(r[t]=g.fromJSON(JSON.stringify(n)),r),{})}function Z(o,{markdown:r,baseSlug:t}){return f(()=>{const i=S();if(o.options.oAuth2RedirectURI=i?`${window.location.origin}${m(u.REPLAY_OAUTH2_CALLBACK)}`:void 0,o.options.routingBasePath=m(t),o.options.mockServer=R(o.options.mockServer,t),o.options.corsProxyUrl===void 0){const e=m(`${u.CORS_PROXY}/`);o.options.corsProxyUrl=i?new URL(e,window.location.origin).toString():e}o.options.scrollYOffset=i?parseInt(getComputedStyle(document.documentElement).getPropertyValue("--navbar-height"),10):0,o.options.markdocOptions={tags:{...v,..._,...C(c?.tags??{})},nodes:{...O,...c?.nodes??{}},functions:{...c?.functions??{}},components:{...T,...y,...d,...globalThis.__LOADER.markdocComponents},...r,partials:b(r?.partials)},o.options.unstable_hooks={...o.options.unstable_hooks,MiddlePanelFooter:()=>{const{templateId:e}=x()||{},{nextPage:s,prevPage:a}=A()||{};return e===w?null:h({nextPage:s,prevPage:a})},MiddlePanelHeader:()=>P({})};const l={codeSamplesLanguageSwitch:"samples_language_switch",codeSamplesCopy:"code_samples_copy",panelToggle:"panel_toggle",targetServerSwitch:"target_server_switch",tryItOpen:"try_it_toggle",tryItSent:"try_it_sent"},p={};for(const[e,s]of Object.entries(l)){const a=U(o.options.events?.[e]);p[e]=F(a,s)}return o.options.events=p,o},[o,r,t])}function U(o){if(typeof window>"u")return null;if(typeof o=="function")return o;if(typeof o!="string")return null;try{const r=o.trim();if(!r.match(/^(\([^)]*\)\s*=>\s*.+|[a-zA-Z_$][\w$]*\s*=>\s*.+)$/))throw new Error("Invalid function format. Only arrow functions allowed.");if(["eval","Function","constructor","prototype","__proto__","import","require","process","global","window","document"].some(i=>r.includes(i)))throw new Error("Function contains prohibited keywords");return new Function("event",`
|
|
2
2
|
'use strict';
|
|
3
3
|
const userFn = ${r};
|
|
4
4
|
return userFn(event);
|
|
@@ -6,6 +6,7 @@ export declare const AuthCookieNames: {
|
|
|
6
6
|
readonly FEDERATED_ACCESS_TOKEN: 'federated_access_token';
|
|
7
7
|
readonly FEDERATED_ID_TOKEN: 'federated_id_token';
|
|
8
8
|
};
|
|
9
|
+
export declare const POST_LOGOUT_COOKIE_NAME = "post_logout";
|
|
9
10
|
export declare const OPENAPI_DOCS_TEMPLATE_ID = "openapi_docs";
|
|
10
11
|
export declare const ASYNC_API_DOCS_TEMPLATE_ID = "asyncapi_docs";
|
|
11
12
|
export declare const GRAPHQL_TEMPLATE_ID = "graphql_docs";
|
|
@@ -18,6 +19,7 @@ export declare const PUBLIC_RBAC_SCOPE_ITEM: {
|
|
|
18
19
|
};
|
|
19
20
|
export declare const REQUIRED_OIDC_SCOPES: string[];
|
|
20
21
|
export declare const DEFAULT_COOKIE_EXPIRATION: number;
|
|
22
|
+
export declare const POST_LOGOUT_COOKIE_EXPIRATION: number;
|
|
21
23
|
export declare const DEFAULT_ANONYMOUS_VISITOR_TEAM = "anonymous";
|
|
22
24
|
export declare const DEFAULT_AUTHENTICATED_TEAM = "authenticated";
|
|
23
25
|
export declare const DEFAULT_RBAC_SCOPE = "**";
|
|
@@ -26,6 +28,12 @@ export declare const TRANSLATIONS_FILE_NAME = "translations.yaml";
|
|
|
26
28
|
export declare const CONFIG_FILE_NAME = "redocly.yaml";
|
|
27
29
|
export declare const DEFAULT_THEME_NAME = "@redocly/theme";
|
|
28
30
|
export declare const USER_THEME_ALIAS = "@theme";
|
|
31
|
+
export declare const USER_SKILLS_ALIAS = "@skills";
|
|
32
|
+
export declare const USER_SKILL_FILENAME = "SKILL.md";
|
|
33
|
+
export declare const AGENT_SKILLS_BASE = "/.well-known/agent-skills";
|
|
34
|
+
export declare const AGENT_CARD_SLUG = "/.well-known/agent-card.json";
|
|
35
|
+
export declare const A2A_SLUG = "/a2a";
|
|
36
|
+
export declare const MCP_SERVER_CARD_SLUG = "/.well-known/mcp/server-card.json";
|
|
29
37
|
export declare const GLOBAL_DATA_URL = "/app-data.json";
|
|
30
38
|
export declare const EJECT_COMPONENT_URL = "/eject-component";
|
|
31
39
|
export declare enum cliCommandNames {
|
package/dist/constants/common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a={AUTHORIZATION:"authorization",IDP_ID_TOKEN:"idp_id_token",IDP_ACCESS_TOKEN:"idp_access_token",FEDERATED_ACCESS_TOKEN:"federated_access_token",FEDERATED_ID_TOKEN:"federated_id_token"},n="post_logout",_="openapi_docs",E="asyncapi_docs",p="graphql_docs",A="/_spec-gql",i="markdoc",S="tags",c="*",L={[c]:"read"},O=["openid","email"],d=1440*60,I=720*60*60,T="anonymous",R="authenticated",l="**",C="Reunite",x="translations.yaml",P="redocly.yaml",D="@redocly/theme",N="@theme",m="@skills",U="SKILL.md",u="/.well-known/agent-skills",g="/.well-known/agent-card.json",M="/a2a",h="/.well-known/mcp/server-card.json",F="/app-data.json",b="/eject-component";var t;(function(o){o.BUILD="build",o.DEVELOP="develop",o.PREPARE="prepare"})(t||(t={}));var e;(function(o){o.RATING="rating",o.SENTIMENT="sentiment",o.COMMENT="comment",o.MOOD="mood",o.PROBLEM="problem",o.SCALE="scale"})(e||(e={}));var r;(function(o){o.AI_SEARCH="aiSearch"})(r||(r={}));const k="/login",v="/invite",G={AUTH0_PASS:"/auth/auth0-pass"},H={NotExist:"ENOENT"},y="default_locale",K="sidebar-",B="PUBLIC_",w="branch.",V=["BROKEN_LINK","MARKDOC","RESOLVE"],f=["logo","navbar","products","footer","sidebar","scripts","links","feedback","search","aiAssistant","colorMode","palette","navigation","codeSnippet","markdown","openapi","graphql","analytics","userMenu","versionPicker","breadcrumbs","catalog","entitiesCatalog","scorecard","scorecards","scorecardClassic","mcp","banner"],s="redocly_category",j="redocly_product",q="redocly_version",X="redocly_teams",Q=s,W={asyncapi:"asyncapi",apiFunctions:"apiFunctions",reactPages:"reactPages",catalog:"catalog",catalogClassic:"catalogClassic",lint:"lint",scorecard:"scorecard",scorecards:"scorecards",l10n:"l10n",openapi:"openapi",graphql:"graphql",markdown:"markdown",devOnboarding:"devOnboarding",seo:"seo",redirects:"redirects",customPlugins:"customPlugins",themeEjecting:"themeEjecting",products:"products",breadcrumbs:"breadcrumbs",mockServer:"mockServer",sso:"sso",rbac:"rbac",analytics:"analytics",removeAttribution:"removeAttribution",advancedSearch:"advancedSearch",soap:"soap",ssoDirect:"ssoDirect",codeWalkthrough:"codeWalkthrough",aiSearchLimit:"aiSearchLimit",kvStorageLimit:"kvStorageLimit",mcp:"mcp",banner:"banner"};export{M as A2A_SLUG,g as AGENT_CARD_SLUG,u as AGENT_SKILLS_BASE,E as ASYNC_API_DOCS_TEMPLATE_ID,a as AuthCookieNames,w as BRANCH_ENV_PREFIX,P as CONFIG_FILE_NAME,i as CUSTOM_MARKDOC_OPTIONS_PATH,S as CUSTOM_MARKDOC_TAGS_PATH,T as DEFAULT_ANONYMOUS_VISITOR_TEAM,R as DEFAULT_AUTHENTICATED_TEAM,d as DEFAULT_COOKIE_EXPIRATION,y as DEFAULT_LOCALE_PLACEHOLDER,l as DEFAULT_RBAC_SCOPE,C as DEFAULT_SSO_IDP_TITLE,D as DEFAULT_THEME_NAME,k as DEV_LOGIN_SLUG,b as EJECT_COMPONENT_URL,G as ExternalRoutes,W as FEATURE,e as FEEDBACK_TYPES,H as FsErrors,F as GLOBAL_DATA_URL,A as GRAPHQL_SPEC_SLUG,p as GRAPHQL_TEMPLATE_ID,v as INVITE_SLUG,V as MARKDOC_ERROR_TYPES,h as MCP_SERVER_CARD_SLUG,_ as OPENAPI_DOCS_TEMPLATE_ID,I as POST_LOGOUT_COOKIE_EXPIRATION,n as POST_LOGOUT_COOKIE_NAME,B as PUBLIC_ENV_PREFIX,L as PUBLIC_RBAC_SCOPE_ITEM,c as RBAC_ALL_OTHER_TEAMS,O as REQUIRED_OIDC_SCOPES,r as RbacFeatures,s as SEARCH_CATEGORY_FIELD,Q as SEARCH_GROUP_FACET_FIELD,j as SEARCH_PRODUCT_FIELD,X as SEARCH_RBAC_FIELD,q as SEARCH_VERSION_FIELD,K as SIDEBAR_PREFIX,x as TRANSLATIONS_FILE_NAME,f as UI_ACCESSIBLE_CONFIG_PROPS,m as USER_SKILLS_ALIAS,U as USER_SKILL_FILENAME,N as USER_THEME_ALIAS,t as cliCommandNames};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Hono as
|
|
1
|
+
import{Hono as l}from"hono";import{TrieRouter as f}from"hono/router/trie-router";import{Logger as d}from"../tools/notifiers/logger.js";import{envConfig as a}from"../config/env-config.js";import{importApiRoutesHandler as m}from"./import-api-routes-handlers.js";import{getBodyWithSizeCheck as g}from"./helpers/get-body-with-size-check.js";import{setupLogger as w}from"./helpers/setup-logger.js";import{telemetry as c}from"../telemetry/index.js";import{KvService as D}from"../persistence/kv/services/kv-service.js";import{enhanceContext as R,enhanceMockServerContext as p}from"./helpers/enhance-context.js";import{isMockServerRoute as q}from"./helpers/is-mock-server.js";const u=new d,h=8e3,v=100;async function z(e){c.initialize(),w(u,e.requestHandlerId);const n=await A(e),r=await H(e,n).request(e.req.url,e.req),t=await g(r,e.maxResponseSizeMB);return{status:r.status,headers:Object.fromEntries(r.headers.entries()),body:t}}async function A(e){return(await(await M(e))()).default}function H(e,n){const o=new l({router:new f}),r=y(e.requestHandlerId);return o.all(e.slug,async t=>{if(typeof n!="function")return E(e,t);const i=r({honoCtx:t,ctx:e.ctxData,telemetry:c,getKv:()=>x(e),slug:e.slug}),s=await n(t.req.raw,i,e.staticData);return s instanceof Response?s:typeof s=="string"?t.text(s):t.json(s)}),o.onError((t,i)=>{if(u.error(`[${e.requestHandlerId}] ${t.message} ${t.stack}`),t instanceof SyntaxError)return i.text(t.message,500);throw t}),o}function y(e){return q(e)?p:R}function x(e){return D.getInstance({baseDbDir:e.serverOutDir,sqldRemoteDatabaseUrl:e.sqldRemoteDatabaseUrl,sqldRemoteDatabaseAuthToken:e.sqldRemoteDatabaseAuthToken})}function E(e,n){const o=`API function "${e.slug}" does not export a default function. Add 'export default function (request, context) { ... }' to the file.`;return u.error(`[${e.requestHandlerId}] ${o}`),a.isDevelopMode?n.text(o,500):n.newResponse(null,404)}async function M(e){const n=Date.now()+(a.isDevelopMode?h:0);let o;for(;;){try{const{requestHandlers:r}=await m(e.serverOutDir),t=r?.[e.requestHandlerId];if(typeof t=="function")return t;o=new Error(`Request handler "${e.requestHandlerId}" is not available yet.`)}catch(r){o=r}if(Date.now()>=n)throw o;await new Promise(r=>setTimeout(r,v))}}export{z as executeApiRoute};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AsyncApiRealmAPI } from '@redocly/realm-asyncapi-sdk';
|
|
2
|
-
import type { ApiFunctionsContext, KvService } from '@redocly/config';
|
|
2
|
+
import type { ApiFunctionsContext, KvService, MockServerRouteContext } from '@redocly/config';
|
|
3
3
|
import type { Context } from 'hono';
|
|
4
4
|
import type { ApiFunctionsBasicContext } from '../../types';
|
|
5
5
|
export type EnhanceContextParams = {
|
|
@@ -7,6 +7,8 @@ export type EnhanceContextParams = {
|
|
|
7
7
|
ctx: ApiFunctionsBasicContext;
|
|
8
8
|
telemetry?: AsyncApiRealmAPI.Telemetry;
|
|
9
9
|
getKv: () => Promise<KvService>;
|
|
10
|
+
slug?: string;
|
|
10
11
|
};
|
|
11
12
|
export declare const enhanceContext: ({ honoCtx, ctx, telemetry, getKv, }: EnhanceContextParams) => ApiFunctionsContext;
|
|
13
|
+
export declare function enhanceMockServerContext(params: EnhanceContextParams): MockServerRouteContext;
|
|
12
14
|
//# sourceMappingURL=enhance-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{deleteCookie as
|
|
1
|
+
import{deleteCookie as p,getCookie as k,setCookie as g}from"hono/cookie";import{createQuickJsMockExecutor as q}from"../mock-server/mock-js-executor.js";import{createKvStateStore as b}from"../mock-server/kv-state-store.js";const j=new Set([101,103,204,205,304]),a=e=>e!==void 0&&j.has(e),A=({honoCtx:e,ctx:l,telemetry:d,getKv:m})=>{const c=e.req.routePath,f=e.req.param(),S=Object.fromEntries(Object.entries(f).map(([t,r])=>{if(r&&(c.includes(`/:${t}{.*}`)||c.includes(`/:${t}{.+}`))){const o=r.split("/").filter(Boolean);return[t,o.length?o:void 0]}return[t,r]}));let n;const u=t=>{n=t,e.status(t)},s={...e.res,status:t=>(u(t),s),json:t=>a(n)?e.body(null):e.json(t),text:(t,r)=>(r&&u(r),a(n)?e.body(null):e.text(t)),redirect:(t,r=302)=>e.redirect(t,r),setCookie:(t,r,i)=>(g(e,t,r,i),s),deleteCookie:t=>(p(e,t),s)};return{...l,...s,params:S,query:e.req.query()||{},cookies:k(e),telemetry:d,getKv:m}};function P(e){return{...A(e),executor:q(),store:b(e.getKv,["mock",String(e.slug??"default")])}}export{A as enhanceContext,P as enhanceMockServerContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{MOCK_SERVER_REQUEST_HANDLER_ID as o}from"@redocly/portal-plugin-mock-server";function t(r){return r===o}export{t as isMockServerRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=7200;function k(a,i=["mock"]){const s=t=>[...i,...t];return{async get(t){return(await a()).get(s(t))},async set(t,e,n){await(await a()).set(s(t),e,{ttlInSeconds:n?.ttlSeconds??7200})},async delete(t){await(await a()).delete(s(t))},async list(t,e){const n=await a(),{items:l,total:o,cursor:r}=await n.list({prefix:s(t)},{limit:e?.limit,cursor:e?.cursor});return{items:l.filter(c=>c.value!==null).map(c=>({key:c.key.slice(i.length),value:c.value})),total:o,cursor:r}}}}export{k as createKvStateStore};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{runInSandbox as f}from"../../sandbox/sandbox.js";import{setupHostFunctions as p}from"../../sandbox/utils/setup-host-functions.js";import{evalGuestCode as m}from"../../sandbox/utils/eval-guest-code.js";const i="state",g=15e3;function E(r){const o=r?.timeoutMs,s=r?.maxLifetimeMs??g;return{async run(n,e,t){const{result:a,error:u}=await f(n,{setupContext:(c,d)=>{const l=p(c,M(e.state),{globalName:i,budget:d});return m(c,b(e.request)),l},timeoutMs:t?.timeoutMs??o,maxLifetimeMs:t?.maxLifetimeMs??s});if(u!==void 0)throw new Error(`Mock snippet execution failed: ${u}`);return a}}}function M(r){const o=e=>{const t=typeof e=="object"&&e!==null&&"resource"in e?e.resource:void 0;if(typeof t!="string"||t==="")throw new Error(`Mock snippet passed an invalid resource to ctx.state: expected a non-empty string, got ${typeof t}`);return t},s=e=>{const t=typeof e=="object"&&e!==null&&"id"in e?e.id:void 0;if(typeof t!="string"&&typeof t!="number")throw new Error(`Mock snippet passed an invalid id to ctx.state: expected a string or number, got ${typeof t}`);return t},n=e=>{const t=typeof e=="object"&&e!==null&&"value"in e?e.value:void 0;if(t===void 0)throw new Error(`Mock snippet passed an invalid value to ctx.state: expected a defined JSON value, got ${typeof t}`);return t};return{get(e){return r.get(o(e),s(e))},list(e){return r.list(o(e))},set(e){return r.set(o(e),s(e),n(e))},delete(e){return r.delete(o(e),s(e))}}}function b(r){return`(() => {
|
|
2
|
+
const state = globalThis[${JSON.stringify(i)}];
|
|
3
|
+
delete globalThis[${JSON.stringify(i)}];
|
|
4
|
+
globalThis.ctx = Object.freeze({
|
|
5
|
+
request: ${x(r)},
|
|
6
|
+
state: Object.freeze({
|
|
7
|
+
get: (resource, id) => state.get({ resource, id }),
|
|
8
|
+
list: (resource) => state.list({ resource }),
|
|
9
|
+
set: (resource, id, value) => state.set({ resource, id, value }),
|
|
10
|
+
delete: (resource, id) => state.delete({ resource, id }),
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
})();`}function x(r){return JSON.stringify(r).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}export{E as createQuickJsMockExecutor};
|
|
@@ -53,6 +53,7 @@ declare function loadEnvConfig(): {
|
|
|
53
53
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
54
54
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
55
55
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
56
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
56
57
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
57
58
|
SEARCH_DEV_DEBUG: boolean;
|
|
58
59
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -65,6 +66,7 @@ declare function loadEnvConfig(): {
|
|
|
65
66
|
SQLD_REMOTE_DATABASE_URL?: string | undefined;
|
|
66
67
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN?: string | undefined;
|
|
67
68
|
FORCE_CATALOG_CACHE_REVALIDATE?: boolean | undefined;
|
|
69
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
68
70
|
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
69
71
|
OTEL_TRACES_URL?: string | undefined;
|
|
70
72
|
REQUEST_ID?: string | undefined;
|
|
@@ -132,6 +134,7 @@ export declare const envConfig: {
|
|
|
132
134
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
133
135
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
134
136
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
137
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
135
138
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
136
139
|
SEARCH_DEV_DEBUG: boolean;
|
|
137
140
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -144,6 +147,7 @@ export declare const envConfig: {
|
|
|
144
147
|
SQLD_REMOTE_DATABASE_URL?: string | undefined;
|
|
145
148
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN?: string | undefined;
|
|
146
149
|
FORCE_CATALOG_CACHE_REVALIDATE?: boolean | undefined;
|
|
150
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
147
151
|
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
148
152
|
OTEL_TRACES_URL?: string | undefined;
|
|
149
153
|
REQUEST_ID?: string | undefined;
|
|
@@ -57,6 +57,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
57
57
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL: z.ZodOptional<z.ZodString>;
|
|
58
58
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
59
59
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
60
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
60
61
|
} & {
|
|
61
62
|
SEARCH_DEV_REINIT: z.ZodOptional<z.ZodString>;
|
|
62
63
|
SEARCH_DEV_DEBUG: z.ZodEffects<z.ZodDefault<z.ZodEnum<["true", "false"]>>, boolean, "false" | "true" | undefined>;
|
|
@@ -73,6 +74,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
73
74
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN: z.ZodOptional<z.ZodString>;
|
|
74
75
|
} & {
|
|
75
76
|
FORCE_CATALOG_CACHE_REVALIDATE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
77
|
+
CATALOG_MAX_REVISIONS: z.ZodOptional<z.ZodNumber>;
|
|
76
78
|
} & {
|
|
77
79
|
SCORECARDS_POLLING_INTERVAL_MS: z.ZodOptional<z.ZodString>;
|
|
78
80
|
} & {
|
|
@@ -133,6 +135,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
133
135
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
134
136
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
135
137
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
138
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
136
139
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
137
140
|
SEARCH_DEV_DEBUG: boolean;
|
|
138
141
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -145,6 +148,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
145
148
|
SQLD_REMOTE_DATABASE_URL?: string | undefined;
|
|
146
149
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN?: string | undefined;
|
|
147
150
|
FORCE_CATALOG_CACHE_REVALIDATE?: boolean | undefined;
|
|
151
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
148
152
|
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
149
153
|
OTEL_TRACES_URL?: string | undefined;
|
|
150
154
|
REQUEST_ID?: string | undefined;
|
|
@@ -202,6 +206,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
202
206
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
203
207
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
204
208
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
209
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: "false" | "true" | undefined;
|
|
205
210
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
206
211
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
207
212
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -214,6 +219,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
214
219
|
SQLD_REMOTE_DATABASE_URL?: string | undefined;
|
|
215
220
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN?: string | undefined;
|
|
216
221
|
FORCE_CATALOG_CACHE_REVALIDATE?: "false" | "true" | undefined;
|
|
222
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
217
223
|
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
218
224
|
OTEL_TRACES_URL?: string | undefined;
|
|
219
225
|
REQUEST_ID?: string | undefined;
|
|
@@ -271,6 +277,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
271
277
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
272
278
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
273
279
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
280
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
274
281
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
275
282
|
SEARCH_DEV_DEBUG: boolean;
|
|
276
283
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -283,6 +290,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
283
290
|
SQLD_REMOTE_DATABASE_URL?: string | undefined;
|
|
284
291
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN?: string | undefined;
|
|
285
292
|
FORCE_CATALOG_CACHE_REVALIDATE?: boolean | undefined;
|
|
293
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
286
294
|
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
287
295
|
OTEL_TRACES_URL?: string | undefined;
|
|
288
296
|
REQUEST_ID?: string | undefined;
|
|
@@ -340,6 +348,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
340
348
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
341
349
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
342
350
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
351
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: "false" | "true" | undefined;
|
|
343
352
|
SEARCH_DEV_REINIT?: string | undefined;
|
|
344
353
|
SEARCH_DEV_DEBUG?: "false" | "true" | undefined;
|
|
345
354
|
TYPESENSE_API_URL?: string | undefined;
|
|
@@ -352,6 +361,7 @@ export declare const envSchema: z.ZodEffects<z.ZodObject<{
|
|
|
352
361
|
SQLD_REMOTE_DATABASE_URL?: string | undefined;
|
|
353
362
|
SQLD_REMOTE_DATABASE_AUTH_TOKEN?: string | undefined;
|
|
354
363
|
FORCE_CATALOG_CACHE_REVALIDATE?: "false" | "true" | undefined;
|
|
364
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
355
365
|
SCORECARDS_POLLING_INTERVAL_MS?: string | undefined;
|
|
356
366
|
OTEL_TRACES_URL?: string | undefined;
|
|
357
367
|
REQUEST_ID?: string | undefined;
|
|
@@ -4,9 +4,12 @@ import { z } from 'zod';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const catalogSchema: z.ZodObject<{
|
|
6
6
|
FORCE_CATALOG_CACHE_REVALIDATE: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
7
|
+
CATALOG_MAX_REVISIONS: z.ZodOptional<z.ZodNumber>;
|
|
7
8
|
}, "strip", z.ZodTypeAny, {
|
|
8
9
|
FORCE_CATALOG_CACHE_REVALIDATE?: boolean | undefined;
|
|
10
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
9
11
|
}, {
|
|
10
12
|
FORCE_CATALOG_CACHE_REVALIDATE?: "false" | "true" | undefined;
|
|
13
|
+
CATALOG_MAX_REVISIONS?: number | undefined;
|
|
11
14
|
}>;
|
|
12
15
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"zod";import{envBooleanStringOptional as t}from"../../utils/envs/env-boolean-string.js";const
|
|
1
|
+
import{z as o}from"zod";import{envBooleanStringOptional as t}from"../../utils/envs/env-boolean-string.js";const r=o.object({FORCE_CATALOG_CACHE_REVALIDATE:t(),CATALOG_MAX_REVISIONS:o.coerce.number().int().min(0).optional()});export{r as catalogSchema};
|
|
@@ -17,6 +17,8 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
17
17
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT: z.ZodOptional<z.ZodString>;
|
|
18
18
|
/** Experimental: serve the Docs MCP server in codemode (a single `execute` tool). */
|
|
19
19
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
20
|
+
/** Experimental: give the docs MCP `execute` sandbox a guarded `fetch` that can call gateway-eligible APIs. */
|
|
21
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED: z.ZodEffects<z.ZodOptional<z.ZodEnum<["true", "false"]>>, boolean | undefined, "false" | "true" | undefined>;
|
|
20
22
|
}, "strip", z.ZodTypeAny, {
|
|
21
23
|
NEW_CATALOG_ENABLED?: boolean | undefined;
|
|
22
24
|
NEW_SCORECARDS_ENABLED?: boolean | undefined;
|
|
@@ -28,6 +30,7 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
28
30
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
29
31
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
30
32
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: boolean | undefined;
|
|
33
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: boolean | undefined;
|
|
31
34
|
}, {
|
|
32
35
|
NEW_CATALOG_ENABLED?: "false" | "true" | undefined;
|
|
33
36
|
NEW_SCORECARDS_ENABLED?: "false" | "true" | undefined;
|
|
@@ -39,5 +42,6 @@ export declare const featureFlagsSchema: z.ZodObject<{
|
|
|
39
42
|
REDOCLY_EXP_LLMSTXT_AGENT_FEEDBACK_URL?: string | undefined;
|
|
40
43
|
REDOCLY_EXP_LLMSTXT_AGENT_ENDPOINT?: string | undefined;
|
|
41
44
|
REDOCLY_EXP_MCP_CODE_MODE_ENABLED?: "false" | "true" | undefined;
|
|
45
|
+
REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED?: "false" | "true" | undefined;
|
|
42
46
|
}>;
|
|
43
47
|
//# 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
|
|
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_EXP_MCP_CODE_MODE_ENABLED:E(),REDOCLY_EXP_MCP_GATEWAY_SERVER_ENABLED:E()});export{D as featureFlagsSchema};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const DEFAULT_SEARCH_ENGINE: SearchEngineType;
|
|
1
|
+
import type { SearchDocument } from '../../types';
|
|
3
2
|
export declare const SEARCH_INDEX_FIELDS: string[];
|
|
4
3
|
export declare const SEARCH_GROUP_NAME_DOCUMENTATION = "Documentation";
|
|
5
4
|
export declare const SEARCH_GROUP_NAME_API = "API Reference";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_ANONYMOUS_VISITOR_TEAM as e,DEFAULT_AUTHENTICATED_TEAM as t}from"../../../constants/common.js";const _=
|
|
1
|
+
import{DEFAULT_ANONYMOUS_VISITOR_TEAM as e,DEFAULT_AUTHENTICATED_TEAM as t}from"../../../constants/common.js";const _=["title","text","path","httpPath","parameters[]:name","parameters[]:description","parameters[]:place","parameters[]:path"],A="Documentation",o="API Reference",r="search",p=100,T=10,a=20,n=100,s=150,c="ai-search",I=50,S=250,C=Symbol("metadata"),R={id:"",url:"",title:"",text:"",security:[],parameters:[{place:"",mediaType:void 0,name:"",description:"",path:[],type:"object",required:!1,example:void 0,enum:void 0}],rbacTeams:[e,t]},D=!0,H=["title"];export{c as AI_INDEX_EXPORT_FOLDER,I as AI_SEARCH_CHUNK_SIZE,S as AI_SEARCH_DOCUMENT_CHUNK_SIZE,R as BASE_SEARCH_DOCUMENT,D as DEFAULT_AI_SEARCH_ENABLED,H as DISABLE_DEEP_LINK_IF_FIELDS_EXIST,s as HIGHLIGHTED_TEXT_MAX_LENGTH,r as SEARCH_DATA_EXPORT_FOLDER,C as SEARCH_DOCUMENT_METADATA_KEY,T as SEARCH_GROUP_LIMIT,o as SEARCH_GROUP_NAME_API,A as SEARCH_GROUP_NAME_DOCUMENTATION,_ as SEARCH_INDEX_FIELDS,p as SEARCH_LIMIT,a as SEARCH_MAX_FACET_VALUES,n as SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const r=new Map,
|
|
1
|
+
const r=new Map,n=e=>({name:"esbuild-on-rebuild",setup:u=>{const{label:t}=e;r.set(t,0);function a(){return r.get(t)===0}u.onStart(()=>a()?e.buildStart():e.rebuildStart()),u.onEnd(async()=>{a()?await e.buildEnd():await e.rebuildEnd();const l=r.get(t);r.set(t,(l||0)+1)})}});export{n as OnRebuild};
|
package/dist/server/fs/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
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};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DatabaseConnection, PublishRowsResult } from './types';
|
|
2
|
+
export type PublishDiffTableResult = PublishRowsResult & {
|
|
3
|
+
deleted: number;
|
|
4
|
+
};
|
|
5
|
+
export type PublishDiffResult = {
|
|
6
|
+
entities: PublishDiffTableResult;
|
|
7
|
+
relations: PublishDiffTableResult;
|
|
8
|
+
attributes: PublishRowsResult;
|
|
9
|
+
orphanAttributesDeleted: number;
|
|
10
|
+
};
|
|
11
|
+
export declare class CatalogEntitiesDiffPublisher {
|
|
12
|
+
#private;
|
|
13
|
+
static publishDiff({ runId, localConnection, remoteConnection, scopeFiles, chunkSize }: {
|
|
14
|
+
runId: string;
|
|
15
|
+
localConnection: DatabaseConnection;
|
|
16
|
+
remoteConnection: DatabaseConnection;
|
|
17
|
+
/**
|
|
18
|
+
* Source files to converge (changed + removed for delta publishes, the
|
|
19
|
+
* full local file list for full publishes). Files outside this scope are
|
|
20
|
+
* never read or touched on the remote — this preserves the old sweep's
|
|
21
|
+
* "never delete data for files absent from the local snapshot" guarantee.
|
|
22
|
+
*/
|
|
23
|
+
scopeFiles: string[];
|
|
24
|
+
chunkSize: number;
|
|
25
|
+
}): Promise<PublishDiffResult>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=catalog-entities-diff-publisher.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{and as K,eq as L,inArray as w,isNotNull as U,sql as f}from"drizzle-orm";import{logger as H}from"../../../tools/notifiers/logger.js";import{sha1 as M}from"../../../utils/crypto/sha1.js";import{entitiesAttributesTable as S}from"../../../providers/database/databases/sqlite-db/schemas/entities-attributes-table.js";import{entitiesRelationsTable as u}from"../../../providers/database/databases/sqlite-db/schemas/entities-relations-table.js";import{entitiesTable as g}from"../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{BATCH_TRANSIENT_RETRY as k,withTransientErrorRetry as A}from"../../../providers/database/transient-sqld-error.js";import{ATTRIBUTES_UPSERT_SET as $,DELETE_IDS_CHUNK_SIZE as b,ENTITIES_UPSERT_SET as F,MAX_BATCH_PAYLOAD_BYTES as _,MAX_LOGGED_DB_ERROR_LENGTH as v,MIN_RETRYABLE_BATCH_SIZE as J,RELATIONS_UPSERT_SET as V,SCOPE_FILES_BATCH_SIZE as W,SYNC_SCAN_PAGE_SIZE as m}from"./consts.js";class o{static async publishDiff({runId:t,localConnection:s,remoteConnection:i,scopeFiles:n,chunkSize:a}){await A(()=>i.client.sync(),k);const c={entities:{upserted:0,skipped:0,deleted:0},relations:{upserted:0,skipped:0,deleted:0},attributes:{upserted:0,skipped:0},orphanAttributesDeleted:0};for(const r of o.#i(n,W)){const l=await o.#n({runId:t,localConnection:s,remoteConnection:i,filesBatch:r,chunkSize:a});c.entities.upserted+=l.upserted,c.entities.skipped+=l.skipped,c.entities.deleted+=l.deleted;const e=await o.#c({runId:t,localConnection:s,remoteConnection:i,filesBatch:r,chunkSize:a});c.relations.upserted+=e.upserted,c.relations.skipped+=e.skipped,c.relations.deleted+=e.deleted;const d=await o.#a({localConnection:s,remoteConnection:i,filesBatch:r,chunkSize:a});c.attributes.upserted+=d.upserted,c.attributes.skipped+=d.skipped}return c.orphanAttributesDeleted=await o.#o(i),c}static async#n({runId:t,localConnection:s,remoteConnection:i,filesBatch:n,chunkSize:a}){const c=e=>JSON.stringify([e.key,e.source,e.revision,e.version]),r=e=>o.#s([e.organizationId,e.projectId,e.type,e.title,e.summary,e.tags,e.metadata,e.git,e.contact,e.links,e.sourceFile,e.fileHash,e.hash,o.#e(e.isCurrent),o.#e(e.isDefaultVersion),o.#e(e.isDeleted),e.scorecardsStatus]),l=K(L(g.source,"file"),w(g.sourceFile,n));return o.#t({chunkSize:a,selectRemotePage:(e,d)=>i.client.client.select().from(g).where(l).orderBy(f`rowid`).limit(d).offset(e).all(),selectLocalPage:(e,d)=>s.client.client.select().from(g).where(l).orderBy(f`rowid`).limit(d).offset(e).all(),logicalKey:c,digest:r,decorateRow:e=>({...e,lastSeenRunId:t}),runUpsert:async e=>{await i.client.client.insert(g).values(e).onConflictDoUpdate({target:[g.key,g.source,g.revision,g.version],set:F}).run()},runDeleteByIds:e=>i.client.client.delete(g).where(w(g.id,e)),describeSkippedRow:e=>`entity key=${String(e.key)}`})}static async#c({runId:t,localConnection:s,remoteConnection:i,filesBatch:n,chunkSize:a}){const c=e=>JSON.stringify([e.sourceKey,e.targetKey,e.sourceVersion,e.targetVersion,e.sourceRevision,e.targetRevision,e.sourceToTargetRelation]),r=e=>o.#s([e.organizationId,e.projectId,e.targetToSourceRelation,e.sourceFile,e.fileHash,o.#e(e.isDeleted)]),l=K(U(u.sourceFile),w(u.sourceFile,n));return o.#t({chunkSize:a,selectRemotePage:(e,d)=>i.client.client.select().from(u).where(l).orderBy(f`rowid`).limit(d).offset(e).all(),selectLocalPage:(e,d)=>s.client.client.select().from(u).where(l).orderBy(f`rowid`).limit(d).offset(e).all(),logicalKey:c,digest:r,decorateRow:e=>({...e,lastSeenRunId:t}),runUpsert:async e=>{await i.client.client.insert(u).values(e).onConflictDoUpdate({target:[u.sourceKey,u.targetKey,u.sourceVersion,u.targetVersion,u.sourceRevision,u.targetRevision,u.sourceToTargetRelation],set:V}).run()},runDeleteByIds:e=>i.client.client.delete(u).where(w(u.id,e)),describeSkippedRow:e=>{const d=e;return`relation sourceKey=${String(d.sourceKey)} targetKey=${String(d.targetKey)}`}})}static async#a({localConnection:t,remoteConnection:s,filesBatch:i,chunkSize:n}){const a=()=>f`EXISTS (
|
|
2
|
+
SELECT 1
|
|
3
|
+
FROM entities e
|
|
4
|
+
WHERE e.key = ${S.entityKey}
|
|
5
|
+
AND e.source = 'file'
|
|
6
|
+
AND e.source_file IN (${f.join(i.map(r=>f`${r}`),f`, `)})
|
|
7
|
+
)`,c=await o.#t({chunkSize:n,selectRemotePage:(r,l)=>s.client.client.select().from(S).where(a()).orderBy(f`rowid`).limit(l).offset(r).all(),selectLocalPage:(r,l)=>t.client.client.select().from(S).where(a()).orderBy(f`rowid`).limit(l).offset(r).all(),logicalKey:r=>r.entityKey,digest:r=>o.#s([r.organizationId,r.projectId,r.rbacTeams]),runUpsert:async r=>{await s.client.client.insert(S).values(r).onConflictDoUpdate({target:[S.entityKey],set:$}).run()},runDeleteByIds:null});return{upserted:c.upserted,skipped:c.skipped}}static async#t({chunkSize:t,selectRemotePage:s,selectLocalPage:i,logicalKey:n,digest:a,decorateRow:c,runUpsert:r,runDeleteByIds:l,describeSkippedRow:e}){const d=new Map;for(let R=0;;R+=m){const p=await A(()=>s(R,m),k);for(const y of p)d.set(n(y),{id:y.id,digest:a(y),seen:!1});if(p.length<m)break}let I=0,E=0,T=[];const B=async()=>{if(!T.length)return;const R=T;T=[];for(const p of o.#l(R,t,_)){const y=await o.#r({rows:p,runOperation:r,shouldSkipIsolatedRow:e?(h,O)=>o.#u(O)?(H.warn(`Skipping ${e(h)} due to remote insert error: ${o.#p(O)}`),!0):!1:void 0});I+=y.upserted,E+=y.skipped}};for(let R=0;;R+=m){const p=await i(R,m);for(const y of p){const h=d.get(n(y));if(h&&(h.seen=!0,h.digest===a(y))){E+=1;continue}T.push(c?c(y):y),T.length>=t&&await B()}if(p.length<m)break}await B();let N=0;if(l){const R=[];for(const p of d.values())p.seen||R.push(p.id);for(const p of o.#i(R,b))await A(()=>l(p).run(),k),N+=p.length}return{upserted:I,skipped:E,deleted:N}}static async#o(t){const s=await A(()=>t.client.client.delete(S).where(f`NOT EXISTS (
|
|
8
|
+
SELECT 1
|
|
9
|
+
FROM entities e
|
|
10
|
+
WHERE e.key = ${S.entityKey}
|
|
11
|
+
AND COALESCE(e.is_deleted, 0) = 0
|
|
12
|
+
)`).run(),k);return Number(s.rowsAffected??0)}static#e(t){return t==null?null:!!t}static#s(t){return M(JSON.stringify(t))}static#i(t,s){const i=[];for(let n=0;n<t.length;n+=s)i.push(t.slice(n,n+s));return i}static#l(t,s,i){const n=[];let a=[],c=0;for(const r of t){const l=o.#d(r);a.length>0&&(a.length>=s||c+l>i)&&(n.push(a),a=[],c=0),a.push(r),c+=l}return a.length>0&&n.push(a),n}static#d(t){try{return JSON.stringify(t).length}catch{return 0}}static async#r({rows:t,runOperation:s,shouldSkipIsolatedRow:i}){try{return await A(()=>s(t),k),{upserted:t.length,skipped:0}}catch(n){if(t.length<J){if(!i)throw n;if(await i(t[0],n))return{upserted:0,skipped:1};throw n}const a=Math.floor(t.length/2),c=await o.#r({rows:t.slice(0,a),runOperation:s,shouldSkipIsolatedRow:i}),r=await o.#r({rows:t.slice(a),runOperation:s,shouldSkipIsolatedRow:i});return{upserted:c.upserted+r.upserted,skipped:c.skipped+r.skipped}}}static#u(t){if(!(t instanceof Error))return!1;const s=t.message.toLowerCase();return s.includes("code: 11")||s.includes("too many sql variables")||s.includes("string or blob too big")||s.includes("statement too long")||s.includes("request body too large")||s.includes("payload too large")||s.includes("body too large")||s.includes("resource exhausted")}static#p(t){const n=(t instanceof Error?t.message:typeof t=="string"?t:JSON.stringify(t)).split(" params:")[0].replace(/\s+/g," ").trim();return n.length>v?`${n.slice(0,v)}...`:n}}export{o as CatalogEntitiesDiffPublisher};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import{and as
|
|
2
|
-
SELECT 1
|
|
3
|
-
FROM entities e
|
|
4
|
-
WHERE e.key = ${p.entityKey}
|
|
5
|
-
AND e.source = 'file'
|
|
6
|
-
AND e.source_file IN (${w.join(a.map(u=>w`${u}`),w`, `)})
|
|
7
|
-
)`:void 0).limit(c).offset(i).all(),runUpsert:async i=>{await n.client.client.insert(p).values(i).onConflictDoUpdate({target:[p.entityKey],set:M}).run()}})}static#e(e){return Array.isArray(e)&&e.length>0?e:void 0}static async#t({chunkSize:e,sourceFilesFilter:t,selectRows:n,decorateRow:r,runUpsert:s,describeSkippedRow:a}){if(t==="none")return{upserted:0,skipped:0};let i=0,c=0,u=0;for(;;){const f=await n(i,e);if(!f.length)return{upserted:c,skipped:u};const h=r?f.map(m=>r(m)):f;for(const m of o.#S(h,e,V)){const S=await o.#s({rows:m,runOperation:s,shouldSkipIsolatedRow:a?(R,y)=>o.#T(y)?(A.warn(`Skipping ${a(R)} due to remote insert error: ${o.#o(y)}`),!0):!1:void 0});c+=S.upserted,u+=S.skipped}i+=e}}static async#F({runId:e,remoteConnection:t,sourceFilesFilter:n}){if(n==="none")return{staleEntitiesDeleted:0,staleRelationsDeleted:0,orphanAttributesDeleted:0};const r=t.client.client,s=o.#e(n),a=await o.#r(()=>r.delete(d).where(F(v(d.sourceFile),s?T(d.sourceFile,s):void 0,g(N(d.lastSeenRunId),$(d.lastSeenRunId,e)))).run()),i=await o.#r(()=>r.delete(l).where(F(D(l.source,"file"),s?T(l.sourceFile,s):void 0,g(N(l.lastSeenRunId),$(l.lastSeenRunId,e)))).run()),c=await o.#r(()=>r.delete(p).where(w`NOT EXISTS (
|
|
8
|
-
SELECT 1
|
|
9
|
-
FROM entities e
|
|
10
|
-
WHERE e.key = ${p.entityKey}
|
|
11
|
-
AND COALESCE(e.is_deleted, 0) = 0
|
|
12
|
-
)`).run());return{staleEntitiesDeleted:i,staleRelationsDeleted:a,orphanAttributesDeleted:c}}static async#w(e){const n=(await e.client.client.selectDistinct({sourceFile:l.sourceFile}).from(l).where(F(D(l.source,"file"),v(l.sourceFile))).all()).map(({sourceFile:r})=>r).filter(r=>!!r);return n.length===0?"none":n}static async#r(e){const t=await o.#c(e);return Number(t.rowsAffected??0)}static#S(e,t,n){const r=[];let s=[],a=0;for(const i of e){const c=o.#R(i);s.length>0&&(s.length>=t||a+c>n)&&(r.push(s),s=[],a=0),s.push(i),a+=c}return s.length>0&&r.push(s),r}static#R(e){try{return JSON.stringify(e).length}catch{return 0}}static async#s({rows:e,runOperation:t,shouldSkipIsolatedRow:n}){try{return await o.#c(()=>t(e)),{upserted:e.length,skipped:0}}catch(r){if(e.length<x){if(!n)throw r;if(await n(e[0],r))return{upserted:0,skipped:1};throw r}const s=Math.floor(e.length/2),a=await o.#s({rows:e.slice(0,s),runOperation:t,shouldSkipIsolatedRow:n}),i=await o.#s({rows:e.slice(s),runOperation:t,shouldSkipIsolatedRow:n});return{upserted:a.upserted+i.upserted,skipped:a.skipped+i.skipped}}}static#T(e){if(!(e instanceof Error))return!1;const t=e.message.toLowerCase();return t.includes("code: 11")||t.includes("too many sql variables")||t.includes("string or blob too big")||t.includes("statement too long")||t.includes("request body too large")||t.includes("payload too large")||t.includes("body too large")||t.includes("resource exhausted")}static#o(e){const n=(e instanceof Error?e.message:typeof e=="string"?e:JSON.stringify(e)).split(" params:")[0],s=o.#A(n).replace(/\s+/g," ").trim();return s.length>O?`${s.slice(0,O)}...`:s}static#A(e){const t="Failed query:",n=e.indexOf(t);if(n===-1)return e;const r=e.slice(0,n).trim();return r?`${r}. ${t} <omitted for brevity>`:`${t} <omitted for brevity>`}static#c(e){return K(e,H)}}export{o as CatalogEntitiesPublisher};
|
|
1
|
+
import{and as T,eq as k,isNotNull as D}from"drizzle-orm";import{ulid as v}from"ulid";import{logger as c}from"../../../tools/notifiers/logger.js";import{DatabaseConnectionFactory as R}from"../../../providers/database/database-connection-factory.js";import{entitiesTable as u}from"../../../providers/database/databases/sqlite-db/schemas/entities-table.js";import{BATCH_TRANSIENT_RETRY as E,withTransientErrorRetry as g}from"../../../providers/database/transient-sqld-error.js";import{envConfig as l}from"../../../config/env-config.js";import{DEFAULT_CHUNK_SIZE as A,MAX_LOGGED_DB_ERROR_LENGTH as $}from"./consts.js";import{CatalogEntitiesDiffPublisher as L}from"./catalog-entities-diff-publisher.js";import{INTERNAL_CATALOG_PUBLISH_KEY_PREFIX as P,RemotePublishLockService as f}from"./remote-publish-lock-service.js";const w=`${P}::last-successful-publish`;class i{static async publishFromLocalToRemote(t){const e=v();if(l.isDevelopMode||!l.isProductionEnv)return{runId:e,published:!1,shouldFinalizeFileHashes:!0};const{baseDbDir:s,chunkSize:r=A,changedSourceFiles:n=[],removedSourceFiles:h=[]}=t,[d,a]=await Promise.all([R.create({baseDbDir:s,databaseType:"local"}),R.create({baseDbDir:s,databaseType:"remote"})]);if(!d||!a)return c.warn("Skipping entities remote sync: local or remote connection is unavailable"),{runId:e,published:!1,shouldFinalizeFileHashes:!1};const p="changedSourceFiles"in t||"removedSourceFiles"in t,m=Array.from(new Set([...n,...h]));if(p&&m.length===0)return{runId:e,published:!0,shouldFinalizeFileHashes:!0};const F=p?m:await i.#c(d),I=await f.runUnderRemotePublishLock({runId:e,remoteConnection:a,run:async()=>{await g(()=>a.client.sync(),E);const b=i.#o(),y=await i.#t({remoteConnection:a,token:b});if(!y.shouldPublish)return c.info(`Publishing entities to the database skipped: ${y.reason}`),!1;try{if(F!=="none"){const o=await L.publishDiff({runId:e,localConnection:d,remoteConnection:a,scopeFiles:F,chunkSize:r});c.info(`Entities publish diff: entities upserted=${o.entities.upserted} unchanged=${o.entities.skipped} deleted=${o.entities.deleted}, relations upserted=${o.relations.upserted} unchanged=${o.relations.skipped} deleted=${o.relations.deleted}, attributes upserted=${o.attributes.upserted} unchanged=${o.attributes.skipped}, orphan attributes deleted=${o.orphanAttributesDeleted}`)}return await i.#s({runId:e,remoteConnection:a,token:b}),!0}catch(o){const S=i.#u(o);throw c.error(`Failed to publish entities to the database: ${S}`),new Error(`[CatalogEntitiesPublisher.publishFromLocalToRemote] Failed runId=${e}. ${S}`,{cause:o instanceof Error?o:void 0})}}});return{runId:e,published:I,shouldFinalizeFileHashes:!0}}static async#t({remoteConnection:t,token:e}){if(!e)return{shouldPublish:!0};const s=i.#e(),r=await f.getInternalCacheValue({remoteConnection:t,key:s});if(!r)return{shouldPublish:!0};const n=i.#r(r);return n?i.#a(e,n.token)<0?{shouldPublish:!1,reason:`Freshness gate blocked stale publish: current ${e.source}="${e.value}" is older than latest successful ${n.token.source}="${n.token.value}" recordedAt=${n.recordedAt}.`}:{shouldPublish:!0}:{shouldPublish:!0}}static async#s({runId:t,remoteConnection:e,token:s}){if(!s)return;const r=i.#e(),n=JSON.stringify({runId:t,recordedAt:new Date().toISOString(),token:s});await f.upsertInternalCacheValue({remoteConnection:e,key:r,value:n,ttl:null})}static#e(){const t=l.PUBLIC_REDOCLY_BRANCH_NAME?.trim();return t?`${w}::branch::${t}`:`${w}::default`}static#r(t){try{const e=JSON.parse(t);return typeof e.runId!="string"||typeof e.recordedAt!="string"||!i.#n(e.token)?null:{runId:e.runId,recordedAt:e.recordedAt,token:e.token}}catch{return null}}static#n(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.value=="string"&&e.source==="PROJECT_BUILD_ID"}static#o(){const t=[{source:"PROJECT_BUILD_ID",value:l.PROJECT_BUILD_ID}];for(const e of t){const s=e.value?.trim();if(!s)continue;const r=i.#i(s);if(r)return{source:e.source,value:r}}return null}static#i(t){return t.match(/[0-9A-HJKMNP-TV-Z]{26}/i)?.[0]?.toUpperCase()??null}static#a(t,e){return t.value===e.value?0:t.value>e.value?1:-1}static async#c(t){const s=(await t.client.client.selectDistinct({sourceFile:u.sourceFile}).from(u).where(T(k(u.source,"file"),D(u.sourceFile))).all()).map(({sourceFile:r})=>r).filter(r=>!!r);return s.length===0?"none":s}static#u(t){const s=(t instanceof Error?t.message:typeof t=="string"?t:JSON.stringify(t)).split(" params:")[0],n=i.#l(s).replace(/\s+/g," ").trim();return n.length>$?`${n.slice(0,$)}...`:n}static#l(t){const e="Failed query:",s=t.indexOf(e);if(s===-1)return t;const r=t.slice(0,s).trim();return r?`${r}. ${e} <omitted for brevity>`:`${e} <omitted for brevity>`}}export{i as CatalogEntitiesPublisher};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DatabaseConnection } from './types';
|
|
2
|
+
export type PruneLocalRevisionsResult = {
|
|
3
|
+
prunedEntities: number;
|
|
4
|
+
prunedRelations: number;
|
|
5
|
+
affectedSourceFiles: string[];
|
|
6
|
+
vacuumed: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare class CatalogEntitiesRevisionsPruner {
|
|
9
|
+
#private;
|
|
10
|
+
static pruneLocalRevisions({ localConnection, maxRevisions, vacuumThreshold }: {
|
|
11
|
+
localConnection: DatabaseConnection;
|
|
12
|
+
maxRevisions: number;
|
|
13
|
+
vacuumThreshold?: number;
|
|
14
|
+
}): Promise<PruneLocalRevisionsResult>;
|
|
15
|
+
static confirmPrunedFiles({ localConnection, sourceFiles }: {
|
|
16
|
+
localConnection: DatabaseConnection;
|
|
17
|
+
sourceFiles: string[];
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=catalog-entities-revisions-pruner.d.ts.map
|