@speclynx/apidom-ns-openapi-3-1 3.2.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/apidom-ns-openapi-3-1.browser.js +37 -35
  3. package/dist/apidom-ns-openapi-3-1.browser.min.js +1 -1
  4. package/package.json +8 -8
  5. package/src/elements/Callback.cjs +0 -10
  6. package/src/elements/Callback.mjs +0 -7
  7. package/src/elements/Components.cjs +0 -17
  8. package/src/elements/Components.mjs +0 -14
  9. package/src/elements/Contact.cjs +0 -10
  10. package/src/elements/Contact.mjs +0 -7
  11. package/src/elements/Discriminator.cjs +0 -10
  12. package/src/elements/Discriminator.mjs +0 -7
  13. package/src/elements/Encoding.cjs +0 -10
  14. package/src/elements/Encoding.mjs +0 -7
  15. package/src/elements/Example.cjs +0 -10
  16. package/src/elements/Example.mjs +0 -7
  17. package/src/elements/ExternalDocumentation.cjs +0 -10
  18. package/src/elements/ExternalDocumentation.mjs +0 -7
  19. package/src/elements/Header.cjs +0 -17
  20. package/src/elements/Header.mjs +0 -13
  21. package/src/elements/Info.cjs +0 -23
  22. package/src/elements/Info.mjs +0 -19
  23. package/src/elements/JsonSchemaDialect.cjs +0 -16
  24. package/src/elements/JsonSchemaDialect.mjs +0 -13
  25. package/src/elements/License.cjs +0 -17
  26. package/src/elements/License.mjs +0 -14
  27. package/src/elements/Link.cjs +0 -10
  28. package/src/elements/Link.mjs +0 -7
  29. package/src/elements/MediaType.cjs +0 -17
  30. package/src/elements/MediaType.mjs +0 -13
  31. package/src/elements/OAuthFlow.cjs +0 -10
  32. package/src/elements/OAuthFlow.mjs +0 -7
  33. package/src/elements/OAuthFlows.cjs +0 -10
  34. package/src/elements/OAuthFlows.mjs +0 -7
  35. package/src/elements/OpenApi3-1.cjs +0 -77
  36. package/src/elements/OpenApi3-1.mjs +0 -73
  37. package/src/elements/Openapi.cjs +0 -10
  38. package/src/elements/Openapi.mjs +0 -7
  39. package/src/elements/Operation.cjs +0 -17
  40. package/src/elements/Operation.mjs +0 -13
  41. package/src/elements/Parameter.cjs +0 -17
  42. package/src/elements/Parameter.mjs +0 -13
  43. package/src/elements/PathItem.cjs +0 -59
  44. package/src/elements/PathItem.mjs +0 -55
  45. package/src/elements/Paths.cjs +0 -10
  46. package/src/elements/Paths.mjs +0 -7
  47. package/src/elements/Reference.cjs +0 -28
  48. package/src/elements/Reference.mjs +0 -25
  49. package/src/elements/RequestBody.cjs +0 -10
  50. package/src/elements/RequestBody.mjs +0 -7
  51. package/src/elements/Response.cjs +0 -10
  52. package/src/elements/Response.mjs +0 -7
  53. package/src/elements/Responses.cjs +0 -10
  54. package/src/elements/Responses.mjs +0 -7
  55. package/src/elements/Schema.cjs +0 -50
  56. package/src/elements/Schema.mjs +0 -46
  57. package/src/elements/SecurityRequirement.cjs +0 -10
  58. package/src/elements/SecurityRequirement.mjs +0 -7
  59. package/src/elements/SecurityScheme.cjs +0 -10
  60. package/src/elements/SecurityScheme.mjs +0 -7
  61. package/src/elements/Server.cjs +0 -10
  62. package/src/elements/Server.mjs +0 -7
  63. package/src/elements/ServerVariable.cjs +0 -10
  64. package/src/elements/ServerVariable.mjs +0 -7
  65. package/src/elements/Tag.cjs +0 -10
  66. package/src/elements/Tag.mjs +0 -7
  67. package/src/elements/Xml.cjs +0 -10
  68. package/src/elements/Xml.mjs +0 -7
  69. package/src/elements/nces/ComponentsPathItems.cjs +0 -16
  70. package/src/elements/nces/ComponentsPathItems.mjs +0 -13
  71. package/src/elements/nces/Webhooks.cjs +0 -16
  72. package/src/elements/nces/Webhooks.mjs +0 -13
  73. package/src/index.cjs +0 -182
  74. package/src/index.mjs +0 -31
  75. package/src/media-types.cjs +0 -34
  76. package/src/media-types.mjs +0 -30
  77. package/src/namespace.cjs +0 -81
  78. package/src/namespace.mjs +0 -76
  79. package/src/predicates.cjs +0 -228
  80. package/src/predicates.mjs +0 -195
  81. package/src/refractor/index.cjs +0 -368
  82. package/src/refractor/index.mjs +0 -330
  83. package/src/refractor/inspect.cjs +0 -207
  84. package/src/refractor/inspect.mjs +0 -171
  85. package/src/refractor/plugins/normalize-header-examples/NormalizeStorage.cjs +0 -38
  86. package/src/refractor/plugins/normalize-header-examples/NormalizeStorage.mjs +0 -34
  87. package/src/refractor/plugins/normalize-header-examples/index.cjs +0 -109
  88. package/src/refractor/plugins/normalize-header-examples/index.mjs +0 -103
  89. package/src/refractor/plugins/normalize-operation-ids.cjs +0 -166
  90. package/src/refractor/plugins/normalize-operation-ids.mjs +0 -161
  91. package/src/refractor/plugins/normalize-parameter-examples.cjs +0 -109
  92. package/src/refractor/plugins/normalize-parameter-examples.mjs +0 -103
  93. package/src/refractor/plugins/normalize-parameters.cjs +0 -109
  94. package/src/refractor/plugins/normalize-parameters.mjs +0 -103
  95. package/src/refractor/plugins/normalize-security-requirements.cjs +0 -75
  96. package/src/refractor/plugins/normalize-security-requirements.mjs +0 -69
  97. package/src/refractor/plugins/normalize-servers.cjs +0 -124
  98. package/src/refractor/plugins/normalize-servers.mjs +0 -118
  99. package/src/refractor/plugins/replace-empty-element.cjs +0 -669
  100. package/src/refractor/plugins/replace-empty-element.mjs +0 -661
  101. package/src/refractor/predicates.cjs +0 -36
  102. package/src/refractor/predicates.mjs +0 -31
  103. package/src/refractor/specification.cjs +0 -531
  104. package/src/refractor/specification.mjs +0 -526
  105. package/src/refractor/toolbox.cjs +0 -61
  106. package/src/refractor/toolbox.mjs +0 -53
  107. package/src/refractor/visitors/open-api-3-1/JsonSchemaDialectVisitor.cjs +0 -25
  108. package/src/refractor/visitors/open-api-3-1/JsonSchemaDialectVisitor.mjs +0 -19
  109. package/src/refractor/visitors/open-api-3-1/OpenapiVisitor.cjs +0 -25
  110. package/src/refractor/visitors/open-api-3-1/OpenapiVisitor.mjs +0 -19
  111. package/src/refractor/visitors/open-api-3-1/WebhooksVisitor.cjs +0 -43
  112. package/src/refractor/visitors/open-api-3-1/WebhooksVisitor.mjs +0 -37
  113. package/src/refractor/visitors/open-api-3-1/bases.cjs +0 -46
  114. package/src/refractor/visitors/open-api-3-1/bases.mjs +0 -43
  115. package/src/refractor/visitors/open-api-3-1/callback/index.cjs +0 -36
  116. package/src/refractor/visitors/open-api-3-1/callback/index.mjs +0 -31
  117. package/src/refractor/visitors/open-api-3-1/components/PathItemsVisitor.cjs +0 -33
  118. package/src/refractor/visitors/open-api-3-1/components/PathItemsVisitor.mjs +0 -27
  119. package/src/refractor/visitors/open-api-3-1/components/SchemasVisitor.cjs +0 -22
  120. package/src/refractor/visitors/open-api-3-1/components/SchemasVisitor.mjs +0 -17
  121. package/src/refractor/visitors/open-api-3-1/components/index.cjs +0 -21
  122. package/src/refractor/visitors/open-api-3-1/components/index.mjs +0 -16
  123. package/src/refractor/visitors/open-api-3-1/contact/index.cjs +0 -21
  124. package/src/refractor/visitors/open-api-3-1/contact/index.mjs +0 -16
  125. package/src/refractor/visitors/open-api-3-1/distriminator/index.cjs +0 -22
  126. package/src/refractor/visitors/open-api-3-1/distriminator/index.mjs +0 -17
  127. package/src/refractor/visitors/open-api-3-1/encoding/index.cjs +0 -21
  128. package/src/refractor/visitors/open-api-3-1/encoding/index.mjs +0 -16
  129. package/src/refractor/visitors/open-api-3-1/example/index.cjs +0 -21
  130. package/src/refractor/visitors/open-api-3-1/example/index.mjs +0 -16
  131. package/src/refractor/visitors/open-api-3-1/external-documentation/index.cjs +0 -21
  132. package/src/refractor/visitors/open-api-3-1/external-documentation/index.mjs +0 -16
  133. package/src/refractor/visitors/open-api-3-1/header/index.cjs +0 -21
  134. package/src/refractor/visitors/open-api-3-1/header/index.mjs +0 -16
  135. package/src/refractor/visitors/open-api-3-1/index.cjs +0 -41
  136. package/src/refractor/visitors/open-api-3-1/index.mjs +0 -35
  137. package/src/refractor/visitors/open-api-3-1/info/index.cjs +0 -21
  138. package/src/refractor/visitors/open-api-3-1/info/index.mjs +0 -16
  139. package/src/refractor/visitors/open-api-3-1/license/index.cjs +0 -21
  140. package/src/refractor/visitors/open-api-3-1/license/index.mjs +0 -16
  141. package/src/refractor/visitors/open-api-3-1/link/index.cjs +0 -21
  142. package/src/refractor/visitors/open-api-3-1/link/index.mjs +0 -16
  143. package/src/refractor/visitors/open-api-3-1/media-type/index.cjs +0 -21
  144. package/src/refractor/visitors/open-api-3-1/media-type/index.mjs +0 -16
  145. package/src/refractor/visitors/open-api-3-1/oauth-flow/index.cjs +0 -21
  146. package/src/refractor/visitors/open-api-3-1/oauth-flow/index.mjs +0 -16
  147. package/src/refractor/visitors/open-api-3-1/oauth-flows/index.cjs +0 -21
  148. package/src/refractor/visitors/open-api-3-1/oauth-flows/index.mjs +0 -16
  149. package/src/refractor/visitors/open-api-3-1/operation/index.cjs +0 -21
  150. package/src/refractor/visitors/open-api-3-1/operation/index.mjs +0 -16
  151. package/src/refractor/visitors/open-api-3-1/parameter/index.cjs +0 -21
  152. package/src/refractor/visitors/open-api-3-1/parameter/index.mjs +0 -16
  153. package/src/refractor/visitors/open-api-3-1/path-item/index.cjs +0 -21
  154. package/src/refractor/visitors/open-api-3-1/path-item/index.mjs +0 -16
  155. package/src/refractor/visitors/open-api-3-1/paths/index.cjs +0 -21
  156. package/src/refractor/visitors/open-api-3-1/paths/index.mjs +0 -16
  157. package/src/refractor/visitors/open-api-3-1/reference/index.cjs +0 -21
  158. package/src/refractor/visitors/open-api-3-1/reference/index.mjs +0 -16
  159. package/src/refractor/visitors/open-api-3-1/request-body/index.cjs +0 -21
  160. package/src/refractor/visitors/open-api-3-1/request-body/index.mjs +0 -16
  161. package/src/refractor/visitors/open-api-3-1/response/index.cjs +0 -21
  162. package/src/refractor/visitors/open-api-3-1/response/index.mjs +0 -16
  163. package/src/refractor/visitors/open-api-3-1/responses/index.cjs +0 -21
  164. package/src/refractor/visitors/open-api-3-1/responses/index.mjs +0 -16
  165. package/src/refractor/visitors/open-api-3-1/schema/$defsVisitor.cjs +0 -19
  166. package/src/refractor/visitors/open-api-3-1/schema/$defsVisitor.mjs +0 -16
  167. package/src/refractor/visitors/open-api-3-1/schema/AllOfVisitor.cjs +0 -15
  168. package/src/refractor/visitors/open-api-3-1/schema/AllOfVisitor.mjs +0 -11
  169. package/src/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.cjs +0 -15
  170. package/src/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.mjs +0 -11
  171. package/src/refractor/visitors/open-api-3-1/schema/DependentSchemasVisitor.cjs +0 -15
  172. package/src/refractor/visitors/open-api-3-1/schema/DependentSchemasVisitor.mjs +0 -11
  173. package/src/refractor/visitors/open-api-3-1/schema/OneOfVisitor.cjs +0 -15
  174. package/src/refractor/visitors/open-api-3-1/schema/OneOfVisitor.mjs +0 -11
  175. package/src/refractor/visitors/open-api-3-1/schema/PatternPropertiesVisitor.cjs +0 -15
  176. package/src/refractor/visitors/open-api-3-1/schema/PatternPropertiesVisitor.mjs +0 -11
  177. package/src/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.cjs +0 -15
  178. package/src/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.mjs +0 -11
  179. package/src/refractor/visitors/open-api-3-1/schema/PropertiesVisitor.cjs +0 -15
  180. package/src/refractor/visitors/open-api-3-1/schema/PropertiesVisitor.mjs +0 -11
  181. package/src/refractor/visitors/open-api-3-1/schema/index.cjs +0 -76
  182. package/src/refractor/visitors/open-api-3-1/schema/index.mjs +0 -70
  183. package/src/refractor/visitors/open-api-3-1/security-requirement/index.cjs +0 -21
  184. package/src/refractor/visitors/open-api-3-1/security-requirement/index.mjs +0 -16
  185. package/src/refractor/visitors/open-api-3-1/security-scheme/index.cjs +0 -21
  186. package/src/refractor/visitors/open-api-3-1/security-scheme/index.mjs +0 -16
  187. package/src/refractor/visitors/open-api-3-1/server/index.cjs +0 -21
  188. package/src/refractor/visitors/open-api-3-1/server/index.mjs +0 -16
  189. package/src/refractor/visitors/open-api-3-1/server-variable/index.cjs +0 -21
  190. package/src/refractor/visitors/open-api-3-1/server-variable/index.mjs +0 -16
  191. package/src/refractor/visitors/open-api-3-1/tag/index.cjs +0 -21
  192. package/src/refractor/visitors/open-api-3-1/tag/index.mjs +0 -16
  193. package/src/refractor/visitors/open-api-3-1/xml/index.cjs +0 -21
  194. package/src/refractor/visitors/open-api-3-1/xml/index.mjs +0 -16
@@ -1,368 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
- exports.__esModule = true;
5
- exports.refractXml = exports.refractTag = exports.refractServerVariable = exports.refractServer = exports.refractSecurityScheme = exports.refractSecurityRequirement = exports.refractSchema = exports.refractResponses = exports.refractResponse = exports.refractRequestBody = exports.refractReference = exports.refractPaths = exports.refractPathItem = exports.refractParameter = exports.refractOperation = exports.refractOpenApi3_1 = exports.refractOAuthFlows = exports.refractOAuthFlow = exports.refractMediaType = exports.refractLink = exports.refractLicense = exports.refractJsonSchemaDialect = exports.refractInfo = exports.refractHeader = exports.refractExternalDocumentation = exports.refractExample = exports.refractEncoding = exports.refractDiscriminator = exports.refractContact = exports.refractComponents = exports.refractCallback = exports.default = void 0;
6
- var _apidomCore = require("@speclynx/apidom-core");
7
- var _apidomDatamodel = require("@speclynx/apidom-datamodel");
8
- var _apidomTraverse = require("@speclynx/apidom-traverse");
9
- var _ramda = require("ramda");
10
- var _specification = _interopRequireDefault(require("./specification.cjs"));
11
- var _toolbox = _interopRequireDefault(require("./toolbox.cjs"));
12
- /**
13
- * @public
14
- */
15
-
16
- /**
17
- * @public
18
- */
19
-
20
- /**
21
- * @public
22
- */
23
- const refract = (value, {
24
- element = 'openApi3_1',
25
- plugins = [],
26
- specificationObj = _specification.default,
27
- consume = false
28
- } = {}) => {
29
- const genericElement = (0, _apidomDatamodel.refract)(value);
30
- const resolvedSpec = (0, _apidomCore.resolveSpecification)(specificationObj);
31
- const elementMap = resolvedSpec.elementMap;
32
- const specPath = elementMap[element];
33
- if (!specPath) {
34
- throw new Error(`Unknown element type: "${element}"`);
35
- }
36
-
37
- /**
38
- * This is where generic ApiDOM becomes semantic (namespace applied).
39
- * We don't allow consumers to hook into this translation.
40
- * Though we allow consumers to define their own plugins on already transformed ApiDOM.
41
- */
42
- const RootVisitorClass = (0, _ramda.path)(specPath, resolvedSpec);
43
- const rootVisitor = new RootVisitorClass({
44
- specObj: resolvedSpec,
45
- consume
46
- });
47
- (0, _apidomTraverse.traverse)(genericElement, rootVisitor, {
48
- nodeTypeGetter: _apidomTraverse.getNodePrimitiveType
49
- });
50
-
51
- /**
52
- * Running plugins visitors means extra single traversal === performance hit.
53
- */
54
- return (0, _apidomCore.dispatchRefractorPlugins)(rootVisitor.element, plugins, {
55
- toolboxCreator: _toolbox.default
56
- });
57
- };
58
-
59
- /**
60
- * Refracts a value into an OpenApi3_1Element.
61
- * @public
62
- */
63
- const refractOpenApi3_1 = (value, options = {}) => refract(value, {
64
- ...options,
65
- element: 'openApi3_1'
66
- });
67
-
68
- /**
69
- * Refracts a value into an InfoElement.
70
- * @public
71
- */
72
- exports.refractOpenApi3_1 = refractOpenApi3_1;
73
- const refractInfo = (value, options = {}) => refract(value, {
74
- ...options,
75
- element: 'info'
76
- });
77
-
78
- /**
79
- * Refracts a value into a ContactElement.
80
- * @public
81
- */
82
- exports.refractInfo = refractInfo;
83
- const refractContact = (value, options = {}) => refract(value, {
84
- ...options,
85
- element: 'contact'
86
- });
87
-
88
- /**
89
- * Refracts a value into a LicenseElement.
90
- * @public
91
- */
92
- exports.refractContact = refractContact;
93
- const refractLicense = (value, options = {}) => refract(value, {
94
- ...options,
95
- element: 'license'
96
- });
97
-
98
- /**
99
- * Refracts a value into a ServerElement.
100
- * @public
101
- */
102
- exports.refractLicense = refractLicense;
103
- const refractServer = (value, options = {}) => refract(value, {
104
- ...options,
105
- element: 'server'
106
- });
107
-
108
- /**
109
- * Refracts a value into a ServerVariableElement.
110
- * @public
111
- */
112
- exports.refractServer = refractServer;
113
- const refractServerVariable = (value, options = {}) => refract(value, {
114
- ...options,
115
- element: 'serverVariable'
116
- });
117
-
118
- /**
119
- * Refracts a value into a ComponentsElement.
120
- * @public
121
- */
122
- exports.refractServerVariable = refractServerVariable;
123
- const refractComponents = (value, options = {}) => refract(value, {
124
- ...options,
125
- element: 'components'
126
- });
127
-
128
- /**
129
- * Refracts a value into a PathsElement.
130
- * @public
131
- */
132
- exports.refractComponents = refractComponents;
133
- const refractPaths = (value, options = {}) => refract(value, {
134
- ...options,
135
- element: 'paths'
136
- });
137
-
138
- /**
139
- * Refracts a value into a PathItemElement.
140
- * @public
141
- */
142
- exports.refractPaths = refractPaths;
143
- const refractPathItem = (value, options = {}) => refract(value, {
144
- ...options,
145
- element: 'pathItem'
146
- });
147
-
148
- /**
149
- * Refracts a value into an OperationElement.
150
- * @public
151
- */
152
- exports.refractPathItem = refractPathItem;
153
- const refractOperation = (value, options = {}) => refract(value, {
154
- ...options,
155
- element: 'operation'
156
- });
157
-
158
- /**
159
- * Refracts a value into an ExternalDocumentationElement.
160
- * @public
161
- */
162
- exports.refractOperation = refractOperation;
163
- const refractExternalDocumentation = (value, options = {}) => refract(value, {
164
- ...options,
165
- element: 'externalDocumentation'
166
- });
167
-
168
- /**
169
- * Refracts a value into a ParameterElement.
170
- * @public
171
- */
172
- exports.refractExternalDocumentation = refractExternalDocumentation;
173
- const refractParameter = (value, options = {}) => refract(value, {
174
- ...options,
175
- element: 'parameter'
176
- });
177
-
178
- /**
179
- * Refracts a value into a RequestBodyElement.
180
- * @public
181
- */
182
- exports.refractParameter = refractParameter;
183
- const refractRequestBody = (value, options = {}) => refract(value, {
184
- ...options,
185
- element: 'requestBody'
186
- });
187
-
188
- /**
189
- * Refracts a value into a MediaTypeElement.
190
- * @public
191
- */
192
- exports.refractRequestBody = refractRequestBody;
193
- const refractMediaType = (value, options = {}) => refract(value, {
194
- ...options,
195
- element: 'mediaType'
196
- });
197
-
198
- /**
199
- * Refracts a value into an EncodingElement.
200
- * @public
201
- */
202
- exports.refractMediaType = refractMediaType;
203
- const refractEncoding = (value, options = {}) => refract(value, {
204
- ...options,
205
- element: 'encoding'
206
- });
207
-
208
- /**
209
- * Refracts a value into a ResponsesElement.
210
- * @public
211
- */
212
- exports.refractEncoding = refractEncoding;
213
- const refractResponses = (value, options = {}) => refract(value, {
214
- ...options,
215
- element: 'responses'
216
- });
217
-
218
- /**
219
- * Refracts a value into a ResponseElement.
220
- * @public
221
- */
222
- exports.refractResponses = refractResponses;
223
- const refractResponse = (value, options = {}) => refract(value, {
224
- ...options,
225
- element: 'response'
226
- });
227
-
228
- /**
229
- * Refracts a value into a CallbackElement.
230
- * @public
231
- */
232
- exports.refractResponse = refractResponse;
233
- const refractCallback = (value, options = {}) => refract(value, {
234
- ...options,
235
- element: 'callback'
236
- });
237
-
238
- /**
239
- * Refracts a value into an ExampleElement.
240
- * @public
241
- */
242
- exports.refractCallback = refractCallback;
243
- const refractExample = (value, options = {}) => refract(value, {
244
- ...options,
245
- element: 'example'
246
- });
247
-
248
- /**
249
- * Refracts a value into a LinkElement.
250
- * @public
251
- */
252
- exports.refractExample = refractExample;
253
- const refractLink = (value, options = {}) => refract(value, {
254
- ...options,
255
- element: 'link'
256
- });
257
-
258
- /**
259
- * Refracts a value into a HeaderElement.
260
- * @public
261
- */
262
- exports.refractLink = refractLink;
263
- const refractHeader = (value, options = {}) => refract(value, {
264
- ...options,
265
- element: 'header'
266
- });
267
-
268
- /**
269
- * Refracts a value into a TagElement.
270
- * @public
271
- */
272
- exports.refractHeader = refractHeader;
273
- const refractTag = (value, options = {}) => refract(value, {
274
- ...options,
275
- element: 'tag'
276
- });
277
-
278
- /**
279
- * Refracts a value into a ReferenceElement.
280
- * @public
281
- */
282
- exports.refractTag = refractTag;
283
- const refractReference = (value, options = {}) => refract(value, {
284
- ...options,
285
- element: 'reference'
286
- });
287
-
288
- /**
289
- * Refracts a value into a SchemaElement.
290
- * @public
291
- */
292
- exports.refractReference = refractReference;
293
- const refractSchema = (value, options = {}) => refract(value, {
294
- ...options,
295
- element: 'schema'
296
- });
297
-
298
- /**
299
- * Refracts a value into a DiscriminatorElement.
300
- * @public
301
- */
302
- exports.refractSchema = refractSchema;
303
- const refractDiscriminator = (value, options = {}) => refract(value, {
304
- ...options,
305
- element: 'discriminator'
306
- });
307
-
308
- /**
309
- * Refracts a value into an XmlElement.
310
- * @public
311
- */
312
- exports.refractDiscriminator = refractDiscriminator;
313
- const refractXml = (value, options = {}) => refract(value, {
314
- ...options,
315
- element: 'xml'
316
- });
317
-
318
- /**
319
- * Refracts a value into a SecuritySchemeElement.
320
- * @public
321
- */
322
- exports.refractXml = refractXml;
323
- const refractSecurityScheme = (value, options = {}) => refract(value, {
324
- ...options,
325
- element: 'securityScheme'
326
- });
327
-
328
- /**
329
- * Refracts a value into an OAuthFlowsElement.
330
- * @public
331
- */
332
- exports.refractSecurityScheme = refractSecurityScheme;
333
- const refractOAuthFlows = (value, options = {}) => refract(value, {
334
- ...options,
335
- element: 'oAuthFlows'
336
- });
337
-
338
- /**
339
- * Refracts a value into an OAuthFlowElement.
340
- * @public
341
- */
342
- exports.refractOAuthFlows = refractOAuthFlows;
343
- const refractOAuthFlow = (value, options = {}) => refract(value, {
344
- ...options,
345
- element: 'oAuthFlow'
346
- });
347
-
348
- /**
349
- * Refracts a value into a SecurityRequirementElement.
350
- * @public
351
- */
352
- exports.refractOAuthFlow = refractOAuthFlow;
353
- const refractSecurityRequirement = (value, options = {}) => refract(value, {
354
- ...options,
355
- element: 'securityRequirement'
356
- });
357
-
358
- /**
359
- * Refracts a value into a JsonSchemaDialectElement.
360
- * @public
361
- */
362
- exports.refractSecurityRequirement = refractSecurityRequirement;
363
- const refractJsonSchemaDialect = (value, options = {}) => refract(value, {
364
- ...options,
365
- element: 'jsonSchemaDialect'
366
- });
367
- exports.refractJsonSchemaDialect = refractJsonSchemaDialect;
368
- var _default = exports.default = refract;
@@ -1,330 +0,0 @@
1
- import { resolveSpecification, dispatchRefractorPlugins } from '@speclynx/apidom-core';
2
- import { refract as baseRefract } from '@speclynx/apidom-datamodel';
3
- import { traverse, getNodePrimitiveType } from '@speclynx/apidom-traverse';
4
- import { path } from 'ramda';
5
- import specification from "./specification.mjs";
6
- import createToolbox from "./toolbox.mjs";
7
- /**
8
- * @public
9
- */
10
- /**
11
- * @public
12
- */
13
- /**
14
- * @public
15
- */
16
- const refract = (value, {
17
- element = 'openApi3_1',
18
- plugins = [],
19
- specificationObj = specification,
20
- consume = false
21
- } = {}) => {
22
- const genericElement = baseRefract(value);
23
- const resolvedSpec = resolveSpecification(specificationObj);
24
- const elementMap = resolvedSpec.elementMap;
25
- const specPath = elementMap[element];
26
- if (!specPath) {
27
- throw new Error(`Unknown element type: "${element}"`);
28
- }
29
-
30
- /**
31
- * This is where generic ApiDOM becomes semantic (namespace applied).
32
- * We don't allow consumers to hook into this translation.
33
- * Though we allow consumers to define their own plugins on already transformed ApiDOM.
34
- */
35
- const RootVisitorClass = path(specPath, resolvedSpec);
36
- const rootVisitor = new RootVisitorClass({
37
- specObj: resolvedSpec,
38
- consume
39
- });
40
- traverse(genericElement, rootVisitor, {
41
- nodeTypeGetter: getNodePrimitiveType
42
- });
43
-
44
- /**
45
- * Running plugins visitors means extra single traversal === performance hit.
46
- */
47
- return dispatchRefractorPlugins(rootVisitor.element, plugins, {
48
- toolboxCreator: createToolbox
49
- });
50
- };
51
-
52
- /**
53
- * Refracts a value into an OpenApi3_1Element.
54
- * @public
55
- */
56
- export const refractOpenApi3_1 = (value, options = {}) => refract(value, {
57
- ...options,
58
- element: 'openApi3_1'
59
- });
60
-
61
- /**
62
- * Refracts a value into an InfoElement.
63
- * @public
64
- */
65
- export const refractInfo = (value, options = {}) => refract(value, {
66
- ...options,
67
- element: 'info'
68
- });
69
-
70
- /**
71
- * Refracts a value into a ContactElement.
72
- * @public
73
- */
74
- export const refractContact = (value, options = {}) => refract(value, {
75
- ...options,
76
- element: 'contact'
77
- });
78
-
79
- /**
80
- * Refracts a value into a LicenseElement.
81
- * @public
82
- */
83
- export const refractLicense = (value, options = {}) => refract(value, {
84
- ...options,
85
- element: 'license'
86
- });
87
-
88
- /**
89
- * Refracts a value into a ServerElement.
90
- * @public
91
- */
92
- export const refractServer = (value, options = {}) => refract(value, {
93
- ...options,
94
- element: 'server'
95
- });
96
-
97
- /**
98
- * Refracts a value into a ServerVariableElement.
99
- * @public
100
- */
101
- export const refractServerVariable = (value, options = {}) => refract(value, {
102
- ...options,
103
- element: 'serverVariable'
104
- });
105
-
106
- /**
107
- * Refracts a value into a ComponentsElement.
108
- * @public
109
- */
110
- export const refractComponents = (value, options = {}) => refract(value, {
111
- ...options,
112
- element: 'components'
113
- });
114
-
115
- /**
116
- * Refracts a value into a PathsElement.
117
- * @public
118
- */
119
- export const refractPaths = (value, options = {}) => refract(value, {
120
- ...options,
121
- element: 'paths'
122
- });
123
-
124
- /**
125
- * Refracts a value into a PathItemElement.
126
- * @public
127
- */
128
- export const refractPathItem = (value, options = {}) => refract(value, {
129
- ...options,
130
- element: 'pathItem'
131
- });
132
-
133
- /**
134
- * Refracts a value into an OperationElement.
135
- * @public
136
- */
137
- export const refractOperation = (value, options = {}) => refract(value, {
138
- ...options,
139
- element: 'operation'
140
- });
141
-
142
- /**
143
- * Refracts a value into an ExternalDocumentationElement.
144
- * @public
145
- */
146
- export const refractExternalDocumentation = (value, options = {}) => refract(value, {
147
- ...options,
148
- element: 'externalDocumentation'
149
- });
150
-
151
- /**
152
- * Refracts a value into a ParameterElement.
153
- * @public
154
- */
155
- export const refractParameter = (value, options = {}) => refract(value, {
156
- ...options,
157
- element: 'parameter'
158
- });
159
-
160
- /**
161
- * Refracts a value into a RequestBodyElement.
162
- * @public
163
- */
164
- export const refractRequestBody = (value, options = {}) => refract(value, {
165
- ...options,
166
- element: 'requestBody'
167
- });
168
-
169
- /**
170
- * Refracts a value into a MediaTypeElement.
171
- * @public
172
- */
173
- export const refractMediaType = (value, options = {}) => refract(value, {
174
- ...options,
175
- element: 'mediaType'
176
- });
177
-
178
- /**
179
- * Refracts a value into an EncodingElement.
180
- * @public
181
- */
182
- export const refractEncoding = (value, options = {}) => refract(value, {
183
- ...options,
184
- element: 'encoding'
185
- });
186
-
187
- /**
188
- * Refracts a value into a ResponsesElement.
189
- * @public
190
- */
191
- export const refractResponses = (value, options = {}) => refract(value, {
192
- ...options,
193
- element: 'responses'
194
- });
195
-
196
- /**
197
- * Refracts a value into a ResponseElement.
198
- * @public
199
- */
200
- export const refractResponse = (value, options = {}) => refract(value, {
201
- ...options,
202
- element: 'response'
203
- });
204
-
205
- /**
206
- * Refracts a value into a CallbackElement.
207
- * @public
208
- */
209
- export const refractCallback = (value, options = {}) => refract(value, {
210
- ...options,
211
- element: 'callback'
212
- });
213
-
214
- /**
215
- * Refracts a value into an ExampleElement.
216
- * @public
217
- */
218
- export const refractExample = (value, options = {}) => refract(value, {
219
- ...options,
220
- element: 'example'
221
- });
222
-
223
- /**
224
- * Refracts a value into a LinkElement.
225
- * @public
226
- */
227
- export const refractLink = (value, options = {}) => refract(value, {
228
- ...options,
229
- element: 'link'
230
- });
231
-
232
- /**
233
- * Refracts a value into a HeaderElement.
234
- * @public
235
- */
236
- export const refractHeader = (value, options = {}) => refract(value, {
237
- ...options,
238
- element: 'header'
239
- });
240
-
241
- /**
242
- * Refracts a value into a TagElement.
243
- * @public
244
- */
245
- export const refractTag = (value, options = {}) => refract(value, {
246
- ...options,
247
- element: 'tag'
248
- });
249
-
250
- /**
251
- * Refracts a value into a ReferenceElement.
252
- * @public
253
- */
254
- export const refractReference = (value, options = {}) => refract(value, {
255
- ...options,
256
- element: 'reference'
257
- });
258
-
259
- /**
260
- * Refracts a value into a SchemaElement.
261
- * @public
262
- */
263
- export const refractSchema = (value, options = {}) => refract(value, {
264
- ...options,
265
- element: 'schema'
266
- });
267
-
268
- /**
269
- * Refracts a value into a DiscriminatorElement.
270
- * @public
271
- */
272
- export const refractDiscriminator = (value, options = {}) => refract(value, {
273
- ...options,
274
- element: 'discriminator'
275
- });
276
-
277
- /**
278
- * Refracts a value into an XmlElement.
279
- * @public
280
- */
281
- export const refractXml = (value, options = {}) => refract(value, {
282
- ...options,
283
- element: 'xml'
284
- });
285
-
286
- /**
287
- * Refracts a value into a SecuritySchemeElement.
288
- * @public
289
- */
290
- export const refractSecurityScheme = (value, options = {}) => refract(value, {
291
- ...options,
292
- element: 'securityScheme'
293
- });
294
-
295
- /**
296
- * Refracts a value into an OAuthFlowsElement.
297
- * @public
298
- */
299
- export const refractOAuthFlows = (value, options = {}) => refract(value, {
300
- ...options,
301
- element: 'oAuthFlows'
302
- });
303
-
304
- /**
305
- * Refracts a value into an OAuthFlowElement.
306
- * @public
307
- */
308
- export const refractOAuthFlow = (value, options = {}) => refract(value, {
309
- ...options,
310
- element: 'oAuthFlow'
311
- });
312
-
313
- /**
314
- * Refracts a value into a SecurityRequirementElement.
315
- * @public
316
- */
317
- export const refractSecurityRequirement = (value, options = {}) => refract(value, {
318
- ...options,
319
- element: 'securityRequirement'
320
- });
321
-
322
- /**
323
- * Refracts a value into a JsonSchemaDialectElement.
324
- * @public
325
- */
326
- export const refractJsonSchemaDialect = (value, options = {}) => refract(value, {
327
- ...options,
328
- element: 'jsonSchemaDialect'
329
- });
330
- export default refract;