@intuitionrobotics/file-upload 0.41.68 → 0.41.71

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,17 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -21,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22
9
  });
23
10
  };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
11
  Object.defineProperty(exports, "__esModule", { value: true });
52
12
  exports.UploaderModule = exports.UploaderModule_Class = exports.Temp_Path = void 0;
53
13
  /*
@@ -68,180 +28,109 @@ exports.UploaderModule = exports.UploaderModule_Class = exports.Temp_Path = void
68
28
  * See the License for the specific language governing permissions and
69
29
  * limitations under the License.
70
30
  */
71
- var ts_common_1 = require("@intuitionrobotics/ts-common");
72
- var backend_1 = require("@intuitionrobotics/firebase/backend");
73
- var types_1 = require("../../shared/types");
74
- var UploaderTempFileModule_1 = require("./UploaderTempFileModule");
75
- var backend_2 = require("@intuitionrobotics/push-pub-sub/backend");
31
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
32
+ const backend_1 = require("@intuitionrobotics/firebase/backend");
33
+ const types_1 = require("../../shared/types");
34
+ const UploaderTempFileModule_1 = require("./UploaderTempFileModule");
35
+ const backend_2 = require("@intuitionrobotics/push-pub-sub/backend");
76
36
  exports.Temp_Path = "files-temp";
77
- var UploaderModule_Class = /** @class */ (function (_super) {
78
- __extends(UploaderModule_Class, _super);
79
- function UploaderModule_Class() {
80
- var _this = _super !== null && _super.apply(this, arguments) || this;
81
- _this.setPostProcessor = function (validator) {
82
- _this.postProcessor = validator;
37
+ class UploaderModule_Class extends ts_common_1.Module {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.setPostProcessor = (validator) => {
41
+ this.postProcessor = validator;
83
42
  };
84
- _this.getProcessor = function (k) {
85
- var postProcessorElement = _this.postProcessor[k];
43
+ this.getProcessor = (k) => {
44
+ const postProcessorElement = this.postProcessor[k];
86
45
  if (!postProcessorElement)
87
- throw new ts_common_1.ImplementationMissingException("Missing validator for type " + k);
46
+ throw new ts_common_1.ImplementationMissingException(`Missing validator for type ${k}`);
88
47
  return postProcessorElement;
89
48
  };
90
- _this.fileUploaded = function (filePath) { return __awaiter(_this, void 0, void 0, function () {
91
- var _this = this;
92
- return __generator(this, function (_a) {
93
- switch (_a.label) {
94
- case 0:
95
- if (!filePath)
96
- throw new ts_common_1.ThisShouldNotHappenException("Missing file path");
97
- this.logInfo("Looking for file with path " + filePath);
98
- return [4 /*yield*/, UploaderTempFileModule_1.UploaderTempFileModule.runInTransaction(function (transaction) { return __awaiter(_this, void 0, void 0, function () {
99
- var tempMeta, val, bucket, file, e_1, e_2;
100
- return __generator(this, function (_a) {
101
- switch (_a.label) {
102
- case 0: return [4 /*yield*/, transaction.queryUnique(UploaderTempFileModule_1.UploaderTempFileModule.collection, { where: { path: filePath } })];
103
- case 1:
104
- tempMeta = _a.sent();
105
- if (!tempMeta)
106
- return [2 /*return*/, this.logInfo("File with path: " + filePath + ", not found in temp collection db")];
107
- this.logInfo("Found temp meta with _id: " + tempMeta._id, tempMeta);
108
- val = this.postProcessor[tempMeta.key];
109
- this.logInfo("Found a validator " + !!val);
110
- if (!val)
111
- return [2 /*return*/, this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Failure, "Missing a validator for " + tempMeta.key + " for file: " + tempMeta.name)];
112
- return [4 /*yield*/, this.storage.getOrCreateBucket(tempMeta.bucketName)];
113
- case 2:
114
- bucket = _a.sent();
115
- return [4 /*yield*/, bucket.getFile(tempMeta.path)];
116
- case 3:
117
- file = _a.sent();
118
- if (!tempMeta.public) return [3 /*break*/, 8];
119
- _a.label = 4;
120
- case 4:
121
- _a.trys.push([4, 6, , 8]);
122
- return [4 /*yield*/, file.makePublic()];
123
- case 5:
124
- _a.sent();
125
- return [3 /*break*/, 8];
126
- case 6:
127
- e_1 = _a.sent();
128
- return [4 /*yield*/, this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Failure, "Failed to make the file public: " + tempMeta.name, e_1)];
129
- case 7:
130
- _a.sent();
131
- return [3 /*break*/, 8];
132
- case 8:
133
- _a.trys.push([8, 10, , 12]);
134
- return [4 /*yield*/, val(transaction, file, tempMeta)];
135
- case 9:
136
- _a.sent();
137
- return [3 /*break*/, 12];
138
- case 10:
139
- e_2 = _a.sent();
140
- return [4 /*yield*/, this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Failure, "Post-processing failed for file: " + tempMeta.name, e_2)];
141
- case 11:
142
- //TODO delete the file and the temp doc
143
- return [2 /*return*/, _a.sent()];
144
- case 12: return [2 /*return*/, this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Success, "Successfully parsed and processed file " + tempMeta.name)];
145
- }
146
- });
147
- }); })];
148
- case 1:
149
- _a.sent();
150
- return [2 /*return*/];
49
+ this.fileUploaded = (filePath) => __awaiter(this, void 0, void 0, function* () {
50
+ if (!filePath)
51
+ throw new ts_common_1.ThisShouldNotHappenException("Missing file path");
52
+ this.logInfo(`Looking for file with path ${filePath}`);
53
+ yield UploaderTempFileModule_1.UploaderTempFileModule.runInTransaction((transaction) => __awaiter(this, void 0, void 0, function* () {
54
+ // I use collection and not the module directly since I want to handle failure my way
55
+ const tempMeta = yield transaction.queryUnique(UploaderTempFileModule_1.UploaderTempFileModule.collection, { where: { path: filePath } });
56
+ if (!tempMeta)
57
+ return this.logInfo(`File with path: ${filePath}, not found in temp collection db`);
58
+ this.logInfo(`Found temp meta with _id: ${tempMeta._id}`, tempMeta);
59
+ const val = this.postProcessor[tempMeta.key];
60
+ this.logInfo(`Found a validator ${!!val}`);
61
+ if (!val)
62
+ return this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Failure, `Missing a validator for ${tempMeta.key} for file: ${tempMeta.name}`);
63
+ const bucket = yield this.storage.getOrCreateBucket(tempMeta.bucketName);
64
+ const file = yield bucket.getFile(tempMeta.path);
65
+ if (tempMeta.public) {
66
+ try {
67
+ yield file.makePublic();
68
+ }
69
+ catch (e) {
70
+ yield this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Failure, `Failed to make the file public: ${tempMeta.name}`, e);
71
+ }
151
72
  }
152
- });
153
- }); };
154
- _this.notifyFrontend = function (feId, result, message, cause) { return __awaiter(_this, void 0, void 0, function () {
155
- var data;
156
- return __generator(this, function (_a) {
157
- switch (_a.label) {
158
- case 0:
159
- cause && this.logWarning(cause);
160
- data = { message: message, result: result, cause: cause };
161
- return [4 /*yield*/, backend_2.PushPubSubModule.pushToKey(types_1.fileUploadedKey, { feId: feId }, data)];
162
- case 1:
163
- _a.sent();
164
- return [2 /*return*/];
73
+ try {
74
+ yield val(transaction, file, tempMeta);
165
75
  }
166
- });
167
- }); };
168
- return _this;
169
- }
170
- UploaderModule_Class.prototype.__onFileUploaded = function (filePath) {
171
- return __awaiter(this, void 0, void 0, function () {
172
- return __generator(this, function (_a) {
173
- switch (_a.label) {
174
- case 0: return [4 /*yield*/, this.fileUploaded(filePath)];
175
- case 1:
176
- _a.sent();
177
- return [2 /*return*/];
76
+ catch (e) {
77
+ //TODO delete the file and the temp doc
78
+ return yield this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Failure, `Post-processing failed for file: ${tempMeta.name}`, e);
178
79
  }
179
- });
80
+ return this.notifyFrontend(tempMeta.feId, types_1.UploadResult.Success, `Successfully parsed and processed file ${tempMeta.name}`);
81
+ }));
82
+ });
83
+ this.notifyFrontend = (feId, result, message, cause) => __awaiter(this, void 0, void 0, function* () {
84
+ cause && this.logWarning(cause);
85
+ const data = { message, result, cause };
86
+ yield backend_2.PushPubSubModule.pushToKey(types_1.fileUploadedKey, { feId }, data);
87
+ });
88
+ }
89
+ __onFileUploaded(filePath) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ yield this.fileUploaded(filePath);
180
92
  });
181
- };
182
- UploaderModule_Class.prototype.init = function () {
93
+ }
94
+ init() {
183
95
  if (!this.postProcessor)
184
96
  throw new ts_common_1.ImplementationMissingException("You must set a postProcessor for the UploaderModule");
185
97
  this.storage = backend_1.FirebaseModule.createAdminSession(this.config.uploaderProjectId).getStorage();
186
- };
187
- UploaderModule_Class.prototype.getUrl = function (body, pathPrefix) {
98
+ }
99
+ getUrl(body, pathPrefix = exports.Temp_Path) {
188
100
  var _a;
189
- if (pathPrefix === void 0) { pathPrefix = exports.Temp_Path; }
190
- return __awaiter(this, void 0, void 0, function () {
191
- var bucketName, bucket;
192
- var _this = this;
193
- return __generator(this, function (_b) {
194
- switch (_b.label) {
195
- case 0:
196
- bucketName = (_a = this.config) === null || _a === void 0 ? void 0 : _a.bucketName;
197
- return [4 /*yield*/, this.storage.getOrCreateBucket(bucketName)];
198
- case 1:
199
- bucket = _b.sent();
200
- return [2 /*return*/, Promise.all(body.map(function (_file) { return __awaiter(_this, void 0, void 0, function () {
201
- var key, _id, path, instance, temp, file, url;
202
- return __generator(this, function (_a) {
203
- switch (_a.label) {
204
- case 0:
205
- key = _file.key || _file.mimeType;
206
- this.getProcessor(key);
207
- _id = ts_common_1.generateHex(32);
208
- path = pathPrefix + "/" + _id;
209
- instance = {
210
- _id: _id,
211
- feId: _file.feId,
212
- name: _file.name,
213
- mimeType: _file.mimeType,
214
- key: key,
215
- path: path,
216
- _audit: ts_common_1.auditBy("be-stub"),
217
- bucketName: bucket.bucketName
218
- };
219
- if (_file.public)
220
- instance.public = _file.public;
221
- if (_file.metadata)
222
- instance.metadata = _file.metadata;
223
- return [4 /*yield*/, UploaderTempFileModule_1.UploaderTempFileModule.upsert(instance)];
224
- case 1:
225
- temp = _a.sent();
226
- return [4 /*yield*/, bucket.getFile(temp.path)];
227
- case 2:
228
- file = _a.sent();
229
- return [4 /*yield*/, file.getWriteSecuredUrl(_file.mimeType, ts_common_1.Hour)];
230
- case 3:
231
- url = _a.sent();
232
- return [2 /*return*/, {
233
- secureUrl: url.securedUrl,
234
- tempDoc: temp
235
- }];
236
- }
237
- });
238
- }); }))];
239
- }
240
- });
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const bucketName = (_a = this.config) === null || _a === void 0 ? void 0 : _a.bucketName;
103
+ const bucket = yield this.storage.getOrCreateBucket(bucketName);
104
+ return Promise.all(body.map((_file) => __awaiter(this, void 0, void 0, function* () {
105
+ const key = _file.key || _file.mimeType;
106
+ this.getProcessor(key);
107
+ const _id = ts_common_1.generateHex(32);
108
+ const path = `${pathPrefix}/${_id}`;
109
+ const instance = {
110
+ _id,
111
+ feId: _file.feId,
112
+ name: _file.name,
113
+ mimeType: _file.mimeType,
114
+ key,
115
+ path,
116
+ _audit: ts_common_1.auditBy("be-stub"),
117
+ bucketName: bucket.bucketName
118
+ };
119
+ if (_file.public)
120
+ instance.public = _file.public;
121
+ if (_file.metadata)
122
+ instance.metadata = _file.metadata;
123
+ const temp = yield UploaderTempFileModule_1.UploaderTempFileModule.upsert(instance);
124
+ const file = yield bucket.getFile(temp.path);
125
+ const url = yield file.getWriteSecuredUrl(_file.mimeType, ts_common_1.Hour);
126
+ return {
127
+ secureUrl: url.securedUrl,
128
+ tempDoc: temp
129
+ };
130
+ })));
241
131
  });
242
- };
243
- return UploaderModule_Class;
244
- }(ts_common_1.Module));
132
+ }
133
+ }
245
134
  exports.UploaderModule_Class = UploaderModule_Class;
246
135
  exports.UploaderModule = new UploaderModule_Class();
247
136
  //# sourceMappingURL=UploaderModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;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oBACH,IAAI;oBACJ,MAAM,EAAE,mBAAO,CAAC,SAAS,CAAC;oBAC1B,UAAU,EAAE,MAAM,CAAC,UAAU;iBAC7B,CAAC;gBAEF,IAAI,KAAK,CAAC,MAAM;oBACf,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEhC,IAAI,KAAK,CAAC,QAAQ;oBACjB,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;gBAEpC,MAAM,IAAI,GAAG,MAAM,+CAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC3D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC7C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,QAAQ,EAAE,gBAAI,CAAC,CAAC;gBAChE,OAAO;oBACN,SAAS,EAAE,GAAG,CAAC,UAAU;oBACzB,OAAO,EAAE,IAAI;iBACb,CAAC;YACH,CAAC,CAAA,CAAC,CAAC,CAAC;;KACJ;CA8CD;AA/GD,oDA+GC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
@@ -1,17 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
2
  Object.defineProperty(exports, "__esModule", { value: true });
16
3
  exports.UploaderTempFileModule = exports.UploaderTempFileModule_Class = exports.validateName = exports.TEMP_COLLECTION = void 0;
17
4
  /*
@@ -32,32 +19,30 @@ exports.UploaderTempFileModule = exports.UploaderTempFileModule_Class = exports.
32
19
  * See the License for the specific language governing permissions and
33
20
  * limitations under the License.
34
21
  */
35
- var ts_common_1 = require("@intuitionrobotics/ts-common");
36
- var backend_1 = require("@intuitionrobotics/db-api-generator/backend");
22
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
23
+ const backend_1 = require("@intuitionrobotics/db-api-generator/backend");
37
24
  exports.TEMP_COLLECTION = "temp-files-upload";
38
25
  exports.validateName = ts_common_1.validateRegexp(/^.{3,}$/);
39
- var UploaderTempFileModule_Class = /** @class */ (function (_super) {
40
- __extends(UploaderTempFileModule_Class, _super);
41
- function UploaderTempFileModule_Class() {
42
- return _super.call(this, exports.TEMP_COLLECTION, UploaderTempFileModule_Class._validator, "temp-files") || this;
26
+ class UploaderTempFileModule_Class extends backend_1.BaseDB_ApiGenerator {
27
+ constructor() {
28
+ super(exports.TEMP_COLLECTION, UploaderTempFileModule_Class._validator, "temp-files");
43
29
  }
44
- UploaderTempFileModule_Class.prototype.apis = function (pathPart) {
30
+ apis(pathPart) {
45
31
  return [];
46
- };
47
- UploaderTempFileModule_Class._validator = {
48
- _id: backend_1.validateUniqueId,
49
- name: exports.validateName,
50
- feId: ts_common_1.validateExists(true),
51
- mimeType: ts_common_1.validateExists(true),
52
- key: ts_common_1.validateExists(true),
53
- path: ts_common_1.validateExists(true),
54
- _audit: ts_common_1.auditValidator(),
55
- bucketName: ts_common_1.validateExists(true),
56
- public: undefined,
57
- metadata: undefined
58
- };
59
- return UploaderTempFileModule_Class;
60
- }(backend_1.BaseDB_ApiGenerator));
32
+ }
33
+ }
61
34
  exports.UploaderTempFileModule_Class = UploaderTempFileModule_Class;
35
+ UploaderTempFileModule_Class._validator = {
36
+ _id: backend_1.validateUniqueId,
37
+ name: exports.validateName,
38
+ feId: ts_common_1.validateExists(true),
39
+ mimeType: ts_common_1.validateExists(true),
40
+ key: ts_common_1.validateExists(true),
41
+ path: ts_common_1.validateExists(true),
42
+ _audit: ts_common_1.auditValidator(),
43
+ bucketName: ts_common_1.validateExists(true),
44
+ public: undefined,
45
+ metadata: undefined
46
+ };
62
47
  exports.UploaderTempFileModule = new UploaderTempFileModule_Class();
63
48
  //# sourceMappingURL=UploaderTempFileModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UploaderTempFileModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderTempFileModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,0DAKsC;AAEtC,uEAGqD;AAGxC,QAAA,eAAe,GAAG,mBAAmB,CAAC;AAEtC,QAAA,YAAY,GAAG,0BAAc,CAAC,SAAS,CAAC,CAAC;AAEtD;IACS,gDAAiC;IAczC;eACC,kBAAM,uBAAe,EAAE,4BAA4B,CAAC,UAAU,EAAE,YAAY,CAAC;IAC9E,CAAC;IAED,2CAAI,GAAJ,UAAK,QAAiB;QACrB,OAAO,EAAE,CAAC;IACX,CAAC;IAnBM,uCAAU,GAAgC;QAChD,GAAG,EAAE,0BAAgB;QACrB,IAAI,EAAE,oBAAY;QAClB,IAAI,EAAE,0BAAc,CAAC,IAAI,CAAC;QAC1B,QAAQ,EAAE,0BAAc,CAAC,IAAI,CAAC;QAC9B,GAAG,EAAE,0BAAc,CAAC,IAAI,CAAC;QACzB,IAAI,EAAE,0BAAc,CAAC,IAAI,CAAC;QAC1B,MAAM,EAAE,0BAAc,EAAE;QACxB,UAAU,EAAE,0BAAc,CAAC,IAAI,CAAC;QAChC,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS;KACnB,CAAC;IASH,mCAAC;CAAA,AAtBD,CACS,6BAAmB,GAqB3B;AAtBY,oEAA4B;AAwB5B,QAAA,sBAAsB,GAAG,IAAI,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"UploaderTempFileModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/UploaderTempFileModule.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,4DAKsC;AAEtC,yEAGqD;AAGxC,QAAA,eAAe,GAAG,mBAAmB,CAAC;AAEtC,QAAA,YAAY,GAAG,0BAAc,CAAC,SAAS,CAAC,CAAC;AAEtD,MAAa,4BACZ,SAAQ,6BAAiC;IAczC;QACC,KAAK,CAAC,uBAAe,EAAE,4BAA4B,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,CAAC,QAAiB;QACrB,OAAO,EAAE,CAAC;IACX,CAAC;;AArBF,oEAsBC;AApBO,uCAAU,GAAgC;IAChD,GAAG,EAAE,0BAAgB;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;CACnB,CAAC;AAWU,QAAA,sBAAsB,GAAG,IAAI,4BAA4B,EAAE,CAAC"}
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
- var __spreadArrays = (this && this.__spreadArrays) || function () {
3
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
4
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
5
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
6
- r[k] = a[j];
7
- return r;
8
- };
9
2
  Object.defineProperty(exports, "__esModule", { value: true });
10
3
  exports.Frontend_ModulePack_Uploader = void 0;
11
4
  /*
@@ -26,9 +19,10 @@ exports.Frontend_ModulePack_Uploader = void 0;
26
19
  * See the License for the specific language governing permissions and
27
20
  * limitations under the License.
28
21
  */
29
- var UploaderModule_1 = require("../modules/UploaderModule");
30
- var frontend_1 = require("@intuitionrobotics/push-pub-sub/frontend");
31
- exports.Frontend_ModulePack_Uploader = __spreadArrays(frontend_1.Frontend_ModulePack_PushPubSub, [
22
+ const UploaderModule_1 = require("../modules/UploaderModule");
23
+ const frontend_1 = require("@intuitionrobotics/push-pub-sub/frontend");
24
+ exports.Frontend_ModulePack_Uploader = [
25
+ ...frontend_1.Frontend_ModulePack_PushPubSub,
32
26
  UploaderModule_1.UploaderModule
33
- ]);
27
+ ];
34
28
  //# 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;;;;;;;;;;;;;;;;;GAiBG;AACH,4DAAyD;AACzD,qEAAwF;AAE3E,QAAA,4BAA4B,kBACrC,yCAA8B;IACjC,+BAAc;GACb"}
1
+ {"version":3,"file":"module-pack.js","sourceRoot":"","sources":["../../../src/main/app-frontend/core/module-pack.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,8DAAyD;AACzD,uEAAwF;AAE3E,QAAA,4BAA4B,GAAG;IAC3C,GAAG,yCAA8B;IACjC,+BAAc;CACd,CAAC"}
@@ -1,17 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -21,33 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
21
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
22
9
  });
23
10
  };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
11
  Object.defineProperty(exports, "__esModule", { value: true });
52
12
  exports.UploaderModule = exports.UploaderModule_Class = void 0;
53
13
  /*
@@ -68,48 +28,38 @@ exports.UploaderModule = exports.UploaderModule_Class = void 0;
68
28
  * See the License for the specific language governing permissions and
69
29
  * limitations under the License.
70
30
  */
71
- var frontend_1 = require("@intuitionrobotics/thunderstorm/frontend");
72
- var types_1 = require("../../shared/types");
73
- var frontend_2 = require("@intuitionrobotics/push-pub-sub/frontend");
74
- var BaseUploaderModule_1 = require("../../shared/modules/BaseUploaderModule");
75
- var ts_common_1 = require("@intuitionrobotics/ts-common");
76
- var UploaderModule_Class = /** @class */ (function (_super) {
77
- __extends(UploaderModule_Class, _super);
78
- function UploaderModule_Class() {
79
- var _this = _super.call(this, frontend_1.XhrHttpModule) || this;
80
- _this.dispatch_fileStatusChange = new frontend_1.ThunderDispatcher("__onFileStatusChanged");
81
- return _this;
31
+ const frontend_1 = require("@intuitionrobotics/thunderstorm/frontend");
32
+ const types_1 = require("../../shared/types");
33
+ const frontend_2 = require("@intuitionrobotics/push-pub-sub/frontend");
34
+ const BaseUploaderModule_1 = require("../../shared/modules/BaseUploaderModule");
35
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
36
+ class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class {
37
+ constructor() {
38
+ super(frontend_1.XhrHttpModule);
39
+ this.dispatch_fileStatusChange = new frontend_1.ThunderDispatcher("__onFileStatusChanged");
82
40
  }
83
- UploaderModule_Class.prototype.dispatchFileStatusChange = function (id) {
41
+ dispatchFileStatusChange(id) {
84
42
  this.dispatch_fileStatusChange.dispatchUI([id]);
85
- _super.prototype.dispatchFileStatusChange.call(this, id);
86
- };
87
- UploaderModule_Class.prototype.upload = function (files, key, _public) {
88
- return this.uploadImpl(files.map((function (file) {
43
+ super.dispatchFileStatusChange(id);
44
+ }
45
+ upload(files, key, _public) {
46
+ return this.uploadImpl(files.map((file => {
89
47
  return {
90
48
  name: file.name,
91
49
  mimeType: file.type,
92
- key: key,
93
- file: file,
50
+ key,
51
+ file,
94
52
  public: _public
95
53
  };
96
54
  })));
97
- };
98
- UploaderModule_Class.prototype.subscribeToPush = function (toSubscribe) {
99
- return __awaiter(this, void 0, void 0, function () {
100
- return __generator(this, function (_a) {
101
- switch (_a.label) {
102
- case 0:
103
- frontend_2.PushPubSubModule.subscribeMulti(toSubscribe.map(function (r) { return ({ pushKey: types_1.fileUploadedKey, props: { feId: r.tempDoc.feId } }); }));
104
- return [4 /*yield*/, ts_common_1.timeout(ts_common_1.Second)];
105
- case 1:
106
- _a.sent();
107
- return [2 /*return*/];
108
- }
109
- });
55
+ }
56
+ subscribeToPush(toSubscribe) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ frontend_2.PushPubSubModule.subscribeMulti(toSubscribe.map(r => ({ pushKey: types_1.fileUploadedKey, props: { feId: r.tempDoc.feId } })));
59
+ yield ts_common_1.timeout(ts_common_1.Second);
110
60
  });
111
- };
112
- UploaderModule_Class.prototype.__onMessageReceived = function (notification) {
61
+ }
62
+ __onMessageReceived(notification) {
113
63
  var _a, _b;
114
64
  this.logInfo("Message received from service worker", notification.pushKey, notification.props, notification.data);
115
65
  if (notification.pushKey !== types_1.fileUploadedKey)
@@ -123,9 +73,8 @@ var UploaderModule_Class = /** @class */ (function (_super) {
123
73
  break;
124
74
  }
125
75
  frontend_2.PushPubSubModule.unsubscribe({ pushKey: types_1.fileUploadedKey, props: notification.props });
126
- };
127
- return UploaderModule_Class;
128
- }(BaseUploaderModule_1.BaseUploaderModule_Class));
76
+ }
77
+ }
129
78
  exports.UploaderModule_Class = UploaderModule_Class;
130
79
  exports.UploaderModule = new UploaderModule_Class();
131
80
  //# sourceMappingURL=UploaderModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-frontend/modules/UploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;G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