@donmahallem/turbo-pb 0.4.4 → 0.4.7

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.
@@ -1,34 +1,32 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  const turbo = require('@donmahallem/turbo');
6
4
 
7
- /*!
8
- * Source https://github.com/donmahallem/js-libs Package: turbo-pb
9
- */
10
- /**
11
- * Formats response to either json or protobuf
12
- * @param msg message to be formated
13
- * @param message Message to convert
14
- * @param res express Response object
15
- * @param next express Next function
16
- */
17
- const formatResponse = (msg, message, res, next) => {
18
- res.format({
19
- 'application/json': () => {
20
- res.json(msg);
21
- },
22
- 'application/x-protobuf': () => {
23
- const encodedMessage = message.encode(msg).finish();
24
- res
25
- .type('application/x-protobuf')
26
- .send(encodedMessage);
27
- },
28
- default: () => {
29
- next(new turbo.RequestError('Not Acceptable', 406));
30
- },
31
- });
5
+ /*!
6
+ * Source https://github.com/donmahallem/js-libs Package: turbo-pb
7
+ */
8
+ /**
9
+ * Formats response to either json or protobuf
10
+ * @param msg message to be formated
11
+ * @param message Message to convert
12
+ * @param res express Response object
13
+ * @param next express Next function
14
+ */
15
+ const formatResponse = (msg, message, res, next) => {
16
+ res.format({
17
+ 'application/json': () => {
18
+ res.json(msg);
19
+ },
20
+ 'application/x-protobuf': () => {
21
+ const encodedMessage = message.encode(msg).finish();
22
+ res
23
+ .type('application/x-protobuf')
24
+ .send(encodedMessage);
25
+ },
26
+ default: () => {
27
+ next(new turbo.RequestError('Not Acceptable', 406));
28
+ },
29
+ });
32
30
  };
33
31
 
34
32
  exports.formatResponse = formatResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"format-response.cjs","sources":["../../src/format-response.ts"],"sourcesContent":[null],"names":["RequestError"],"mappings":";;;;;;AAAA;;AAEG;AASH;;;;;;AAMG;AACI,MAAM,cAAc,GAAG,CAAmB,GAAM,EAAE,OAAsB,EAAE,GAAa,EAAE,IAAkB,KAAU;IACxH,GAAG,CAAC,MAAM,CAAC;QACP,kBAAkB,EAAE,MAAW;AAC3B,YAAA,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACjB;QACD,wBAAwB,EAAE,MAAW;YACjC,MAAM,cAAc,GAAe,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YAChE,GAAG;iBACE,IAAI,CAAC,wBAAwB,CAAC;iBAC9B,IAAI,CAAC,cAAc,CAAC,CAAC;SAC7B;QACD,OAAO,EAAE,MAAW;YAChB,IAAI,CAAC,IAAIA,kBAAY,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,CAAC;SACjD;AACJ,KAAA,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"format-response.cjs","sources":["../../src/format-response.ts"],"sourcesContent":[null],"names":["RequestError"],"mappings":";;;;AAAA;;AAEG;AASH;;;;;;AAMG;AACI,MAAM,cAAc,GAAG,CAAmB,GAAM,EAAE,OAAsB,EAAE,GAAa,EAAE,IAAkB,KAAU;IACxH,GAAG,CAAC,MAAM,CAAC;QACP,kBAAkB,EAAE,MAAW;AAC3B,YAAA,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACjB;QACD,wBAAwB,EAAE,MAAW;YACjC,MAAM,cAAc,GAAe,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YAChE,GAAG;iBACE,IAAI,CAAC,wBAAwB,CAAC;iBAC9B,IAAI,CAAC,cAAc,CAAC,CAAC;SAC7B;QACD,OAAO,EAAE,MAAW;YAChB,IAAI,CAAC,IAAIA,kBAAY,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,CAAC;SACjD;AACJ,KAAA,CAAC,CAAC;AACP;;;;"}
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  const formatResponse = require('./format-response.cjs');
6
4
 
7
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,30 +1,30 @@
1
1
  import { RequestError } from '@donmahallem/turbo';
2
2
 
3
- /*!
4
- * Source https://github.com/donmahallem/js-libs Package: turbo-pb
5
- */
6
- /**
7
- * Formats response to either json or protobuf
8
- * @param msg message to be formated
9
- * @param message Message to convert
10
- * @param res express Response object
11
- * @param next express Next function
12
- */
13
- const formatResponse = (msg, message, res, next) => {
14
- res.format({
15
- 'application/json': () => {
16
- res.json(msg);
17
- },
18
- 'application/x-protobuf': () => {
19
- const encodedMessage = message.encode(msg).finish();
20
- res
21
- .type('application/x-protobuf')
22
- .send(encodedMessage);
23
- },
24
- default: () => {
25
- next(new RequestError('Not Acceptable', 406));
26
- },
27
- });
3
+ /*!
4
+ * Source https://github.com/donmahallem/js-libs Package: turbo-pb
5
+ */
6
+ /**
7
+ * Formats response to either json or protobuf
8
+ * @param msg message to be formated
9
+ * @param message Message to convert
10
+ * @param res express Response object
11
+ * @param next express Next function
12
+ */
13
+ const formatResponse = (msg, message, res, next) => {
14
+ res.format({
15
+ 'application/json': () => {
16
+ res.json(msg);
17
+ },
18
+ 'application/x-protobuf': () => {
19
+ const encodedMessage = message.encode(msg).finish();
20
+ res
21
+ .type('application/x-protobuf')
22
+ .send(encodedMessage);
23
+ },
24
+ default: () => {
25
+ next(new RequestError('Not Acceptable', 406));
26
+ },
27
+ });
28
28
  };
29
29
 
30
30
  export { formatResponse };
@@ -1,17 +1,17 @@
1
- /*!
2
- * Source https://github.com/donmahallem/js-libs Package: turbo-pb
3
- */
4
- import { NextFunction, Response } from 'express';
5
- import { Message, Type, Writer } from 'protobufjs';
6
- declare type MessageKey<T extends object> = ({
7
- encode: (msg: T) => Writer;
8
- } & typeof Message) | Type;
9
- /**
10
- * Formats response to either json or protobuf
11
- * @param msg message to be formated
12
- * @param message Message to convert
13
- * @param res express Response object
14
- * @param next express Next function
15
- */
16
- export declare const formatResponse: <T extends object>(msg: T, message: MessageKey<T>, res: Response, next: NextFunction) => void;
17
- export {};
1
+ /*!
2
+ * Source https://github.com/donmahallem/js-libs Package: turbo-pb
3
+ */
4
+ import { NextFunction, Response } from 'express';
5
+ import { Message, Type, Writer } from 'protobufjs';
6
+ type MessageKey<T extends object> = ({
7
+ encode: (msg: T) => Writer;
8
+ } & typeof Message) | Type;
9
+ /**
10
+ * Formats response to either json or protobuf
11
+ * @param msg message to be formated
12
+ * @param message Message to convert
13
+ * @param res express Response object
14
+ * @param next express Next function
15
+ */
16
+ export declare const formatResponse: <T extends object>(msg: T, message: MessageKey<T>, res: Response, next: NextFunction) => void;
17
+ export {};
@@ -1,4 +1,4 @@
1
- /*!
2
- * Source https://github.com/donmahallem/js-libs Package: turbo-pb
3
- */
4
- export { formatResponse } from './format-response';
1
+ /*!
2
+ * Source https://github.com/donmahallem/js-libs Package: turbo-pb
3
+ */
4
+ export { formatResponse } from './format-response';
package/package.json CHANGED
@@ -1,18 +1,23 @@
1
1
  {
2
2
  "name": "@donmahallem/turbo-pb",
3
- "version": "0.4.4",
3
+ "version": "0.4.7",
4
4
  "description": "Protobuf Helpers for express.js",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "types": "./dist/types/index.d.ts",
7
- "module": "./dist/esm/index.mjs",
8
7
  "private": false,
8
+ "type": "module",
9
+ "exports": {
10
+ "require": "./dist/cjs/index.cjs",
11
+ "import": "./dist/esm/index.mjs",
12
+ "types": "./dist/types/index.d.ts"
13
+ },
9
14
  "keywords": [
10
15
  "express",
11
16
  "helpers"
12
17
  ],
13
18
  "typedocMain": "./src/index.ts",
14
19
  "scripts": {
15
- "build": "rollup -c rollup.config.js",
20
+ "build": "rollup -c rollup.config.mjs",
16
21
  "build:readme": "npx @appnest/readme generate --input ../package_readme_blueprint.md --config readme_config.json",
17
22
  "test": "mocha --config ../../.mocharc.json",
18
23
  "test:coverage": "c8 --config ../../.nycrc.json npm run test",
@@ -47,19 +52,20 @@
47
52
  "access": "public"
48
53
  },
49
54
  "devDependencies": {
50
- "@types/express": "4.17.13",
51
- "@types/supertest": "2.0.12",
52
- "express": "4.18.1",
53
- "protobufjs": "7.0.0",
54
- "supertest": "6.2.4"
55
+ "@types/express": "4.17.21",
56
+ "@types/supertest": "2.0.14",
57
+ "esmock": "2.6.0",
58
+ "express": "4.18.2",
59
+ "protobufjs": "7.2.5",
60
+ "supertest": "6.3.3"
55
61
  },
56
62
  "peerDependencies": {
57
- "axios": "^0.27.0",
63
+ "axios": "^1.0.0",
58
64
  "express": "^4.17.1",
59
65
  "protobufjs": "^7.0.0"
60
66
  },
61
67
  "dependencies": {
62
- "@donmahallem/turbo": "^2.4.3"
68
+ "@donmahallem/turbo": "^2.4.6"
63
69
  },
64
- "gitHead": "fbac1ca446cf28c9d62f83765a442464a6829687"
70
+ "gitHead": "20bc4f61fa034321931f37859dbd196b04e7909c"
65
71
  }