@nu-art/bug-report-backend 0.500.0 → 0.500.6
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Module } from '@nu-art/ts-common';
|
|
2
|
-
import { API_AdminBugReport,
|
|
2
|
+
import { API_AdminBugReport, Paths } from '@nu-art/bug-report-shared/api';
|
|
3
3
|
type Config = {
|
|
4
4
|
projectId: string;
|
|
5
5
|
bucket?: string;
|
|
@@ -11,7 +11,7 @@ export declare class ModuleBE_AdminBR_Class extends Module<Config> {
|
|
|
11
11
|
protected init(): void;
|
|
12
12
|
retrieveLogs(_params?: API_AdminBugReport['retrieveLogs']['Params']): Promise<API_AdminBugReport['retrieveLogs']['Response']>;
|
|
13
13
|
downloadLogs(body: API_AdminBugReport['downloadLogs']['Body']): Promise<API_AdminBugReport['downloadLogs']['Response']>;
|
|
14
|
-
getFilesFirebase: () => Promise<DB_BugReport[]>;
|
|
14
|
+
getFilesFirebase: () => Promise<import("@nu-art/bug-report-shared/api").DB_BugReport[]>;
|
|
15
15
|
downloadFiles: (path: Paths) => Promise<{
|
|
16
16
|
fileName: string;
|
|
17
17
|
signedUrl: string;
|
|
@@ -51,9 +51,10 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
51
51
|
done = true;
|
|
52
52
|
};
|
|
53
53
|
import { Module } from '@nu-art/ts-common';
|
|
54
|
-
import { ApiDef_AdminBugReport } from '@nu-art/bug-report-shared/api';
|
|
55
|
-
import { ModuleBE_Firebase } from '@nu-art/firebase-backend
|
|
54
|
+
import { ApiDef_AdminBugReport, DBDef_BugReport } from '@nu-art/bug-report-shared/api';
|
|
55
|
+
import { ModuleBE_Firebase } from '@nu-art/firebase-backend';
|
|
56
56
|
import { ApiHandler } from '@nu-art/http-server';
|
|
57
|
+
import { _EmptyQuery } from '@nu-art/firebase-shared';
|
|
57
58
|
let ModuleBE_AdminBR_Class = (() => {
|
|
58
59
|
let _classSuper = Module;
|
|
59
60
|
let _instanceExtraInitializers = [];
|
|
@@ -77,16 +78,16 @@ let ModuleBE_AdminBR_Class = (() => {
|
|
|
77
78
|
super.init();
|
|
78
79
|
const sessAdmin = ModuleBE_Firebase.createAdminSession();
|
|
79
80
|
const firestore = sessAdmin.getFirestore();
|
|
80
|
-
this.bugReport = firestore.getCollection(
|
|
81
|
+
this.bugReport = firestore.getCollection(DBDef_BugReport);
|
|
81
82
|
this.storage = sessAdmin.getStorage();
|
|
82
83
|
}
|
|
83
84
|
async retrieveLogs(_params) {
|
|
84
|
-
return this.bugReport.
|
|
85
|
+
return this.bugReport.query.custom(_EmptyQuery);
|
|
85
86
|
}
|
|
86
87
|
async downloadLogs(body) {
|
|
87
88
|
return ModuleBE_AdminBR.downloadFiles(body);
|
|
88
89
|
}
|
|
89
|
-
getFilesFirebase = async () => this.bugReport.
|
|
90
|
+
getFilesFirebase = async () => this.bugReport.query.custom(_EmptyQuery);
|
|
90
91
|
downloadFiles = async (path) => {
|
|
91
92
|
const bucket = await this.storage.getOrCreateBucket(this.config?.bucket);
|
|
92
93
|
const file = await bucket.getFile(path.path);
|
|
@@ -50,12 +50,13 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
|
|
|
50
50
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
51
51
|
done = true;
|
|
52
52
|
};
|
|
53
|
-
import { addItemToArray, auditBy,
|
|
54
|
-
import { ModuleBE_Firebase } from '@nu-art/firebase-backend
|
|
53
|
+
import { addItemToArray, auditBy, filterInstances, generateHex, Module, padNumber } from '@nu-art/ts-common';
|
|
54
|
+
import { ModuleBE_Firebase } from '@nu-art/firebase-backend';
|
|
55
55
|
import { ApiHandler } from '@nu-art/http-server';
|
|
56
56
|
import JSZip from 'jszip';
|
|
57
|
-
import { ApiDef_BugReport } from '@nu-art/bug-report-shared';
|
|
57
|
+
import { ApiDef_BugReport, DBDef_BugReport } from '@nu-art/bug-report-shared';
|
|
58
58
|
import { MemKey_AccountId } from '@nu-art/user-account-backend';
|
|
59
|
+
import { stringToUniqueId } from '@nu-art/db-api-shared';
|
|
59
60
|
let ModuleBE_BugReport_Class = (() => {
|
|
60
61
|
let _classSuper = Module;
|
|
61
62
|
let _instanceExtraInitializers = [];
|
|
@@ -76,7 +77,7 @@ let ModuleBE_BugReport_Class = (() => {
|
|
|
76
77
|
init() {
|
|
77
78
|
const sessionAdmin = ModuleBE_Firebase.createAdminSession();
|
|
78
79
|
const firestore = sessionAdmin.getFirestore();
|
|
79
|
-
this.bugReport = firestore.getCollection(
|
|
80
|
+
this.bugReport = firestore.getCollection(DBDef_BugReport);
|
|
80
81
|
this.storage = sessionAdmin.getStorage();
|
|
81
82
|
}
|
|
82
83
|
async sendBugReport(body) {
|
|
@@ -99,13 +100,10 @@ let ModuleBE_BugReport_Class = (() => {
|
|
|
99
100
|
};
|
|
100
101
|
};
|
|
101
102
|
saveFile = async (bugReport, email) => {
|
|
102
|
-
const _id = generateHex(16);
|
|
103
|
+
const _id = stringToUniqueId(generateHex(16));
|
|
103
104
|
const logs = await Promise.all(bugReport.reports.map(report => this.saveLog(report, _id)));
|
|
104
|
-
const now = currentTimeMillis();
|
|
105
105
|
const instance = {
|
|
106
106
|
_id,
|
|
107
|
-
__created: now,
|
|
108
|
-
__updated: now,
|
|
109
107
|
subject: bugReport.subject,
|
|
110
108
|
description: bugReport.description,
|
|
111
109
|
reports: logs,
|
|
@@ -115,7 +113,7 @@ let ModuleBE_BugReport_Class = (() => {
|
|
|
115
113
|
instance.bucket = this.config.bucket;
|
|
116
114
|
const tickets = await Promise.all(this.ticketCreatorApis.map(api => api(bugReport, logs, email)));
|
|
117
115
|
instance.tickets = filterInstances(tickets);
|
|
118
|
-
await this.bugReport.
|
|
116
|
+
await this.bugReport.create.item(instance);
|
|
119
117
|
return instance.tickets;
|
|
120
118
|
};
|
|
121
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/bug-report-backend",
|
|
3
|
-
"version": "0.500.
|
|
3
|
+
"version": "0.500.6",
|
|
4
4
|
"description": "Bug Report Backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"TacB0sS",
|
|
@@ -29,16 +29,17 @@
|
|
|
29
29
|
"build": "tsc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nu-art/bug-report-shared": "0.500.
|
|
33
|
-
"@nu-art/firebase-backend": "0.500.
|
|
34
|
-
"@nu-art/firebase-shared": "0.500.
|
|
35
|
-
"@nu-art/jira-backend": "0.500.
|
|
36
|
-
"@nu-art/jira-shared": "0.500.
|
|
37
|
-
"@nu-art/slack-backend": "0.500.
|
|
38
|
-
"@nu-art/slack-shared": "0.500.
|
|
39
|
-
"@nu-art/ts-common": "0.500.
|
|
40
|
-
"@nu-art/
|
|
41
|
-
"@nu-art/user-account-
|
|
32
|
+
"@nu-art/bug-report-shared": "0.500.6",
|
|
33
|
+
"@nu-art/firebase-backend": "0.500.6",
|
|
34
|
+
"@nu-art/firebase-shared": "0.500.6",
|
|
35
|
+
"@nu-art/jira-backend": "0.500.6",
|
|
36
|
+
"@nu-art/jira-shared": "0.500.6",
|
|
37
|
+
"@nu-art/slack-backend": "0.500.6",
|
|
38
|
+
"@nu-art/slack-shared": "0.500.6",
|
|
39
|
+
"@nu-art/ts-common": "0.500.6",
|
|
40
|
+
"@nu-art/db-api-shared": "0.500.6",
|
|
41
|
+
"@nu-art/user-account-backend": "0.500.6",
|
|
42
|
+
"@nu-art/user-account-shared": "0.500.6",
|
|
42
43
|
"express": "^4.18.2",
|
|
43
44
|
"firebase": "^11.9.0",
|
|
44
45
|
"firebase-admin": "13.4.0",
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
"react": "^18.0.0",
|
|
48
49
|
"react-dom": "^18.0.0",
|
|
49
50
|
"react-router-dom": "^6.9.0",
|
|
50
|
-
"@nu-art/http-server": "
|
|
51
|
-
"@nu-art/api-types": "
|
|
51
|
+
"@nu-art/http-server": "0.500.6",
|
|
52
|
+
"@nu-art/api-types": "0.500.6"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/express": "^4.17.17",
|