@intuitionrobotics/file-upload 0.47.32 → 0.47.33
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,14 +1,11 @@
|
|
|
1
1
|
import { ThunderDispatcher, XhrHttpModule_Class } from "@intuitionrobotics/thunderstorm/frontend";
|
|
2
|
-
import { BaseUploaderFile,
|
|
3
|
-
import { OnPushMessageReceived } from "@intuitionrobotics/push-pub-sub/frontend";
|
|
2
|
+
import { BaseUploaderFile, TempSecureUrl } from "../../shared/types";
|
|
4
3
|
import { BaseUploaderModule_Class, OnFileStatusChanged } from "../../shared/modules/BaseUploaderModule";
|
|
5
|
-
|
|
6
|
-
export declare class UploaderModule_Class extends BaseUploaderModule_Class<XhrHttpModule_Class> implements OnPushMessageReceived<Push_FileUploaded> {
|
|
4
|
+
export declare class UploaderModule_Class extends BaseUploaderModule_Class<XhrHttpModule_Class> {
|
|
7
5
|
protected readonly dispatch_fileStatusChange: ThunderDispatcher<OnFileStatusChanged, "__onFileStatusChanged", [id?: string | undefined], void>;
|
|
8
6
|
constructor();
|
|
9
7
|
protected dispatchFileStatusChange(id?: string): void;
|
|
10
8
|
upload(files: File[], key?: string, _public?: boolean): BaseUploaderFile[];
|
|
11
9
|
protected subscribeToPush(toSubscribe: TempSecureUrl[]): Promise<void>;
|
|
12
|
-
__onMessageReceived(notification: DB_Notifications): void;
|
|
13
10
|
}
|
|
14
11
|
export declare const UploaderModule: UploaderModule_Class;
|
|
@@ -37,25 +37,25 @@ class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class
|
|
|
37
37
|
}
|
|
38
38
|
subscribeToPush(toSubscribe) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
frontend_2.PushPubSubModule.subscribeMulti(toSubscribe.map(r =>
|
|
40
|
+
frontend_2.PushPubSubModule.subscribeMulti(toSubscribe.map(r => {
|
|
41
|
+
const props = { feId: r.tempDoc.feId };
|
|
42
|
+
const callBack = (data) => {
|
|
43
|
+
this.logInfo("Message received from service worker", types_1.fileUploadedKey, props, data);
|
|
44
|
+
switch (data.result) {
|
|
45
|
+
case types_1.UploadResult.Success:
|
|
46
|
+
this.setFileInfo(props === null || props === void 0 ? void 0 : props.feId, "status", BaseUploaderModule_1.FileStatus.Completed);
|
|
47
|
+
break;
|
|
48
|
+
case types_1.UploadResult.Failure:
|
|
49
|
+
this.setFileInfo(props === null || props === void 0 ? void 0 : props.feId, "status", BaseUploaderModule_1.FileStatus.Error);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
frontend_2.PushPubSubModule.unsubscribe({ pushKey: types_1.fileUploadedKey, props, callBack });
|
|
53
|
+
};
|
|
54
|
+
return ({ pushKey: types_1.fileUploadedKey, props: props, callBack });
|
|
55
|
+
}));
|
|
41
56
|
yield (0, ts_common_1.timeout)(ts_common_1.Second);
|
|
42
57
|
});
|
|
43
58
|
}
|
|
44
|
-
__onMessageReceived(notification) {
|
|
45
|
-
var _a, _b;
|
|
46
|
-
this.logInfo("Message received from service worker", notification.pushKey, notification.props, notification.data);
|
|
47
|
-
if (notification.pushKey !== types_1.fileUploadedKey)
|
|
48
|
-
return;
|
|
49
|
-
switch (notification.data.result) {
|
|
50
|
-
case types_1.UploadResult.Success:
|
|
51
|
-
this.setFileInfo((_a = notification.props) === null || _a === void 0 ? void 0 : _a.feId, "status", BaseUploaderModule_1.FileStatus.Completed);
|
|
52
|
-
break;
|
|
53
|
-
case types_1.UploadResult.Failure:
|
|
54
|
-
this.setFileInfo((_b = notification.props) === null || _b === void 0 ? void 0 : _b.feId, "status", BaseUploaderModule_1.FileStatus.Error);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
frontend_2.PushPubSubModule.unsubscribe({ pushKey: types_1.fileUploadedKey, props: notification.props });
|
|
58
|
-
}
|
|
59
59
|
}
|
|
60
60
|
exports.UploaderModule_Class = UploaderModule_Class;
|
|
61
61
|
exports.UploaderModule = new 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","sourceRoot":"","sources":["../../../src/main/app-frontend/modules/UploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uEAA+G;AAC/G,8CAAwH;AACxH,uEAA0E;AAC1E,gFAAkH;AAClH,4DAA6D;AAE7D,MAAa,oBACT,SAAQ,6CAA6C;IAIrD;QACI,KAAK,CAAC,wBAAa,EAAE,gBAAgB,CAAC,CAAC;QAHxB,8BAAyB,GAAG,IAAI,4BAAiB,CAA+C,uBAAuB,CAAC,CAAC;IAI5I,CAAC;IAES,wBAAwB,CAAC,EAAW;QAC1C,IAAI,CAAC,yBAAyB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC9C,KAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,GAAY,EAAE,OAAiB;QACjD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE;YACrC,OAAO;gBACH,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,IAAI;gBACnB,GAAG;gBACH,IAAI;gBACJ,MAAM,EAAE,OAAO;aAClB,CAAC;QACN,CAAC,CAAC,CAAC,CAAC,CAAC;IACT,CAAC;IAEe,eAAe,CAAC,WAA4B;;YACxD,2BAAgB,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;gBAChD,MAAM,KAAK,GAAG,EAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAC,CAAC;gBACrC,MAAM,QAAQ,GAAG,CAAC,IAA0B,EAAE,EAAE;oBAC5C,IAAI,CAAC,OAAO,CAAC,sCAAsC,EAAE,uBAAe,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;oBACnF,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;wBAClB,KAAK,oBAAY,CAAC,OAAO;4BACrB,IAAI,CAAC,WAAW,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE,QAAQ,EAAE,+BAAU,CAAC,SAAS,CAAC,CAAC;4BAC9D,MAAM;wBACV,KAAK,oBAAY,CAAC,OAAO;4BACrB,IAAI,CAAC,WAAW,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,EAAE,QAAQ,EAAE,+BAAU,CAAC,KAAK,CAAC,CAAC;4BAC1D,MAAM;oBACd,CAAC;oBACD,2BAAgB,CAAC,WAAW,CAAC,EAAC,OAAO,EAAE,uBAAe,EAAE,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAC;gBAC9E,CAAC,CAAC;gBACF,OAAO,CAAC,EAAC,OAAO,EAAE,uBAAe,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC,CAAC;YACJ,MAAM,IAAA,mBAAO,EAAC,kBAAM,CAAC,CAAC;QAC1B,CAAC;KAAA;CACJ;AA7CD,oDA6CC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
|
package/package.json
CHANGED
package/shared/types.d.ts
CHANGED
|
@@ -3,13 +3,14 @@ import { DB_Object } from "@intuitionrobotics/firebase";
|
|
|
3
3
|
import { AuditBy, ObjectTS } from "@intuitionrobotics/ts-common";
|
|
4
4
|
import { MessageType } from "@intuitionrobotics/push-pub-sub";
|
|
5
5
|
export declare const fileUploadedKey = "file-uploaded";
|
|
6
|
-
export type
|
|
7
|
-
feId: string;
|
|
8
|
-
}, {
|
|
6
|
+
export type Payload_FileUploaded = {
|
|
9
7
|
message: string;
|
|
10
8
|
result: string;
|
|
11
9
|
cause?: any;
|
|
12
|
-
}
|
|
10
|
+
};
|
|
11
|
+
export type Push_FileUploaded = MessageType<"file-uploaded", {
|
|
12
|
+
feId: string;
|
|
13
|
+
}, Payload_FileUploaded>;
|
|
13
14
|
export declare enum UploadResult {
|
|
14
15
|
Success = "Success",
|
|
15
16
|
Failure = "Failure"
|
package/shared/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/shared/types.ts"],"names":[],"mappings":";;;AAQa,QAAA,eAAe,GAAG,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/shared/types.ts"],"names":[],"mappings":";;;AAQa,QAAA,eAAe,GAAG,eAAe,CAAC;AAI/C,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACpB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB"}
|