swagger-client 3.10.13 → 3.12.1
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.
- package/dist/swagger-client.browser.js +13756 -9367
- package/dist/swagger-client.browser.min.js +1 -1
- package/dist/swagger-client.browser.min.js.map +1 -1
- package/es/execute/index.js +53 -26
- package/es/execute/oas3/build-request.js +23 -11
- package/es/execute/oas3/content-serializer.js +3 -2
- package/es/execute/oas3/parameter-builders.js +9 -5
- package/es/execute/oas3/style-serializer.js +62 -30
- package/es/execute/swagger2/build-request.js +25 -11
- package/es/execute/swagger2/parameter-builders.js +4 -1
- package/es/helpers.js +27 -10
- package/es/http.js +97 -63
- package/es/index.js +3 -2
- package/es/interfaces.js +13 -6
- package/es/internal/form-data-monkey-patch.js +24 -11
- package/es/resolver.js +2 -2
- package/es/specmap/helpers.js +25 -10
- package/es/specmap/index.js +88 -61
- package/es/specmap/lib/all-of.js +28 -10
- package/es/specmap/lib/context-tree.js +13 -6
- package/es/specmap/lib/index.js +39 -27
- package/es/specmap/lib/parameters.js +8 -5
- package/es/specmap/lib/properties.js +1 -1
- package/es/specmap/lib/refs.js +103 -26
- package/es/subtree-resolver/index.js +4 -4
- package/lib/execute/oas3/build-request.js +1 -1
- package/lib/specmap/helpers.js +3 -1
- package/lib/specmap/lib/all-of.js +10 -1
- package/lib/specmap/lib/refs.js +18 -5
- package/package.json +26 -28
package/es/specmap/helpers.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime-
|
|
2
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
2
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
5
|
+
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
6
|
+
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
7
|
+
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
3
8
|
import traverse from 'traverse';
|
|
4
|
-
import URL from 'url';
|
|
9
|
+
import URL from 'url';
|
|
10
|
+
import isString from 'lodash/isString'; // This will match if the direct parent's key exactly matches an item.
|
|
5
11
|
|
|
6
12
|
var freelyNamedKeyParents = ['properties']; // This will match if the grandparent's key exactly matches an item.
|
|
7
13
|
// NOTE that this is for finding non-free paths!
|
|
@@ -24,39 +30,48 @@ export function isFreelyNamed(parentPath) {
|
|
|
24
30
|
var grandparentKey = parentPath[parentPath.length - 2];
|
|
25
31
|
var parentStr = parentPath.join('/');
|
|
26
32
|
return (// eslint-disable-next-line max-len
|
|
27
|
-
freelyNamedKeyParents.
|
|
28
|
-
return parentStr.
|
|
33
|
+
_indexOfInstanceProperty(freelyNamedKeyParents).call(freelyNamedKeyParents, parentKey) > -1 && _indexOfInstanceProperty(nonFreelyNamedKeyGrandparents).call(nonFreelyNamedKeyGrandparents, grandparentKey) === -1 || _indexOfInstanceProperty(freelyNamedPaths).call(freelyNamedPaths, parentStr) > -1 || _someInstanceProperty(freelyNamedAncestors).call(freelyNamedAncestors, function (el) {
|
|
34
|
+
return _indexOfInstanceProperty(parentStr).call(parentStr, el) > -1;
|
|
29
35
|
})
|
|
30
36
|
);
|
|
31
37
|
}
|
|
32
38
|
export function generateAbsoluteRefPatches(obj, basePath) {
|
|
39
|
+
var _context2;
|
|
40
|
+
|
|
33
41
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
34
42
|
specmap = _ref.specmap,
|
|
35
43
|
_ref$getBaseUrlForNod = _ref.getBaseUrlForNodePath,
|
|
36
44
|
getBaseUrlForNodePath = _ref$getBaseUrlForNod === void 0 ? function (path) {
|
|
37
|
-
|
|
45
|
+
var _context;
|
|
46
|
+
|
|
47
|
+
return specmap.getContext(_concatInstanceProperty(_context = []).call(_context, _toConsumableArray(basePath), _toConsumableArray(path))).baseDoc;
|
|
38
48
|
} : _ref$getBaseUrlForNod,
|
|
39
49
|
_ref$targetKeys = _ref.targetKeys,
|
|
40
50
|
targetKeys = _ref$targetKeys === void 0 ? ['$ref', '$$ref'] : _ref$targetKeys;
|
|
41
51
|
|
|
42
52
|
var patches = [];
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
|
|
54
|
+
_forEachInstanceProperty(_context2 = traverse(obj)).call(_context2, function callback() {
|
|
55
|
+
if (_includesInstanceProperty(targetKeys).call(targetKeys, this.key) && isString(this.node)) {
|
|
45
56
|
var nodePath = this.path; // this node's path, relative to `obj`
|
|
46
57
|
|
|
47
|
-
var fullPath = basePath.
|
|
58
|
+
var fullPath = _concatInstanceProperty(basePath).call(basePath, this.path);
|
|
59
|
+
|
|
48
60
|
var absolutifiedRefValue = absolutifyPointer(this.node, getBaseUrlForNodePath(nodePath));
|
|
49
61
|
patches.push(specmap.replace(fullPath, absolutifiedRefValue));
|
|
50
62
|
}
|
|
51
63
|
});
|
|
64
|
+
|
|
52
65
|
return patches;
|
|
53
66
|
}
|
|
54
67
|
export function absolutifyPointer(pointer, baseUrl) {
|
|
68
|
+
var _context3;
|
|
69
|
+
|
|
55
70
|
var _pointer$split = pointer.split('#'),
|
|
56
71
|
_pointer$split2 = _slicedToArray(_pointer$split, 2),
|
|
57
72
|
urlPart = _pointer$split2[0],
|
|
58
73
|
fragmentPart = _pointer$split2[1];
|
|
59
74
|
|
|
60
75
|
var newRefUrlPart = URL.resolve(urlPart || '', baseUrl || '');
|
|
61
|
-
return fragmentPart ? "".concat(newRefUrlPart, "#").
|
|
76
|
+
return fragmentPart ? _concatInstanceProperty(_context3 = "".concat(newRefUrlPart, "#")).call(_context3, fragmentPart) : newRefUrlPart;
|
|
62
77
|
}
|
package/es/specmap/index.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import _Object$
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
1
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
2
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
3
|
+
import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
|
|
4
|
+
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
6
|
+
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
8
|
+
import _Object$keys2 from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
9
|
+
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
10
|
+
import _createForOfIteratorHelper from "@babel/runtime-corejs3/helpers/createForOfIteratorHelper";
|
|
11
|
+
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
12
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
13
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
14
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
15
|
+
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
16
|
+
import _Object$create from "@babel/runtime-corejs3/core-js-stable/object/create";
|
|
17
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
18
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
19
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
20
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
12
21
|
import find from 'lodash/find';
|
|
13
22
|
import noop from 'lodash/noop';
|
|
14
23
|
import lib from './lib';
|
|
@@ -28,12 +37,18 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
28
37
|
}, {
|
|
29
38
|
key: "getPatchesOfType",
|
|
30
39
|
value: function getPatchesOfType(patches, fn) {
|
|
31
|
-
return patches.
|
|
40
|
+
return _filterInstanceProperty(patches).call(patches, fn);
|
|
32
41
|
}
|
|
33
42
|
}]);
|
|
34
43
|
|
|
35
44
|
function SpecMap(opts) {
|
|
36
|
-
var _this = this
|
|
45
|
+
var _this = this,
|
|
46
|
+
_context,
|
|
47
|
+
_context2,
|
|
48
|
+
_context3,
|
|
49
|
+
_context4,
|
|
50
|
+
_context5,
|
|
51
|
+
_context6;
|
|
37
52
|
|
|
38
53
|
_classCallCheck(this, SpecMap);
|
|
39
54
|
|
|
@@ -62,13 +77,13 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
62
77
|
}, opts); // Lib methods bound
|
|
63
78
|
|
|
64
79
|
|
|
65
|
-
this.get = this._get.
|
|
80
|
+
this.get = _bindInstanceProperty(_context = this._get).call(_context, this); // eslint-disable-line no-underscore-dangle
|
|
66
81
|
|
|
67
|
-
this.getContext = this._getContext.
|
|
82
|
+
this.getContext = _bindInstanceProperty(_context2 = this._getContext).call(_context2, this); // eslint-disable-line no-underscore-dangle
|
|
68
83
|
|
|
69
|
-
this.hasRun = this._hasRun.
|
|
84
|
+
this.hasRun = _bindInstanceProperty(_context3 = this._hasRun).call(_context3, this); // eslint-disable-line no-underscore-dangle
|
|
70
85
|
|
|
71
|
-
this.wrappedPlugins = this.plugins.
|
|
86
|
+
this.wrappedPlugins = _filterInstanceProperty(_context4 = _mapInstanceProperty(_context5 = this.plugins).call(_context5, _bindInstanceProperty(_context6 = this.wrapPlugin).call(_context6, this))).call(_context4, lib.isFunction); // Initial patch(s)
|
|
72
87
|
|
|
73
88
|
this.patches.push(lib.add([], this.spec));
|
|
74
89
|
this.patches.push(lib.context([], this.context));
|
|
@@ -93,13 +108,13 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
93
108
|
key: "verbose",
|
|
94
109
|
value: function verbose(header) {
|
|
95
110
|
if (this.debugLevel === 'verbose') {
|
|
96
|
-
var _console2;
|
|
111
|
+
var _console2, _context7;
|
|
97
112
|
|
|
98
113
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
99
114
|
args[_key2 - 1] = arguments[_key2];
|
|
100
115
|
}
|
|
101
116
|
|
|
102
|
-
(_console2 = console).log.apply(_console2, ["[".concat(header, "] ")].
|
|
117
|
+
(_console2 = console).log.apply(_console2, _concatInstanceProperty(_context7 = ["[".concat(header, "] ")]).call(_context7, args)); // eslint-disable-line no-console
|
|
103
118
|
|
|
104
119
|
}
|
|
105
120
|
}
|
|
@@ -119,7 +134,7 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
119
134
|
fn = createKeyBasedPlugin(plugin);
|
|
120
135
|
}
|
|
121
136
|
|
|
122
|
-
return _Object$assign(fn.
|
|
137
|
+
return _Object$assign(_bindInstanceProperty(fn).call(fn, ctx), {
|
|
123
138
|
pluginName: plugin.name || name,
|
|
124
139
|
isGenerator: lib.isGenerator(fn)
|
|
125
140
|
}); // Expected plugin interface: {key: string, plugin: fn*}
|
|
@@ -133,7 +148,7 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
133
148
|
return true;
|
|
134
149
|
}
|
|
135
150
|
|
|
136
|
-
return path.
|
|
151
|
+
return _everyInstanceProperty(path).call(path, function (val, i) {
|
|
137
152
|
return val === tested[i];
|
|
138
153
|
});
|
|
139
154
|
};
|
|
@@ -141,38 +156,38 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
141
156
|
return /*#__PURE__*/_regeneratorRuntime.mark(function generator(patches, specmap) {
|
|
142
157
|
var _marked, refCache, _iterator, _step, patch, traverse;
|
|
143
158
|
|
|
144
|
-
return _regeneratorRuntime.wrap(function generator$(
|
|
159
|
+
return _regeneratorRuntime.wrap(function generator$(_context9) {
|
|
145
160
|
while (1) {
|
|
146
|
-
switch (
|
|
161
|
+
switch (_context9.prev = _context9.next) {
|
|
147
162
|
case 0:
|
|
148
163
|
traverse = function _traverse(obj, path, patch) {
|
|
149
164
|
var parentIndex, parent, indexOfFirstProperties, isRootProperties, traversed, _i, _Object$keys, key, val, updatedPath, isObj, objRef, isWithinPathDiscriminator;
|
|
150
165
|
|
|
151
|
-
return _regeneratorRuntime.wrap(function traverse$(
|
|
166
|
+
return _regeneratorRuntime.wrap(function traverse$(_context8) {
|
|
152
167
|
while (1) {
|
|
153
|
-
switch (
|
|
168
|
+
switch (_context8.prev = _context8.next) {
|
|
154
169
|
case 0:
|
|
155
170
|
if (lib.isObject(obj)) {
|
|
156
|
-
|
|
171
|
+
_context8.next = 6;
|
|
157
172
|
break;
|
|
158
173
|
}
|
|
159
174
|
|
|
160
175
|
if (!(pluginObj.key === path[path.length - 1])) {
|
|
161
|
-
|
|
176
|
+
_context8.next = 4;
|
|
162
177
|
break;
|
|
163
178
|
}
|
|
164
179
|
|
|
165
|
-
|
|
180
|
+
_context8.next = 4;
|
|
166
181
|
return pluginObj.plugin(obj, pluginObj.key, path, specmap);
|
|
167
182
|
|
|
168
183
|
case 4:
|
|
169
|
-
|
|
184
|
+
_context8.next = 30;
|
|
170
185
|
break;
|
|
171
186
|
|
|
172
187
|
case 6:
|
|
173
188
|
parentIndex = path.length - 1;
|
|
174
189
|
parent = path[parentIndex];
|
|
175
|
-
indexOfFirstProperties = path.
|
|
190
|
+
indexOfFirstProperties = _indexOfInstanceProperty(path).call(path, 'properties');
|
|
176
191
|
isRootProperties = parent === 'properties' && parentIndex === indexOfFirstProperties;
|
|
177
192
|
traversed = specmap.allowMetaPatches && refCache[obj.$$ref]; // eslint-disable-next-line no-restricted-syntax
|
|
178
193
|
|
|
@@ -180,23 +195,23 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
180
195
|
|
|
181
196
|
case 12:
|
|
182
197
|
if (!(_i < _Object$keys.length)) {
|
|
183
|
-
|
|
198
|
+
_context8.next = 30;
|
|
184
199
|
break;
|
|
185
200
|
}
|
|
186
201
|
|
|
187
202
|
key = _Object$keys[_i];
|
|
188
203
|
val = obj[key];
|
|
189
|
-
updatedPath = path.
|
|
204
|
+
updatedPath = _concatInstanceProperty(path).call(path, key);
|
|
190
205
|
isObj = lib.isObject(val);
|
|
191
206
|
objRef = obj.$$ref;
|
|
192
207
|
|
|
193
208
|
if (traversed) {
|
|
194
|
-
|
|
209
|
+
_context8.next = 22;
|
|
195
210
|
break;
|
|
196
211
|
}
|
|
197
212
|
|
|
198
213
|
if (!isObj) {
|
|
199
|
-
|
|
214
|
+
_context8.next = 22;
|
|
200
215
|
break;
|
|
201
216
|
}
|
|
202
217
|
|
|
@@ -205,32 +220,32 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
205
220
|
refCache[objRef] = true;
|
|
206
221
|
}
|
|
207
222
|
|
|
208
|
-
return
|
|
223
|
+
return _context8.delegateYield(traverse(val, updatedPath, patch), "t0", 22);
|
|
209
224
|
|
|
210
225
|
case 22:
|
|
211
226
|
if (!(!isRootProperties && key === pluginObj.key)) {
|
|
212
|
-
|
|
227
|
+
_context8.next = 27;
|
|
213
228
|
break;
|
|
214
229
|
}
|
|
215
230
|
|
|
216
231
|
isWithinPathDiscriminator = isSubPath(pathDiscriminator, path);
|
|
217
232
|
|
|
218
233
|
if (!(!pathDiscriminator || isWithinPathDiscriminator)) {
|
|
219
|
-
|
|
234
|
+
_context8.next = 27;
|
|
220
235
|
break;
|
|
221
236
|
}
|
|
222
237
|
|
|
223
|
-
|
|
238
|
+
_context8.next = 27;
|
|
224
239
|
return pluginObj.plugin(val, key, updatedPath, specmap, patch);
|
|
225
240
|
|
|
226
241
|
case 27:
|
|
227
242
|
_i++;
|
|
228
|
-
|
|
243
|
+
_context8.next = 12;
|
|
229
244
|
break;
|
|
230
245
|
|
|
231
246
|
case 30:
|
|
232
247
|
case "end":
|
|
233
|
-
return
|
|
248
|
+
return _context8.stop();
|
|
234
249
|
}
|
|
235
250
|
}
|
|
236
251
|
}, _marked);
|
|
@@ -239,44 +254,44 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
239
254
|
_marked = /*#__PURE__*/_regeneratorRuntime.mark(traverse);
|
|
240
255
|
refCache = {}; // eslint-disable-next-line no-restricted-syntax
|
|
241
256
|
|
|
242
|
-
_iterator = _createForOfIteratorHelper(patches.
|
|
243
|
-
|
|
257
|
+
_iterator = _createForOfIteratorHelper(_filterInstanceProperty(patches).call(patches, lib.isAdditiveMutation));
|
|
258
|
+
_context9.prev = 4;
|
|
244
259
|
|
|
245
260
|
_iterator.s();
|
|
246
261
|
|
|
247
262
|
case 6:
|
|
248
263
|
if ((_step = _iterator.n()).done) {
|
|
249
|
-
|
|
264
|
+
_context9.next = 11;
|
|
250
265
|
break;
|
|
251
266
|
}
|
|
252
267
|
|
|
253
268
|
patch = _step.value;
|
|
254
|
-
return
|
|
269
|
+
return _context9.delegateYield(traverse(patch.value, patch.path, patch), "t0", 9);
|
|
255
270
|
|
|
256
271
|
case 9:
|
|
257
|
-
|
|
272
|
+
_context9.next = 6;
|
|
258
273
|
break;
|
|
259
274
|
|
|
260
275
|
case 11:
|
|
261
|
-
|
|
276
|
+
_context9.next = 16;
|
|
262
277
|
break;
|
|
263
278
|
|
|
264
279
|
case 13:
|
|
265
|
-
|
|
266
|
-
|
|
280
|
+
_context9.prev = 13;
|
|
281
|
+
_context9.t1 = _context9["catch"](4);
|
|
267
282
|
|
|
268
|
-
_iterator.e(
|
|
283
|
+
_iterator.e(_context9.t1);
|
|
269
284
|
|
|
270
285
|
case 16:
|
|
271
|
-
|
|
286
|
+
_context9.prev = 16;
|
|
272
287
|
|
|
273
288
|
_iterator.f();
|
|
274
289
|
|
|
275
|
-
return
|
|
290
|
+
return _context9.finish(16);
|
|
276
291
|
|
|
277
292
|
case 19:
|
|
278
293
|
case "end":
|
|
279
|
-
return
|
|
294
|
+
return _context9.stop();
|
|
280
295
|
}
|
|
281
296
|
}
|
|
282
297
|
}, generator, null, [[4, 13, 16, 19]]);
|
|
@@ -299,7 +314,9 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
299
314
|
key: "nextPromisedPatch",
|
|
300
315
|
value: function nextPromisedPatch() {
|
|
301
316
|
if (this.promisedPatches.length > 0) {
|
|
302
|
-
|
|
317
|
+
var _context10;
|
|
318
|
+
|
|
319
|
+
return _Promise.race(_mapInstanceProperty(_context10 = this.promisedPatches).call(_context10, function (patch) {
|
|
303
320
|
return patch.value;
|
|
304
321
|
}));
|
|
305
322
|
}
|
|
@@ -340,9 +357,10 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
340
357
|
}, {
|
|
341
358
|
key: "updatePatches",
|
|
342
359
|
value: function updatePatches(patches) {
|
|
343
|
-
var
|
|
360
|
+
var _context11,
|
|
361
|
+
_this3 = this;
|
|
344
362
|
|
|
345
|
-
lib.normalizeArray(patches).
|
|
363
|
+
_forEachInstanceProperty(_context11 = lib.normalizeArray(patches)).call(_context11, function (patch) {
|
|
346
364
|
if (patch instanceof Error) {
|
|
347
365
|
_this3.errors.push(patch);
|
|
348
366
|
|
|
@@ -405,14 +423,16 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
405
423
|
}, {
|
|
406
424
|
key: "removePromisedPatch",
|
|
407
425
|
value: function removePromisedPatch(patch) {
|
|
408
|
-
var
|
|
426
|
+
var _context12, _context13;
|
|
427
|
+
|
|
428
|
+
var index = _indexOfInstanceProperty(_context12 = this.promisedPatches).call(_context12, patch);
|
|
409
429
|
|
|
410
430
|
if (index < 0) {
|
|
411
431
|
this.debug("Tried to remove a promisedPatch that isn't there!");
|
|
412
432
|
return;
|
|
413
433
|
}
|
|
414
434
|
|
|
415
|
-
this.promisedPatches.
|
|
435
|
+
_spliceInstanceProperty(_context13 = this.promisedPatches).call(_context13, index, 1);
|
|
416
436
|
}
|
|
417
437
|
}, {
|
|
418
438
|
key: "promisedPatchThen",
|
|
@@ -437,13 +457,15 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
437
457
|
}, {
|
|
438
458
|
key: "getMutations",
|
|
439
459
|
value: function getMutations(from, to) {
|
|
460
|
+
var _context14;
|
|
461
|
+
|
|
440
462
|
from = from || 0;
|
|
441
463
|
|
|
442
464
|
if (typeof to !== 'number') {
|
|
443
465
|
to = this.mutations.length;
|
|
444
466
|
}
|
|
445
467
|
|
|
446
|
-
return this.mutations.
|
|
468
|
+
return _sliceInstanceProperty(_context14 = this.mutations).call(_context14, from, to);
|
|
447
469
|
}
|
|
448
470
|
}, {
|
|
449
471
|
key: "getCurrentMutations",
|
|
@@ -527,19 +549,24 @@ var SpecMap = /*#__PURE__*/function () {
|
|
|
527
549
|
that.pluginCount[plugin] = (that.pluginCount[plugin] || 0) + 1;
|
|
528
550
|
|
|
529
551
|
if (that.pluginCount[plugin] > HARD_LIMIT) {
|
|
552
|
+
var _context15;
|
|
553
|
+
|
|
530
554
|
return _Promise.resolve({
|
|
531
555
|
spec: that.state,
|
|
532
|
-
errors: that.errors.
|
|
556
|
+
errors: _concatInstanceProperty(_context15 = that.errors).call(_context15, new Error("We've reached a hard limit of ".concat(HARD_LIMIT, " plugin runs")))
|
|
533
557
|
});
|
|
534
558
|
} // A different plugin runs, wait for all promises to resolve, then retry
|
|
535
559
|
|
|
536
560
|
|
|
537
561
|
if (plugin !== this.currentPlugin && this.promisedPatches.length) {
|
|
538
|
-
var
|
|
562
|
+
var _context16;
|
|
563
|
+
|
|
564
|
+
var promises = _mapInstanceProperty(_context16 = this.promisedPatches).call(_context16, function (p) {
|
|
539
565
|
return p.value;
|
|
540
566
|
}); // Waits for all to settle instead of Promise.all which stops on rejection
|
|
541
567
|
|
|
542
|
-
|
|
568
|
+
|
|
569
|
+
return _Promise.all(_mapInstanceProperty(promises).call(promises, function (promise) {
|
|
543
570
|
return promise.then(noop, noop);
|
|
544
571
|
})).then(function () {
|
|
545
572
|
return _this5.dispatch();
|
package/es/specmap/lib/all-of.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
3
|
+
import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
|
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
5
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
6
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
7
|
+
import isEmpty from 'lodash/isEmpty';
|
|
4
8
|
import { isFreelyNamed, generateAbsoluteRefPatches } from '../helpers';
|
|
5
9
|
export default {
|
|
6
10
|
key: 'allOf',
|
|
@@ -12,7 +16,7 @@ export default {
|
|
|
12
16
|
return undefined;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
var parent = fullPath.
|
|
19
|
+
var parent = _sliceInstanceProperty(fullPath).call(fullPath, 0, -1);
|
|
16
20
|
|
|
17
21
|
if (isFreelyNamed(parent)) {
|
|
18
22
|
return undefined;
|
|
@@ -29,17 +33,25 @@ export default {
|
|
|
29
33
|
// Remove the `allOf` property so it doesn't get added to the result of the `allOf` plugin
|
|
30
34
|
|
|
31
35
|
var originalDefinitionObj = patch.value;
|
|
32
|
-
|
|
36
|
+
|
|
37
|
+
_forEachInstanceProperty(parent).call(parent, function (part) {
|
|
33
38
|
if (!originalDefinitionObj) return; // bail out if we've lost sight of our target
|
|
34
39
|
|
|
35
40
|
originalDefinitionObj = originalDefinitionObj[part];
|
|
36
41
|
});
|
|
37
|
-
|
|
42
|
+
|
|
43
|
+
originalDefinitionObj = _objectSpread({}, originalDefinitionObj); // when we've lost sight, interrupt prematurely
|
|
44
|
+
|
|
45
|
+
if (isEmpty(originalDefinitionObj)) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
delete originalDefinitionObj.allOf;
|
|
39
50
|
var patches = []; // remove existing content
|
|
40
51
|
|
|
41
52
|
patches.push(specmap.replace(parent, {}));
|
|
42
|
-
|
|
53
|
+
|
|
54
|
+
_forEachInstanceProperty(val).call(val, function (toMerge, i) {
|
|
43
55
|
if (!specmap.isObject(toMerge)) {
|
|
44
56
|
if (alreadyAddError) {
|
|
45
57
|
return null;
|
|
@@ -58,10 +70,13 @@ export default {
|
|
|
58
70
|
patches.push(specmap.mergeDeep(parent, toMerge)); // Generate patches that migrate $ref values based on ContextTree information
|
|
59
71
|
// remove ["allOf"], which will not be present when these patches are applied
|
|
60
72
|
|
|
61
|
-
var collapsedFullPath = fullPath.
|
|
73
|
+
var collapsedFullPath = _sliceInstanceProperty(fullPath).call(fullPath, 0, -1);
|
|
74
|
+
|
|
62
75
|
var absoluteRefPatches = generateAbsoluteRefPatches(toMerge, collapsedFullPath, {
|
|
63
76
|
getBaseUrlForNodePath: function getBaseUrlForNodePath(nodePath) {
|
|
64
|
-
|
|
77
|
+
var _context;
|
|
78
|
+
|
|
79
|
+
return specmap.getContext(_concatInstanceProperty(_context = []).call(_context, _toConsumableArray(fullPath), [i], _toConsumableArray(nodePath))).baseDoc;
|
|
65
80
|
},
|
|
66
81
|
specmap: specmap
|
|
67
82
|
});
|
|
@@ -69,11 +84,14 @@ export default {
|
|
|
69
84
|
return undefined;
|
|
70
85
|
}); // Merge back the values from the original definition
|
|
71
86
|
|
|
87
|
+
|
|
72
88
|
patches.push(specmap.mergeDeep(parent, originalDefinitionObj)); // If there was not an original $$ref value, make sure to remove
|
|
73
89
|
// any $$ref value that may exist from the result of `allOf` merges
|
|
74
90
|
|
|
75
91
|
if (!originalDefinitionObj.$$ref) {
|
|
76
|
-
|
|
92
|
+
var _context2;
|
|
93
|
+
|
|
94
|
+
patches.push(specmap.remove(_concatInstanceProperty(_context2 = []).call(_context2, parent, '$$ref')));
|
|
77
95
|
}
|
|
78
96
|
|
|
79
97
|
return patches;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import _Object$keys from "@babel/runtime-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
2
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
|
+
import _objectSpread from "@babel/runtime-corejs3/helpers/objectSpread2";
|
|
4
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
5
|
+
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
6
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
7
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
5
8
|
|
|
6
9
|
var ContextTree = /*#__PURE__*/function () {
|
|
7
10
|
function ContextTree(value) {
|
|
@@ -60,6 +63,8 @@ var ContextTree = /*#__PURE__*/function () {
|
|
|
60
63
|
}, {
|
|
61
64
|
key: "getParent",
|
|
62
65
|
value: function getParent(path, ensureExists) {
|
|
66
|
+
var _context;
|
|
67
|
+
|
|
63
68
|
if (!path || path.length < 1) {
|
|
64
69
|
return null;
|
|
65
70
|
}
|
|
@@ -68,7 +73,7 @@ var ContextTree = /*#__PURE__*/function () {
|
|
|
68
73
|
return this.root;
|
|
69
74
|
}
|
|
70
75
|
|
|
71
|
-
return path.
|
|
76
|
+
return _reduceInstanceProperty(_context = _sliceInstanceProperty(path).call(path, 0, -1)).call(_context, function (branch, token) {
|
|
72
77
|
if (!branch) {
|
|
73
78
|
return branch;
|
|
74
79
|
}
|
|
@@ -99,10 +104,12 @@ function createNode(value, parent) {
|
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
function updateNode(node, value, parent) {
|
|
107
|
+
var _context2;
|
|
108
|
+
|
|
102
109
|
node.value = value || {};
|
|
103
110
|
node.protoValue = parent ? _objectSpread(_objectSpread({}, parent.protoValue), node.value) : node.value;
|
|
104
111
|
|
|
105
|
-
_Object$keys(node.children).
|
|
112
|
+
_forEachInstanceProperty(_context2 = _Object$keys(node.children)).call(_context2, function (prop) {
|
|
106
113
|
var child = node.children[prop];
|
|
107
114
|
node.children[prop] = updateNode(child, child.value, node);
|
|
108
115
|
});
|