@alauda/doom 2.5.4 → 2.6.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 (92) hide show
  1. package/lib/cli/api.d.ts +2 -0
  2. package/lib/cli/api.js +147 -0
  3. package/lib/cli/helpers.d.ts +1 -7
  4. package/lib/cli/helpers.js +4 -41
  5. package/lib/cli/index.js +2 -0
  6. package/lib/cli/translate-agent.d.ts +81 -0
  7. package/lib/cli/translate-agent.js +450 -0
  8. package/lib/cli/translate-check.d.ts +17 -0
  9. package/lib/cli/translate-check.js +67 -0
  10. package/lib/cli/translate-checker.d.ts +58 -0
  11. package/lib/cli/translate-checker.js +112 -0
  12. package/lib/cli/translate-judge.d.ts +119 -0
  13. package/lib/cli/translate-judge.js +224 -0
  14. package/lib/cli/translate-limits.d.ts +43 -0
  15. package/lib/cli/translate-limits.js +55 -0
  16. package/lib/cli/translate-mask.d.ts +144 -0
  17. package/lib/cli/translate-mask.js +617 -0
  18. package/lib/cli/translate-models.d.ts +127 -0
  19. package/lib/cli/translate-models.js +189 -0
  20. package/lib/cli/translate-scratch.d.ts +142 -0
  21. package/lib/cli/translate-scratch.js +187 -0
  22. package/lib/cli/translate-terms.d.ts +22 -0
  23. package/lib/cli/translate-terms.js +33 -0
  24. package/lib/cli/translate.d.ts +15 -10
  25. package/lib/cli/translate.js +228 -185
  26. package/lib/eslint.js +22 -3
  27. package/lib/plugins/api/index.js +1 -1
  28. package/lib/plugins/api/types.d.ts +36 -1
  29. package/lib/plugins/global/components.d.ts +16 -0
  30. package/lib/plugins/global/components.js +16 -1
  31. package/lib/remark-lint/index.d.ts +20 -0
  32. package/lib/remark-lint/index.js +40 -0
  33. package/lib/remark-lint/no-unmatched-anchor.d.ts +10 -0
  34. package/lib/remark-lint/no-unmatched-anchor.js +13 -0
  35. package/lib/remark-lint/no-unopened-frontmatter.d.ts +2 -0
  36. package/lib/remark-lint/no-unopened-frontmatter.js +70 -0
  37. package/lib/remark-lint/no-unparsed-emphasis.d.ts +2 -0
  38. package/lib/remark-lint/no-unparsed-emphasis.js +53 -0
  39. package/lib/remark-lint/no-unresolved-api-ref.d.ts +40 -0
  40. package/lib/remark-lint/no-unresolved-api-ref.js +194 -0
  41. package/lib/remark-lint/rule-sets.d.ts +75 -0
  42. package/lib/remark-lint/rule-sets.js +120 -0
  43. package/lib/remark-lint/translation-parity/component-multiset.d.ts +17 -0
  44. package/lib/remark-lint/translation-parity/component-multiset.js +35 -0
  45. package/lib/remark-lint/translation-parity/echoed-source.d.ts +2 -0
  46. package/lib/remark-lint/translation-parity/echoed-source.js +37 -0
  47. package/lib/remark-lint/translation-parity/frontmatter-preservation.d.ts +2 -0
  48. package/lib/remark-lint/translation-parity/frontmatter-preservation.js +36 -0
  49. package/lib/remark-lint/translation-parity/heading-sequence.d.ts +12 -0
  50. package/lib/remark-lint/translation-parity/heading-sequence.js +25 -0
  51. package/lib/remark-lint/translation-parity/index.d.ts +24 -0
  52. package/lib/remark-lint/translation-parity/index.js +24 -0
  53. package/lib/remark-lint/translation-parity/jsx-attribute-parity.d.ts +14 -0
  54. package/lib/remark-lint/translation-parity/jsx-attribute-parity.js +47 -0
  55. package/lib/remark-lint/translation-parity/length-ratio.d.ts +2 -0
  56. package/lib/remark-lint/translation-parity/length-ratio.js +49 -0
  57. package/lib/remark-lint/translation-parity/link-isomorphism.d.ts +26 -0
  58. package/lib/remark-lint/translation-parity/link-isomorphism.js +45 -0
  59. package/lib/remark-lint/translation-parity/shared.d.ts +110 -0
  60. package/lib/remark-lint/translation-parity/shared.js +282 -0
  61. package/lib/remark-lint/translation-parity/terminology-adherence.d.ts +2 -0
  62. package/lib/remark-lint/translation-parity/terminology-adherence.js +67 -0
  63. package/lib/remark-lint/translation-parity/up-to-date.d.ts +11 -0
  64. package/lib/remark-lint/translation-parity/up-to-date.js +21 -0
  65. package/lib/remark-lint/translation-parity/url-residue.d.ts +2 -0
  66. package/lib/remark-lint/translation-parity/url-residue.js +46 -0
  67. package/lib/remarkrc.d.ts +1 -1
  68. package/lib/remarkrc.js +7 -34
  69. package/lib/runtime/api-paths.d.ts +20 -0
  70. package/lib/runtime/api-paths.js +29 -0
  71. package/lib/runtime/components/K8sAPI.d.ts +14 -1
  72. package/lib/runtime/components/K8sAPI.js +49 -10
  73. package/lib/runtime/components/K8sCrd.d.ts +1 -1
  74. package/lib/runtime/components/K8sPermissionTable.js +10 -5
  75. package/lib/runtime/components/OpenAPIPath.js +19 -2
  76. package/lib/runtime/components/_HeadingTitle.js +24 -6
  77. package/lib/runtime/components/_K8sAPIEndpoints.d.ts +8 -1
  78. package/lib/runtime/components/_K8sAPIEndpoints.js +27 -9
  79. package/lib/runtime/components/_K8sAPISchema.d.ts +9 -1
  80. package/lib/runtime/components/_K8sAPISchema.js +24 -6
  81. package/lib/runtime/components/_translation-policy.d.ts +23 -0
  82. package/lib/runtime/components/_translation-policy.js +32 -0
  83. package/lib/runtime/hooks/useTranslation.d.ts +1 -1
  84. package/lib/runtime/translation.d.ts +68 -0
  85. package/lib/runtime/translation.js +51 -0
  86. package/lib/runtime/utils.d.ts +24 -2
  87. package/lib/runtime/utils.js +87 -5
  88. package/lib/shared/constants.d.ts +9 -0
  89. package/lib/shared/constants.js +14 -0
  90. package/lib/types.d.ts +70 -0
  91. package/lib/utils/helpers.js +8 -2
  92. package/package.json +3 -1
@@ -1,11 +1,14 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import crdsMap from 'doom-@api-crdsMap';
3
3
  import openapisMap from 'doom-@api-openapisMap';
4
+ import virtual from 'doom-@api-virtual';
5
+ import { plural as pluralize } from 'pluralize';
4
6
  import { useMemo } from 'react';
5
- import { resolveRef } from '../utils.js';
7
+ import { declaresStatusSubresource } from '../api-paths.js';
8
+ import { resolveRef, selectCrdVersionName } from '../utils.js';
6
9
  import { K8sAPIEndpoints } from './_K8sAPIEndpoints.js';
7
10
  import { K8sAPISchema } from './_K8sAPISchema.js';
8
- export const K8sAPI = ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVersion, apiKind, }) => {
11
+ export const K8sAPI = ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVersion, apiKind, plural, hasStatus, }) => {
9
12
  const [, openapi] = useMemo(() => Object.entries(openapisMap).find(([pathname, openapi]) => {
10
13
  if (filepath && pathname !== filepath) {
11
14
  return;
@@ -18,6 +21,15 @@ export const K8sAPI = ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVe
18
21
  }
19
22
  return crd.metadata.name === name;
20
23
  }) || [], [filepath, name]);
24
+ // The version this page renders: an explicit `apiVersion` prop wins,
25
+ // otherwise the version `kubectl` would resolve to (see `selectCrdVersionName`
26
+ // / `api.crdVersion`). Used consistently for the schema AND the endpoint
27
+ // paths so the two never disagree.
28
+ const resolvedVersion = useMemo(() => crd
29
+ ? (apiVersion ??
30
+ selectCrdVersionName(crd.spec.versions, virtual.crdVersion))
31
+ : apiVersion, [apiVersion, crd]);
32
+ const versionDef = useMemo(() => crd?.spec.versions.find((ver) => ver.name === resolvedVersion), [crd, resolvedVersion]);
21
33
  const schema = useMemo(() => {
22
34
  if (openapi) {
23
35
  return resolveRef(openapi, name);
@@ -25,17 +37,14 @@ export const K8sAPI = ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVe
25
37
  if (!crd) {
26
38
  return;
27
39
  }
28
- const { versions } = crd.spec;
29
- const v = apiVersion ?? versions[0]?.name;
30
- const versionDef = versions.find((ver) => ver.name === v);
31
40
  if (!versionDef) {
32
- console.error(`CRD ${name} does not have version ${v}, available versions: ${versions
41
+ console.error(`CRD ${name} does not have version ${resolvedVersion}, available versions: ${crd.spec.versions
33
42
  .map((ver) => ver.name)
34
43
  .join(', ')}`);
35
44
  return;
36
45
  }
37
46
  return versionDef.schema.openAPIV3Schema;
38
- }, [apiVersion, crd, name, openapi]);
47
+ }, [crd, name, openapi, resolvedVersion, versionDef]);
39
48
  const k8sApiDef = useMemo(() => {
40
49
  if (!schema) {
41
50
  return;
@@ -47,15 +56,45 @@ export const K8sAPI = ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVe
47
56
  if (crd) {
48
57
  return {
49
58
  group: crd.spec.group,
50
- version: crd.spec.versions[0].name,
59
+ version: resolvedVersion ?? crd.spec.versions[0].name,
51
60
  kind: crd.spec.names.kind,
52
61
  };
53
62
  }
54
- }, [crd, schema]);
63
+ }, [crd, resolvedVersion, schema]);
64
+ // The endpoint paths are built by concatenating group / version / plural. An
65
+ // unknown segment used to fall back to `''`, which concatenates into a
66
+ // silently broken path such as `/api//` — a guess dressed up as a fact. Merge
67
+ // the caller's props with whatever the fact sources yielded, then render the
68
+ // endpoints only if the result is actually complete.
69
+ const group = apiGroup ?? k8sApiDef?.group;
70
+ const version = apiVersion ?? k8sApiDef?.version;
71
+ const kind = apiKind ?? k8sApiDef?.kind;
72
+ const pluralName = plural ??
73
+ crd?.spec.names.plural ??
74
+ (kind ? pluralize(kind).toLowerCase() : undefined);
75
+ // `subresources.status` is the CRD's own declaration. An OpenAPI source has
76
+ // no such field, so the routes it lists are the next best fact; only when it
77
+ // lists none for this resource does the weaker "the schema has a `status`
78
+ // property" signal still apply (see `declaresStatusSubresource`).
79
+ const derivedHasStatus = useMemo(() => {
80
+ if (crd) {
81
+ return !!versionDef?.subresources?.status;
82
+ }
83
+ if (!schema) {
84
+ return false;
85
+ }
86
+ return (declaresStatusSubresource(Object.keys(openapi?.paths ?? {}), pluralName) ?? !!schema.properties?.status);
87
+ }, [crd, openapi, pluralName, schema, versionDef]);
55
88
  if (!openapi && !crd) {
56
89
  console.error(`No OpenAPI nor CustomResourceDefinition schema found for ${name}`);
57
90
  return null;
58
91
  }
59
- return schema ? (_jsxs(_Fragment, { children: [_jsx(K8sAPISchema, { schema: schema, fullSchema: openapi }), _jsx(K8sAPIEndpoints, { hasStatus: !!schema.properties?.status, group: apiGroup ?? k8sApiDef?.group, version: apiVersion ?? k8sApiDef?.version ?? '', kind: apiKind ?? k8sApiDef?.kind ?? '', pathPrefix: pathPrefix, namespaced: namespaced })] })) : null;
92
+ // `group` is legitimately absent for core-group resources (`/api/v1/...`);
93
+ // `version` and `kind` are not — without them there is no path to render.
94
+ const endpointDef = version && kind ? { group, version, kind } : undefined;
95
+ if (schema && !endpointDef) {
96
+ console.error(`Cannot resolve the group/version/kind of ${name}: its OpenAPI schema carries no \`x-kubernetes-group-version-kind\` extension and no CustomResourceDefinition defines it. Pass explicit \`apiVersion\` and \`apiKind\` props (plus \`apiGroup\` for non-core groups, and \`plural\` if the plural is irregular). Omitting the API endpoints section.`);
97
+ }
98
+ return schema ? (_jsxs(_Fragment, { children: [_jsx(K8sAPISchema, { schema: schema, fullSchema: openapi }), endpointDef && (_jsx(K8sAPIEndpoints, { ...endpointDef, hasStatus: hasStatus ?? derivedHasStatus, hasScale: crd ? !!versionDef?.subresources?.scale : undefined, plural: pluralName, pathPrefix: pathPrefix, namespaced: namespaced ?? (crd ? crd.spec.scope === 'Namespaced' : undefined) }))] })) : null;
60
99
  };
61
100
  export default K8sAPI;
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * @deprecated Use `K8sAPI` component instead
3
3
  */
4
- export declare const K8sCrd: ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVersion, apiKind, }: import("./K8sAPI.js").K8sAPIProps) => import("react/jsx-runtime").JSX.Element | null;
4
+ export declare const K8sCrd: ({ name, namespaced, pathPrefix, filepath, apiGroup, apiVersion, apiKind, plural, hasStatus, }: import("./K8sAPI.js").K8sAPIProps) => import("react/jsx-runtime").JSX.Element | null;
5
5
  export default K8sCrd;
@@ -49,13 +49,15 @@ const RolesPermission = ({ functionResource, roleTemplates, verb, }) => {
49
49
  };
50
50
  const allFunctionResources = Object.values(functionResourcesMap).reduce((acc, curr) => Object.assign(acc, ...curr.map((fr) => ({ [fr.metadata.name]: fr }))), {});
51
51
  export const K8sPermissionTable = ({ functions }) => {
52
- const functionResources = useMemo(() => functions.flatMap((name) => {
52
+ const functionResources = useMemo(() => functions.map((name) => {
53
53
  const matched = allFunctionResources[name];
54
54
  if (!matched) {
55
+ // Do NOT drop the row: a missing FunctionResource used to vanish
56
+ // silently, leaving a complete-looking table with a build exit 0.
57
+ // Keep it visible and log for the build-integrity summary.
55
58
  console.error(`FunctionResource \`${name}\` not found!\n`);
56
- return [];
57
59
  }
58
- return matched;
60
+ return { name, resource: matched };
59
61
  }),
60
62
  // eslint-disable-next-line @eslint-react/exhaustive-deps
61
63
  functions);
@@ -67,8 +69,11 @@ export const K8sPermissionTable = ({ functions }) => {
67
69
  const isZh = lang === 'zh';
68
70
  return (_jsxs(X.table, { children: [_jsx("thead", { children: _jsxs(X.tr, { children: [_jsx(X.th, { children: t('function') }), _jsx(X.th, { style: TEXT_NO_WRAP_STYLE, children: t('action') }), roleTemplates.map(({ metadata: { annotations, name } }) => (_jsx(X.th, { children: isZh
69
71
  ? annotations[DISPLAY_NAME_ZH]
70
- : annotations[DISPLAY_NAME_EN] }, name)))] }) }), _jsx("tbody", { children: functionResources.map((fr) => {
71
- const { metadata: { annotations, name }, } = fr;
72
+ : annotations[DISPLAY_NAME_EN] }, name)))] }) }), _jsx("tbody", { children: functionResources.map(({ name, resource: fr }) => {
73
+ if (!fr) {
74
+ return (_jsxs(X.tr, { children: [_jsx(X.td, { style: TEXT_CENTER_STYLE, children: _jsx("code", { children: name }) }), _jsxs(X.td, { colSpan: 1 + roleTemplates.length, children: [_jsx("code", { children: "FunctionResource" }), " ", _jsx("code", { children: name }), " not found"] })] }, name));
75
+ }
76
+ const { metadata: { annotations }, } = fr;
72
77
  return (_jsxs(Fragment, { children: [_jsxs(X.tr, { children: [_jsxs(X.td, { rowSpan: 4, style: TEXT_CENTER_STYLE, children: [isZh
73
78
  ? annotations[FUNCTION_DISPLAY_NAME_ZH]
74
79
  : annotations[FUNCTION_DISPLAY_NAME_EN], _jsx("br", {}), _jsx("code", { children: name })] }), _jsx(X.td, { children: t('view') }), _jsx(RolesPermission, { functionResource: fr, roleTemplates: roleTemplates, verb: "view" })] }), Verbs.slice(1).map((verb) => (_jsxs(X.tr, { children: [_jsx(X.td, { children: t(verb) }), _jsx(RolesPermission, { functionResource: fr, roleTemplates: roleTemplates, verb: verb })] }, verb)))] }, name));
@@ -6,6 +6,7 @@ import openapisMap from 'doom-@api-openapisMap';
6
6
  import virtual from 'doom-@api-virtual';
7
7
  import { OpenAPIV3 } from 'openapi-types';
8
8
  import { Fragment, useMemo } from 'react';
9
+ import { useTranslation } from '../hooks/index.js';
9
10
  import { omitRoutePathRefs, resolveRef } from '../utils.js';
10
11
  import { Markdown } from './Markdown.js';
11
12
  import { OpenAPIProperties, OpenAPIProperty, OpenAPIRef } from './OpenAPIRef.js';
@@ -87,12 +88,13 @@ const setRefsForPath = (openapi, path, knownRefs, refs) => {
87
88
  }
88
89
  };
89
90
  const OpenAPIPathBase = ({ path, pathItem, openapi, pathPrefix: pathPrefix_, slugger, }) => {
91
+ const t = useTranslation();
90
92
  const pathPrefix = pathPrefix_ ?? (virtual.pathPrefix || '');
91
93
  if (!pathItem || !openapi) {
92
94
  console.error(`No OpenAPI path definition found for ${path}`);
93
95
  return null;
94
96
  }
95
- return (_jsxs(_Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 2, children: [pathPrefix, path] }), pathItem.parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 3, children: "Common Parameters" }), _jsx(OpenAPIParameters, { parameters: pathItem.parameters, openapi: openapi })] })), Object.values(OpenAPIV3.HttpMethods).map((method) => {
97
+ return (_jsxs(_Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 2, children: [pathPrefix, path] }), pathItem.parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 3, children: t('common_parameters') }), _jsx(OpenAPIParameters, { parameters: pathItem.parameters, openapi: openapi })] })), Object.values(OpenAPIV3.HttpMethods).map((method) => {
96
98
  if (!pathItem[method]) {
97
99
  return null;
98
100
  }
@@ -108,7 +110,16 @@ const OpenAPIPathBase = ({ path, pathItem, openapi, pathPrefix: pathPrefix_, slu
108
110
  const requestBodySchema = requestBodyRef
109
111
  ? resolveRef(openapi, requestBodyRef)
110
112
  : undefined;
111
- return (_jsxs(Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 3, children: [_jsx("code", { children: method }), " ", summary] }), _jsx(Markdown, { children: description }), parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Parameters" }), _jsx(OpenAPIParameters, { parameters: parameters, openapi: openapi })] })), requestBodySchema && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Request Body" }), _jsxs(X.p, { children: [_jsx(RefLink, { "$ref": requestBodyRef }), requestBodySchema.required && _jsx(Badge, { children: "required" })] })] })), responses && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: "Response" }), _jsx(OpenAPIResponses, { responses: responses, openapi: openapi })] }))] }, method));
113
+ // Whether the request body itself is required — the boolean on the
114
+ // RequestBodyObject. NOT `requestBodySchema.required`, which is the
115
+ // list of required *properties* of the body schema (truthy whenever the
116
+ // body has any required field, which is unrelated).
117
+ const requestBodyObj = requestBody &&
118
+ ('$ref' in requestBody
119
+ ? resolveRef(openapi, requestBody.$ref)
120
+ : requestBody);
121
+ const requestBodyRequired = !!requestBodyObj?.required;
122
+ return (_jsxs(Fragment, { children: [_jsxs(HeadingTitle, { slugger: slugger, level: 3, children: [_jsx("code", { children: method }), " ", summary] }), _jsx(Markdown, { children: description }), parameters && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: t('parameters') }), _jsx(OpenAPIParameters, { parameters: parameters, openapi: openapi })] })), requestBodySchema && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: t('request_body') }), _jsxs(X.p, { children: [_jsx(RefLink, { "$ref": requestBodyRef }), requestBodyRequired && _jsx(Badge, { children: "required" })] })] })), responses && (_jsxs(_Fragment, { children: [_jsx(HeadingTitle, { slugger: slugger, level: 4, children: t('response') }), _jsx(OpenAPIResponses, { responses: responses, openapi: openapi })] }))] }, method));
112
123
  })] }));
113
124
  };
114
125
  export const OpenAPIPath = ({ path, openapiPath, pathPrefix, }) => {
@@ -122,6 +133,12 @@ export const OpenAPIPath = ({ path, openapiPath, pathPrefix, }) => {
122
133
  continue;
123
134
  }
124
135
  for (const path of paths) {
136
+ // First matched file wins, consistent with `K8sAPI`/`OpenAPIRef` and
137
+ // this component's own JSDoc. Files are sorted (see
138
+ // `generateRuntimeModule`), so "first" is deterministic.
139
+ if (pathMap.has(path)) {
140
+ continue;
141
+ }
125
142
  const pathItem = openapi.paths?.[path];
126
143
  if (pathItem) {
127
144
  pathMap.set(path, {
@@ -1,18 +1,36 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import BananaSlug from '@rspress/shared/github-slugger';
3
- import { Children, useMemo } from 'react';
3
+ import { isValidElement, useMemo } from 'react';
4
4
  import { X } from './_X.js';
5
+ /**
6
+ * Flatten a React node tree to its visible text. Unlike a plain
7
+ * `Children.toArray().filter(string)`, this descends into element children, so
8
+ * a heading like `<code>{method}</code> {summary}` still yields `method` even
9
+ * when `summary` is `undefined` — instead of an empty slug that becomes
10
+ * `id="undefined"` / `href="#undefined"`.
11
+ */
12
+ const extractText = (node) => {
13
+ if (node == null || typeof node === 'boolean') {
14
+ return '';
15
+ }
16
+ if (typeof node === 'string' || typeof node === 'number') {
17
+ return String(node);
18
+ }
19
+ if (Array.isArray(node)) {
20
+ return node.map(extractText).join('');
21
+ }
22
+ if (isValidElement(node)) {
23
+ return extractText(node.props.children);
24
+ }
25
+ return '';
26
+ };
5
27
  // TODO: use context to simplify the usage of `slugger`
6
28
  export const HeadingTitle = ({ slug, slugger, level, children, }) => {
7
29
  const HeadingComponents = useMemo(() => {
8
30
  return [null, X.h1, X.h2, X.h3, X.h4, X.h5, X.h6];
9
31
  }, []);
10
32
  const HeadingComponent = HeadingComponents[level];
11
- const slugFromChildren = useMemo(() =>
12
- // eslint-disable-next-line @eslint-react/no-children-to-array
13
- Children.toArray(children)
14
- .filter((it) => typeof it === 'string' && !!it.trim())
15
- .join(''), [children]);
33
+ const slugFromChildren = useMemo(() => extractText(children).trim(), [children]);
16
34
  const id = useMemo(() => [slug || slugger?.slug(slugFromChildren)].filter(Boolean).join('-') ||
17
35
  undefined, [slug, slugger, slugFromChildren]);
18
36
  return (_jsxs(HeadingComponent, { id: id, children: [_jsx(X.a, { className: "rp-header-anchor", href: `#${id}`, "aria-hidden": true, children: "#" }), children] }));
@@ -6,6 +6,13 @@ export interface K8sAPIDefinition {
6
6
  export interface K8sAPIEndpointsProps extends K8sAPIDefinition {
7
7
  namespaced?: boolean;
8
8
  hasStatus?: boolean;
9
+ hasScale?: boolean;
10
+ /**
11
+ * The resource's plural name. When provided (e.g. read from a CRD's
12
+ * `spec.names.plural`) it is used verbatim; otherwise it is guessed with the
13
+ * `pluralize` package, which is wrong for irregular or hyphenated plurals.
14
+ */
15
+ plural?: string;
9
16
  pathPrefix?: string;
10
17
  }
11
- export declare const K8sAPIEndpoints: ({ hasStatus, group, version, kind, pathPrefix: pathPrefix_, namespaced, }: K8sAPIEndpointsProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const K8sAPIEndpoints: ({ hasStatus, hasScale, group, version, kind, plural, pathPrefix: pathPrefix_, namespaced, }: K8sAPIEndpointsProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,20 +1,38 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { FallbackHeading } from '@rspress/core/theme';
3
3
  import virtual from 'doom-@api-virtual';
4
- import { plural } from 'pluralize';
4
+ import { plural as pluralize } from 'pluralize';
5
+ import { useTranslation } from '../hooks/index.js';
5
6
  import { APIReferenceLink } from './_APIReferenceLink.js';
6
7
  import { X } from './_X.js';
7
8
  const QueryParameters = ({ fieldValidation = true, }) => {
8
- return (_jsxs(_Fragment, { children: [_jsx("dl", { children: _jsx("dt", { children: "Query parameters" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Parameter" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "dryRun" }) }), _jsx("td", { children: _jsx("code", { children: "string" }) }), _jsx("td", { children: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed" })] }), fieldValidation && (_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "fieldValidation" }) }), _jsx("td", { children: _jsx("code", { children: "string" }) }), _jsx("td", { children: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered." })] }))] })] })] }));
9
+ const t = useTranslation();
10
+ return (_jsxs(_Fragment, { children: [_jsx("dl", { children: _jsx("dt", { children: t('query_parameters') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('parameter') }), _jsx("th", { children: t('type') }), _jsx("th", { children: t('description') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "dryRun" }) }), _jsx("td", { children: _jsx("code", { children: "string" }) }), _jsx("td", { children: "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed" })] }), fieldValidation && (_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "fieldValidation" }) }), _jsx("td", { children: _jsx("code", { children: "string" }) }), _jsx("td", { children: "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered." })] }))] })] })] }));
9
11
  };
10
12
  const BodyParameters = ({ kind }) => {
11
- return (_jsxs(_Fragment, { children: [_jsx("dl", { children: _jsx("dt", { children: "Body parameters" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Parameter" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "body" }) }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] }), _jsxs("td", { children: [_jsx("code", { children: "application/json" }), " formatted"] })] }) })] })] }));
13
+ const t = useTranslation();
14
+ return (_jsxs(_Fragment, { children: [_jsx("dl", { children: _jsx("dt", { children: t('body_parameters') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('parameter') }), _jsx("th", { children: t('type') }), _jsx("th", { children: t('description') })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: "body" }) }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] }), _jsxs("td", { children: [_jsx("code", { children: "application/json" }), " formatted"] })] }) })] })] }));
12
15
  };
13
- const K8sAPIListEndpoint = ({ kind }) => (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "DELETE" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["delete collection of ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["list objects of kind ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsxs("code", { children: [kind, "List"] }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "POST" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["create a new ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "202 - Accepted" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
14
- const K8sAPIItemEndpoint = ({ kind }) => (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "DELETE" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["delete the specified ", kind] })] }), _jsx(QueryParameters, { fieldValidation: false }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "202 - Accepted" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["read the specified ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["partially update the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["replace the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
15
- const K8sAPIStatusEndpoint = ({ kind }) => (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["read status of the specified ", kind] }), _jsx("dt", { children: "HTTP responses" })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["partially update status of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: "HTTP method" }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: "Description" }), _jsxs("dd", { children: ["replace status of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: "HTTP responses" }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "HTTP code" }), _jsx("th", { children: "Response body" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
16
- export const K8sAPIEndpoints = ({ hasStatus, group, version, kind, pathPrefix: pathPrefix_, namespaced = true, }) => {
16
+ const K8sAPIListEndpoint = ({ kind }) => {
17
+ const t = useTranslation();
18
+ return (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "DELETE" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["delete collection of ", kind] }), _jsx("dt", { children: t('http_responses') })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["list objects of kind ", kind] }), _jsx("dt", { children: t('http_responses') })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsxs("code", { children: [kind, "List"] }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "POST" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["create a new ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: t('http_responses') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "202 - Accepted" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
19
+ };
20
+ const K8sAPIItemEndpoint = ({ kind }) => {
21
+ const t = useTranslation();
22
+ return (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "DELETE" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["delete the specified ", kind] })] }), _jsx(QueryParameters, { fieldValidation: false }), _jsx("dl", { children: _jsx("dt", { children: t('http_responses') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "202 - Accepted" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Status" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["read the specified ", kind] }), _jsx("dt", { children: t('http_responses') })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["partially update the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx("dl", { children: _jsx("dt", { children: t('http_responses') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["replace the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: t('http_responses') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
23
+ };
24
+ const K8sAPIStatusEndpoint = ({ kind }) => {
25
+ const t = useTranslation();
26
+ return (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["read status of the specified ", kind] }), _jsx("dt", { children: t('http_responses') })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["partially update status of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx("dl", { children: _jsx("dt", { children: t('http_responses') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["replace status of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: kind }), _jsx("dl", { children: _jsx("dt", { children: t('http_responses') }) }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "201 - Created" }), _jsxs("td", { children: [_jsx("code", { children: kind }), " schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] })] }));
27
+ };
28
+ const K8sAPIScaleEndpoint = ({ kind }) => {
29
+ const t = useTranslation();
30
+ return (_jsxs(_Fragment, { children: [_jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "GET" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["read scale of the specified ", kind] }), _jsx("dt", { children: t('http_responses') })] }), _jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('http_code') }), _jsx("th", { children: t('response_body') })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "200 - OK" }), _jsxs("td", { children: [_jsx("code", { children: _jsx(APIReferenceLink, { name: "Scale" }) }), ' ', "schema"] })] }), _jsxs("tr", { children: [_jsx("td", { children: "401 - Unauthorized" }), _jsx("td", { children: "Empty" })] })] })] }), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "PATCH" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["partially update scale of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsxs("dl", { children: [_jsx("dt", { children: t('http_method') }), _jsx("dd", { children: _jsx("code", { children: "PUT" }) }), _jsx("dt", { children: t('description') }), _jsxs("dd", { children: ["replace scale of the specified ", kind] })] }), _jsx(QueryParameters, {}), _jsx(BodyParameters, { kind: "Scale" })] }));
31
+ };
32
+ export const K8sAPIEndpoints = ({ hasStatus, hasScale, group, version, kind, plural, pathPrefix: pathPrefix_, namespaced = true, }) => {
33
+ const t = useTranslation();
17
34
  const pathPrefix = pathPrefix_ ?? (virtual.pathPrefix || '');
18
- const apiPath = `${pathPrefix}/${group ? `apis/${group}` : 'api'}/${version}/${namespaced ? `namespaces/{namespace}/` : ''}${plural(kind).toLocaleLowerCase()}`;
19
- return (_jsxs(_Fragment, { children: [_jsx(FallbackHeading, { level: 2, title: "API Endpoints" }), _jsx(X.p, { children: "The following API endpoints are available:" }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: apiPath }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "DELETE" }), ": delete collection of ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": list objects of kind ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "POST" }), ": create a new ", kind] })] })] }), _jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "DELETE" }), ": delete the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace the specified ", kind] })] })] }), hasStatus && (_jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}/status` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read status of the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update status of the specified", ' ', kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace status of the specified ", kind] })] })] }))] }), _jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: apiPath }) }), _jsx(K8sAPIListEndpoint, { kind: kind }), _jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}` }) }), _jsx(K8sAPIItemEndpoint, { kind: kind }), hasStatus && (_jsxs(_Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}/status` }) }), _jsx(K8sAPIStatusEndpoint, { kind: kind })] }))] }));
35
+ const pluralName = plural ?? pluralize(kind).toLowerCase();
36
+ const apiPath = `${pathPrefix}/${group ? `apis/${group}` : 'api'}/${version}/${namespaced ? `namespaces/{namespace}/` : ''}${pluralName}`;
37
+ return (_jsxs(_Fragment, { children: [_jsx(FallbackHeading, { level: 2, title: t('api_endpoints') }), _jsx(X.p, { children: t('available_api_endpoints') }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: apiPath }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "DELETE" }), ": delete collection of ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": list objects of kind ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "POST" }), ": create a new ", kind] })] })] }), _jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "DELETE" }), ": delete the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace the specified ", kind] })] })] }), hasStatus && (_jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}/status` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read status of the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update status of the specified", ' ', kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace status of the specified ", kind] })] })] })), hasScale && (_jsxs(X.li, { children: [_jsx("code", { children: `${apiPath}/{name}/scale` }), _jsxs(X.ul, { children: [_jsxs(X.li, { children: [_jsx("code", { children: "GET" }), ": read scale of the specified ", kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PATCH" }), ": partially update scale of the specified", ' ', kind] }), _jsxs(X.li, { children: [_jsx("code", { children: "PUT" }), ": replace scale of the specified ", kind] })] })] }))] }), _jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: apiPath }) }), _jsx(K8sAPIListEndpoint, { kind: kind }), _jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}` }) }), _jsx(K8sAPIItemEndpoint, { kind: kind }), hasStatus && (_jsxs(_Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}/status` }) }), _jsx(K8sAPIStatusEndpoint, { kind: kind })] })), hasScale && (_jsxs(_Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${apiPath}/{name}/scale` }) }), _jsx(K8sAPIScaleEndpoint, { kind: kind })] }))] }));
20
38
  };
@@ -1,3 +1,4 @@
1
+ import BananaSlug from '@rspress/shared/github-slugger';
1
2
  import type { OpenAPIV3_1 } from 'openapi-types';
2
3
  export interface K8sAPISchemaProps {
3
4
  schema: OpenAPIV3_1.SchemaObject;
@@ -7,9 +8,16 @@ export interface K8sAPISchemaItemProps {
7
8
  schema: OpenAPIV3_1.SchemaObject;
8
9
  fullSchema?: OpenAPIV3_1.Document;
9
10
  propertyPath?: string;
11
+ /**
12
+ * A single stateful slugger shared across the whole schema tree of a page.
13
+ * github-slugger's stateless `slug()` strips `.`/`[`/`]`, so
14
+ * `.spec.foo` and `.spec.foo[]` collide into one id; a shared instance
15
+ * de-duplicates them (WCAG 4.1.1 / HTML id uniqueness).
16
+ */
17
+ slugger?: BananaSlug;
10
18
  }
11
19
  export declare const K8sAPISchemaItemBasic: ({ schema, }: {
12
20
  schema: OpenAPIV3_1.SchemaObject;
13
21
  }) => import("react/jsx-runtime").JSX.Element;
14
- export declare const K8sAPISchemaItem: ({ schema, fullSchema, propertyPath, }: K8sAPISchemaItemProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const K8sAPISchemaItem: ({ schema, fullSchema, propertyPath, slugger, }: K8sAPISchemaItemProps) => import("react/jsx-runtime").JSX.Element;
15
23
  export declare const K8sAPISchema: ({ schema, fullSchema }: K8sAPISchemaProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FallbackHeading } from '@rspress/core/theme';
2
+ import BananaSlug from '@rspress/shared/github-slugger';
3
3
  import { Fragment, useMemo } from 'react';
4
+ import { useTranslation } from '../hooks/index.js';
4
5
  import { resolveRef } from '../utils.js';
5
6
  import { Markdown } from './Markdown.js';
6
7
  import { APIReferenceLink } from './_APIReferenceLink.js';
8
+ import { HeadingTitle } from './_HeadingTitle.js';
7
9
  import { X } from './_X.js';
8
10
  const getSchemaValue = (schema, key = 'type') => {
9
11
  if (schema[key]) {
@@ -19,6 +21,16 @@ const getSchemaValue = (schema, key = 'type') => {
19
21
  if (key === 'type' && schema.oneOf?.length) {
20
22
  return schema.oneOf.map((it) => it[key]);
21
23
  }
24
+ // `x-kubernetes-int-or-string` fields carry their type under `anyOf`
25
+ // (`[{ type: 'integer' }, { type: 'string' }]`) with no top-level `type`.
26
+ if (key === 'type' && schema.anyOf?.length) {
27
+ const types = schema.anyOf
28
+ .map((it) => it[key])
29
+ .filter(Boolean);
30
+ if (types.length) {
31
+ return types;
32
+ }
33
+ }
22
34
  };
23
35
  const NESTED_SCHEMA_TYPES = new Set(['object', 'array']);
24
36
  const METADATA = 'metadata';
@@ -32,10 +44,12 @@ const derefSchema = (schema, fullSchema) => {
32
44
  };
33
45
  const typeCode = (type) => (_jsx("code", { children: Array.isArray(type) ? type.join('|') : type }));
34
46
  export const K8sAPISchemaItemBasic = ({ schema, }) => {
47
+ const t = useTranslation();
35
48
  const description = getSchemaValue(schema, 'description');
36
- return (_jsxs("dl", { children: [description && (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Description" }), _jsx("dd", { children: description })] })), _jsx("dt", { children: "Type" }), _jsx("dd", { children: typeCode(getSchemaValue(schema)) }), schema.required && (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Required" }), _jsx("dd", { children: schema.required.map((it) => (_jsx("code", { children: it }, it))) })] }))] }));
49
+ return (_jsxs("dl", { children: [description && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('description') }), _jsx("dd", { children: description })] })), _jsx("dt", { children: t('type') }), _jsx("dd", { children: typeCode(getSchemaValue(schema)) }), schema.required && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('required') }), _jsx("dd", { children: schema.required.map((it) => (_jsx("code", { children: it }, it))) })] }))] }));
37
50
  };
38
- export const K8sAPISchemaItem = ({ schema, fullSchema, propertyPath = '', }) => {
51
+ export const K8sAPISchemaItem = ({ schema, fullSchema, propertyPath = '', slugger, }) => {
52
+ const t = useTranslation();
39
53
  const schemaType = useMemo(() => getSchemaValue(schema), [schema]);
40
54
  const isArraySchema = schemaType === 'array';
41
55
  const nestedSchema = useMemo(() => isArraySchema
@@ -46,7 +60,7 @@ export const K8sAPISchemaItem = ({ schema, fullSchema, propertyPath = '', }) =>
46
60
  return (properties &&
47
61
  Object.entries(properties).map(([key, value]) => [key, derefSchema(value, fullSchema)]));
48
62
  }, [fullSchema, nestedSchema]);
49
- return (_jsxs(_Fragment, { children: [_jsx(K8sAPISchemaItemBasic, { schema: schema }), !propertyPath && _jsx(FallbackHeading, { level: 2, title: "Specification" }), isArraySchema && (_jsxs(_Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: `${propertyPath}[]` }) }), _jsx(K8sAPISchemaItemBasic, { schema: nestedSchema })] })), propertiesEntry && (_jsxs(_Fragment, { children: [_jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Property" }), _jsx("th", { children: "Type" }), _jsx("th", { children: "Description" })] }) }), _jsx("tbody", { children: propertiesEntry.map(([key, value]) => {
63
+ return (_jsxs(_Fragment, { children: [_jsx(K8sAPISchemaItemBasic, { schema: schema }), !propertyPath && (_jsx(HeadingTitle, { slugger: slugger, level: 2, children: t('specification') })), isArraySchema && (_jsxs(_Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(HeadingTitle, { slugger: slugger, level: 3, children: `${propertyPath}[]` }) }), _jsx(K8sAPISchemaItemBasic, { schema: nestedSchema })] })), propertiesEntry && (_jsxs(_Fragment, { children: [_jsxs(X.table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t('property') }), _jsx("th", { children: t('type') }), _jsx("th", { children: t('description') })] }) }), _jsx("tbody", { children: propertiesEntry.map(([key, value]) => {
50
64
  const description = getSchemaValue(value, 'description');
51
65
  const isMetadata = key === METADATA;
52
66
  return (_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: key }) }), _jsx("td", { children: isMetadata ? (_jsx("code", { children: _jsx(APIReferenceLink, { name: "ObjectMeta" }) })) : (typeCode(getSchemaValue(value))) }), _jsx("td", { children: _jsx(Markdown, { children: description ||
@@ -57,7 +71,11 @@ export const K8sAPISchemaItem = ({ schema, fullSchema, propertyPath = '', }) =>
57
71
  return;
58
72
  }
59
73
  const nestedPropertyPath = `${propertyPath}${isArraySchema ? '[]' : ''}.${key}`;
60
- return (_jsxs(Fragment, { children: [_jsx("div", { className: "rp-toc-exclude", children: _jsx(FallbackHeading, { level: 3, title: nestedPropertyPath }) }), _jsx(K8sAPISchemaItem, { schema: value, fullSchema: fullSchema, propertyPath: nestedPropertyPath })] }, key));
74
+ const heading = (_jsx(HeadingTitle, { slugger: slugger, level: 3, children: nestedPropertyPath }));
75
+ return (_jsxs(Fragment, { children: [propertyPath ? (_jsx("div", { className: "rp-toc-exclude", children: heading })) : (heading), _jsx(K8sAPISchemaItem, { schema: value, fullSchema: fullSchema, propertyPath: nestedPropertyPath, slugger: slugger })] }, key));
61
76
  })] }))] }));
62
77
  };
63
- export const K8sAPISchema = ({ schema, fullSchema }) => (_jsx(K8sAPISchemaItem, { schema: schema, fullSchema: fullSchema }));
78
+ export const K8sAPISchema = ({ schema, fullSchema }) => {
79
+ const slugger = useMemo(() => new BananaSlug(), []);
80
+ return (_jsx(K8sAPISchemaItem, { schema: schema, fullSchema: fullSchema, slugger: slugger }));
81
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Which JSX attributes carry prose that must reach the translation model.
3
+ *
4
+ * Everything that is **not** listed here is masked before a document is handed
5
+ * to the model (see `cli/translate-mask.ts`). The default is deliberate, and
6
+ * the failure modes are asymmetric:
7
+ *
8
+ * - over-masking leaves a label in the source language — visible and harmless;
9
+ * - under-masking lets an identifier (`Term name`, `K8sAPI name`, an `href`, an
10
+ * anchor id) be rewritten — silent, and the page breaks.
11
+ *
12
+ * So a component that nobody has classified yet lands on the safe side, and the
13
+ * list below is the only thing that has to be maintained when a component grows
14
+ * a prose-bearing prop.
15
+ *
16
+ * This lives beside the component definitions on purpose: the components are
17
+ * doom's own, so one declaration here is correct for every repository that
18
+ * consumes doom — no per-repository allowlist.
19
+ *
20
+ * Keys are JSX element names as they appear in the document (`Term`, `img`, …).
21
+ */
22
+ export declare const TRANSLATABLE_JSX_ATTRS: Readonly<Record<string, readonly string[] | undefined>>;
23
+ export declare const isTranslatableJsxAttr: (elementName: string | null | undefined, attrName: string) => boolean;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Which JSX attributes carry prose that must reach the translation model.
3
+ *
4
+ * Everything that is **not** listed here is masked before a document is handed
5
+ * to the model (see `cli/translate-mask.ts`). The default is deliberate, and
6
+ * the failure modes are asymmetric:
7
+ *
8
+ * - over-masking leaves a label in the source language — visible and harmless;
9
+ * - under-masking lets an identifier (`Term name`, `K8sAPI name`, an `href`, an
10
+ * anchor id) be rewritten — silent, and the page breaks.
11
+ *
12
+ * So a component that nobody has classified yet lands on the safe side, and the
13
+ * list below is the only thing that has to be maintained when a component grows
14
+ * a prose-bearing prop.
15
+ *
16
+ * This lives beside the component definitions on purpose: the components are
17
+ * doom's own, so one declaration here is correct for every repository that
18
+ * consumes doom — no per-repository allowlist.
19
+ *
20
+ * Keys are JSX element names as they appear in the document (`Term`, `img`, …).
21
+ */
22
+ export const TRANSLATABLE_JSX_ATTRS = {
23
+ // "Current behavior", "DR pair requirements" — a rendered callout heading.
24
+ Directive: ['title'],
25
+ // The link text, passed as a prop rather than as children.
26
+ ExternalSiteLink: ['children'],
27
+ // "Web Console", "MySQL" — a rendered tab label.
28
+ Tab: ['label'],
29
+ // Alternative text is prose read by screen readers.
30
+ img: ['alt'],
31
+ };
32
+ export const isTranslatableJsxAttr = (elementName, attrName) => !!elementName && !!TRANSLATABLE_JSX_ATTRS[elementName]?.includes(attrName);
@@ -1,3 +1,3 @@
1
1
  import type { Language } from '../../shared/index.js';
2
2
  export declare const useLang: () => Language;
3
- export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "toc" | "create" | "update" | "password" | "close" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip1" | "user_login_tip2" | "customer_portal_global" | "customer_portal_china" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat" | "show_more" | "show_less" | "products" | "all_product_documentation" | "explore_doc_all_products") => string;
3
+ export declare const useTranslation: () => (key: "function" | "name" | "description" | "delete" | "type" | "parameters" | "required" | "toc" | "create" | "update" | "password" | "thinking" | "close" | "collapse_all" | "expand_all" | "crd_no_schema" | "action" | "view" | "chinese" | "english" | "property" | "specification" | "api_endpoints" | "available_api_endpoints" | "http_method" | "http_responses" | "http_code" | "response_body" | "query_parameters" | "body_parameters" | "parameter" | "common_parameters" | "request_body" | "response" | "chinese_bad_cases" | "english_bad_cases" | "download_pdf" | "view_docs_as_pdf" | "ai_assistant" | "exclamation" | "semicolon" | "period" | "colon" | "user_login" | "user_login_tip1" | "user_login_tip2" | "customer_portal_global" | "customer_portal_china" | "account_id" | "username" | "captcha" | "login" | "current_field" | "field_required" | "ERR_INTERNET_DISCONNECTED" | "AccountDisabledError" | "CaptchaError" | "LoginError" | "NetworkError" | "TenantError" | "TenantNotFoundError" | "logout" | "hi_there" | "ai_assistant_tip" | "ai_assistant_placeholder" | "max_chars_exceeded_tip" | "thinking_process" | "referenced_doc_links" | "view_more_related_docs" | "view_less_related_docs" | "new_chat" | "show_more" | "show_less" | "products" | "all_product_documentation" | "explore_doc_all_products") => string;