@scalar/workspace-store 0.68.2 → 0.68.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/channel-example/get-async-api-protocols.d.ts +3 -1
  3. package/dist/channel-example/get-async-api-protocols.d.ts.map +1 -1
  4. package/dist/channel-example/get-async-api-protocols.js +6 -2
  5. package/dist/channel-example/get-asyncapi-security-requirements.d.ts +14 -2
  6. package/dist/channel-example/get-asyncapi-security-requirements.d.ts.map +1 -1
  7. package/dist/channel-example/get-asyncapi-security-requirements.js +89 -32
  8. package/dist/channel-example/get-channel-connection-context.d.ts.map +1 -1
  9. package/dist/channel-example/get-channel-connection-context.js +3 -4
  10. package/dist/channel-example/get-channel-connection-security.d.ts +3 -2
  11. package/dist/channel-example/get-channel-connection-security.d.ts.map +1 -1
  12. package/dist/channel-example/get-channel-connection-security.js +4 -6
  13. package/dist/channel-example/get-channel-operations.d.ts.map +1 -1
  14. package/dist/channel-example/get-channel-operations.js +2 -1
  15. package/dist/channel-example/get-channel-parameters.d.ts.map +1 -1
  16. package/dist/channel-example/get-channel-parameters.js +2 -1
  17. package/dist/channel-example/index.d.ts +2 -2
  18. package/dist/channel-example/index.d.ts.map +1 -1
  19. package/dist/channel-example/index.js +2 -2
  20. package/dist/channel-example/resolve-channel.d.ts.map +1 -1
  21. package/dist/channel-example/resolve-channel.js +2 -1
  22. package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -1
  23. package/dist/channel-example/resolve-operation-channel.js +4 -2
  24. package/dist/channel-example/resolve-operation-with-traits.d.ts +1 -3
  25. package/dist/channel-example/resolve-operation-with-traits.d.ts.map +1 -1
  26. package/dist/channel-example/resolve-operation-with-traits.js +3 -41
  27. package/dist/channel-example/servers.d.ts.map +1 -1
  28. package/dist/channel-example/servers.js +2 -1
  29. package/dist/client.d.ts.map +1 -1
  30. package/dist/client.js +8 -4
  31. package/dist/entities/auth/schema.d.ts +5 -0
  32. package/dist/entities/auth/schema.d.ts.map +1 -1
  33. package/dist/events/definitions/operation.d.ts +7 -0
  34. package/dist/events/definitions/operation.d.ts.map +1 -1
  35. package/dist/helpers/asyncapi-chunk-groups.d.ts.map +1 -1
  36. package/dist/helpers/asyncapi-chunk-groups.js +8 -4
  37. package/dist/helpers/asyncapi-model-chunk-reference.d.ts.map +1 -1
  38. package/dist/helpers/asyncapi-model-chunk-reference.js +2 -1
  39. package/dist/helpers/auth-secret-fields.d.ts +11 -0
  40. package/dist/helpers/auth-secret-fields.d.ts.map +1 -1
  41. package/dist/helpers/auth-secret-fields.js +22 -0
  42. package/dist/helpers/encode-path-parameter.d.ts.map +1 -1
  43. package/dist/helpers/encode-path-parameter.js +11 -12
  44. package/dist/helpers/external-examples.d.ts.map +1 -1
  45. package/dist/helpers/external-examples.js +6 -3
  46. package/dist/helpers/get-boolean-schema.d.ts +7 -0
  47. package/dist/helpers/get-boolean-schema.d.ts.map +1 -0
  48. package/dist/helpers/get-boolean-schema.js +5 -0
  49. package/dist/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  50. package/dist/helpers/normalize-boolean-schemas.d.ts.map +1 -1
  51. package/dist/helpers/normalize-boolean-schemas.js +6 -1
  52. package/dist/helpers/operation-examples.d.ts.map +1 -1
  53. package/dist/helpers/operation-examples.js +2 -1
  54. package/dist/helpers/querystring-parameter.d.ts.map +1 -1
  55. package/dist/helpers/querystring-parameter.js +6 -6
  56. package/dist/helpers/resolve-security-requirements.d.ts.map +1 -1
  57. package/dist/helpers/resolve-security-requirements.js +38 -19
  58. package/dist/helpers/resolve-traits.d.ts +3 -0
  59. package/dist/helpers/resolve-traits.d.ts.map +1 -0
  60. package/dist/helpers/resolve-traits.js +68 -0
  61. package/dist/helpers/serialize-stream-example.js +1 -1
  62. package/dist/helpers/use-external-examples.d.ts.map +1 -1
  63. package/dist/helpers/use-external-examples.js +10 -5
  64. package/dist/mutators/auth.d.ts.map +1 -1
  65. package/dist/mutators/auth.js +2 -1
  66. package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
  67. package/dist/mutators/operation/helpers/har-to-operation.js +4 -2
  68. package/dist/mutators/operation/operation.d.ts.map +1 -1
  69. package/dist/mutators/operation/operation.js +4 -2
  70. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  71. package/dist/mutators/operation/parameters.js +23 -1
  72. package/dist/mutators/tag.d.ts.map +1 -1
  73. package/dist/mutators/tag.js +4 -2
  74. package/dist/navigation/get-navigation-options.js +6 -5
  75. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
  76. package/dist/navigation/helpers/traverse-asyncapi-document.js +27 -20
  77. package/dist/navigation/helpers/traverse-paths.js +1 -1
  78. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  79. package/dist/navigation/helpers/traverse-schemas.js +2 -1
  80. package/dist/plugins/bundler/index.d.ts.map +1 -1
  81. package/dist/plugins/bundler/index.js +2 -1
  82. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -1
  83. package/dist/plugins/bundler/openapi-document.js +2 -1
  84. package/dist/request-example/builder/body/build-multipart.d.ts.map +1 -1
  85. package/dist/request-example/builder/body/build-multipart.js +18 -16
  86. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -1
  87. package/dist/request-example/builder/body/encode-multipart-body.js +2 -1
  88. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  89. package/dist/request-example/builder/body/get-request-body-example.js +2 -1
  90. package/dist/request-example/builder/body/schema-value-coercion.d.ts.map +1 -1
  91. package/dist/request-example/builder/body/schema-value-coercion.js +4 -1
  92. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  93. package/dist/request-example/builder/header/build-request-parameters.js +12 -2
  94. package/dist/request-example/builder/header/filter-disabled-properties.d.ts +3 -0
  95. package/dist/request-example/builder/header/filter-disabled-properties.d.ts.map +1 -0
  96. package/dist/request-example/builder/header/filter-disabled-properties.js +18 -0
  97. package/dist/request-example/builder/header/filter-global-cookies.d.ts +1 -1
  98. package/dist/request-example/builder/header/filter-global-cookies.d.ts.map +1 -1
  99. package/dist/request-example/builder/header/filter-global-cookies.js +15 -3
  100. package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
  101. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  102. package/dist/request-example/builder/header/is-param-disabled.js +3 -2
  103. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  104. package/dist/request-example/builder/helpers/get-example-from-schema.js +20 -16
  105. package/dist/request-example/builder/helpers/get-example.d.ts +2 -0
  106. package/dist/request-example/builder/helpers/get-example.d.ts.map +1 -1
  107. package/dist/request-example/builder/helpers/get-example.js +15 -5
  108. package/dist/request-example/builder/index.d.ts +1 -0
  109. package/dist/request-example/builder/index.d.ts.map +1 -1
  110. package/dist/request-example/builder/index.js +1 -0
  111. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  112. package/dist/request-example/builder/resolve-request-factory-url.js +9 -8
  113. package/dist/request-example/builder/security/secret-types.d.ts +13 -3
  114. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  115. package/dist/request-example/context/headers.js +1 -1
  116. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  117. package/dist/request-example/context/security/extract-security-scheme-secrets.js +63 -25
  118. package/dist/request-example/context/security/get-selected-security.js +1 -1
  119. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  120. package/dist/request-example/context/security/merge-security.js +2 -1
  121. package/dist/request-example/index.d.ts +1 -1
  122. package/dist/request-example/index.d.ts.map +1 -1
  123. package/dist/request-example/index.js +1 -1
  124. package/dist/request-example/xml/get-xml-example.js +2 -1
  125. package/dist/request-example/xml/write-xml.d.ts.map +1 -1
  126. package/dist/request-example/xml/write-xml.js +6 -5
  127. package/dist/resolve.d.ts +1 -1
  128. package/dist/resolve.d.ts.map +1 -1
  129. package/dist/resolve.js +16 -1
  130. package/dist/schemas/extensions/example/x-disabled.d.ts +4 -0
  131. package/dist/schemas/extensions/example/x-disabled.d.ts.map +1 -1
  132. package/dist/schemas/extensions/example/x-disabled.js +3 -1
  133. package/dist/schemas/navigation.d.ts +1 -1
  134. package/dist/schemas/navigation.d.ts.map +1 -1
  135. package/dist/schemas/reference-config/index.d.ts +1 -0
  136. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  137. package/dist/schemas/reference-config/settings.d.ts +1 -0
  138. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  139. package/dist/schemas/v3.1/strict/example.d.ts +3 -0
  140. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  141. package/dist/schemas/v3.1/strict/openapi-document.d.ts +36 -6
  142. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  143. package/dist/schemas/v3.2/strict/example.d.ts +3 -0
  144. package/dist/schemas/v3.2/strict/example.d.ts.map +1 -1
  145. package/dist/schemas/v3.2/strict/openapi-document.d.ts +36 -6
  146. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  147. package/dist/server.d.ts.map +1 -1
  148. package/dist/server.js +4 -2
  149. package/package.json +9 -9
@@ -25,8 +25,9 @@ const absoluteReference = (reference, base) => {
25
25
  * Relative keys in referenced documents become absolute to keep distinct document bases apart.
26
26
  */
27
27
  export const resolveSecurityRequirements = async (document, { origin = '/', loaders }) => {
28
- if (typeof document.openapi !== 'string' || !/^3\.2\.\d+$/.test(document.openapi))
28
+ if (typeof document.openapi !== 'string' || !/^3\.2\.\d+$/.test(document.openapi)) {
29
29
  return;
30
+ }
30
31
  const originalKeys = isObject(document[ORIGINAL_KEYS]) ? document[ORIGINAL_KEYS] : {};
31
32
  const components = isObject(document.components) ? document.components : {};
32
33
  const schemes = isObject(components.securitySchemes) ? components.securitySchemes : {};
@@ -44,8 +45,9 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
44
45
  const processedDocuments = new Set();
45
46
  const cache = new Map();
46
47
  const visit = async (node, path, base, external) => {
47
- if (node === null || typeof node !== 'object' || visited.has(node) || isSchemaPath(path))
48
+ if (node === null || typeof node !== 'object' || visited.has(node) || isSchemaPath(path)) {
48
49
  return;
50
+ }
49
51
  visited.add(node);
50
52
  // Security is a fixed field on document and operation objects, not arbitrary example payloads.
51
53
  const operationKey = path.at(-1) ?? '';
@@ -53,11 +55,13 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
53
55
  const isDocument = path.length === 0 || (path[0] === 'x-ext' && path.length === 2);
54
56
  if (isObject(node) && (isDocument || isOperation) && Array.isArray(node.security)) {
55
57
  for (const [index, requirement] of node.security.entries()) {
56
- if (!isObject(requirement))
58
+ if (!isObject(requirement)) {
57
59
  continue;
60
+ }
58
61
  for (const [name, scopes] of Object.entries(requirement)) {
59
- if (namedSchemes.has(name) || !Array.isArray(scopes))
62
+ if (namedSchemes.has(name) || !Array.isArray(scopes)) {
60
63
  continue;
64
+ }
61
65
  const uri = (() => {
62
66
  try {
63
67
  return Object.hasOwn(aliases, name) && typeof aliases[name] === 'string'
@@ -68,8 +72,9 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
68
72
  return undefined;
69
73
  }
70
74
  })();
71
- if (uri === undefined)
75
+ if (uri === undefined) {
72
76
  continue;
77
+ }
73
78
  const key = await generateUniqueValue({
74
79
  defaultValue: external ? uri : name,
75
80
  validation: (candidate) => !namedSchemes.has(candidate) &&
@@ -77,8 +82,9 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
77
82
  (!external || candidate === name || !Object.hasOwn(requirement, candidate)),
78
83
  maxRetries: Object.keys(schemes).length + 1,
79
84
  });
80
- if (key === undefined)
85
+ if (key === undefined) {
81
86
  continue;
87
+ }
82
88
  if (!Object.hasOwn(aliases, key)) {
83
89
  const reference = { $ref: uri };
84
90
  await bundle({ components: { securitySchemes: { target: reference } } }, {
@@ -106,8 +112,9 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
106
112
  ])),
107
113
  }
108
114
  : target;
109
- if (!Value.Check(SecuritySchemeObjectSchema, validationTarget))
115
+ if (!Value.Check(SecuritySchemeObjectSchema, validationTarget)) {
110
116
  continue;
117
+ }
111
118
  Object.defineProperty(schemes, key, {
112
119
  value: reference,
113
120
  enumerable: true,
@@ -125,8 +132,9 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
125
132
  Object.defineProperty(mapping, name, { value: key, enumerable: true, writable: true, configurable: true });
126
133
  originalKeys[location] = mapping;
127
134
  document[ORIGINAL_KEYS] = originalKeys;
128
- if (key === name)
135
+ if (key === name) {
129
136
  continue;
137
+ }
130
138
  const previous = Object.hasOwn(requirement, key) ? requirement[key] : [];
131
139
  Object.defineProperty(requirement, key, {
132
140
  value: [...new Set([...(Array.isArray(previous) ? previous : []), ...scopes])],
@@ -140,8 +148,9 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
140
148
  }
141
149
  }
142
150
  for (const [key, child] of Object.entries(node)) {
143
- if (key.startsWith('x-') || key === 'example' || key === 'examples' || key === 'security')
151
+ if (key.startsWith('x-') || key === 'example' || key === 'examples' || key === 'security') {
144
152
  continue;
153
+ }
145
154
  await visit(child, [...path, key], base, external);
146
155
  }
147
156
  };
@@ -150,14 +159,17 @@ export const resolveSecurityRequirements = async (document, { origin = '/', load
150
159
  // URI-only dependencies can load further documents, so process newly embedded documents too.
151
160
  while (isObject(document['x-ext'])) {
152
161
  const next = Object.entries(document['x-ext']).find(([key]) => !processedDocuments.has(key));
153
- if (!next)
162
+ if (!next) {
154
163
  break;
164
+ }
155
165
  const [key, external] = next;
156
166
  processedDocuments.add(key);
157
- if (!isObject(external))
167
+ if (!isObject(external)) {
158
168
  continue;
159
- if (typeof external.openapi === 'string' && !/^3\.2\.\d+$/.test(external.openapi))
169
+ }
170
+ if (typeof external.openapi === 'string' && !/^3\.2\.\d+$/.test(external.openapi)) {
160
171
  continue;
172
+ }
161
173
  const mappings = document['x-ext-urls'];
162
174
  const retrieval = isObject(mappings) && typeof mappings[key] === 'string' ? mappings[key] : key;
163
175
  const retrievalUri = resolveReferencePath(entryBase, retrieval);
@@ -179,20 +191,24 @@ export const restoreSecurityRequirements = (document) => {
179
191
  })();
180
192
  if (!Array.isArray(path) ||
181
193
  !path.every((segment) => typeof segment === 'string' && !isPollutionKey(segment)) ||
182
- !isObject(mapping))
194
+ !isObject(mapping)) {
183
195
  continue;
196
+ }
184
197
  const requirement = path.reduce((parent, segment) => {
185
- if (parent === null || typeof parent !== 'object' || !Object.hasOwn(parent, segment))
198
+ if (parent === null || typeof parent !== 'object' || !Object.hasOwn(parent, segment)) {
186
199
  return undefined;
200
+ }
187
201
  return Reflect.get(parent, segment);
188
202
  }, document);
189
- if (!isObject(requirement))
203
+ if (!isObject(requirement)) {
190
204
  continue;
205
+ }
191
206
  const entries = Object.entries(mapping).flatMap(([original, rewritten]) => typeof rewritten === 'string' && Object.hasOwn(requirement, rewritten)
192
207
  ? [{ original, rewritten, scopes: requirement[rewritten] }]
193
208
  : []);
194
- for (const { rewritten } of entries)
209
+ for (const { rewritten } of entries) {
195
210
  delete requirement[rewritten];
211
+ }
196
212
  for (const { original, scopes } of entries) {
197
213
  Object.defineProperty(requirement, original, {
198
214
  value: scopes,
@@ -210,12 +226,15 @@ export const restoreSecurityRequirements = (document) => {
210
226
  isObject(components) &&
211
227
  Object.hasOwn(components, 'securitySchemes') &&
212
228
  isObject(components.securitySchemes)) {
213
- for (const key of Object.keys(metadata.schemes))
229
+ for (const key of Object.keys(metadata.schemes)) {
214
230
  delete components.securitySchemes[key];
215
- if (!metadata.hadSecuritySchemes && Object.keys(components.securitySchemes).length === 0)
231
+ }
232
+ if (!metadata.hadSecuritySchemes && Object.keys(components.securitySchemes).length === 0) {
216
233
  delete components.securitySchemes;
217
- if (!metadata.hadComponents && Object.keys(components).length === 0)
234
+ }
235
+ if (!metadata.hadComponents && Object.keys(components).length === 0) {
218
236
  delete document.components;
237
+ }
219
238
  }
220
239
  delete document[ALIASES];
221
240
  delete document[ORIGINAL_KEYS];
@@ -0,0 +1,3 @@
1
+ /** Merge traits in order, then apply the target's own fields with highest priority. */
2
+ export declare const resolveTraits: <T extends object>(target: T, traits: readonly object[]) => T;
3
+ //# sourceMappingURL=resolve-traits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-traits.d.ts","sourceRoot":"","sources":["../../src/helpers/resolve-traits.ts"],"names":[],"mappings":"AAoEA,uFAAuF;AACvF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,SAAS,MAAM,EAAE,KAAG,CAetF,CAAA"}
@@ -0,0 +1,68 @@
1
+ import { isObject } from '@scalar/helpers/object/is-object';
2
+ import { getResolvedRef } from './get-resolved-ref.js';
3
+ const schemaMaps = new Set(['properties', 'patternProperties', '$defs', 'definitions', 'dependentSchemas']);
4
+ const dataFields = new Set(['example', 'examples', 'default', 'enum', 'const', 'value', 'dataValue']);
5
+ /**
6
+ * Apply JSON Merge Patch to resolved trait fields. Unlike mergeObjects, null removes a key.
7
+ * Resolve schema references before merging so a message can extend referenced trait headers.
8
+ */
9
+ const mergeTraitFields = (target, patch, context = 'object', ancestors = new WeakMap()) => {
10
+ // Reply channels identify a location in the document, so retain their reference wrappers.
11
+ if (context === 'reference') {
12
+ return patch;
13
+ }
14
+ const resolvedPatch = context === 'object' && isObject(patch) && typeof patch.$ref === 'string' ? getResolvedRef(patch) : patch;
15
+ if (!isObject(resolvedPatch)) {
16
+ return resolvedPatch;
17
+ }
18
+ // Resolved schemas can be recursive. Keep their cycles without changing the source document.
19
+ if (ancestors.has(resolvedPatch)) {
20
+ return ancestors.get(resolvedPatch);
21
+ }
22
+ const resolvedTarget = context === 'object' && isObject(target) && typeof target.$ref === 'string' ? getResolvedRef(target) : target;
23
+ const result = isObject(resolvedTarget) ? { ...resolvedTarget } : {};
24
+ ancestors.set(resolvedPatch, result);
25
+ for (const [key, value] of Object.entries(resolvedPatch)) {
26
+ if (value === null) {
27
+ delete result[key];
28
+ }
29
+ else if (value !== undefined) {
30
+ // Schema names and example data can contain literal $ref keys without being references.
31
+ const childContext = context === 'data'
32
+ ? 'data'
33
+ : context === 'map'
34
+ ? 'object'
35
+ : key === 'channel'
36
+ ? 'reference'
37
+ : dataFields.has(key) || key.startsWith('x-')
38
+ ? 'data'
39
+ : schemaMaps.has(key)
40
+ ? 'map'
41
+ : 'object';
42
+ // Define an own property even for schema properties named __proto__.
43
+ Object.defineProperty(result, key, {
44
+ value: mergeTraitFields(Object.hasOwn(result, key) ? result[key] : undefined, value, childContext, ancestors),
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ });
49
+ }
50
+ }
51
+ ancestors.delete(resolvedPatch);
52
+ return result;
53
+ };
54
+ /** Merge traits in order, then apply the target's own fields with highest priority. */
55
+ export const resolveTraits = (target, traits) => {
56
+ if (traits.length === 0) {
57
+ return target;
58
+ }
59
+ const inherited = traits.reduce((fields, trait) => {
60
+ const resolved = getResolvedRef(trait);
61
+ return resolved ? mergeTraitFields(fields, resolved) : fields;
62
+ }, {});
63
+ // Only overlay fields supplied by traits. Unrelated fields keep their references and identity.
64
+ const overrides = Object.fromEntries(Object.entries(target).filter(([key]) => Object.hasOwn(inherited, key)));
65
+ const merged = mergeTraitFields(inherited, overrides);
66
+ const ownFields = Object.fromEntries(Object.entries(target).filter(([key]) => !Object.hasOwn(inherited, key)));
67
+ return { ...ownFields, ...merged };
68
+ };
@@ -11,7 +11,7 @@ export const serializeStreamExample = (value, contentType, singleItem) => {
11
11
  return undefined;
12
12
  }
13
13
  const format = getStreamFormat(contentType);
14
- const items = singleItem ? [value] : Array.isArray(value) ? value : [value];
14
+ const items = !singleItem && Array.isArray(value) ? value : [value];
15
15
  if (format === 'json-lines') {
16
16
  return items.map((item) => `${JSON.stringify(item)}\n`).join('');
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-external-examples.d.ts","sourceRoot":"","sources":["../../src/helpers/use-external-examples.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAA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AAuB,CAA+B,CAAA;AAEzG,0GAA0G;AAC1G,eAAO,MAAM,oBAAoB,GAAI,QAAQ,GAAG,CAAC,OAAO,GAAG,uBAAuB,GAAG,IAAI,CAAC,KAAG,GAAG,CAAC,OAAO,CAyBvG,CAAA;AAED,gGAAgG;AAChG,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,EAAE,EAC7C,UAAS,MAAM,OAAoB,EACnC,WAAW,MAAM,uBAAuB,KACvC;IACD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7B,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5B,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,KAAK,aAAa,GAAG,SAAS,CAAA;IAC1E,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CA8C3B,CAAA"}
@@ -10,8 +10,9 @@ export const useExampleVisibility = (target) => {
10
10
  observer?.disconnect();
11
11
  visible.value = false;
12
12
  const node = element && ('$el' in element ? element.$el : element);
13
- if (typeof Element === 'undefined' || !(node instanceof Element))
13
+ if (typeof Element === 'undefined' || !(node instanceof Element)) {
14
14
  return;
15
+ }
15
16
  if (typeof IntersectionObserver === 'undefined') {
16
17
  visible.value = true;
17
18
  return;
@@ -32,22 +33,26 @@ export const useExternalExamples = (examples, enabled = () => true, resolver) =>
32
33
  .filter((example) => example !== undefined && example.value === undefined && !!example.externalValue)
33
34
  .map((example) => getResolver()(example)));
34
35
  watchEffect(() => {
35
- if (!enabled())
36
+ if (!enabled()) {
36
37
  return;
38
+ }
37
39
  for (const state of states.value) {
38
- if (state.status === 'idle')
40
+ if (state.status === 'idle') {
39
41
  void state.load();
42
+ }
40
43
  }
41
44
  });
42
45
  return {
43
46
  pending: computed(() => states.value.some((state) => state.status !== 'loaded')),
44
47
  failed: computed(() => states.value.some((state) => state.status === 'error')),
45
48
  resolve: (example) => {
46
- if (!example || example.value !== undefined || !example.externalValue)
49
+ if (!example || example.value !== undefined || !example.externalValue) {
47
50
  return example;
51
+ }
48
52
  const state = getResolver()(example);
49
- if (state.status !== 'loaded')
53
+ if (state.status !== 'loaded') {
50
54
  return example;
55
+ }
51
56
  // A 3.2 example can pair structured data with external wire text. Keep both in the
52
57
  // resolved view so raw consumers display the download and form editors retain the data.
53
58
  if (example.dataValue !== undefined && state.serializedValue !== undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/mutators/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAU3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAGlD,OAAO,KAAK,EAAgB,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAuC/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,6BAA6B,GACxC,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,UAAU,CAAC,uCAAuC,CAAC,kBAgFhG,CAAA;AAwBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,UAAU,CAAC,6BAA6B,CAAC,qCAwB7D,CAAA;AAqED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,qBAAqB,GAChC,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,iBAAiB,UAAU,CAAC,0BAA0B,CAAC,SAgDxD,CAAA;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU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;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,WAAW,UAAU,CAAC,6BAA6B,CAAC,SAsFrD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,sBAGjC;IACD,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAC7B;6CAE4C,UAAU,CAAC,uCAAuC,CAAC;4CAEpD,UAAU,CAAC,sCAAsC,CAAC;oCAE1D,UAAU,CAAC,6BAA6B,CAAC;2CAElC,UAAU,CAAC,qCAAqC,CAAC;yCAEnD,UAAU,CAAC,mCAAmC,CAAC;0CAE9C,UAAU,CAAC,oCAAoC,CAAC;qCAErD,UAAU,CAAC,0BAA0B,CAAC;oCAEvC,UAAU,CAAC,6BAA6B,CAAC;2BAElD,UAAU,CAAC,oBAAoB,CAAC;2BAChC,UAAU,CAAC,oBAAoB,CAAC;oCACvB,UAAU,CAAC,6BAA6B,CAAC;CAG5E,CAAA"}
@@ -590,8 +590,9 @@ export const deleteSecurityScheme = (store, document, { names }) => {
590
590
  forEachPathItemOperation(pathItemRef, (method, operationRef) => {
591
591
  // Get mutable reference for the operation (could resolve $ref proxies)
592
592
  const resolvedOperation = getResolvedRef(operationRef);
593
- if (!resolvedOperation)
593
+ if (!resolvedOperation) {
594
594
  return;
595
+ }
595
596
  // Remove from operation-level security array
596
597
  if ('security' in resolvedOperation && resolvedOperation['security']) {
597
598
  resolvedOperation['security'] = filterSecuritySchemes(resolvedOperation['security']);
@@ -1 +1 @@
1
- {"version":3,"file":"har-to-operation.d.ts","sourceRoot":"","sources":["../../../../src/mutators/operation/helpers/har-to-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAKpH,KAAK,mBAAmB,GAAG;IACzB,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,CAAA;AAyBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,2DAK5B,mBAAmB,KAAG,eA0HxB,CAAA"}
1
+ {"version":3,"file":"har-to-operation.d.ts","sourceRoot":"","sources":["../../../../src/mutators/operation/helpers/har-to-operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,8DAA8D,CAAA;AAKpH,KAAK,mBAAmB,GAAG;IACzB,6BAA6B;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,eAAe,CAAA;IAC/B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,CAAA;AAyBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,GAAI,2DAK5B,mBAAmB,KAAG,eA4HxB,CAAA"}
@@ -98,8 +98,9 @@ export const harToOperation = ({ harRequest, exampleKey, baseOperation = {}, pat
98
98
  }
99
99
  // Resolve the request body in case it is a reference
100
100
  const requestBody = getResolvedRef(baseOperation.requestBody);
101
- if (!requestBody)
101
+ if (!requestBody) {
102
102
  return baseOperation;
103
+ }
103
104
  // Ensure the content type exists in the requestBody
104
105
  if (!requestBody.content[mimeType]) {
105
106
  requestBody.content[mimeType] = {
@@ -150,8 +151,9 @@ const setParameterDisabled = (param, exampleKey, disabled) => {
150
151
  return;
151
152
  }
152
153
  const example = getResolvedRef(param.examples[exampleKey]);
153
- if (example)
154
+ if (example) {
154
155
  example['x-disabled'] = disabled;
156
+ }
155
157
  };
156
158
  /**
157
159
  * Finds an existing parameter in the parameters array or creates a new one.
@@ -1 +1 @@
1
- {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/mutators/operation/operation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAarE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAGlD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAC1B,gBAAgB,cAAc,GAAG,IAAI,EACrC,SAAS,eAAe,CAAC,4BAA4B,CAAC,KACrD,MAAM,GAAG,SA0DX,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,cAAc,GAAG,IAAI,EAC5B,UAAU,iBAAiB,GAAG,IAAI,EAClC,mBAAmB,eAAe,CAAC,uBAAuB,CAAC,SAsB5D,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,yBAAyB,GACpC,UAAU,iBAAiB,GAAG,IAAI,EAClC,OAAO,cAAc,GAAG,IAAI,EAC5B,mEAAmE,eAAe,CAAC,6BAA6B,CAAC,KAChH,IAkGF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,cAAc,GAAG,IAAI,EAChC,wBAAwB,eAAe,CAAC,4BAA4B,CAAC,SAgBtE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GACtC,WAAW,cAAc,GAAG,IAAI,EAChC,uDAAuD,eAAe,CAAC,gCAAgC,CAAC,SAuBzG,CAAA;AAED;;;;;;GAM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CAAgC,CAAC,SAuBzG,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,cAAc,GAAG,IAAI,EAChC,sDAAsD,eAAe,CAAC,0BAA0B,CAAC,SAoDlG,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,GACjC,WAAW,cAAc,GAAG,IAAI,EAChC,+DAA+D,eAAe,CAAC,0BAA0B,CAAC,SA0E3G,CAAA"}
@@ -274,8 +274,9 @@ export const deleteOperationExample = (workspace, { meta: { path, method, exampl
274
274
  // Remove the example from all operation parameters
275
275
  operation.parameters?.forEach((parameter) => {
276
276
  const resolvedParameter = getResolvedRef(parameter);
277
- if (!resolvedParameter)
277
+ if (!resolvedParameter) {
278
278
  return;
279
+ }
279
280
  // Remove from content-level examples (if parameter uses content)
280
281
  if ('content' in resolvedParameter && resolvedParameter.content) {
281
282
  Object.values(resolvedParameter.content).forEach((mediaType) => {
@@ -325,8 +326,9 @@ export const renameOperationExample = (workspace, { meta: { path, method, exampl
325
326
  const records = [];
326
327
  operation.parameters?.forEach((parameter) => {
327
328
  const resolvedParameter = getResolvedRef(parameter);
328
- if (!resolvedParameter)
329
+ if (!resolvedParameter) {
329
330
  return;
331
+ }
330
332
  if ('examples' in resolvedParameter && resolvedParameter.examples) {
331
333
  records.push(resolvedParameter.examples);
332
334
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/mutators/operation/parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAMrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAmClD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,eAAe,CAAC,4BAA4B,CAAC,SAyG1F,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,8BAA8B,GACzC,UAAU,iBAAiB,GAAG,IAAI,EAClC,uCAAuC,eAAe,CAAC,mCAAmC,CAAC,SA8C5F,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,iBAAiB,GAAG,IAAI,EAClC,6BAA6B,eAAe,CAAC,4BAA4B,CAAC,SAkC3E,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,iBAAiB,GAAG,IAAI,EAClC,gBAAgB,eAAe,CAAC,iCAAiC,CAAC,SAgBnE,CAAA"}
1
+ {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../src/mutators/operation/parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAOrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAmClD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,iBAAiB,GAAG,IAAI,EAClC,4CAA4C,eAAe,CAAC,4BAA4B,CAAC,SA4H1F,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,8BAA8B,GACzC,UAAU,iBAAiB,GAAG,IAAI,EAClC,uCAAuC,eAAe,CAAC,mCAAmC,CAAC,SA8C5F,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,UAAU,iBAAiB,GAAG,IAAI,EAClC,6BAA6B,eAAe,CAAC,4BAA4B,CAAC,SAkC3E,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,GACvC,UAAU,iBAAiB,GAAG,IAAI,EAClC,gBAAgB,eAAe,CAAC,iCAAiC,CAAC,SAgBnE,CAAA"}
@@ -3,6 +3,7 @@ import { getParameterExample } from '../../helpers/get-parameter-example.js';
3
3
  import { getResolvedRef } from '../../helpers/get-resolved-ref.js';
4
4
  import { getQuerystringParameter, serializeQuerystringParameter } from '../../helpers/querystring-parameter.js';
5
5
  import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
6
+ import { isParamDisabled } from '../../request-example/builder/header/is-param-disabled.js';
6
7
  import { isOpenApiDocument } from '../../schemas/type-guards.js';
7
8
  import { isContentTypeParameterObject } from '../../schemas/v3.2/strict/type-guards.js';
8
9
  const getPathItemsForParameterMutation = (pathItemRef) => {
@@ -47,6 +48,7 @@ export const upsertOperationParameter = (document, { meta, type, payload, origin
47
48
  const preserveQuerystringValue = querystring && payload.value === serializeQuerystringParameter(querystring);
48
49
  const param = originalParameter;
49
50
  const selected = getParameterExample(param, meta.exampleKey);
51
+ const inheritedDisabled = isParamDisabled(param, selected.example);
50
52
  const target = param.in !== 'querystring' && !selected.serialized && isContentTypeParameterObject(param)
51
53
  ? Object.values(param.content ?? {})[0]
52
54
  : param;
@@ -117,7 +119,27 @@ export const upsertOperationParameter = (document, { meta, type, payload, origin
117
119
  example.value = payload.value;
118
120
  }
119
121
  }
120
- example['x-disabled'] = payload.isDisabled;
122
+ if (payload.propertyState) {
123
+ // Freeze the inherited state before changing values: adding the first populated field
124
+ // must not implicitly enable every untouched sibling.
125
+ const states = { '[]': inheritedDisabled, ...example['x-scalar-disabled-properties'] };
126
+ const { path, previousPath, isDisabled } = payload.propertyState;
127
+ if (previousPath) {
128
+ delete states[JSON.stringify(previousPath)];
129
+ }
130
+ const key = JSON.stringify(path);
131
+ if (isDisabled === undefined) {
132
+ delete states[key];
133
+ }
134
+ else {
135
+ states[key] = isDisabled;
136
+ }
137
+ example['x-scalar-disabled-properties'] = states;
138
+ }
139
+ else {
140
+ example['x-disabled'] = payload.isDisabled;
141
+ delete example['x-scalar-disabled-properties'];
142
+ }
121
143
  return;
122
144
  }
123
145
  // We are adding a new parameter
@@ -1 +1 @@
1
- {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/mutators/tag.ts"],"names":[],"mappings":"AAAA,OAAO,K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AAO,MAAM,kBAAkB,GAAI,WAAW;IAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE;yBAErD,SAAS,CAAC,gBAAgB,CAAC;uBAC7B,SAAS,CAAC,cAAc,CAAC;yBACvB,SAAS,CAAC,gBAAgB,CAAC;CAEnD,CAAA"}
@@ -112,8 +112,9 @@ export const deleteTag = (workspace, payload) => {
112
112
  Object.values(document.paths ?? {}).forEach((pathItemRef) => {
113
113
  forEachPathItemOperation(pathItemRef, (_method, operationRef) => {
114
114
  const resolvedOperation = getResolvedRef(operationRef);
115
- if (!resolvedOperation)
115
+ if (!resolvedOperation) {
116
116
  return;
117
+ }
117
118
  if ('tags' in resolvedOperation) {
118
119
  const plainTags = unpackProxyObject(resolvedOperation.tags, { depth: 1 });
119
120
  resolvedOperation.tags = plainTags?.filter((tag) => tag !== payload.name);
@@ -124,8 +125,9 @@ export const deleteTag = (workspace, payload) => {
124
125
  Object.values(document.webhooks ?? {}).forEach((pathItemRef) => {
125
126
  forEachPathItemOperation(pathItemRef, (_method, operationRef) => {
126
127
  const resolvedOperation = getResolvedRef(operationRef);
127
- if (!resolvedOperation)
128
+ if (!resolvedOperation) {
128
129
  return;
130
+ }
129
131
  const plainTags = unpackProxyObject(resolvedOperation.tags, { depth: 1 });
130
132
  resolvedOperation.tags = plainTags?.filter((tag) => tag !== payload.name);
131
133
  });
@@ -6,11 +6,12 @@ import { DEFAULT_MODELS_SECTION_LABEL } from '@scalar/types/api-reference';
6
6
  * Extension methods retain exact case because HTTP method tokens are case-sensitive.
7
7
  * Normalizing COPY and copy would collapse distinct operations onto the same anchor.
8
8
  */
9
- const getMethodId = (method) => isHttpMethod(method)
10
- ? method === method.toLowerCase()
11
- ? method.toUpperCase()
12
- : `additionalOperations/${method}`
13
- : method;
9
+ const getMethodId = (method) => {
10
+ if (!isHttpMethod(method)) {
11
+ return method;
12
+ }
13
+ return method === method.toLowerCase() ? method.toUpperCase() : `additionalOperations/${method}`;
14
+ };
14
15
  /**
15
16
  * Returns options for traversing an OpenAPI document, allowing customization of
16
17
  * how IDs and slugs are generated for tags, headings, models, operations, and webhooks.
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-asyncapi-document.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-asyncapi-document.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,gBAAgB,EAA2B,MAAM,4BAA4B,CAAA;AAKlH,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,qCAAqC,CAAA;AAOlG,OAAO,KAAK,EAKV,iBAAiB,EAGlB,MAAM,sBAAsB,CAAA;AAM7B,oFAAoF;AACpF,KAAK,wCAAwC,GAAG,gBAAgB,GAAG;IACjE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAiiBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,cAAc,MAAM,EACpB,UAAU,wCAAwC,EAClD,UAAU,iBAAiB,KAC1B,iBA+HF,CAAA"}
1
+ {"version":3,"file":"traverse-asyncapi-document.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-asyncapi-document.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAyB,gBAAgB,EAA2B,MAAM,4BAA4B,CAAA;AAOlH,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,qCAAqC,CAAA;AAOlG,OAAO,KAAK,EAKV,iBAAiB,EAGlB,MAAM,sBAAsB,CAAA;AAM7B,oFAAoF;AACpF,KAAK,wCAAwC,GAAG,gBAAgB,GAAG;IACjE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AA0iBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,GACnC,cAAc,MAAM,EACpB,UAAU,wCAAwC,EAClD,UAAU,iBAAiB,KAC1B,iBA+HF,CAAA"}
@@ -1,5 +1,7 @@
1
1
  import { sortByOrder } from '@scalar/helpers/array/sort-by-order';
2
2
  import { objectKeys } from '@scalar/helpers/object/object-keys';
3
+ import { resolveOperationWithTraits } from '../../channel-example/resolve-operation-with-traits.js';
4
+ import { getNameFromRef } from '../../helpers/get-name-from-ref.js';
3
5
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
4
6
  import { isHidden } from '../../helpers/is-hidden.js';
5
7
  import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
@@ -40,7 +42,7 @@ const getMessageTitle = (message, messageName) => pickNonEmpty(message.title, me
40
42
  /**
41
43
  * Parses a channel JSON pointer (`#/channels/<name>`) into the key used in `document.channels`.
42
44
  */
43
- const getChannelNameFromRef = (ref) => ref.match(/^#\/channels\/([^/]+)$/)?.[1];
45
+ const getChannelNameFromRef = (ref) => getNameFromRef(ref, ['channels']);
44
46
  /**
45
47
  * Resolves the channel referenced by an operation.
46
48
  *
@@ -81,19 +83,16 @@ const resolveOperationMessageNames = (operation, channel, channelName) => {
81
83
  if (operation.messages.length === 0) {
82
84
  return [];
83
85
  }
84
- const channelScopePrefix = `#/channels/${channelName}/messages/`;
85
86
  const names = new Set();
86
87
  for (const messageRef of operation.messages) {
87
88
  if (!('$ref' in messageRef)) {
88
89
  continue;
89
90
  }
90
91
  // Common case: a channel-scoped reference like `#/channels/<name>/messages/<id>`.
91
- if (messageRef.$ref.startsWith(channelScopePrefix)) {
92
- const candidate = messageRef.$ref.slice(channelScopePrefix.length);
93
- if (channelMessages[candidate]) {
94
- names.add(candidate);
95
- continue;
96
- }
92
+ const candidate = getNameFromRef(messageRef.$ref, ['channels', channelName, 'messages']);
93
+ if (candidate && channelMessages[candidate]) {
94
+ names.add(candidate);
95
+ continue;
97
96
  }
98
97
  // Fallback: a channel-level message that points to the same target.
99
98
  for (const [name, entry] of Object.entries(channelMessages)) {
@@ -137,10 +136,10 @@ const sortMessages = (entries) => {
137
136
  entries.sort((a, b) => a.title.localeCompare(b.title));
138
137
  };
139
138
  /**
140
- * Builds nested message entries for one operation.
139
+ * Builds message entries beneath a channel or operation.
141
140
  * Resolves each message ref, skips hidden messages, and sorts the result by title.
142
141
  */
143
- const createMessageEntries = ({ channelName, channel, operationId, messageNames, generateId, }) => {
142
+ const createMessageEntries = ({ channelName, channel, parentId, messageNames, generateId, }) => {
144
143
  const messages = messageNames.flatMap((messageName) => {
145
144
  const messageNode = channel.messages?.[messageName];
146
145
  if (!messageNode) {
@@ -157,7 +156,7 @@ const createMessageEntries = ({ channelName, channel, operationId, messageNames,
157
156
  type: 'asyncapi-message',
158
157
  messageName,
159
158
  channelName,
160
- parentId: operationId,
159
+ parentId,
161
160
  }),
162
161
  title: getMessageTitle(message, messageName),
163
162
  messageName,
@@ -185,7 +184,7 @@ const createOperationEntry = ({ operationName, operation, channel, channelName,
185
184
  const messageEntries = createMessageEntries({
186
185
  channelName,
187
186
  channel,
188
- operationId,
187
+ parentId: operationId,
189
188
  messageNames: resolveOperationMessageNames(operation, channel, channelName),
190
189
  generateId,
191
190
  });
@@ -204,7 +203,7 @@ const createOperationEntry = ({ operationName, operation, channel, channelName,
204
203
  * Builds a channel navigation entry from a bucket and the operations to render under it.
205
204
  * The same channel may appear at the document root and under each of its channel-level tags.
206
205
  * Writes `x-scalar-order` on the source channel (when it is not a bare `$ref`) so other code can reuse the order.
207
- * Returns `undefined` when the channel is hidden or every requested operation was filtered out.
206
+ * Returns `undefined` when the channel is hidden or all its declared operations are hidden.
208
207
  */
209
208
  const createChannelEntry = ({ bucket, operationEntries, generateId, parentId, parentTag, operationsSorter, document, }) => {
210
209
  if (isHidden(bucket.channel)) {
@@ -229,15 +228,26 @@ const createChannelEntry = ({ bucket, operationEntries, generateId, parentId, pa
229
228
  return entry ? [entry] : [];
230
229
  });
231
230
  sortOperations(operations, operationsSorter);
232
- if (operations.length === 0) {
231
+ // A channel with hidden operations must not expose their messages through the fallback.
232
+ if (operations.length === 0 && bucket.operations.length > 0) {
233
233
  return undefined;
234
234
  }
235
+ // Keep channel-only messages reachable without duplicating messages already owned by an operation.
236
+ const operationMessageNames = new Set(bucket.operations.flatMap(({ operation }) => resolveOperationMessageNames(operation, bucket.channel, bucket.channelName)));
237
+ const messages = createMessageEntries({
238
+ channelName: bucket.channelName,
239
+ channel: bucket.channel,
240
+ parentId: channelId,
241
+ messageNames: objectKeys(bucket.channel.messages ?? {}).filter((name) => !operationMessageNames.has(name)),
242
+ generateId,
243
+ });
244
+ const children = [...operations, ...messages];
235
245
  // Persist the rendered order back onto the source channel for downstream consumers.
236
246
  // We skip channels that are stored as references, since the order should live on the target.
237
247
  const channelNode = document.channels?.[bucket.channelName];
238
248
  if (channelNode && !('$ref' in channelNode)) {
239
249
  const orderedChannel = channelNode;
240
- orderedChannel['x-scalar-order'] = operations.map((child) => child.id);
250
+ orderedChannel['x-scalar-order'] = children.map((child) => child.id);
241
251
  }
242
252
  return {
243
253
  type: 'asyncapi-channel',
@@ -245,7 +255,7 @@ const createChannelEntry = ({ bucket, operationEntries, generateId, parentId, pa
245
255
  title: getChannelTitle(bucket.channel, bucket.channelName),
246
256
  channelName: bucket.channelName,
247
257
  channelAddress: bucket.channelAddress,
248
- children: operations,
258
+ children,
249
259
  };
250
260
  };
251
261
  /**
@@ -344,10 +354,7 @@ const collectChannelBuckets = (document) => {
344
354
  if (!operationNode) {
345
355
  continue;
346
356
  }
347
- const operation = getResolvedRef(operationNode, mergeSiblingReferences);
348
- if (isHidden(operation)) {
349
- continue;
350
- }
357
+ const operation = resolveOperationWithTraits(getResolvedRef(operationNode, mergeSiblingReferences));
351
358
  const resolved = resolveOperationChannel(document, operation);
352
359
  if (!resolved) {
353
360
  continue;
@@ -30,7 +30,7 @@ const createOperationEntry = ({ ref, operation, method, path, generateId, parent
30
30
  path: path,
31
31
  parentId: parentId,
32
32
  });
33
- const title = operationTitleSource === 'path' ? path : operation.summary?.trim() ? operation.summary : path;
33
+ const title = operationTitleSource !== 'path' && operation.summary?.trim() ? operation.summary : path;
34
34
  const isDeprecated = isDeprecatedOperation(operation);
35
35
  const examples = traverseOperationExamples(operation).map((example) => ({
36
36
  type: 'example',
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,wCAAwC,CAAA;AA2C3F;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,gDAK7B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,eAAe,EAmDlB,CAAA"}
1
+ {"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,wCAAwC,CAAA;AA2C3F;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,gDAK7B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,eAAe,EAmDlB,CAAA"}