@panneau/data 3.0.142 → 3.0.146
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/es/index.js +10 -19
- package/lib/index.js +13 -22
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { useUrlGenerator } from '@panneau/core/contexts';
|
|
|
4
4
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
5
5
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
6
6
|
import _callSuper from '@babel/runtime/helpers/callSuper';
|
|
7
|
-
import _assertThisInitialized from '@babel/runtime/helpers/assertThisInitialized';
|
|
8
7
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
9
8
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
10
9
|
import { getCSRFHeaders, getJSON, postJSON } from '@folklore/fetch';
|
|
@@ -356,7 +355,7 @@ var AccountApi = /*#__PURE__*/function () {
|
|
|
356
355
|
withCredentials: false
|
|
357
356
|
}, opts);
|
|
358
357
|
}
|
|
359
|
-
_createClass(AccountApi, [{
|
|
358
|
+
return _createClass(AccountApi, [{
|
|
360
359
|
key: "update",
|
|
361
360
|
value: function update(data) {
|
|
362
361
|
var withCredentials = this.options.withCredentials;
|
|
@@ -393,9 +392,7 @@ var AccountApi = /*#__PURE__*/function () {
|
|
|
393
392
|
});
|
|
394
393
|
}
|
|
395
394
|
}]);
|
|
396
|
-
return AccountApi;
|
|
397
395
|
}();
|
|
398
|
-
var AccountApi$1 = AccountApi;
|
|
399
396
|
|
|
400
397
|
var AuthApi = /*#__PURE__*/function () {
|
|
401
398
|
function AuthApi(api, opts) {
|
|
@@ -405,7 +402,7 @@ var AuthApi = /*#__PURE__*/function () {
|
|
|
405
402
|
withCredentials: true
|
|
406
403
|
}, opts);
|
|
407
404
|
}
|
|
408
|
-
_createClass(AuthApi, [{
|
|
405
|
+
return _createClass(AuthApi, [{
|
|
409
406
|
key: "check",
|
|
410
407
|
value: function check() {
|
|
411
408
|
var withCredentials = this.options.withCredentials;
|
|
@@ -469,9 +466,7 @@ var AuthApi = /*#__PURE__*/function () {
|
|
|
469
466
|
});
|
|
470
467
|
}
|
|
471
468
|
}]);
|
|
472
|
-
return AuthApi;
|
|
473
469
|
}();
|
|
474
|
-
var AuthApi$1 = AuthApi;
|
|
475
470
|
|
|
476
471
|
var Base = /*#__PURE__*/function () {
|
|
477
472
|
function Base() {
|
|
@@ -485,7 +480,7 @@ var Base = /*#__PURE__*/function () {
|
|
|
485
480
|
onUnauthorized: opts.onUnauthorized || null
|
|
486
481
|
});
|
|
487
482
|
}
|
|
488
|
-
_createClass(Base, [{
|
|
483
|
+
return _createClass(Base, [{
|
|
489
484
|
key: "requestGet",
|
|
490
485
|
value: function requestGet(path) {
|
|
491
486
|
var _this = this;
|
|
@@ -586,12 +581,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
586
581
|
throw err;
|
|
587
582
|
}
|
|
588
583
|
}]);
|
|
589
|
-
return Base;
|
|
590
584
|
}();
|
|
591
585
|
var Base$1 = Base;
|
|
592
586
|
|
|
593
587
|
var MediasApi = /*#__PURE__*/function (_Base) {
|
|
594
|
-
_inherits(MediasApi, _Base);
|
|
595
588
|
function MediasApi() {
|
|
596
589
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
597
590
|
_classCallCheck(this, MediasApi);
|
|
@@ -607,7 +600,8 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
607
600
|
}, opts.routes || null)
|
|
608
601
|
}]); // console.log('opts', opts);
|
|
609
602
|
}
|
|
610
|
-
|
|
603
|
+
_inherits(MediasApi, _Base);
|
|
604
|
+
return _createClass(MediasApi, [{
|
|
611
605
|
key: "find",
|
|
612
606
|
value: function find(id) {
|
|
613
607
|
return this.requestGet(this.route('show', {
|
|
@@ -660,7 +654,6 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
660
654
|
}));
|
|
661
655
|
}
|
|
662
656
|
}]);
|
|
663
|
-
return MediasApi;
|
|
664
657
|
}(Base$1);
|
|
665
658
|
|
|
666
659
|
var ResourcesApi = /*#__PURE__*/function () {
|
|
@@ -668,7 +661,7 @@ var ResourcesApi = /*#__PURE__*/function () {
|
|
|
668
661
|
_classCallCheck(this, ResourcesApi);
|
|
669
662
|
this.api = api;
|
|
670
663
|
}
|
|
671
|
-
_createClass(ResourcesApi, [{
|
|
664
|
+
return _createClass(ResourcesApi, [{
|
|
672
665
|
key: "resourceRoute",
|
|
673
666
|
value: function resourceRoute(_ref, route, params) {
|
|
674
667
|
var id = _ref.id,
|
|
@@ -731,29 +724,27 @@ var ResourcesApi = /*#__PURE__*/function () {
|
|
|
731
724
|
});
|
|
732
725
|
}
|
|
733
726
|
}]);
|
|
734
|
-
return ResourcesApi;
|
|
735
727
|
}();
|
|
736
|
-
var ResourcesApi$1 = ResourcesApi;
|
|
737
728
|
|
|
738
729
|
var Api = /*#__PURE__*/function (_Base) {
|
|
739
|
-
_inherits(Api, _Base);
|
|
740
730
|
function Api() {
|
|
741
731
|
var _this;
|
|
742
732
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
743
733
|
_classCallCheck(this, Api);
|
|
744
734
|
_this = _callSuper(this, Api, [opts]);
|
|
745
|
-
_this.auth = new AuthApi
|
|
735
|
+
_this.auth = new AuthApi(_this, {
|
|
746
736
|
withCredentials: true
|
|
747
737
|
});
|
|
748
|
-
_this.account = new AccountApi
|
|
738
|
+
_this.account = new AccountApi(_this, {
|
|
749
739
|
withCredentials: true
|
|
750
740
|
});
|
|
751
741
|
_this.medias = new MediasApi(opts);
|
|
752
|
-
_this.resources = new ResourcesApi
|
|
742
|
+
_this.resources = new ResourcesApi(_this);
|
|
753
743
|
// console.log('opts', opts);
|
|
754
744
|
// console.log('this', this);
|
|
755
745
|
return _this;
|
|
756
746
|
}
|
|
747
|
+
_inherits(Api, _Base);
|
|
757
748
|
return _createClass(Api);
|
|
758
749
|
}(Base$1);
|
|
759
750
|
var Api$1 = Api;
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,6 @@ var contexts = require('@panneau/core/contexts');
|
|
|
6
6
|
var _createClass = require('@babel/runtime/helpers/createClass');
|
|
7
7
|
var _classCallCheck = require('@babel/runtime/helpers/classCallCheck');
|
|
8
8
|
var _callSuper = require('@babel/runtime/helpers/callSuper');
|
|
9
|
-
var _assertThisInitialized = require('@babel/runtime/helpers/assertThisInitialized');
|
|
10
9
|
var _inherits = require('@babel/runtime/helpers/inherits');
|
|
11
10
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
12
11
|
var fetch$1 = require('@folklore/fetch');
|
|
@@ -359,7 +358,7 @@ var AccountApi = /*#__PURE__*/function () {
|
|
|
359
358
|
withCredentials: false
|
|
360
359
|
}, opts);
|
|
361
360
|
}
|
|
362
|
-
_createClass(AccountApi, [{
|
|
361
|
+
return _createClass(AccountApi, [{
|
|
363
362
|
key: "update",
|
|
364
363
|
value: function update(data) {
|
|
365
364
|
var withCredentials = this.options.withCredentials;
|
|
@@ -396,9 +395,7 @@ var AccountApi = /*#__PURE__*/function () {
|
|
|
396
395
|
});
|
|
397
396
|
}
|
|
398
397
|
}]);
|
|
399
|
-
return AccountApi;
|
|
400
398
|
}();
|
|
401
|
-
var AccountApi$1 = AccountApi;
|
|
402
399
|
|
|
403
400
|
var AuthApi = /*#__PURE__*/function () {
|
|
404
401
|
function AuthApi(api, opts) {
|
|
@@ -408,7 +405,7 @@ var AuthApi = /*#__PURE__*/function () {
|
|
|
408
405
|
withCredentials: true
|
|
409
406
|
}, opts);
|
|
410
407
|
}
|
|
411
|
-
_createClass(AuthApi, [{
|
|
408
|
+
return _createClass(AuthApi, [{
|
|
412
409
|
key: "check",
|
|
413
410
|
value: function check() {
|
|
414
411
|
var withCredentials = this.options.withCredentials;
|
|
@@ -472,9 +469,7 @@ var AuthApi = /*#__PURE__*/function () {
|
|
|
472
469
|
});
|
|
473
470
|
}
|
|
474
471
|
}]);
|
|
475
|
-
return AuthApi;
|
|
476
472
|
}();
|
|
477
|
-
var AuthApi$1 = AuthApi;
|
|
478
473
|
|
|
479
474
|
({
|
|
480
475
|
children: PropTypes.node.isRequired,
|
|
@@ -484,12 +479,12 @@ var AuthApi$1 = AuthApi;
|
|
|
484
479
|
var compilers = {};
|
|
485
480
|
function generatePath(fullPath, data) {
|
|
486
481
|
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
487
|
-
var fullUrlMatches = fullPath.match(/^(https?:\/\/
|
|
482
|
+
var fullUrlMatches = fullPath.match(/^(https?:\/\/)/);
|
|
488
483
|
if (typeof compilers[fullPath] === 'undefined') {
|
|
489
|
-
compilers[fullPath] = pathToRegexp.compile(fullPath.replace(/^(https?:\/\/
|
|
484
|
+
compilers[fullPath] = pathToRegexp.compile(fullPath.replace(/^(https?:\/\/)/, ''), opts);
|
|
490
485
|
}
|
|
491
486
|
var compiler = compilers[fullPath];
|
|
492
|
-
return fullUrlMatches !== null ? "".concat(fullUrlMatches[1]
|
|
487
|
+
return fullUrlMatches !== null ? "".concat(fullUrlMatches[1]).concat(compiler(data)) : compiler(data);
|
|
493
488
|
}
|
|
494
489
|
|
|
495
490
|
var token = '%[a-f0-9]{2}';
|
|
@@ -1165,7 +1160,7 @@ var Base = /*#__PURE__*/function () {
|
|
|
1165
1160
|
onUnauthorized: opts.onUnauthorized || null
|
|
1166
1161
|
});
|
|
1167
1162
|
}
|
|
1168
|
-
_createClass(Base, [{
|
|
1163
|
+
return _createClass(Base, [{
|
|
1169
1164
|
key: "requestGet",
|
|
1170
1165
|
value: function requestGet(path) {
|
|
1171
1166
|
var _this = this;
|
|
@@ -1266,12 +1261,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
1266
1261
|
throw err;
|
|
1267
1262
|
}
|
|
1268
1263
|
}]);
|
|
1269
|
-
return Base;
|
|
1270
1264
|
}();
|
|
1271
1265
|
var Base$1 = Base;
|
|
1272
1266
|
|
|
1273
1267
|
var MediasApi = /*#__PURE__*/function (_Base) {
|
|
1274
|
-
_inherits(MediasApi, _Base);
|
|
1275
1268
|
function MediasApi() {
|
|
1276
1269
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1277
1270
|
_classCallCheck(this, MediasApi);
|
|
@@ -1287,7 +1280,8 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
1287
1280
|
}, opts.routes || null)
|
|
1288
1281
|
}]); // console.log('opts', opts);
|
|
1289
1282
|
}
|
|
1290
|
-
|
|
1283
|
+
_inherits(MediasApi, _Base);
|
|
1284
|
+
return _createClass(MediasApi, [{
|
|
1291
1285
|
key: "find",
|
|
1292
1286
|
value: function find(id) {
|
|
1293
1287
|
return this.requestGet(this.route('show', {
|
|
@@ -1340,7 +1334,6 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
1340
1334
|
}));
|
|
1341
1335
|
}
|
|
1342
1336
|
}]);
|
|
1343
|
-
return MediasApi;
|
|
1344
1337
|
}(Base$1);
|
|
1345
1338
|
|
|
1346
1339
|
var ResourcesApi = /*#__PURE__*/function () {
|
|
@@ -1348,7 +1341,7 @@ var ResourcesApi = /*#__PURE__*/function () {
|
|
|
1348
1341
|
_classCallCheck(this, ResourcesApi);
|
|
1349
1342
|
this.api = api;
|
|
1350
1343
|
}
|
|
1351
|
-
_createClass(ResourcesApi, [{
|
|
1344
|
+
return _createClass(ResourcesApi, [{
|
|
1352
1345
|
key: "resourceRoute",
|
|
1353
1346
|
value: function resourceRoute(_ref, route, params) {
|
|
1354
1347
|
var id = _ref.id,
|
|
@@ -1411,29 +1404,27 @@ var ResourcesApi = /*#__PURE__*/function () {
|
|
|
1411
1404
|
});
|
|
1412
1405
|
}
|
|
1413
1406
|
}]);
|
|
1414
|
-
return ResourcesApi;
|
|
1415
1407
|
}();
|
|
1416
|
-
var ResourcesApi$1 = ResourcesApi;
|
|
1417
1408
|
|
|
1418
1409
|
var Api = /*#__PURE__*/function (_Base) {
|
|
1419
|
-
_inherits(Api, _Base);
|
|
1420
1410
|
function Api() {
|
|
1421
1411
|
var _this;
|
|
1422
1412
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1423
1413
|
_classCallCheck(this, Api);
|
|
1424
1414
|
_this = _callSuper(this, Api, [opts]);
|
|
1425
|
-
_this.auth = new AuthApi
|
|
1415
|
+
_this.auth = new AuthApi(_this, {
|
|
1426
1416
|
withCredentials: true
|
|
1427
1417
|
});
|
|
1428
|
-
_this.account = new AccountApi
|
|
1418
|
+
_this.account = new AccountApi(_this, {
|
|
1429
1419
|
withCredentials: true
|
|
1430
1420
|
});
|
|
1431
1421
|
_this.medias = new MediasApi(opts);
|
|
1432
|
-
_this.resources = new ResourcesApi
|
|
1422
|
+
_this.resources = new ResourcesApi(_this);
|
|
1433
1423
|
// console.log('opts', opts);
|
|
1434
1424
|
// console.log('this', this);
|
|
1435
1425
|
return _this;
|
|
1436
1426
|
}
|
|
1427
|
+
_inherits(Api, _Base);
|
|
1437
1428
|
return _createClass(Api);
|
|
1438
1429
|
}(Base$1);
|
|
1439
1430
|
var Api$1 = Api;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/data",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.146",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"@babel/runtime": "^7.12.5",
|
|
57
57
|
"@folklore/fetch": "^0.1.17",
|
|
58
58
|
"@folklore/routes": "^0.2.26",
|
|
59
|
-
"@panneau/core": "^3.0.
|
|
59
|
+
"@panneau/core": "^3.0.146",
|
|
60
60
|
"prop-types": "^15.7.2",
|
|
61
61
|
"query-string": "^9.0.0"
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "6cb6250299f5e725b74a20195fe6e66fe803bafc"
|
|
67
67
|
}
|