@nmtjs/protocol 0.15.0-beta.45 → 0.15.0-beta.46

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.
@@ -5,12 +5,12 @@ export class UnsupportedContentTypeError extends UnsupportedFormatError {
5
5
  export class UnsupportedAcceptTypeError extends UnsupportedFormatError {
6
6
  }
7
7
  export const getFormat = (format, { accept, contentType }) => {
8
- const encoder = contentType ? format.supportsEncoder(contentType) : undefined;
8
+ const encoder = accept ? format.supportsEncoder(accept) : undefined;
9
9
  if (!encoder)
10
- throw new UnsupportedContentTypeError('Unsupported Content type');
11
- const decoder = accept ? format.supportsDecoder(accept) : undefined;
12
- if (!decoder)
13
10
  throw new UnsupportedAcceptTypeError('Unsupported Accept type');
11
+ const decoder = contentType ? format.supportsDecoder(contentType) : undefined;
12
+ if (!decoder)
13
+ throw new UnsupportedContentTypeError('Unsupported Content type');
14
14
  return { encoder, decoder };
15
15
  };
16
16
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/server/utils.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,MAAM,OAAO,2BAA4B,SAAQ,sBAAsB;CAAG;AAE1E,MAAM,OAAO,0BAA2B,SAAQ,sBAAsB;CAAG;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAuB,EACvB,EAAE,MAAM,EAAE,WAAW,EAAuB,EAC5C,EAAE,CAAC;IACH,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7E,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,2BAA2B,CAAC,0BAA0B,CAAC,CAAA;IAEnE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACnE,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,0BAA0B,CAAC,yBAAyB,CAAC,CAAA;IAE7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAAA,CAC5B,CAAA"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/server/utils.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,MAAM,OAAO,2BAA4B,SAAQ,sBAAsB;CAAG;AAE1E,MAAM,OAAO,0BAA2B,SAAQ,sBAAsB;CAAG;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAuB,EACvB,EAAE,MAAM,EAAE,WAAW,EAAuB,EAC5C,EAAE,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACnE,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,0BAA0B,CAAC,yBAAyB,CAAC,CAAA;IAE7E,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7E,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,2BAA2B,CAAC,0BAA0B,CAAC,CAAA;IAEnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAAA,CAC5B,CAAA"}
package/package.json CHANGED
@@ -21,18 +21,18 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "hookable": "6.0.0-rc.1",
24
- "@nmtjs/common": "0.15.0-beta.45",
25
- "@nmtjs/type": "0.15.0-beta.45",
26
- "@nmtjs/contract": "0.15.0-beta.45"
24
+ "@nmtjs/common": "0.15.0-beta.46",
25
+ "@nmtjs/type": "0.15.0-beta.46",
26
+ "@nmtjs/contract": "0.15.0-beta.46"
27
27
  },
28
28
  "devDependencies": {
29
- "@nmtjs/core": "0.15.0-beta.45"
29
+ "@nmtjs/core": "0.15.0-beta.46"
30
30
  },
31
31
  "peerDependencies": {
32
- "@nmtjs/common": "0.15.0-beta.45",
33
- "@nmtjs/core": "0.15.0-beta.45",
34
- "@nmtjs/type": "0.15.0-beta.45",
35
- "@nmtjs/contract": "0.15.0-beta.45"
32
+ "@nmtjs/core": "0.15.0-beta.46",
33
+ "@nmtjs/common": "0.15.0-beta.46",
34
+ "@nmtjs/type": "0.15.0-beta.46",
35
+ "@nmtjs/contract": "0.15.0-beta.46"
36
36
  },
37
37
  "files": [
38
38
  "dist",
@@ -40,7 +40,7 @@
40
40
  "LICENSE.md",
41
41
  "README.md"
42
42
  ],
43
- "version": "0.15.0-beta.45",
43
+ "version": "0.15.0-beta.46",
44
44
  "scripts": {
45
45
  "clean-build": "rm -rf ./dist"
46
46
  }
@@ -11,12 +11,12 @@ export const getFormat = (
11
11
  format: ProtocolFormats,
12
12
  { accept, contentType }: ResolveFormatParams,
13
13
  ) => {
14
- const encoder = contentType ? format.supportsEncoder(contentType) : undefined
15
- if (!encoder)
16
- throw new UnsupportedContentTypeError('Unsupported Content type')
14
+ const encoder = accept ? format.supportsEncoder(accept) : undefined
15
+ if (!encoder) throw new UnsupportedAcceptTypeError('Unsupported Accept type')
17
16
 
18
- const decoder = accept ? format.supportsDecoder(accept) : undefined
19
- if (!decoder) throw new UnsupportedAcceptTypeError('Unsupported Accept type')
17
+ const decoder = contentType ? format.supportsDecoder(contentType) : undefined
18
+ if (!decoder)
19
+ throw new UnsupportedContentTypeError('Unsupported Content type')
20
20
 
21
21
  return { encoder, decoder }
22
22
  }