@rocketmakers/orbit-notify-firebase 2.0.5 → 3.0.0

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 (64) hide show
  1. package/README.md +2 -2
  2. package/lib/config/environment.generated.js +5 -1
  3. package/lib/config/environment.generated.js.map +1 -1
  4. package/lib/ioc/register.d.ts +2 -2
  5. package/lib/ioc/register.d.ts.map +1 -1
  6. package/lib/ioc/register.js +18 -22
  7. package/lib/ioc/register.js.map +1 -1
  8. package/lib/ioc/types.d.ts +1 -1
  9. package/lib/ioc/types.d.ts.map +1 -1
  10. package/lib/services/firebaseService.d.ts +2 -18
  11. package/lib/services/firebaseService.d.ts.map +1 -1
  12. package/lib/services/firebaseService.js +51 -57
  13. package/lib/services/firebaseService.js.map +1 -1
  14. package/lib/services/index.d.ts +1 -0
  15. package/lib/services/index.d.ts.map +1 -1
  16. package/lib/services/index.js +1 -0
  17. package/lib/services/index.js.map +1 -1
  18. package/lib/services/types.d.ts +19 -0
  19. package/lib/services/types.d.ts.map +1 -0
  20. package/lib/services/types.js +3 -0
  21. package/lib/services/types.js.map +1 -0
  22. package/lib/validation/index.d.ts +1 -1
  23. package/lib/validation/index.d.ts.map +1 -1
  24. package/lib/validation/index.js +12 -15
  25. package/lib/validation/index.js.map +1 -1
  26. package/package.json +33 -36
  27. package/lib/_tests_/manualTest/index.test.d.ts +0 -2
  28. package/lib/_tests_/manualTest/index.test.d.ts.map +0 -1
  29. package/lib/_tests_/manualTest/index.test.js +0 -7
  30. package/lib/_tests_/manualTest/index.test.js.map +0 -1
  31. package/lib/_tests_/manualTest/sendNotification.d.ts +0 -2
  32. package/lib/_tests_/manualTest/sendNotification.d.ts.map +0 -1
  33. package/lib/_tests_/manualTest/sendNotification.js +0 -47
  34. package/lib/_tests_/manualTest/sendNotification.js.map +0 -1
  35. package/lib/_tests_/manualTest/serviceInstance.d.ts +0 -9
  36. package/lib/_tests_/manualTest/serviceInstance.d.ts.map +0 -1
  37. package/lib/_tests_/manualTest/serviceInstance.js +0 -26
  38. package/lib/_tests_/manualTest/serviceInstance.js.map +0 -1
  39. package/lib/_tests_/unit/validation/index.test.d.ts +0 -2
  40. package/lib/_tests_/unit/validation/index.test.d.ts.map +0 -1
  41. package/lib/_tests_/unit/validation/index.test.js +0 -7
  42. package/lib/_tests_/unit/validation/index.test.js.map +0 -1
  43. package/lib/_tests_/unit/validation/mockedService.d.ts +0 -13
  44. package/lib/_tests_/unit/validation/mockedService.d.ts.map +0 -1
  45. package/lib/_tests_/unit/validation/mockedService.js +0 -20
  46. package/lib/_tests_/unit/validation/mockedService.js.map +0 -1
  47. package/lib/_tests_/unit/validation/sendNotification.d.ts +0 -2
  48. package/lib/_tests_/unit/validation/sendNotification.d.ts.map +0 -1
  49. package/lib/_tests_/unit/validation/sendNotification.js +0 -39
  50. package/lib/_tests_/unit/validation/sendNotification.js.map +0 -1
  51. package/lib/_tests_/validation/index.test.d.ts +0 -2
  52. package/lib/_tests_/validation/index.test.d.ts.map +0 -1
  53. package/lib/_tests_/validation/index.test.js +0 -7
  54. package/lib/_tests_/validation/index.test.js.map +0 -1
  55. package/lib/_tests_/validation/mockedService.d.ts +0 -14
  56. package/lib/_tests_/validation/mockedService.d.ts.map +0 -1
  57. package/lib/_tests_/validation/mockedService.js +0 -20
  58. package/lib/_tests_/validation/mockedService.js.map +0 -1
  59. package/lib/_tests_/validation/sendNotification.d.ts +0 -2
  60. package/lib/_tests_/validation/sendNotification.d.ts.map +0 -1
  61. package/lib/_tests_/validation/sendNotification.js +0 -39
  62. package/lib/_tests_/validation/sendNotification.js.map +0 -1
  63. package/lib/environment.json +0 -11
  64. package/lib/tsconfig.tsbuildinfo +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceInstance.d.ts","sourceRoot":"","sources":["../../../src/_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AACnG,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjD,wBAAgB,kBAAkB;;;;EAwBjC"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getServiceInstance = void 0;
4
- const orbit_core_1 = require("@rocketmakers/orbit-core");
5
- const orbit_template_http_repository_1 = require("@rocketmakers/orbit-template-http-repository");
6
- const orbit_template_service_1 = require("@rocketmakers/orbit-template-service");
7
- const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
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+sYLW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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
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceInstance.js","sourceRoot":"","sources":["../../../src/_tests_/manualTest/serviceInstance.ts"],"names":[],"mappings":";;;AAAA,yDAA8D;AAE9D,iGAAmG;AACnG,iFAAuE;AACvE,oEAAuE;AAEvE,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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/index.test.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
1
- /// <reference types="bunyan" />
2
- import { TemplateService } from '@rocketmakers/orbit-template-service';
3
- import { Logger } from '@rocketmakers/shell-commands/lib/logger';
4
- import * as TypeMoq from 'typemoq';
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockedService.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/mockedService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAgB,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,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"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MockedFirebaseService = void 0;
4
- const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
5
- const TypeMoq = require("typemoq");
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockedService.js","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/mockedService.ts"],"names":[],"mappings":";;;AACA,oEAA+E;AAC/E,mCAAmC;AAEnC,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"}
@@ -1,2 +0,0 @@
1
- export declare function sendNotificationTests(): void;
2
- //# sourceMappingURL=sendNotification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../../src/_tests_/unit/validation/sendNotification.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,SAoCpC"}
@@ -1,39 +0,0 @@
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).toBe('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).toBe('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).toBe('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).toBe('ValidationError');
34
- }));
35
- }));
36
- });
37
- }
38
- exports.sendNotificationTests = sendNotificationTests;
39
- //# sourceMappingURL=sendNotification.js.map
@@ -1 +0,0 @@
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,GAAG,kBAAkB,EAAE,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,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC3C,CAAC,CAAA,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,sDAoCC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/_tests_/validation/index.test.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,14 +0,0 @@
1
- /// <reference types="bunyan" />
2
- import { TemplateService } from '@rocketmakers/orbit-template-service';
3
- import { Logger } from '@rocketmakers/shell-commands/lib/logger';
4
- import * as TypeMoq from 'typemoq';
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockedService.d.ts","sourceRoot":"","sources":["../../../src/_tests_/validation/mockedService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAgB,MAAM,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,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"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MockedFirebaseService = void 0;
4
- const logger_1 = require("@rocketmakers/shell-commands/lib/logger");
5
- const TypeMoq = require("typemoq");
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockedService.js","sourceRoot":"","sources":["../../../src/_tests_/validation/mockedService.ts"],"names":[],"mappings":";;;AACA,oEAA+E;AAC/E,mCAAmC;AAGnC,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"}
@@ -1,2 +0,0 @@
1
- export declare function sendNotificationTests(): void;
2
- //# sourceMappingURL=sendNotification.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sendNotification.d.ts","sourceRoot":"","sources":["../../../src/_tests_/validation/sendNotification.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,SAoCpC"}
@@ -1,39 +0,0 @@
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).toBe('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).toBe('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).toBe('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).toBe('ValidationError');
34
- }));
35
- }));
36
- });
37
- }
38
- exports.sendNotificationTests = sendNotificationTests;
39
- //# sourceMappingURL=sendNotification.js.map
@@ -1 +0,0 @@
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,CAAC,OAAO,CAAC,CAAM,GAAG,EAAC,EAAE;YAChC,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG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AAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC3C,CAAC,CAAA,CAAC,CAAC;QACL,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AApCD,sDAoCC"}
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "./node_modules/@rocketmakers/environment/schema/environment-schema.json",
3
- "version": 1,
4
- "name": "Firebase",
5
- "variables": [
6
- { "kind": "string", "name": "FIREBASE_PROJECT_ID", "optional": false, "secret": true },
7
- { "kind": "string", "name": "FIREBASE_PRIVATE_KEY", "optional": false, "secret": true },
8
- { "kind": "string", "name": "FIREBASE_CLIENT_EMAIL", "optional": false, "secret": true },
9
- { "kind": "string", "name": "ROOT_TEMPLATE_REPO_URL", "optional": false }
10
- ]
11
- }