@glissandoo/lib 1.16.11 → 1.17.1

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.
@@ -16,4 +16,13 @@ export declare namespace EventoRepertoryFbFunctionsTypes {
16
16
  filename: string;
17
17
  path: string;
18
18
  }
19
+ interface DownloadParams {
20
+ eventId: string;
21
+ instrumentId: InstrumentId;
22
+ tags: string[];
23
+ }
24
+ interface DownloadResult {
25
+ filename: string;
26
+ path: string;
27
+ }
19
28
  }
@@ -17,6 +17,7 @@ export declare enum FbFunctionName {
17
17
  EventPublish = "event-publish",
18
18
  EventRemove = "event-remove",
19
19
  EventRepertoryDownloadPdf = "eventRepertory-downloadPdf",
20
+ EventRepertoryDownload = "eventRepertory-download",
20
21
  EventRepertoryEdit = "eventRepertory-edit",
21
22
  EventSetRollcall = "event-setRollCall",
22
23
  FederationAddConfirmedAdmin = "federation-addConfirmedAdmin",
@@ -21,6 +21,7 @@ var FbFunctionName;
21
21
  FbFunctionName["EventPublish"] = "event-publish";
22
22
  FbFunctionName["EventRemove"] = "event-remove";
23
23
  FbFunctionName["EventRepertoryDownloadPdf"] = "eventRepertory-downloadPdf";
24
+ FbFunctionName["EventRepertoryDownload"] = "eventRepertory-download";
24
25
  FbFunctionName["EventRepertoryEdit"] = "eventRepertory-edit";
25
26
  FbFunctionName["EventSetRollcall"] = "event-setRollCall";
26
27
  FbFunctionName["FederationAddConfirmedAdmin"] = "federation-addConfirmedAdmin";
@@ -60,6 +60,7 @@ const regionByFunctions = {
60
60
  [index_1.FbFunctionName.EventPlayerEdit]: GCloudRegions.UsCentral1,
61
61
  [index_1.FbFunctionName.EventRepertoryEdit]: GCloudRegions.UsCentral1,
62
62
  [index_1.FbFunctionName.EventRepertoryDownloadPdf]: GCloudRegions.EuropeWest6,
63
+ [index_1.FbFunctionName.EventRepertoryDownload]: GCloudRegions.EuropeWest6,
63
64
  [index_1.FbFunctionName.FederationAddPendingAdmin]: GCloudRegions.EuropeWest6,
64
65
  [index_1.FbFunctionName.FederationAddConfirmedAdmin]: GCloudRegions.EuropeWest6,
65
66
  [index_1.FbFunctionName.FederationRemoveAdmin]: GCloudRegions.EuropeWest6,
package/helpers/utils.js CHANGED
@@ -10,7 +10,6 @@ const lodash_1 = require("lodash");
10
10
  const get_1 = __importDefault(require("lodash/get"));
11
11
  const lang_1 = require("../lang");
12
12
  const Instrument_1 = __importDefault(require("../models/Instrument"));
13
- const instruments_1 = require("./instruments");
14
13
  const replaceVarsBrackets = (string, values) => {
15
14
  const matches = string.match(/[^[\]]+(?=])/g);
16
15
  let replaceString = string;
@@ -40,11 +39,10 @@ const replaceKeysNotification = (string, values, lang) => {
40
39
  switch (type) {
41
40
  case 'instrument': {
42
41
  const instrumentId = get_1.default(newValues, key.split('.'));
43
- if (!Object.values(instruments_1.InstrumentId).includes(instrumentId)) {
44
- throw new Error(`Invalid instrumentId: ${instrumentId} from value: ${value}`);
45
- }
46
42
  const instrument = new Instrument_1.default(instrumentId, lang);
47
- replaceString = replaceString.replace(match, instrument.name.toLowerCase());
43
+ if (instrument) {
44
+ replaceString = replaceString.replace(match, instrument.name.toLowerCase());
45
+ }
48
46
  break;
49
47
  }
50
48
  case 'date': {
@@ -1,3 +1,4 @@
1
+ import { MusicStyleType } from '../../../../../helpers/musicStyles';
1
2
  import { LanguagesTypes } from '../../../../../lang';
2
3
  import { FileSectionId } from './types';
3
4
  export default class GroupRepertoryFileSection {
@@ -5,4 +6,5 @@ export default class GroupRepertoryFileSection {
5
6
  private lang;
6
7
  constructor(id: FileSectionId, lang?: LanguagesTypes);
7
8
  get name(): string;
9
+ getOrder(musicStyle: MusicStyleType): number;
8
10
  }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const orders_1 = require("../../../../../helpers/fileSections/orders");
6
7
  const lang_1 = require("../../../../../lang");
7
8
  const Instrument_1 = __importDefault(require("../../../../Instrument"));
8
9
  const types_1 = require("./types");
@@ -16,5 +17,8 @@ class GroupRepertoryFileSection {
16
17
  ? lang_1.getTranslation(`sections.all`, this.lang)
17
18
  : new Instrument_1.default(this.id).name) || this.id);
18
19
  }
20
+ getOrder(musicStyle) {
21
+ return orders_1.getOrderByMusicStyle(musicStyle).indexOf(this.id) + 1 || Infinity;
22
+ }
19
23
  }
20
24
  exports.default = GroupRepertoryFileSection;
@@ -24,7 +24,7 @@ export default class GroupRepertory extends Theme<GroupRepertoryData> {
24
24
  get filesPath(): Partial<Record<FileSectionId, import("./types").GroupRepertoireFilePathItem[]>>;
25
25
  get filesPathList(): {
26
26
  path: string;
27
- tag: string | null;
27
+ tag: string;
28
28
  sectionId: FileSectionId;
29
29
  }[];
30
30
  /** @deprecated use sections */
@@ -36,6 +36,7 @@ export interface AGroupRepertoireScoreFilePage extends GroupRepertoireScoreFileP
36
36
  id: FileSectionId;
37
37
  }
38
38
  declare type PageNumber = string;
39
+ declare type FileId = string;
39
40
  export interface GroupRepertoireFileSections {
40
41
  tags?: string[];
41
42
  pages?: Record<PageNumber, GroupRepertoireScoreFilePage>;
@@ -51,7 +52,7 @@ export interface GroupRepertoireFile {
51
52
  }
52
53
  export interface GroupRepertoireFilePathItem {
53
54
  path: string;
54
- tag: string | null;
55
+ tag: string;
55
56
  }
56
57
  export interface GroupRepertoryData extends ThemeBasicData {
57
58
  events: string[];
@@ -67,7 +68,7 @@ export interface GroupRepertoryData extends ThemeBasicData {
67
68
  audios: string[];
68
69
  /** @deprecated */
69
70
  identifyAt: Timestamp | null;
70
- files: Record<string, GroupRepertoireFile>;
71
+ files: Record<FileId, GroupRepertoireFile>;
71
72
  filesPath: Partial<Record<FileSectionId, GroupRepertoireFilePathItem[]>>;
72
73
  votes: Record<string, number>;
73
74
  thumbnailURL: string | null;
@@ -2,7 +2,7 @@ import { DocumentReference, DocumentSnapshot } from '@google-cloud/firestore';
2
2
  import { PlansGroup } from '../../helpers/plans';
3
3
  import { LanguagesTypes } from '../../lang';
4
4
  import GroupBasic from './basic';
5
- import { GroupData, GroupRepertoireTag, GroupStatus, SocialNetwork } from './types';
5
+ import { GroupData, GroupStatus, SocialNetwork } from './types';
6
6
  export default class Group extends GroupBasic<GroupData> {
7
7
  constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
8
8
  get owner(): DocumentReference;
@@ -61,10 +61,9 @@ export default class Group extends GroupBasic<GroupData> {
61
61
  id: string;
62
62
  })[];
63
63
  get firstAnswerAt(): FirebaseFirestore.Timestamp | null;
64
- get repertoireTags(): Record<string, GroupRepertoireTag>;
65
- get repertoireTagsList(): (GroupRepertoireTag & {
64
+ get repertoireTags(): Record<string, import("./types").GroupRepertoireTag>;
65
+ get repertoireTagsList(): (import("./types").GroupRepertoireTag & {
66
66
  id: string;
67
67
  })[];
68
68
  getRepertoireTagName(id: string): string | null;
69
- getRepertoireTagNameTranslator(): (id: string, repertoireTags?: Record<string, GroupRepertoireTag>, lang?: LanguagesTypes) => string | null;
70
69
  }
@@ -174,13 +174,5 @@ class Group extends basic_1.default {
174
174
  const tag = this.repertoireTags[id];
175
175
  return tag.default ? lang_1.getTranslation(tag.title, this.lang) : tag.title;
176
176
  }
177
- getRepertoireTagNameTranslator() {
178
- return (id, repertoireTags = { ...this.repertoireTags }, lang = this.lang) => {
179
- if (!(id in repertoireTags))
180
- return null;
181
- const tag = repertoireTags[id];
182
- return tag.default ? lang_1.getTranslation(tag.title, lang) : tag.title;
183
- };
184
- }
185
177
  }
186
178
  exports.default = Group;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.16.11",
3
+ "version": "1.17.1",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",