@rocketmakers/orbit-notify-firebase 2.0.0-beta.3 → 2.0.0-beta.6

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 (82) hide show
  1. package/README.md +8 -7
  2. package/lib/_tests_/manualTest/index.test.d.ts.map +1 -1
  3. package/lib/_tests_/manualTest/index.test.js +1 -1
  4. package/lib/_tests_/manualTest/index.test.js.map +1 -1
  5. package/lib/_tests_/manualTest/sendNotification.d.ts.map +1 -1
  6. package/lib/_tests_/manualTest/sendNotification.js +2 -2
  7. package/lib/_tests_/manualTest/sendNotification.js.map +1 -1
  8. package/lib/_tests_/manualTest/serviceInstance.d.ts +3 -3
  9. package/lib/_tests_/manualTest/serviceInstance.d.ts.map +1 -1
  10. package/lib/_tests_/manualTest/serviceInstance.js +7 -6
  11. package/lib/_tests_/manualTest/serviceInstance.js.map +1 -1
  12. package/lib/_tests_/unit/validation/index.test.d.ts.map +1 -1
  13. package/lib/_tests_/unit/validation/index.test.js +1 -1
  14. package/lib/_tests_/unit/validation/index.test.js.map +1 -1
  15. package/lib/_tests_/unit/validation/mockedService.d.ts +1 -1
  16. package/lib/_tests_/unit/validation/mockedService.d.ts.map +1 -1
  17. package/lib/_tests_/unit/validation/mockedService.js +3 -3
  18. package/lib/_tests_/unit/validation/mockedService.js.map +1 -1
  19. package/lib/_tests_/unit/validation/sendNotification.d.ts.map +1 -1
  20. package/lib/_tests_/unit/validation/sendNotification.js +4 -4
  21. package/lib/_tests_/unit/validation/sendNotification.js.map +1 -1
  22. package/lib/{src/config → config}/environment.generated.d.ts +1 -1
  23. package/lib/config/environment.generated.d.ts.map +1 -0
  24. package/lib/{src/config → config}/environment.generated.js +8 -11
  25. package/lib/config/environment.generated.js.map +1 -0
  26. package/lib/{src/config → config}/index.d.ts +0 -0
  27. package/lib/config/index.d.ts.map +1 -0
  28. package/lib/{src/config → config}/index.js +0 -0
  29. package/lib/config/index.js.map +1 -0
  30. package/lib/{src/index.d.ts → index.d.ts} +0 -0
  31. package/lib/index.d.ts.map +1 -0
  32. package/lib/{src/index.js → index.js} +0 -0
  33. package/lib/index.js.map +1 -0
  34. package/lib/{src/ioc → ioc}/index.d.ts +0 -0
  35. package/lib/ioc/index.d.ts.map +1 -0
  36. package/lib/{src/ioc → ioc}/index.js +0 -0
  37. package/lib/ioc/index.js.map +1 -0
  38. package/lib/ioc/register.d.ts +8 -0
  39. package/lib/ioc/register.d.ts.map +1 -0
  40. package/lib/ioc/register.js +31 -0
  41. package/lib/ioc/register.js.map +1 -0
  42. package/lib/{src/ioc → ioc}/types.d.ts +0 -3
  43. package/lib/ioc/types.d.ts.map +1 -0
  44. package/lib/{src/ioc → ioc}/types.js +0 -0
  45. package/lib/{src/ioc → ioc}/types.js.map +1 -1
  46. package/lib/{src/services → services}/firebaseService.d.ts +4 -2
  47. package/lib/services/firebaseService.d.ts.map +1 -0
  48. package/lib/{src/services → services}/firebaseService.js +14 -5
  49. package/lib/services/firebaseService.js.map +1 -0
  50. package/lib/{src/services → services}/index.d.ts +0 -0
  51. package/lib/services/index.d.ts.map +1 -0
  52. package/lib/{src/services → services}/index.js +0 -0
  53. package/lib/services/index.js.map +1 -0
  54. package/lib/tsconfig.tsbuildinfo +1 -13274
  55. package/lib/{src/validation → validation}/index.d.ts +1 -1
  56. package/lib/validation/index.d.ts.map +1 -0
  57. package/lib/{src/validation → validation}/index.js +4 -4
  58. package/lib/validation/index.js.map +1 -0
  59. package/package.json +17 -18
  60. package/lib/src/config/environment.generated.d.ts.map +0 -1
  61. package/lib/src/config/environment.generated.js.map +0 -1
  62. package/lib/src/config/index.d.ts.map +0 -1
  63. package/lib/src/config/index.js.map +0 -1
  64. package/lib/src/index.d.ts.map +0 -1
  65. package/lib/src/index.js.map +0 -1
  66. package/lib/src/ioc/container.d.ts +0 -13
  67. package/lib/src/ioc/container.d.ts.map +0 -1
  68. package/lib/src/ioc/container.js +0 -7
  69. package/lib/src/ioc/container.js.map +0 -1
  70. package/lib/src/ioc/index.d.ts.map +0 -1
  71. package/lib/src/ioc/index.js.map +0 -1
  72. package/lib/src/ioc/register.d.ts +0 -3
  73. package/lib/src/ioc/register.d.ts.map +0 -1
  74. package/lib/src/ioc/register.js +0 -27
  75. package/lib/src/ioc/register.js.map +0 -1
  76. package/lib/src/ioc/types.d.ts.map +0 -1
  77. package/lib/src/services/firebaseService.d.ts.map +0 -1
  78. package/lib/src/services/firebaseService.js.map +0 -1
  79. package/lib/src/services/index.d.ts.map +0 -1
  80. package/lib/src/services/index.js.map +0 -1
  81. package/lib/src/validation/index.d.ts.map +0 -1
  82. package/lib/src/validation/index.js.map +0 -1
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Exposes a service class that manages sending firebase push notifications.
4
4
 
5
+ ### Environment config
6
+
7
+ Once installed as a dependency, any env vars required by this package will be listed as properties of the `@rocketmakers/environment` generated class found at `node_modules/@rocketmakers/orbit-notify-firebase/lib/config/environment.generated.d.ts`.
8
+
5
9
  ### Implementation
6
10
 
7
11
  When using `@rocketmakers/orbit-notify-firebase` there are two options to register service classes with your ioc framework.
@@ -16,15 +20,12 @@ You can bootstrap notify-firebase service classes using the exposed `registerFir
16
20
 
17
21
  ```typescript
18
22
  // Register core types and services from @rocketmakers/orbit-core
19
- registerCoreIoC();
23
+ const coreContainer = registerCoreIoC(logger);
20
24
 
21
25
  // Register anonymous notification template repository, template service and firebase service
22
- registerFirebaseIoC({
23
- firebaseClientEmail,
24
- firebasePrivateKey,
25
- firebaseProjectId,
26
- rootTemplateRepoUrl,
27
- });
26
+ const firebaseServiceContainer = await registerFirebaseIoC(coreContainer);
27
+
28
+ await firebaseServiceContainer.get('firebaseTemplateService').initCache();
28
29
  ```
29
30
 
30
31
  Details on template repository setup can be found in the `@rocketmakers/orbit-template-http-repository` documentation.
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../_tests_/manualTest/index.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/_tests_/manualTest/index.test.ts"],"names":[],"mappings":""}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const sendNotification_1 = require("./sendNotification");
4
4
  describe('FirebaseService - manual', () => {
5
- sendNotification_1.sendNotificationTests();
5
+ (0, sendNotification_1.sendNotificationTests)();
6
6
  });
7
7
  //# sourceMappingURL=index.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../_tests_/manualTest/index.test.ts"],"names":[],"mappings":";;AAAA,yDAA2D;AAE3D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,wCAAqB,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../_tests_/manualTest/sendNotification.ts"],"names":[],"mappings":"AAwDA,wBAAgB,qBAAqB,SAUpC"}
1
+ {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../src/_tests_/manualTest/sendNotification.ts"],"names":[],"mappings":"AAwDA,wBAAgB,qBAAqB,SAUpC"}
@@ -10,7 +10,7 @@ const orbit_core_1 = require("@rocketmakers/orbit-core");
10
10
  const serviceInstance_1 = require("./serviceInstance");
11
11
  function send() {
12
12
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
- const { firebaseService, templateService } = serviceInstance_1.getServiceInstance();
13
+ const { firebaseService, templateService } = (0, serviceInstance_1.getServiceInstance)();
14
14
  const layoutId = 'login';
15
15
  const payload = {
16
16
  name: 'product team',
@@ -43,7 +43,7 @@ function sendNotificationTests() {
43
43
  chai.use(chaiAsPromised);
44
44
  it('can send notification', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
45
45
  const res = yield send();
46
- chai_1.expect(res).to.eql(true);
46
+ (0, chai_1.expect)(res).to.eql(true);
47
47
  }));
48
48
  });
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../_tests_/manualTest/sendNotification.ts"],"names":[],"mappings":";;;;AAEA,6BAA6B;AAE7B,+BAA8B;AAC9B,mDAAmD;AACnD,gDAAgD;AAChD,yDAAgE;AAGhE,uDAAuD;AASvD,SAAe,IAAI;;QAIjB,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,oCAAkB,EAAE,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,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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,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAEzB,EAAE,CAAC,uBAAuB,EAAE,GAAS,EAAE;YACrC,MAAM,GAAG,GAAG,MAAM,IAAI,EAAE,CAAC;YAEzB,IAAA,aAAM,EAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAVD,sDAUC"}
@@ -1,8 +1,8 @@
1
- import { AnonHttpRepository } from '@rocketmakers/orbit-template-http-repository';
1
+ import { TemplateRepository } from '@rocketmakers/orbit-template-http-repository';
2
2
  import { TemplateService } from '@rocketmakers/orbit-template-service';
3
- import { FirebaseService } from '../../src';
3
+ import { FirebaseService } from '../..';
4
4
  export declare function getServiceInstance(): {
5
- templateRepo: AnonHttpRepository;
5
+ templateRepo: TemplateRepository;
6
6
  templateService: TemplateService;
7
7
  firebaseService: FirebaseService;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"serviceInstance.d.ts","sourceRoot":"","sources":["../../../_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAI5C,wBAAgB,kBAAkB;;;;EAoBjC"}
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,OAAO,CAAC;AAIxC,wBAAgB,kBAAkB;;;;EAwBjC"}
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getServiceInstance = void 0;
4
4
  const orbit_template_http_repository_1 = require("@rocketmakers/orbit-template-http-repository");
5
+ const orbit_core_1 = require("@rocketmakers/orbit-core");
5
6
  const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
6
7
  const orbit_template_service_1 = require("@rocketmakers/orbit-template-service");
7
- const src_1 = require("../../src");
8
- const logger = logger_1.createLogger('sendgrid-service-manual-test');
8
+ const __1 = require("../..");
9
+ const logger = (0, logger_1.createLogger)('sendgrid-service-manual-test');
9
10
  function getServiceInstance() {
10
11
  const templateGitlabUrl = process.env.TEMPLATES_URL;
11
12
  const serviceAccount = {
@@ -14,11 +15,11 @@ function getServiceInstance() {
14
15
  client_email: 'firebase-adminsdk-s5pgs@manual-tester.iam.gserviceaccount.com',
15
16
  };
16
17
  if (!templateGitlabUrl) {
17
- throw new Error('Template gitlab root url must be provided for manual testing through the env variable: TEMPLATES_URL');
18
+ throw new orbit_core_1.ConfigurationError('Template gitlab root url must be provided for manual testing through the env variable: TEMPLATES_URL');
18
19
  }
19
- const templateRepo = new orbit_template_http_repository_1.AnonHttpRepository(templateGitlabUrl, 'sendgrid', logger);
20
- const templateService = new orbit_template_service_1.TemplateService(templateRepo);
21
- const firebaseService = new src_1.FirebaseService(templateService, serviceAccount, logger);
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 __1.FirebaseService(templateService, serviceAccount, logger);
22
23
  return { templateRepo, templateService, firebaseService };
23
24
  }
24
25
  exports.getServiceInstance = getServiceInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"serviceInstance.js","sourceRoot":"","sources":["../../../_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":";;;AAAA,iGAAkF;AAClF,oEAAuE;AACvE,iFAAuE;AACvE,mCAA4C;AAE5C,MAAM,MAAM,GAAG,qBAAY,CAAC,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,KAAK,CACb,sGAAsG,CACvG,CAAC;KACH;IAED,MAAM,YAAY,GAAG,IAAI,mDAAkB,CAAC,iBAA2B,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC7F,MAAM,eAAe,GAAG,IAAI,wCAAe,CAAC,YAAY,CAAC,CAAC;IAC1D,MAAM,eAAe,GAAG,IAAI,qBAAe,CAAC,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACrF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC5D,CAAC;AApBD,gDAoBC"}
1
+ {"version":3,"file":"serviceInstance.js","sourceRoot":"","sources":["../../../src/_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":";;;AAAA,iGAAmG;AACnG,yDAA8D;AAC9D,oEAAuE;AAEvE,iFAAuE;AACvE,6BAAwC;AAExC,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,mBAAe,CAAC,eAAe,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACrF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAC5D,CAAC;AAxBD,gDAwBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../_tests_/unit/validation/index.test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/index.test.ts"],"names":[],"mappings":""}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const sendNotification_1 = require("./sendNotification");
4
4
  describe('FirebaseService - validation', () => {
5
- sendNotification_1.sendNotificationTests();
5
+ (0, sendNotification_1.sendNotificationTests)();
6
6
  });
7
7
  //# sourceMappingURL=index.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../_tests_/unit/validation/index.test.ts"],"names":[],"mappings":";;AAAA,yDAA2D;AAE3D,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,wCAAqB,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
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"}
@@ -2,7 +2,7 @@
2
2
  import * as TypeMoq from 'typemoq';
3
3
  import { TemplateService } from '@rocketmakers/orbit-template-service';
4
4
  import { Logger } from '@rocketmakers/shell-commands/lib/logger';
5
- import { FirebaseService, IGoogleServiceAccount } from '../../../src';
5
+ import { FirebaseService, IGoogleServiceAccount } from '../../..';
6
6
  export declare class MockedFirebaseService {
7
7
  mockedTemplateService: TypeMoq.IMock<TemplateService>;
8
8
  serviceAccount: IGoogleServiceAccount;
@@ -1 +1 @@
1
- {"version":3,"file":"mockedService.d.ts","sourceRoot":"","sources":["../../../../_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,cAAc,CAAC;AAEtE,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"}
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"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MockedFirebaseService = void 0;
4
4
  const TypeMoq = require("typemoq");
5
5
  const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
6
- const src_1 = require("../../../src");
6
+ const __1 = require("../../..");
7
7
  class MockedFirebaseService {
8
8
  constructor() {
9
9
  this.mockedTemplateService = TypeMoq.Mock.ofType();
@@ -12,8 +12,8 @@ class MockedFirebaseService {
12
12
  private_key: 'my-super-cool-key',
13
13
  client_email: 'firebase-adminsdk-s5pgs@manual-tester.iam.gserviceaccount.com',
14
14
  };
15
- this.logger = logger_1.createLogger('firebase-service-tests');
16
- this.service = new src_1.FirebaseService(this.mockedTemplateService.object, this.serviceAccount, this.logger);
15
+ this.logger = (0, logger_1.createLogger)('firebase-service-tests');
16
+ this.service = new __1.FirebaseService(this.mockedTemplateService.object, this.serviceAccount, this.logger);
17
17
  }
18
18
  }
19
19
  exports.MockedFirebaseService = MockedFirebaseService;
@@ -1 +1 @@
1
- {"version":3,"file":"mockedService.js","sourceRoot":"","sources":["../../../../_tests_/unit/validation/mockedService.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AAEnC,oEAA+E;AAC/E,sCAAsE;AAEtE,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,qBAAY,CAAC,wBAAwB,CAAC,CAAC;QAErD,IAAI,CAAC,OAAO,GAAG,IAAI,qBAAe,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1G,CAAC;CACF;AApBD,sDAoBC"}
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,CAAC,CAAC;IAC1G,CAAC;CACF;AApBD,sDAoBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../../_tests_/unit/validation/sendNotification.ts"],"names":[],"mappings":"AAWA,wBAAgB,qBAAqB,SA0CpC"}
1
+ {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/sendNotification.ts"],"names":[],"mappings":"AAWA,wBAAgB,qBAAqB,SA0CpC"}
@@ -22,16 +22,16 @@ function sendNotificationTests() {
22
22
  orbit_testing_core_1.invalidValues.forEach((val) => tslib_1.__awaiter(this, void 0, void 0, function* () {
23
23
  const { mock, firebaseDeviceToken, layoutId, templateName, payload } = setupBaseValidMock();
24
24
  it(`throws validation error when '${val}' is provided as deviceToken`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
25
- chai_1.expect(mock.service.sendNotification({ firebaseDeviceToken: val, layoutId, templateName, payload })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
25
+ (0, chai_1.expect)(mock.service.sendNotification({ firebaseDeviceToken: val, layoutId, templateName, payload })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
26
26
  }));
27
27
  it(`throws validation error when '${val}' is provided as layout id`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
28
- chai_1.expect(mock.service.sendNotification({ firebaseDeviceToken, layoutId: val, templateName, payload })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
28
+ (0, chai_1.expect)(mock.service.sendNotification({ firebaseDeviceToken, layoutId: val, templateName, payload })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
29
29
  }));
30
30
  it(`throws validation error when '${val}' is provided as template name`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
31
- chai_1.expect(mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName: val, payload })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
31
+ (0, chai_1.expect)(mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName: val, payload })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
32
32
  }));
33
33
  it(`throws validation error when '${val}' is provided as payload`, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
34
- chai_1.expect(mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName, payload: val })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
34
+ (0, chai_1.expect)(mock.service.sendNotification({ firebaseDeviceToken, layoutId, templateName, payload: val })).to.eventually.be.rejectedWith(orbit_core_1.ValidationError);
35
35
  }));
36
36
  }));
37
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"sendNotification.js","sourceRoot":"","sources":["../../../../_tests_/unit/validation/sendNotification.ts"],"names":[],"mappings":";;;;AAEA,6BAA6B;AAE7B,+BAA8B;AAC9B,mDAAmD;AACnD,yEAAiE;AAEjE,yDAA2D;AAC3D,mDAAwD;AAExD,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AC,CAAA,CAAC,CAAC;YAEH,EAAE,CAAC,iCAAiC,GAAG,0BAA0B,EAAE,GAAS,EAAE;gBAC5E,IAAA,aAAM,EACJ,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAC7F,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,YAAY,CAAC,4BAAe,CAAC,CAAC;YACnD,CAAC,CAAA,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA1CD,sDA0CC"}
@@ -1,4 +1,4 @@
1
- export declare class DefaultEnvironment {
1
+ export declare class FirebaseEnvironment {
2
2
  firebaseClientEmail: string;
3
3
  firebasePrivateKey: string;
4
4
  firebaseProjectId: string;
@@ -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"}
@@ -1,28 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultEnvironment = void 0;
3
+ exports.FirebaseEnvironment = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const environment_1 = require("@rocketmakers/environment");
6
- let DefaultEnvironment = class DefaultEnvironment {
7
- };
6
+ class FirebaseEnvironment {
7
+ }
8
8
  tslib_1.__decorate([
9
9
  environment_1.environmentVariable.string('FIREBASE_CLIENT_EMAIL'),
10
10
  tslib_1.__metadata("design:type", String)
11
- ], DefaultEnvironment.prototype, "firebaseClientEmail", void 0);
11
+ ], FirebaseEnvironment.prototype, "firebaseClientEmail", void 0);
12
12
  tslib_1.__decorate([
13
13
  environment_1.environmentVariable.string('FIREBASE_PRIVATE_KEY'),
14
14
  tslib_1.__metadata("design:type", String)
15
- ], DefaultEnvironment.prototype, "firebasePrivateKey", void 0);
15
+ ], FirebaseEnvironment.prototype, "firebasePrivateKey", void 0);
16
16
  tslib_1.__decorate([
17
17
  environment_1.environmentVariable.string('FIREBASE_PROJECT_ID'),
18
18
  tslib_1.__metadata("design:type", String)
19
- ], DefaultEnvironment.prototype, "firebaseProjectId", void 0);
19
+ ], FirebaseEnvironment.prototype, "firebaseProjectId", void 0);
20
20
  tslib_1.__decorate([
21
21
  environment_1.environmentVariable.string('ROOT_TEMPLATE_REPO_URL'),
22
22
  tslib_1.__metadata("design:type", String)
23
- ], DefaultEnvironment.prototype, "rootTemplateRepoUrl", void 0);
24
- DefaultEnvironment = tslib_1.__decorate([
25
- environment_1.environmentVariable.namespace('DEFAULT')
26
- ], DefaultEnvironment);
27
- exports.DefaultEnvironment = DefaultEnvironment;
23
+ ], FirebaseEnvironment.prototype, "rootTemplateRepoUrl", void 0);
24
+ exports.FirebaseEnvironment = FirebaseEnvironment;
28
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"}
File without changes
@@ -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"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC"}
File without changes
@@ -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"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAIA,mDAAyB;AACzB,gDAAsB;AACtB,qDAA2B;AAC3B,uDAA6B"}
File without changes
@@ -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"}
File without changes
@@ -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;AAE9B,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;AAIhD,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"}
@@ -1,10 +1,7 @@
1
- /// <reference types="bunyan" />
2
- import { Logger } from '@rocketmakers/log';
3
1
  import { FirebaseService } from '../services';
4
2
  import { IGoogleServiceAccount } from '..';
5
3
  export interface IServicesContainerTypes {
6
4
  firebaseNotifyConfig: IGoogleServiceAccount;
7
- logger: Logger;
8
5
  firebaseService: FirebaseService;
9
6
  }
10
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"}
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ioc/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ioc/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,7 @@
1
1
  /// <reference types="bunyan" />
2
2
  import { Logger } from '@rocketmakers/log';
3
+ import { IOrbitResponse } from '@rocketmakers/orbit-core';
4
+ import { ITemplateNotFound, ILayoutNotFound } from '@rocketmakers/orbit-template-core';
3
5
  import { TemplateService } from '@rocketmakers/orbit-template-service';
4
6
  import { IGoogleServiceAccount } from '..';
5
7
  export declare namespace FirebaseServiceParams {
@@ -16,7 +18,7 @@ export interface IFirebasePayload<TPayloadData> {
16
18
  imageUrl?: string;
17
19
  }
18
20
  export interface IFirebaseService {
19
- sendNotification<TPayloadData>(params: FirebaseServiceParams.ISendNotification<TPayloadData>): Promise<boolean>;
21
+ sendNotification<TPayloadData>(params: FirebaseServiceParams.ISendNotification<TPayloadData>): IOrbitResponse<boolean, ITemplateNotFound | ILayoutNotFound>;
20
22
  }
21
23
  export declare class FirebaseService implements IFirebaseService {
22
24
  private templateService;
@@ -24,6 +26,6 @@ export declare class FirebaseService implements IFirebaseService {
24
26
  private logger;
25
27
  private app;
26
28
  constructor(templateService: TemplateService, serviceAccount: IGoogleServiceAccount, logger: Logger);
27
- sendNotification<TPayloadData>(params: FirebaseServiceParams.ISendNotification<TPayloadData>): Promise<boolean>;
29
+ sendNotification<TPayloadData>(params: FirebaseServiceParams.ISendNotification<TPayloadData>): IOrbitResponse<boolean, ITemplateNotFound | ILayoutNotFound>;
28
30
  }
29
31
  //# 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,CAAC;KACzC;CACF;AAED,MAAM,WAAW,gBAAgB,CAAC,YAAY;IAC5C,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAM/B,gBAAgB,CAAC,YAAY,EAC3B,MAAM,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAC5D,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CAAC,CAAC;CACjE;AAED,qBAAa,eAAgB,YAAW,gBAAgB;IAIpD,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,GAAG,CAAwB;gBAGzB,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,qBAAqB,EACrC,MAAM,EAAE,MAAM;IAiBX,gBAAgB,CAAC,YAAY,EACxC,MAAM,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAC5D,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,eAAe,CAAC;CAiFhE"}
@@ -22,11 +22,14 @@ class FirebaseService {
22
22
  var _a;
23
23
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
24
  const { firebaseDeviceToken, layoutId, templateName, payload } = params;
25
- const { validatedDeviceToken, validatedLayoutId, validatedTemplateName, validatedPayload, } = yield __1.Validation.sendNotification(firebaseDeviceToken, layoutId, templateName, payload);
26
- const layouts = yield this.templateService.renderLayoutTemplates(validatedLayoutId, validatedPayload.data);
27
- const txtNotification = (_a = layouts.find(layout => layout.name === validatedTemplateName)) === null || _a === void 0 ? void 0 : _a.compiled;
25
+ const { validatedDeviceToken, validatedLayoutId, validatedTemplateName, validatedPayload } = yield __1.Validation.sendNotification(firebaseDeviceToken, layoutId, templateName, payload);
26
+ const templatesResponse = yield this.templateService.renderLayoutTemplates(validatedLayoutId, validatedPayload.data);
27
+ if (templatesResponse.kind !== 'ok') {
28
+ return templatesResponse;
29
+ }
30
+ const txtNotification = (_a = templatesResponse.result.find(template => template.name === validatedTemplateName)) === null || _a === void 0 ? void 0 : _a.compiled;
28
31
  if (!txtNotification) {
29
- throw new orbit_core_1.NotFoundError(`Failed to find Firebase txt template for layout: ${layoutId}`);
32
+ return (0, orbit_core_1.buildNotFoundResponse)('Template', this.logger, `Failed to find Firebase txt template for layout: ${layoutId}`);
30
33
  }
31
34
  const notification = {
32
35
  title: validatedPayload.title,
@@ -64,7 +67,7 @@ class FirebaseService {
64
67
  if (errors && errors.length > 0) {
65
68
  throw new Error(JSON.stringify(errors));
66
69
  }
67
- return true;
70
+ return { kind: 'ok', result: true };
68
71
  }
69
72
  finally {
70
73
  if (firebaseMessaging) {
@@ -74,5 +77,11 @@ class FirebaseService {
74
77
  });
75
78
  }
76
79
  }
80
+ tslib_1.__decorate([
81
+ orbit_core_1.ensureNoError,
82
+ tslib_1.__metadata("design:type", Function),
83
+ tslib_1.__metadata("design:paramtypes", [Object]),
84
+ tslib_1.__metadata("design:returntype", Object)
85
+ ], FirebaseService.prototype, "sendNotification", null);
77
86
  exports.FirebaseService = FirebaseService;
78
87
  //# sourceMappingURL=firebaseService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebaseService.js","sourceRoot":"","sources":["../../src/services/firebaseService.ts"],"names":[],"mappings":";;;;AAEA,yDAAgG;AAGhG,gDAAgD;AAChD,0BAAuD;AA4BvD,MAAa,eAAe;IAG1B,YACU,eAAgC,EAChC,cAAqC,EACrC,MAAc;QAFd,oBAAe,GAAf,eAAe,CAAiB;QAChC,mBAAc,GAAd,cAAc,CAAuB;QACrC,WAAM,GAAN,MAAM,CAAQ;QAEtB,IAAI,CAAC,GAAG,GAAG,aAAa,CAAC,aAAa,CAAC;YACrC,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC;gBACxC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,YAAY;gBAC7C,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,WAAW;gBAC3C,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,UAAU;aAC1C,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAQY,gBAAgB,CAC3B,MAA6D;;;YAE7D,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;YACxE,MAAM,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,GACxF,MAAM,cAAU,CAAC,gBAAgB,CAAe,mBAAmB,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AAC,IAAI,CAAC,EAAE;wBACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBAErC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;4BACrB,IACE,QAAQ,CAAC,KAAK;gCACd,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,sCAAsC;oCAC7D,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,6CAA6C;oCACrE,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,iCAAiC,CAAC,EAC5D;gCACA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;6BAClD;4BAED,MAAM,CAAC,IAAI,CAAC,GAAG,oBAAoB,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;yBAC3E;qBACF;iBACF;gBAGD,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC/B,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;iBACzC;gBAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;aACrC;oBAAS;gBAER,IAAI,iBAAiB,EAAE;oBACrB,MAAM,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;iBACtC;aACF;;KACF;CACF;AAnFC;IADC,0BAAa;;;;uDAmFb;AAzGH,0CA0GC"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC"}