@dereekb/firebase-server 11.0.6 → 11.0.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [11.0.8](https://github.com/dereekb/dbx-components/compare/v11.0.7-dev...v11.0.8) (2024-11-23)
6
+
7
+
8
+
9
+ ## [11.0.7](https://github.com/dereekb/dbx-components/compare/v11.0.6-dev...v11.0.7) (2024-11-22)
10
+
11
+
12
+
5
13
  ## [11.0.6](https://github.com/dereekb/dbx-components/compare/v11.0.5-dev...v11.0.6) (2024-11-20)
6
14
 
7
15
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/mailgun",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/test",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }
@@ -0,0 +1,21 @@
1
+ import { JestExpectFailAssertionFunction } from '@dereekb/util/test';
2
+ import { HttpsError } from 'firebase-functions/v1/https';
3
+ import { BaseError } from 'make-error';
4
+ /**
5
+ * Error thrown when the error type was different than the expected type.
6
+ */
7
+ export declare class JestExpectedHttpErrorWithSpecificServerErrorCode extends BaseError {
8
+ readonly httpError: HttpsError;
9
+ readonly expectedErrorCode: string;
10
+ constructor(httpError: HttpsError, expectedErrorCode: string);
11
+ }
12
+ /**
13
+ * Creates a JestExpectFailAssertionFunction that asserts the encountered error is of the expected type using the instanceof keyword.
14
+ *
15
+ * Throws a JestExpectedErrorOfSpecificTypeError if the input is not a HttpsError.
16
+ * Throws a JestExpectedHttpErrorWithSpecificServerErrorCode if the input's server error data has a different error code.
17
+ *
18
+ * @param expectedType
19
+ * @returns
20
+ */
21
+ export declare function jestExpectFailAssertHttpErrorServerErrorCode(expectedCode: string): JestExpectFailAssertionFunction;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jestExpectFailAssertHttpErrorServerErrorCode = exports.JestExpectedHttpErrorWithSpecificServerErrorCode = void 0;
4
+ const test_1 = require("@dereekb/util/test");
5
+ const https_1 = require("firebase-functions/v1/https");
6
+ const make_error_1 = require("make-error");
7
+ /**
8
+ * Error thrown when the error type was different than the expected type.
9
+ */
10
+ class JestExpectedHttpErrorWithSpecificServerErrorCode extends make_error_1.BaseError {
11
+ httpError;
12
+ expectedErrorCode;
13
+ constructor(httpError, expectedErrorCode) {
14
+ const { code } = httpError.details;
15
+ super(`Expected HttpError with an error code of "${expectedErrorCode}", but recieved "${code}" instead.`);
16
+ this.httpError = httpError;
17
+ this.expectedErrorCode = expectedErrorCode;
18
+ }
19
+ }
20
+ exports.JestExpectedHttpErrorWithSpecificServerErrorCode = JestExpectedHttpErrorWithSpecificServerErrorCode;
21
+ /**
22
+ * Creates a JestExpectFailAssertionFunction that asserts the encountered error is of the expected type using the instanceof keyword.
23
+ *
24
+ * Throws a JestExpectedErrorOfSpecificTypeError if the input is not a HttpsError.
25
+ * Throws a JestExpectedHttpErrorWithSpecificServerErrorCode if the input's server error data has a different error code.
26
+ *
27
+ * @param expectedType
28
+ * @returns
29
+ */
30
+ function jestExpectFailAssertHttpErrorServerErrorCode(expectedCode) {
31
+ return (error) => {
32
+ if (error instanceof https_1.HttpsError) {
33
+ const { code } = error.details;
34
+ if (code !== expectedCode) {
35
+ throw new JestExpectedHttpErrorWithSpecificServerErrorCode(error, expectedCode);
36
+ }
37
+ }
38
+ else {
39
+ throw new test_1.JestExpectedErrorOfSpecificTypeError(error, https_1.HttpsError);
40
+ }
41
+ return true;
42
+ };
43
+ }
44
+ exports.jestExpectFailAssertHttpErrorServerErrorCode = jestExpectFailAssertHttpErrorServerErrorCode;
45
+ //# sourceMappingURL=firebase.jest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebase.jest.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/test/src/lib/firebase/firebase.jest.ts"],"names":[],"mappings":";;;AACA,6CAA2G;AAC3G,uDAAyD;AACzD,2CAAuC;AAEvC;;GAEG;AACH,MAAa,gDAAiD,SAAQ,sBAAS;IACxD;IAAgC;IAArD,YAAqB,SAAqB,EAAW,iBAAyB;QAC5E,MAAM,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC,OAAsB,CAAC;QAClD,KAAK,CAAC,6CAA6C,iBAAiB,oBAAoB,IAAI,YAAY,CAAC,CAAC;QAFvF,cAAS,GAAT,SAAS,CAAY;QAAW,sBAAiB,GAAjB,iBAAiB,CAAQ;IAG9E,CAAC;CACF;AALD,4GAKC;AAED;;;;;;;;GAQG;AACH,SAAgB,4CAA4C,CAAC,YAAoB;IAC/E,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,KAAK,YAAY,kBAAU,EAAE;YAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,OAAsB,CAAC;YAC9C,IAAI,IAAI,KAAK,YAAY,EAAE;gBACzB,MAAM,IAAI,gDAAgD,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;aACjF;SACF;aAAM;YACL,MAAM,IAAI,2CAAoC,CAAC,KAAK,EAAE,kBAA2B,CAAC,CAAC;SACpF;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AAbD,oGAaC"}
@@ -6,4 +6,5 @@ export * from './firebase.admin.nest.function';
6
6
  export * from './firebase.admin.nest';
7
7
  export * from './firebase.admin.test.server';
8
8
  export * from './firebase.admin';
9
+ export * from './firebase.jest';
9
10
  export * from './firebase';
@@ -9,5 +9,6 @@ tslib_1.__exportStar(require("./firebase.admin.nest.function"), exports);
9
9
  tslib_1.__exportStar(require("./firebase.admin.nest"), exports);
10
10
  tslib_1.__exportStar(require("./firebase.admin.test.server"), exports);
11
11
  tslib_1.__exportStar(require("./firebase.admin"), exports);
12
+ tslib_1.__exportStar(require("./firebase.jest"), exports);
12
13
  tslib_1.__exportStar(require("./firebase"), exports);
13
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/test/src/lib/firebase/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,sEAA4C;AAC5C,oEAA0C;AAC1C,iFAAuD;AACvD,yEAA+C;AAC/C,gEAAsC;AACtC,uEAA6C;AAC7C,2DAAiC;AACjC,qDAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase-server/test/src/lib/firebase/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,sEAA4C;AAC5C,oEAA0C;AAC1C,iFAAuD;AACvD,yEAA+C;AAC/C,gEAAsC;AACtC,uEAA6C;AAC7C,2DAAiC;AACjC,0DAAgC;AAChC,qDAA2B"}
package/zoho/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/zoho",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js"
6
6
  }