@intuitionrobotics/file-upload 0.45.0 → 0.45.3

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.
Files changed (41) hide show
  1. package/app-backend/api/_upload.js +2 -2
  2. package/app-backend/api/_upload.js.map +1 -1
  3. package/app-backend/api/v1/upload/get-url.js +20 -2
  4. package/app-backend/api/v1/upload/get-url.js.map +1 -1
  5. package/app-backend/core/module-pack.d.ts +1 -1
  6. package/app-backend/core/module-pack.js +20 -2
  7. package/app-backend/core/module-pack.js.map +1 -1
  8. package/app-backend/modules/BucketListener.d.ts +1 -1
  9. package/app-backend/modules/BucketListener.js +21 -4
  10. package/app-backend/modules/BucketListener.js.map +1 -1
  11. package/app-backend/modules/ServerUploaderModule.d.ts +2 -3
  12. package/app-backend/modules/ServerUploaderModule.js +21 -3
  13. package/app-backend/modules/ServerUploaderModule.js.map +1 -1
  14. package/app-backend/modules/UploaderModule.d.ts +2 -2
  15. package/app-backend/modules/UploaderModule.js +30 -15
  16. package/app-backend/modules/UploaderModule.js.map +1 -1
  17. package/app-backend/modules/UploaderTempFileModule.d.ts +4 -4
  18. package/app-backend/modules/UploaderTempFileModule.js +29 -11
  19. package/app-backend/modules/UploaderTempFileModule.js.map +1 -1
  20. package/app-frontend/core/module-pack.d.ts +1 -1
  21. package/app-frontend/core/module-pack.js +20 -2
  22. package/app-frontend/core/module-pack.js.map +1 -1
  23. package/app-frontend/modules/UploaderModule.d.ts +3 -4
  24. package/app-frontend/modules/UploaderModule.js +26 -12
  25. package/app-frontend/modules/UploaderModule.js.map +1 -1
  26. package/backend.d.ts +5 -0
  27. package/backend.js +36 -0
  28. package/backend.js.map +1 -0
  29. package/frontend.d.ts +2 -0
  30. package/frontend.js +33 -0
  31. package/frontend.js.map +1 -0
  32. package/index.d.ts +1 -0
  33. package/index.js +30 -0
  34. package/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/shared/modules/BaseUploaderModule.d.ts +3 -5
  37. package/shared/modules/BaseUploaderModule.js +31 -19
  38. package/shared/modules/BaseUploaderModule.js.map +1 -1
  39. package/shared/types.d.ts +4 -3
  40. package/shared/types.js +18 -0
  41. package/shared/types.js.map +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const HttpServer_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/server/HttpServer");
4
- module.exports = new HttpServer_1.RouteResolver(require, __dirname);
3
+ const backend_1 = require("@intuitionrobotics/thunderstorm/backend");
4
+ module.exports = new backend_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,sGAAoG;AAEpG,MAAM,CAAC,OAAO,GAAG,IAAI,0BAAa,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"_upload.js","sourceRoot":"","sources":["../../../src/main/app-backend/api/_upload.ts"],"names":[],"mappings":";;AAAA,qEAAsE;AAEtE,MAAM,CAAC,OAAO,GAAG,IAAI,uBAAa,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC"}
@@ -1,4 +1,22 @@
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
+ */
2
20
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
21
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
22
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -9,9 +27,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
27
  });
10
28
  };
11
29
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const server_api_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/server/server-api");
30
+ const backend_1 = require("@intuitionrobotics/thunderstorm/backend");
13
31
  const UploaderModule_1 = require("../../../modules/UploaderModule");
14
- class ServerApi_GetUploadUrl extends server_api_1.ServerApi_Post {
32
+ class ServerApi_GetUploadUrl extends backend_1.ServerApi_Post {
15
33
  constructor() {
16
34
  super('get-url');
17
35
  }
@@ -1 +1 @@
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
+ {"version":3,"file":"get-url.js","sourceRoot":"","sources":["../../../../../src/main/app-backend/api/v1/upload/get-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;AAEH,qEAIiD;AAMjD,oEAA+D;AAG/D,MAAM,sBACL,SAAQ,wBAAgC;IACxC;QACC,KAAK,CAAC,SAAS,CAAC,CAAA;IACjB,CAAC;IAEe,OAAO,CAAC,OAAuB,EAAE,QAAqB,EAAE,WAAwB,EAAE,IAAwB;;YACzH,OAAO,+BAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KAAA;CACD;AAED,MAAM,CAAC,OAAO,GAAG,IAAI,sBAAsB,EAAE,CAAA"}
@@ -1 +1 @@
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)[];
1
+ export declare const Backend_ModulePack_Uploader: (import("../modules/UploaderTempFileModule").UploaderTempFileModule_Class | import("@intuitionrobotics/push-pub-sub/backend").PushPubSubModule_Class | import("@intuitionrobotics/push-pub-sub/backend").ScheduledCleanup_Class | import("../modules/BucketListener").BucketListener_Class | import("../modules/UploaderModule").UploaderModule_Class | import("../modules/ServerUploaderModule").ServerUploaderModule_Class)[];
@@ -1,13 +1,31 @@
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
+ */
2
20
  Object.defineProperty(exports, "__esModule", { value: true });
3
21
  exports.Backend_ModulePack_Uploader = void 0;
4
22
  const UploaderModule_1 = require("../modules/UploaderModule");
5
23
  const UploaderTempFileModule_1 = require("../modules/UploaderTempFileModule");
6
24
  const BucketListener_1 = require("../modules/BucketListener");
7
- const module_pack_1 = require("@intuitionrobotics/push-pub-sub/app-backend/core/module-pack");
25
+ const backend_1 = require("@intuitionrobotics/push-pub-sub/backend");
8
26
  const ServerUploaderModule_1 = require("../modules/ServerUploaderModule");
9
27
  exports.Backend_ModulePack_Uploader = [
10
- ...module_pack_1.Backend_ModulePack_PushPubSub,
28
+ ...backend_1.Backend_ModulePack_PushPubSub,
11
29
  ServerUploaderModule_1.ServerUploaderModule,
12
30
  UploaderModule_1.UploaderModule,
13
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":";;;AACA,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
+ {"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,qEAAsF;AACtF,0EAAqE;AAExD,QAAA,2BAA2B,GAAG;IAC1C,GAAG,uCAA6B;IAChC,2CAAoB;IACpB,+BAAc;IACd,+CAAsB;IACtB,+BAAc;CACd,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Firebase_StorageFunction } from "@intuitionrobotics/firebase/app-backend/functions/firebase-function";
1
+ import { Firebase_StorageFunction } from "@intuitionrobotics/firebase/backend-functions";
2
2
  import { ObjectMetadata } from "firebase-functions/lib/v1/providers/storage";
3
3
  import { EventContext } from "firebase-functions";
4
4
  export interface OnFileUploaded {
@@ -1,4 +1,21 @@
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
+ */
2
19
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
20
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
21
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,10 +27,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
27
  };
11
28
  Object.defineProperty(exports, "__esModule", { value: true });
12
29
  exports.BucketListener = exports.BucketListener_Class = void 0;
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 {
30
+ const backend_functions_1 = require("@intuitionrobotics/firebase/backend-functions");
31
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
32
+ const dispatcher_onFileUploaded = new ts_common_1.Dispatcher("__onFileUploaded");
33
+ class BucketListener_Class extends backend_functions_1.Firebase_StorageFunction {
17
34
  constructor() {
18
35
  super("BucketListener");
19
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BucketListener.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/BucketListener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2GAA6G;AAG7G,6EAAwE;AAMxE,MAAM,yBAAyB,GAA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IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;IAEK,UAAU,CAAC,MAAsB,EAAE,OAAqB;;YAC7D,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;QACtC,CAAC;KAAA;CAED;AArBD,oDAqBC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { BaseUploaderFile, Request_Uploader, TempSecureUrl } from "../../shared/types";
2
+ import { BaseUploaderFile, TempSecureUrl, Request_Uploader } from "../../shared/types";
3
3
  import { BaseUploaderModule_Class } from "../../shared/modules/BaseUploaderModule";
4
- import { AxiosHttpModule_Class } from "@intuitionrobotics/thunderstorm/app-backend/modules/http/AxiosHttpModule";
5
- import { Axios_RequestConfig } from "@intuitionrobotics/thunderstorm/app-backend/modules/http/types";
4
+ import { Axios_RequestConfig, AxiosHttpModule_Class } from "@intuitionrobotics/thunderstorm/backend";
6
5
  export declare type ServerFilesToUpload = Request_Uploader & {
7
6
  file: Buffer;
8
7
  };
@@ -1,4 +1,22 @@
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
+ */
2
20
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
21
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
22
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -11,14 +29,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
29
  Object.defineProperty(exports, "__esModule", { value: true });
12
30
  exports.ServerUploaderModule = exports.ServerUploaderModule_Class = void 0;
13
31
  const BaseUploaderModule_1 = require("../../shared/modules/BaseUploaderModule");
14
- const AxiosHttpModule_1 = require("@intuitionrobotics/thunderstorm/app-backend/modules/http/AxiosHttpModule");
32
+ const backend_1 = require("@intuitionrobotics/thunderstorm/backend");
15
33
  class ServerUploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class {
16
34
  constructor() {
17
- super(AxiosHttpModule_1.AxiosHttpModule, "ServerUploaderModule");
35
+ super(backend_1.AxiosHttpModule, "ServerUploaderModule");
18
36
  }
19
37
  init() {
20
38
  super.init();
21
- AxiosHttpModule_1.AxiosHttpModule.setRequestOption(this.config.requestConfig);
39
+ backend_1.AxiosHttpModule.setRequestOption(this.config.requestConfig);
22
40
  }
23
41
  upload(files) {
24
42
  return this.uploadImpl(files);
@@ -1 +1 @@
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
+ {"version":3,"file":"ServerUploaderModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/ServerUploaderModule.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAOH,gFAEiD;AACjD,qEAIiD;AAMjD,MAAa,0BACZ,SAAQ,6CAAuF;IAE/F;QACC,KAAK,CAAC,yBAAe,EAAE,sBAAsB,CAAC,CAAC;IAChD,CAAC;IAED,IAAI;QACH,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,yBAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,KAA4B;QAClC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAEe,eAAe,CAAC,WAA4B;;YAC3D,eAAe;YACf,kBAAkB;QACnB,CAAC;KAAA;CACD;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";
1
3
  import { BaseUploaderFile, DB_Temp_File, TempSecureUrl } from "../../shared/types";
2
4
  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,16 +10,31 @@ 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");
13
33
  const types_1 = require("../../shared/types");
14
34
  const UploaderTempFileModule_1 = require("./UploaderTempFileModule");
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");
35
+ const backend_2 = require("@intuitionrobotics/push-pub-sub/backend");
21
36
  exports.Temp_Path = "files-temp";
22
- class UploaderModule_Class extends module_1.Module {
37
+ class UploaderModule_Class extends ts_common_1.Module {
23
38
  constructor() {
24
39
  super("UploaderModule");
25
40
  this.setPostProcessor = (validator) => {
@@ -28,12 +43,12 @@ class UploaderModule_Class extends module_1.Module {
28
43
  this.getProcessor = (k) => {
29
44
  const postProcessorElement = this.postProcessor[k];
30
45
  if (!postProcessorElement)
31
- throw new exceptions_1.ImplementationMissingException(`Missing validator for type ${k}`);
46
+ throw new ts_common_1.ImplementationMissingException(`Missing validator for type ${k}`);
32
47
  return postProcessorElement;
33
48
  };
34
49
  this.fileUploaded = (filePath) => __awaiter(this, void 0, void 0, function* () {
35
50
  if (!filePath)
36
- throw new exceptions_1.ThisShouldNotHappenException("Missing file path");
51
+ throw new ts_common_1.ThisShouldNotHappenException("Missing file path");
37
52
  this.logInfo(`Looking for file with path ${filePath}`);
38
53
  // I use collection and not the module directly since I want to handle failure my way
39
54
  const tempMeta = yield UploaderTempFileModule_1.UploaderTempFileModule.collection.queryUnique({ where: { path: filePath } });
@@ -66,7 +81,7 @@ class UploaderModule_Class extends module_1.Module {
66
81
  this.notifyFrontend = (feId, result, message, cause) => __awaiter(this, void 0, void 0, function* () {
67
82
  cause && this.logWarning(cause);
68
83
  const data = { message, result, cause };
69
- yield PushPubSubModule_1.PushPubSubModule.pushToKey(types_1.fileUploadedKey, { feId }, data);
84
+ yield backend_2.PushPubSubModule.pushToKey(types_1.fileUploadedKey, { feId }, data);
70
85
  });
71
86
  }
72
87
  __onFileUploaded(filePath) {
@@ -76,8 +91,8 @@ class UploaderModule_Class extends module_1.Module {
76
91
  }
77
92
  init() {
78
93
  if (!this.postProcessor)
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();
94
+ throw new ts_common_1.ImplementationMissingException("You must set a postProcessor for the UploaderModule");
95
+ this.storage = backend_1.FirebaseModule.createAdminSession(this.config.uploaderProjectId).getStorage();
81
96
  }
82
97
  getUrl(body, pathPrefix = exports.Temp_Path) {
83
98
  var _a;
@@ -87,7 +102,7 @@ class UploaderModule_Class extends module_1.Module {
87
102
  return Promise.all(body.map((_file) => __awaiter(this, void 0, void 0, function* () {
88
103
  const key = _file.key || _file.mimeType;
89
104
  this.getProcessor(key);
90
- const _id = random_tools_1.generateHex(32);
105
+ const _id = ts_common_1.generateHex(32);
91
106
  const path = `${pathPrefix}/${_id}`;
92
107
  const instance = {
93
108
  _id,
@@ -96,7 +111,7 @@ class UploaderModule_Class extends module_1.Module {
96
111
  mimeType: _file.mimeType,
97
112
  key,
98
113
  path,
99
- _audit: date_time_tools_1.auditBy("be-stub"),
114
+ _audit: ts_common_1.auditBy("be-stub"),
100
115
  bucketName: bucket.bucketName
101
116
  };
102
117
  if (_file.public)
@@ -105,7 +120,7 @@ class UploaderModule_Class extends module_1.Module {
105
120
  instance.metadata = _file.metadata;
106
121
  const temp = yield UploaderTempFileModule_1.UploaderTempFileModule.upsert(instance);
107
122
  const file = yield bucket.getFile(temp.path);
108
- const url = yield file.getWriteSecuredUrl(_file.mimeType, date_time_tools_1.Hour);
123
+ const url = yield file.getWriteSecuredUrl(_file.mimeType, ts_common_1.Hour);
109
124
  return {
110
125
  secureUrl: url.securedUrl,
111
126
  tempDoc: temp
@@ -1 +1 @@
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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ics/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";
1
+ import { TypeValidator } from "@intuitionrobotics/ts-common";
2
+ import { ServerApi } from "@intuitionrobotics/thunderstorm/backend";
3
+ import { BaseDB_ApiGenerator } from "@intuitionrobotics/db-api-generator/backend";
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/validator").Validator<string>;
6
+ export declare const validateName: import("@intuitionrobotics/ts-common").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,11 +1,29 @@
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
- const validator_1 = require("@intuitionrobotics/ts-common/validator/validator");
5
- const BaseDB_ApiGenerator_1 = require("@intuitionrobotics/db-api-generator/app-backend/BaseDB_ApiGenerator");
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
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
23
+ const backend_1 = require("@intuitionrobotics/db-api-generator/backend");
6
24
  exports.TEMP_COLLECTION = "temp-files-upload";
7
- exports.validateName = validator_1.validateRegexp(/^.{3,}$/);
8
- class UploaderTempFileModule_Class extends BaseDB_ApiGenerator_1.BaseDB_ApiGenerator {
25
+ exports.validateName = ts_common_1.validateRegexp(/^.{3,}$/);
26
+ class UploaderTempFileModule_Class extends backend_1.BaseDB_ApiGenerator {
9
27
  constructor() {
10
28
  super(exports.TEMP_COLLECTION, UploaderTempFileModule_Class._validator, "temp-files", "UploaderTempFileModule");
11
29
  }
@@ -15,14 +33,14 @@ class UploaderTempFileModule_Class extends BaseDB_ApiGenerator_1.BaseDB_ApiGener
15
33
  }
16
34
  exports.UploaderTempFileModule_Class = UploaderTempFileModule_Class;
17
35
  UploaderTempFileModule_Class._validator = {
18
- _id: BaseDB_ApiGenerator_1.validateUniqueId,
36
+ _id: backend_1.validateUniqueId,
19
37
  name: exports.validateName,
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),
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),
26
44
  public: undefined,
27
45
  metadata: undefined
28
46
  };
@@ -1 +1 @@
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
+ {"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,EAAE,wBAAwB,CAAC,CAAC;IACzG,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 +1 @@
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
+ 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 | import("../modules/UploaderModule").UploaderModule_Class)[];
@@ -1,10 +1,28 @@
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
+ */
4
22
  const UploaderModule_1 = require("../modules/UploaderModule");
5
- const module_pack_1 = require("@intuitionrobotics/push-pub-sub/app-frontend/core/module-pack");
23
+ const frontend_1 = require("@intuitionrobotics/push-pub-sub/frontend");
6
24
  exports.Frontend_ModulePack_Uploader = [
7
- ...module_pack_1.Frontend_ModulePack_PushPubSub,
25
+ ...frontend_1.Frontend_ModulePack_PushPubSub,
8
26
  UploaderModule_1.UploaderModule
9
27
  ];
10
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,8DAAyD;AACzD,+FAA6G;AAEhG,QAAA,4BAA4B,GAAG;IACxC,GAAG,4CAA8B;IACjC,+BAAc;CACjB,CAAC"}
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,9 +1,8 @@
1
+ import { ThunderDispatcher, XhrHttpModule_Class } from "@intuitionrobotics/thunderstorm/frontend";
1
2
  import { BaseUploaderFile, Push_FileUploaded, TempSecureUrl } from "../../shared/types";
3
+ import { OnPushMessageReceived } from "@intuitionrobotics/push-pub-sub/frontend";
2
4
  import { BaseUploaderModule_Class, OnFileStatusChanged } from "../../shared/modules/BaseUploaderModule";
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";
5
+ import { DB_Notifications } from "@intuitionrobotics/push-pub-sub";
7
6
  export declare class UploaderModule_Class extends BaseUploaderModule_Class<XhrHttpModule_Class> implements OnPushMessageReceived<Push_FileUploaded> {
8
7
  protected readonly dispatch_fileStatusChange: ThunderDispatcher<OnFileStatusChanged, "__onFileStatusChanged">;
9
8
  constructor();
@@ -10,16 +10,33 @@ 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");
13
32
  const types_1 = require("../../shared/types");
33
+ const frontend_2 = require("@intuitionrobotics/push-pub-sub/frontend");
14
34
  const BaseUploaderModule_1 = require("../../shared/modules/BaseUploaderModule");
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");
35
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
19
36
  class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class {
20
37
  constructor() {
21
- super(XhrHttpModule_1.XhrHttpModule, 'UploaderModule');
22
- this.dispatch_fileStatusChange = new thunder_dispatcher_1.ThunderDispatcher("__onFileStatusChanged");
38
+ super(frontend_1.XhrHttpModule, 'UploaderModule');
39
+ this.dispatch_fileStatusChange = new frontend_1.ThunderDispatcher("__onFileStatusChanged");
23
40
  }
24
41
  dispatchFileStatusChange(id) {
25
42
  this.dispatch_fileStatusChange.dispatchUI([id]);
@@ -38,11 +55,8 @@ class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class
38
55
  }
39
56
  subscribeToPush(toSubscribe) {
40
57
  return __awaiter(this, void 0, void 0, function* () {
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);
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);
46
60
  });
47
61
  }
48
62
  __onMessageReceived(notification) {
@@ -58,7 +72,7 @@ class UploaderModule_Class extends BaseUploaderModule_1.BaseUploaderModule_Class
58
72
  this.setFileInfo((_b = notification.props) === null || _b === void 0 ? void 0 : _b.feId, "status", BaseUploaderModule_1.FileStatus.Error);
59
73
  break;
60
74
  }
61
- PushPubSubModule_1.PushPubSubModule.unsubscribe({ pushKey: types_1.fileUploadedKey, props: notification.props });
75
+ frontend_2.PushPubSubModule.unsubscribe({ pushKey: types_1.fileUploadedKey, props: notification.props });
62
76
  }
63
77
  }
64
78
  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,8CAAqH;AACrH,gFAAkH;AAClH,2G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AgDC;AAEY,QAAA,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
package/backend.d.ts ADDED
@@ -0,0 +1,5 @@
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 ADDED
@@ -0,0 +1,36 @@
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 ADDED
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./app-frontend/core/module-pack";
2
+ export * from "./app-frontend/modules/UploaderModule";
package/frontend.js ADDED
@@ -0,0 +1,33 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontend.js","sourceRoot":"","sources":["../src/main/frontend.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,kEAAgD;AAChD,wEAAsD"}
package/index.d.ts CHANGED
@@ -0,0 +1 @@
1
+ export * from './shared/types';
package/index.js CHANGED
@@ -1,2 +1,32 @@
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);
2
32
  //# 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":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,iDAA+B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuitionrobotics/file-upload",
3
- "version": "0.45.0",
3
+ "version": "0.45.3",
4
4
  "description": "File Uploader - Express & Typescript based backend framework",
5
5
  "keywords": [
6
6
  "IR",
@@ -1,8 +1,6 @@
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";
1
+ import { Dispatcher, Module } from "@intuitionrobotics/ts-common";
2
+ import { BaseHttpModule_Class, BaseHttpRequest } from "@intuitionrobotics/thunderstorm";
3
+ import { BaseUploaderFile, DB_Temp_File, Request_Uploader, TempSecureUrl } from "../../shared/types";
6
4
  export declare enum FileStatus {
7
5
  ObtainingUrl = "ObtainingUrl",
8
6
  UrlObtained = "UrlObtained",
@@ -10,14 +10,26 @@ 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
- 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");
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 thunderstorm_1 = require("@intuitionrobotics/thunderstorm");
21
33
  const RequestKey_UploadUrl = 'get-upload-url';
22
34
  const RequestKey_UploadFile = 'upload-file';
23
35
  var FileStatus;
@@ -31,12 +43,12 @@ var FileStatus;
31
43
  FileStatus["Completed"] = "Completed";
32
44
  FileStatus["Error"] = "Error";
33
45
  })(FileStatus = exports.FileStatus || (exports.FileStatus = {}));
34
- class BaseUploaderModule_Class extends module_1.Module {
46
+ class BaseUploaderModule_Class extends ts_common_1.Module {
35
47
  constructor(httpModule, moduleName) {
36
48
  super(moduleName);
37
49
  this.files = {};
38
- this.uploadQueue = new queue_1.Queue("File Uploader").setParallelCount(2);
39
- this.dispatch_fileStatusChange = new dispatcher_1.Dispatcher('__onFileStatusChanged');
50
+ this.uploadQueue = new ts_common_1.Queue("File Uploader").setParallelCount(2);
51
+ this.dispatch_fileStatusChange = new ts_common_1.Dispatcher('__onFileStatusChanged');
40
52
  this.uploadFiles = (response) => __awaiter(this, void 0, void 0, function* () {
41
53
  // Subscribe
42
54
  yield this.subscribeToPush(response);
@@ -51,7 +63,7 @@ class BaseUploaderModule_Class extends module_1.Module {
51
63
  this.setFileInfo(feId, "status", FileStatus.PostProcessing);
52
64
  }, error => {
53
65
  this.setFileInfo(feId, "status", FileStatus.Error);
54
- this.setFileInfo(feId, "messageStatus", tools_1.__stringify(error));
66
+ this.setFileInfo(feId, "messageStatus", ts_common_1.__stringify(error));
55
67
  });
56
68
  });
57
69
  });
@@ -61,14 +73,14 @@ class BaseUploaderModule_Class extends module_1.Module {
61
73
  this.setFileInfo(feId, "tempDoc", response.tempDoc);
62
74
  const fileInfo = this.files[feId];
63
75
  if (!fileInfo)
64
- throw new exceptions_1.BadImplementationException(`Missing file with id ${feId} and name: ${response.tempDoc.name}`);
76
+ throw new ts_common_1.BadImplementationException(`Missing file with id ${feId} and name: ${response.tempDoc.name}`);
65
77
  const request = this
66
78
  .httpModule
67
- .createRequest(types_1.HttpMethod.PUT, RequestKey_UploadFile)
79
+ .createRequest(thunderstorm_1.HttpMethod.PUT, RequestKey_UploadFile)
68
80
  .setUrl(response.secureUrl)
69
81
  // Don't change this because it replaces the default headers which we dont need
70
82
  .setDefaultHeaders({ 'Content-Type': response.tempDoc.mimeType })
71
- .setTimeout(20 * date_time_tools_1.Minute)
83
+ .setTimeout(20 * ts_common_1.Minute)
72
84
  .setBody(fileInfo.file)
73
85
  .setOnProgressListener((ev) => {
74
86
  this.setFileInfo(feId, "progress", ev.loaded / ev.total);
@@ -90,7 +102,7 @@ class BaseUploaderModule_Class extends module_1.Module {
90
102
  }
91
103
  setFileInfo(id, key, value) {
92
104
  if (!this.files[id])
93
- throw new exceptions_1.BadImplementationException(`Trying to set ${key} for non existent file with id: ${id}`);
105
+ throw new ts_common_1.BadImplementationException(`Trying to set ${key} for non existent file with id: ${id}`);
94
106
  this.files[id][key] = value;
95
107
  this.dispatchFileStatusChange(id);
96
108
  }
@@ -102,7 +114,7 @@ class BaseUploaderModule_Class extends module_1.Module {
102
114
  const fileInfo = {
103
115
  name: fileData.name,
104
116
  mimeType: fileData.mimeType,
105
- feId: random_tools_1.generateHex(32)
117
+ feId: ts_common_1.generateHex(32)
106
118
  };
107
119
  if (fileData.key)
108
120
  fileInfo.key = fileData.key;
@@ -118,12 +130,12 @@ class BaseUploaderModule_Class extends module_1.Module {
118
130
  });
119
131
  this
120
132
  .httpModule
121
- .createRequest(types_1.HttpMethod.POST, RequestKey_UploadUrl)
133
+ .createRequest(thunderstorm_1.HttpMethod.POST, RequestKey_UploadUrl)
122
134
  .setRelativeUrl('/v1/upload/get-url')
123
135
  .setJsonBody(body)
124
136
  .setOnError((request, resError) => {
125
137
  body.forEach(f => {
126
- this.setFileInfo(f.feId, "messageStatus", tools_1.__stringify(resError === null || resError === void 0 ? void 0 : resError.debugMessage));
138
+ this.setFileInfo(f.feId, "messageStatus", ts_common_1.__stringify(resError === null || resError === void 0 ? void 0 : resError.debugMessage));
127
139
  this.setFileInfo(f.feId, "status", FileStatus.Error);
128
140
  });
129
141
  })
@@ -1 +1 @@
1
- {"version":3,"file":"BaseUploaderModule.js","sourceRoot":"","sources":["../../../src/main/shared/modules/BaseUploaderModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,wEAAuF;AACvF,6EAAwE;AACxE,6EAAwF;AACxF,qEAAgE;AAChE,wFAA0E;AAC1E,oEAA+D;AAC/D,kFAA4E;AAC5E,oEAAqE;AAGrE,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAC9C,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAE5C,IAAY,UASX;AATD,WAAY,UAAU;IAClB,2CAA6B,CAAA;IAC7B,yCAA2B,CAAA;IAC3B,6CAA+B,CAAA;IAC/B,kDAAkD;IAClD,6CAA6C;IAC7C,+CAAiC,CAAA;IACjC,qCAAuB,CAAA;IACvB,6BAAe,CAAA;AACnB,CAAC,EATW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QASrB;AA0BD,MAAsB,wBAClB,SAAQ,eAA6B;IAMrC,YAAsB,UAAsB,EAAE,UAAkB;QAC5D,KAAK,CAAC,UAAU,CAAC,CAAC;QANZ,UAAK,GAA+B,EAAE,CAAC;QAChC,gBAAW,GAAU,IAAI,aAAK,CAAC,eAAe,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UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;YAC9E,IAAI,CAAC,QAAQ;gBACZ,OAAO;YAER,oCAAoC;YACpC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC,CAAA,CAAC,CAAC;QAEJ,OAAO,IAAI,CAAC;IACb,CAAC;CA6CD;AAjID,4DAiIC"}
package/shared/types.d.ts CHANGED
@@ -1,6 +1,7 @@
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";
1
+ import { ApiWithBody } from "@intuitionrobotics/thunderstorm";
2
+ import { DB_Object } from "@intuitionrobotics/firebase";
3
+ import { AuditBy, ObjectTS } from "@intuitionrobotics/ts-common";
4
+ import { MessageType } from "@intuitionrobotics/push-pub-sub";
4
5
  export declare const fileUploadedKey = "file-uploaded";
5
6
  export declare type Push_FileUploaded = MessageType<"file-uploaded", {
6
7
  feId: string;
package/shared/types.js CHANGED
@@ -1,4 +1,22 @@
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
+ */
2
20
  Object.defineProperty(exports, "__esModule", { value: true });
3
21
  exports.UploadResult = exports.fileUploadedKey = void 0;
4
22
  exports.fileUploadedKey = "file-uploaded";
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/main/shared/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAUU,QAAA,eAAe,GAAG,eAAe,CAAC;AAG/C,IAAY,YAGX;AAHD,WAAY,YAAY;IACvB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACpB,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB"}