@mapcreator/api 3.3.1 → 3.3.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.
@@ -29,11 +29,11 @@
29
29
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
30
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
31
  *
32
- * hash:3e335130ac54b76fcfe7, chunkhash:21bfda8bbd411c86f2b3, name:bundle.browser, version:v3.3.1
32
+ * hash:2c872c83a5ec4b8f813c, chunkhash:9a7189100c245ed16f72, name:bundle.browser, version:b8d270c
33
33
  */
34
34
  /*!
35
35
  * This bundle contains the following packages:
36
- * └─ @mapcreator/api (3.3.1) ── BSD 3-clause "New" or "Revised" License (http://www.opensource.org/licenses/BSD-3-Clause) ── package.json
36
+ * └─ @mapcreator/api (3.3.3) ── BSD 3-clause "New" or "Revised" License (http://www.opensource.org/licenses/BSD-3-Clause) ── package.json
37
37
  * ├─ @babel/runtime (7.10.2) ── MIT License (http://www.opensource.org/licenses/MIT) ── node_modules/@babel/runtime/package.json
38
38
  * │ └─ regenerator-runtime (0.13.5) ── MIT License (http://www.opensource.org/licenses/MIT) ── node_modules/@babel/runtime ~ regenerator-runtime/package.json
39
39
  * ├─ case (1.6.3) ── mit or gpl 3.0 or later ── node_modules/case/package.json
@@ -665,7 +665,7 @@ __webpack_require__.r(__webpack_exports__);
665
665
  /* harmony export */ });
666
666
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
667
667
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(case__WEBPACK_IMPORTED_MODULE_0__);
668
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21);
668
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
669
669
  /* harmony import */ var _Mapcreator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
670
670
  /* harmony import */ var _proxy_SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15);
671
671
  /* harmony import */ var _traits_Injectable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(65);
@@ -2545,7 +2545,7 @@ __webpack_require__.r(__webpack_exports__);
2545
2545
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2546
2546
  /* harmony export */ "default": () => (/* binding */ CrudSetItemBase)
2547
2547
  /* harmony export */ });
2548
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
2548
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
2549
2549
  /* harmony import */ var _CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
2550
2550
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
2551
2551
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(case__WEBPACK_IMPORTED_MODULE_2__);
@@ -2859,7 +2859,7 @@ __webpack_require__.r(__webpack_exports__);
2859
2859
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2860
2860
  /* harmony export */ "default": () => (/* binding */ OAuthToken)
2861
2861
  /* harmony export */ });
2862
- /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
2862
+ /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
2863
2863
  /* harmony import */ var _utils_requests__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
2864
2864
  /*
2865
2865
  * BSD 3-Clause License
@@ -3714,7 +3714,7 @@ __webpack_require__.r(__webpack_exports__);
3714
3714
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3715
3715
  /* harmony export */ "default": () => (/* binding */ CrudSetBase)
3716
3716
  /* harmony export */ });
3717
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
3717
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
3718
3718
  /* harmony import */ var _CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
3719
3719
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
3720
3720
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(case__WEBPACK_IMPORTED_MODULE_2__);
@@ -4806,8 +4806,8 @@ __webpack_require__.r(__webpack_exports__);
4806
4806
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12);
4807
4807
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
4808
4808
  /* harmony import */ var ky_universal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31);
4809
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21);
4810
- /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22);
4809
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22);
4810
+ /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20);
4811
4811
  /* harmony import */ var _OAuthToken__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13);
4812
4812
  /* harmony import */ var _StateContainer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(42);
4813
4813
  /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1);
@@ -4953,258 +4953,6 @@ class OAuth {
4953
4953
  /* 20 */
4954
4954
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4955
4955
 
4956
- "use strict";
4957
- __webpack_require__.r(__webpack_exports__);
4958
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4959
- /* harmony export */ "default": () => (/* binding */ OwnedResourceProxy)
4960
- /* harmony export */ });
4961
- /* harmony import */ var _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
4962
- /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
4963
- /*
4964
- * BSD 3-Clause License
4965
- *
4966
- * Copyright (c) 2020, Mapcreator
4967
- * All rights reserved.
4968
- *
4969
- * Redistribution and use in source and binary forms, with or without
4970
- * modification, are permitted provided that the following conditions are met:
4971
- *
4972
- * Redistributions of source code must retain the above copyright notice, this
4973
- * list of conditions and the following disclaimer.
4974
- *
4975
- * Redistributions in binary form must reproduce the above copyright notice,
4976
- * this list of conditions and the following disclaimer in the documentation
4977
- * and/or other materials provided with the distribution.
4978
- *
4979
- * Neither the name of the copyright holder nor the names of its
4980
- * contributors may be used to endorse or promote products derived from
4981
- * this software without specific prior written permission.
4982
- *
4983
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
4984
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4985
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4986
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
4987
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4988
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4989
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4990
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
4991
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4992
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4993
- */
4994
-
4995
-
4996
- /**
4997
- * Used for proxying resource => organisation
4998
- */
4999
-
5000
- class OwnedResourceProxy extends _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__["default"] {
5001
- /**
5002
- * OwnedResourceProxy Constructor
5003
- * @param {Mapcreator} api - Api instance
5004
- * @param {ResourceBase} parent - Parent instance
5005
- * @param {Class<ResourceBase>} Target - Target constructor
5006
- */
5007
- constructor(api, parent, Target) {
5008
- const resource = Target.resourceName.replace(/s+$/, '');
5009
- const url = `${parent.url}/${resource}s`;
5010
- super(api, Target, url);
5011
- }
5012
- /**
5013
- * Sync items to the organisation
5014
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync
5015
- * @throws {TypeError}
5016
- * @throws {ApiError} - If the api returns errors
5017
- * @returns {CancelablePromise}
5018
- */
5019
-
5020
-
5021
- sync(items) {
5022
- return this._modifyResourceLink(items, 'PATCH');
5023
- }
5024
- /**
5025
- * Attach items to the organisation
5026
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to attach
5027
- * @throws {TypeError}
5028
- * @throws {ApiError} - If the api returns errors
5029
- * @returns {CancelablePromise}
5030
- */
5031
-
5032
-
5033
- attach(items) {
5034
- return this._modifyResourceLink(items, 'POST');
5035
- }
5036
- /**
5037
- * Detach items from the organisation
5038
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to unlink
5039
- * @throws {TypeError}
5040
- * @throws {ApiError} - If the api returns errors
5041
- * @returns {CancelablePromise}
5042
- */
5043
-
5044
-
5045
- detach(items) {
5046
- return this._modifyResourceLink(items, 'DELETE');
5047
- }
5048
- /**
5049
- * Attach parent resource to all organisations
5050
- * @throws {ApiError} - If the api returns errors
5051
- * @returns {CancelablePromise}
5052
- */
5053
-
5054
-
5055
- attachAll() {
5056
- return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5057
- await this.api.ky.post(`${this.baseUrl}/all`, {
5058
- signal
5059
- });
5060
- });
5061
- }
5062
- /**
5063
- * Detach parent resource to all organisations
5064
- * @throws {ApiError} - If the api returns errors
5065
- * @returns {CancelablePromise}
5066
- */
5067
-
5068
-
5069
- detachAll() {
5070
- return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5071
- await this.api.ky.delete(`${this.baseUrl}/all`, {
5072
- signal
5073
- });
5074
- });
5075
- }
5076
- /**
5077
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync, attach or detach
5078
- * @param {string} method - http method
5079
- * @throws {ApiError} - If the api returns errors
5080
- * @throws {TypeError}
5081
- * @returns {CancelablePromise}
5082
- * @private
5083
- */
5084
-
5085
-
5086
- _modifyResourceLink(items, method) {
5087
- if (!Array.isArray(items)) {
5088
- items = [items];
5089
- }
5090
-
5091
- const keys = items.map(x => OwnedResourceProxy._getKeyValue(x)).map(Number).filter(x => !Number.isNaN(x));
5092
- return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5093
- await this.api.ky(this.baseUrl, {
5094
- method,
5095
- signal,
5096
- json: {
5097
- keys
5098
- }
5099
- });
5100
- });
5101
- }
5102
-
5103
- static _getKeyValue(item) {
5104
- if (['number', 'string'].includes(typeof item)) {
5105
- return item;
5106
- }
5107
-
5108
- const key = item.constructor.resourceUrlKey || 'id';
5109
-
5110
- if (typeof item[key] !== 'undefined') {
5111
- return item[key];
5112
- }
5113
-
5114
- throw new TypeError('Expected items to be of type Array<ResourceBase>, Array<number>, ResourceBase or number}');
5115
- }
5116
-
5117
- }
5118
-
5119
- /***/ }),
5120
- /* 21 */
5121
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5122
-
5123
- "use strict";
5124
- __webpack_require__.r(__webpack_exports__);
5125
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5126
- /* harmony export */ "AbstractError": () => (/* binding */ AbstractError),
5127
- /* harmony export */ "AbstractClassError": () => (/* binding */ AbstractClassError),
5128
- /* harmony export */ "AbstractMethodError": () => (/* binding */ AbstractMethodError)
5129
- /* harmony export */ });
5130
- /*
5131
- * BSD 3-Clause License
5132
- *
5133
- * Copyright (c) 2020, Mapcreator
5134
- * All rights reserved.
5135
- *
5136
- * Redistribution and use in source and binary forms, with or without
5137
- * modification, are permitted provided that the following conditions are met:
5138
- *
5139
- * Redistributions of source code must retain the above copyright notice, this
5140
- * list of conditions and the following disclaimer.
5141
- *
5142
- * Redistributions in binary form must reproduce the above copyright notice,
5143
- * this list of conditions and the following disclaimer in the documentation
5144
- * and/or other materials provided with the distribution.
5145
- *
5146
- * Neither the name of the copyright holder nor the names of its
5147
- * contributors may be used to endorse or promote products derived from
5148
- * this software without specific prior written permission.
5149
- *
5150
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5151
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5152
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5153
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5154
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5155
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5156
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5157
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5158
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5159
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5160
- */
5161
-
5162
- /**
5163
- * Thrown by abstract methods and classes
5164
- */
5165
- class AbstractError extends Error {
5166
- /**
5167
- * AbstractError constructor
5168
- * @param {?String} message - Error message
5169
- */
5170
- constructor(message = 'Unimplemented') {
5171
- super(message);
5172
- }
5173
-
5174
- }
5175
- /**
5176
- * Thrown upon invocation of an abstract class
5177
- * @example
5178
- * class FooBar {
5179
- * constructor() {
5180
- * if (this.constructor === FooBar) {
5181
- * throw new AbstractClassError();
5182
- * }
5183
- * }
5184
- * }
5185
- */
5186
-
5187
- class AbstractClassError extends AbstractError {
5188
- constructor() {
5189
- super('Can not make an instance of an abstract class');
5190
- }
5191
-
5192
- }
5193
- /**
5194
- * Thrown upon invocation of an abstract method
5195
- */
5196
-
5197
- class AbstractMethodError extends AbstractError {
5198
- constructor() {
5199
- super('Can not call an abstract method');
5200
- }
5201
-
5202
- }
5203
-
5204
- /***/ }),
5205
- /* 22 */
5206
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5207
-
5208
4956
  "use strict";
5209
4957
  // ESM COMPAT FLAG
5210
4958
  __webpack_require__.r(__webpack_exports__);
@@ -5683,6 +5431,258 @@ class StorageManager extends StaticClass["default"] {
5683
5431
 
5684
5432
  }
5685
5433
 
5434
+ /***/ }),
5435
+ /* 21 */
5436
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5437
+
5438
+ "use strict";
5439
+ __webpack_require__.r(__webpack_exports__);
5440
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5441
+ /* harmony export */ "default": () => (/* binding */ OwnedResourceProxy)
5442
+ /* harmony export */ });
5443
+ /* harmony import */ var _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
5444
+ /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
5445
+ /*
5446
+ * BSD 3-Clause License
5447
+ *
5448
+ * Copyright (c) 2020, Mapcreator
5449
+ * All rights reserved.
5450
+ *
5451
+ * Redistribution and use in source and binary forms, with or without
5452
+ * modification, are permitted provided that the following conditions are met:
5453
+ *
5454
+ * Redistributions of source code must retain the above copyright notice, this
5455
+ * list of conditions and the following disclaimer.
5456
+ *
5457
+ * Redistributions in binary form must reproduce the above copyright notice,
5458
+ * this list of conditions and the following disclaimer in the documentation
5459
+ * and/or other materials provided with the distribution.
5460
+ *
5461
+ * Neither the name of the copyright holder nor the names of its
5462
+ * contributors may be used to endorse or promote products derived from
5463
+ * this software without specific prior written permission.
5464
+ *
5465
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5466
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5467
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5468
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5469
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5470
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5471
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5472
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5473
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5474
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5475
+ */
5476
+
5477
+
5478
+ /**
5479
+ * Used for proxying resource => organisation
5480
+ */
5481
+
5482
+ class OwnedResourceProxy extends _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__["default"] {
5483
+ /**
5484
+ * OwnedResourceProxy Constructor
5485
+ * @param {Mapcreator} api - Api instance
5486
+ * @param {ResourceBase} parent - Parent instance
5487
+ * @param {Class<ResourceBase>} Target - Target constructor
5488
+ */
5489
+ constructor(api, parent, Target) {
5490
+ const resource = Target.resourceName.replace(/s+$/, '');
5491
+ const url = `${parent.url}/${resource}s`;
5492
+ super(api, Target, url);
5493
+ }
5494
+ /**
5495
+ * Sync items to the organisation
5496
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync
5497
+ * @throws {TypeError}
5498
+ * @throws {ApiError} - If the api returns errors
5499
+ * @returns {CancelablePromise}
5500
+ */
5501
+
5502
+
5503
+ sync(items) {
5504
+ return this._modifyResourceLink(items, 'PATCH');
5505
+ }
5506
+ /**
5507
+ * Attach items to the organisation
5508
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to attach
5509
+ * @throws {TypeError}
5510
+ * @throws {ApiError} - If the api returns errors
5511
+ * @returns {CancelablePromise}
5512
+ */
5513
+
5514
+
5515
+ attach(items) {
5516
+ return this._modifyResourceLink(items, 'POST');
5517
+ }
5518
+ /**
5519
+ * Detach items from the organisation
5520
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to unlink
5521
+ * @throws {TypeError}
5522
+ * @throws {ApiError} - If the api returns errors
5523
+ * @returns {CancelablePromise}
5524
+ */
5525
+
5526
+
5527
+ detach(items) {
5528
+ return this._modifyResourceLink(items, 'DELETE');
5529
+ }
5530
+ /**
5531
+ * Attach parent resource to all organisations
5532
+ * @throws {ApiError} - If the api returns errors
5533
+ * @returns {CancelablePromise}
5534
+ */
5535
+
5536
+
5537
+ attachAll() {
5538
+ return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5539
+ await this.api.ky.post(`${this.baseUrl}/all`, {
5540
+ signal
5541
+ });
5542
+ });
5543
+ }
5544
+ /**
5545
+ * Detach parent resource to all organisations
5546
+ * @throws {ApiError} - If the api returns errors
5547
+ * @returns {CancelablePromise}
5548
+ */
5549
+
5550
+
5551
+ detachAll() {
5552
+ return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5553
+ await this.api.ky.delete(`${this.baseUrl}/all`, {
5554
+ signal
5555
+ });
5556
+ });
5557
+ }
5558
+ /**
5559
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync, attach or detach
5560
+ * @param {string} method - http method
5561
+ * @throws {ApiError} - If the api returns errors
5562
+ * @throws {TypeError}
5563
+ * @returns {CancelablePromise}
5564
+ * @private
5565
+ */
5566
+
5567
+
5568
+ _modifyResourceLink(items, method) {
5569
+ if (!Array.isArray(items)) {
5570
+ items = [items];
5571
+ }
5572
+
5573
+ const keys = items.map(x => OwnedResourceProxy._getKeyValue(x)).map(Number).filter(x => !Number.isNaN(x));
5574
+ return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5575
+ await this.api.ky(this.baseUrl, {
5576
+ method,
5577
+ signal,
5578
+ json: {
5579
+ keys
5580
+ }
5581
+ });
5582
+ });
5583
+ }
5584
+
5585
+ static _getKeyValue(item) {
5586
+ if (['number', 'string'].includes(typeof item)) {
5587
+ return item;
5588
+ }
5589
+
5590
+ const key = item.constructor.resourceUrlKey || 'id';
5591
+
5592
+ if (typeof item[key] !== 'undefined') {
5593
+ return item[key];
5594
+ }
5595
+
5596
+ throw new TypeError('Expected items to be of type Array<ResourceBase>, Array<number>, ResourceBase or number}');
5597
+ }
5598
+
5599
+ }
5600
+
5601
+ /***/ }),
5602
+ /* 22 */
5603
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5604
+
5605
+ "use strict";
5606
+ __webpack_require__.r(__webpack_exports__);
5607
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5608
+ /* harmony export */ "AbstractError": () => (/* binding */ AbstractError),
5609
+ /* harmony export */ "AbstractClassError": () => (/* binding */ AbstractClassError),
5610
+ /* harmony export */ "AbstractMethodError": () => (/* binding */ AbstractMethodError)
5611
+ /* harmony export */ });
5612
+ /*
5613
+ * BSD 3-Clause License
5614
+ *
5615
+ * Copyright (c) 2020, Mapcreator
5616
+ * All rights reserved.
5617
+ *
5618
+ * Redistribution and use in source and binary forms, with or without
5619
+ * modification, are permitted provided that the following conditions are met:
5620
+ *
5621
+ * Redistributions of source code must retain the above copyright notice, this
5622
+ * list of conditions and the following disclaimer.
5623
+ *
5624
+ * Redistributions in binary form must reproduce the above copyright notice,
5625
+ * this list of conditions and the following disclaimer in the documentation
5626
+ * and/or other materials provided with the distribution.
5627
+ *
5628
+ * Neither the name of the copyright holder nor the names of its
5629
+ * contributors may be used to endorse or promote products derived from
5630
+ * this software without specific prior written permission.
5631
+ *
5632
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5633
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5634
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5635
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5636
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5637
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5638
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5639
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5640
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5641
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5642
+ */
5643
+
5644
+ /**
5645
+ * Thrown by abstract methods and classes
5646
+ */
5647
+ class AbstractError extends Error {
5648
+ /**
5649
+ * AbstractError constructor
5650
+ * @param {?String} message - Error message
5651
+ */
5652
+ constructor(message = 'Unimplemented') {
5653
+ super(message);
5654
+ }
5655
+
5656
+ }
5657
+ /**
5658
+ * Thrown upon invocation of an abstract class
5659
+ * @example
5660
+ * class FooBar {
5661
+ * constructor() {
5662
+ * if (this.constructor === FooBar) {
5663
+ * throw new AbstractClassError();
5664
+ * }
5665
+ * }
5666
+ * }
5667
+ */
5668
+
5669
+ class AbstractClassError extends AbstractError {
5670
+ constructor() {
5671
+ super('Can not make an instance of an abstract class');
5672
+ }
5673
+
5674
+ }
5675
+ /**
5676
+ * Thrown upon invocation of an abstract method
5677
+ */
5678
+
5679
+ class AbstractMethodError extends AbstractError {
5680
+ constructor() {
5681
+ super('Can not call an abstract method');
5682
+ }
5683
+
5684
+ }
5685
+
5686
5686
  /***/ }),
5687
5687
  /* 23 */
5688
5688
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
@@ -5692,7 +5692,7 @@ __webpack_require__.r(__webpack_exports__);
5692
5692
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5693
5693
  /* harmony export */ "default": () => (/* binding */ DataStoreContract)
5694
5694
  /* harmony export */ });
5695
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
5695
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
5696
5696
  /*
5697
5697
  * BSD 3-Clause License
5698
5698
  *
@@ -8603,7 +8603,7 @@ __webpack_require__.d(__webpack_exports__, {
8603
8603
  });
8604
8604
 
8605
8605
  // EXTERNAL MODULE: ./src/errors/AbstractError.js
8606
- var AbstractError = __webpack_require__(21);
8606
+ var AbstractError = __webpack_require__(22);
8607
8607
  // EXTERNAL MODULE: ./src/errors/ApiError.js
8608
8608
  var ApiError = __webpack_require__(66);
8609
8609
  // EXTERNAL MODULE: ./src/errors/ValidationError.js
@@ -9391,7 +9391,7 @@ __webpack_require__.d(__webpack_exports__, {
9391
9391
  });
9392
9392
 
9393
9393
  // EXTERNAL MODULE: ./src/storage/StorageManager.js + 3 modules
9394
- var StorageManager = __webpack_require__(22);
9394
+ var StorageManager = __webpack_require__(20);
9395
9395
  // EXTERNAL MODULE: ./src/utils/StaticClass.js
9396
9396
  var StaticClass = __webpack_require__(34);
9397
9397
  ;// CONCATENATED MODULE: ./src/utils/uuid.js
@@ -9801,7 +9801,7 @@ __webpack_require__.r(__webpack_exports__);
9801
9801
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9802
9802
  /* harmony export */ "default": () => (/* binding */ Organisation)
9803
9803
  /* harmony export */ });
9804
- /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
9804
+ /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
9805
9805
  /* harmony import */ var _base_CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
9806
9806
  /* harmony import */ var _Color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(46);
9807
9807
  /* harmony import */ var _Contract__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67);
@@ -11264,7 +11264,7 @@ __webpack_require__.r(__webpack_exports__);
11264
11264
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11265
11265
  /* harmony export */ "default": () => (/* binding */ User)
11266
11266
  /* harmony export */ });
11267
- /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
11267
+ /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
11268
11268
  /* harmony import */ var _proxy_ResourceProxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
11269
11269
  /* harmony import */ var _base_CrudBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
11270
11270
  /* harmony import */ var _Color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(46);
@@ -12241,7 +12241,7 @@ class Injectable extends _Trait__WEBPACK_IMPORTED_MODULE_2__["default"] {
12241
12241
  const OwnableResource = (__webpack_require__(4)["default"]);
12242
12242
 
12243
12243
  if ((0,_utils_reflection__WEBPACK_IMPORTED_MODULE_1__.hasTrait)(value, OwnableResource)) {
12244
- const OwnedResourceProxy = (__webpack_require__(20)["default"]);
12244
+ const OwnedResourceProxy = (__webpack_require__(21)["default"]);
12245
12245
 
12246
12246
  this._inject(name, function () {
12247
12247
  return new OwnedResourceProxy(this.api, this, value);
@@ -12982,7 +12982,7 @@ __webpack_require__.r(__webpack_exports__);
12982
12982
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12983
12983
  /* harmony export */ "default": () => (/* binding */ Role)
12984
12984
  /* harmony export */ });
12985
- /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
12985
+ /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
12986
12986
  /* harmony import */ var _base_CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
12987
12987
  /* harmony import */ var _Permission__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59);
12988
12988
  /* harmony import */ var _User__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(58);
@@ -13132,7 +13132,7 @@ __webpack_require__.r(__webpack_exports__);
13132
13132
  /* harmony export */ });
13133
13133
  /* harmony import */ var _GeoResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43);
13134
13134
  /* harmony import */ var _OrganisationProxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(35);
13135
- /* harmony import */ var _OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20);
13135
+ /* harmony import */ var _OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21);
13136
13136
  /* harmony import */ var _ResourceProxy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
13137
13137
  /* harmony import */ var _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15);
13138
13138
  /*
@@ -13953,7 +13953,7 @@ var Mapcreator = __webpack_require__(17);
13953
13953
  // EXTERNAL MODULE: ./src/RequestParameters.js
13954
13954
  var RequestParameters = __webpack_require__(8);
13955
13955
  // EXTERNAL MODULE: ./src/storage/StorageManager.js + 3 modules
13956
- var StorageManager = __webpack_require__(22);
13956
+ var StorageManager = __webpack_require__(20);
13957
13957
  // EXTERNAL MODULE: ./src/enums/Enum.js + 1 modules
13958
13958
  var Enum = __webpack_require__(11);
13959
13959
  // EXTERNAL MODULE: ./src/enums/index.js + 3 modules
@@ -14232,6 +14232,7 @@ class ImplicitFlow extends OAuth["default"] {
14232
14232
 
14233
14233
 
14234
14234
 
14235
+
14235
14236
  /**
14236
14237
  * Implicit OAuth flow using a pop-up.
14237
14238
  */
@@ -14283,25 +14284,24 @@ class ImplicitFlowPopup extends ImplicitFlow {
14283
14284
  }
14284
14285
 
14285
14286
  return new Promise((resolve, reject) => {
14287
+ const localStorage = StorageManager["default"].localStorage;
14288
+ const storageName = 'api_auth';
14289
+ localStorage.remove(storageName);
14286
14290
  const popup = window.open(this._buildRedirectUrl(), ImplicitFlowPopup.popupWindowName, this.windowOptions);
14287
14291
  const ticker = setInterval(() => {
14288
- if (popup.closed) {
14289
- reject(new OAuthError["default"]('window_closed', 'Pop-up window was closed before data could be extracted'));
14290
- }
14291
-
14292
- let done = false;
14293
-
14294
- try {
14295
- done = !['', 'about:blank'].includes(popup.location.href);
14296
- } catch (e) {// Nothing
14297
- }
14292
+ const locationHash = localStorage.get(storageName);
14298
14293
 
14299
- if (done) {
14294
+ if (locationHash) {
14300
14295
  clearInterval(ticker);
14301
14296
 
14302
- const data = this._getAnchorParams(popup.location.hash);
14297
+ const data = this._getAnchorParams(locationHash);
14303
14298
 
14304
- popup.close();
14299
+ localStorage.remove(storageName);
14300
+
14301
+ try {
14302
+ popup.close();
14303
+ } catch (e) {// cloudflare intercepted or closed manually
14304
+ }
14305
14305
 
14306
14306
  if (data.error) {
14307
14307
  reject(new OAuthError["default"](data.error, data.message));
@@ -14494,7 +14494,7 @@ var DummyFlow = __webpack_require__(76);
14494
14494
  // EXTERNAL MODULE: ./src/errors/ApiError.js
14495
14495
  var ApiError = __webpack_require__(66);
14496
14496
  // EXTERNAL MODULE: ./src/errors/AbstractError.js
14497
- var AbstractError = __webpack_require__(21);
14497
+ var AbstractError = __webpack_require__(22);
14498
14498
  // EXTERNAL MODULE: ./src/errors/ValidationError.js
14499
14499
  var ValidationError = __webpack_require__(78);
14500
14500
  // EXTERNAL MODULE: ./src/errors/StaticClassError.js
@@ -14580,7 +14580,7 @@ var proxy = __webpack_require__(75);
14580
14580
  * @private
14581
14581
  */
14582
14582
 
14583
- const version = "v3.3.1";
14583
+ const version = "b8d270c";
14584
14584
  })();
14585
14585
 
14586
14586
  /******/ return __webpack_exports__;