@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.
package/dist/bundle.js CHANGED
@@ -29,7 +29,7 @@
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:af26823235a66e3e14db, chunkhash:99c5aae0fb9546866704, name:bundle, version:v3.3.1
32
+ * hash:b7ea9c4fef45443fd467, chunkhash:77af474606a897d530f7, name:bundle, version:b8d270c
33
33
  */
34
34
  /******/ (() => { // webpackBootstrap
35
35
  /******/ "use strict";
@@ -628,7 +628,7 @@ __webpack_require__.r(__webpack_exports__);
628
628
  /* harmony export */ });
629
629
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
630
630
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(case__WEBPACK_IMPORTED_MODULE_0__);
631
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21);
631
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22);
632
632
  /* harmony import */ var _Mapcreator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
633
633
  /* harmony import */ var _proxy_SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
634
634
  /* harmony import */ var _traits_Injectable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(61);
@@ -2331,7 +2331,7 @@ __webpack_require__.r(__webpack_exports__);
2331
2331
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2332
2332
  /* harmony export */ "default": () => (/* binding */ CrudSetItemBase)
2333
2333
  /* harmony export */ });
2334
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
2334
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
2335
2335
  /* harmony import */ var _CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
2336
2336
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
2337
2337
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(case__WEBPACK_IMPORTED_MODULE_2__);
@@ -2622,7 +2622,7 @@ __webpack_require__.r(__webpack_exports__);
2622
2622
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2623
2623
  /* harmony export */ "default": () => (/* binding */ OAuthToken)
2624
2624
  /* harmony export */ });
2625
- /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
2625
+ /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
2626
2626
  /* harmony import */ var _utils_requests__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
2627
2627
  /*
2628
2628
  * BSD 3-Clause License
@@ -3474,7 +3474,7 @@ __webpack_require__.r(__webpack_exports__);
3474
3474
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3475
3475
  /* harmony export */ "default": () => (/* binding */ CrudSetBase)
3476
3476
  /* harmony export */ });
3477
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
3477
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
3478
3478
  /* harmony import */ var _CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
3479
3479
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
3480
3480
  /* harmony import */ var case__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(case__WEBPACK_IMPORTED_MODULE_2__);
@@ -4571,8 +4571,8 @@ __webpack_require__.r(__webpack_exports__);
4571
4571
  /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
4572
4572
  /* harmony import */ var ky_universal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31);
4573
4573
  /* harmony import */ var ky_universal__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(ky_universal__WEBPACK_IMPORTED_MODULE_1__);
4574
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21);
4575
- /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22);
4574
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22);
4575
+ /* harmony import */ var _storage_StorageManager__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(20);
4576
4576
  /* harmony import */ var _OAuthToken__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12);
4577
4577
  /* harmony import */ var _StateContainer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(37);
4578
4578
  /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1);
@@ -4718,256 +4718,6 @@ class OAuth {
4718
4718
  /* 20 */
4719
4719
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4720
4720
 
4721
- __webpack_require__.r(__webpack_exports__);
4722
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4723
- /* harmony export */ "default": () => (/* binding */ OwnedResourceProxy)
4724
- /* harmony export */ });
4725
- /* harmony import */ var _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
4726
- /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
4727
- /*
4728
- * BSD 3-Clause License
4729
- *
4730
- * Copyright (c) 2020, Mapcreator
4731
- * All rights reserved.
4732
- *
4733
- * Redistribution and use in source and binary forms, with or without
4734
- * modification, are permitted provided that the following conditions are met:
4735
- *
4736
- * Redistributions of source code must retain the above copyright notice, this
4737
- * list of conditions and the following disclaimer.
4738
- *
4739
- * Redistributions in binary form must reproduce the above copyright notice,
4740
- * this list of conditions and the following disclaimer in the documentation
4741
- * and/or other materials provided with the distribution.
4742
- *
4743
- * Neither the name of the copyright holder nor the names of its
4744
- * contributors may be used to endorse or promote products derived from
4745
- * this software without specific prior written permission.
4746
- *
4747
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
4748
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4749
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4750
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
4751
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4752
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4753
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4754
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
4755
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4756
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4757
- */
4758
-
4759
-
4760
- /**
4761
- * Used for proxying resource => organisation
4762
- */
4763
-
4764
- class OwnedResourceProxy extends _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__["default"] {
4765
- /**
4766
- * OwnedResourceProxy Constructor
4767
- * @param {Mapcreator} api - Api instance
4768
- * @param {ResourceBase} parent - Parent instance
4769
- * @param {Class<ResourceBase>} Target - Target constructor
4770
- */
4771
- constructor(api, parent, Target) {
4772
- const resource = Target.resourceName.replace(/s+$/, '');
4773
- const url = `${parent.url}/${resource}s`;
4774
- super(api, Target, url);
4775
- }
4776
- /**
4777
- * Sync items to the organisation
4778
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync
4779
- * @throws {TypeError}
4780
- * @throws {ApiError} - If the api returns errors
4781
- * @returns {CancelablePromise}
4782
- */
4783
-
4784
-
4785
- sync(items) {
4786
- return this._modifyResourceLink(items, 'PATCH');
4787
- }
4788
- /**
4789
- * Attach items to the organisation
4790
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to attach
4791
- * @throws {TypeError}
4792
- * @throws {ApiError} - If the api returns errors
4793
- * @returns {CancelablePromise}
4794
- */
4795
-
4796
-
4797
- attach(items) {
4798
- return this._modifyResourceLink(items, 'POST');
4799
- }
4800
- /**
4801
- * Detach items from the organisation
4802
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to unlink
4803
- * @throws {TypeError}
4804
- * @throws {ApiError} - If the api returns errors
4805
- * @returns {CancelablePromise}
4806
- */
4807
-
4808
-
4809
- detach(items) {
4810
- return this._modifyResourceLink(items, 'DELETE');
4811
- }
4812
- /**
4813
- * Attach parent resource to all organisations
4814
- * @throws {ApiError} - If the api returns errors
4815
- * @returns {CancelablePromise}
4816
- */
4817
-
4818
-
4819
- attachAll() {
4820
- return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
4821
- await this.api.ky.post(`${this.baseUrl}/all`, {
4822
- signal
4823
- });
4824
- });
4825
- }
4826
- /**
4827
- * Detach parent resource to all organisations
4828
- * @throws {ApiError} - If the api returns errors
4829
- * @returns {CancelablePromise}
4830
- */
4831
-
4832
-
4833
- detachAll() {
4834
- return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
4835
- await this.api.ky.delete(`${this.baseUrl}/all`, {
4836
- signal
4837
- });
4838
- });
4839
- }
4840
- /**
4841
- * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync, attach or detach
4842
- * @param {string} method - http method
4843
- * @throws {ApiError} - If the api returns errors
4844
- * @throws {TypeError}
4845
- * @returns {CancelablePromise}
4846
- * @private
4847
- */
4848
-
4849
-
4850
- _modifyResourceLink(items, method) {
4851
- if (!Array.isArray(items)) {
4852
- items = [items];
4853
- }
4854
-
4855
- const keys = items.map(x => OwnedResourceProxy._getKeyValue(x)).map(Number).filter(x => !Number.isNaN(x));
4856
- return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
4857
- await this.api.ky(this.baseUrl, {
4858
- method,
4859
- signal,
4860
- json: {
4861
- keys
4862
- }
4863
- });
4864
- });
4865
- }
4866
-
4867
- static _getKeyValue(item) {
4868
- if (['number', 'string'].includes(typeof item)) {
4869
- return item;
4870
- }
4871
-
4872
- const key = item.constructor.resourceUrlKey || 'id';
4873
-
4874
- if (typeof item[key] !== 'undefined') {
4875
- return item[key];
4876
- }
4877
-
4878
- throw new TypeError('Expected items to be of type Array<ResourceBase>, Array<number>, ResourceBase or number}');
4879
- }
4880
-
4881
- }
4882
-
4883
- /***/ }),
4884
- /* 21 */
4885
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4886
-
4887
- __webpack_require__.r(__webpack_exports__);
4888
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4889
- /* harmony export */ "AbstractError": () => (/* binding */ AbstractError),
4890
- /* harmony export */ "AbstractClassError": () => (/* binding */ AbstractClassError),
4891
- /* harmony export */ "AbstractMethodError": () => (/* binding */ AbstractMethodError)
4892
- /* harmony export */ });
4893
- /*
4894
- * BSD 3-Clause License
4895
- *
4896
- * Copyright (c) 2020, Mapcreator
4897
- * All rights reserved.
4898
- *
4899
- * Redistribution and use in source and binary forms, with or without
4900
- * modification, are permitted provided that the following conditions are met:
4901
- *
4902
- * Redistributions of source code must retain the above copyright notice, this
4903
- * list of conditions and the following disclaimer.
4904
- *
4905
- * Redistributions in binary form must reproduce the above copyright notice,
4906
- * this list of conditions and the following disclaimer in the documentation
4907
- * and/or other materials provided with the distribution.
4908
- *
4909
- * Neither the name of the copyright holder nor the names of its
4910
- * contributors may be used to endorse or promote products derived from
4911
- * this software without specific prior written permission.
4912
- *
4913
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
4914
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4915
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
4916
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
4917
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4918
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
4919
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
4920
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
4921
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4922
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4923
- */
4924
-
4925
- /**
4926
- * Thrown by abstract methods and classes
4927
- */
4928
- class AbstractError extends Error {
4929
- /**
4930
- * AbstractError constructor
4931
- * @param {?String} message - Error message
4932
- */
4933
- constructor(message = 'Unimplemented') {
4934
- super(message);
4935
- }
4936
-
4937
- }
4938
- /**
4939
- * Thrown upon invocation of an abstract class
4940
- * @example
4941
- * class FooBar {
4942
- * constructor() {
4943
- * if (this.constructor === FooBar) {
4944
- * throw new AbstractClassError();
4945
- * }
4946
- * }
4947
- * }
4948
- */
4949
-
4950
- class AbstractClassError extends AbstractError {
4951
- constructor() {
4952
- super('Can not make an instance of an abstract class');
4953
- }
4954
-
4955
- }
4956
- /**
4957
- * Thrown upon invocation of an abstract method
4958
- */
4959
-
4960
- class AbstractMethodError extends AbstractError {
4961
- constructor() {
4962
- super('Can not call an abstract method');
4963
- }
4964
-
4965
- }
4966
-
4967
- /***/ }),
4968
- /* 22 */
4969
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4970
-
4971
4721
  // ESM COMPAT FLAG
4972
4722
  __webpack_require__.r(__webpack_exports__);
4973
4723
 
@@ -5445,6 +5195,256 @@ class StorageManager extends StaticClass["default"] {
5445
5195
 
5446
5196
  }
5447
5197
 
5198
+ /***/ }),
5199
+ /* 21 */
5200
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5201
+
5202
+ __webpack_require__.r(__webpack_exports__);
5203
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5204
+ /* harmony export */ "default": () => (/* binding */ OwnedResourceProxy)
5205
+ /* harmony export */ });
5206
+ /* harmony import */ var _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(14);
5207
+ /* harmony import */ var _utils_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
5208
+ /*
5209
+ * BSD 3-Clause License
5210
+ *
5211
+ * Copyright (c) 2020, Mapcreator
5212
+ * All rights reserved.
5213
+ *
5214
+ * Redistribution and use in source and binary forms, with or without
5215
+ * modification, are permitted provided that the following conditions are met:
5216
+ *
5217
+ * Redistributions of source code must retain the above copyright notice, this
5218
+ * list of conditions and the following disclaimer.
5219
+ *
5220
+ * Redistributions in binary form must reproduce the above copyright notice,
5221
+ * this list of conditions and the following disclaimer in the documentation
5222
+ * and/or other materials provided with the distribution.
5223
+ *
5224
+ * Neither the name of the copyright holder nor the names of its
5225
+ * contributors may be used to endorse or promote products derived from
5226
+ * this software without specific prior written permission.
5227
+ *
5228
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5229
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5230
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5231
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5232
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5233
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5234
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5235
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5236
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5237
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5238
+ */
5239
+
5240
+
5241
+ /**
5242
+ * Used for proxying resource => organisation
5243
+ */
5244
+
5245
+ class OwnedResourceProxy extends _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_0__["default"] {
5246
+ /**
5247
+ * OwnedResourceProxy Constructor
5248
+ * @param {Mapcreator} api - Api instance
5249
+ * @param {ResourceBase} parent - Parent instance
5250
+ * @param {Class<ResourceBase>} Target - Target constructor
5251
+ */
5252
+ constructor(api, parent, Target) {
5253
+ const resource = Target.resourceName.replace(/s+$/, '');
5254
+ const url = `${parent.url}/${resource}s`;
5255
+ super(api, Target, url);
5256
+ }
5257
+ /**
5258
+ * Sync items to the organisation
5259
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync
5260
+ * @throws {TypeError}
5261
+ * @throws {ApiError} - If the api returns errors
5262
+ * @returns {CancelablePromise}
5263
+ */
5264
+
5265
+
5266
+ sync(items) {
5267
+ return this._modifyResourceLink(items, 'PATCH');
5268
+ }
5269
+ /**
5270
+ * Attach items to the organisation
5271
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to attach
5272
+ * @throws {TypeError}
5273
+ * @throws {ApiError} - If the api returns errors
5274
+ * @returns {CancelablePromise}
5275
+ */
5276
+
5277
+
5278
+ attach(items) {
5279
+ return this._modifyResourceLink(items, 'POST');
5280
+ }
5281
+ /**
5282
+ * Detach items from the organisation
5283
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to unlink
5284
+ * @throws {TypeError}
5285
+ * @throws {ApiError} - If the api returns errors
5286
+ * @returns {CancelablePromise}
5287
+ */
5288
+
5289
+
5290
+ detach(items) {
5291
+ return this._modifyResourceLink(items, 'DELETE');
5292
+ }
5293
+ /**
5294
+ * Attach parent resource to all organisations
5295
+ * @throws {ApiError} - If the api returns errors
5296
+ * @returns {CancelablePromise}
5297
+ */
5298
+
5299
+
5300
+ attachAll() {
5301
+ return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5302
+ await this.api.ky.post(`${this.baseUrl}/all`, {
5303
+ signal
5304
+ });
5305
+ });
5306
+ }
5307
+ /**
5308
+ * Detach parent resource to all organisations
5309
+ * @throws {ApiError} - If the api returns errors
5310
+ * @returns {CancelablePromise}
5311
+ */
5312
+
5313
+
5314
+ detachAll() {
5315
+ return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5316
+ await this.api.ky.delete(`${this.baseUrl}/all`, {
5317
+ signal
5318
+ });
5319
+ });
5320
+ }
5321
+ /**
5322
+ * @param {Array<ResourceBase>|Array<number>|ResourceBase|number} items - List of items to sync, attach or detach
5323
+ * @param {string} method - http method
5324
+ * @throws {ApiError} - If the api returns errors
5325
+ * @throws {TypeError}
5326
+ * @returns {CancelablePromise}
5327
+ * @private
5328
+ */
5329
+
5330
+
5331
+ _modifyResourceLink(items, method) {
5332
+ if (!Array.isArray(items)) {
5333
+ items = [items];
5334
+ }
5335
+
5336
+ const keys = items.map(x => OwnedResourceProxy._getKeyValue(x)).map(Number).filter(x => !Number.isNaN(x));
5337
+ return (0,_utils_helpers__WEBPACK_IMPORTED_MODULE_1__.makeCancelable)(async signal => {
5338
+ await this.api.ky(this.baseUrl, {
5339
+ method,
5340
+ signal,
5341
+ json: {
5342
+ keys
5343
+ }
5344
+ });
5345
+ });
5346
+ }
5347
+
5348
+ static _getKeyValue(item) {
5349
+ if (['number', 'string'].includes(typeof item)) {
5350
+ return item;
5351
+ }
5352
+
5353
+ const key = item.constructor.resourceUrlKey || 'id';
5354
+
5355
+ if (typeof item[key] !== 'undefined') {
5356
+ return item[key];
5357
+ }
5358
+
5359
+ throw new TypeError('Expected items to be of type Array<ResourceBase>, Array<number>, ResourceBase or number}');
5360
+ }
5361
+
5362
+ }
5363
+
5364
+ /***/ }),
5365
+ /* 22 */
5366
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
5367
+
5368
+ __webpack_require__.r(__webpack_exports__);
5369
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5370
+ /* harmony export */ "AbstractError": () => (/* binding */ AbstractError),
5371
+ /* harmony export */ "AbstractClassError": () => (/* binding */ AbstractClassError),
5372
+ /* harmony export */ "AbstractMethodError": () => (/* binding */ AbstractMethodError)
5373
+ /* harmony export */ });
5374
+ /*
5375
+ * BSD 3-Clause License
5376
+ *
5377
+ * Copyright (c) 2020, Mapcreator
5378
+ * All rights reserved.
5379
+ *
5380
+ * Redistribution and use in source and binary forms, with or without
5381
+ * modification, are permitted provided that the following conditions are met:
5382
+ *
5383
+ * Redistributions of source code must retain the above copyright notice, this
5384
+ * list of conditions and the following disclaimer.
5385
+ *
5386
+ * Redistributions in binary form must reproduce the above copyright notice,
5387
+ * this list of conditions and the following disclaimer in the documentation
5388
+ * and/or other materials provided with the distribution.
5389
+ *
5390
+ * Neither the name of the copyright holder nor the names of its
5391
+ * contributors may be used to endorse or promote products derived from
5392
+ * this software without specific prior written permission.
5393
+ *
5394
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
5395
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5396
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
5397
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
5398
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5399
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
5400
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
5401
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
5402
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
5403
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5404
+ */
5405
+
5406
+ /**
5407
+ * Thrown by abstract methods and classes
5408
+ */
5409
+ class AbstractError extends Error {
5410
+ /**
5411
+ * AbstractError constructor
5412
+ * @param {?String} message - Error message
5413
+ */
5414
+ constructor(message = 'Unimplemented') {
5415
+ super(message);
5416
+ }
5417
+
5418
+ }
5419
+ /**
5420
+ * Thrown upon invocation of an abstract class
5421
+ * @example
5422
+ * class FooBar {
5423
+ * constructor() {
5424
+ * if (this.constructor === FooBar) {
5425
+ * throw new AbstractClassError();
5426
+ * }
5427
+ * }
5428
+ * }
5429
+ */
5430
+
5431
+ class AbstractClassError extends AbstractError {
5432
+ constructor() {
5433
+ super('Can not make an instance of an abstract class');
5434
+ }
5435
+
5436
+ }
5437
+ /**
5438
+ * Thrown upon invocation of an abstract method
5439
+ */
5440
+
5441
+ class AbstractMethodError extends AbstractError {
5442
+ constructor() {
5443
+ super('Can not call an abstract method');
5444
+ }
5445
+
5446
+ }
5447
+
5448
5448
  /***/ }),
5449
5449
  /* 23 */
5450
5450
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
@@ -5535,7 +5535,7 @@ __webpack_require__.r(__webpack_exports__);
5535
5535
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5536
5536
  /* harmony export */ "default": () => (/* binding */ DataStoreContract)
5537
5537
  /* harmony export */ });
5538
- /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
5538
+ /* harmony import */ var _errors_AbstractError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
5539
5539
  /*
5540
5540
  * BSD 3-Clause License
5541
5541
  *
@@ -7338,7 +7338,7 @@ __webpack_require__.d(__webpack_exports__, {
7338
7338
  });
7339
7339
 
7340
7340
  // EXTERNAL MODULE: ./src/errors/AbstractError.js
7341
- var AbstractError = __webpack_require__(21);
7341
+ var AbstractError = __webpack_require__(22);
7342
7342
  // EXTERNAL MODULE: ./src/errors/ApiError.js
7343
7343
  var ApiError = __webpack_require__(62);
7344
7344
  // EXTERNAL MODULE: ./src/errors/ValidationError.js
@@ -7587,7 +7587,7 @@ __webpack_require__.d(__webpack_exports__, {
7587
7587
  });
7588
7588
 
7589
7589
  // EXTERNAL MODULE: ./src/storage/StorageManager.js + 3 modules
7590
- var StorageManager = __webpack_require__(22);
7590
+ var StorageManager = __webpack_require__(20);
7591
7591
  // EXTERNAL MODULE: ./src/utils/StaticClass.js
7592
7592
  var StaticClass = __webpack_require__(33);
7593
7593
  ;// CONCATENATED MODULE: ./src/utils/uuid.js
@@ -8000,7 +8000,7 @@ __webpack_require__.r(__webpack_exports__);
8000
8000
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
8001
8001
  /* harmony export */ "default": () => (/* binding */ Organisation)
8002
8002
  /* harmony export */ });
8003
- /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
8003
+ /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
8004
8004
  /* harmony import */ var _base_CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
8005
8005
  /* harmony import */ var _Color__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(42);
8006
8006
  /* harmony import */ var _Contract__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(63);
@@ -9450,7 +9450,7 @@ __webpack_require__.r(__webpack_exports__);
9450
9450
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9451
9451
  /* harmony export */ "default": () => (/* binding */ User)
9452
9452
  /* harmony export */ });
9453
- /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
9453
+ /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
9454
9454
  /* harmony import */ var _proxy_ResourceProxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13);
9455
9455
  /* harmony import */ var _base_CrudBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
9456
9456
  /* harmony import */ var _Color__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42);
@@ -10420,7 +10420,7 @@ class Injectable extends _Trait__WEBPACK_IMPORTED_MODULE_2__["default"] {
10420
10420
  const OwnableResource = (__webpack_require__(4)["default"]);
10421
10421
 
10422
10422
  if ((0,_utils_reflection__WEBPACK_IMPORTED_MODULE_1__.hasTrait)(value, OwnableResource)) {
10423
- const OwnedResourceProxy = (__webpack_require__(20)["default"]);
10423
+ const OwnedResourceProxy = (__webpack_require__(21)["default"]);
10424
10424
 
10425
10425
  this._inject(name, function () {
10426
10426
  return new OwnedResourceProxy(this.api, this, value);
@@ -11153,7 +11153,7 @@ __webpack_require__.r(__webpack_exports__);
11153
11153
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
11154
11154
  /* harmony export */ "default": () => (/* binding */ Role)
11155
11155
  /* harmony export */ });
11156
- /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
11156
+ /* harmony import */ var _proxy_OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
11157
11157
  /* harmony import */ var _base_CrudBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
11158
11158
  /* harmony import */ var _Permission__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55);
11159
11159
  /* harmony import */ var _User__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(54);
@@ -11301,7 +11301,7 @@ __webpack_require__.r(__webpack_exports__);
11301
11301
  /* harmony export */ });
11302
11302
  /* harmony import */ var _GeoResourceProxy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(38);
11303
11303
  /* harmony import */ var _OrganisationProxy__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34);
11304
- /* harmony import */ var _OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(20);
11304
+ /* harmony import */ var _OwnedResourceProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(21);
11305
11305
  /* harmony import */ var _ResourceProxy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13);
11306
11306
  /* harmony import */ var _SimpleResourceProxy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(14);
11307
11307
  /*
@@ -12118,7 +12118,7 @@ var Mapcreator = __webpack_require__(16);
12118
12118
  // EXTERNAL MODULE: ./src/RequestParameters.js
12119
12119
  var RequestParameters = __webpack_require__(7);
12120
12120
  // EXTERNAL MODULE: ./src/storage/StorageManager.js + 3 modules
12121
- var StorageManager = __webpack_require__(22);
12121
+ var StorageManager = __webpack_require__(20);
12122
12122
  // EXTERNAL MODULE: ./src/enums/Enum.js + 1 modules
12123
12123
  var Enum = __webpack_require__(11);
12124
12124
  // EXTERNAL MODULE: ./src/enums/index.js + 3 modules
@@ -12397,6 +12397,7 @@ class ImplicitFlow extends OAuth["default"] {
12397
12397
 
12398
12398
 
12399
12399
 
12400
+
12400
12401
  /**
12401
12402
  * Implicit OAuth flow using a pop-up.
12402
12403
  */
@@ -12448,25 +12449,24 @@ class ImplicitFlowPopup extends ImplicitFlow {
12448
12449
  }
12449
12450
 
12450
12451
  return new Promise((resolve, reject) => {
12452
+ const localStorage = StorageManager["default"].localStorage;
12453
+ const storageName = 'api_auth';
12454
+ localStorage.remove(storageName);
12451
12455
  const popup = window.open(this._buildRedirectUrl(), ImplicitFlowPopup.popupWindowName, this.windowOptions);
12452
12456
  const ticker = setInterval(() => {
12453
- if (popup.closed) {
12454
- reject(new OAuthError["default"]('window_closed', 'Pop-up window was closed before data could be extracted'));
12455
- }
12456
-
12457
- let done = false;
12457
+ const locationHash = localStorage.get(storageName);
12458
12458
 
12459
- try {
12460
- done = !['', 'about:blank'].includes(popup.location.href);
12461
- } catch (e) {// Nothing
12462
- }
12463
-
12464
- if (done) {
12459
+ if (locationHash) {
12465
12460
  clearInterval(ticker);
12466
12461
 
12467
- const data = this._getAnchorParams(popup.location.hash);
12462
+ const data = this._getAnchorParams(locationHash);
12463
+
12464
+ localStorage.remove(storageName);
12468
12465
 
12469
- popup.close();
12466
+ try {
12467
+ popup.close();
12468
+ } catch (e) {// cloudflare intercepted or closed manually
12469
+ }
12470
12470
 
12471
12471
  if (data.error) {
12472
12472
  reject(new OAuthError["default"](data.error, data.message));
@@ -12660,7 +12660,7 @@ var DummyFlow = __webpack_require__(72);
12660
12660
  // EXTERNAL MODULE: ./src/errors/ApiError.js
12661
12661
  var ApiError = __webpack_require__(62);
12662
12662
  // EXTERNAL MODULE: ./src/errors/AbstractError.js
12663
- var AbstractError = __webpack_require__(21);
12663
+ var AbstractError = __webpack_require__(22);
12664
12664
  // EXTERNAL MODULE: ./src/errors/ValidationError.js
12665
12665
  var ValidationError = __webpack_require__(74);
12666
12666
  // EXTERNAL MODULE: ./src/errors/StaticClassError.js
@@ -12746,7 +12746,7 @@ var proxy = __webpack_require__(71);
12746
12746
  * @private
12747
12747
  */
12748
12748
 
12749
- const version = "v3.3.1";
12749
+ const version = "b8d270c";
12750
12750
  })();
12751
12751
 
12752
12752
  module.exports = __webpack_exports__;