@glissandoo/lib 1.16.2 → 1.16.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.
Files changed (38) hide show
  1. package/helpers/fileSections/index.d.ts +2 -0
  2. package/helpers/fileSections/index.js +9 -0
  3. package/helpers/fileSections/orders.d.ts +7 -0
  4. package/helpers/fileSections/orders.js +20 -0
  5. package/helpers/musicStyles/orders.d.ts +2 -2
  6. package/helpers/musicStyles/orders.js +2 -9
  7. package/helpers/utils.d.ts +1 -0
  8. package/helpers/utils.js +18 -14
  9. package/lang/ca.json +1 -0
  10. package/lang/de.json +1 -0
  11. package/lang/en.json +3 -2
  12. package/lang/es.json +1 -0
  13. package/lang/eu.json +1 -0
  14. package/lang/gl.json +1 -0
  15. package/lang/index.d.ts +7 -0
  16. package/lang/pt.json +1 -0
  17. package/models/Communication/index.js +6 -3
  18. package/models/Evento/index.js +4 -1
  19. package/models/FileSection/index.d.ts +8 -0
  20. package/models/FileSection/index.js +19 -0
  21. package/models/Group/Repertory/File/Section/index.d.ts +8 -0
  22. package/models/Group/Repertory/File/Section/index.js +20 -0
  23. package/models/Group/Repertory/File/Section/types.d.ts +5 -0
  24. package/models/Group/Repertory/File/Section/types.js +7 -0
  25. package/models/Group/Repertory/File/index.d.ts +22 -0
  26. package/models/Group/Repertory/File/index.js +89 -0
  27. package/models/Group/Repertory/File/types.d.ts +11 -0
  28. package/models/Group/Repertory/File/types.js +2 -0
  29. package/models/Group/Repertory/File.d.ts +28 -0
  30. package/models/Group/Repertory/File.js +99 -0
  31. package/models/Group/Repertory/index.d.ts +7 -2
  32. package/models/Group/Repertory/index.js +15 -2
  33. package/models/Group/Repertory/types.d.ts +8 -3
  34. package/models/Group/index.js +4 -1
  35. package/models/Group/types.d.ts +3 -0
  36. package/models/Group/types.js +5 -1
  37. package/models/Partner/basic.js +6 -1
  38. package/package.json +5 -2
@@ -0,0 +1,2 @@
1
+ import { FileSectionId } from '../../models/Group/Repertory/File/Section/types';
2
+ export declare const fileSectionIdList: FileSectionId[];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fileSectionIdList = void 0;
4
+ const types_1 = require("../../models/Group/Repertory/File/Section/types");
5
+ const instruments_1 = require("../instruments");
6
+ exports.fileSectionIdList = [
7
+ ...Object.values(instruments_1.InstrumentId),
8
+ ...Object.values(types_1.FileSectionIdReserved),
9
+ ];
@@ -0,0 +1,7 @@
1
+ import { FileSectionId } from '../../models/Group/Repertory/File/Section/types';
2
+ import { MusicStyleType } from '../musicStyles/index';
3
+ export declare const orders: {
4
+ [k: string]: FileSectionId[];
5
+ };
6
+ export declare const getOrderByMusicStyle: (musicStyle: MusicStyleType) => FileSectionId[];
7
+ export declare const orderByMusicStyle: <T>(list: T[], field: keyof T, musicStyle: MusicStyleType) => T[];
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.orderByMusicStyle = exports.getOrderByMusicStyle = exports.orders = void 0;
4
+ const types_1 = require("../../models/Group/Repertory/File/Section/types");
5
+ const fileSections_1 = require("../fileSections");
6
+ const orders_1 = require("../musicStyles/orders");
7
+ const utils_1 = require("../utils");
8
+ exports.orders = Object.fromEntries(Object.entries(orders_1.orders).map(([musicStyle, instruments]) => [
9
+ musicStyle,
10
+ [types_1.FileSectionIdReserved.All, ...instruments],
11
+ ]));
12
+ const getOrderByMusicStyle = (musicStyle) => {
13
+ return musicStyle in exports.orders ? exports.orders[musicStyle] : fileSections_1.fileSectionIdList;
14
+ };
15
+ exports.getOrderByMusicStyle = getOrderByMusicStyle;
16
+ const orderByMusicStyle = (list, field, musicStyle) => {
17
+ const order = exports.getOrderByMusicStyle(musicStyle);
18
+ return utils_1.orderByMatch(list, field, order);
19
+ };
20
+ exports.orderByMusicStyle = orderByMusicStyle;
@@ -1,5 +1,5 @@
1
1
  import { InstrumentId } from '../instruments';
2
2
  import { MusicStyleType } from './index';
3
- export declare const orders: Record<string, InstrumentId[]>;
3
+ export declare const orders: Record<MusicStyleType, InstrumentId[]>;
4
4
  export declare const getInstrumentsOrderByMusicStyle: (musicStyle: MusicStyleType) => InstrumentId[];
5
- export declare const orderByMusicStyle: <T>(list: T[], field: string, musicStyle: MusicStyleType) => T[];
5
+ export declare const orderByMusicStyle: <T>(list: T[], field: keyof T, musicStyle: MusicStyleType) => T[];
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.orderByMusicStyle = exports.getInstrumentsOrderByMusicStyle = exports.orders = void 0;
7
- const get_1 = __importDefault(require("lodash/get"));
8
- const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
- const sortBy_1 = __importDefault(require("lodash/sortBy"));
10
4
  const instruments_1 = require("../instruments");
5
+ const utils_1 = require("../utils");
11
6
  const index_1 = require("./index");
12
7
  exports.orders = {
13
8
  [index_1.MusicStyleId.Band]: [
@@ -193,8 +188,6 @@ const getInstrumentsOrderByMusicStyle = (musicStyle) => {
193
188
  exports.getInstrumentsOrderByMusicStyle = getInstrumentsOrderByMusicStyle;
194
189
  const orderByMusicStyle = (list, field, musicStyle) => {
195
190
  const order = exports.getInstrumentsOrderByMusicStyle(musicStyle);
196
- const noMatch = list.filter((player) => !order.includes(get_1.default(player, field)));
197
- const match = list.filter((player) => order.includes(get_1.default(player, field)));
198
- return sortBy_1.default(match, [(player) => order.indexOf(get_1.default(player, field)), 'displayName']).concat(orderBy_1.default(noMatch, field, 'asc'));
191
+ return utils_1.orderByMatch(list, field, order);
199
192
  };
200
193
  exports.orderByMusicStyle = orderByMusicStyle;
@@ -7,3 +7,4 @@ export declare const serializeSlateBlock: (nodes: Descendant[]) => string;
7
7
  export declare const objToArray: <T>(obj: Record<string, T>) => (T & {
8
8
  id: string;
9
9
  })[];
10
+ export declare const orderByMatch: <T>(list: T[], field: keyof T, order: string[]) => T[];
package/helpers/utils.js CHANGED
@@ -1,22 +1,12 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
5
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.objToArray = exports.serializeSlateBlock = exports.replaceKeysNotification = exports.replaceVarsBrackets = void 0;
6
+ exports.orderByMatch = exports.objToArray = exports.serializeSlateBlock = exports.replaceKeysNotification = exports.replaceVarsBrackets = void 0;
18
7
  const date_fns_1 = require("date-fns");
19
8
  const date_fns_tz_1 = require("date-fns-tz");
9
+ const lodash_1 = require("lodash");
20
10
  const get_1 = __importDefault(require("lodash/get"));
21
11
  const lang_1 = require("../lang");
22
12
  const Instrument_1 = __importDefault(require("../models/Instrument"));
@@ -34,7 +24,7 @@ exports.replaceVarsBrackets = replaceVarsBrackets;
34
24
  const replaceKeysNotification = (string, values, lang) => {
35
25
  const dateLang = lang_1.getDateLang(lang);
36
26
  const matches = string.match(/(\{).+?(\})/g);
37
- const { extra } = values, other = __rest(values, ["extra"]);
27
+ const { extra, ...other } = values;
38
28
  const newValues = { extra };
39
29
  Object.keys(other || {}).forEach((key) => Object.assign(newValues, {
40
30
  [key]: Object.values(get_1.default(other, key)),
@@ -97,6 +87,20 @@ const serializeSlateBlock = (nodes) => {
97
87
  };
98
88
  exports.serializeSlateBlock = serializeSlateBlock;
99
89
  const objToArray = (obj) => {
100
- return Object.keys(obj).map((key) => (Object.assign(Object.assign({}, obj[key]), { id: key })));
90
+ return Object.keys(obj).map((key) => ({
91
+ ...obj[key],
92
+ id: key,
93
+ }));
101
94
  };
102
95
  exports.objToArray = objToArray;
96
+ const orderByMatch = (list, field, order) => {
97
+ const { match, noMatch } = list.reduce((acc, item) => {
98
+ const isMatch = order.includes(get_1.default(item, field));
99
+ return {
100
+ match: isMatch ? acc.match.concat(item) : acc.match,
101
+ noMatch: !isMatch ? acc.noMatch.concat(item) : acc.noMatch,
102
+ };
103
+ }, { match: [], noMatch: [] });
104
+ return lodash_1.sortBy(match, [(player) => order.indexOf(get_1.default(player, field)), 'displayName']).concat(lodash_1.orderBy(noMatch, field, 'asc'));
105
+ };
106
+ exports.orderByMatch = orderByMatch;
package/lang/ca.json CHANGED
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "Nous assajos",
214
214
  "practices.players.remove.text": "Us han eliminat d'una sèrie d'assajos entre {date:event.0.datetime:shortDate} i {date:event.1.datetime:shortDate}",
215
215
  "practices.players.remove.title": "Assajos eliminats",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} ha reclamat la partitura de {instrument:extra.instrumentId} de l'obra \"{string:extra.title}\"",
217
218
  "theme.claim.new.title": "Han demanat una partitura",
218
219
  "theme.claim.update.text": "S'afegit la partitura de {instrument:extra.instrumentId} de l'obra \"{string:extra.title}\"",
package/lang/de.json CHANGED
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "Neue Proben",
214
214
  "practices.players.remove.text": "Du wurdest aus einer Reihe von Proben von {date:event.0.datetime:shortDate} bis {date:event.1.datetime:shortDate} entfernt.",
215
215
  "practices.players.remove.title": "Die Proben wurden entfernt",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} beanspruchte die Noten \nvon {instrument:extra.instrumentld} des Stücks \"{string:extra.title}“",
217
218
  "theme.claim.new.title": "Noten wurden angefordert",
218
219
  "theme.claim.update.text": "{instrument:extra.instrumentld} -Noten des Stücks \"{string:extra.title}\" wurden hinzugefügt.",
package/lang/en.json CHANGED
@@ -49,7 +49,7 @@
49
49
  "instruments.choir": "Choir",
50
50
  "instruments.clarinet": "Clarinet",
51
51
  "instruments.contraAlto": "Contralto",
52
- "instruments.contraBass": "Contrabass",
52
+ "instruments.contraBass": "Contrabassoon",
53
53
  "instruments.contrabassClarinet": "Contrabass Clarinet",
54
54
  "instruments.cornet": "Cornet",
55
55
  "instruments.counterTenor": "Countertenor",
@@ -67,7 +67,7 @@
67
67
  "instruments.frenchHorn": "French Horn",
68
68
  "instruments.guitar": "Guitar",
69
69
  "instruments.harmonica": "Harmonica",
70
- "instruments.harp": "Arp",
70
+ "instruments.harp": "Harp",
71
71
  "instruments.highTrombone": "Alto Trombone",
72
72
  "instruments.keyboard": "Keyboard",
73
73
  "instruments.littleClarinet": "Piccolo Clarinet",
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "New rehearsals",
214
214
  "practices.players.remove.text": "You have been removed from several rehearsals between {date:event.0.datetime:shortDate} and {date:event.1.datetime:shortDate}",
215
215
  "practices.players.remove.title": "Rehearsals removed",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} has claimed a review on {instrument:extra.instrumentId} for \"{string:extra.title}\"",
217
218
  "theme.claim.new.title": "A music sheet review has been submitted by a musician",
218
219
  "theme.claim.update.text": "{instrument:extra.instrumentId} sheet for \"{string:extra.title}\" has been added.",
package/lang/es.json CHANGED
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "Nuevos ensayos",
214
214
  "practices.players.remove.text": "Has sido eliminado de una serie de ensayos entre {date:event.0.datetime:shortDate} y {date:event.1.datetime:shortDate}",
215
215
  "practices.players.remove.title": "Ensayos eliminados",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} ha reclamado la partitura de {instrument:extra.instrumentId} de la obra \"{string:extra.title}\"",
217
218
  "theme.claim.new.title": "Han pedido una partitura",
218
219
  "theme.claim.update.text": "Se ha añadido la partitura de {instrument:extra.instrumentId} de la obra \"{string:extra.title}\"",
package/lang/eu.json CHANGED
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "Entsegu berriak",
214
214
  "practices.players.remove.text": "{date:event.0.datetime:shortDate} eta {date:event.1.datetime:shortDate} egunen arteko entsegu batzuetatik ezabatua izan zara",
215
215
  "practices.players.remove.title": "Bertan behera utzi diren entseguak",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} erabiltzaileak \"{string:extra.title}\" obrako {instrument:extra.instrumentId} instrumentuaren partitura eskatu du",
217
218
  "theme.claim.new.title": "Partitura bat eskatu da",
218
219
  "theme.claim.update.text": "{instrument:extra.instrumentId} instrumentuaren partitura gehitu da \"{string:extra.title}\" obrarako",
package/lang/gl.json CHANGED
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "Novas probas",
214
214
  "practices.players.remove.text": "Elimináronte dunha serie de ensaios entre {date:event.0.datetime:shortDate} e {date:event.1.datetime:shortDate}",
215
215
  "practices.players.remove.title": "Quitáronse os ensaios",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} ha reclamado la partitura de {instrument:extra.instrument} de la obra \"{string:extra.title}\"",
217
218
  "theme.claim.new.title": "Han pedido una partitura",
218
219
  "theme.claim.update.text": "Se ha añadido la partitura de {instrument:extra.instrument} de la obra \"{string:extra.title}\"",
package/lang/index.d.ts CHANGED
@@ -227,6 +227,7 @@ declare const languageProvider: {
227
227
  "practices.players.add.title": string;
228
228
  "practices.players.remove.text": string;
229
229
  "practices.players.remove.title": string;
230
+ "sections.all": string;
230
231
  "theme.claim.new.text": string;
231
232
  "theme.claim.new.title": string;
232
233
  "theme.claim.update.text": string;
@@ -458,6 +459,7 @@ declare const languageProvider: {
458
459
  "practices.players.add.title": string;
459
460
  "practices.players.remove.text": string;
460
461
  "practices.players.remove.title": string;
462
+ "sections.all": string;
461
463
  "theme.claim.new.text": string;
462
464
  "theme.claim.new.title": string;
463
465
  "theme.claim.update.text": string;
@@ -689,6 +691,7 @@ declare const languageProvider: {
689
691
  "practices.players.add.title": string;
690
692
  "practices.players.remove.text": string;
691
693
  "practices.players.remove.title": string;
694
+ "sections.all": string;
692
695
  "theme.claim.new.text": string;
693
696
  "theme.claim.new.title": string;
694
697
  "theme.claim.update.text": string;
@@ -920,6 +923,7 @@ declare const languageProvider: {
920
923
  "practices.players.add.title": string;
921
924
  "practices.players.remove.text": string;
922
925
  "practices.players.remove.title": string;
926
+ "sections.all": string;
923
927
  "theme.claim.new.text": string;
924
928
  "theme.claim.new.title": string;
925
929
  "theme.claim.update.text": string;
@@ -1151,6 +1155,7 @@ declare const languageProvider: {
1151
1155
  "practices.players.add.title": string;
1152
1156
  "practices.players.remove.text": string;
1153
1157
  "practices.players.remove.title": string;
1158
+ "sections.all": string;
1154
1159
  "theme.claim.new.text": string;
1155
1160
  "theme.claim.new.title": string;
1156
1161
  "theme.claim.update.text": string;
@@ -1382,6 +1387,7 @@ declare const languageProvider: {
1382
1387
  "practices.players.add.title": string;
1383
1388
  "practices.players.remove.text": string;
1384
1389
  "practices.players.remove.title": string;
1390
+ "sections.all": string;
1385
1391
  "theme.claim.new.text": string;
1386
1392
  "theme.claim.new.title": string;
1387
1393
  "theme.claim.update.text": string;
@@ -1613,6 +1619,7 @@ declare const languageProvider: {
1613
1619
  "practices.players.add.title": string;
1614
1620
  "practices.players.remove.text": string;
1615
1621
  "practices.players.remove.title": string;
1622
+ "sections.all": string;
1616
1623
  "theme.claim.new.text": string;
1617
1624
  "theme.claim.new.title": string;
1618
1625
  "theme.claim.update.text": string;
package/lang/pt.json CHANGED
@@ -213,6 +213,7 @@
213
213
  "practices.players.add.title": "Novos ensaios",
214
214
  "practices.players.remove.text": "Você foi removido de vários ensaios entre {date:event.0.datetime:shortDate} e {date:event.1.datetime:shortDate}",
215
215
  "practices.players.remove.title": "Ensaios removidos",
216
+ "sections.all": "All",
216
217
  "theme.claim.new.text": "{string:user.0.displayName} uma revisão em {instrument:extra.instrumentId} para “{string:extra.title}”",
217
218
  "theme.claim.new.title": "Uma revisão da partitura foi enviada por um músico",
218
219
  "theme.claim.update.text": "A partitura {instrument:extra.instrumentId} da obra “{string:extra.title}” foi adicionada.",
@@ -92,9 +92,12 @@ class Communication extends Model_1.default {
92
92
  .reduce((acc, current) => acc + current, 0);
93
93
  }
94
94
  get reactions() {
95
- return this.listRecipients.reduce((acc, { reaction, id }) => (Object.assign(Object.assign({}, acc), (reaction && {
96
- [reaction]: reaction in acc ? [...acc[reaction], id] : [id],
97
- }))), {});
95
+ return this.listRecipients.reduce((acc, { reaction, id }) => ({
96
+ ...acc,
97
+ ...(reaction && {
98
+ [reaction]: reaction in acc ? [...acc[reaction], id] : [id],
99
+ }),
100
+ }), {});
98
101
  }
99
102
  get totalViews() {
100
103
  return this.listRecipients
@@ -114,7 +114,10 @@ class Evento extends promoter_1.default {
114
114
  return types_2.EventStatusByTime.Future;
115
115
  }
116
116
  get repertoryList() {
117
- const repertory = Object.keys(this.repertory).map((themeId) => (Object.assign(Object.assign({}, this.repertory[themeId]), { id: themeId })));
117
+ const repertory = Object.keys(this.repertory).map((themeId) => ({
118
+ ...this.repertory[themeId],
119
+ id: themeId,
120
+ }));
118
121
  return lodash_1.orderBy(repertory, 'order', 'asc');
119
122
  }
120
123
  get activePlayers() {
@@ -0,0 +1,8 @@
1
+ import { SectionIdType } from '../../helpers/fileSections';
2
+ import { LanguagesTypes } from '../../lang';
3
+ export default class Section {
4
+ id: SectionIdType;
5
+ private lang;
6
+ constructor(id: SectionIdType, lang?: LanguagesTypes);
7
+ get name(): any;
8
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lang_1 = require("../../lang");
7
+ const Instrument_1 = __importDefault(require("../Instrument"));
8
+ class Section {
9
+ constructor(id, lang = lang_1.defaultLocale) {
10
+ this.id = id;
11
+ this.lang = lang;
12
+ }
13
+ get name() {
14
+ return ((this.id === 'all'
15
+ ? lang_1.getTranslation(`sections.all`, this.lang)
16
+ : new Instrument_1.default(this.id).name) || this.id);
17
+ }
18
+ }
19
+ exports.default = Section;
@@ -0,0 +1,8 @@
1
+ import { LanguagesTypes } from '../../../../../lang';
2
+ import { FileSectionId } from './types';
3
+ export default class GroupRepertoryFileSection {
4
+ id: FileSectionId;
5
+ private lang;
6
+ constructor(id: FileSectionId, lang?: LanguagesTypes);
7
+ get name(): string;
8
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const lang_1 = require("../../../../../lang");
7
+ const Instrument_1 = __importDefault(require("../../../../Instrument"));
8
+ const types_1 = require("./types");
9
+ class GroupRepertoryFileSection {
10
+ constructor(id, lang = lang_1.defaultLocale) {
11
+ this.id = id;
12
+ this.lang = lang;
13
+ }
14
+ get name() {
15
+ return ((this.id === types_1.FileSectionIdReserved.All
16
+ ? lang_1.getTranslation(`sections.all`, this.lang)
17
+ : new Instrument_1.default(this.id).name) || this.id);
18
+ }
19
+ }
20
+ exports.default = GroupRepertoryFileSection;
@@ -0,0 +1,5 @@
1
+ import { InstrumentId } from '../../../../../helpers/instruments';
2
+ export declare enum FileSectionIdReserved {
3
+ All = "all"
4
+ }
5
+ export declare type FileSectionId = InstrumentId | FileSectionIdReserved;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FileSectionIdReserved = void 0;
4
+ var FileSectionIdReserved;
5
+ (function (FileSectionIdReserved) {
6
+ FileSectionIdReserved["All"] = "all";
7
+ })(FileSectionIdReserved = exports.FileSectionIdReserved || (exports.FileSectionIdReserved = {}));
@@ -0,0 +1,22 @@
1
+ import { FileSectionId } from '../File/Section/types';
2
+ import { GroupRepertoireFile } from '../types';
3
+ import { FileSectionByTagItem, FileSectionItem } from './types';
4
+ export default class ThemeFile {
5
+ id: string;
6
+ private data;
7
+ constructor(id: string, data: GroupRepertoireFile);
8
+ get path(): string;
9
+ get filetype(): string;
10
+ get isAudio(): boolean;
11
+ get isPdf(): boolean;
12
+ get uploadedAt(): number;
13
+ get pageCount(): number | null;
14
+ get isEncrypted(): boolean;
15
+ get isFileByPages(): boolean;
16
+ get sections(): Partial<Record<FileSectionId, import("../types").GroupRepertoireFileSections>>;
17
+ get sectionIds(): FileSectionId[];
18
+ get sectionsList(): FileSectionItem[];
19
+ get sectionListByTags(): FileSectionByTagItem[];
20
+ get identifyAt(): number | null;
21
+ protected isNoTag(tags?: string[]): boolean;
22
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../helpers/utils");
4
+ const types_1 = require("../../types");
5
+ class ThemeFile {
6
+ constructor(id, data) {
7
+ this.id = id;
8
+ this.data = data;
9
+ }
10
+ get path() {
11
+ return this.data.path;
12
+ }
13
+ get filetype() {
14
+ return this.data.filetype;
15
+ }
16
+ get isAudio() {
17
+ return this.filetype.includes('audio');
18
+ }
19
+ get isPdf() {
20
+ return this.filetype === 'application/pdf';
21
+ }
22
+ get uploadedAt() {
23
+ return this.data.uploadedAt;
24
+ }
25
+ get pageCount() {
26
+ return this.data.pageCount || null;
27
+ }
28
+ get isEncrypted() {
29
+ return this.data.isEncrypted;
30
+ }
31
+ get isFileByPages() {
32
+ return this.isPdf && !this.isEncrypted;
33
+ }
34
+ get sections() {
35
+ return this.data.sections || {};
36
+ }
37
+ get sectionIds() {
38
+ return Object.keys(this.sections);
39
+ }
40
+ get sectionsList() {
41
+ const list = utils_1.objToArray(this.sections);
42
+ return list.map((section) => this.isFileByPages
43
+ ? {
44
+ sectionId: section.id,
45
+ tagsByFile: [],
46
+ tagsByPages: Object.entries(section.pages || {}).reduce((acc, [page, { tags }]) => ({
47
+ ...acc,
48
+ ...(this.isNoTag(tags)
49
+ ? {
50
+ [types_1.GroupRepertoireTagReserved.NoTag]: [
51
+ ...(acc[types_1.GroupRepertoireTagReserved.NoTag] || []),
52
+ Number(page),
53
+ ],
54
+ }
55
+ : tags.reduce((accTags, tag) => ({
56
+ ...accTags,
57
+ [tag]: [...(acc[tag] || []), Number(page)],
58
+ }), {})),
59
+ }), {}),
60
+ }
61
+ : {
62
+ sectionId: section.id,
63
+ tagsByFile: this.isNoTag(section.tags)
64
+ ? [types_1.GroupRepertoireTagReserved.NoTag]
65
+ : section.tags || [],
66
+ tagsByPages: {},
67
+ });
68
+ }
69
+ get sectionListByTags() {
70
+ const list = this.sectionsList;
71
+ return list.reduce((acc, { tagsByFile, tagsByPages, sectionId }) => [
72
+ ...acc,
73
+ ...(this.isFileByPages
74
+ ? Object.entries(tagsByPages).reduce((accTags, [tag, pages]) => [...accTags, { sectionId, tag, pages }], [])
75
+ : tagsByFile.map((tag) => ({
76
+ sectionId,
77
+ tag,
78
+ pages: null,
79
+ }))),
80
+ ], []);
81
+ }
82
+ get identifyAt() {
83
+ return this.data.identifyAt || null;
84
+ }
85
+ isNoTag(tags = []) {
86
+ return tags.length === 0 || tags.includes(types_1.GroupRepertoireTagReserved.NoTag);
87
+ }
88
+ }
89
+ exports.default = ThemeFile;
@@ -0,0 +1,11 @@
1
+ import { FileSectionId } from '../File/Section/types';
2
+ export interface FileSectionItem {
3
+ sectionId: FileSectionId;
4
+ tagsByFile: string[];
5
+ tagsByPages: Record<string, number[]>;
6
+ }
7
+ export interface FileSectionByTagItem {
8
+ sectionId: FileSectionId;
9
+ tag: string;
10
+ pages: number[] | null;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ import { GroupRepertoireFile, GroupRepertoireSectionId as SectionId } from './types';
2
+ export default class ThemeFile {
3
+ id: string;
4
+ private data;
5
+ constructor(id: string, data: GroupRepertoireFile);
6
+ get path(): string;
7
+ get filetype(): string;
8
+ get isAudio(): boolean;
9
+ get isPdf(): boolean;
10
+ get uploadedAt(): number;
11
+ get pageCount(): number | null;
12
+ get isEncrypted(): boolean;
13
+ get isFileByPages(): boolean;
14
+ get sections(): Partial<Record<import("../../../helpers/fileSections").SectionIdType, import("./types").GroupRepertoireFileSections>>;
15
+ get sectionIds(): import("../../../helpers/fileSections").SectionIdType[];
16
+ get sectionsList(): {
17
+ id: SectionId;
18
+ tagsByFile: string[];
19
+ tagsByPages: Record<string, number[]>;
20
+ }[];
21
+ get sectionListByTags(): {
22
+ id: SectionId;
23
+ tag: string;
24
+ pages: number[] | null;
25
+ }[];
26
+ get identifyAt(): number | null;
27
+ protected isAllTag(tags?: string[]): boolean;
28
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../helpers/utils");
4
+ const types_1 = require("../types");
5
+ class ThemeFile {
6
+ constructor(id, data) {
7
+ this.id = id;
8
+ this.data = data;
9
+ }
10
+ get path() {
11
+ return this.data.path;
12
+ }
13
+ get filetype() {
14
+ return this.data.filetype;
15
+ }
16
+ get isAudio() {
17
+ return this.filetype.includes('audio');
18
+ }
19
+ get isPdf() {
20
+ return this.filetype === 'application/pdf';
21
+ }
22
+ get uploadedAt() {
23
+ return this.data.uploadedAt;
24
+ }
25
+ get pageCount() {
26
+ return this.data.pageCount || null;
27
+ }
28
+ get isEncrypted() {
29
+ return this.data.isEncrypted;
30
+ }
31
+ get isFileByPages() {
32
+ return this.isPdf && !this.isEncrypted;
33
+ }
34
+ get sections() {
35
+ return this.data.sections || {};
36
+ }
37
+ get sectionIds() {
38
+ return Object.keys(this.sections);
39
+ }
40
+ get sectionsList() {
41
+ const list = utils_1.objToArray(this.sections);
42
+ return list.map((section) => this.isFileByPages
43
+ ? {
44
+ id: section.id,
45
+ tagsByFile: [],
46
+ tagsByPages: Object.entries(section.pages || {}).reduce((acc, [page, { tags }]) => ({
47
+ ...acc,
48
+ ...(this.isAllTag(tags)
49
+ ? {
50
+ [types_1.GroupRepertoireTagReserved.All]: [
51
+ ...(acc[types_1.GroupRepertoireTagReserved.All] || []),
52
+ Number(page),
53
+ ],
54
+ }
55
+ : tags.reduce((accTags, tag) => ({
56
+ ...accTags,
57
+ [tag]: [...(acc[tag] || []), Number(page)],
58
+ }), {})),
59
+ }), {}),
60
+ }
61
+ : {
62
+ id: section.id,
63
+ tagsByFile: this.isAllTag(section.tags)
64
+ ? [types_1.GroupRepertoireTagReserved.All]
65
+ : section.tags || [],
66
+ tagsByPages: {},
67
+ });
68
+ }
69
+ get sectionListByTags() {
70
+ const list = this.sectionsList;
71
+ return list.reduce((acc, section) => {
72
+ const tagItems = this.isFileByPages
73
+ ? Object.entries(section.tagsByPages).reduce((accTags, [tag, pages]) => {
74
+ return [...accTags, { id: section.id, tag, pages }];
75
+ }, [])
76
+ : section.tagsByFile.map((tag) => ({ id: section.id, tag, pages: null }));
77
+ return [...acc, ...tagItems];
78
+ }, []);
79
+ }
80
+ // get sectionListByTags() {
81
+ // const list = this.sectionsList;
82
+ // return list;
83
+ // return list.reduce((acc, section) => {
84
+ // const tagItems = this.isFileByPages
85
+ // ? Object.entries(section.tagsByPages).reduce((accTags, [tag, pages]) => {
86
+ // return [...accTags, { id: section.id, tag, pages }];
87
+ // }, [])
88
+ // : section.tagsByFile.map((tag) => ({ id: section.id, tag, pages: null }));
89
+ // return [...acc, ...tagItems];
90
+ // }, []);
91
+ // }
92
+ get identifyAt() {
93
+ return this.data.identifyAt || null;
94
+ }
95
+ isAllTag(tags = []) {
96
+ return tags.length === 0 || tags.includes(types_1.GroupRepertoireTagReserved.All);
97
+ }
98
+ }
99
+ exports.default = ThemeFile;
@@ -3,7 +3,8 @@ import { InstrumentId } from '../../../helpers/instruments';
3
3
  import { LanguagesTypes } from '../../../lang';
4
4
  import EventoTiny from '../../Evento/tiny';
5
5
  import Theme from '../../Repertory/basic';
6
- import { AGroupRepertoryClaim, GroupRepertoireSectionId as SectionId, GroupRepertoireVisibility, GroupRepertoryData } from './types';
6
+ import { FileSectionId } from './File/Section/types';
7
+ import { AGroupRepertoryClaim, GroupRepertoireVisibility, GroupRepertoryData } from './types';
7
8
  export default class GroupRepertory extends Theme<GroupRepertoryData> {
8
9
  private lang;
9
10
  constructor(doc: firestore.DocumentSnapshot, lang?: LanguagesTypes);
@@ -19,7 +20,11 @@ export default class GroupRepertory extends Theme<GroupRepertoryData> {
19
20
  get fileList(): (import("./types").GroupRepertoireFile & {
20
21
  id: string;
21
22
  })[];
22
- get sections(): SectionId[];
23
+ get filesPath(): Record<FileSectionId, import("./types").GroupRepertoireFilePathItem>;
24
+ get filesPathList(): (import("./types").GroupRepertoireFilePathItem & {
25
+ id: string;
26
+ })[];
27
+ get sections(): FileSectionId[];
23
28
  /** @deprecated use sections */
24
29
  get mainFilePath(): string | null;
25
30
  get visibility(): GroupRepertoireVisibility;
@@ -28,7 +28,10 @@ class GroupRepertory extends basic_1.default {
28
28
  /** @deprecated use sections */
29
29
  get instruments() {
30
30
  const instruments = this.data.instruments || [];
31
- return instruments.map((instrument) => (Object.assign(Object.assign({}, instrument), { filesPath: instrument.filesPath })));
31
+ return instruments.map((instrument) => ({
32
+ ...instrument,
33
+ filesPath: instrument.filesPath,
34
+ }));
32
35
  }
33
36
  get files() {
34
37
  return this.data.files || {};
@@ -36,6 +39,12 @@ class GroupRepertory extends basic_1.default {
36
39
  get fileList() {
37
40
  return utils_1.objToArray(this.files);
38
41
  }
42
+ get filesPath() {
43
+ return this.data.filesPath || {};
44
+ }
45
+ get filesPathList() {
46
+ return utils_1.objToArray(this.filesPath);
47
+ }
39
48
  get sections() {
40
49
  return lodash_1.uniq(lodash_1.flatten(this.fileList.map((file) => Object.keys(file.sections))));
41
50
  }
@@ -122,7 +131,11 @@ class GroupRepertory extends basic_1.default {
122
131
  const list = [];
123
132
  Object.keys(this.claims).map((instrumentId) => {
124
133
  Object.keys(this.claims[instrumentId] || {}).map((userId) => {
125
- list.push(Object.assign({ userId, instrumentId: instrumentId }, this.claims[instrumentId][userId]));
134
+ list.push({
135
+ userId,
136
+ instrumentId: instrumentId,
137
+ ...this.claims[instrumentId][userId],
138
+ });
126
139
  });
127
140
  });
128
141
  return list;
@@ -2,6 +2,7 @@ import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { InstrumentId } from '../../../helpers/instruments';
3
3
  import { EventTinyData } from '../../Evento/types';
4
4
  import { ThemeBasicData } from '../../Repertory/types';
5
+ import { FileSectionId } from './File/Section/types';
5
6
  export declare enum GroupRepertoireVisibility {
6
7
  Always = "always",
7
8
  ByEvent = "byEvent"
@@ -28,12 +29,11 @@ export interface GroupRepertoryInstrumentItemData {
28
29
  pages: number[];
29
30
  filesPath?: string[];
30
31
  }
31
- export declare type GroupRepertoireSectionId = InstrumentId | 'all';
32
32
  export interface GroupRepertoireScoreFilePage {
33
33
  tags: string[];
34
34
  }
35
35
  export interface AGroupRepertoireScoreFilePage extends GroupRepertoireScoreFilePage {
36
- id: GroupRepertoireSectionId;
36
+ id: FileSectionId;
37
37
  }
38
38
  declare type PageNumber = string;
39
39
  export interface GroupRepertoireFileSections {
@@ -47,7 +47,11 @@ export interface GroupRepertoireFile {
47
47
  readonly pageCount: number | null;
48
48
  readonly isEncrypted: boolean;
49
49
  identifyAt: number | null;
50
- sections: Partial<Record<GroupRepertoireSectionId, GroupRepertoireFileSections>>;
50
+ sections: Partial<Record<FileSectionId, GroupRepertoireFileSections>>;
51
+ }
52
+ export interface GroupRepertoireFilePathItem {
53
+ path: string;
54
+ tag: string | null;
51
55
  }
52
56
  export interface GroupRepertoryData extends ThemeBasicData {
53
57
  events: string[];
@@ -64,6 +68,7 @@ export interface GroupRepertoryData extends ThemeBasicData {
64
68
  /** @deprecated */
65
69
  identifyAt: Timestamp | null;
66
70
  files: Record<string, GroupRepertoireFile>;
71
+ filesPath: Record<FileSectionId, GroupRepertoireFilePathItem>;
67
72
  votes: Record<string, number>;
68
73
  thumbnailURL: string | null;
69
74
  editedAt: Timestamp | null;
@@ -91,7 +91,10 @@ class Group extends basic_1.default {
91
91
  return Object.keys(this.players);
92
92
  }
93
93
  get playersList() {
94
- const players = this.activePlayers.map((playerId) => (Object.assign(Object.assign({}, this.players[playerId]), { id: playerId })));
94
+ const players = this.activePlayers.map((playerId) => ({
95
+ ...this.players[playerId],
96
+ id: playerId,
97
+ }));
95
98
  return orders_1.orderByMusicStyle(players, 'mainInstrument', this.musicStyle);
96
99
  }
97
100
  get isActive() {
@@ -63,6 +63,9 @@ export interface GroupBasicData extends GroupTinyData {
63
63
  locality: string;
64
64
  location: GeoPoint;
65
65
  }
66
+ export declare enum GroupRepertoireTagReserved {
67
+ NoTag = "$noTag"
68
+ }
66
69
  export interface GroupRepertoireTag {
67
70
  title: string;
68
71
  default: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SocialNetwork = exports.GroupStatus = exports.GroupConfig = void 0;
3
+ exports.GroupRepertoireTagReserved = exports.SocialNetwork = exports.GroupStatus = exports.GroupConfig = void 0;
4
4
  var GroupConfig;
5
5
  (function (GroupConfig) {
6
6
  GroupConfig["IncludesMembersToEventsWhenJoined"] = "includesMembersToEventsWhenJoined";
@@ -19,3 +19,7 @@ var SocialNetwork;
19
19
  SocialNetwork["Instagram"] = "instagram";
20
20
  SocialNetwork["YouTube"] = "youtube";
21
21
  })(SocialNetwork = exports.SocialNetwork || (exports.SocialNetwork = {}));
22
+ var GroupRepertoireTagReserved;
23
+ (function (GroupRepertoireTagReserved) {
24
+ GroupRepertoireTagReserved["NoTag"] = "$noTag";
25
+ })(GroupRepertoireTagReserved = exports.GroupRepertoireTagReserved || (exports.GroupRepertoireTagReserved = {}));
@@ -10,7 +10,12 @@ class PartnerBasic extends tiny_1.default {
10
10
  super(doc);
11
11
  }
12
12
  get basicInfo() {
13
- return Object.assign(Object.assign({}, this.tinyInfo), { verifiedAt: this.verifiedAt, deletedAt: this.deletedAt, createdAt: this.createdAt });
13
+ return {
14
+ ...this.tinyInfo,
15
+ verifiedAt: this.verifiedAt,
16
+ deletedAt: this.deletedAt,
17
+ createdAt: this.createdAt,
18
+ };
14
19
  }
15
20
  get status() {
16
21
  if (this.isDeleted) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.16.2",
3
+ "version": "1.16.3",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -16,7 +16,9 @@
16
16
  "version": "npm run format && git add -A src && ./publish.sh",
17
17
  "postversion": "git push && git push --tags",
18
18
  "publish:beta": "npm publish --tag beta",
19
- "link": "cp package.json ./lib && cd ./lib && npm link"
19
+ "link": "cp package.json ./lib && cd ./lib && npm link",
20
+ "translation:upload": "localazy upload",
21
+ "translation:download": "localazy download"
20
22
  },
21
23
  "author": "Glissandoo",
22
24
  "license": "ISC",
@@ -27,6 +29,7 @@
27
29
  "lodash": "^4.17.21"
28
30
  },
29
31
  "devDependencies": {
32
+ "@localazy/cli": "^1.6.5",
30
33
  "@types/lodash": "^4.14.168",
31
34
  "@types/node": "^12.19.13",
32
35
  "@typescript-eslint/eslint-plugin": "^4.22.0",