@nmtjs/protocol 0.12.6 → 0.12.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.
- package/package.json +7 -8
- package/src/client/events.ts +0 -57
- package/src/client/format.ts +0 -51
- package/src/client/index.ts +0 -6
- package/src/client/protocol.ts +0 -634
- package/src/client/stream.ts +0 -116
- package/src/client/types.ts +0 -14
- package/src/common/binary.ts +0 -60
- package/src/common/blob.ts +0 -77
- package/src/common/enums.ts +0 -48
- package/src/common/index.ts +0 -4
- package/src/common/types.ts +0 -41
- package/src/server/api.ts +0 -63
- package/src/server/connection.ts +0 -40
- package/src/server/constants.ts +0 -9
- package/src/server/format.ts +0 -117
- package/src/server/index.ts +0 -11
- package/src/server/injectables.ts +0 -52
- package/src/server/protocol.ts +0 -601
- package/src/server/registry.ts +0 -3
- package/src/server/stream.ts +0 -38
- package/src/server/transport.ts +0 -39
- package/src/server/types.ts +0 -20
- package/src/server/utils.ts +0 -29
package/src/server/utils.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { Format } from './format.ts'
|
|
2
|
-
|
|
3
|
-
export type ResolveFormatParams = {
|
|
4
|
-
contentType?: string | null
|
|
5
|
-
acceptType?: string | null
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class UnsupportedFormatError extends Error {}
|
|
9
|
-
|
|
10
|
-
export class UnsupportedContentTypeError extends UnsupportedFormatError {}
|
|
11
|
-
|
|
12
|
-
export class UnsupportedAcceptTypeError extends UnsupportedFormatError {}
|
|
13
|
-
|
|
14
|
-
export const getFormat = (
|
|
15
|
-
format: Format,
|
|
16
|
-
{ acceptType, contentType }: ResolveFormatParams,
|
|
17
|
-
) => {
|
|
18
|
-
const encoder = contentType ? format.supportsEncoder(contentType) : undefined
|
|
19
|
-
if (!encoder)
|
|
20
|
-
throw new UnsupportedContentTypeError('Unsupported Content-Type')
|
|
21
|
-
|
|
22
|
-
const decoder = acceptType ? format.supportsDecoder(acceptType) : undefined
|
|
23
|
-
if (!decoder) throw new UnsupportedAcceptTypeError('Unsupported Accept-Type')
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
encoder,
|
|
27
|
-
decoder,
|
|
28
|
-
}
|
|
29
|
-
}
|