@rocketmakers/orbit-notify-firebase 2.0.0-beta.5 → 2.0.0-beta.8

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 (74) hide show
  1. package/lib/_tests_/manualTest/index.test.d.ts +2 -0
  2. package/lib/_tests_/manualTest/index.test.d.ts.map +1 -0
  3. package/lib/_tests_/manualTest/index.test.js +7 -0
  4. package/lib/_tests_/manualTest/index.test.js.map +1 -0
  5. package/lib/_tests_/manualTest/sendNotification.d.ts +2 -0
  6. package/lib/_tests_/manualTest/sendNotification.d.ts.map +1 -0
  7. package/lib/_tests_/manualTest/sendNotification.js +47 -0
  8. package/lib/_tests_/manualTest/sendNotification.js.map +1 -0
  9. package/lib/_tests_/manualTest/serviceInstance.d.ts +9 -0
  10. package/lib/_tests_/manualTest/serviceInstance.d.ts.map +1 -0
  11. package/lib/_tests_/manualTest/serviceInstance.js +26 -0
  12. package/lib/_tests_/manualTest/serviceInstance.js.map +1 -0
  13. package/lib/_tests_/unit/validation/index.test.d.ts +2 -0
  14. package/lib/_tests_/unit/validation/index.test.d.ts.map +1 -0
  15. package/lib/_tests_/unit/validation/index.test.js +7 -0
  16. package/lib/_tests_/unit/validation/index.test.js.map +1 -0
  17. package/lib/_tests_/unit/validation/mockedService.d.ts +13 -0
  18. package/lib/_tests_/unit/validation/mockedService.d.ts.map +1 -0
  19. package/lib/_tests_/unit/validation/mockedService.js +20 -0
  20. package/lib/_tests_/unit/validation/mockedService.js.map +1 -0
  21. package/lib/_tests_/unit/validation/sendNotification.d.ts +2 -0
  22. package/lib/_tests_/unit/validation/sendNotification.d.ts.map +1 -0
  23. package/lib/_tests_/unit/validation/sendNotification.js +39 -0
  24. package/lib/_tests_/unit/validation/sendNotification.js.map +1 -0
  25. package/lib/_tests_/validation/index.test.d.ts +2 -0
  26. package/lib/_tests_/validation/index.test.d.ts.map +1 -0
  27. package/lib/_tests_/validation/index.test.js +7 -0
  28. package/lib/_tests_/validation/index.test.js.map +1 -0
  29. package/lib/_tests_/validation/mockedService.d.ts +14 -0
  30. package/lib/_tests_/validation/mockedService.d.ts.map +1 -0
  31. package/lib/_tests_/validation/mockedService.js +20 -0
  32. package/lib/_tests_/validation/mockedService.js.map +1 -0
  33. package/lib/_tests_/validation/sendNotification.d.ts +2 -0
  34. package/lib/_tests_/validation/sendNotification.d.ts.map +1 -0
  35. package/lib/_tests_/validation/sendNotification.js +39 -0
  36. package/lib/_tests_/validation/sendNotification.js.map +1 -0
  37. package/lib/config/environment.generated.d.ts +7 -0
  38. package/lib/config/environment.generated.d.ts.map +1 -0
  39. package/lib/config/environment.generated.js +25 -0
  40. package/lib/config/environment.generated.js.map +1 -0
  41. package/lib/config/index.d.ts +7 -0
  42. package/lib/config/index.d.ts.map +1 -0
  43. package/lib/config/index.js +5 -0
  44. package/lib/config/index.js.map +1 -0
  45. package/lib/index.d.ts +5 -0
  46. package/lib/index.d.ts.map +1 -0
  47. package/lib/index.js +8 -0
  48. package/lib/index.js.map +1 -0
  49. package/lib/ioc/index.d.ts +3 -0
  50. package/lib/ioc/index.d.ts.map +1 -0
  51. package/lib/ioc/index.js +6 -0
  52. package/lib/ioc/index.js.map +1 -0
  53. package/lib/ioc/register.d.ts +8 -0
  54. package/lib/ioc/register.d.ts.map +1 -0
  55. package/lib/ioc/register.js +31 -0
  56. package/lib/ioc/register.js.map +1 -0
  57. package/lib/ioc/types.d.ts +7 -0
  58. package/lib/ioc/types.d.ts.map +1 -0
  59. package/lib/ioc/types.js +3 -0
  60. package/lib/ioc/types.js.map +1 -0
  61. package/lib/services/firebaseService.d.ts +32 -0
  62. package/lib/services/firebaseService.d.ts.map +1 -0
  63. package/lib/services/firebaseService.js +93 -0
  64. package/lib/services/firebaseService.js.map +1 -0
  65. package/lib/services/index.d.ts +2 -0
  66. package/lib/services/index.d.ts.map +1 -0
  67. package/lib/services/index.js +5 -0
  68. package/lib/services/index.js.map +1 -0
  69. package/lib/tsconfig.tsbuildinfo +1 -0
  70. package/lib/validation/index.d.ts +15 -0
  71. package/lib/validation/index.d.ts.map +1 -0
  72. package/lib/validation/index.js +24 -0
  73. package/lib/validation/index.js.map +1 -0
  74. package/package.json +8 -8
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/_tests_/manualTest/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sendNotification_1 = require("./sendNotification");
4
+ describe('FirebaseService - manual', () => {
5
+ (0, sendNotification_1.sendNotificationTests)();
6
+ });
7
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/_tests_/manualTest/index.test.ts"],"names":[],"mappings":";;AAAA,yDAA2D;AAE3D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAA,wCAAqB,GAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function sendNotificationTests(): void;
2
+ //# sourceMappingURL=sendNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../src/_tests_/manualTest/sendNotification.ts"],"names":[],"mappings":"AAkDA,wBAAgB,qBAAqB,SAQpC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendNotificationTests = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const FirebaseAdmin = require("firebase-admin");
6
+ const orbit_core_1 = require("@rocketmakers/orbit-core");
7
+ const serviceInstance_1 = require("./serviceInstance");
8
+ function send() {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const { firebaseService, templateService } = (0, serviceInstance_1.getServiceInstance)();
11
+ const layoutId = 'login';
12
+ const payload = {
13
+ name: 'product team',
14
+ username: 'football_tuesdays_21',
15
+ loginDateTime: 'Sometime in the early 90s',
16
+ deviceId: '123ABC',
17
+ };
18
+ yield templateService.initCache();
19
+ const someUid = new orbit_core_1.UuidGeneratorService().generate();
20
+ const firebaseDeviceToken = yield FirebaseAdmin.auth().createCustomToken(someUid);
21
+ try {
22
+ return firebaseService.sendNotification({
23
+ firebaseDeviceToken,
24
+ layoutId,
25
+ templateName: 'txt',
26
+ payload: {
27
+ data: payload,
28
+ title: 'Test push',
29
+ imageUrl: 'https://placekitten.com/200/300',
30
+ },
31
+ });
32
+ }
33
+ catch (error) {
34
+ throw new Error(error);
35
+ }
36
+ });
37
+ }
38
+ function sendNotificationTests() {
39
+ describe('sendNotification', () => {
40
+ it('can send notification', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
41
+ const res = yield send();
42
+ expect(res).toEqual(true);
43
+ }));
44
+ });
45
+ }
46
+ exports.sendNotificationTests = sendNotificationTests;
47
+ //# sourceMappingURL=sendNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/_tests_/manualTest/sendNotification.ts"],"names":[],"mappings":";;;;AAAA,gDAAgD;AAChD,yDAAgE;AAGhE,uDAAuD;AASvD,SAAe,IAAI;;QAIjB,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,IAAA,oCAAkB,GAAE,CAAC;QAElE,MAAM,QAAQ,GAAG,OAAmB,CAAC;QACrC,MAAM,OAAO,GAAkB;YAC7B,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,sBAAsB;YAChC,aAAa,EAAE,2BAA2B;YAC1C,QAAQ,EAAE,QAAQ;SACnB,CAAC;QAGF,MAAM,eAAe,CAAC,SAAS,EAAE,CAAC;QAElC,MAAM,OAAO,GAAG,IAAI,iCAAoB,EAAE,CAAC,QAAQ,EAAE,CAAC;QACtD,MAAM,mBAAmB,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAGlF,IAAI;YACF,OAAO,eAAe,CAAC,gBAAgB,CAAgB;gBACrD,mBAAmB;gBACnB,QAAQ;gBACR,YAAY,EAAE,KAAK;gBACnB,OAAO,EAAE;oBACP,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,WAAW;oBAClB,QAAQ,EAAE,iCAAiC;iBAC5C;aACF,CAAC,CAAC;SACJ;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;CAAA;AAED,SAAgB,qBAAqB;IACnC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,EAAE,CAAC,uBAAuB,EAAE,GAAS,EAAE;YACrC,MAAM,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC;YAEzB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AARD,sDAQC"}
@@ -0,0 +1,9 @@
1
+ import { TemplateRepository } from '@rocketmakers/orbit-template-http-repository';
2
+ import { TemplateService } from '@rocketmakers/orbit-template-service';
3
+ import { FirebaseService } from '../../services';
4
+ export declare function getServiceInstance(): {
5
+ templateRepo: TemplateRepository;
6
+ templateService: TemplateService;
7
+ firebaseService: FirebaseService;
8
+ };
9
+ //# sourceMappingURL=serviceInstance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceInstance.d.ts","sourceRoot":"","sources":["../../../src/_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,8CAA8C,CAAC;AAInG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjD,wBAAgB,kBAAkB;;;;EAwBjC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getServiceInstance = void 0;
4
+ const orbit_template_http_repository_1 = require("@rocketmakers/orbit-template-http-repository");
5
+ const orbit_core_1 = require("@rocketmakers/orbit-core");
6
+ const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
7
+ const orbit_template_service_1 = require("@rocketmakers/orbit-template-service");
8
+ const services_1 = require("../../services");
9
+ const logger = (0, logger_1.createLogger)('sendgrid-service-manual-test');
10
+ function getServiceInstance() {
11
+ const templateGitlabUrl = process.env.TEMPLATES_URL;
12
+ const serviceAccount = {
13
+ project_id: 'manual-tester',
14
+ private_key: '-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC0EgIXftpw1Zh4\n2fwIxegpaf4TW6IlH99gjyd0+Vktfbgc7xYRR+I/bke9CwrJq82jVQcUQUkvAjFK\nEIK6QEYsD//6A0ghMeGc9m9ZrjA565bWMYpy2JUIct+4D3gNgJnTsjKNaJeXhhIh\n8eUrgiGh0NhqDMb8rreHjsmZQ82mhaOs1hjFJLM9Sa08oaSWaeB7xNGfNQe/Tke7\n/RB4ycmMLWi8u4u5lEDmkid7PCG/OPKHWQLmVjSlq/c2F8D48XwMUn8npYAJG6Ie\norEyy5GudpB3LuDVACYjkhZFkl04Hu2lSPl3gAUJckyvFMobCTJ5j+qyfG9of6J7\nTRw8pPXrAgMBAAECggEAJYNe5jAqJ7mHwx1+cQFxxTbslHHRjLRgH8iS6r6Lgnuf\nYH+6dC0qiBZcYZisTak59N3g1KppKZ7mT8yyv0RmmgVXSWlnnGq82qtINUGhkF9x\nE/xMIHLYUWNFEh4+32k8IqsL9wOkGQ/4NRQkrvS0NvbALw+sYLWxTE9F1mUWsarp\n4DHlO6v6eLudtOUnGH9N7EHKEPpE3JJfwtWgr83kTkRLy7g3/MHM34zNTu6ghTS0\nubyWoHBNzAeoK4Ksi9YK37YcBu1c8g59zG+MaehX3QiFjgj2k5tcYkCEtg+EzY6o\nzALmasDQduv+6SH1bbNDIscH3Q7c2lMKknHs+ThtmQKBgQDnmsOypd6ppDqesNBM\nYmPKnOq/JjQItP8edz417/IFh3YKdd4w0z7PcZ0VNa1j8lYFh47MQDaYlYWOm++B\nP5ljAyOHlAQTEj+R6EnYjiU4nzepVAyoudM0W/PxzIJceJXSDSwXL9HEJaeXzIsz\nJZ67ZL46ZpcI9dXFEy8Z5eWNRQKBgQDHCZ6k8b5WdiAEiubQYaemdqkz0Lsik0uv\npi8yVbfefbhvlUws/8Nr6z3FAY0G0VhEdjY/Lgv+Alwkx1R67apmJHJq2pMySUdH\n+j7OAMtKY78ut08PDPuOUNqrbYbTvuOvQp3N1GrSn5Gru3bFv1hpWvFT0Uq/glJ4\njsCpWLCxbwKBgQCu7yHTpR96qPYx+MFMgKB5YG6a9KMm1HdCLrUJjnQSow+QtRif\nbl+p1lnctE+EB33b7Vj5g6L5Oy7G2Zdc24ni1HMYq78sHINxlK96Z1tL2k7zke2B\n3+HcUXv/bgYlDFu1bYeY9+CMNBjTOocFmeu8BUr915FLDkxp76SK/i+VtQKBgQC+\nfQRqFDr4AMGP12gj0vJirHovbvtKkfIDv2a4I7V/qI7Vq+tlvbpIFLHfVCamecCi\ndQhh2y37AkMxp9vAcql8bDFc9qednugriOKGwdfN8DzO9v0hCGnQwK0nGAHLsYuy\n9myUy1EZF0KROy7m/sQcwL7qWwnQ02cennDhIlKo3QKBgFvXbiWQdqzyz/p7btoq\nWcnGCSZwjYNYrWnrgCjuaIV8GPNlmiRTDqc43aCmexVTYzbJziXaNVsEb5DIqMws\nXAzZiKe/VZ1Jc/0Hp+VkRHKGCBBKdV8uVVaCQEf6jBadnPE/9KchdSS/ot/6KYOl\n61p33xHa/13tm7tIOjL6QHHK\n-----END PRIVATE KEY-----\n',
15
+ client_email: 'firebase-adminsdk-s5pgs@manual-tester.iam.gserviceaccount.com',
16
+ };
17
+ if (!templateGitlabUrl) {
18
+ throw new orbit_core_1.ConfigurationError('Template gitlab root url must be provided for manual testing through the env variable: TEMPLATES_URL');
19
+ }
20
+ const templateRepo = new orbit_template_http_repository_1.TemplateRepository(logger, 'firebase', new orbit_template_http_repository_1.AnonHttpFetcher(new URL(templateGitlabUrl)));
21
+ const templateService = new orbit_template_service_1.TemplateService(templateRepo, logger);
22
+ const firebaseService = new services_1.FirebaseService(templateService, serviceAccount, logger);
23
+ return { templateRepo, templateService, firebaseService };
24
+ }
25
+ exports.getServiceInstance = getServiceInstance;
26
+ //# sourceMappingURL=serviceInstance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serviceInstance.js","sourceRoot":"","sources":["../../../src/_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":";;;AAAA,iGAAmG;AACnG,yDAA8D;AAC9D,oEAAuE;AAEvE,iFAAuE;AACvE,6CAAiD;AAEjD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,8BAA8B,CAAC,CAAC;AAE5D,SAAgB,kBAAkB;IAChC,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAEpD,MAAM,cAAc,GAAG;QACrB,UAAU,EAAE,eAAe;QAC3B,WAAW,EACT,ssDAAssD;QACxsD,YAAY,EAAE,+DAA+D;KAC9E,CAAC;IAEF,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,+BAAkB,CAC1B,sGAAsG,CACvG,CAAC;KACH;IAED,MAAM,YAAY,GAAG,IAAI,mDAAkB,CACzC,MAAM,EACN,UAA+B,EAC/B,IAAI,gDAAe,CAAC,IAAI,GAAG,CAAC,iBAA2B,CAAC,CAAC,CAC1D,CAAC;IACF,MAAM,eAAe,GAAG,IAAI,wCAAe,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAClE,MAAM,eAAe,GAAG,IAAI,0BAAe,CAAC,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACrF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC5D,CAAC;AAxBD,gDAwBC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sendNotification_1 = require("./sendNotification");
4
+ describe('FirebaseService - validation', () => {
5
+ (0, sendNotification_1.sendNotificationTests)();
6
+ });
7
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/index.test.ts"],"names":[],"mappings":";;AAAA,yDAA2D;AAE3D,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,IAAA,wCAAqB,GAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="bunyan" />
2
+ import * as TypeMoq from 'typemoq';
3
+ import { TemplateService } from '@rocketmakers/orbit-template-service';
4
+ import { Logger } from '@rocketmakers/shell-commands/lib/logger';
5
+ import { FirebaseService, IGoogleServiceAccount } from '../../..';
6
+ export declare class MockedFirebaseService {
7
+ mockedTemplateService: TypeMoq.IMock<TemplateService>;
8
+ serviceAccount: IGoogleServiceAccount;
9
+ service: FirebaseService;
10
+ logger: Logger;
11
+ constructor();
12
+ }
13
+ //# sourceMappingURL=mockedService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockedService.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/mockedService.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAgB,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAElE,qBAAa,qBAAqB;IACzB,qBAAqB,EAAE,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAEtD,cAAc,EAAE,qBAAqB,CAAC;IAEtC,OAAO,EAAE,eAAe,CAAC;IAEzB,MAAM,EAAE,MAAM,CAAC;;CAavB"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockedFirebaseService = void 0;
4
+ const TypeMoq = require("typemoq");
5
+ const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
6
+ const __1 = require("../../..");
7
+ class MockedFirebaseService {
8
+ constructor() {
9
+ this.mockedTemplateService = TypeMoq.Mock.ofType();
10
+ this.serviceAccount = {
11
+ project_id: 'manual-tester',
12
+ private_key: 'my-super-cool-key',
13
+ client_email: 'firebase-adminsdk-s5pgs@manual-tester.iam.gserviceaccount.com',
14
+ };
15
+ this.logger = (0, logger_1.createLogger)('firebase-service-tests');
16
+ this.service = new __1.FirebaseService(this.mockedTemplateService.object, this.serviceAccount, this.logger, true);
17
+ }
18
+ }
19
+ exports.MockedFirebaseService = MockedFirebaseService;
20
+ //# sourceMappingURL=mockedService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockedService.js","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/mockedService.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAEnC,oEAA+E;AAC/E,gCAAkE;AAElE,MAAa,qBAAqB;IAShC;QACE,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAmB,CAAC;QACpE,IAAI,CAAC,cAAc,GAAG;YACpB,UAAU,EAAE,eAAe;YAC3B,WAAW,EAAE,mBAAmB;YAChC,YAAY,EAAE,+DAA+D;SAC9E,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAY,EAAC,wBAAwB,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,GAAG,IAAI,mBAAe,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChH,CAAC;CACF;AApBD,sDAoBC"}
@@ -0,0 +1,2 @@
1
+ export declare function sendNotificationTests(): void;
2
+ //# sourceMappingURL=sendNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/sendNotification.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,SAoCpC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendNotificationTests = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const orbit_testing_core_1 = require("@rocketmakers/orbit-testing-core");
6
+ const mockedService_1 = require("./mockedService");
7
+ function sendNotificationTests() {
8
+ describe('sendNotification', () => {
9
+ function setupBaseValidMock() {
10
+ const mock = new mockedService_1.MockedFirebaseService();
11
+ const firebaseDeviceToken = 'MY-COOL-DEVICE';
12
+ const layoutId = 'MY-COOL-LAYOUT';
13
+ const templateName = 'MY-COOL-TEMPLATE';
14
+ const payload = { data: { name: 'TIM' } };
15
+ return { mock, firebaseDeviceToken, layoutId, templateName, payload };
16
+ }
17
+ orbit_testing_core_1.invalidValues.forEach((val) => tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ const { mock, firebaseDeviceToken, layoutId, templateName, payload } = setupBaseValidMock();
19
+ it(`throws validation error when '${val}' is provided as deviceToken`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken: val, layoutId, templateName, payload });
21
+ expect(res.kind).toEqual('ValidationError');
22
+ }));
23
+ it(`throws validation error when '${val}' is provided as layout id`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken, layoutId: val, templateName, payload });
25
+ expect(res.kind).toEqual('ValidationError');
26
+ }));
27
+ it(`throws validation error when '${val}' is provided as template name`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName: val, payload });
29
+ expect(res.kind).toEqual('ValidationError');
30
+ }));
31
+ it(`throws validation error when '${val}' is provided as payload`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName, payload: val });
33
+ expect(res.kind).toEqual('ValidationError');
34
+ }));
35
+ }));
36
+ });
37
+ }
38
+ exports.sendNotificationTests = sendNotificationTests;
39
+ //# sourceMappingURL=sendNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/sendNotification.ts"],"names":[],"mappings":";;;;AACA,yEAAiE;AAEjE,mDAAwD;AAExD,SAAgB,qBAAqB;IACnC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,SAAS,kBAAkB;YACzB,MAAM,IAAI,GAAG,IAAI,qCAAqB,EAAE,CAAC;YACzC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;YAC7C,MAAM,QAAQ,GAAG,gBAA4B,CAAC;YAC9C,MAAM,YAAY,GAAG,kBAAkB,CAAC;YACxC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAE1C,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;QACxE,CAAC;QAED,kCAAa,CAAC,OAAO,CAAC,CAAM,GAAG,EAAC,EAAE;YAChC,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GA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,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC9C,CAAC,CAAA,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,sDAoCC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/_tests_/validation/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sendNotification_1 = require("./sendNotification");
4
+ describe('FirebaseService - validation', () => {
5
+ (0, sendNotification_1.sendNotificationTests)();
6
+ });
7
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/_tests_/validation/index.test.ts"],"names":[],"mappings":";;AAAA,yDAA2D;AAE3D,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,IAAA,wCAAqB,GAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /// <reference types="bunyan" />
2
+ import * as TypeMoq from 'typemoq';
3
+ import { TemplateService } from '@rocketmakers/orbit-template-service';
4
+ import { Logger } from '@rocketmakers/shell-commands/lib/logger';
5
+ import { IGoogleServiceAccount } from '../../config';
6
+ import { FirebaseService } from '../../services';
7
+ export declare class MockedFirebaseService {
8
+ mockedTemplateService: TypeMoq.IMock<TemplateService>;
9
+ serviceAccount: IGoogleServiceAccount;
10
+ service: FirebaseService;
11
+ logger: Logger;
12
+ constructor();
13
+ }
14
+ //# sourceMappingURL=mockedService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockedService.d.ts","sourceRoot":"","sources":["../../../src/_tests_/validation/mockedService.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAgB,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,qBAAa,qBAAqB;IACzB,qBAAqB,EAAE,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAEtD,cAAc,EAAE,qBAAqB,CAAC;IAEtC,OAAO,EAAE,eAAe,CAAC;IAEzB,MAAM,EAAE,MAAM,CAAC;;CAavB"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MockedFirebaseService = void 0;
4
+ const TypeMoq = require("typemoq");
5
+ const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
6
+ const services_1 = require("../../services");
7
+ class MockedFirebaseService {
8
+ constructor() {
9
+ this.mockedTemplateService = TypeMoq.Mock.ofType();
10
+ this.serviceAccount = {
11
+ project_id: 'manual-tester',
12
+ private_key: 'my-super-cool-key',
13
+ client_email: 'firebase-adminsdk-s5pgs@manual-tester.iam.gserviceaccount.com',
14
+ };
15
+ this.logger = (0, logger_1.createLogger)('firebase-service-tests');
16
+ this.service = new services_1.FirebaseService(this.mockedTemplateService.object, this.serviceAccount, this.logger, true);
17
+ }
18
+ }
19
+ exports.MockedFirebaseService = MockedFirebaseService;
20
+ //# sourceMappingURL=mockedService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockedService.js","sourceRoot":"","sources":["../../../src/_tests_/validation/mockedService.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAEnC,oEAA+E;AAE/E,6CAAiD;AAEjD,MAAa,qBAAqB;IAShC;QACE,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAmB,CAAC;QACpE,IAAI,CAAC,cAAc,GAAG;YACpB,UAAU,EAAE,eAAe;YAC3B,WAAW,EAAE,mBAAmB;YAChC,YAAY,EAAE,+DAA+D;SAC9E,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAY,EAAC,wBAAwB,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,GAAG,IAAI,0BAAe,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChH,CAAC;CACF;AApBD,sDAoBC"}
@@ -0,0 +1,2 @@
1
+ export declare function sendNotificationTests(): void;
2
+ //# sourceMappingURL=sendNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../src/_tests_/validation/sendNotification.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,SAoCpC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendNotificationTests = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const orbit_testing_core_1 = require("@rocketmakers/orbit-testing-core");
6
+ const mockedService_1 = require("./mockedService");
7
+ function sendNotificationTests() {
8
+ describe('sendNotification', () => {
9
+ function setupBaseValidMock() {
10
+ const mock = new mockedService_1.MockedFirebaseService();
11
+ const firebaseDeviceToken = 'MY-COOL-DEVICE';
12
+ const layoutId = 'MY-COOL-LAYOUT';
13
+ const templateName = 'MY-COOL-TEMPLATE';
14
+ const payload = { data: { name: 'TIM' } };
15
+ return { mock, firebaseDeviceToken, layoutId, templateName, payload };
16
+ }
17
+ orbit_testing_core_1.invalidValues.forEach((val) => tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ const { mock, firebaseDeviceToken, layoutId, templateName, payload } = setupBaseValidMock();
19
+ it(`throws validation error when '${val}' is provided as deviceToken`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken: val, layoutId, templateName, payload });
21
+ expect(res.kind).toEqual('ValidationError');
22
+ }));
23
+ it(`throws validation error when '${val}' is provided as layout id`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken, layoutId: val, templateName, payload });
25
+ expect(res.kind).toEqual('ValidationError');
26
+ }));
27
+ it(`throws validation error when '${val}' is provided as template name`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName: val, payload });
29
+ expect(res.kind).toEqual('ValidationError');
30
+ }));
31
+ it(`throws validation error when '${val}' is provided as payload`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ const res = yield mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName, payload: val });
33
+ expect(res.kind).toEqual('ValidationError');
34
+ }));
35
+ }));
36
+ });
37
+ }
38
+ exports.sendNotificationTests = sendNotificationTests;
39
+ //# sourceMappingURL=sendNotification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../src/_tests_/validation/sendNotification.ts"],"names":[],"mappings":";;;;AACA,yEAAiE;AAEjE,mDAAwD;AAExD,SAAgB,qBAAqB;IACnC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAChC,SAAS,kBAAkB;YACzB,MAAM,IAAI,GAAG,IAAI,qCAAqB,EAAE,CAAC;YACzC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;YAC7C,MAAM,QAAQ,GAAG,gBAA4B,CAAC;YAC9C,MAAM,YAAY,GAAG,kBAAkB,CAAC;YACxC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YAE1C,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;QACxE,CAAC;QAED,kCAAa,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AAO,CAAC,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;gBAC/G,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC9C,CAAC,CAAA,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,sDAoCC"}
@@ -0,0 +1,7 @@
1
+ export declare class FirebaseEnvironment {
2
+ firebaseClientEmail: string;
3
+ firebasePrivateKey: string;
4
+ firebaseProjectId: string;
5
+ rootTemplateRepoUrl: string;
6
+ }
7
+ //# sourceMappingURL=environment.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.generated.d.ts","sourceRoot":"","sources":["../../src/config/environment.generated.ts"],"names":[],"mappings":"AAOA,qBAAa,mBAAmB;IAG5B,mBAAmB,EAAG,MAAM,CAAC;IAG7B,kBAAkB,EAAG,MAAM,CAAC;IAG5B,iBAAiB,EAAG,MAAM,CAAC;IAG3B,mBAAmB,EAAG,MAAM,CAAC;CAChC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FirebaseEnvironment = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const environment_1 = require("@rocketmakers/environment");
6
+ class FirebaseEnvironment {
7
+ }
8
+ tslib_1.__decorate([
9
+ environment_1.environmentVariable.string('FIREBASE_CLIENT_EMAIL'),
10
+ tslib_1.__metadata("design:type", String)
11
+ ], FirebaseEnvironment.prototype, "firebaseClientEmail", void 0);
12
+ tslib_1.__decorate([
13
+ environment_1.environmentVariable.string('FIREBASE_PRIVATE_KEY'),
14
+ tslib_1.__metadata("design:type", String)
15
+ ], FirebaseEnvironment.prototype, "firebasePrivateKey", void 0);
16
+ tslib_1.__decorate([
17
+ environment_1.environmentVariable.string('FIREBASE_PROJECT_ID'),
18
+ tslib_1.__metadata("design:type", String)
19
+ ], FirebaseEnvironment.prototype, "firebaseProjectId", void 0);
20
+ tslib_1.__decorate([
21
+ environment_1.environmentVariable.string('ROOT_TEMPLATE_REPO_URL'),
22
+ tslib_1.__metadata("design:type", String)
23
+ ], FirebaseEnvironment.prototype, "rootTemplateRepoUrl", void 0);
24
+ exports.FirebaseEnvironment = FirebaseEnvironment;
25
+ //# sourceMappingURL=environment.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.generated.js","sourceRoot":"","sources":["../../src/config/environment.generated.ts"],"names":[],"mappings":";;;;AAKA,2DAAgE;AAEhE,MAAa,mBAAmB;CAa/B;AAVG;IADC,iCAAmB,CAAC,MAAM,CAAC,uBAAuB,CAAC;;gEACvB;AAG7B;IADC,iCAAmB,CAAC,MAAM,CAAC,sBAAsB,CAAC;;+DACvB;AAG5B;IADC,iCAAmB,CAAC,MAAM,CAAC,qBAAqB,CAAC;;8DACvB;AAG3B;IADC,iCAAmB,CAAC,MAAM,CAAC,wBAAwB,CAAC;;gEACxB;AAZjC,kDAaC"}
@@ -0,0 +1,7 @@
1
+ export * from './environment.generated';
2
+ export interface IGoogleServiceAccount {
3
+ project_id: string;
4
+ private_key: string;
5
+ client_email: string;
6
+ }
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AAExC,MAAM,WAAW,qBAAqB;IAEpC,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./environment.generated"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './config';
2
+ export * from './ioc';
3
+ export * from './services';
4
+ export * from './validation';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./config"), exports);
5
+ tslib_1.__exportStar(require("./ioc"), exports);
6
+ tslib_1.__exportStar(require("./services"), exports);
7
+ tslib_1.__exportStar(require("./validation"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA,mDAAyB;AACzB,gDAAsB;AACtB,qDAA2B;AAC3B,uDAA6B"}
@@ -0,0 +1,3 @@
1
+ export * from './register';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ioc/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./register"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ioc/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,kDAAwB"}
@@ -0,0 +1,8 @@
1
+ import { TemplateServiceIoC } from '@rocketmakers/orbit-template-service';
2
+ import { IContainer } from '@rocketmakers/ioc';
3
+ import { ICoreContainerTypes } from '@rocketmakers/orbit-core';
4
+ import { IServicesContainerTypes } from './types';
5
+ declare type ServiceName = 'firebase';
6
+ export declare function registerFirebaseIoC(container: IContainer<ICoreContainerTypes>): Promise<IContainer<IServicesContainerTypes & TemplateServiceIoC<ServiceName>>>;
7
+ export {};
8
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/ioc/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAGtG,OAAO,EAAE,UAAU,EAAY,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIlD,aAAK,WAAW,GAAG,UAAU,CAAC;AAqC9B,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,UAAU,CAAC,mBAAmB,CAAC,GACzC,OAAO,CAAC,UAAU,CAAC,uBAAuB,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CA4BhF"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerFirebaseIoC = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const orbit_template_service_1 = require("@rocketmakers/orbit-template-service");
6
+ const orbit_template_http_repository_1 = require("@rocketmakers/orbit-template-http-repository");
7
+ const environment_1 = require("@rocketmakers/environment");
8
+ const ioc_1 = require("@rocketmakers/ioc");
9
+ const services_1 = require("../services");
10
+ const config_1 = require("../config");
11
+ function registerFirebaseIoC(container) {
12
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
+ const env = yield (0, environment_1.readFromEnvironment)(config_1.FirebaseEnvironment);
14
+ const serviceName = 'firebase';
15
+ const templateRepoContainer = yield (0, orbit_template_http_repository_1.registerTemplateRepositoryIoC)(serviceName, container);
16
+ const templateServicesContainer = (0, orbit_template_service_1.registerTemplateServiceIoC)(serviceName, templateRepoContainer);
17
+ const { firebaseClientEmail, firebasePrivateKey, firebaseProjectId } = env;
18
+ return (0, ioc_1.register)({
19
+ firebaseNotifyConfig: builder => builder.constant({
20
+ client_email: firebaseClientEmail,
21
+ private_key: firebasePrivateKey,
22
+ project_id: firebaseProjectId,
23
+ }),
24
+ firebaseService: builder => builder
25
+ .class(services_1.FirebaseService, ['firebaseTemplateService', 'firebaseNotifyConfig', 'logger'])
26
+ .inSingletonScope(),
27
+ }, templateServicesContainer);
28
+ });
29
+ }
30
+ exports.registerFirebaseIoC = registerFirebaseIoC;
31
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/ioc/register.ts"],"names":[],"mappings":";;;;AAAA,iFAAsG;AACtG,iGAA6F;AAC7F,2DAAgE;AAChE,2CAAyD;AAGzD,0CAA8C;AAC9C,sCAAgD;AAuChD,SAAsB,mBAAmB,CACvC,SAA0C;;QAE1C,MAAM,GAAG,GAAG,MAAM,IAAA,iCAAmB,EAAC,4BAAmB,CAAC,CAAC;QAE3D,MAAM,WAAW,GAAgB,UAAU,CAAC;QAE5C,MAAM,qBAAqB,GAAG,MAAM,IAAA,8DAA6B,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAG1F,MAAM,yBAAyB,GAAG,IAAA,mDAA0B,EAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;QAEjG,MAAM,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,GAAG,CAAC;QAE3E,OAAO,IAAA,cAAQ,EACb;YACE,oBAAoB,EAAE,OAAO,CAAC,EAAE,CAC9B,OAAO,CAAC,QAAQ,CAAC;gBACf,YAAY,EAAE,mBAAmB;gBACjC,WAAW,EAAE,kBAAkB;gBAC/B,UAAU,EAAE,iBAAiB;aAC9B,CAAC;YAEJ,eAAe,EAAE,OAAO,CAAC,EAAE,CACzB,OAAO;iBACJ,KAAK,CAAC,0BAAe,EAAE,CAAC,yBAAyB,EAAE,sBAAsB,EAAE,QAAQ,CAAC,CAAC;iBACrF,gBAAgB,EAAE;SACxB,EACD,yBAAyB,CAC1B,CAAC;IACJ,CAAC;CAAA;AA9BD,kDA8BC"}
@@ -0,0 +1,7 @@
1
+ import { FirebaseService } from '../services';
2
+ import { IGoogleServiceAccount } from '..';
3
+ export interface IServicesContainerTypes {
4
+ firebaseNotifyConfig: IGoogleServiceAccount;
5
+ firebaseService: FirebaseService;
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ioc/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAE3C,MAAM,WAAW,uBAAuB;IAEtC,oBAAoB,EAAE,qBAAqB,CAAC;IAG5C,eAAe,EAAE,eAAe,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ioc/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ /// <reference types="bunyan" />
2
+ import { Logger } from '@rocketmakers/log';
3
+ import { IOrbitResponse } from '@rocketmakers/orbit-core';
4
+ import { ITemplateNotFound, ILayoutNotFound } from '@rocketmakers/orbit-template-core';
5
+ import { TemplateService } from '@rocketmakers/orbit-template-service';
6
+ import { IGoogleServiceAccount } from '..';
7
+ export declare namespace FirebaseServiceParams {
8
+ interface ISendNotification<TPayloadData> {
9
+ firebaseDeviceToken: string;
10
+ layoutId: string;
11
+ templateName: string;
12
+ payload: IFirebasePayload<TPayloadData>;
13
+ }
14
+ }
15
+ export interface IFirebasePayload<TPayloadData> {
16
+ data: TPayloadData;
17
+ title?: string;
18
+ imageUrl?: string;
19
+ }
20
+ export interface IFirebaseService {
21
+ sendNotification<TPayloadData>(params: FirebaseServiceParams.ISendNotification<TPayloadData>): IOrbitResponse<boolean, ITemplateNotFound | ILayoutNotFound>;
22
+ }
23
+ export declare class FirebaseService implements IFirebaseService {
24
+ private templateService;
25
+ private serviceAccount;
26
+ private logger;
27
+ private isTestInstance;
28
+ private app;
29
+ constructor(templateService: TemplateService, serviceAccount: IGoogleServiceAccount, logger: Logger, isTestInstance?: boolean);
30
+ sendNotification<TPayloadData>(params: FirebaseServiceParams.ISendNotification<TPayloadData>): IOrbitResponse<boolean, ITemplateNotFound | ILayoutNotFound>;
31
+ }
32
+ //# sourceMappingURL=firebaseService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebaseService.d.ts","sourceRoot":"","sources":["../../src/services/firebaseService.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAwC,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAY,iBAAiB,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAc,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAEvD,yBAAiB,qBAAqB,CAAC;IACrC,UAAiB,iBAAiB,CAAC,YAAY;QAC7C,mBAAmB,EAAE,MAAM,CAAC;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAA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