@scalar/workspace-store 0.68.1 → 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 (179) hide show
  1. package/CHANGELOG.md +34 -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 +15 -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/chunk-index.d.ts +2 -0
  43. package/dist/helpers/chunk-index.d.ts.map +1 -1
  44. package/dist/helpers/chunk-index.js +8 -1
  45. package/dist/helpers/encode-path-parameter.d.ts +20 -0
  46. package/dist/helpers/encode-path-parameter.d.ts.map +1 -0
  47. package/dist/helpers/encode-path-parameter.js +50 -0
  48. package/dist/helpers/external-examples.d.ts.map +1 -1
  49. package/dist/helpers/external-examples.js +6 -3
  50. package/dist/helpers/get-boolean-schema.d.ts +7 -0
  51. package/dist/helpers/get-boolean-schema.d.ts.map +1 -0
  52. package/dist/helpers/get-boolean-schema.js +5 -0
  53. package/dist/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  54. package/dist/helpers/get-tag-kind.d.ts +6 -0
  55. package/dist/helpers/get-tag-kind.d.ts.map +1 -0
  56. package/dist/helpers/get-tag-kind.js +7 -0
  57. package/dist/helpers/normalize-boolean-schemas.d.ts.map +1 -1
  58. package/dist/helpers/normalize-boolean-schemas.js +6 -1
  59. package/dist/helpers/operation-examples.d.ts.map +1 -1
  60. package/dist/helpers/operation-examples.js +2 -1
  61. package/dist/helpers/querystring-parameter.d.ts.map +1 -1
  62. package/dist/helpers/querystring-parameter.js +6 -6
  63. package/dist/helpers/resolve-form-schema.d.ts +9 -0
  64. package/dist/helpers/resolve-form-schema.d.ts.map +1 -0
  65. package/dist/helpers/resolve-form-schema.js +143 -0
  66. package/dist/helpers/resolve-schema-with-annotations.d.ts +11 -0
  67. package/dist/helpers/resolve-schema-with-annotations.d.ts.map +1 -0
  68. package/dist/helpers/resolve-schema-with-annotations.js +57 -0
  69. package/dist/helpers/resolve-security-requirements.d.ts +15 -0
  70. package/dist/helpers/resolve-security-requirements.d.ts.map +1 -0
  71. package/dist/helpers/resolve-security-requirements.js +241 -0
  72. package/dist/helpers/resolve-traits.d.ts +3 -0
  73. package/dist/helpers/resolve-traits.d.ts.map +1 -0
  74. package/dist/helpers/resolve-traits.js +68 -0
  75. package/dist/helpers/serialize-stream-example.js +1 -1
  76. package/dist/helpers/use-external-examples.d.ts.map +1 -1
  77. package/dist/helpers/use-external-examples.js +10 -5
  78. package/dist/mutators/auth.d.ts.map +1 -1
  79. package/dist/mutators/auth.js +2 -1
  80. package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
  81. package/dist/mutators/operation/helpers/har-to-operation.js +4 -2
  82. package/dist/mutators/operation/operation.d.ts.map +1 -1
  83. package/dist/mutators/operation/operation.js +4 -2
  84. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  85. package/dist/mutators/operation/parameters.js +23 -1
  86. package/dist/mutators/tag.d.ts.map +1 -1
  87. package/dist/mutators/tag.js +4 -2
  88. package/dist/navigation/get-navigation-options.js +6 -5
  89. package/dist/navigation/helpers/get-navigation-tag-names.d.ts +5 -0
  90. package/dist/navigation/helpers/get-navigation-tag-names.d.ts.map +1 -0
  91. package/dist/navigation/helpers/get-navigation-tag-names.js +3 -0
  92. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
  93. package/dist/navigation/helpers/traverse-asyncapi-document.js +27 -20
  94. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  95. package/dist/navigation/helpers/traverse-paths.js +5 -3
  96. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  97. package/dist/navigation/helpers/traverse-schemas.js +6 -3
  98. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  99. package/dist/navigation/helpers/traverse-tags.js +8 -4
  100. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  101. package/dist/navigation/helpers/traverse-webhooks.js +4 -2
  102. package/dist/plugins/bundler/index.d.ts.map +1 -1
  103. package/dist/plugins/bundler/index.js +2 -1
  104. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -1
  105. package/dist/plugins/bundler/openapi-document.js +2 -1
  106. package/dist/request-example/builder/body/build-multipart.d.ts.map +1 -1
  107. package/dist/request-example/builder/body/build-multipart.js +18 -16
  108. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  109. package/dist/request-example/builder/body/build-request-body.js +3 -5
  110. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -1
  111. package/dist/request-example/builder/body/encode-multipart-body.js +2 -1
  112. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  113. package/dist/request-example/builder/body/get-request-body-example.js +2 -1
  114. package/dist/request-example/builder/body/schema-value-coercion.d.ts.map +1 -1
  115. package/dist/request-example/builder/body/schema-value-coercion.js +9 -8
  116. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  117. package/dist/request-example/builder/build-request.js +3 -0
  118. package/dist/request-example/builder/header/build-request-parameters.d.ts +7 -1
  119. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  120. package/dist/request-example/builder/header/build-request-parameters.js +34 -3
  121. package/dist/request-example/builder/header/filter-disabled-properties.d.ts +3 -0
  122. package/dist/request-example/builder/header/filter-disabled-properties.d.ts.map +1 -0
  123. package/dist/request-example/builder/header/filter-disabled-properties.js +18 -0
  124. package/dist/request-example/builder/header/filter-global-cookies.d.ts +1 -1
  125. package/dist/request-example/builder/header/filter-global-cookies.d.ts.map +1 -1
  126. package/dist/request-example/builder/header/filter-global-cookies.js +15 -3
  127. package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
  128. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  129. package/dist/request-example/builder/header/is-param-disabled.js +3 -2
  130. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  131. package/dist/request-example/builder/helpers/get-example-from-schema.js +20 -16
  132. package/dist/request-example/builder/helpers/get-example.d.ts +2 -0
  133. package/dist/request-example/builder/helpers/get-example.d.ts.map +1 -1
  134. package/dist/request-example/builder/helpers/get-example.js +15 -5
  135. package/dist/request-example/builder/index.d.ts +1 -0
  136. package/dist/request-example/builder/index.d.ts.map +1 -1
  137. package/dist/request-example/builder/index.js +1 -0
  138. package/dist/request-example/builder/request-factory.d.ts +6 -1
  139. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  140. package/dist/request-example/builder/request-factory.js +3 -1
  141. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  142. package/dist/request-example/builder/resolve-request-factory-url.js +23 -7
  143. package/dist/request-example/builder/security/secret-types.d.ts +13 -3
  144. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  145. package/dist/request-example/context/headers.js +1 -1
  146. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  147. package/dist/request-example/context/security/extract-security-scheme-secrets.js +63 -25
  148. package/dist/request-example/context/security/get-selected-security.js +1 -1
  149. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  150. package/dist/request-example/context/security/merge-security.js +2 -1
  151. package/dist/request-example/index.d.ts +1 -1
  152. package/dist/request-example/index.d.ts.map +1 -1
  153. package/dist/request-example/index.js +1 -1
  154. package/dist/request-example/xml/get-xml-example.js +2 -1
  155. package/dist/request-example/xml/write-xml.d.ts.map +1 -1
  156. package/dist/request-example/xml/write-xml.js +6 -5
  157. package/dist/resolve.d.ts +1 -1
  158. package/dist/resolve.d.ts.map +1 -1
  159. package/dist/resolve.js +16 -1
  160. package/dist/schemas/extensions/example/x-disabled.d.ts +4 -0
  161. package/dist/schemas/extensions/example/x-disabled.d.ts.map +1 -1
  162. package/dist/schemas/extensions/example/x-disabled.js +3 -1
  163. package/dist/schemas/navigation.d.ts +1 -1
  164. package/dist/schemas/navigation.d.ts.map +1 -1
  165. package/dist/schemas/reference-config/index.d.ts +1 -0
  166. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  167. package/dist/schemas/reference-config/settings.d.ts +1 -0
  168. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  169. package/dist/schemas/v3.1/strict/example.d.ts +3 -0
  170. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  171. package/dist/schemas/v3.1/strict/openapi-document.d.ts +36 -6
  172. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  173. package/dist/schemas/v3.2/strict/example.d.ts +3 -0
  174. package/dist/schemas/v3.2/strict/example.d.ts.map +1 -1
  175. package/dist/schemas/v3.2/strict/openapi-document.d.ts +36 -6
  176. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  177. package/dist/server.d.ts.map +1 -1
  178. package/dist/server.js +37 -8
  179. package/package.json +9 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-form-schema.d.ts","sourceRoot":"","sources":["../../src/helpers/resolve-form-schema.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAMxE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,oBAAoB,GAAG,SAAS,EACxC,uBAAuB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC5C,YAAY,GAAG,SAyJjB,CAAA"}
@@ -0,0 +1,143 @@
1
+ import { objectEntries } from '@scalar/helpers/object/object-entries';
2
+ import { selectExampleComposition } from '../request-example/builder/helpers/get-example-from-schema.js';
3
+ import { resolve } from '../resolve.js';
4
+ import { isNumberSchema, isObjectSchema } from '../schemas/v3.2/strict/type-guards.js';
5
+ import { getSchemaAnnotations, resolveSchemaWithAnnotations } from './resolve-schema-with-annotations.js';
6
+ import { unpackProxyShallow } from './unpack-proxy.js';
7
+ /**
8
+ * Expose the selected request-body shape to form editors and serializers without changing the
9
+ * API description. Use the example generator's branch selection so field types match its values.
10
+ * Unselected alternatives remain on the view for validation, but do not contribute form fields.
11
+ */
12
+ export const resolveFormSchema = (schema, compositionSelection) => {
13
+ const ancestors = new Set();
14
+ const visit = (input, path, selection) => {
15
+ const source = resolve.schema(input);
16
+ const resolved = resolveSchemaWithAnnotations(input);
17
+ if (!source || !resolved || !input) {
18
+ return resolved;
19
+ }
20
+ const identity = unpackProxyShallow(input);
21
+ // Recursive properties remain opaque leaves instead of expanding an infinite form.
22
+ if (ancestors.has(identity)) {
23
+ return isObjectSchema(resolved) ? { ...resolved, properties: undefined } : resolved;
24
+ }
25
+ ancestors.add(identity);
26
+ try {
27
+ if (source.allOf?.length) {
28
+ let choiceIndex = 0;
29
+ const members = source.allOf.map((member) => {
30
+ const memberSchema = resolve.schema(member);
31
+ const isChoice = Boolean(memberSchema?.oneOf || memberSchema?.anyOf);
32
+ return visit(member, isChoice ? [...path, String(choiceIndex++)] : path, selection) ?? member;
33
+ });
34
+ if (!resolved.allOf) {
35
+ return resolveSchemaWithAnnotations({ ...source, allOf: members });
36
+ }
37
+ const { allOf: _allOf, ...siblings } = source;
38
+ const parts = [visit(siblings, path, selection), ...members].filter((member) => member !== undefined);
39
+ const typed = parts.filter((member) => 'type' in member && member.type !== undefined);
40
+ const first = typed[0];
41
+ if (!first || !('type' in first) || Array.isArray(first.type)) {
42
+ return resolved;
43
+ }
44
+ const type = typed.some((member) => 'type' in member && member.type === 'integer') &&
45
+ (first.type === 'integer' || first.type === 'number')
46
+ ? 'integer'
47
+ : first.type;
48
+ // Incompatible intersections have no single input type. Keep them as opaque leaves.
49
+ if (typed.some((member) => 'type' in member && member.type !== type && !(type === 'integer' && member.type === 'number'))) {
50
+ return resolved;
51
+ }
52
+ const annotations = Object.assign({}, ...parts.map(getSchemaAnnotations));
53
+ const result = { ...first, ...annotations, ...siblings, type, allOf: source.allOf };
54
+ Reflect.deleteProperty(result, '__scalar_');
55
+ if (isObjectSchema(result)) {
56
+ const properties = {};
57
+ const required = new Set();
58
+ for (const part of parts) {
59
+ if ('required' in part) {
60
+ for (const name of part.required ?? []) {
61
+ required.add(name);
62
+ }
63
+ }
64
+ if ('properties' in part) {
65
+ for (const [name, child] of objectEntries(part.properties ?? {})) {
66
+ const previous = properties[name];
67
+ properties[name] = previous
68
+ ? (visit({ __scalar_: '', allOf: [previous, child] }, [...path, name], selection) ?? child)
69
+ : child;
70
+ }
71
+ }
72
+ }
73
+ result.properties = properties;
74
+ result.required = [...required];
75
+ }
76
+ if (isNumberSchema(result)) {
77
+ const minima = parts.flatMap((part) => 'minimum' in part && part.minimum !== undefined ? [part.minimum] : []);
78
+ const maxima = parts.flatMap((part) => 'maximum' in part && part.maximum !== undefined ? [part.maximum] : []);
79
+ if (minima.length) {
80
+ result.minimum = Math.max(...minima);
81
+ }
82
+ if (maxima.length) {
83
+ result.maximum = Math.min(...maxima);
84
+ }
85
+ }
86
+ return result;
87
+ }
88
+ const properties = isObjectSchema(resolved) && resolved.properties
89
+ ? Object.fromEntries(objectEntries(resolved.properties).map(([key, child]) => [
90
+ key,
91
+ visit(child, [...path, key], selection) ?? child,
92
+ ]))
93
+ : undefined;
94
+ const base = properties ? { ...resolved, properties } : resolved;
95
+ const keyword = resolved.oneOf ? 'oneOf' : 'anyOf';
96
+ const candidate = selectExampleComposition(resolved, path, { compositionSelection: selection });
97
+ if (!candidate) {
98
+ return base;
99
+ }
100
+ const selectionKey = [...path, keyword].join('.');
101
+ const { [selectionKey]: _selection, ...remainingSelection } = selection ?? {};
102
+ const selected = visit(candidate, path, remainingSelection);
103
+ if (!selected) {
104
+ return base;
105
+ }
106
+ const result = { ...base, ...selected, [keyword]: resolved[keyword] };
107
+ if ('type' in result) {
108
+ Reflect.deleteProperty(result, '__scalar_');
109
+ }
110
+ if (isNumberSchema(result)) {
111
+ // Parent and branch bounds both apply; selecting a variant must not weaken validation.
112
+ if ('minimum' in base &&
113
+ 'minimum' in selected &&
114
+ base.minimum !== undefined &&
115
+ selected.minimum !== undefined) {
116
+ result.minimum = Math.max(base.minimum, selected.minimum);
117
+ }
118
+ if ('maximum' in base &&
119
+ 'maximum' in selected &&
120
+ base.maximum !== undefined &&
121
+ selected.maximum !== undefined) {
122
+ result.maximum = Math.min(base.maximum, selected.maximum);
123
+ }
124
+ }
125
+ if (resolved.description !== undefined) {
126
+ result.description = resolved.description;
127
+ }
128
+ if (isObjectSchema(result)) {
129
+ const baseProperties = 'properties' in base ? base.properties : undefined;
130
+ const selectedProperties = 'properties' in selected ? selected.properties : undefined;
131
+ const baseRequired = 'required' in base ? base.required : undefined;
132
+ const selectedRequired = 'required' in selected ? selected.required : undefined;
133
+ result.properties = { ...baseProperties, ...selectedProperties };
134
+ result.required = [...new Set([...(baseRequired ?? []), ...(selectedRequired ?? [])])];
135
+ }
136
+ return result;
137
+ }
138
+ finally {
139
+ ancestors.delete(identity);
140
+ }
141
+ };
142
+ return visit(schema, ['requestBody'], compositionSelection);
143
+ };
@@ -0,0 +1,11 @@
1
+ import type { SchemaObject } from '../schemas/v3.2/strict/openapi-document.js';
2
+ import type { MaybeRefSchemaObject } from '../schemas/v3.2/strict/schema.js';
3
+ /** Extract annotation keywords without copying validation constraints into a form projection. */
4
+ export declare const getSchemaAnnotations: (schema: SchemaObject) => Record<string, unknown>;
5
+ /**
6
+ * Expose the value schema inside an annotation-only allOf wrapper for form editors and serializers.
7
+ * Multiple value schemas retain their composition, since combining their constraints requires more
8
+ * than spreading their keywords. The returned view does not mutate the API description.
9
+ */
10
+ export declare const resolveSchemaWithAnnotations: (schema: MaybeRefSchemaObject | undefined) => SchemaObject | undefined;
11
+ //# sourceMappingURL=resolve-schema-with-annotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-schema-with-annotations.d.ts","sourceRoot":"","sources":["../../src/helpers/resolve-schema-with-annotations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAmBxE,iGAAiG;AACjG,eAAO,MAAM,oBAAoB,GAAI,QAAQ,YAAY,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CACK,CAAA;AAEvF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GAAI,QAAQ,oBAAoB,GAAG,SAAS,KAAG,YAAY,GAAG,SAuCtG,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { resolve } from '../resolve.js';
2
+ import { unpackProxyShallow } from './unpack-proxy.js';
3
+ const annotationKeys = new Set([
4
+ 'title',
5
+ 'description',
6
+ 'default',
7
+ 'examples',
8
+ 'example',
9
+ 'deprecated',
10
+ 'readOnly',
11
+ 'writeOnly',
12
+ '$comment',
13
+ 'externalDocs',
14
+ // TypeBox marks schemas without an explicit type; this does not constrain their value.
15
+ '__scalar_',
16
+ ]);
17
+ /** Extract annotation keywords without copying validation constraints into a form projection. */
18
+ export const getSchemaAnnotations = (schema) => Object.fromEntries(Object.entries(schema).filter(([key]) => annotationKeys.has(key)));
19
+ /**
20
+ * Expose the value schema inside an annotation-only allOf wrapper for form editors and serializers.
21
+ * Multiple value schemas retain their composition, since combining their constraints requires more
22
+ * than spreading their keywords. The returned view does not mutate the API description.
23
+ */
24
+ export const resolveSchemaWithAnnotations = (schema) => {
25
+ const seen = new Set();
26
+ const visit = (input) => {
27
+ const resolved = resolve.schema(input);
28
+ if (!resolved?.allOf?.length || !input) {
29
+ return resolved;
30
+ }
31
+ if (Object.keys(resolved).some((key) => key !== 'allOf' && key !== '$ref' && !annotationKeys.has(key))) {
32
+ return resolved;
33
+ }
34
+ const identity = unpackProxyShallow(input);
35
+ if (seen.has(identity)) {
36
+ return resolved;
37
+ }
38
+ seen.add(identity);
39
+ const members = resolved.allOf.map((member) => resolve.schema(member));
40
+ if (members.some((member) => !member)) {
41
+ return resolved;
42
+ }
43
+ const valueMembers = members.filter((member) => member && Object.keys(member).some((key) => !annotationKeys.has(key)));
44
+ const valueMember = valueMembers[0];
45
+ if (valueMembers.length !== 1 || !valueMember) {
46
+ return resolved;
47
+ }
48
+ const valueIndex = members.indexOf(valueMember);
49
+ const valueSchema = visit(resolved.allOf[valueIndex]);
50
+ const annotations = Object.assign({}, ...members.filter((member) => member !== valueMember && member !== undefined).map(getSchemaAnnotations));
51
+ const { allOf: _allOf, ...siblings } = resolved;
52
+ const result = { ...valueSchema, ...annotations, ...siblings };
53
+ Reflect.deleteProperty(result, '__scalar_');
54
+ return result;
55
+ };
56
+ return visit(schema);
57
+ };
@@ -0,0 +1,15 @@
1
+ import { type LoaderPlugin } from '@scalar/json-magic/bundle';
2
+ type SecurityUriOptions = {
3
+ origin?: string;
4
+ loaders: LoaderPlugin[];
5
+ };
6
+ /**
7
+ * Makes URI requirements available to the existing name-based auth consumers.
8
+ * Aliases live only in the working document; export removes them and restores authored keys.
9
+ * Relative keys in referenced documents become absolute to keep distinct document bases apart.
10
+ */
11
+ export declare const resolveSecurityRequirements: (document: Record<string, unknown>, { origin, loaders }: SecurityUriOptions) => Promise<void>;
12
+ /** Remove runtime URI aliases while keeping edited scopes and authored requirement spellings. */
13
+ export declare const restoreSecurityRequirements: (document: Record<string, unknown>) => void;
14
+ export {};
15
+ //# sourceMappingURL=resolve-security-requirements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-security-requirements.d.ts","sourceRoot":"","sources":["../../src/helpers/resolve-security-requirements.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAgC,MAAM,2BAA2B,CAAA;AAa3F,KAAK,kBAAkB,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,YAAY,EAAE,CAAA;CACxB,CAAA;AAUD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,qBAA2B,kBAAkB,KAC5C,OAAO,CAAC,IAAI,CAoKd,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,2BAA2B,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAkE/E,CAAA"}
@@ -0,0 +1,241 @@
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
2
+ import { isObject } from '@scalar/helpers/object/is-object';
3
+ import { isPollutionKey } from '@scalar/helpers/object/prevent-pollution';
4
+ import { isSchemaPath } from '@scalar/helpers/openapi/is-schema-path';
5
+ import { bundle, resolveReferencePath } from '@scalar/json-magic/bundle';
6
+ import { createMagicProxy } from '@scalar/json-magic/magic-proxy';
7
+ import { Value } from '@scalar/typebox/value';
8
+ import { generateUniqueValue } from '../helpers/generate-unique-value.js';
9
+ import { getResolvedRef } from '../helpers/get-resolved-ref.js';
10
+ import { normalizeAuthSchemes } from '../plugins/bundler/index.js';
11
+ import { resolveOpenApiDocument } from '../plugins/bundler/openapi-document.js';
12
+ import { SecuritySchemeObjectSchema } from '../schemas/v3.2/strict/openapi-document.js';
13
+ const ALIASES = 'x-scalar-security-uri-aliases';
14
+ const ORIGINAL_KEYS = 'x-scalar-original-security-keys';
15
+ /** Resolve the URI portion separately so filesystem origins do not interpret fragments as filenames. */
16
+ const absoluteReference = (reference, base) => {
17
+ const separator = reference.indexOf('#');
18
+ const resource = separator === -1 ? reference : reference.slice(0, separator);
19
+ const fragment = separator === -1 ? '' : reference.slice(separator);
20
+ return `${resource ? resolveReferencePath(base, resource) : base}${fragment}`;
21
+ };
22
+ /**
23
+ * Makes URI requirements available to the existing name-based auth consumers.
24
+ * Aliases live only in the working document; export removes them and restores authored keys.
25
+ * Relative keys in referenced documents become absolute to keep distinct document bases apart.
26
+ */
27
+ export const resolveSecurityRequirements = async (document, { origin = '/', loaders }) => {
28
+ if (typeof document.openapi !== 'string' || !/^3\.2\.\d+$/.test(document.openapi)) {
29
+ return;
30
+ }
31
+ const originalKeys = isObject(document[ORIGINAL_KEYS]) ? document[ORIGINAL_KEYS] : {};
32
+ const components = isObject(document.components) ? document.components : {};
33
+ const schemes = isObject(components.securitySchemes) ? components.securitySchemes : {};
34
+ const metadata = isObject(document[ALIASES])
35
+ ? document[ALIASES]
36
+ : {
37
+ hadComponents: isObject(document.components),
38
+ hadSecuritySchemes: isObject(components.securitySchemes),
39
+ schemes: {},
40
+ };
41
+ const aliases = isObject(metadata.schemes) ? metadata.schemes : {};
42
+ metadata.schemes = aliases;
43
+ const namedSchemes = new Set(Object.keys(schemes).filter((name) => !Object.hasOwn(aliases, name)));
44
+ const visited = new WeakSet();
45
+ const processedDocuments = new Set();
46
+ const cache = new Map();
47
+ const visit = async (node, path, base, external) => {
48
+ if (node === null || typeof node !== 'object' || visited.has(node) || isSchemaPath(path)) {
49
+ return;
50
+ }
51
+ visited.add(node);
52
+ // Security is a fixed field on document and operation objects, not arbitrary example payloads.
53
+ const operationKey = path.at(-1) ?? '';
54
+ const isOperation = isHttpMethod(operationKey) || path.at(-2) === 'additionalOperations';
55
+ const isDocument = path.length === 0 || (path[0] === 'x-ext' && path.length === 2);
56
+ if (isObject(node) && (isDocument || isOperation) && Array.isArray(node.security)) {
57
+ for (const [index, requirement] of node.security.entries()) {
58
+ if (!isObject(requirement)) {
59
+ continue;
60
+ }
61
+ for (const [name, scopes] of Object.entries(requirement)) {
62
+ if (namedSchemes.has(name) || !Array.isArray(scopes)) {
63
+ continue;
64
+ }
65
+ const uri = (() => {
66
+ try {
67
+ return Object.hasOwn(aliases, name) && typeof aliases[name] === 'string'
68
+ ? aliases[name]
69
+ : absoluteReference(name, base);
70
+ }
71
+ catch {
72
+ return undefined;
73
+ }
74
+ })();
75
+ if (uri === undefined) {
76
+ continue;
77
+ }
78
+ const key = await generateUniqueValue({
79
+ defaultValue: external ? uri : name,
80
+ validation: (candidate) => !namedSchemes.has(candidate) &&
81
+ (!Object.hasOwn(aliases, candidate) || aliases[candidate] === uri) &&
82
+ (!external || candidate === name || !Object.hasOwn(requirement, candidate)),
83
+ maxRetries: Object.keys(schemes).length + 1,
84
+ });
85
+ if (key === undefined) {
86
+ continue;
87
+ }
88
+ if (!Object.hasOwn(aliases, key)) {
89
+ const reference = { $ref: uri };
90
+ await bundle({ components: { securitySchemes: { target: reference } } }, {
91
+ root: document,
92
+ origin,
93
+ treeShake: false,
94
+ urlMap: true,
95
+ cache,
96
+ plugins: [...loaders, normalizeAuthSchemes()],
97
+ hooks: { resolveDocument: resolveOpenApiDocument },
98
+ });
99
+ // Validate the target before exposing an auth option; missing pointers and non-schemes
100
+ // keep their original requirement and never acquire a misleading working alias.
101
+ const proxy = createMagicProxy({ ...document, 'x-scalar-security-uri-target': reference }, {
102
+ documentUri: resolveOpenApiDocument(document, origin)?.baseUri,
103
+ });
104
+ const target = getResolvedRef(proxy['x-scalar-security-uri-target']);
105
+ // The strict runtime schema requires refreshUrl, while authored OAuth flows may omit it.
106
+ const validationTarget = isObject(target) && target.type === 'oauth2' && isObject(target.flows)
107
+ ? {
108
+ ...target,
109
+ flows: Object.fromEntries(Object.entries(target.flows).map(([flow, value]) => [
110
+ flow,
111
+ isObject(value) ? { refreshUrl: '', ...value } : value,
112
+ ])),
113
+ }
114
+ : target;
115
+ if (!Value.Check(SecuritySchemeObjectSchema, validationTarget)) {
116
+ continue;
117
+ }
118
+ Object.defineProperty(schemes, key, {
119
+ value: reference,
120
+ enumerable: true,
121
+ writable: true,
122
+ configurable: true,
123
+ });
124
+ Object.defineProperty(aliases, key, { value: uri, enumerable: true, writable: true, configurable: true });
125
+ components.securitySchemes = schemes;
126
+ document.components = components;
127
+ document[ALIASES] = metadata;
128
+ }
129
+ if (external) {
130
+ const location = JSON.stringify([...path, 'security', String(index)]);
131
+ const mapping = isObject(originalKeys[location]) ? originalKeys[location] : {};
132
+ Object.defineProperty(mapping, name, { value: key, enumerable: true, writable: true, configurable: true });
133
+ originalKeys[location] = mapping;
134
+ document[ORIGINAL_KEYS] = originalKeys;
135
+ if (key === name) {
136
+ continue;
137
+ }
138
+ const previous = Object.hasOwn(requirement, key) ? requirement[key] : [];
139
+ Object.defineProperty(requirement, key, {
140
+ value: [...new Set([...(Array.isArray(previous) ? previous : []), ...scopes])],
141
+ enumerable: true,
142
+ writable: true,
143
+ configurable: true,
144
+ });
145
+ delete requirement[name];
146
+ }
147
+ }
148
+ }
149
+ }
150
+ for (const [key, child] of Object.entries(node)) {
151
+ if (key.startsWith('x-') || key === 'example' || key === 'examples' || key === 'security') {
152
+ continue;
153
+ }
154
+ await visit(child, [...path, key], base, external);
155
+ }
156
+ };
157
+ const entryBase = resolveOpenApiDocument(document, origin)?.baseUri ?? origin;
158
+ await visit(document, [], entryBase, false);
159
+ // URI-only dependencies can load further documents, so process newly embedded documents too.
160
+ while (isObject(document['x-ext'])) {
161
+ const next = Object.entries(document['x-ext']).find(([key]) => !processedDocuments.has(key));
162
+ if (!next) {
163
+ break;
164
+ }
165
+ const [key, external] = next;
166
+ processedDocuments.add(key);
167
+ if (!isObject(external)) {
168
+ continue;
169
+ }
170
+ if (typeof external.openapi === 'string' && !/^3\.2\.\d+$/.test(external.openapi)) {
171
+ continue;
172
+ }
173
+ const mappings = document['x-ext-urls'];
174
+ const retrieval = isObject(mappings) && typeof mappings[key] === 'string' ? mappings[key] : key;
175
+ const retrievalUri = resolveReferencePath(entryBase, retrieval);
176
+ await visit(external, ['x-ext', key], resolveOpenApiDocument(external, retrievalUri)?.baseUri ?? retrievalUri, true);
177
+ }
178
+ };
179
+ /** Remove runtime URI aliases while keeping edited scopes and authored requirement spellings. */
180
+ export const restoreSecurityRequirements = (document) => {
181
+ const originalKeys = Object.hasOwn(document, ORIGINAL_KEYS) ? document[ORIGINAL_KEYS] : undefined;
182
+ if (isObject(originalKeys)) {
183
+ for (const [location, mapping] of Object.entries(originalKeys)) {
184
+ const path = (() => {
185
+ try {
186
+ return JSON.parse(location);
187
+ }
188
+ catch {
189
+ return undefined;
190
+ }
191
+ })();
192
+ if (!Array.isArray(path) ||
193
+ !path.every((segment) => typeof segment === 'string' && !isPollutionKey(segment)) ||
194
+ !isObject(mapping)) {
195
+ continue;
196
+ }
197
+ const requirement = path.reduce((parent, segment) => {
198
+ if (parent === null || typeof parent !== 'object' || !Object.hasOwn(parent, segment)) {
199
+ return undefined;
200
+ }
201
+ return Reflect.get(parent, segment);
202
+ }, document);
203
+ if (!isObject(requirement)) {
204
+ continue;
205
+ }
206
+ const entries = Object.entries(mapping).flatMap(([original, rewritten]) => typeof rewritten === 'string' && Object.hasOwn(requirement, rewritten)
207
+ ? [{ original, rewritten, scopes: requirement[rewritten] }]
208
+ : []);
209
+ for (const { rewritten } of entries) {
210
+ delete requirement[rewritten];
211
+ }
212
+ for (const { original, scopes } of entries) {
213
+ Object.defineProperty(requirement, original, {
214
+ value: scopes,
215
+ enumerable: true,
216
+ writable: true,
217
+ configurable: true,
218
+ });
219
+ }
220
+ }
221
+ }
222
+ const metadata = Object.hasOwn(document, ALIASES) ? document[ALIASES] : undefined;
223
+ const components = Object.hasOwn(document, 'components') ? document.components : undefined;
224
+ if (isObject(metadata) &&
225
+ isObject(metadata.schemes) &&
226
+ isObject(components) &&
227
+ Object.hasOwn(components, 'securitySchemes') &&
228
+ isObject(components.securitySchemes)) {
229
+ for (const key of Object.keys(metadata.schemes)) {
230
+ delete components.securitySchemes[key];
231
+ }
232
+ if (!metadata.hadSecuritySchemes && Object.keys(components.securitySchemes).length === 0) {
233
+ delete components.securitySchemes;
234
+ }
235
+ if (!metadata.hadComponents && Object.keys(components).length === 0) {
236
+ delete document.components;
237
+ }
238
+ }
239
+ delete document[ALIASES];
240
+ delete document[ORIGINAL_KEYS];
241
+ };
@@ -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,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,GAAG,EAOT,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,KAAK,uBAAuB,EAAiC,MAAM,6BAA6B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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,iBAAiB,GAAG,IAAI,EAClC,6CAA6C,UAAU,CAAC,6BAA6B,CAAC,SA0EvF,CAAA;AAqED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GACtB,OAAO,cAAc,GAA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C,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"}