@redocly/realm 0.134.0-next.1 → 0.134.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/client/app/utils/getBlocksHeight.d.ts +5 -14
  3. package/dist/client/app/utils/getBlocksHeight.js +1 -1
  4. package/dist/client/app/utils/loadAndNavigate.js +1 -1
  5. package/dist/client/app/utils/syncScrollWithEditor.js +1 -1
  6. package/dist/client/providers/hooks.js +1 -1
  7. package/dist/client/templates/asyncapi-docs/helpers.d.ts +3 -13
  8. package/dist/compiled/svgo/svgo-node.js +55 -49
  9. package/dist/constants/common.d.ts +1 -0
  10. package/dist/constants/common.js +1 -1
  11. package/dist/markdoc/tags/index.d.ts +30 -0
  12. package/dist/markdoc/types.d.ts +2 -2
  13. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  14. package/dist/server/config/env-config.d.ts +6 -0
  15. package/dist/server/config/env-schema.d.ts +149 -2
  16. package/dist/server/config/env-schema.js +1 -1
  17. package/dist/server/config/env-schemas/feature-flags.d.ts +12 -0
  18. package/dist/server/config/env-schemas/feature-flags.js +1 -1
  19. package/dist/server/constants/feedback.d.ts +2 -0
  20. package/dist/server/constants/feedback.js +1 -1
  21. package/dist/server/node-bundle-entry.js +1 -1
  22. package/dist/server/persistence/cache/repositories/cache-repository.js +1 -1
  23. package/dist/server/persistence/file-hashes/repositories/file-hashes-repository.js +1 -1
  24. package/dist/server/persistence/kv/repositories/kv-repository.d.ts +1 -1
  25. package/dist/server/persistence/kv/repositories/kv-repository.js +2 -2
  26. package/dist/server/persistence/kv/services/kv-service.d.ts +3 -2
  27. package/dist/server/persistence/kv/services/kv-service.js +1 -1
  28. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +2 -1
  29. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  30. package/dist/server/plugins/catalog-entities/database/repositories/catalog-entities-repository.d.ts +1 -4
  31. package/dist/server/plugins/catalog-entities/database/repositories/catalog-entities-repository.js +1 -1
  32. package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-read-repository.js +1 -1
  33. package/dist/server/plugins/catalog-entities/database/repositories/entities/entities-write-repository.js +1 -1
  34. package/dist/server/plugins/entitlements/utils/get-billed-catalog-build-pages-count.js +1 -1
  35. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  36. package/dist/server/plugins/markdown/search/create-render-tag-fn.d.ts +4 -0
  37. package/dist/server/plugins/markdown/search/create-render-tag-fn.js +1 -0
  38. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +7 -8
  39. package/dist/server/plugins/markdown/search/join-section-content.d.ts +3 -0
  40. package/dist/server/plugins/markdown/search/join-section-content.js +2 -0
  41. package/dist/server/plugins/markdown/search/nodes/heading-node.d.ts +1 -7
  42. package/dist/server/plugins/markdown/search/nodes/section-node.d.ts +2 -14
  43. package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
  44. package/dist/server/plugins/markdown/search/nodes/tag-node.d.ts +1 -7
  45. package/dist/server/plugins/markdown/search/walk-sections.d.ts +3 -1
  46. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  47. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.d.ts +2 -2
  48. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +30 -30
  49. package/dist/server/plugins/scorecards/database/repositories/scorecards-config-repository.d.ts +4 -0
  50. package/dist/server/plugins/scorecards/database/repositories/scorecards-config-repository.js +1 -1
  51. package/dist/server/plugins/scorecards/database/scorecards-config-service.d.ts +4 -4
  52. package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
  53. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +3 -1
  54. package/dist/server/providers/database/base-service.d.ts +25 -0
  55. package/dist/server/providers/database/base-service.js +1 -0
  56. package/dist/server/providers/database/database-preconnect-service.js +1 -1
  57. package/dist/server/providers/database/instance-cache-resolver.d.ts +19 -0
  58. package/dist/server/providers/database/instance-cache-resolver.js +1 -0
  59. package/dist/server/store.d.ts +2 -34
  60. package/dist/server/types/plugins/common.d.ts +5 -0
  61. package/dist/server/types/plugins/markdown.d.ts +3 -0
  62. package/dist/server/utils/is-api-download-link.d.ts +2 -0
  63. package/dist/server/utils/is-api-download-link.js +1 -0
  64. package/dist/server/utils/is-realm-or-reef.d.ts +2 -0
  65. package/dist/server/utils/is-realm-or-reef.js +1 -0
  66. package/dist/server/utils/llmstxt/agent-feedback-llms-footer.d.ts +3 -0
  67. package/dist/server/utils/llmstxt/agent-feedback-llms-footer.js +2 -0
  68. package/dist/server/utils/shared-data.js +1 -1
  69. package/dist/server/web-server/dev-server.js +1 -1
  70. package/dist/server/web-server/routes/auth.js +1 -1
  71. package/dist/server/web-server/routes/feedback.d.ts +16 -0
  72. package/dist/server/web-server/routes/feedback.js +1 -1
  73. package/dist/server/web-server/utils/feedback-ip.d.ts +2 -0
  74. package/dist/server/web-server/utils/feedback-ip.js +1 -0
  75. package/dist/server/web-server/utils/get-client-ip.d.ts +1 -0
  76. package/dist/server/web-server/utils/get-client-ip.js +1 -1
  77. package/dist/utils/auth/is-auth-route-path.js +1 -0
  78. package/package.json +7 -7
  79. package/dist/client/utils/auth/is-auth-route-path.js +0 -1
  80. package/dist/server/plugins/catalog-entities/utils/has-options-changed.d.ts +0 -2
  81. package/dist/server/plugins/catalog-entities/utils/has-options-changed.js +0 -1
  82. /package/dist/{client/utils → utils}/auth/is-auth-route-path.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @redocly/realm
2
2
 
3
+ ## 0.134.0-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 98c2a8d099e: Fixed scroll synchronization between the editor and the Webview.
8
+
9
+ ## 0.134.0-next.2
10
+
11
+ ### Minor Changes
12
+
13
+ - 369752b7a65: Added `renderForLlms` to custom Markdoc tag schemas to control output for LLMs.
14
+
15
+ ### Patch Changes
16
+
17
+ - 901291dbd68: Fixed an issue where in rare cases, clicking on a link on a Markdown page, could trigger navigation twice, taking the user to the first link on the target page.
18
+ - 140606ccd0c: Fixed issue where the link checker incorrectly reported valid authentication links as broken.
19
+ - 43168a71e27: Fixed an issue where IP addresses associated with submitted feedback were inaccurate due to proxy or CDN chains.
20
+ - Updated dependencies [369752b7a65]
21
+ - Updated dependencies [45d17147cbc]
22
+ - Updated dependencies [082d73f2c3c]
23
+ - @redocly/theme@0.66.0-next.2
24
+ - @redocly/realm-asyncapi-sdk@0.12.0-next.2
25
+ - @redocly/openapi-docs@3.22.0-next.2
26
+ - @redocly/asyncapi-docs@1.11.0-next.2
27
+ - @redocly/graphql-docs@1.11.0-next.2
28
+ - @redocly/portal-plugin-mock-server@0.19.0-next.2
29
+
3
30
  ## 0.134.0-next.1
4
31
 
5
32
  ### Minor Changes
@@ -56,6 +83,15 @@
56
83
  - @redocly/graphql-docs@1.11.0-next.0
57
84
  - @redocly/openapi-docs@3.22.0-next.0
58
85
 
86
+ ## 0.133.1
87
+
88
+ ### Patch Changes
89
+
90
+ - e69c304a76: Fixed an issue where in rare cases, clicking on a link on a Markdown page, could trigger navigation twice, taking the user to the first link on the target page.
91
+ - Updated dependencies [3aa79f51c8]
92
+ - @redocly/realm-asyncapi-sdk@0.11.1
93
+ - @redocly/theme@0.65.0
94
+
59
95
  ## 0.133.0
60
96
 
61
97
  ### Minor Changes
@@ -1,24 +1,16 @@
1
- type BlockHeight = {
1
+ export type BlockHeight = {
2
2
  height: number;
3
3
  offset: number;
4
4
  };
5
5
  /**
6
- * Calculates the height of each block element within an article, accounting for margins between blocks.
7
- * A block is defined as content between two heading elements or from start/end of article.
6
+ * Calculates the height of each block element within markdown content, accounting for margins between blocks.
7
+ * A block is defined as content between two heading elements or from start/end of the content root.
8
8
  * @returns An array containing the heights and offsets of all block elements.
9
9
  */
10
10
  export declare function getBlocksHeight(): BlockHeight[];
11
11
  /**
12
- * Calculates the offset top position of a block element in an HTML document.
13
- * A block element is determined by its sequence number in relation to heading elements.
14
- * @param sequenceNumber - The sequence number of the block element (0-based index).
15
- * @returns The offset top position of the block element with the specified sequenceNumber, adjusted for nav height.
16
- * Returns 0 if the sequence number is invalid or no block is found.
17
- */
18
- export declare function getBlockOffsetTop(sequenceNumber: number): number;
19
- /**
20
- * Calculates the offset top position of an article element, adjusted for navigation height.
21
- * @returns The offset top position of the article relative to the viewport, accounting for fixed navigation.
12
+ * Calculates the offset top position of markdown content, adjusted for navigation height.
13
+ * @returns The offset top position of the content relative to the viewport, accounting for fixed navigation.
22
14
  */
23
15
  export declare const getArticleOffsetTop: () => number;
24
16
  /**
@@ -26,5 +18,4 @@ export declare const getArticleOffsetTop: () => number;
26
18
  * @returns The height of the navigation element in pixels, or 0 if no nav element exists.
27
19
  */
28
20
  export declare const getNavHeight: () => number;
29
- export {};
30
21
  //# sourceMappingURL=getBlocksHeight.d.ts.map
@@ -1 +1 @@
1
- function f(t){const o=window.getComputedStyle(t);return{marginTop:parseFloat(o.getPropertyValue("margin-top"))||0,marginBottom:parseFloat(o.getPropertyValue("margin-bottom"))||0}}const s=t=>!!t&&(t instanceof HTMLHeadingElement||/^H[1-6]$/.test(t.tagName));function p(){const t=[],o=Array.from(document.querySelectorAll("article > *")??[]);let e=0,r=l(o[0]),a=0;return o.forEach(n=>{const{marginTop:i,marginBottom:c}=f(n);s(n)&&e&&(t.push({height:e,offset:r}),r=n.offsetTop-Math.max(a,i),e=0),e+=n.offsetHeight,e+=Math.max(a,i),a=c}),e!==0&&t.push({height:e,offset:r}),t}function u(t){if(t===0)return 0;const e=Array.from(document.querySelectorAll("article > *")).filter(r=>s(r));if(t<e.length){const r=document.querySelector("nav")?.offsetHeight??0;return e[t].offsetTop-r}return 0}const m=()=>{const t=document.querySelector("article")?.offsetTop??0,o=g();return t-o},g=()=>document.querySelector("nav")?.offsetHeight??0;function l(t){if(!t)return 0;const o=window.getComputedStyle(t),e=parseFloat(o.getPropertyValue("margin-top"))||0;return t.offsetTop-e}export{m as getArticleOffsetTop,u as getBlockOffsetTop,p as getBlocksHeight,g as getNavHeight};
1
+ const g='main[data-component-name="Markdown/Markdown"]',h='[data-component-name="Markdoc/Heading/Heading"]';function a(){return document.querySelector(g)}function u(t){const e=Array.from(t.querySelectorAll(h));return e.length>0?e:Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6"))}function l(){const t=a();if(!t)return[];const e=u(t);if(e.length===0)return[{offset:n(t),height:t.offsetHeight}];const o=[],f=n(t),s=n(e[0]);s>f&&o.push({offset:f,height:s-f});for(let r=0;r<e.length;r++){const c=n(e[r]),i=(r+1<e.length?n(e[r+1]):n(t)+t.offsetHeight)-c;i>0&&o.push({height:i,offset:c})}return o}const m=()=>{const t=a(),e=t?n(t):0,o=d();return e-o},d=()=>document.querySelector("nav")?.offsetHeight??0;function n(t){if(!t)return 0;const e=window.getComputedStyle(t),o=parseFloat(e.getPropertyValue("margin-top"))||0;return t.offsetTop-o}export{m as getArticleOffsetTop,l as getBlocksHeight,d as getNavHeight};
@@ -1 +1 @@
1
- import{isLocalLink as f}from"../../../utils/path/is-local-link.js";import{isAuthRoutePath as m}from"../../utils/auth/is-auth-route-path.js";import{withLoadProgress as u}from"./withLoadProgress";import{scrollToAnchor as p}from"./scroll-to-anchor";let s;async function A({navigate:i,to:o,origin:a="browser",options:c}){o===""&&(o="/"),s=o;const{pathname:n,hash:d,search:t}=new URL(o,window.location.origin+window.location.pathname),r=decodeURIComponent(d),l=decodeURIComponent(window.location.hash);if(m(n)){window.location.href=o;return}const w=window.__LOADER,e=await u(w.tryLoad(n,void 0,t));if(e?.redirectTo){if(!f(e.redirectTo)){window.location.href=e.redirectTo;return}return A({navigate:i,to:e.redirectTo,origin:a,options:c})}if(e&&s===o){if((n!==window.location.pathname||t!==window.location.search||r!==l)&&i({pathname:n,search:t,hash:r},{...c,state:{origin:a},unstable_flushSync:!0}),e.props?.disableAutoScroll)return;requestAnimationFrame(()=>{if(r){const h=r.slice(1);p(h)}else window.scrollTo(0,0)})}}export{A as loadAndNavigate};
1
+ import{isLocalLink as f}from"../../../utils/path/is-local-link.js";import{isAuthRoutePath as m}from"../../../utils/auth/is-auth-route-path.js";import{withLoadProgress as u}from"./withLoadProgress";import{scrollToAnchor as p}from"./scroll-to-anchor";let s;async function A({navigate:i,to:o,origin:a="browser",options:c}){o===""&&(o="/"),s=o;const{pathname:n,hash:d,search:t}=new URL(o,window.location.origin+window.location.pathname),r=decodeURIComponent(d),l=decodeURIComponent(window.location.hash);if(m(n)){window.location.href=o;return}const w=window.__LOADER,e=await u(w.tryLoad(n,void 0,t));if(e?.redirectTo){if(!f(e.redirectTo)){window.location.href=e.redirectTo;return}return A({navigate:i,to:e.redirectTo,origin:a,options:c})}if(e&&s===o){if((n!==window.location.pathname||t!==window.location.search||r!==l)&&i({pathname:n,search:t,hash:r},{...c,state:{origin:a},unstable_flushSync:!0}),e.props?.disableAutoScroll)return;requestAnimationFrame(()=>{if(r){const h=r.slice(1);p(h)}else window.scrollTo(0,0)})}}export{A as loadAndNavigate};
@@ -1 +1 @@
1
- import{getBlocksHeight as s,getArticleOffsetTop as f,getNavHeight as h}from"./getBlocksHeight.js";function g(t,e=0){if(typeof t>"u"){window.scrollTo({top:0,behavior:"smooth"});return}const o=s(),n=h();if(!o[e])return;const{height:r,offset:c}=o[e],i=Math.round(c-n+r*(Math.round(t)/100));window.scrollTo({top:i,behavior:"smooth"})}const p=t=>{const e=f(),o=h();if(t<e)return{percentScrolled:0,sequenceNumber:-1};const n=s(),r=l(t+o,n),{height:c,offset:i}=n[r];return{percentScrolled:Math.round((t+o-i)/c*100),sequenceNumber:r}};function l(t,e){return e.findIndex(({offset:o,height:n})=>t>=o&&t<o+n)}export{g as syncScrollWithEditor,p as syncScrollWithProject};
1
+ import{getBlocksHeight as s,getArticleOffsetTop as f,getNavHeight as u}from"./getBlocksHeight.js";function m(t,n=0){if(typeof t>"u"){window.scrollTo({top:0,behavior:"smooth"});return}const o=s(),e=u();if(!o[n])return;const{height:r,offset:c}=o[n],i=Math.round(c-e+r*(Math.round(t)/100));window.scrollTo({top:i,behavior:"instant"})}const p=t=>{const n=f(),o=u();if(t<n)return{percentScrolled:0,sequenceNumber:-1};const e=s(),r=h(t+o,e);if(r===-1||!e[r])return{percentScrolled:0,sequenceNumber:-1};const{height:c,offset:i}=e[r];return c<=0?{percentScrolled:0,sequenceNumber:-1}:{percentScrolled:l(Math.round((t+o-i)/c*100)),sequenceNumber:r}};function l(t){return Math.max(0,Math.min(100,t))}function h(t,n){const o=n.findIndex(({offset:e,height:r})=>t>=e&&t<e+r);if(o!==-1)return o;for(let e=n.length-1;e>=0;e--)if(t>=n[e].offset)return e;return-1}export{m as syncScrollWithEditor,p as syncScrollWithProject};
@@ -1 +1 @@
1
- import{useEffect as c,useState as s}from"react";import{useNavigate as l}from"react-router-dom";import{isLocalLink as m}from"../../utils/path/is-local-link.js";import{isJsProtocolLink as a}from"../../utils/path/is-js-protocol-link.js";import{isAssetsLink as u}from"../../utils/path/is-assets-link.js";import{isHostnameOnDomain as f}from"../app/utils/isHostnameOnDomain.js";import{loadAndNavigate as d}from"../app/utils/loadAndNavigate.js";import{isForcedNavigationLinkClick as p}from"../utils/utils.js";export*from"./page-data/hooks.js";function E(){const e=l();c(()=>{const t=n=>{const i=n.target;if(i.tagName!=="A"||p(n,i.getAttribute("target")||""))return;const r=i.getAttribute("href");!m(r)||u(r)||a(r)||(n.preventDefault(),d({navigate:e,to:r||""}))};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t)}},[e])}function b(){const[e,t]=s(null);return c(()=>{if(process.env.NODE_ENV==="development"&&typeof window<"u"&&!o("localhost")&&!o("127.0.0.1")&&!o("")&&!o("redocly-local.com")&&!o("editor.redocly.xyz")&&!o("apps.codespaces.githubusercontent.com")&&!o("blueharvest.cloud")&&!o("bhstage.cloud")&&!o("cloud.redocly.com")&&!o("cloud.eu.redocly.com")&&!o("cba.au.redocly.com"))return t("Development mode is only allowed in localhost")},[typeof window]),e}function o(e){return f(window.location.hostname,e)}export{E as useRouterForLocalLinks,b as useRunningEnvironmentCheck};
1
+ import{useEffect as c,useState as s}from"react";import{useNavigate as l}from"react-router-dom";import{isLocalLink as u}from"../../utils/path/is-local-link.js";import{isJsProtocolLink as a}from"../../utils/path/is-js-protocol-link.js";import{isAssetsLink as m}from"../../utils/path/is-assets-link.js";import{isHostnameOnDomain as f}from"../app/utils/isHostnameOnDomain.js";import{loadAndNavigate as d}from"../app/utils/loadAndNavigate.js";import{isForcedNavigationLinkClick as p}from"../utils/utils.js";export*from"./page-data/hooks.js";function E(){const o=l();c(()=>{const r=t=>{if(t.defaultPrevented)return;const i=t.target;if(i.tagName!=="A"||p(t,i.getAttribute("target")||""))return;const n=i.getAttribute("href");!u(n)||m(n)||a(n)||(t.preventDefault(),d({navigate:o,to:n||""}))};return document.addEventListener("click",r),()=>{document.removeEventListener("click",r)}},[o])}function b(){const[o,r]=s(null);return c(()=>{if(process.env.NODE_ENV==="development"&&typeof window<"u"&&!e("localhost")&&!e("127.0.0.1")&&!e("")&&!e("redocly-local.com")&&!e("editor.redocly.xyz")&&!e("apps.codespaces.githubusercontent.com")&&!e("blueharvest.cloud")&&!e("bhstage.cloud")&&!e("cloud.redocly.com")&&!e("cloud.eu.redocly.com")&&!e("cba.au.redocly.com"))return r("Development mode is only allowed in localhost")},[typeof window]),o}function e(o){return f(window.location.hostname,o)}export{E as useRouterForLocalLinks,b as useRunningEnvironmentCheck};
@@ -3,22 +3,12 @@ export declare function useCollectMarkdocOptions({ markdown }: PageProps): {
3
3
  partials: Record<string, import("@markdoc/markdoc").Node | import("@markdoc/markdoc").Node[]> | undefined;
4
4
  variables?: Record<string, any>;
5
5
  tags: {
6
- [x: string]: (import("@markdoc/markdoc").Schema<Readonly<Partial<{
7
- nodes: Partial<Record<import("@markdoc/markdoc").NodeType, import("@markdoc/markdoc").Schema<Partial</*elided*/ any>, string>>>;
8
- tags: Record<string, import("@markdoc/markdoc").Schema>;
9
- variables: Record<string, any>;
10
- functions: Record<string, import("@markdoc/markdoc").ConfigFunction>;
11
- partials: Record<string, any>;
12
- validation?: {
13
- parents?: import("@markdoc/markdoc").Node[];
14
- validateFunctions?: boolean;
15
- environment?: string;
16
- };
17
- }>>, string> & {
6
+ [x: string]: import("@redocly/theme/markdoc/tags/types").MarkdocTagSchema | (import("@markdoc/markdoc").Schema & {
18
7
  attributes?: Record<string, import("@markdoc/markdoc").SchemaAttribute & {
19
8
  resolver?: string;
20
9
  }>;
21
- }) | (import("@markdoc/markdoc").Schema & {
10
+ renderForLlms?: import("@redocly/theme/markdoc/tags/types").RenderForLlmsFn;
11
+ } & {
22
12
  dynamicComponentLib?: string;
23
13
  });
24
14
  };