@micromag/data 0.3.497 → 0.3.505
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 +8 -12
- package/lib/index.js +11 -15
- package/package.json +3 -3
package/es/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var Base = /*#__PURE__*/function () {
|
|
|
24
24
|
baseUrl: opts.baseUrl || 'https://micromag.ca/api'
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
_createClass(Base, [{
|
|
27
|
+
return _createClass(Base, [{
|
|
28
28
|
key: "requestGet",
|
|
29
29
|
value: function requestGet(path) {
|
|
30
30
|
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -74,12 +74,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
74
74
|
return "".concat(baseUrl.replace(/\/$/, ''), "/").concat(path.replace(/^\//, ''));
|
|
75
75
|
}
|
|
76
76
|
}]);
|
|
77
|
-
return Base;
|
|
78
77
|
}();
|
|
79
78
|
var Base$1 = Base;
|
|
80
79
|
|
|
81
80
|
var ContributionsApi = /*#__PURE__*/function (_Base) {
|
|
82
|
-
_inherits(ContributionsApi, _Base);
|
|
83
81
|
function ContributionsApi() {
|
|
84
82
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
85
83
|
_classCallCheck(this, ContributionsApi);
|
|
@@ -92,7 +90,8 @@ var ContributionsApi = /*#__PURE__*/function (_Base) {
|
|
|
92
90
|
}, opts.routes || null)
|
|
93
91
|
})]);
|
|
94
92
|
}
|
|
95
|
-
|
|
93
|
+
_inherits(ContributionsApi, _Base);
|
|
94
|
+
return _createClass(ContributionsApi, [{
|
|
96
95
|
key: "get",
|
|
97
96
|
value: function get(id) {
|
|
98
97
|
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -115,11 +114,9 @@ var ContributionsApi = /*#__PURE__*/function (_Base) {
|
|
|
115
114
|
return this.requestPost(this.route('store'), data);
|
|
116
115
|
}
|
|
117
116
|
}]);
|
|
118
|
-
return ContributionsApi;
|
|
119
117
|
}(Base$1);
|
|
120
118
|
|
|
121
119
|
var MediasApi = /*#__PURE__*/function (_Base) {
|
|
122
|
-
_inherits(MediasApi, _Base);
|
|
123
120
|
function MediasApi() {
|
|
124
121
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
125
122
|
_classCallCheck(this, MediasApi);
|
|
@@ -136,7 +133,8 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
136
133
|
}, opts.routes || null)
|
|
137
134
|
})]);
|
|
138
135
|
}
|
|
139
|
-
|
|
136
|
+
_inherits(MediasApi, _Base);
|
|
137
|
+
return _createClass(MediasApi, [{
|
|
140
138
|
key: "find",
|
|
141
139
|
value: function find(id) {
|
|
142
140
|
return this.requestGet(this.route('show', {
|
|
@@ -207,11 +205,9 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
207
205
|
}));
|
|
208
206
|
}
|
|
209
207
|
}]);
|
|
210
|
-
return MediasApi;
|
|
211
208
|
}(Base$1);
|
|
212
209
|
|
|
213
210
|
var QuizApi = /*#__PURE__*/function (_Base) {
|
|
214
|
-
_inherits(QuizApi, _Base);
|
|
215
211
|
function QuizApi() {
|
|
216
212
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
217
213
|
_classCallCheck(this, QuizApi);
|
|
@@ -224,7 +220,8 @@ var QuizApi = /*#__PURE__*/function (_Base) {
|
|
|
224
220
|
}, opts.routes || null)
|
|
225
221
|
})]);
|
|
226
222
|
}
|
|
227
|
-
|
|
223
|
+
_inherits(QuizApi, _Base);
|
|
224
|
+
return _createClass(QuizApi, [{
|
|
228
225
|
key: "results",
|
|
229
226
|
value: function results(screenId) {
|
|
230
227
|
return this.requestGet(this.route('results', {
|
|
@@ -237,11 +234,9 @@ var QuizApi = /*#__PURE__*/function (_Base) {
|
|
|
237
234
|
return this.requestPost(this.route('store'), data);
|
|
238
235
|
}
|
|
239
236
|
}]);
|
|
240
|
-
return QuizApi;
|
|
241
237
|
}(Base$1);
|
|
242
238
|
|
|
243
239
|
var Api = /*#__PURE__*/function (_Base) {
|
|
244
|
-
_inherits(Api, _Base);
|
|
245
240
|
function Api() {
|
|
246
241
|
var _this;
|
|
247
242
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -252,6 +247,7 @@ var Api = /*#__PURE__*/function (_Base) {
|
|
|
252
247
|
_this.quiz = new QuizApi(opts);
|
|
253
248
|
return _this;
|
|
254
249
|
}
|
|
250
|
+
_inherits(Api, _Base);
|
|
255
251
|
return _createClass(Api);
|
|
256
252
|
}(Base$1);
|
|
257
253
|
var Api$1 = Api;
|
package/lib/index.js
CHANGED
|
@@ -24,12 +24,12 @@ var contexts = require('@micromag/core/contexts');
|
|
|
24
24
|
var compilers = {};
|
|
25
25
|
function generatePath(fullPath, data) {
|
|
26
26
|
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
27
|
-
var fullUrlMatches = fullPath.match(/^(https?:\/\/
|
|
27
|
+
var fullUrlMatches = fullPath.match(/^(https?:\/\/)/);
|
|
28
28
|
if (typeof compilers[fullPath] === 'undefined') {
|
|
29
|
-
compilers[fullPath] = pathToRegexp.compile(fullPath.replace(/^(https?:\/\/
|
|
29
|
+
compilers[fullPath] = pathToRegexp.compile(fullPath.replace(/^(https?:\/\/)/, ''), opts);
|
|
30
30
|
}
|
|
31
31
|
var compiler = compilers[fullPath];
|
|
32
|
-
return fullUrlMatches !== null ? "".concat(fullUrlMatches[1]
|
|
32
|
+
return fullUrlMatches !== null ? "".concat(fullUrlMatches[1]).concat(compiler(data)) : compiler(data);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
var Base = /*#__PURE__*/function () {
|
|
@@ -42,7 +42,7 @@ var Base = /*#__PURE__*/function () {
|
|
|
42
42
|
baseUrl: opts.baseUrl || 'https://micromag.ca/api'
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
_createClass(Base, [{
|
|
45
|
+
return _createClass(Base, [{
|
|
46
46
|
key: "requestGet",
|
|
47
47
|
value: function requestGet(path) {
|
|
48
48
|
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -92,12 +92,10 @@ var Base = /*#__PURE__*/function () {
|
|
|
92
92
|
return "".concat(baseUrl.replace(/\/$/, ''), "/").concat(path.replace(/^\//, ''));
|
|
93
93
|
}
|
|
94
94
|
}]);
|
|
95
|
-
return Base;
|
|
96
95
|
}();
|
|
97
96
|
var Base$1 = Base;
|
|
98
97
|
|
|
99
98
|
var ContributionsApi = /*#__PURE__*/function (_Base) {
|
|
100
|
-
_inherits(ContributionsApi, _Base);
|
|
101
99
|
function ContributionsApi() {
|
|
102
100
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
103
101
|
_classCallCheck(this, ContributionsApi);
|
|
@@ -110,7 +108,8 @@ var ContributionsApi = /*#__PURE__*/function (_Base) {
|
|
|
110
108
|
}, opts.routes || null)
|
|
111
109
|
})]);
|
|
112
110
|
}
|
|
113
|
-
|
|
111
|
+
_inherits(ContributionsApi, _Base);
|
|
112
|
+
return _createClass(ContributionsApi, [{
|
|
114
113
|
key: "get",
|
|
115
114
|
value: function get(id) {
|
|
116
115
|
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -133,11 +132,9 @@ var ContributionsApi = /*#__PURE__*/function (_Base) {
|
|
|
133
132
|
return this.requestPost(this.route('store'), data);
|
|
134
133
|
}
|
|
135
134
|
}]);
|
|
136
|
-
return ContributionsApi;
|
|
137
135
|
}(Base$1);
|
|
138
136
|
|
|
139
137
|
var MediasApi = /*#__PURE__*/function (_Base) {
|
|
140
|
-
_inherits(MediasApi, _Base);
|
|
141
138
|
function MediasApi() {
|
|
142
139
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
143
140
|
_classCallCheck(this, MediasApi);
|
|
@@ -154,7 +151,8 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
154
151
|
}, opts.routes || null)
|
|
155
152
|
})]);
|
|
156
153
|
}
|
|
157
|
-
|
|
154
|
+
_inherits(MediasApi, _Base);
|
|
155
|
+
return _createClass(MediasApi, [{
|
|
158
156
|
key: "find",
|
|
159
157
|
value: function find(id) {
|
|
160
158
|
return this.requestGet(this.route('show', {
|
|
@@ -225,11 +223,9 @@ var MediasApi = /*#__PURE__*/function (_Base) {
|
|
|
225
223
|
}));
|
|
226
224
|
}
|
|
227
225
|
}]);
|
|
228
|
-
return MediasApi;
|
|
229
226
|
}(Base$1);
|
|
230
227
|
|
|
231
228
|
var QuizApi = /*#__PURE__*/function (_Base) {
|
|
232
|
-
_inherits(QuizApi, _Base);
|
|
233
229
|
function QuizApi() {
|
|
234
230
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
235
231
|
_classCallCheck(this, QuizApi);
|
|
@@ -242,7 +238,8 @@ var QuizApi = /*#__PURE__*/function (_Base) {
|
|
|
242
238
|
}, opts.routes || null)
|
|
243
239
|
})]);
|
|
244
240
|
}
|
|
245
|
-
|
|
241
|
+
_inherits(QuizApi, _Base);
|
|
242
|
+
return _createClass(QuizApi, [{
|
|
246
243
|
key: "results",
|
|
247
244
|
value: function results(screenId) {
|
|
248
245
|
return this.requestGet(this.route('results', {
|
|
@@ -255,11 +252,9 @@ var QuizApi = /*#__PURE__*/function (_Base) {
|
|
|
255
252
|
return this.requestPost(this.route('store'), data);
|
|
256
253
|
}
|
|
257
254
|
}]);
|
|
258
|
-
return QuizApi;
|
|
259
255
|
}(Base$1);
|
|
260
256
|
|
|
261
257
|
var Api = /*#__PURE__*/function (_Base) {
|
|
262
|
-
_inherits(Api, _Base);
|
|
263
258
|
function Api() {
|
|
264
259
|
var _this;
|
|
265
260
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -270,6 +265,7 @@ var Api = /*#__PURE__*/function (_Base) {
|
|
|
270
265
|
_this.quiz = new QuizApi(opts);
|
|
271
266
|
return _this;
|
|
272
267
|
}
|
|
268
|
+
_inherits(Api, _Base);
|
|
273
269
|
return _createClass(Api);
|
|
274
270
|
}(Base$1);
|
|
275
271
|
var Api$1 = Api;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/data",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.505",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@babel/runtime": "^7.13.10",
|
|
61
61
|
"@folklore/fetch": "^0.1.17",
|
|
62
62
|
"@folklore/routes": "^0.2.27",
|
|
63
|
-
"@micromag/core": "^0.3.
|
|
63
|
+
"@micromag/core": "^0.3.505",
|
|
64
64
|
"lodash": "^4.17.21",
|
|
65
65
|
"prop-types": "^15.7.2",
|
|
66
66
|
"query-string": "^6.13.7"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"access": "public",
|
|
70
70
|
"registry": "https://registry.npmjs.org/"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "f16e0f95385c69df3b07b182c70a9f0eb56cbe3a"
|
|
73
73
|
}
|