museria 0.2.49 → 0.3.2

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.
Files changed (74) hide show
  1. package/.eslintrc +10 -2
  2. package/.github/workflows/build.yml +3 -3
  3. package/.github/workflows/publish.yml +3 -3
  4. package/README.md +55 -59
  5. package/bin/actions.js +28 -28
  6. package/bin/index.js +4 -4
  7. package/bin/runner.js +1 -1
  8. package/bin/utils.js +6 -2
  9. package/dist/client/museria.client.js +7 -7
  10. package/dist/face/45a265d0f07b31cde85f.ttf +0 -0
  11. package/dist/face/6205fd00fb1b573e9f0f.ttf +0 -0
  12. package/dist/face/8d3cabfc66809162fb4d.woff2 +0 -0
  13. package/dist/face/fb8184add5a3101ad0a3.woff2 +0 -0
  14. package/dist/face/museria.face.js +33 -13
  15. package/dist/face/style.css +13 -11
  16. package/package.json +41 -40
  17. package/src/browser/client/index.js +2 -1
  18. package/src/browser/face/client.js +2 -1
  19. package/src/browser/face/controllers/app/app.html +77 -69
  20. package/src/browser/face/controllers/app/app.js +14 -7
  21. package/src/browser/face/controllers/app/app.scss +2 -22
  22. package/src/browser/face/index.js +3 -3
  23. package/src/browser/face/styles/main.scss +91 -11
  24. package/src/browser/face/styles/vars.scss +0 -1
  25. package/src/client.js +73 -74
  26. package/src/collection/transports/music/index.js +20 -18
  27. package/src/db/transports/database/index.js +7 -5
  28. package/src/db/transports/loki/index.js +30 -25
  29. package/src/errors.js +2 -1
  30. package/src/index.js +8 -6
  31. package/src/node.js +312 -323
  32. package/src/schema.js +27 -29
  33. package/src/server/transports/express/api/butler/controllers.js +7 -10
  34. package/src/server/transports/express/api/butler/routes.js +5 -5
  35. package/src/server/transports/express/api/master/controllers.js +7 -10
  36. package/src/server/transports/express/api/master/routes.js +5 -5
  37. package/src/server/transports/express/api/node/controllers.js +52 -61
  38. package/src/server/transports/express/api/node/routes.js +10 -10
  39. package/src/server/transports/express/api/routes.js +1 -1
  40. package/src/server/transports/express/api/slave/controllers.js +7 -10
  41. package/src/server/transports/express/api/slave/routes.js +6 -6
  42. package/src/server/transports/express/client/controllers.js +40 -61
  43. package/src/server/transports/express/client/routes.js +33 -39
  44. package/src/server/transports/express/controllers.js +10 -21
  45. package/src/server/transports/express/index.js +23 -20
  46. package/src/server/transports/express/midds.js +67 -67
  47. package/src/server/transports/express/routes.js +12 -12
  48. package/src/utils.js +175 -184
  49. package/test/client.js +311 -305
  50. package/test/db/database.js +32 -28
  51. package/test/db/loki.js +78 -74
  52. package/test/group.js +161 -156
  53. package/test/index.js +20 -10
  54. package/test/node.js +461 -460
  55. package/test/routes.js +404 -399
  56. package/test/server/express.js +35 -31
  57. package/test/services.js +25 -18
  58. package/test/tools.js +8 -6
  59. package/test/utils.js +236 -234
  60. package/webpack.client.js +9 -7
  61. package/webpack.face.js +8 -6
  62. package/dist/face/fa-brands-400.eot +0 -0
  63. package/dist/face/fa-brands-400.svg +0 -3717
  64. package/dist/face/fa-brands-400.ttf +0 -0
  65. package/dist/face/fa-brands-400.woff +0 -0
  66. package/dist/face/fa-brands-400.woff2 +0 -0
  67. package/dist/face/fa-solid-900.eot +0 -0
  68. package/dist/face/fa-solid-900.svg +0 -5034
  69. package/dist/face/fa-solid-900.ttf +0 -0
  70. package/dist/face/fa-solid-900.woff +0 -0
  71. package/dist/face/fa-solid-900.woff2 +0 -0
  72. /package/dist/face/{open-sans.ttf → 17e98b9e5586529b13cc.ttf} +0 -0
  73. /package/dist/face/{proxima-nova.ttf → 326601dfabd91e3f016c.ttf} +0 -0
  74. /package/dist/face/{logo.svg → ee9c6af64aa224827cec.svg} +0 -0
package/src/client.js CHANGED
@@ -1,22 +1,24 @@
1
- const fs = require('fs');
2
- const merge = require('lodash/merge');
3
- const omit = require('lodash/omit');
4
- const ClientMetastocle= require('metastocle/src/client')();
5
- const ClientStoracle = require('storacle/src/client')(ClientMetastocle);
6
- const utils = require('./utils');
7
- const errors = require('./errors');
8
- const pack = require('../package.json');
9
-
10
- module.exports = (Parent) => {
1
+ import fse from "fs-extra";
2
+ import { merge, omit } from "lodash-es";
3
+ import clientMetastocle from "metastocle/src/client.js";
4
+ import clientStoracle from "storacle/src/client.js";
5
+ import pack from "../package.json" with { type: "json" };
6
+ import errors from "./errors.js";
7
+ import utils from "./utils.js";
8
+
9
+ const ClientMetastocle = clientMetastocle();
10
+ const ClientStoracle = clientStoracle(ClientMetastocle);
11
+
12
+ export default (Parent) => {
11
13
  /**
12
14
  * Class to manage client requests to the network
13
15
  */
14
16
  return class ClientMuseria extends (Parent || ClientStoracle) {
15
- static get version () { return pack.version }
16
- static get codename () { return pack.name }
17
- static get utils () { return utils }
18
- static get errors () { return errors }
19
-
17
+ static get version() { return pack.version; }
18
+ static get codename() { return pack.name; }
19
+ static get utils() { return utils; }
20
+ static get errors() { return errors; }
21
+
20
22
  constructor(options = {}) {
21
23
  options = merge({
22
24
  request: {
@@ -25,11 +27,11 @@ module.exports = (Parent) => {
25
27
  }
26
28
  }, options);
27
29
  super(options);
28
- }
29
-
30
+ }
31
+
30
32
  /**
31
33
  * Get the song complete info
32
- *
34
+ *
33
35
  * @async
34
36
  * @param {string} title
35
37
  * @param {object} [options]
@@ -46,14 +48,14 @@ module.exports = (Parent) => {
46
48
 
47
49
  /**
48
50
  * Find songs
49
- *
51
+ *
50
52
  * @async
51
53
  * @param {string} str
52
54
  * @param {object} [options]
53
55
  * @param {number} [options.limit]
54
56
  * @returns {object[]}
55
57
  */
56
- async findSongs(str, options = {}) {
58
+ async findSongs(str, options = {}) {
57
59
  const result = await this.request('find-songs', Object.assign({}, options, {
58
60
  body: { str, limit: options.limit },
59
61
  timeout: options.timeout || this.options.request.documentGettingTimeout
@@ -64,13 +66,13 @@ module.exports = (Parent) => {
64
66
 
65
67
  /**
66
68
  * Find artist songs
67
- *
69
+ *
68
70
  * @async
69
71
  * @param {string} artist
70
72
  * @param {object} [options]
71
73
  * @returns {object[]}
72
74
  */
73
- async findArtistSongs(artist, options = {}) {
75
+ async findArtistSongs(artist, options = {}) {
74
76
  const result = await this.request('find-artist-songs', Object.assign({}, options, {
75
77
  body: { artist },
76
78
  timeout: options.timeout || this.options.request.documentGettingTimeout
@@ -81,7 +83,7 @@ module.exports = (Parent) => {
81
83
 
82
84
  /**
83
85
  * Get the song main info
84
- *
86
+ *
85
87
  * @async
86
88
  * @param {string} title
87
89
  * @param {object} [options]
@@ -93,18 +95,18 @@ module.exports = (Parent) => {
93
95
  timeout: options.timeout || this.options.request.documentGettingTimeout
94
96
  }));
95
97
 
96
- if(!result.info.length) {
98
+ if (!result.info.length) {
97
99
  return null;
98
100
  }
99
101
 
100
102
  let obj = { tags: {} };
101
103
 
102
- for(let i = result.info.length - 1; i >= 0; i--) {
104
+ for (let i = result.info.length - 1; i >= 0; i--) {
103
105
  const info = result.info[i];
104
106
  !info.coverLink && delete info.coverLink;
105
- const tags = utils.mergeSongTags(obj.tags, info.tags);
107
+ const tags = utils.mergeSongTags(obj.tags, info.tags);
106
108
  obj = Object.assign(obj, info);
107
- obj.tags = tags;
109
+ obj.tags = tags;
108
110
  }
109
111
 
110
112
  return obj;
@@ -112,7 +114,7 @@ module.exports = (Parent) => {
112
114
 
113
115
  /**
114
116
  * Get the song audio link
115
- *
117
+ *
116
118
  * @async
117
119
  * @param {string} title
118
120
  * @param {object} [options]
@@ -127,7 +129,7 @@ module.exports = (Parent) => {
127
129
 
128
130
  /**
129
131
  * Get the song cover link
130
- *
132
+ *
131
133
  * @async
132
134
  * @param {string} title
133
135
  * @param {object} [options]
@@ -142,7 +144,7 @@ module.exports = (Parent) => {
142
144
 
143
145
  /**
144
146
  * Get the song to a buffer
145
- *
147
+ *
146
148
  * @param {string} title
147
149
  * @param {string} type
148
150
  * @param {object} [options]
@@ -150,13 +152,13 @@ module.exports = (Parent) => {
150
152
  */
151
153
  async getSongToBuffer(title, type, options = {}) {
152
154
  this.envTest(false, 'getSongToBuffer');
153
- const { result, timer } = await this.getSongLinkAndTimer(title, type, options);
155
+ const { result, timer } = await this.getSongLinkAndTimer(title, type, options);
154
156
  return await utils.fetchFileToBuffer(result.link, this.createDefaultRequestOptions({ timeout: timer() }));
155
157
  }
156
-
158
+
157
159
  /**
158
160
  * Get the song audio to a buffer
159
- *
161
+ *
160
162
  * @see ClientMuseria.prototype.getSongToBuffer
161
163
  */
162
164
  async getSongAudioToBuffer(title, options = {}) {
@@ -165,7 +167,7 @@ module.exports = (Parent) => {
165
167
 
166
168
  /**
167
169
  * Get the song cover to a buffer
168
- *
170
+ *
169
171
  * @see ClientMuseria.prototype.getSongToBuffer
170
172
  */
171
173
  async getSongCoverToBuffer(title, options = {}) {
@@ -174,7 +176,7 @@ module.exports = (Parent) => {
174
176
 
175
177
  /**
176
178
  * Get the song to the path
177
- *
179
+ *
178
180
  * @param {string} title
179
181
  * @param {string} filePath
180
182
  * @param {string} type
@@ -183,13 +185,13 @@ module.exports = (Parent) => {
183
185
  */
184
186
  async getSongToPath(title, filePath, type, options = {}) {
185
187
  this.envTest(false, 'getSongToPath');
186
- const { result, timer } = await this.getSongLinkAndTimer(title, type, options);
188
+ const { result, timer } = await this.getSongLinkAndTimer(title, type, options);
187
189
  await utils.fetchFileToPath(filePath, result.link, this.createDefaultRequestOptions({ timeout: timer() }));
188
190
  }
189
191
 
190
192
  /**
191
193
  * Get the song audio to the path
192
- *
194
+ *
193
195
  * @see ClientMuseria.prototype.getSongToPath
194
196
  */
195
197
  async getSongAudioToPath(title, filePath, options = {}) {
@@ -198,16 +200,16 @@ module.exports = (Parent) => {
198
200
 
199
201
  /**
200
202
  * Get the song cover to the path
201
- *
203
+ *
202
204
  * @see ClientMuseria.prototype.getSongToPath
203
205
  */
204
206
  async getSongCoverToPath(title, filePath, options = {}) {
205
- return this.getSongToPath(title, filePath, 'cover', options);
207
+ return this.getSongToPath(title, filePath, 'cover', options);
206
208
  }
207
209
 
208
210
  /**
209
211
  * Get the song to a blob
210
- *
212
+ *
211
213
  * @param {string} title
212
214
  * @param {string} type
213
215
  * @param {object} [options]
@@ -215,13 +217,13 @@ module.exports = (Parent) => {
215
217
  */
216
218
  async getSongToBlob(title, type, options = {}) {
217
219
  this.envTest(true, 'getSongToBlob');
218
- const { result, timer } = await this.getSongLinkAndTimer(title, type, options);
220
+ const { result, timer } = await this.getSongLinkAndTimer(title, type, options);
219
221
  return await utils.fetchFileToBlob(result.link, this.createDefaultRequestOptions({ timeout: timer() }));
220
222
  }
221
223
 
222
224
  /**
223
225
  * Get the song audio to a blob
224
- *
226
+ *
225
227
  * @see ClientMuseria.prototype.getSongToBlob
226
228
  */
227
229
  async getSongAudioToBlob(title, options = {}) {
@@ -230,7 +232,7 @@ module.exports = (Parent) => {
230
232
 
231
233
  /**
232
234
  * Get the song cover to a blob
233
- *
235
+ *
234
236
  * @see ClientMuseria.prototype.getSongToBlob
235
237
  */
236
238
  async getSongCoverToBlob(title, options = {}) {
@@ -249,51 +251,51 @@ module.exports = (Parent) => {
249
251
  async getSongLinkAndTimer(title, type, options) {
250
252
  const timeout = options.timeout || this.options.request.fileGettingTimeout;
251
253
  const timer = this.createRequestTimer(timeout);
252
- const result = await this.request('get-song-link', Object.assign({}, options, {
254
+ const result = await this.request('get-song-link', Object.assign({}, options, {
253
255
  body: { title, type },
254
256
  timeout: timer(this.options.request.fileLinkGettingTimeout)
255
257
  }));
256
-
257
- if(!result.link) {
258
+
259
+ if (!result.link) {
258
260
  throw new errors.WorkError(`Link for song "${title}" is not found`, 'ERR_MUSERIA_NOT_FOUND_LINK');
259
261
  }
260
262
 
261
263
  return {
262
264
  result,
263
265
  timer
264
- }
266
+ };
265
267
  }
266
268
 
267
269
  /**
268
270
  * Store the file to the storage
269
- *
271
+ *
270
272
  * @async
271
- * @param {string|Buffer|fs.ReadStream|Blob|File} file
273
+ * @param {string|Buffer|fse.ReadStream|Blob|File} file
272
274
  * @param {object} [options]
273
275
  * @param {boolean} [options.controlled]
274
276
  * @param {number} [options.priority]
275
277
  */
276
- async addSong(file, options = {}) {
278
+ async addSong(file, options = {}) {
277
279
  const destroyFileStream = () => utils.isFileReadStream(file) && file.destroy();
278
280
 
279
281
  try {
280
- options = Object.assign({
282
+ options = Object.assign({
281
283
  priority: 0,
282
- controlled: false
284
+ controlled: false
283
285
  }, options);
284
286
  const info = await utils.getFileInfo(file);
285
287
  const tags = await utils.getSongTags(file);
286
-
287
- if(!utils.isSongTitle(tags.fullTitle)) {
288
+
289
+ if (!utils.isSongTitle(tags.fullTitle)) {
288
290
  throw new errors.WorkError(`Wrong song title "${tags.fullTitle}"`, 'ERR_MUSERIA_SONG_WRONG_TITLE');
289
291
  }
290
292
 
291
- if(typeof file == 'string') {
292
- file = fs.createReadStream(file);
293
+ if (typeof file == 'string') {
294
+ file = fse.createReadStream(file);
293
295
  }
294
296
 
295
297
  const priority = String(options.priority);
296
- const controlled = options.controlled? '1': '';
298
+ const controlled = options.controlled ? '1' : '';
297
299
  const result = await this.request('add-song', Object.assign({}, omit(options, ['priority']), {
298
300
  formData: {
299
301
  priority,
@@ -301,26 +303,25 @@ module.exports = (Parent) => {
301
303
  file: {
302
304
  value: file,
303
305
  options: {
304
- filename: info.hash + (info.ext? '.' + info.ext: ''),
306
+ filename: info.hash + (info.ext ? '.' + info.ext : ''),
305
307
  contentType: info.mime
306
308
  }
307
309
  }
308
310
  },
309
311
  timeout: options.timeout || this.options.request.fileStoringTimeout
310
312
  }));
311
-
312
313
  destroyFileStream();
313
314
  return result;
314
315
  }
315
- catch(err) {
316
+ catch (err) {
316
317
  destroyFileStream();
317
318
  throw err;
318
319
  }
319
- }
320
+ }
320
321
 
321
322
  /**
322
323
  * Remove the song
323
- *
324
+ *
324
325
  * @async
325
326
  * @param {string} title
326
327
  * @param {object} [options]
@@ -335,38 +336,36 @@ module.exports = (Parent) => {
335
336
 
336
337
  /**
337
338
  * Create a deferred song link
338
- *
339
- * @param {string} title
340
- * @param {string} type
341
- * @param {object} options
339
+ *
340
+ * @param {string} title
341
+ * @param {string} type
342
+ * @param {object} options
342
343
  * @returns {string}
343
344
  */
344
345
  createRequestedSongLink(title, type, options = {}) {
345
- options = Object.assign({
346
+ options = Object.assign({
346
347
  query: {
347
348
  type,
348
- title
349
+ title
349
350
  }
350
351
  }, options);
351
352
  return this.createRequestUrl(`request-song`, options);
352
353
  }
353
-
354
354
  /**
355
355
  * Create a deferred song audio link
356
- *
356
+ *
357
357
  * @see ClientMuseria.prototype.createRequestedSongLink
358
358
  */
359
359
  createRequestedSongAudioLink(title, options = {}) {
360
360
  return this.createRequestedSongLink(title, 'audio', options);
361
361
  }
362
-
363
362
  /**
364
363
  * Create a deferred song cover link
365
- *
364
+ *
366
365
  * @see ClientMuseria.prototype.createRequestedSongLink
367
366
  */
368
367
  createRequestedSongCoverLink(title, options = {}) {
369
368
  return this.createRequestedSongLink(title, 'cover', options);
370
369
  }
371
- }
372
- };
370
+ };
371
+ };
@@ -1,14 +1,16 @@
1
- const _ = require('lodash');
2
- const Collection = require('metastocle/src/collection/transports/collection')();
3
- const utils = require('../../../utils');
4
- const schema = require('../../../schema');
1
+ import omit from "lodash-es/omit.js";
2
+ import collection from "metastocle/src/collection/transports/collection/index.js";
3
+ import schema from "../../../schema.js";
4
+ import utils from "../../../utils.js";
5
5
 
6
- module.exports = (Parent) => {
6
+ const Collection = collection();
7
+
8
+ export default (Parent) => {
7
9
  /**
8
10
  * Music collection transport
9
11
  */
10
12
  return class MusicCollection extends (Parent || Collection) {
11
- static get DocumentsHandler () { return utils.MusicDocumentsHandler }
13
+ static get DocumentsHandler() { return utils.MusicDocumentsHandler; }
12
14
 
13
15
  /**
14
16
  * @see Collection.prototype.actionsGettingTest
@@ -22,33 +24,33 @@ module.exports = (Parent) => {
22
24
  * @see Collection.prototype.prepareDocumentFromSlave
23
25
  */
24
26
  async prepareDocumentFromSlave(doc) {
25
- if(!doc.fileHash) {
27
+ if (!doc.fileHash) {
26
28
  return null;
27
29
  }
28
30
 
29
- try {
31
+ try {
30
32
  const filePath = this.node.getFilePath(doc.fileHash);
31
33
  const buff = await this.node.getSongAudioHeadersBuffer(filePath);
32
34
 
33
35
  try {
34
- doc.tags = await utils.getSongTags(buff);
36
+ doc.tags = await utils.getSongTags(buff);
35
37
  }
36
- catch(err) {
37
- this.node.logger.warn(err.stack);
38
- doc.tags = {};
38
+ catch (err) {
39
+ this.node.logger.warn(err.stack);
40
+ doc.tags = {};
39
41
  }
40
-
42
+
41
43
  doc.audioLink = await this.node.createSongAudioLink(doc);
42
44
  doc.coverLink = await this.node.createSongCoverLink(doc, doc.tags);
43
- doc.tags = _.omit(doc.tags, ['APIC']);
45
+ doc.tags = omit(doc.tags, ['APIC']);
44
46
  doc.priority = doc.priority || 0;
45
47
  }
46
- catch(err) {
48
+ catch (err) {
47
49
  this.node.logger.warn(err.stack);
48
50
  return null;
49
51
  }
50
-
52
+
51
53
  return doc;
52
54
  }
53
- }
54
- };
55
+ };
56
+ };
@@ -1,13 +1,15 @@
1
- const Database = require('spreadable/src/db/transports/database')();
1
+ import database from "spreadable/src/db/transports/database/index.js";
2
2
 
3
- module.exports = (Parent) => {
3
+ const Database = database();
4
+
5
+ export default (Parent) => {
4
6
  /**
5
7
  * Database transport interface
6
8
  */
7
9
  return class DatabaseMuseria extends (Parent || Database) {
8
10
  /**
9
11
  * @async
10
- * @param {string} title
12
+ * @param {string} title
11
13
  * @returns {object}
12
14
  */
13
15
  async getMusicByPk() {
@@ -30,5 +32,5 @@ module.exports = (Parent) => {
30
32
  async removeMusicByFileHash() {
31
33
  throw new Error('Method "removeMusicByFileHash" is required for database transport');
32
34
  }
33
- }
34
- };
35
+ };
36
+ };
@@ -1,10 +1,15 @@
1
- const DatabaseMuseria = require('../database')();
2
- const DatabaseLoki = require('spreadable/src/db/transports/loki')(DatabaseMuseria);
3
- const DatabaseLokiMetastocle = require('metastocle/src/db/transports/loki')(DatabaseLoki);
4
- const DatabaseLokiStoracle = require('storacle/src/db/transports/loki')(DatabaseLokiMetastocle);
5
- const utils = require('../../../utils');
1
+ import database from "../database/index.js";
2
+ import lokiSpreadable from "spreadable/src/db/transports/loki/index.js";
3
+ import lokiMetastocle from "metastocle/src/db/transports/loki/index.js";
4
+ import lokiStoracle from "storacle/src/db/transports/loki/index.js";
5
+ import utils from "../../../utils.js";
6
6
 
7
- module.exports = (Parent) => {
7
+ const DatabaseMuseria = database();
8
+ const DatabaseLoki = lokiSpreadable(DatabaseMuseria);
9
+ const DatabaseLokiMetastocle = lokiMetastocle(DatabaseLoki);
10
+ const DatabaseLokiStoracle = lokiStoracle(DatabaseLokiMetastocle);
11
+
12
+ export default (Parent) => {
8
13
  /**
9
14
  * Lokijs database transport
10
15
  */
@@ -15,39 +20,39 @@ module.exports = (Parent) => {
15
20
  async getMusicByPk(title, options = {}) {
16
21
  title = utils.prepareComparisonSongTitle(title);
17
22
  options = Object.assign({
18
- similarity: this.node.options.music.similarity
19
- }, options);
23
+ similarity: this.node.options.music.similarity
24
+ }, options);
20
25
  const fullName = this.createCollectionName('music');
21
26
  const documents = this.col[fullName].find();
22
27
  let max = null;
23
-
24
- for(let i = 0; i < documents.length; i++) {
28
+
29
+ for (let i = 0; i < documents.length; i++) {
25
30
  const doc = documents[i];
26
31
  let score = doc.compTitle === title? 1: 0;
27
32
 
28
- if(!score) {
29
- score = utils.getSongSimilarity(doc.compTitle, title, {
30
- beautify: false,
31
- min: options.similarity
33
+ if (!score) {
34
+ score = utils.getSongSimilarity(doc.compTitle, title, {
35
+ beautify: false,
36
+ min: options.similarity
32
37
  });
33
38
  }
34
39
 
35
- if(score === 1) {
40
+ if (score === 1) {
36
41
  max = { score, doc };
37
42
  break;
38
43
  }
39
44
 
40
- if(!max || score > max.score) {
45
+ if (!max || score > max.score) {
41
46
  max = { score, doc };
42
47
  continue;
43
48
  }
44
49
 
45
- if(score == max.score && Math.random() > 0.5) {
50
+ if (score == max.score && Math.random() > 0.5) {
46
51
  max = { score, doc };
47
52
  }
48
- }
53
+ }
49
54
 
50
- if(max && max.score >= options.similarity) {
55
+ if (max && max.score >= options.similarity) {
51
56
  return this.prepareDocumentToGet(max.doc);
52
57
  }
53
58
 
@@ -56,9 +61,9 @@ module.exports = (Parent) => {
56
61
 
57
62
  /**
58
63
  * Add music document
59
- *
64
+ *
60
65
  * @async
61
- * @param {object} doc
66
+ * @param {object} doc
62
67
  * @returns {object}
63
68
  */
64
69
  async addMusicDocument(doc, options = {}) {
@@ -69,9 +74,9 @@ module.exports = (Parent) => {
69
74
 
70
75
  /**
71
76
  * Add music document
72
- *
77
+ *
73
78
  * @async
74
- * @param {object} doc
79
+ * @param {object} doc
75
80
  * @param {object} options
76
81
  * @param {object} options.beautify
77
82
  * @returns {object}
@@ -98,5 +103,5 @@ module.exports = (Parent) => {
98
103
  const fullName = this.createCollectionName('music');
99
104
  this.col[fullName].chain().find({ fileHash: hash }).remove();
100
105
  }
101
- }
102
- };
106
+ };
107
+ };
package/src/errors.js CHANGED
@@ -1 +1,2 @@
1
- module.exports = Object.assign({}, require('spreadable/src/errors'));
1
+ import * as errors from "spreadable/src/errors.js";
2
+ export default Object.assign({}, errors);
package/src/index.js CHANGED
@@ -1,7 +1,9 @@
1
- const Node = require('./node')();
2
- const Client = require('./client')();
1
+ import node from "./node.js";
2
+ import client from "./client.js";
3
3
 
4
- module.exports = {
5
- Client,
6
- Node
7
- };
4
+ const Node = node();
5
+ const Client = client();
6
+
7
+ export { Client };
8
+ export { Node };
9
+ export default { Client, Node };