@redocly/openapi-core 1.10.2 → 1.10.4

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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/lib/bundle.d.ts +1 -1
  3. package/lib/bundle.js +2 -2
  4. package/lib/config/config.d.ts +6 -0
  5. package/lib/config/config.js +19 -1
  6. package/lib/config/load.js +2 -2
  7. package/lib/config/types.d.ts +0 -10
  8. package/lib/config/types.js +0 -13
  9. package/lib/decorators/common/registry-dependencies.js +2 -2
  10. package/lib/env.js +3 -1
  11. package/lib/index.d.ts +2 -3
  12. package/lib/index.js +2 -17
  13. package/lib/oas-types.d.ts +1 -1
  14. package/lib/redocly/index.d.ts +2 -1
  15. package/lib/redocly/index.js +24 -14
  16. package/lib/redocly/registry-api.d.ts +2 -2
  17. package/lib/redocly/registry-api.js +9 -9
  18. package/lib/types/redocly-yaml.js +3 -3
  19. package/lib/utils.d.ts +0 -2
  20. package/lib/utils.js +1 -7
  21. package/package.json +3 -4
  22. package/src/__tests__/lint.test.ts +2 -30
  23. package/src/bundle.ts +1 -1
  24. package/src/config/config.ts +23 -1
  25. package/src/config/load.ts +1 -2
  26. package/src/config/types.ts +0 -13
  27. package/src/decorators/common/registry-dependencies.ts +1 -1
  28. package/src/env.ts +3 -1
  29. package/src/index.ts +2 -11
  30. package/src/redocly/__tests__/redocly-client.test.ts +3 -5
  31. package/src/redocly/index.ts +24 -14
  32. package/src/redocly/registry-api.ts +31 -25
  33. package/src/types/redocly-yaml.ts +2 -2
  34. package/src/utils.ts +1 -7
  35. package/tsconfig.tsbuildinfo +1 -1
  36. package/lib/redocly/domains.d.ts +0 -14
  37. package/lib/redocly/domains.js +0 -41
  38. package/lib/types/portal-config-schema.d.ts +0 -5299
  39. package/lib/types/portal-config-schema.js +0 -338
  40. package/lib/types/theme-config.d.ts +0 -2541
  41. package/lib/types/theme-config.js +0 -637
  42. package/src/redocly/__tests__/domains.test.ts +0 -52
  43. package/src/redocly/domains.ts +0 -48
  44. package/src/types/portal-config-schema.ts +0 -416
  45. package/src/types/theme-config.ts +0 -781
@@ -1,637 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.productThemeOverrideSchema = exports.themeConfigSchema = void 0;
4
- const logoConfigSchema = {
5
- type: 'object',
6
- properties: {
7
- image: { type: 'string' },
8
- srcSet: { type: 'string' },
9
- altText: { type: 'string' },
10
- link: { type: 'string' },
11
- favicon: { type: 'string' },
12
- },
13
- additionalProperties: false,
14
- };
15
- const hideConfigSchema = {
16
- type: 'object',
17
- properties: {
18
- hide: { type: 'boolean' },
19
- },
20
- additionalProperties: false,
21
- };
22
- const scriptConfigSchema = {
23
- type: 'object',
24
- properties: {
25
- src: { type: 'string' },
26
- async: { type: 'boolean' },
27
- crossorigin: { type: 'string' },
28
- defer: { type: 'boolean' },
29
- fetchpriority: { type: 'string' },
30
- integrity: { type: 'string' },
31
- module: { type: 'boolean' },
32
- nomodule: { type: 'boolean' },
33
- nonce: { type: 'string' },
34
- referrerpolicy: { type: 'string' },
35
- type: { type: 'string' },
36
- },
37
- required: ['src'],
38
- additionalProperties: true,
39
- };
40
- const linksConfigSchema = {
41
- type: 'object',
42
- properties: {
43
- href: { type: 'string' },
44
- as: { type: 'string' },
45
- crossorigin: { type: 'string' },
46
- fetchpriority: { type: 'string' },
47
- hreflang: { type: 'string' },
48
- imagesizes: { type: 'string' },
49
- imagesrcset: { type: 'string' },
50
- integrity: { type: 'string' },
51
- media: { type: 'string' },
52
- prefetch: { type: 'string' },
53
- referrerpolicy: { type: 'string' },
54
- rel: { type: 'string' },
55
- sizes: { type: 'string' },
56
- title: { type: 'string' },
57
- type: { type: 'string' },
58
- },
59
- required: ['href'],
60
- additionalProperties: true,
61
- };
62
- const markdownConfigSchema = {
63
- type: 'object',
64
- properties: {
65
- frontMatterKeysToResolve: {
66
- type: 'array',
67
- items: { type: 'string' },
68
- default: ['image', 'links'],
69
- },
70
- partialsFolders: {
71
- type: 'array',
72
- items: { type: 'string' },
73
- default: ['_partials'],
74
- },
75
- lastUpdatedBlock: {
76
- type: 'object',
77
- properties: Object.assign({ format: {
78
- type: 'string',
79
- enum: ['timeago', 'iso', 'long', 'short'],
80
- default: 'timeago',
81
- }, locale: { type: 'string' } }, hideConfigSchema.properties),
82
- additionalProperties: false,
83
- default: {},
84
- },
85
- toc: {
86
- type: 'object',
87
- properties: Object.assign({ header: { type: 'string', default: 'On this page' }, depth: { type: 'integer', default: 3, minimum: 1 } }, hideConfigSchema.properties),
88
- additionalProperties: false,
89
- default: {},
90
- },
91
- editPage: {
92
- type: 'object',
93
- properties: Object.assign({ baseUrl: { type: 'string' } }, hideConfigSchema.properties),
94
- additionalProperties: false,
95
- default: {},
96
- },
97
- },
98
- additionalProperties: false,
99
- default: {},
100
- };
101
- const amplitudeAnalyticsConfigSchema = {
102
- type: 'object',
103
- properties: {
104
- includeInDevelopment: { type: 'boolean' },
105
- apiKey: { type: 'string' },
106
- head: { type: 'boolean' },
107
- respectDNT: { type: 'boolean' },
108
- exclude: { type: 'array', items: { type: 'string' } },
109
- outboundClickEventName: { type: 'string' },
110
- pageViewEventName: { type: 'string' },
111
- amplitudeConfig: { type: 'object', additionalProperties: true },
112
- },
113
- additionalProperties: false,
114
- required: ['apiKey'],
115
- };
116
- const fullstoryAnalyticsConfigSchema = {
117
- type: 'object',
118
- properties: {
119
- includeInDevelopment: { type: 'boolean' },
120
- orgId: { type: 'string' },
121
- },
122
- additionalProperties: false,
123
- required: ['orgId'],
124
- };
125
- const heapAnalyticsConfigSchema = {
126
- type: 'object',
127
- properties: {
128
- includeInDevelopment: { type: 'boolean' },
129
- appId: { type: 'string' },
130
- },
131
- additionalProperties: false,
132
- required: ['appId'],
133
- };
134
- const rudderstackAnalyticsConfigSchema = {
135
- type: 'object',
136
- properties: {
137
- includeInDevelopment: { type: 'boolean' },
138
- writeKey: { type: 'string', minLength: 10 },
139
- trackPage: { type: 'boolean' },
140
- dataPlaneUrl: { type: 'string' },
141
- controlPlaneUrl: { type: 'string' },
142
- sdkUrl: { type: 'string' },
143
- loadOptions: { type: 'object', additionalProperties: true },
144
- },
145
- additionalProperties: false,
146
- required: ['writeKey'],
147
- };
148
- const segmentAnalyticsConfigSchema = {
149
- type: 'object',
150
- properties: {
151
- includeInDevelopment: { type: 'boolean' },
152
- writeKey: { type: 'string', minLength: 10 },
153
- trackPage: { type: 'boolean' },
154
- includeTitleInPageCall: { type: 'boolean' },
155
- host: { type: 'string' },
156
- },
157
- additionalProperties: false,
158
- required: ['writeKey'],
159
- };
160
- const gtmAnalyticsConfigSchema = {
161
- type: 'object',
162
- properties: {
163
- includeInDevelopment: { type: 'boolean' },
164
- trackingId: { type: 'string' },
165
- gtmAuth: { type: 'string' },
166
- gtmPreview: { type: 'string' },
167
- defaultDataLayer: {},
168
- dataLayerName: { type: 'string' },
169
- enableWebVitalsTracking: { type: 'boolean' },
170
- selfHostedOrigin: { type: 'string' },
171
- pageViewEventName: { type: 'string' },
172
- },
173
- additionalProperties: false,
174
- required: ['trackingId'],
175
- };
176
- const productGoogleAnalyticsConfigSchema = {
177
- type: 'object',
178
- properties: {
179
- includeInDevelopment: { type: 'boolean' },
180
- trackingId: { type: 'string' },
181
- conversionId: { type: 'string' },
182
- floodlightId: { type: 'string' },
183
- optimizeId: { type: 'string' },
184
- exclude: { type: 'array', items: { type: 'string' } },
185
- },
186
- additionalProperties: false,
187
- required: ['trackingId'],
188
- };
189
- const googleAnalyticsConfigSchema = {
190
- type: 'object',
191
- properties: {
192
- includeInDevelopment: { type: 'boolean' },
193
- trackingId: { type: 'string' },
194
- conversionId: { type: 'string' },
195
- floodlightId: { type: 'string' },
196
- head: { type: 'boolean' },
197
- respectDNT: { type: 'boolean' },
198
- exclude: { type: 'array', items: { type: 'string' } },
199
- optimizeId: { type: 'string' },
200
- anonymizeIp: { type: 'boolean' },
201
- cookieExpires: { type: 'number' },
202
- // All enabled tracking configs
203
- trackers: {
204
- type: 'object',
205
- additionalProperties: productGoogleAnalyticsConfigSchema,
206
- },
207
- },
208
- additionalProperties: false,
209
- required: ['trackingId'],
210
- };
211
- const adobeAnalyticsConfigSchema = {
212
- type: 'object',
213
- properties: {
214
- includeInDevelopment: { type: 'boolean' },
215
- scriptUrl: { type: 'string' },
216
- pageViewEventName: { type: 'string' },
217
- },
218
- additionalProperties: false,
219
- required: ['scriptUrl'],
220
- };
221
- const navItemSchema = {
222
- type: 'object',
223
- properties: {
224
- page: { type: 'string' },
225
- directory: { type: 'string' },
226
- disconnect: { type: 'boolean', default: false },
227
- group: { type: 'string' },
228
- label: { type: 'string' },
229
- separator: { type: 'string' },
230
- separatorLine: { type: 'boolean' },
231
- linePosition: {
232
- type: 'string',
233
- enum: ['top', 'bottom'],
234
- default: 'top',
235
- },
236
- version: { type: 'string' },
237
- menuStyle: { type: 'string', enum: ['drilldown'] },
238
- expanded: { type: 'string', const: 'always' },
239
- selectFirstItemOnExpand: { type: 'boolean' },
240
- flatten: { type: 'boolean' },
241
- linkedSidebars: {
242
- type: 'array',
243
- items: { type: 'string' },
244
- },
245
- },
246
- };
247
- const navItemsSchema = {
248
- type: 'array',
249
- items: Object.assign(Object.assign({}, navItemSchema), { properties: Object.assign(Object.assign({}, navItemSchema.properties), { items: { type: 'array', items: navItemSchema } }) }),
250
- };
251
- const productConfigSchema = {
252
- type: 'object',
253
- properties: {
254
- name: { type: 'string' },
255
- icon: { type: 'string' },
256
- folder: { type: 'string' },
257
- },
258
- additionalProperties: false,
259
- required: ['name', 'folder'],
260
- };
261
- const suggestedPageSchema = {
262
- type: 'object',
263
- properties: {
264
- page: { type: 'string' },
265
- label: { type: 'string' },
266
- labelTranslationKey: { type: 'string' },
267
- },
268
- required: ['page'],
269
- };
270
- const catalogFilterSchema = {
271
- type: 'object',
272
- additionalProperties: false,
273
- required: ['title', 'property'],
274
- properties: {
275
- type: { type: 'string', enum: ['select', 'checkboxes', 'date-range'] },
276
- title: { type: 'string' },
277
- titleTranslationKey: { type: 'string' },
278
- property: { type: 'string' },
279
- parentFilter: { type: 'string' },
280
- valuesMapping: { type: 'object', additionalProperties: { type: 'string' } },
281
- missingCategoryName: { type: 'string' },
282
- missingCategoryNameTranslationKey: { type: 'string' },
283
- options: { type: 'array', items: { type: 'string' } },
284
- },
285
- };
286
- const scorecardConfigSchema = {
287
- type: 'object',
288
- additionalProperties: true,
289
- required: [],
290
- properties: {
291
- ignoreNonCompliant: { type: 'boolean', default: false },
292
- teamMetadataProperty: {
293
- type: 'object',
294
- properties: {
295
- property: { type: 'string' },
296
- label: { type: 'string' },
297
- default: { type: 'string' },
298
- },
299
- },
300
- levels: {
301
- type: 'array',
302
- items: {
303
- type: 'object',
304
- required: ['name'],
305
- properties: {
306
- name: { type: 'string' },
307
- color: { type: 'string' },
308
- extends: { type: 'array', items: { type: 'string' } },
309
- rules: {
310
- type: 'object',
311
- additionalProperties: {
312
- oneOf: [{ type: 'string' }, { type: 'object' }],
313
- },
314
- },
315
- },
316
- additionalProperties: false,
317
- },
318
- },
319
- targets: {
320
- type: 'array',
321
- items: {
322
- type: 'object',
323
- required: ['where'],
324
- properties: {
325
- minimumLevel: { type: 'string' },
326
- where: {
327
- type: 'object',
328
- required: ['metadata'],
329
- properties: {
330
- metadata: { type: 'object', additionalProperties: { type: 'string' } },
331
- },
332
- additionalProperties: false,
333
- },
334
- },
335
- additionalProperties: false,
336
- },
337
- },
338
- },
339
- };
340
- const catalogSchema = {
341
- type: 'object',
342
- additionalProperties: true,
343
- required: ['slug', 'items'],
344
- properties: {
345
- slug: { type: 'string' },
346
- filters: { type: 'array', items: catalogFilterSchema },
347
- groupByFirstFilter: { type: 'boolean' },
348
- filterValuesCasing: {
349
- type: 'string',
350
- enum: ['sentence', 'original', 'lowercase', 'uppercase'],
351
- },
352
- items: navItemsSchema,
353
- requiredPermission: { type: 'string' },
354
- separateVersions: { type: 'boolean' },
355
- title: { type: 'string' },
356
- titleTranslationKey: { type: 'string' },
357
- description: { type: 'string' },
358
- descriptionTranslationKey: { type: 'string' },
359
- },
360
- };
361
- const catalogsConfigSchema = {
362
- type: 'object',
363
- patternProperties: {
364
- '.*': catalogSchema,
365
- },
366
- };
367
- exports.themeConfigSchema = {
368
- type: 'object',
369
- properties: {
370
- imports: {
371
- type: 'array',
372
- items: { type: 'string' },
373
- default: [],
374
- },
375
- logo: logoConfigSchema,
376
- navbar: {
377
- type: 'object',
378
- properties: Object.assign({ items: navItemsSchema }, hideConfigSchema.properties),
379
- additionalProperties: false,
380
- },
381
- products: {
382
- type: 'object',
383
- additionalProperties: productConfigSchema,
384
- },
385
- footer: {
386
- type: 'object',
387
- properties: Object.assign({ items: navItemsSchema, copyrightText: { type: 'string' }, logo: hideConfigSchema }, hideConfigSchema.properties),
388
- additionalProperties: false,
389
- },
390
- sidebar: {
391
- type: 'object',
392
- properties: Object.assign({ separatorLine: { type: 'boolean' }, linePosition: {
393
- type: 'string',
394
- enum: ['top', 'bottom'],
395
- default: 'bottom',
396
- } }, hideConfigSchema.properties),
397
- additionalProperties: false,
398
- },
399
- scripts: {
400
- type: 'object',
401
- properties: {
402
- head: { type: 'array', items: scriptConfigSchema },
403
- body: { type: 'array', items: scriptConfigSchema },
404
- },
405
- additionalProperties: false,
406
- },
407
- links: { type: 'array', items: linksConfigSchema },
408
- feedback: {
409
- type: 'object',
410
- properties: {
411
- hide: {
412
- type: 'boolean',
413
- default: false,
414
- },
415
- type: {
416
- type: 'string',
417
- enum: ['rating', 'sentiment', 'comment', 'reasons', 'mood', 'scale'],
418
- default: 'sentiment',
419
- },
420
- settings: Object.assign({ type: 'object', properties: {
421
- label: { type: 'string' },
422
- submitText: { type: 'string' },
423
- buttonText: { type: 'string' },
424
- component: {
425
- type: 'string',
426
- enum: ['radio', 'checkbox'],
427
- default: 'checkbox',
428
- },
429
- items: { type: 'array', items: { type: 'string' }, minItems: 1 },
430
- leftScaleLabel: { type: 'string' },
431
- rightScaleLabel: { type: 'string' },
432
- reasons: {
433
- type: 'object',
434
- properties: {
435
- hide: {
436
- type: 'boolean',
437
- default: false,
438
- },
439
- component: {
440
- type: 'string',
441
- enum: ['radio', 'checkbox'],
442
- default: 'checkbox',
443
- },
444
- label: { type: 'string' },
445
- items: { type: 'array', items: { type: 'string' } },
446
- },
447
- additionalProperties: false,
448
- },
449
- comment: {
450
- type: 'object',
451
- properties: {
452
- hide: {
453
- type: 'boolean',
454
- default: false,
455
- },
456
- label: { type: 'string' },
457
- likeLabel: { type: 'string' },
458
- dislikeLabel: { type: 'string' },
459
- satisfiedLabel: { type: 'string' },
460
- neutralLabel: { type: 'string' },
461
- dissatisfiedLabel: { type: 'string' },
462
- },
463
- additionalProperties: false,
464
- },
465
- }, additionalProperties: false }, hideConfigSchema.properties),
466
- },
467
- additionalProperties: false,
468
- default: {},
469
- },
470
- search: {
471
- type: 'object',
472
- properties: Object.assign({ placement: {
473
- type: 'string',
474
- default: 'navbar',
475
- }, shortcuts: {
476
- type: 'array',
477
- items: { type: 'string' },
478
- default: ['/'],
479
- }, suggestedPages: {
480
- type: 'array',
481
- items: suggestedPageSchema,
482
- } }, hideConfigSchema.properties),
483
- additionalProperties: false,
484
- default: {},
485
- },
486
- colorMode: {
487
- type: 'object',
488
- properties: Object.assign({ ignoreDetection: { type: 'boolean' }, modes: {
489
- type: 'array',
490
- items: { type: 'string' },
491
- default: ['light', 'dark'],
492
- } }, hideConfigSchema.properties),
493
- additionalProperties: false,
494
- default: {},
495
- },
496
- navigation: {
497
- type: 'object',
498
- properties: {
499
- nextButton: {
500
- type: 'object',
501
- properties: Object.assign({ text: { type: 'string', default: 'Next to {{label}}' } }, hideConfigSchema.properties),
502
- additionalProperties: false,
503
- default: {},
504
- },
505
- previousButton: {
506
- type: 'object',
507
- properties: Object.assign({ text: { type: 'string', default: 'Back to {{label}}' } }, hideConfigSchema.properties),
508
- additionalProperties: false,
509
- default: {},
510
- },
511
- },
512
- additionalProperties: false,
513
- default: {},
514
- },
515
- codeSnippet: {
516
- type: 'object',
517
- properties: {
518
- elementFormat: { type: 'string', default: 'icon' },
519
- copy: {
520
- type: 'object',
521
- properties: Object.assign({}, hideConfigSchema.properties),
522
- additionalProperties: false,
523
- default: { hide: false },
524
- },
525
- report: {
526
- type: 'object',
527
- properties: Object.assign({ tooltipText: { type: 'string' }, buttonText: { type: 'string' }, label: { type: 'string' } }, hideConfigSchema.properties),
528
- additionalProperties: false,
529
- default: { hide: false },
530
- },
531
- expand: {
532
- type: 'object',
533
- properties: Object.assign({}, hideConfigSchema.properties),
534
- additionalProperties: false,
535
- default: { hide: false },
536
- },
537
- collapse: {
538
- type: 'object',
539
- properties: Object.assign({}, hideConfigSchema.properties),
540
- additionalProperties: false,
541
- default: { hide: false },
542
- },
543
- },
544
- additionalProperties: false,
545
- default: {},
546
- },
547
- markdown: markdownConfigSchema,
548
- openapi: { type: 'object', additionalProperties: true },
549
- graphql: { type: 'object', additionalProperties: true },
550
- analytics: {
551
- type: 'object',
552
- properties: {
553
- adobe: adobeAnalyticsConfigSchema,
554
- amplitude: amplitudeAnalyticsConfigSchema,
555
- fullstory: fullstoryAnalyticsConfigSchema,
556
- heap: heapAnalyticsConfigSchema,
557
- rudderstack: rudderstackAnalyticsConfigSchema,
558
- segment: segmentAnalyticsConfigSchema,
559
- gtm: gtmAnalyticsConfigSchema,
560
- ga: googleAnalyticsConfigSchema,
561
- },
562
- },
563
- userProfile: {
564
- type: 'object',
565
- properties: Object.assign({ loginLabel: { type: 'string', default: 'Login' }, logoutLabel: { type: 'string', default: 'Logout' }, menu: {
566
- type: 'array',
567
- items: {
568
- type: 'object',
569
- properties: {
570
- label: { type: 'string' },
571
- external: { type: 'boolean' },
572
- link: { type: 'string' },
573
- separatorLine: { type: 'boolean' },
574
- },
575
- additionalProperties: true,
576
- },
577
- default: [],
578
- } }, hideConfigSchema.properties),
579
- additionalProperties: false,
580
- default: {},
581
- },
582
- versionPicker: {
583
- type: 'object',
584
- properties: {
585
- hide: { type: 'boolean' },
586
- showForUnversioned: {
587
- type: 'boolean',
588
- },
589
- },
590
- },
591
- breadcrumbs: {
592
- type: 'object',
593
- properties: {
594
- hide: { type: 'boolean' },
595
- prefixItems: {
596
- type: 'array',
597
- items: {
598
- type: 'object',
599
- properties: {
600
- label: { type: 'string' },
601
- labelTranslationKey: { type: 'string' },
602
- page: { type: 'string' },
603
- },
604
- additionalProperties: false,
605
- default: {},
606
- },
607
- },
608
- },
609
- additionalProperties: false,
610
- default: {},
611
- },
612
- catalog: catalogsConfigSchema,
613
- scorecard: scorecardConfigSchema,
614
- },
615
- additionalProperties: true,
616
- default: {},
617
- };
618
- exports.productThemeOverrideSchema = {
619
- type: 'object',
620
- properties: {
621
- logo: exports.themeConfigSchema.properties.logo,
622
- navbar: exports.themeConfigSchema.properties.navbar,
623
- footer: exports.themeConfigSchema.properties.footer,
624
- sidebar: exports.themeConfigSchema.properties.sidebar,
625
- search: exports.themeConfigSchema.properties.search,
626
- codeSnippet: exports.themeConfigSchema.properties.codeSnippet,
627
- breadcrumbs: exports.themeConfigSchema.properties.breadcrumbs,
628
- analytics: {
629
- type: 'object',
630
- properties: {
631
- ga: productGoogleAnalyticsConfigSchema,
632
- },
633
- },
634
- },
635
- additionalProperties: true,
636
- default: {},
637
- };
@@ -1,52 +0,0 @@
1
- import { RedoclyClient } from '../../index';
2
- import { setRedoclyDomain, getRedoclyDomain, getDomains, AVAILABLE_REGIONS } from '../domains';
3
-
4
- describe('domains', () => {
5
- const REDOCLY_DOMAIN_US = 'redocly.com';
6
- const TEST_DOMAIN = 'redoclyDomain.com';
7
- const TEST_LAB_DOMAIN = 'lab.redocly.host';
8
- const TEST_REDOC_ONLINE_DOMAIN = 'redoc.online';
9
-
10
- afterEach(() => {
11
- delete process.env.REDOCLY_DOMAIN;
12
- setRedoclyDomain('');
13
- });
14
-
15
- it('should resolve the US domain by default', () => {
16
- expect(getRedoclyDomain()).toBe(REDOCLY_DOMAIN_US);
17
- });
18
-
19
- it('should resolve the US and EU regions by default', () => {
20
- expect(AVAILABLE_REGIONS).toStrictEqual(['us', 'eu']);
21
- });
22
-
23
- it('should resolve the specified domain if used with setter', () => {
24
- setRedoclyDomain(TEST_DOMAIN);
25
- expect(getRedoclyDomain()).toBe(TEST_DOMAIN);
26
- });
27
-
28
- it('should resolve the specified domain provided in environmental variable, after initializing RedoclyClient', () => {
29
- process.env.REDOCLY_DOMAIN = TEST_DOMAIN;
30
- const client = new RedoclyClient();
31
- expect(getRedoclyDomain()).toBe(TEST_DOMAIN);
32
- expect(client.domain).toBe(TEST_DOMAIN);
33
- });
34
-
35
- it('should return correct object when redocly domain is set to lab env', () => {
36
- setRedoclyDomain(TEST_LAB_DOMAIN);
37
- const domains = getDomains();
38
- expect(domains).toEqual({ us: 'redocly.com', eu: 'eu.redocly.com', lab: 'lab.redocly.host' });
39
- expect(getRedoclyDomain()).toBe(TEST_LAB_DOMAIN);
40
- });
41
-
42
- it('should return correct object when redocly domain is set to redoc.online env', () => {
43
- setRedoclyDomain(TEST_REDOC_ONLINE_DOMAIN);
44
- const domains = getDomains();
45
- expect(domains).toEqual({
46
- us: 'redocly.com',
47
- eu: 'eu.redocly.com',
48
- 'redoc.online': 'redoc.online',
49
- });
50
- expect(getRedoclyDomain()).toBe(TEST_REDOC_ONLINE_DOMAIN);
51
- });
52
- });