@redocly/config 0.6.0 → 0.6.2

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 (67) hide show
  1. package/lib/default-theme-config-schema.d.ts +300 -1
  2. package/lib/default-theme-config-schema.js +2 -1
  3. package/lib/feedback-config-schema.d.ts +102 -0
  4. package/lib/feedback-config-schema.js +71 -0
  5. package/lib/graphql-config-schema.d.ts +303 -0
  6. package/lib/graphql-config-schema.js +129 -0
  7. package/lib/graphql-types.d.ts +9 -0
  8. package/lib/graphql-types.js +3 -0
  9. package/lib/index.d.ts +1 -1
  10. package/lib/index.js +2 -1
  11. package/lib/redoc-config-schema.js +2 -67
  12. package/lib/root-config-schema.d.ts +3587 -1837
  13. package/lib/root-config-schema.js +11 -7
  14. package/lib/types.d.ts +2 -0
  15. package/lib-esm/default-theme-config-schema.d.ts +300 -1
  16. package/lib-esm/default-theme-config-schema.js +2 -1
  17. package/lib-esm/feedback-config-schema.d.ts +102 -0
  18. package/lib-esm/feedback-config-schema.js +68 -0
  19. package/lib-esm/graphql-config-schema.d.ts +303 -0
  20. package/lib-esm/graphql-config-schema.js +126 -0
  21. package/lib-esm/graphql-types.d.ts +9 -0
  22. package/lib-esm/graphql-types.js +2 -0
  23. package/lib-esm/index.d.ts +1 -1
  24. package/lib-esm/index.js +1 -1
  25. package/lib-esm/redoc-config-schema.js +2 -67
  26. package/lib-esm/root-config-schema.d.ts +3587 -1837
  27. package/lib-esm/root-config-schema.js +11 -7
  28. package/lib-esm/types.d.ts +2 -0
  29. package/package.json +3 -2
  30. package/CHANGELOG.md +0 -74
  31. package/README_INTERNAL.md +0 -36
  32. package/lib/.tsbuildinfo +0 -1
  33. package/lib/constants.js.map +0 -1
  34. package/lib/default-theme-config-schema.js.map +0 -1
  35. package/lib/index.js.map +0 -1
  36. package/lib/portal-shared-types.js.map +0 -1
  37. package/lib/redoc-config-schema.js.map +0 -1
  38. package/lib/redoc-types.js.map +0 -1
  39. package/lib/remove-property-recursively.js.map +0 -1
  40. package/lib/reunite-config-schema.js.map +0 -1
  41. package/lib/root-config-schema.js.map +0 -1
  42. package/lib/types.js.map +0 -1
  43. package/lib-esm/.tsbuildinfo +0 -1
  44. package/lib-esm/constants.js.map +0 -1
  45. package/lib-esm/default-theme-config-schema.js.map +0 -1
  46. package/lib-esm/index.js.map +0 -1
  47. package/lib-esm/portal-shared-types.js.map +0 -1
  48. package/lib-esm/redoc-config-schema.js.map +0 -1
  49. package/lib-esm/redoc-types.js.map +0 -1
  50. package/lib-esm/remove-property-recursively.js.map +0 -1
  51. package/lib-esm/reunite-config-schema.js.map +0 -1
  52. package/lib-esm/root-config-schema.js.map +0 -1
  53. package/lib-esm/types.js.map +0 -1
  54. package/src/constants.ts +0 -18
  55. package/src/default-theme-config-schema.ts +0 -757
  56. package/src/index.ts +0 -14
  57. package/src/portal-shared-types.ts +0 -330
  58. package/src/redoc-config-schema.ts +0 -183
  59. package/src/redoc-types.ts +0 -80
  60. package/src/remove-property-recursively.ts +0 -39
  61. package/src/reunite-config-schema.ts +0 -7
  62. package/src/root-config-schema.ts +0 -404
  63. package/src/types.ts +0 -86
  64. package/tsconfig.build.json +0 -12
  65. package/tsconfig.json +0 -10
  66. package/tsconfig.lib-esm.json +0 -15
  67. /package/{LICENSE.md → LICENSE} +0 -0
package/src/index.ts DELETED
@@ -1,14 +0,0 @@
1
- export { rbacConfigSchema, rootRedoclyConfigSchema } from './root-config-schema';
2
- export {
3
- productThemeOverrideSchema,
4
- productConfigOverrideSchema,
5
- } from './default-theme-config-schema';
6
- export * from './types';
7
- export * from './portal-shared-types';
8
- export {
9
- ApigeeDevOnboardingIntegrationAuthType,
10
- AuthProviderType,
11
- LayoutVariant,
12
- REDOCLY_TEAMS_RBAC,
13
- REDOCLY_ROUTE_RBAC,
14
- } from './constants';
@@ -1,330 +0,0 @@
1
- import type { Node } from '@markdoc/markdoc/dist/src/types';
2
- import type { LayoutVariant, REDOCLY_ROUTE_RBAC, REDOCLY_TEAMS_RBAC } from './constants';
3
- import type {
4
- ProductConfig,
5
- ProductGoogleAnalyticsConfig,
6
- RbacScopeItems,
7
- SeoConfig,
8
- ThemeConfig,
9
- } from './types';
10
-
11
- export type ThemeUIConfig = ThemeConfig & {
12
- auth?: {
13
- // used by portal dev login emulator
14
- idpsInfo?: {
15
- idpId: string;
16
- type: string; // AuthProviderType
17
- title: string | undefined;
18
- }[];
19
- devLogin?: boolean;
20
- loginUrls?: Record<string, string>;
21
- };
22
- search?: {
23
- shortcuts?: string[];
24
- suggestedPages?: any[];
25
- };
26
- breadcrumbs?: {
27
- prefixItems?: ResolvedNavLinkItem[];
28
- };
29
- products?: {
30
- [key: string]: ProductUiConfig;
31
- };
32
- };
33
-
34
- export type ResolvedNavLinkItem = {
35
- type: 'link';
36
- fsPath?: string;
37
- metadata?: Record<string, unknown>;
38
- link: string;
39
- label: string;
40
- labelTranslationKey?: string;
41
- items?: ResolvedNavItem[];
42
- sidebar?: ResolvedNavItem[]; // for API catalog it contains the corresponding sidebar first item
43
- external?: boolean;
44
- target?: '_self' | '_blank';
45
-
46
- version?: string;
47
- isDefault?: boolean;
48
- versionFolderId?: string;
49
-
50
- badges?: ItemBadge[];
51
- httpVerb?: string;
52
- separatorLine?: boolean;
53
- linePosition?: 'top' | 'bottom';
54
- routeSlug?: string;
55
- active?: boolean;
56
- deprecated?: boolean;
57
- icon?: string;
58
- srcSet?: string;
59
- [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
60
- [REDOCLY_ROUTE_RBAC]?: {
61
- slug?: string;
62
- fsPath?: string;
63
- };
64
-
65
- linkedSidebars?: string[];
66
- languageInsensitive?: boolean;
67
- };
68
-
69
- export type ItemBadge = {
70
- name: string;
71
- color?: string;
72
- position?: 'before' | 'after';
73
- };
74
-
75
- export type ResolvedNavGroupItem = {
76
- type: 'group';
77
- fsPath?: string;
78
- metadata?: Record<string, unknown>;
79
- link?: string;
80
- label?: string;
81
- labelTranslationKey?: string;
82
- items?: ResolvedNavItem[];
83
- sidebar?: ResolvedNavItem[]; // for API catalog it contains the corresponding sidebar first item
84
- external?: boolean;
85
- target?: '_self' | '_blank';
86
- expanded?: string;
87
- selectFirstItemOnExpand?: boolean;
88
-
89
- version?: string;
90
- isDefault?: boolean;
91
- versionFolderId?: string;
92
-
93
- menuStyle?: MenuStyle;
94
- separatorLine?: boolean;
95
- linePosition?: 'top' | 'bottom';
96
- routeSlug?: string;
97
- active?: boolean;
98
- icon?: string;
99
- srcSet?: string;
100
- [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
101
- [REDOCLY_ROUTE_RBAC]?: {
102
- slug?: string;
103
- fsPath?: string;
104
- };
105
-
106
- linkedSidebars?: string[];
107
- languageInsensitive?: boolean;
108
- };
109
-
110
- export type ResolvedNavItem =
111
- | ResolvedNavLinkItem
112
- | ResolvedNavGroupItem
113
- | {
114
- type: 'separator';
115
- fsPath?: never;
116
- metadata?: Record<string, unknown>;
117
- label?: string;
118
- labelTranslationKey?: string;
119
- routeSlug?: never;
120
-
121
- version?: string;
122
- isDefault?: boolean;
123
- versionFolderId?: string;
124
-
125
- variant?: 'primary' | 'secondary';
126
- separatorLine?: boolean;
127
- linePosition?: 'top' | 'bottom';
128
- link?: undefined;
129
- items?: ResolvedNavItem[]; // for typescript
130
- sidebar?: ResolvedNavItem[]; // for typescript
131
- linkedSidebars?: string[]; // for typescript
132
- icon?: string; // for typescript
133
- srcSet?: string; // for typescript
134
- languageInsensitive?: boolean; // for typescript
135
- [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
136
- [REDOCLY_ROUTE_RBAC]?: {
137
- slug?: string;
138
- fsPath?: string;
139
- };
140
- }
141
- | {
142
- type: 'error';
143
-
144
- fsPath?: never;
145
- version?: string;
146
- isDefault?: boolean;
147
- versionFolderId?: string;
148
- metadata?: Record<string, unknown>;
149
- routeSlug?: never;
150
-
151
- label: string;
152
- labelTranslationKey?: string;
153
- link?: undefined;
154
- items?: ResolvedNavItem[]; // for typescript
155
- sidebar?: ResolvedNavItem[]; // for typescript
156
- linkedSidebars?: string[]; // for typescript
157
- icon?: string; // for typescript
158
- srcSet?: string; // for typescript
159
- languageInsensitive?: boolean; // for typescript
160
- [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
161
- [REDOCLY_ROUTE_RBAC]?: {
162
- slug?: string;
163
- fsPath?: string;
164
- };
165
- };
166
-
167
- export type ResolvedNavItemWithLink = (ResolvedNavLinkItem | ResolvedNavGroupItem) & {
168
- link: string;
169
- };
170
-
171
- export type ResolvedSidebar = {
172
- relatedNavbarItem?: BreadcrumbItem;
173
- items: ResolvedNavItem[];
174
- };
175
-
176
- export interface PageProps {
177
- metadata?: Record<string, unknown>;
178
- seo?: SeoConfig;
179
- frontmatter?: Omit<PageProps, 'frontmatter'> & {
180
- theme?: any;
181
- settings?: any;
182
- };
183
- disableAutoScroll?: boolean;
184
- lastModified?: string | null;
185
- [k: string]: unknown;
186
- dynamicMarkdocComponents?: string[];
187
- markdown?: MdOptions;
188
- openapiOptions?: OpenAPIOptions;
189
- definitionId?: string;
190
- variables?: {
191
- lang?: string;
192
- rbac?: {
193
- teams: string[];
194
- };
195
- };
196
- }
197
-
198
- export interface MdOptions {
199
- partials: Record<string, Node>;
200
- variables?: Record<string, any>;
201
- }
202
-
203
- export interface PageStaticData {
204
- props?: PageProps;
205
- [k: string]: unknown;
206
- }
207
-
208
- export type UserData = {
209
- isAuthenticated: boolean;
210
- name: string;
211
- email?: string;
212
- picture: string;
213
- logoutDisabled?: boolean;
214
- teams?: string[];
215
- };
216
-
217
- export interface PageData {
218
- templateId: string;
219
- redirectTo?: string;
220
- slug: string;
221
- sharedDataIds: Record<string, string>;
222
- props: PageProps;
223
- versions?: Version[];
224
- userData: UserData;
225
- }
226
-
227
- export type NavItem = {
228
- page?: string;
229
- directory?: string;
230
- group?: string;
231
- groupTranslationKey?: string;
232
- label?: string;
233
- labelTranslationKey?: string;
234
- href?: string;
235
- items?: NavItem[];
236
- separator?: string;
237
- separatorTranslationKey?: string;
238
- separatorLine?: boolean;
239
- linePosition?: 'top' | 'bottom';
240
- version?: string;
241
- menuStyle?: MenuStyle;
242
- external?: boolean;
243
- target?: '_self' | '_blank';
244
- expanded?: boolean | 'always';
245
- selectFirstItemOnExpand?: boolean;
246
- flatten?: boolean; // for API catalog only
247
- icon?: string | { srcSet: string };
248
- rbac?: RbacScopeItems;
249
- linkedSidebars?: string[];
250
- $ref?: string;
251
- disconnect?: boolean;
252
- };
253
-
254
- export interface LogoConfig {
255
- image?: string;
256
- srcSet?: string;
257
- altText?: string;
258
- link?: string;
259
- favicon?: string;
260
- }
261
-
262
- export type Version = {
263
- version: string;
264
- label: string;
265
- link: string;
266
- default: boolean;
267
- active: boolean;
268
- notExists?: boolean;
269
- folderId: string;
270
- [REDOCLY_TEAMS_RBAC]?: RbacScopeItems;
271
- [REDOCLY_ROUTE_RBAC]?: {
272
- slug?: string;
273
- fsPath?: string;
274
- };
275
- };
276
-
277
- export type VersionConfigItem = {
278
- version: string;
279
- name?: string;
280
- };
281
-
282
- export type VersionsConfigType = {
283
- versions: VersionConfigItem[];
284
- default?: string;
285
- };
286
-
287
- export type VersionedFolderConfig = {
288
- // key is a relative path to file inside of a versioned folder, value is an array of versions
289
- versionedFiles: Map<string, Set<string>>;
290
-
291
- defaultVersion?: string;
292
- versions: VersionConfigItem[];
293
- hasVersionsConfig?: boolean; // if versions.yaml file exists
294
- };
295
-
296
- export type NavGroup = ResolvedNavItem[] | undefined | string | boolean | number;
297
-
298
- export type NavGroupRecord = Record<string, NavGroup>;
299
-
300
- export type ResolvedConfigLinks = NavGroup | NavGroupRecord;
301
-
302
- export type RawNavConfigItem = NavItem | NavItem[] | string | undefined | boolean | number;
303
-
304
- export type RawNavConfig = RawNavConfigItem | Record<string, RawNavConfigItem>;
305
-
306
- export type OpenAPIOptions = {
307
- showRightPanelToggle?: boolean;
308
- layout?: LayoutVariant;
309
- collapsedSidebar?: boolean;
310
- };
311
-
312
- export type MenuStyle = 'drilldown' | 'drilldown-header';
313
-
314
- export type BreadcrumbItem = {
315
- label: string;
316
- link?: string;
317
- };
318
-
319
- export type ProductThemeOverrideConfig = Pick<
320
- ThemeUIConfig,
321
- 'logo' | 'navbar' | 'footer' | 'sidebar' | 'search' | 'codeSnippet' | 'breadcrumbs' | 'feedback'
322
- > & { analytics?: { ga?: ProductGoogleAnalyticsConfig } };
323
-
324
- export type ProductUiConfig = ProductConfig & {
325
- slug: string;
326
- link: string;
327
- [REDOCLY_TEAMS_RBAC]?: { [key: string]: string };
328
- [REDOCLY_ROUTE_RBAC]?: { [key: string]: string };
329
- themeOverride?: ProductThemeOverrideConfig;
330
- };
@@ -1,183 +0,0 @@
1
- const codeSamplesConfigSchema = {
2
- type: 'object',
3
- properties: {
4
- languages: {
5
- type: 'array',
6
- items: {
7
- type: 'object',
8
- properties: {
9
- lang: {
10
- type: 'string',
11
- enum: [
12
- 'curl',
13
- 'JavaScript',
14
- 'Node.js',
15
- 'Python',
16
- 'Java8+Apache',
17
- 'Java',
18
- 'C#',
19
- 'C#+Newtonsoft',
20
- 'PHP',
21
- 'Go',
22
- 'Ruby',
23
- 'R',
24
- 'Payload',
25
- ],
26
- },
27
- label: { type: 'string' },
28
- options: {
29
- type: 'object',
30
- properties: {
31
- indent: { type: 'string' },
32
- withImports: { type: 'boolean' },
33
- withComments: { type: 'boolean' },
34
- binary: { type: 'boolean' },
35
- credentials: {
36
- type: 'string',
37
- enum: ['omit', 'same-origin', 'include'],
38
- },
39
- },
40
- additionalProperties: false,
41
- },
42
- },
43
- required: ['lang'],
44
- additionalProperties: false,
45
- },
46
- },
47
- skipOptionalParameters: { type: 'boolean' },
48
- withOAuth2Call: { type: 'boolean' },
49
- },
50
- required: ['languages'],
51
- additionalProperties: false,
52
- } as const;
53
-
54
- const downloadUrlsSchema = {
55
- type: 'array',
56
- items: {
57
- type: 'object',
58
- properties: {
59
- title: { type: 'string' },
60
- url: { type: 'string' },
61
- },
62
- required: ['url'],
63
- additionalProperties: false,
64
- },
65
- } as const;
66
-
67
- export const redocConfigSchema = {
68
- type: 'object',
69
- properties: {
70
- licenseKey: { type: 'string' },
71
- hideLoading: { type: 'boolean' },
72
- disableRouter: { type: 'boolean' },
73
- hideSidebar: { type: 'boolean' },
74
- feedback: {
75
- type: 'object',
76
- properties: {
77
- hide: {
78
- type: 'boolean',
79
- default: false,
80
- },
81
- type: {
82
- type: 'string',
83
- enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood', 'scale'],
84
- default: 'sentiment',
85
- },
86
- settings: {
87
- type: 'object',
88
- properties: {
89
- label: { type: 'string' },
90
- submitText: { type: 'string' },
91
- buttonText: { type: 'string' },
92
- component: {
93
- type: 'string',
94
- enum: ['radio', 'checkbox'],
95
- default: 'checkbox',
96
- },
97
- items: { type: 'array', items: { type: 'string' }, minItems: 1 },
98
- leftScaleLabel: { type: 'string' },
99
- rightScaleLabel: { type: 'string' },
100
- reasons: {
101
- type: 'object',
102
- properties: {
103
- hide: {
104
- type: 'boolean',
105
- default: false,
106
- },
107
- component: {
108
- type: 'string',
109
- enum: ['radio', 'checkbox'],
110
- default: 'checkbox',
111
- },
112
- label: { type: 'string' },
113
- items: { type: 'array', items: { type: 'string' } },
114
- },
115
- additionalProperties: false,
116
- },
117
- comment: {
118
- type: 'object',
119
- properties: {
120
- hide: {
121
- type: 'boolean',
122
- default: false,
123
- },
124
- label: { type: 'string' },
125
- likeLabel: { type: 'string' },
126
- dislikeLabel: { type: 'string' },
127
- satisfiedLabel: { type: 'string' },
128
- neutralLabel: { type: 'string' },
129
- dissatisfiedLabel: { type: 'string' },
130
- },
131
- additionalProperties: false,
132
- },
133
- },
134
- additionalProperties: false,
135
- },
136
- },
137
- additionalProperties: false,
138
- default: null,
139
- nullable: true,
140
- },
141
- hideReplay: { type: 'boolean' },
142
- oAuth2RedirectURI: { type: 'string', nullable: true },
143
- corsProxyUrl: { type: 'string' },
144
- sortRequiredPropsFirst: { type: 'boolean' },
145
- sanitize: { type: 'boolean' },
146
- hideDownloadButtons: { type: 'boolean' },
147
- downloadUrls: downloadUrlsSchema,
148
- onlyRequiredInSamples: { type: 'boolean' },
149
- generatedSamplesMaxDepth: { oneOf: [{ type: 'number' }, { type: 'string' }] },
150
- showExtensions: {
151
- oneOf: [
152
- { type: 'boolean' },
153
- { type: 'string' },
154
- { type: 'array', items: { type: 'string' } },
155
- ],
156
- },
157
- hideSchemaTitles: { type: 'boolean' },
158
- jsonSamplesExpandLevel: { oneOf: [{ type: 'number' }, { type: 'string' }] },
159
- schemasExpansionLevel: { oneOf: [{ type: 'number' }, { type: 'string' }] },
160
- mockServer: {
161
- type: 'object',
162
- properties: {
163
- url: { type: 'string' },
164
- position: { enum: ['first', 'last', 'replace', 'off'] },
165
- description: { type: 'string' },
166
- },
167
- },
168
- maxDisplayedEnumValues: { type: 'number' },
169
- schemaDefinitionsTagName: { type: 'string' },
170
- layout: { type: 'string', enum: ['stacked', 'three-panel'] },
171
- hideInfoMetadata: { type: 'boolean' },
172
- events: { type: 'object' },
173
- skipBundle: { type: 'boolean' },
174
- routingBasePath: { type: 'string' },
175
- codeSamples: codeSamplesConfigSchema,
176
- ignoreNamedSchemas: {
177
- oneOf: [{ type: 'array', items: { type: 'string' } }, { type: 'string' }],
178
- },
179
- hidePropertiesPrefix: { type: 'boolean' },
180
- excludeFromSearch: { type: 'boolean' },
181
- },
182
- additionalProperties: false,
183
- } as const;
@@ -1,80 +0,0 @@
1
- import type { ReactElement, ComponentType } from 'react';
2
- import type { FromSchema } from 'json-schema-to-ts';
3
- import type { Schema, ConfigFunction } from '@markdoc/markdoc/dist/src/types';
4
- import type { redocConfigSchema } from './redoc-config-schema';
5
-
6
- export type RedocConfigTypes = FromSchema<typeof redocConfigSchema> & {
7
- markdocOptions?: {
8
- tags: Record<string, Schema>;
9
- nodes: Record<string, Schema>;
10
- components: Record<string, ComponentType>;
11
- variables?: Record<string, any>;
12
- partials?: Record<string, any>;
13
- functions?: Record<string, ConfigFunction>;
14
- };
15
- onDeepLinkClick?: ((link: string) => void) | undefined | null;
16
- unstable_hooks?: HooksConfig;
17
- requestInterceptor?: ((req: Request, operation: OperationModel) => void) | undefined | null;
18
- unstable_externalCodeSamples?: Unstable_ExternalCodeSample[];
19
- scrollYOffset?: number | string | (() => number);
20
- };
21
-
22
- type HooksConfig = {
23
- AfterApiTitle?: HookConfig<{ info: OpenAPIInfo }>;
24
- BeforeOperation?: HookConfig<{ operation: OperationModel }>;
25
- BeforeOperationSummary?: HookConfig<{ operation: OperationModel }>;
26
- AfterOperationSummary?: HookConfig<{ operation: OperationModel }>;
27
- AfterOperation?: HookConfig<{ operation: OperationModel }>;
28
- onInit?: (args: { store: Record<string, any> }) => void;
29
- replaceSecurityLink?: (args: { securityRequirementId: string }) => string;
30
- sanitize?: (raw: string) => string;
31
- MiddlePanelFooter?: HookConfig<undefined>;
32
- MiddlePanelHeader?: HookConfig<undefined>;
33
- };
34
-
35
- type OpenAPIInfo = {
36
- title: string;
37
- version: string;
38
- description?: string;
39
- summary?: string;
40
- termsOfService?: string;
41
- contact?: Record<string, any>;
42
- license?: Record<string, any>;
43
- 'x-logo'?: Record<string, any>;
44
- 'x-metadata'?: Record<string, any>;
45
- 'x-seo'?: Record<string, any>;
46
- };
47
-
48
- type HookResult =
49
- | ReactElement
50
- | {
51
- html: string;
52
- }
53
- | null;
54
-
55
- type HookConfig<T> = (props: T) => HookResult;
56
-
57
- type Unstable_ExternalCodeSample = {
58
- get: (source: ExternalSource) => string;
59
- lang: string;
60
- label?: string;
61
- };
62
-
63
- type ExternalSource = {
64
- sample: Unstable_ExternalCodeSample;
65
- operation: OperationModel;
66
- exampleName?: string;
67
- pathParams?: any;
68
- properties?: any;
69
- };
70
-
71
- type OperationModel = {
72
- id: string;
73
- name: string;
74
- description?: string | Record<string, any>;
75
- href: string;
76
- pointer: string;
77
- httpVerb: string;
78
- deprecated: boolean;
79
- path: string;
80
- };
@@ -1,39 +0,0 @@
1
- type Removed<T, Drop> = T extends Record<string, any>
2
- ? T extends ArrayLike<any>
3
- ? Array<Removed<T[number], Drop>>
4
- : {
5
- [K in Exclude<keyof T, Drop>]: Removed<T[K], Drop>;
6
- }
7
- : T;
8
-
9
- export function removePropertyRecursively<TObject extends object, TProp extends string>(
10
- object: TObject,
11
- propToRemove: TProp,
12
- ): Removed<TObject, TProp> {
13
- return Object.fromEntries(
14
- Object.entries(object)
15
- .map(([key, value]) => {
16
- if (key === propToRemove) {
17
- return undefined;
18
- }
19
-
20
- if (typeof value !== 'object' || !value) {
21
- return [key, value];
22
- }
23
-
24
- if (Array.isArray(value)) {
25
- return [
26
- key,
27
- value.map((arrayItem) =>
28
- typeof arrayItem === 'object'
29
- ? removePropertyRecursively(arrayItem, propToRemove)
30
- : arrayItem,
31
- ),
32
- ];
33
- }
34
-
35
- return [key, removePropertyRecursively(value as Record<string, unknown>, propToRemove)];
36
- })
37
- .filter(Boolean) as [string, unknown][],
38
- ) as Removed<TObject, TProp>;
39
- }
@@ -1,7 +0,0 @@
1
- export const reuniteConfigSchema = {
2
- type: 'object',
3
- properties: {
4
- ignoreLinkChecker: { type: 'boolean' },
5
- },
6
- additionalProperties: false,
7
- } as const;