@intuitionrobotics/file-upload 0.43.3 → 0.44.0
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.
- package/app-backend/api/_upload.js +2 -2
- package/app-backend/api/_upload.js.map +1 -1
- package/app-backend/api/v1/upload/get-url.js +2 -20
- package/app-backend/api/v1/upload/get-url.js.map +1 -1
- package/app-backend/core/module-pack.d.ts +1 -1
- package/app-backend/core/module-pack.js +2 -2
- package/app-backend/core/module-pack.js.map +1 -1
- package/app-backend/modules/BucketListener.d.ts +1 -1
- package/app-backend/modules/BucketListener.js +4 -21
- package/app-backend/modules/BucketListener.js.map +1 -1
- package/app-backend/modules/ServerUploaderModule.d.ts +3 -2
- package/app-backend/modules/ServerUploaderModule.js +3 -21
- package/app-backend/modules/ServerUploaderModule.js.map +1 -1
- package/app-backend/modules/UploaderModule.d.ts +2 -2
- package/app-backend/modules/UploaderModule.js +15 -30
- package/app-backend/modules/UploaderModule.js.map +1 -1
- package/app-backend/modules/UploaderTempFileModule.d.ts +4 -4
- package/app-backend/modules/UploaderTempFileModule.js +11 -29
- package/app-backend/modules/UploaderTempFileModule.js.map +1 -1
- package/app-frontend/core/module-pack.d.ts +1 -1
- package/app-frontend/core/module-pack.js +2 -20
- package/app-frontend/core/module-pack.js.map +1 -1
- package/app-frontend/modules/UploaderModule.d.ts +4 -3
- package/app-frontend/modules/UploaderModule.js +12 -26
- package/app-frontend/modules/UploaderModule.js.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +0 -30
- package/index.js.map +1 -1
- package/package.json +7 -7
- package/shared/modules/BaseUploaderModule.d.ts +5 -3
- package/shared/modules/BaseUploaderModule.js +19 -31
- package/shared/modules/BaseUploaderModule.js.map +1 -1
- package/shared/types.d.ts +3 -4
- package/shared/types.js +0 -18
- package/shared/types.js.map +1 -1
- package/backend.d.ts +0 -5
- package/backend.js +0 -36
- package/backend.js.map +0 -1
- package/frontend.d.ts +0 -2
- package/frontend.js +0 -33
- package/frontend.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
module.exports = new
|
|
3
|
+
const HttpServer_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/server/HttpServer");
|
|
4
|
+
module.exports = new HttpServer_1.RouteResolver(require, __dirname);
|
|
5
5
|
//# sourceMappingURL=_upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_upload.js","sourceRoot":"","sources":["../../../src/main/app-backend/api/_upload.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"_upload.js","sourceRoot":"","sources":["../../../src/main/app-backend/api/_upload.ts"],"names":[],"mappings":";;AAAA,sGAAoG;AAEpG,MAAM,CAAC,OAAO,GAAG,IAAI,0BAAa,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -27,9 +9,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
9
|
});
|
|
28
10
|
};
|
|
29
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const
|
|
12
|
+
const server_api_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/server/server-api");
|
|
31
13
|
const UploaderModule_1 = require("../../../modules/UploaderModule");
|
|
32
|
-
class ServerApi_GetUploadUrl extends
|
|
14
|
+
class ServerApi_GetUploadUrl extends server_api_1.ServerApi_Post {
|
|
33
15
|
constructor() {
|
|
34
16
|
super('get-url');
|
|
35
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-url.js","sourceRoot":"","sources":["../../../../../src/main/app-backend/api/v1/upload/get-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-url.js","sourceRoot":"","sources":["../../../../../src/main/app-backend/api/v1/upload/get-url.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sGAAkH;AAIlH,oEAA+D;AAE/D,MAAM,sBACF,SAAQ,2BAAgC;IACxC;QACI,KAAK,CAAC,SAAS,CAAC,CAAA;IACpB,CAAC;IAEe,OAAO,CAAC,OAAuB,EAAE,QAAqB,EAAE,WAAwB,EAAE,IAAwB;;YACtH,OAAO,+BAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;KAAA;CACJ;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,sBAAsB,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Backend_ModulePack_Uploader: (import("../modules/UploaderTempFileModule").UploaderTempFileModule_Class | import("
|
|
1
|
+
export declare const Backend_ModulePack_Uploader: (import("../modules/UploaderTempFileModule").UploaderTempFileModule_Class | import("../modules/BucketListener").BucketListener_Class | import("@intuitionrobotics/push-pub-sub/app-backend/modules/PushPubSubModule").PushPubSubModule_Class | import("../modules/UploaderModule").UploaderModule_Class | import("@intuitionrobotics/push-pub-sub/app-backend/modules/ScheduledPushCleanup").ScheduledCleanup_Class | import("../modules/ServerUploaderModule").ServerUploaderModule_Class)[];
|
|
@@ -22,10 +22,10 @@ exports.Backend_ModulePack_Uploader = void 0;
|
|
|
22
22
|
const UploaderModule_1 = require("../modules/UploaderModule");
|
|
23
23
|
const UploaderTempFileModule_1 = require("../modules/UploaderTempFileModule");
|
|
24
24
|
const BucketListener_1 = require("../modules/BucketListener");
|
|
25
|
-
const
|
|
25
|
+
const module_pack_1 = require("@intuitionrobotics/push-pub-sub/app-backend/core/module-pack");
|
|
26
26
|
const ServerUploaderModule_1 = require("../modules/ServerUploaderModule");
|
|
27
27
|
exports.Backend_ModulePack_Uploader = [
|
|
28
|
-
...
|
|
28
|
+
...module_pack_1.Backend_ModulePack_PushPubSub,
|
|
29
29
|
ServerUploaderModule_1.ServerUploaderModule,
|
|
30
30
|
UploaderModule_1.UploaderModule,
|
|
31
31
|
UploaderTempFileModule_1.UploaderTempFileModule,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-pack.js","sourceRoot":"","sources":["../../../src/main/app-backend/core/module-pack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,8DAAyD;AACzD,8EAAyE;AACzE,8DAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"module-pack.js","sourceRoot":"","sources":["../../../src/main/app-backend/core/module-pack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,8DAAyD;AACzD,8EAAyE;AACzE,8DAAyD;AACzD,8FAA2G;AAC3G,0EAAqE;AAExD,QAAA,2BAA2B,GAAG;IACvC,GAAG,2CAA6B;IAChC,2CAAoB;IACpB,+BAAc;IACd,+CAAsB;IACtB,+BAAc;CACjB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Firebase_StorageFunction } from "@intuitionrobotics/firebase/backend-
|
|
1
|
+
import { Firebase_StorageFunction } from "@intuitionrobotics/firebase/app-backend/functions/firebase-function";
|
|
2
2
|
import { ObjectMetadata } from "firebase-functions/lib/v1/providers/storage";
|
|
3
3
|
import { EventContext } from "firebase-functions";
|
|
4
4
|
export interface OnFileUploaded {
|
|
@@ -1,21 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* A backend boilerplate with example apis
|
|
4
|
-
*
|
|
5
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
6
|
-
*
|
|
7
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
* See the License for the specific language governing permissions and
|
|
17
|
-
* limitations under the License.
|
|
18
|
-
*/
|
|
19
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
20
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -27,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
10
|
};
|
|
28
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
12
|
exports.BucketListener = exports.BucketListener_Class = void 0;
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const dispatcher_onFileUploaded = new
|
|
33
|
-
class BucketListener_Class extends
|
|
13
|
+
const firebase_function_1 = require("@intuitionrobotics/firebase/app-backend/functions/firebase-function");
|
|
14
|
+
const dispatcher_1 = require("@intuitionrobotics/ts-common/core/dispatcher");
|
|
15
|
+
const dispatcher_onFileUploaded = new dispatcher_1.Dispatcher("__onFileUploaded");
|
|
16
|
+
class BucketListener_Class extends firebase_function_1.Firebase_StorageFunction {
|
|
34
17
|
constructor() {
|
|
35
18
|
super("BucketListener");
|
|
36
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BucketListener.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/BucketListener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BucketListener.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/BucketListener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2GAA6G;AAG7G,6EAAwE;AAMxE,MAAM,yBAAyB,GAAG,IAAI,uBAAU,CAAqC,kBAAkB,CAAC,CAAC;AAGzG,MAAa,oBACT,SAAQ,4CAAwB;IAChC;QACI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5B,CAAC;IAGD,IAAI;QACA,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,aAAa;QACb,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAEK,UAAU,CAAC,MAAsB,EAAE,OAAqB;;YAC1D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;YAC7B,MAAM,yBAAyB,CAAC,mBAAmB,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;KAAA;CAEJ;AArBD,oDAqBC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { BaseUploaderFile,
|
|
2
|
+
import { BaseUploaderFile, Request_Uploader, TempSecureUrl } from "../../shared/types";
|
|
3
3
|
import { BaseUploaderModule_Class } from "../../shared/modules/BaseUploaderModule";
|
|
4
|
-
import {
|
|
4
|
+
import { AxiosHttpModule_Class } from "@intuitionrobotics/thunderstorm/app-backend/modules/http/AxiosHttpModule";
|
|
5
|
+
import { Axios_RequestConfig } from "@intuitionrobotics/thunderstorm/app-backend/modules/http/types";
|
|
5
6
|
export declare type ServerFilesToUpload = Request_Uploader & {
|
|
6
7
|
file: Buffer;
|
|
7
8
|
};
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -29,14 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
29
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
12
|
exports.ServerUploaderModule = exports.ServerUploaderModule_Class = void 0;
|
|
31
13
|
const BaseUploaderModule_1 = require("../../shared/modules/BaseUploaderModule");
|
|
32
|
-
const
|
|
14
|
+
const AxiosHttpModule_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/http/AxiosHttpModule");
|
|
33
15
|
class ServerUploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class {
|
|
34
16
|
constructor() {
|
|
35
|
-
super(
|
|
17
|
+
super(AxiosHttpModule_1.AxiosHttpModule, "ServerUploaderModule");
|
|
36
18
|
}
|
|
37
19
|
init() {
|
|
38
20
|
super.init();
|
|
39
|
-
|
|
21
|
+
AxiosHttpModule_1.AxiosHttpModule.setRequestOption(this.config.requestConfig);
|
|
40
22
|
}
|
|
41
23
|
upload(files) {
|
|
42
24
|
return this.uploadImpl(files);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerUploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/ServerUploaderModule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerUploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/ServerUploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gFAAkF;AAClF,8GAGkF;AAOlF,MAAa,0BACT,SAAQ,6CAAuF;IAE/F;QACI,KAAK,CAAC,iCAAe,EAAE,sBAAsB,CAAC,CAAC;IACnD,CAAC;IAED,IAAI;QACA,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,iCAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,KAA4B;QAC/B,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAEe,eAAe,CAAC,WAA4B;;YACxD,eAAe;YACf,kBAAkB;QACtB,CAAC;KAAA;CACJ;AApBD,gEAoBC;AAEY,QAAA,oBAAoB,GAAG,IAAI,0BAA0B,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Module } from "@intuitionrobotics/ts-common";
|
|
2
|
-
import { FileWrapper } from "@intuitionrobotics/firebase/backend";
|
|
3
1
|
import { BaseUploaderFile, DB_Temp_File, TempSecureUrl } from "../../shared/types";
|
|
4
2
|
import { OnFileUploaded } from "./BucketListener";
|
|
3
|
+
import { FileWrapper } from "@intuitionrobotics/firebase/app-backend/storage/StorageWrapper";
|
|
4
|
+
import { Module } from "@intuitionrobotics/ts-common/core/module";
|
|
5
5
|
export declare const Temp_Path = "files-temp";
|
|
6
6
|
declare type Config = {
|
|
7
7
|
bucketName?: string;
|
|
@@ -10,31 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.UploaderModule = exports.UploaderModule_Class = exports.Temp_Path = void 0;
|
|
13
|
-
/*
|
|
14
|
-
* Permissions management system, define access level for each of
|
|
15
|
-
* your server apis, and restrict users by giving them access levels
|
|
16
|
-
*
|
|
17
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
18
|
-
*
|
|
19
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
-
* you may not use this file except in compliance with the License.
|
|
21
|
-
* You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
32
|
-
const backend_1 = require("@intuitionrobotics/firebase/backend");
|
|
33
13
|
const types_1 = require("../../shared/types");
|
|
34
14
|
const UploaderTempFileModule_1 = require("./UploaderTempFileModule");
|
|
35
|
-
const
|
|
15
|
+
const module_1 = require("@intuitionrobotics/ts-common/core/module");
|
|
16
|
+
const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
|
|
17
|
+
const FirebaseModule_1 = require("@intuitionrobotics/firebase/app-backend/FirebaseModule");
|
|
18
|
+
const random_tools_1 = require("@intuitionrobotics/ts-common/utils/random-tools");
|
|
19
|
+
const date_time_tools_1 = require("@intuitionrobotics/ts-common/utils/date-time-tools");
|
|
20
|
+
const PushPubSubModule_1 = require("@intuitionrobotics/push-pub-sub/app-backend/modules/PushPubSubModule");
|
|
36
21
|
exports.Temp_Path = "files-temp";
|
|
37
|
-
class UploaderModule_Class extends
|
|
22
|
+
class UploaderModule_Class extends module_1.Module {
|
|
38
23
|
constructor() {
|
|
39
24
|
super("UploaderModule");
|
|
40
25
|
this.setPostProcessor = (validator) => {
|
|
@@ -43,12 +28,12 @@ class UploaderModule_Class extends ts_common_1.Module {
|
|
|
43
28
|
this.getProcessor = (k) => {
|
|
44
29
|
const postProcessorElement = this.postProcessor[k];
|
|
45
30
|
if (!postProcessorElement)
|
|
46
|
-
throw new
|
|
31
|
+
throw new exceptions_1.ImplementationMissingException(`Missing validator for type ${k}`);
|
|
47
32
|
return postProcessorElement;
|
|
48
33
|
};
|
|
49
34
|
this.fileUploaded = (filePath) => __awaiter(this, void 0, void 0, function* () {
|
|
50
35
|
if (!filePath)
|
|
51
|
-
throw new
|
|
36
|
+
throw new exceptions_1.ThisShouldNotHappenException("Missing file path");
|
|
52
37
|
this.logInfo(`Looking for file with path ${filePath}`);
|
|
53
38
|
// I use collection and not the module directly since I want to handle failure my way
|
|
54
39
|
const tempMeta = yield UploaderTempFileModule_1.UploaderTempFileModule.collection.queryUnique({ where: { path: filePath } });
|
|
@@ -81,7 +66,7 @@ class UploaderModule_Class extends ts_common_1.Module {
|
|
|
81
66
|
this.notifyFrontend = (feId, result, message, cause) => __awaiter(this, void 0, void 0, function* () {
|
|
82
67
|
cause && this.logWarning(cause);
|
|
83
68
|
const data = { message, result, cause };
|
|
84
|
-
yield
|
|
69
|
+
yield PushPubSubModule_1.PushPubSubModule.pushToKey(types_1.fileUploadedKey, { feId }, data);
|
|
85
70
|
});
|
|
86
71
|
}
|
|
87
72
|
__onFileUploaded(filePath) {
|
|
@@ -91,8 +76,8 @@ class UploaderModule_Class extends ts_common_1.Module {
|
|
|
91
76
|
}
|
|
92
77
|
init() {
|
|
93
78
|
if (!this.postProcessor)
|
|
94
|
-
throw new
|
|
95
|
-
this.storage =
|
|
79
|
+
throw new exceptions_1.ImplementationMissingException("You must set a postProcessor for the UploaderModule");
|
|
80
|
+
this.storage = FirebaseModule_1.FirebaseModule.createAdminSession(this.config.uploaderProjectId).getStorage();
|
|
96
81
|
}
|
|
97
82
|
getUrl(body, pathPrefix = exports.Temp_Path) {
|
|
98
83
|
var _a;
|
|
@@ -102,7 +87,7 @@ class UploaderModule_Class extends ts_common_1.Module {
|
|
|
102
87
|
return Promise.all(body.map((_file) => __awaiter(this, void 0, void 0, function* () {
|
|
103
88
|
const key = _file.key || _file.mimeType;
|
|
104
89
|
this.getProcessor(key);
|
|
105
|
-
const _id =
|
|
90
|
+
const _id = random_tools_1.generateHex(32);
|
|
106
91
|
const path = `${pathPrefix}/${_id}`;
|
|
107
92
|
const instance = {
|
|
108
93
|
_id,
|
|
@@ -111,7 +96,7 @@ class UploaderModule_Class extends ts_common_1.Module {
|
|
|
111
96
|
mimeType: _file.mimeType,
|
|
112
97
|
key,
|
|
113
98
|
path,
|
|
114
|
-
_audit:
|
|
99
|
+
_audit: date_time_tools_1.auditBy("be-stub"),
|
|
115
100
|
bucketName: bucket.bucketName
|
|
116
101
|
};
|
|
117
102
|
if (_file.public)
|
|
@@ -120,7 +105,7 @@ class UploaderModule_Class extends ts_common_1.Module {
|
|
|
120
105
|
instance.metadata = _file.metadata;
|
|
121
106
|
const temp = yield UploaderTempFileModule_1.UploaderTempFileModule.upsert(instance);
|
|
122
107
|
const file = yield bucket.getFile(temp.path);
|
|
123
|
-
const url = yield file.getWriteSecuredUrl(_file.mimeType,
|
|
108
|
+
const url = yield file.getWriteSecuredUrl(_file.mimeType, date_time_tools_1.Hour);
|
|
124
109
|
return {
|
|
125
110
|
secureUrl: url.securedUrl,
|
|
126
111
|
tempDoc: temp
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"UploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAO4B;AAC5B,qEAAgE;AAGhE,qEAAgE;AAChE,6EAGsD;AACtD,2FAAsF;AACtF,kFAA4E;AAC5E,wFAAiF;AACjF,2GAAsG;AAEzF,QAAA,SAAS,GAAG,YAAY,CAAC;AAStC,MAAa,oBACT,SAAQ,eAAc;IAGtB;QACI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAW5B,qBAAgB,GAAG,CAAC,SAAyC,EAAE,EAAE;YAC7D,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;QACnC,CAAC,CAAC;QAEK,iBAAY,GAAG,CAAC,CAAS,EAAE,EAAE;YAChC,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YACnD,IAAI,CAAC,oBAAoB;gBACrB,MAAM,IAAI,2CAA8B,CAAC,8BAA8B,CAAC,EAAE,CAAC,CAAC;YAEhF,OAAO,oBAAoB,CAAC;QAChC,CAAC,CAAC;QA6CF,iBAAY,GAAG,CAAO,QAAiB,EAAE,EAAE;YAC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oBACzB,OAAO,EAAE,IAAI;iBAChB,CAAC;YACN,CAAC,CAAA,CAAC,CAAC,CAAC;;KACP;CA4CJ;AAjHD,oDAiHC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { TypeValidator } from "@intuitionrobotics/ts-common";
|
|
2
|
-
import { ServerApi } from "@intuitionrobotics/thunderstorm/backend";
|
|
3
|
-
import { BaseDB_ApiGenerator } from "@intuitionrobotics/db-api-generator/backend";
|
|
1
|
+
import { TypeValidator } from "@intuitionrobotics/ts-common/validator/validator";
|
|
2
|
+
import { ServerApi } from "@intuitionrobotics/thunderstorm/app-backend/modules/server/server-api";
|
|
3
|
+
import { BaseDB_ApiGenerator } from "@intuitionrobotics/db-api-generator/app-backend/BaseDB_ApiGenerator";
|
|
4
4
|
import { DB_Temp_File } from "../../shared/types";
|
|
5
5
|
export declare const TEMP_COLLECTION = "temp-files-upload";
|
|
6
|
-
export declare const validateName: import("@intuitionrobotics/ts-common").Validator<string>;
|
|
6
|
+
export declare const validateName: import("@intuitionrobotics/ts-common/validator/validator").Validator<string>;
|
|
7
7
|
export declare class UploaderTempFileModule_Class extends BaseDB_ApiGenerator<DB_Temp_File> {
|
|
8
8
|
static _validator: TypeValidator<DB_Temp_File>;
|
|
9
9
|
constructor();
|
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UploaderTempFileModule = exports.UploaderTempFileModule_Class = exports.validateName = exports.TEMP_COLLECTION = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* your server apis, and restrict users by giving them access levels
|
|
7
|
-
*
|
|
8
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License.
|
|
12
|
-
* You may obtain a copy of the License at
|
|
13
|
-
*
|
|
14
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
*/
|
|
22
|
-
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
23
|
-
const backend_1 = require("@intuitionrobotics/db-api-generator/backend");
|
|
4
|
+
const validator_1 = require("@intuitionrobotics/ts-common/validator/validator");
|
|
5
|
+
const BaseDB_ApiGenerator_1 = require("@intuitionrobotics/db-api-generator/app-backend/BaseDB_ApiGenerator");
|
|
24
6
|
exports.TEMP_COLLECTION = "temp-files-upload";
|
|
25
|
-
exports.validateName =
|
|
26
|
-
class UploaderTempFileModule_Class extends
|
|
7
|
+
exports.validateName = validator_1.validateRegexp(/^.{3,}$/);
|
|
8
|
+
class UploaderTempFileModule_Class extends BaseDB_ApiGenerator_1.BaseDB_ApiGenerator {
|
|
27
9
|
constructor() {
|
|
28
10
|
super(exports.TEMP_COLLECTION, UploaderTempFileModule_Class._validator, "temp-files", "UploaderTempFileModule");
|
|
29
11
|
}
|
|
@@ -33,14 +15,14 @@ class UploaderTempFileModule_Class extends backend_1.BaseDB_ApiGenerator {
|
|
|
33
15
|
}
|
|
34
16
|
exports.UploaderTempFileModule_Class = UploaderTempFileModule_Class;
|
|
35
17
|
UploaderTempFileModule_Class._validator = {
|
|
36
|
-
_id:
|
|
18
|
+
_id: BaseDB_ApiGenerator_1.validateUniqueId,
|
|
37
19
|
name: exports.validateName,
|
|
38
|
-
feId:
|
|
39
|
-
mimeType:
|
|
40
|
-
key:
|
|
41
|
-
path:
|
|
42
|
-
_audit:
|
|
43
|
-
bucketName:
|
|
20
|
+
feId: validator_1.validateExists(true),
|
|
21
|
+
mimeType: validator_1.validateExists(true),
|
|
22
|
+
key: validator_1.validateExists(true),
|
|
23
|
+
path: validator_1.validateExists(true),
|
|
24
|
+
_audit: validator_1.auditValidator(),
|
|
25
|
+
bucketName: validator_1.validateExists(true),
|
|
44
26
|
public: undefined,
|
|
45
27
|
metadata: undefined
|
|
46
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploaderTempFileModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderTempFileModule.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"UploaderTempFileModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderTempFileModule.ts"],"names":[],"mappings":";;;AAAA,gFAK0D;AAE1D,6GAG6E;AAGhE,QAAA,eAAe,GAAG,mBAAmB,CAAC;AAEtC,QAAA,YAAY,GAAG,0BAAc,CAAC,SAAS,CAAC,CAAC;AAEtD,MAAa,4BACT,SAAQ,yCAAiC;IAczC;QACI,KAAK,CAAC,uBAAe,EAAE,4BAA4B,CAAC,UAAU,EAAE,YAAY,EAAE,wBAAwB,CAAC,CAAC;IAC5G,CAAC;IAED,IAAI,CAAC,QAAiB;QAClB,OAAO,EAAE,CAAC;IACd,CAAC;;AArBL,oEAsBC;AApBU,uCAAU,GAAgC;IAC7C,GAAG,EAAE,sCAAgB;IACrB,IAAI,EAAE,oBAAY;IAClB,IAAI,EAAE,0BAAc,CAAC,IAAI,CAAC;IAC1B,QAAQ,EAAE,0BAAc,CAAC,IAAI,CAAC;IAC9B,GAAG,EAAE,0BAAc,CAAC,IAAI,CAAC;IACzB,IAAI,EAAE,0BAAc,CAAC,IAAI,CAAC;IAC1B,MAAM,EAAE,0BAAc,EAAE;IACxB,UAAU,EAAE,0BAAc,CAAC,IAAI,CAAC;IAChC,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,SAAS;CACtB,CAAC;AAWO,QAAA,sBAAsB,GAAG,IAAI,4BAA4B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Frontend_ModulePack_Uploader: (import("@intuitionrobotics/push-pub-sub/frontend").PushPubSubModule_Class | import("@intuitionrobotics/push-pub-sub/frontend").NotificationsModule_Class | import("@intuitionrobotics/firebase/frontend").FirebaseModule_Class
|
|
1
|
+
export declare const Frontend_ModulePack_Uploader: (import("@intuitionrobotics/push-pub-sub/app-frontend/modules/PushPubSubModule").PushPubSubModule_Class | import("../modules/UploaderModule").UploaderModule_Class | import("@intuitionrobotics/push-pub-sub/app-frontend/modules/NotificationModule").NotificationsModule_Class | import("@intuitionrobotics/firebase/app-frontend/FirebaseModule").FirebaseModule_Class)[];
|
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Frontend_ModulePack_Uploader = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* Permissions management system, define access level for each of
|
|
6
|
-
* your server apis, and restrict users by giving them access levels
|
|
7
|
-
*
|
|
8
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License.
|
|
12
|
-
* You may obtain a copy of the License at
|
|
13
|
-
*
|
|
14
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
*/
|
|
22
4
|
const UploaderModule_1 = require("../modules/UploaderModule");
|
|
23
|
-
const
|
|
5
|
+
const module_pack_1 = require("@intuitionrobotics/push-pub-sub/app-frontend/core/module-pack");
|
|
24
6
|
exports.Frontend_ModulePack_Uploader = [
|
|
25
|
-
...
|
|
7
|
+
...module_pack_1.Frontend_ModulePack_PushPubSub,
|
|
26
8
|
UploaderModule_1.UploaderModule
|
|
27
9
|
];
|
|
28
10
|
//# sourceMappingURL=module-pack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-pack.js","sourceRoot":"","sources":["../../../src/main/app-frontend/core/module-pack.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"module-pack.js","sourceRoot":"","sources":["../../../src/main/app-frontend/core/module-pack.ts"],"names":[],"mappings":";;;AAAA,8DAAyD;AACzD,+FAA6G;AAEhG,QAAA,4BAA4B,GAAG;IACxC,GAAG,4CAA8B;IACjC,+BAAc;CACjB,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ThunderDispatcher, XhrHttpModule_Class } from "@intuitionrobotics/thunderstorm/frontend";
|
|
2
1
|
import { BaseUploaderFile, Push_FileUploaded, TempSecureUrl } from "../../shared/types";
|
|
3
|
-
import { OnPushMessageReceived } from "@intuitionrobotics/push-pub-sub/frontend";
|
|
4
2
|
import { BaseUploaderModule_Class, OnFileStatusChanged } from "../../shared/modules/BaseUploaderModule";
|
|
5
|
-
import {
|
|
3
|
+
import { XhrHttpModule_Class } from "@intuitionrobotics/thunderstorm/app-frontend/modules/http/XhrHttpModule";
|
|
4
|
+
import { OnPushMessageReceived } from "@intuitionrobotics/push-pub-sub/app-frontend/modules/PushPubSubModule";
|
|
5
|
+
import { ThunderDispatcher } from "@intuitionrobotics/thunderstorm/app-frontend/core/thunder-dispatcher";
|
|
6
|
+
import { DB_Notifications } from "@intuitionrobotics/push-pub-sub/shared/types";
|
|
6
7
|
export declare class UploaderModule_Class extends BaseUploaderModule_Class<XhrHttpModule_Class> implements OnPushMessageReceived<Push_FileUploaded> {
|
|
7
8
|
protected readonly dispatch_fileStatusChange: ThunderDispatcher<OnFileStatusChanged, "__onFileStatusChanged">;
|
|
8
9
|
constructor();
|
|
@@ -10,33 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.UploaderModule = exports.UploaderModule_Class = void 0;
|
|
13
|
-
/*
|
|
14
|
-
* Permissions management system, define access level for each of
|
|
15
|
-
* your server apis, and restrict users by giving them access levels
|
|
16
|
-
*
|
|
17
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
18
|
-
*
|
|
19
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
20
|
-
* you may not use this file except in compliance with the License.
|
|
21
|
-
* You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
const frontend_1 = require("@intuitionrobotics/thunderstorm/frontend");
|
|
32
13
|
const types_1 = require("../../shared/types");
|
|
33
|
-
const frontend_2 = require("@intuitionrobotics/push-pub-sub/frontend");
|
|
34
14
|
const BaseUploaderModule_1 = require("../../shared/modules/BaseUploaderModule");
|
|
35
|
-
const
|
|
15
|
+
const XhrHttpModule_1 = require("@intuitionrobotics/thunderstorm/app-frontend/modules/http/XhrHttpModule");
|
|
16
|
+
const PushPubSubModule_1 = require("@intuitionrobotics/push-pub-sub/app-frontend/modules/PushPubSubModule");
|
|
17
|
+
const thunder_dispatcher_1 = require("@intuitionrobotics/thunderstorm/app-frontend/core/thunder-dispatcher");
|
|
18
|
+
const date_time_tools_1 = require("@intuitionrobotics/ts-common/utils/date-time-tools");
|
|
36
19
|
class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class {
|
|
37
20
|
constructor() {
|
|
38
|
-
super(
|
|
39
|
-
this.dispatch_fileStatusChange = new
|
|
21
|
+
super(XhrHttpModule_1.XhrHttpModule, 'UploaderModule');
|
|
22
|
+
this.dispatch_fileStatusChange = new thunder_dispatcher_1.ThunderDispatcher("__onFileStatusChanged");
|
|
40
23
|
}
|
|
41
24
|
dispatchFileStatusChange(id) {
|
|
42
25
|
this.dispatch_fileStatusChange.dispatchUI([id]);
|
|
@@ -55,8 +38,11 @@ class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class
|
|
|
55
38
|
}
|
|
56
39
|
subscribeToPush(toSubscribe) {
|
|
57
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
PushPubSubModule_1.PushPubSubModule.subscribeMulti(toSubscribe.map(r => ({
|
|
42
|
+
pushKey: types_1.fileUploadedKey,
|
|
43
|
+
props: { feId: r.tempDoc.feId }
|
|
44
|
+
})));
|
|
45
|
+
yield date_time_tools_1.timeout(date_time_tools_1.Second);
|
|
60
46
|
});
|
|
61
47
|
}
|
|
62
48
|
__onMessageReceived(notification) {
|
|
@@ -72,7 +58,7 @@ class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class
|
|
|
72
58
|
this.setFileInfo((_b = notification.props) === null || _b === void 0 ? void 0 : _b.feId, "status", BaseUploaderModule_1.FileStatus.Error);
|
|
73
59
|
break;
|
|
74
60
|
}
|
|
75
|
-
|
|
61
|
+
PushPubSubModule_1.PushPubSubModule.unsubscribe({ pushKey: types_1.fileUploadedKey, props: notification.props });
|
|
76
62
|
}
|
|
77
63
|
}
|
|
78
64
|
exports.UploaderModule_Class = UploaderModule_Class;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-frontend/modules/UploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"UploaderModule.js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CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;QAClH,IAAI,YAAY,CAAC,OAAO,KAAK,uBAAe;YACxC,OAAO;QAEX,QAAQ,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE;YAC9B,KAAK,oBAAY,CAAC,OAAO;gBACrB,IAAI,CAAC,WAAW,CAAC,MAAA,YAAY,CAAC,KAAK,0CAAE,IAAc,EAAE,QAAQ,EAAE,+BAAU,CAAC,SAAS,CAAC,CAAC;gBACrF,MAAM;YACV,KAAK,oBAAY,CAAC,OAAO;gBACrB,IAAI,CAAC,WAAW,CAAC,MAAA,YAAY,CAAC,KAAK,0CAAE,IAAc,EAAE,QAAQ,EAAE,+BAAU,CAAC,KAAK,CAAC,CAAC;gBACjF,MAAM;SACb;QAED,mCAAgB,CAAC,WAAW,CAAC,EAAC,OAAO,EAAE,uBAAe,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAC,CAAC,CAAC;IACxF,CAAC;CACJ;AAnDD,oDAmDC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './shared/types';
|
package/index.js
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
__exportStar(require("./shared/types"), exports);
|
|
32
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuitionrobotics/file-upload",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "File Uploader - Express & Typescript based backend framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"IR",
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
"build": "tsc"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@intuitionrobotics/ts-common": "~0.
|
|
33
|
-
"@intuitionrobotics/thunderstorm": "~0.
|
|
34
|
-
"@intuitionrobotics/firebase": "~0.
|
|
35
|
-
"@intuitionrobotics/db-api-generator": "~0.
|
|
36
|
-
"@intuitionrobotics/push-pub-sub": "~0.
|
|
32
|
+
"@intuitionrobotics/ts-common": "~0.44.0",
|
|
33
|
+
"@intuitionrobotics/thunderstorm": "~0.44.0",
|
|
34
|
+
"@intuitionrobotics/firebase": "~0.44.0",
|
|
35
|
+
"@intuitionrobotics/db-api-generator": "~0.44.0",
|
|
36
|
+
"@intuitionrobotics/push-pub-sub": "~0.44.0",
|
|
37
37
|
"firebase-functions": "^4.4.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@intuitionrobotics/testelot": "~0.
|
|
40
|
+
"@intuitionrobotics/testelot": "~0.44.0",
|
|
41
41
|
"@types/node": "^16.0.0",
|
|
42
42
|
"typescript": "~4.1.0"
|
|
43
43
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { BaseHttpModule_Class } from "@intuitionrobotics/thunderstorm/shared/BaseHttpModule";
|
|
2
|
+
import { BaseHttpRequest } from "@intuitionrobotics/thunderstorm/shared/BaseHttpRequest";
|
|
3
|
+
import { Dispatcher } from "@intuitionrobotics/ts-common/core/dispatcher";
|
|
4
|
+
import { Module } from "@intuitionrobotics/ts-common/core/module";
|
|
5
|
+
import { BaseUploaderFile, DB_Temp_File, Request_Uploader, TempSecureUrl } from "../types";
|
|
4
6
|
export declare enum FileStatus {
|
|
5
7
|
ObtainingUrl = "ObtainingUrl",
|
|
6
8
|
UrlObtained = "UrlObtained",
|
|
@@ -10,26 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BaseUploaderModule_Class = exports.FileStatus = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
32
|
-
const thunderstorm_1 = require("@intuitionrobotics/thunderstorm");
|
|
13
|
+
const types_1 = require("@intuitionrobotics/thunderstorm/shared/types");
|
|
14
|
+
const dispatcher_1 = require("@intuitionrobotics/ts-common/core/dispatcher");
|
|
15
|
+
const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
|
|
16
|
+
const module_1 = require("@intuitionrobotics/ts-common/core/module");
|
|
17
|
+
const date_time_tools_1 = require("@intuitionrobotics/ts-common/utils/date-time-tools");
|
|
18
|
+
const queue_1 = require("@intuitionrobotics/ts-common/utils/queue");
|
|
19
|
+
const random_tools_1 = require("@intuitionrobotics/ts-common/utils/random-tools");
|
|
20
|
+
const tools_1 = require("@intuitionrobotics/ts-common/utils/tools");
|
|
33
21
|
const RequestKey_UploadUrl = 'get-upload-url';
|
|
34
22
|
const RequestKey_UploadFile = 'upload-file';
|
|
35
23
|
var FileStatus;
|
|
@@ -43,12 +31,12 @@ var FileStatus;
|
|
|
43
31
|
FileStatus["Completed"] = "Completed";
|
|
44
32
|
FileStatus["Error"] = "Error";
|
|
45
33
|
})(FileStatus = exports.FileStatus || (exports.FileStatus = {}));
|
|
46
|
-
class BaseUploaderModule_Class extends
|
|
34
|
+
class BaseUploaderModule_Class extends module_1.Module {
|
|
47
35
|
constructor(httpModule, moduleName) {
|
|
48
36
|
super(moduleName);
|
|
49
37
|
this.files = {};
|
|
50
|
-
this.uploadQueue = new
|
|
51
|
-
this.dispatch_fileStatusChange = new
|
|
38
|
+
this.uploadQueue = new queue_1.Queue("File Uploader").setParallelCount(2);
|
|
39
|
+
this.dispatch_fileStatusChange = new dispatcher_1.Dispatcher('__onFileStatusChanged');
|
|
52
40
|
this.uploadFiles = (response) => __awaiter(this, void 0, void 0, function* () {
|
|
53
41
|
// Subscribe
|
|
54
42
|
yield this.subscribeToPush(response);
|
|
@@ -63,7 +51,7 @@ class BaseUploaderModule_Class extends ts_common_1.Module {
|
|
|
63
51
|
this.setFileInfo(feId, "status", FileStatus.PostProcessing);
|
|
64
52
|
}, error => {
|
|
65
53
|
this.setFileInfo(feId, "status", FileStatus.Error);
|
|
66
|
-
this.setFileInfo(feId, "messageStatus",
|
|
54
|
+
this.setFileInfo(feId, "messageStatus", tools_1.__stringify(error));
|
|
67
55
|
});
|
|
68
56
|
});
|
|
69
57
|
});
|
|
@@ -73,14 +61,14 @@ class BaseUploaderModule_Class extends ts_common_1.Module {
|
|
|
73
61
|
this.setFileInfo(feId, "tempDoc", response.tempDoc);
|
|
74
62
|
const fileInfo = this.files[feId];
|
|
75
63
|
if (!fileInfo)
|
|
76
|
-
throw new
|
|
64
|
+
throw new exceptions_1.BadImplementationException(`Missing file with id ${feId} and name: ${response.tempDoc.name}`);
|
|
77
65
|
const request = this
|
|
78
66
|
.httpModule
|
|
79
|
-
.createRequest(
|
|
67
|
+
.createRequest(types_1.HttpMethod.PUT, RequestKey_UploadFile)
|
|
80
68
|
.setUrl(response.secureUrl)
|
|
81
69
|
// Don't change this because it replaces the default headers which we dont need
|
|
82
70
|
.setDefaultHeaders({ 'Content-Type': response.tempDoc.mimeType })
|
|
83
|
-
.setTimeout(20 *
|
|
71
|
+
.setTimeout(20 * date_time_tools_1.Minute)
|
|
84
72
|
.setBody(fileInfo.file)
|
|
85
73
|
.setOnProgressListener((ev) => {
|
|
86
74
|
this.setFileInfo(feId, "progress", ev.loaded / ev.total);
|
|
@@ -102,7 +90,7 @@ class BaseUploaderModule_Class extends ts_common_1.Module {
|
|
|
102
90
|
}
|
|
103
91
|
setFileInfo(id, key, value) {
|
|
104
92
|
if (!this.files[id])
|
|
105
|
-
throw new
|
|
93
|
+
throw new exceptions_1.BadImplementationException(`Trying to set ${key} for non existent file with id: ${id}`);
|
|
106
94
|
this.files[id][key] = value;
|
|
107
95
|
this.dispatchFileStatusChange(id);
|
|
108
96
|
}
|
|
@@ -114,7 +102,7 @@ class BaseUploaderModule_Class extends ts_common_1.Module {
|
|
|
114
102
|
const fileInfo = {
|
|
115
103
|
name: fileData.name,
|
|
116
104
|
mimeType: fileData.mimeType,
|
|
117
|
-
feId:
|
|
105
|
+
feId: random_tools_1.generateHex(32)
|
|
118
106
|
};
|
|
119
107
|
if (fileData.key)
|
|
120
108
|
fileInfo.key = fileData.key;
|
|
@@ -130,12 +118,12 @@ class BaseUploaderModule_Class extends ts_common_1.Module {
|
|
|
130
118
|
});
|
|
131
119
|
this
|
|
132
120
|
.httpModule
|
|
133
|
-
.createRequest(
|
|
121
|
+
.createRequest(types_1.HttpMethod.POST, RequestKey_UploadUrl)
|
|
134
122
|
.setRelativeUrl('/v1/upload/get-url')
|
|
135
123
|
.setJsonBody(body)
|
|
136
124
|
.setOnError((request, resError) => {
|
|
137
125
|
body.forEach(f => {
|
|
138
|
-
this.setFileInfo(f.feId, "messageStatus",
|
|
126
|
+
this.setFileInfo(f.feId, "messageStatus", tools_1.__stringify(resError === null || resError === void 0 ? void 0 : resError.debugMessage));
|
|
139
127
|
this.setFileInfo(f.feId, "status", FileStatus.Error);
|
|
140
128
|
});
|
|
141
129
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseUploaderModule.js","sourceRoot":"","sources":["../../../src/main/shared/modules/BaseUploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"BaseUploaderModule.js","sourceRoot":"","sources":["../../../src/main/shared/modules/BaseUploaderModule.ts"],"names":[],"mappings":";;;;;;;;;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AAC,CAAC;aACD,OAAO,CAAC,CAAO,QAAyB,EAAE,EAAE;YACzC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;YAC9E,IAAI,CAAC,QAAQ;gBACT,OAAO;YAEX,oCAAoC;YACpC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAA,CAAC,CAAC;QAEP,OAAO,IAAI,CAAC;IAChB,CAAC;CA6CJ;AAjID,4DAiIC"}
|
package/shared/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { AuditBy, ObjectTS } from "@intuitionrobotics/ts-common";
|
|
4
|
-
import { MessageType } from "@intuitionrobotics/push-pub-sub";
|
|
1
|
+
import { MessageType } from "@intuitionrobotics/push-pub-sub/shared/types";
|
|
2
|
+
import { ApiWithBody } from "@intuitionrobotics/thunderstorm/shared/types";
|
|
3
|
+
import { AuditBy, DB_Object, ObjectTS } from "@intuitionrobotics/ts-common/utils/types";
|
|
5
4
|
export declare const fileUploadedKey = "file-uploaded";
|
|
6
5
|
export declare type Push_FileUploaded = MessageType<"file-uploaded", {
|
|
7
6
|
feId: string;
|
package/shared/types.js
CHANGED
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
3
|
exports.UploadResult = exports.fileUploadedKey = void 0;
|
|
22
4
|
exports.fileUploadedKey = "file-uploaded";
|
package/shared/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/shared/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/shared/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,eAAe,GAAG,eAAe,CAAC;AAO/C,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACvB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB"}
|
package/backend.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export * from "./app-backend/core/module-pack";
|
|
2
|
-
export * from "./app-backend/modules/UploaderModule";
|
|
3
|
-
export * from "./app-backend/modules/BucketListener";
|
|
4
|
-
export * from "./app-backend/modules/UploaderTempFileModule";
|
|
5
|
-
export * from "./app-backend/modules/ServerUploaderModule";
|
package/backend.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
__exportStar(require("./app-backend/core/module-pack"), exports);
|
|
32
|
-
__exportStar(require("./app-backend/modules/UploaderModule"), exports);
|
|
33
|
-
__exportStar(require("./app-backend/modules/BucketListener"), exports);
|
|
34
|
-
__exportStar(require("./app-backend/modules/UploaderTempFileModule"), exports);
|
|
35
|
-
__exportStar(require("./app-backend/modules/ServerUploaderModule"), exports);
|
|
36
|
-
//# sourceMappingURL=backend.js.map
|
package/backend.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/main/backend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,iEAA+C;AAE/C,uEAAqD;AACrD,uEAAqD;AACrD,+EAA6D;AAC7D,6EAA2D"}
|
package/frontend.d.ts
DELETED
package/frontend.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Permissions management system, define access level for each of
|
|
4
|
-
* your server apis, and restrict users by giving them access levels
|
|
5
|
-
*
|
|
6
|
-
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
-
*
|
|
8
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License.
|
|
10
|
-
* You may obtain a copy of the License at
|
|
11
|
-
*
|
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
-
* See the License for the specific language governing permissions and
|
|
18
|
-
* limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23
|
-
}) : (function(o, m, k, k2) {
|
|
24
|
-
if (k2 === undefined) k2 = k;
|
|
25
|
-
o[k2] = m[k];
|
|
26
|
-
}));
|
|
27
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
__exportStar(require("./app-frontend/core/module-pack"), exports);
|
|
32
|
-
__exportStar(require("./app-frontend/modules/UploaderModule"), exports);
|
|
33
|
-
//# sourceMappingURL=frontend.js.map
|
package/frontend.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frontend.js","sourceRoot":"","sources":["../src/main/frontend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,kEAAgD;AAChD,wEAAsD"}
|