@glissandoo/lib 1.55.0 → 1.55.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.
@@ -23,6 +23,12 @@ export declare namespace GroupRepertoryFbFunctionsTypes {
23
23
  groupId: string;
24
24
  }
25
25
  export type RemoveResult = void;
26
+ export interface CloneBetweenGroupsParams {
27
+ themeId: string;
28
+ groupId: string;
29
+ targetGroupId: string;
30
+ }
31
+ export type CloneBetweenGroupsResult = void;
26
32
  export interface ClaimMusicSheetParams {
27
33
  themeId: string;
28
34
  groupId: string;
@@ -79,6 +79,7 @@ export declare enum FbFunctionName {
79
79
  GroupRepertoryDownloadThemeFiles = "groupRepertory-downloadThemeFiles",
80
80
  GroupRepertoryDownloadFilesBySection = "groupRepertory-downloadFilesBySection",
81
81
  GroupRepertoryEdit = "groupRepertory-edit",
82
+ GroupRepertoryCloneBetweenGroups = "groupRepertory-cloneBetweenGroups",
82
83
  GroupRepertoryIdentifyInstruments = "groupRepertory-identifyInstruments",
83
84
  GroupRepertoryIdentifyInstrumentsFromFileNames = "groupRepertory-identifyInstrumentsFromFileNames",
84
85
  GroupRepertoryOnCreate = "groupRepertory-onCreate",
@@ -83,6 +83,7 @@ var FbFunctionName;
83
83
  FbFunctionName["GroupRepertoryDownloadThemeFiles"] = "groupRepertory-downloadThemeFiles";
84
84
  FbFunctionName["GroupRepertoryDownloadFilesBySection"] = "groupRepertory-downloadFilesBySection";
85
85
  FbFunctionName["GroupRepertoryEdit"] = "groupRepertory-edit";
86
+ FbFunctionName["GroupRepertoryCloneBetweenGroups"] = "groupRepertory-cloneBetweenGroups";
86
87
  FbFunctionName["GroupRepertoryIdentifyInstruments"] = "groupRepertory-identifyInstruments";
87
88
  FbFunctionName["GroupRepertoryIdentifyInstrumentsFromFileNames"] = "groupRepertory-identifyInstrumentsFromFileNames";
88
89
  FbFunctionName["GroupRepertoryOnCreate"] = "groupRepertory-onCreate";
@@ -52,6 +52,7 @@ const regionByFunctions = {
52
52
  [index_1.FbFunctionName.GroupPlayerEventOnUpdate]: GCloudRegions.UsCentral1,
53
53
  [index_1.FbFunctionName.GroupRepertoryPublish]: GCloudRegions.UsCentral1,
54
54
  [index_1.FbFunctionName.GroupRepertoryEdit]: GCloudRegions.UsCentral1,
55
+ [index_1.FbFunctionName.GroupRepertoryCloneBetweenGroups]: GCloudRegions.EuropeWest6,
55
56
  [index_1.FbFunctionName.GroupRepertoryRemove]: GCloudRegions.UsCentral1,
56
57
  [index_1.FbFunctionName.GroupRepertoryRate]: GCloudRegions.EuropeWest6,
57
58
  [index_1.FbFunctionName.GroupRepertoryDownloadThemeFiles]: GCloudRegions.UsCentral1,
@@ -43,4 +43,8 @@ export default class User extends UserBasic<UserData> {
43
43
  get lastWebLoginAt(): import("../../types/firestore").Timestamp | null;
44
44
  get glissandooAdminUrl(): string;
45
45
  get customerIds(): string[];
46
+ get devices(): Record<string, import("./types").UserDeviceInfo>;
47
+ get devicesList(): (import("./types").UserDeviceInfo & {
48
+ id: string;
49
+ })[];
46
50
  }
@@ -10,6 +10,7 @@ const utils_1 = require("../../helpers/utils");
10
10
  const lang_1 = require("../../lang");
11
11
  const basic_1 = __importDefault(require("./basic"));
12
12
  const types_1 = require("./types");
13
+ const objects_1 = require("../../helpers/objects");
13
14
  class User extends basic_1.default {
14
15
  constructor(doc) {
15
16
  super(doc, doc.get('language') || lang_1.defaultLocale);
@@ -122,5 +123,11 @@ class User extends basic_1.default {
122
123
  get customerIds() {
123
124
  return this.data.customerIds || [];
124
125
  }
126
+ get devices() {
127
+ return this.data.devices || {};
128
+ }
129
+ get devicesList() {
130
+ return (0, objects_1.mapToArray)(this.devices);
131
+ }
125
132
  }
126
133
  exports.default = User;
@@ -28,6 +28,18 @@ export declare enum UserEventsFilter {
28
28
  Annual = 12,
29
29
  Always = 1000
30
30
  }
31
+ export interface UserDeviceInfo {
32
+ deviceType: string;
33
+ systemVersion: string;
34
+ apiLevel: string;
35
+ uniqueId: string;
36
+ version: string;
37
+ model: string;
38
+ manufacturer: string;
39
+ deviceName: string;
40
+ systemName: string;
41
+ token: string;
42
+ }
31
43
  export interface UserTinyData {
32
44
  displayName: string;
33
45
  photoURL: string;
@@ -58,6 +70,7 @@ export interface UserData extends UserBasicData {
58
70
  groups: string[];
59
71
  groups_admin: string[];
60
72
  birthDate: Timestamp | null;
73
+ devices: Record<string, UserDeviceInfo>;
61
74
  notificationSettings: Record<UserNotificationSettings, boolean>;
62
75
  emailSettings: Record<UserEmailSettings, boolean>;
63
76
  appConfig: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.55.0",
3
+ "version": "1.55.2",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,11 +0,0 @@
1
- import * as firestore from '../types/firestore';
2
- /** Create a DocumentSnapshot. */
3
- export declare function makeDocumentSnapshot(
4
- /** Key-value pairs representing data in the document, pass in `{}` to mock the snapshot of
5
- * a document that doesn't exist.
6
- */
7
- data: {
8
- [key: string]: unknown;
9
- },
10
- /** Full path of the reference (e.g. 'users/alovelace') */
11
- refPath: string, project: string): firestore.DocumentSnapshot<firestore.DocumentData>;
@@ -1,196 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.makeDocumentSnapshot = void 0;
27
- const lodash_1 = require("lodash");
28
- const firestore = __importStar(require("../types/firestore"));
29
- const firebase = __importStar(require("firebase-admin"));
30
- /** @internal */
31
- function testApp() {
32
- if (typeof testApp.singleton === 'undefined') {
33
- testApp.init();
34
- }
35
- return testApp.singleton;
36
- }
37
- /** @internal */
38
- (function (testApp) {
39
- testApp.init = () => (testApp.singleton = new testApp.App());
40
- class App {
41
- constructor() {
42
- return;
43
- }
44
- getApp() {
45
- if (typeof this.appSingleton === 'undefined') {
46
- const config = process.env.FIREBASE_CONFIG
47
- ? JSON.parse(process.env.FIREBASE_CONFIG)
48
- : {};
49
- this.appSingleton = firebase.initializeApp(config,
50
- // Give this app a name so it does not conflict with apps that user initialized.
51
- 'firebase-functions-test');
52
- }
53
- return this.appSingleton;
54
- }
55
- deleteApp() {
56
- if (this.appSingleton) {
57
- void this.appSingleton.delete();
58
- delete this.appSingleton;
59
- }
60
- }
61
- }
62
- testApp.App = App;
63
- })(testApp || (testApp = {}));
64
- /** @internal */
65
- function objectToValueProto(data) {
66
- const encodeHelper = (val) => {
67
- if (typeof val === 'string') {
68
- return {
69
- stringValue: val,
70
- };
71
- }
72
- if (typeof val === 'boolean') {
73
- return {
74
- booleanValue: val,
75
- };
76
- }
77
- if (typeof val === 'number') {
78
- if (val % 1 === 0) {
79
- return {
80
- integerValue: val,
81
- };
82
- }
83
- return {
84
- doubleValue: val,
85
- };
86
- }
87
- if (val instanceof Date) {
88
- return {
89
- timestampValue: val.toISOString(),
90
- };
91
- }
92
- if (val instanceof Array) {
93
- const encodedElements = [];
94
- for (const elem of val) {
95
- const enc = encodeHelper(elem);
96
- if (enc) {
97
- encodedElements.push(enc);
98
- }
99
- }
100
- return {
101
- arrayValue: {
102
- values: encodedElements,
103
- },
104
- };
105
- }
106
- if (val === null) {
107
- // TODO: Look this up. This is a google.protobuf.NulLValue,
108
- // and everything in google.protobuf has a customized JSON encoder.
109
- // OTOH, Firestore's generated .d.ts files don't take this into
110
- // account and have the default proto layout.
111
- return {
112
- nullValue: 'NULL_VALUE',
113
- };
114
- }
115
- if (val instanceof Buffer || val instanceof Uint8Array) {
116
- return {
117
- bytesValue: val,
118
- };
119
- }
120
- if (val instanceof firestore.DocumentReference) {
121
- const projectId = (0, lodash_1.get)(val, '_referencePath.projectId');
122
- const database = (0, lodash_1.get)(val, '_referencePath.databaseId');
123
- const referenceValue = [
124
- 'projects',
125
- projectId,
126
- 'databases',
127
- database,
128
- val.path,
129
- ].join('/');
130
- return { referenceValue };
131
- }
132
- if (val instanceof firestore.Timestamp) {
133
- return {
134
- timestampValue: val.toDate().toISOString(),
135
- };
136
- }
137
- if (val instanceof firestore.GeoPoint) {
138
- return {
139
- geoPointValue: {
140
- latitude: val.latitude,
141
- longitude: val.longitude,
142
- },
143
- };
144
- }
145
- if ((0, lodash_1.isPlainObject)(val)) {
146
- if (!val)
147
- return;
148
- return {
149
- mapValue: {
150
- fields: objectToValueProto(val),
151
- },
152
- };
153
- }
154
- throw new Error('Cannot encode to a Firestore Value');
155
- };
156
- return (0, lodash_1.mapValues)(data, encodeHelper);
157
- }
158
- function dateToTimestampProto(timeString) {
159
- if (typeof timeString === 'undefined') {
160
- return;
161
- }
162
- const date = new Date(timeString);
163
- const seconds = Math.floor(date.getTime() / 1000);
164
- let nanos = 0;
165
- if (timeString.length > 20) {
166
- const nanoString = timeString.substring(20, timeString.length - 1);
167
- const trailingZeroes = 9 - nanoString.length;
168
- nanos = parseInt(nanoString, 10) * Math.pow(10, trailingZeroes);
169
- }
170
- return { seconds, nanos };
171
- }
172
- /** Create a DocumentSnapshot. */
173
- function makeDocumentSnapshot(
174
- /** Key-value pairs representing data in the document, pass in `{}` to mock the snapshot of
175
- * a document that doesn't exist.
176
- */
177
- data,
178
- /** Full path of the reference (e.g. 'users/alovelace') */
179
- refPath, project) {
180
- const firestoreService = firebase.firestore(testApp().getApp());
181
- const resource = `projects/${project}/databases/(default)/documents/${refPath}`;
182
- const proto = (0, lodash_1.isEmpty)(data)
183
- ? resource
184
- : {
185
- fields: objectToValueProto(data),
186
- createTime: dateToTimestampProto(new Date().toISOString()),
187
- updateTime: dateToTimestampProto(new Date().toISOString()),
188
- name: resource,
189
- };
190
- const readTimeProto = dateToTimestampProto(new Date().toISOString());
191
- /* eslint-disable */
192
- // @ts-ignore
193
- return firestoreService.snapshot_(proto, readTimeProto, 'json');
194
- /* eslint-enable */
195
- }
196
- exports.makeDocumentSnapshot = makeDocumentSnapshot;