swagger-client 3.25.2 → 3.25.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.
|
@@ -4388,7 +4388,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4388
4388
|
|
|
4389
4389
|
|
|
4390
4390
|
|
|
4391
|
-
const
|
|
4391
|
+
const PLUGIN_DISPATCH_LIMIT = 100;
|
|
4392
|
+
const TRAVERSE_LIMIT = 1000;
|
|
4392
4393
|
const noop = () => {};
|
|
4393
4394
|
class SpecMap {
|
|
4394
4395
|
static getPluginName(plugin) {
|
|
@@ -4417,7 +4418,8 @@ class SpecMap {
|
|
|
4417
4418
|
libMethods: Object.assign(Object.create(this), _lib_index_js__WEBPACK_IMPORTED_MODULE_0__["default"], {
|
|
4418
4419
|
getInstance: () => this
|
|
4419
4420
|
}),
|
|
4420
|
-
allowMetaPatches: false
|
|
4421
|
+
allowMetaPatches: false,
|
|
4422
|
+
currentTraverseCount: 0
|
|
4421
4423
|
}, opts);
|
|
4422
4424
|
|
|
4423
4425
|
// Lib methods bound
|
|
@@ -4446,6 +4448,7 @@ class SpecMap {
|
|
|
4446
4448
|
const {
|
|
4447
4449
|
pathDiscriminator
|
|
4448
4450
|
} = this;
|
|
4451
|
+
const that = this;
|
|
4449
4452
|
let ctx = null;
|
|
4450
4453
|
let fn;
|
|
4451
4454
|
if (plugin[this.pluginProp]) {
|
|
@@ -4477,9 +4480,14 @@ class SpecMap {
|
|
|
4477
4480
|
|
|
4478
4481
|
// eslint-disable-next-line no-restricted-syntax
|
|
4479
4482
|
for (const patch of patches.filter(_lib_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].isAdditiveMutation)) {
|
|
4480
|
-
|
|
4483
|
+
if (that.currentTraverseCount < TRAVERSE_LIMIT) {
|
|
4484
|
+
yield* traverse(patch.value, patch.path, patch);
|
|
4485
|
+
} else {
|
|
4486
|
+
return;
|
|
4487
|
+
}
|
|
4481
4488
|
}
|
|
4482
4489
|
function* traverse(obj, path, patch) {
|
|
4490
|
+
that.currentTraverseCount += 1;
|
|
4483
4491
|
if (!_lib_index_js__WEBPACK_IMPORTED_MODULE_0__["default"].isObject(obj)) {
|
|
4484
4492
|
if (pluginObj.key === path[path.length - 1]) {
|
|
4485
4493
|
yield pluginObj.plugin(obj, pluginObj.key, path, specmap);
|
|
@@ -4503,7 +4511,11 @@ class SpecMap {
|
|
|
4503
4511
|
if (specmap.allowMetaPatches && objRef) {
|
|
4504
4512
|
refCache[objRef] = true;
|
|
4505
4513
|
}
|
|
4506
|
-
|
|
4514
|
+
if (that.currentTraverseCount < TRAVERSE_LIMIT) {
|
|
4515
|
+
yield* traverse(val, updatedPath, patch);
|
|
4516
|
+
} else {
|
|
4517
|
+
return;
|
|
4518
|
+
}
|
|
4507
4519
|
}
|
|
4508
4520
|
}
|
|
4509
4521
|
if (!isRootProperties && key === pluginObj.key) {
|
|
@@ -4661,6 +4673,7 @@ class SpecMap {
|
|
|
4661
4673
|
dispatch() {
|
|
4662
4674
|
const that = this;
|
|
4663
4675
|
const plugin = this.nextPlugin();
|
|
4676
|
+
that.currentTraverseCount = 0;
|
|
4664
4677
|
if (!plugin) {
|
|
4665
4678
|
const nextPromise = this.nextPromisedPatch();
|
|
4666
4679
|
if (nextPromise) {
|
|
@@ -4679,12 +4692,12 @@ class SpecMap {
|
|
|
4679
4692
|
}
|
|
4680
4693
|
|
|
4681
4694
|
// Makes sure plugin isn't running an endless loop
|
|
4682
|
-
that.pluginCount = that.pluginCount ||
|
|
4683
|
-
that.pluginCount
|
|
4684
|
-
if (that.pluginCount[plugin] >
|
|
4695
|
+
that.pluginCount = that.pluginCount || new WeakMap();
|
|
4696
|
+
that.pluginCount.set(plugin, (that.pluginCount.get(plugin) || 0) + 1);
|
|
4697
|
+
if (that.pluginCount[plugin] > PLUGIN_DISPATCH_LIMIT) {
|
|
4685
4698
|
return Promise.resolve({
|
|
4686
4699
|
spec: that.state,
|
|
4687
|
-
errors: that.errors.concat(new Error(`We've reached a hard limit of ${
|
|
4700
|
+
errors: that.errors.concat(new Error(`We've reached a hard limit of ${PLUGIN_DISPATCH_LIMIT} plugin runs`))
|
|
4688
4701
|
});
|
|
4689
4702
|
}
|
|
4690
4703
|
|