bare-media 1.2.1 → 1.4.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.
package/README.md CHANGED
@@ -29,15 +29,14 @@ const data = await worker.createPreview({ path, maxWidth, maxHeight })
29
29
 
30
30
  > NOTE: A worker spawns when an operation is requested and it stays running until the parent process is killed.
31
31
 
32
- Handle close event:
32
+ Terminate the worker:
33
33
 
34
34
  ```js
35
- import worker from 'bare-media'
35
+ worker.close()
36
36
 
37
37
  worker.onClose = () => {
38
- // worker closed unexpectedly
38
+ // worker terminated
39
39
  }
40
-
41
40
  ```
42
41
 
43
42
  Call the methods directly without a worker:
@@ -50,13 +49,33 @@ const data = await createPreview({ path, maxWidth, maxHeight })
50
49
 
51
50
  ## API
52
51
 
53
- | Method | Parameters | Return Value | Description
54
- |---------------------|---------------------------------------------------------|---------------------|----------------------------------------
55
- | `createPreview` | `path, mimetype, maxWidth, maxHeight, format, encoding` | `metadata, preview` | Create a preview from a media file
56
- | `decodeImage` | `path`, `httpLink, mimetype` | `metadata, data` | Decode an image to RGBA
57
-
58
52
  > See [schema.js](shared/spec/schema.js) for the complete reference of parameters
59
53
 
54
+ ### createPreview()
55
+
56
+ Create a preview from a media file
57
+
58
+ | Property | Type | Description |
59
+ | ----------- | ------ | ----------------------------------------------------------------- |
60
+ | `path` | string | Path to the input file |
61
+ | `mimetype` | string | Media type of the input file. If not provided it will be detected |
62
+ | `maxWidth` | number | Max width for the generated preview |
63
+ | `maxHeight` | number | Max height for the generated preview |
64
+ | `maxFrames` | number | Max frames for the generated preview in case the file is animated |
65
+ | `maxBytes` | number | Max bytes for the generated preview |
66
+ | `format` | string | Media type for the generated preview. Default `image/webp` |
67
+ | `encoding` | string | `base64` or nothing for buffer |
68
+
69
+ ### decodeImage()
70
+
71
+ Decode an image to RGBA
72
+
73
+ | Property | Type | Description |
74
+ | ---------- | ------ | ----------------------------------------------------------------- |
75
+ | `path` | string | Path to the input file. Either this or `httpLink` is required |
76
+ | `httpLink` | string | Http link to the input file |
77
+ | `mimetype` | string | Media type of the input file. If not provided it will be detected |
78
+
60
79
  ## License
61
80
 
62
81
  Apache-2.0
package/client.js CHANGED
@@ -9,21 +9,22 @@ export class WorkerClient extends ReadyResource {
9
9
  rpc = null
10
10
  opts = null
11
11
 
12
- constructor (opts) {
12
+ constructor(opts) {
13
13
  super()
14
14
  this.initialize(opts)
15
15
  this.#attachMethods()
16
16
  }
17
17
 
18
- initialize ({ filename = 'node_modules/bare-media/worker/index.js', requireSource, args } = {}) {
18
+ initialize({
19
+ filename = 'node_modules/bare-media/worker/index.js',
20
+ requireSource,
21
+ args
22
+ } = {}) {
19
23
  this.opts = { filename, requireSource, args }
20
24
  }
21
25
 
22
- #attachMethods () {
23
- const methods = [
24
- 'createPreview',
25
- 'decodeImage'
26
- ]
26
+ #attachMethods() {
27
+ const methods = ['createPreview', 'decodeImage']
27
28
 
28
29
  for (const method of methods) {
29
30
  this[method] = async (...args) => {
@@ -33,15 +34,15 @@ export class WorkerClient extends ReadyResource {
33
34
  }
34
35
  }
35
36
 
36
- async _open () {
37
+ async _open() {
37
38
  await this.#run()
38
39
  }
39
40
 
40
- async _close () {
41
+ async _close() {
41
42
  this.worker?.IPC.end()
42
43
  }
43
44
 
44
- async #run () {
45
+ async #run() {
45
46
  const { filename, requireSource, args } = this.opts
46
47
  const source = requireSource?.()
47
48
  this.worker = await spawn(filename, source, args)
@@ -54,7 +55,7 @@ export class WorkerClient extends ReadyResource {
54
55
  this.rpc = new HRPC(ipc)
55
56
  }
56
57
 
57
- isCodecSupported (mimetype) {
58
+ isCodecSupported(mimetype) {
58
59
  return isCodecSupported(mimetype)
59
60
  }
60
61
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "bare-media",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build:rpc": "cd shared/spec && bare ./build.js",
8
- "lint": "standard",
9
- "lint:fix": "standard --fix",
10
- "test": "npm run lint && brittle-bare test/index.js"
8
+ "format": "prettier --write .",
9
+ "format:check": "prettier --check .",
10
+ "test": "npm run format:check && brittle-bare test/index.js"
11
11
  },
12
12
  "keywords": [],
13
13
  "author": "Holepunch Inc",
@@ -35,7 +35,8 @@
35
35
  "corestore": "^7.4.5",
36
36
  "hyperblobs": "^2.8.0",
37
37
  "hypercore-blob-server": "^1.11.0",
38
- "standard": "^17.1.2",
38
+ "prettier": "^3.6.2",
39
+ "prettier-config-holepunch": "^1.0.0",
39
40
  "test-tmp": "^1.4.0"
40
41
  },
41
42
  "files": [
@@ -43,11 +44,5 @@
43
44
  "worker",
44
45
  "client.js",
45
46
  "index.js"
46
- ],
47
- "standard": {
48
- "globals": [
49
- "Bare",
50
- "Pear"
51
- ]
52
- }
47
+ ]
53
48
  }
package/shared/codecs.js CHANGED
@@ -10,12 +10,16 @@ export const codecs = {
10
10
  'image/tiff': () => import('bare-tiff')
11
11
  }
12
12
 
13
- export function isCodecSupported (mimetype) {
13
+ export function isCodecSupported(mimetype) {
14
14
  return mimetype in codecs
15
15
  }
16
16
 
17
- export async function importCodec (mimetype) {
17
+ export async function importCodec(mimetype) {
18
18
  const codecImport = codecs[mimetype]
19
19
  if (!codecImport) throw new Error(`No codec for ${mimetype}`)
20
20
  return await codecImport()
21
21
  }
22
+
23
+ export function supportsQuality(mimetype) {
24
+ return { 'image/webp': true, 'image/jpeg': true }[mimetype] || false
25
+ }
@@ -28,4 +28,4 @@
28
28
  "version": 1
29
29
  }
30
30
  ]
31
- }
31
+ }
@@ -1,5 +1,6 @@
1
1
  // This file is autogenerated by the hrpc compiler
2
2
  /* eslint-disable camelcase */
3
+ /* eslint-disable space-before-function-paren */
3
4
 
4
5
  import { c, RPC, RPCStream, RPCRequestStream } from 'hrpc/runtime'
5
6
  import { getEncoding } from './messages.js'
@@ -12,7 +13,7 @@ const methods = new Map([
12
13
  ])
13
14
 
14
15
  class HRPC {
15
- constructor (stream) {
16
+ constructor(stream) {
16
17
  this._stream = stream
17
18
  this._handlers = []
18
19
  this._requestEncodings = new Map([
@@ -39,23 +40,40 @@ class HRPC {
39
40
  }
40
41
  if (!this._requestIsStream(command) && this._responseIsStream(command)) {
41
42
  const request = req.data ? c.decode(requestEncoding, req.data) : null
42
- const responseStream = new RPCStream(null, null, req.createResponseStream(), responseEncoding)
43
+ const responseStream = new RPCStream(
44
+ null,
45
+ null,
46
+ req.createResponseStream(),
47
+ responseEncoding
48
+ )
43
49
  responseStream.data = request
44
50
  await this._handlers[command](responseStream)
45
51
  }
46
52
  if (this._requestIsStream(command) && !this._responseIsStream(command)) {
47
- const requestStream = new RPCRequestStream(req, responseEncoding, req.createRequestStream(), requestEncoding)
53
+ const requestStream = new RPCRequestStream(
54
+ req,
55
+ responseEncoding,
56
+ req.createRequestStream(),
57
+ requestEncoding
58
+ )
48
59
  const response = await this._handlers[command](requestStream)
49
60
  req.reply(c.encode(responseEncoding, response))
50
61
  }
51
62
  if (this._requestIsStream(command) && this._responseIsStream(command)) {
52
- const requestStream = new RPCRequestStream(req, responseEncoding, req.createRequestStream(), requestEncoding, req.createResponseStream(), responseEncoding)
63
+ const requestStream = new RPCRequestStream(
64
+ req,
65
+ responseEncoding,
66
+ req.createRequestStream(),
67
+ requestEncoding,
68
+ req.createResponseStream(),
69
+ responseEncoding
70
+ )
53
71
  await this._handlers[command](requestStream)
54
72
  }
55
73
  })
56
74
  }
57
75
 
58
- async _call (name, args) {
76
+ async _call(name, args) {
59
77
  const requestEncoding = this._requestEncodings.get(name)
60
78
  const responseEncoding = this._responseEncodings.get(name)
61
79
  const request = this._rpc.request(methods.get(name))
@@ -64,7 +82,7 @@ class HRPC {
64
82
  return c.decode(responseEncoding, await request.reply())
65
83
  }
66
84
 
67
- _callSync (name, args) {
85
+ _callSync(name, args) {
68
86
  const requestEncoding = this._requestEncodings.get(name)
69
87
  const responseEncoding = this._responseEncodings.get(name)
70
88
  const request = this._rpc.request(methods.get(name))
@@ -78,41 +96,55 @@ class HRPC {
78
96
  return new RPCStream(request.createResponseStream(), responseEncoding)
79
97
  }
80
98
  if (this._requestIsStream(name) && !this._responseIsStream(name)) {
81
- return new RPCRequestStream(request, responseEncoding, null, null, request.createRequestStream(), requestEncoding)
99
+ return new RPCRequestStream(
100
+ request,
101
+ responseEncoding,
102
+ null,
103
+ null,
104
+ request.createRequestStream(),
105
+ requestEncoding
106
+ )
82
107
  }
83
108
  if (this._requestIsStream(name) && this._responseIsStream(name)) {
84
- return new RPCRequestStream(request, responseEncoding, request.createResponseStream(), responseEncoding, request.createRequestStream(), requestEncoding)
109
+ return new RPCRequestStream(
110
+ request,
111
+ responseEncoding,
112
+ request.createResponseStream(),
113
+ responseEncoding,
114
+ request.createRequestStream(),
115
+ requestEncoding
116
+ )
85
117
  }
86
118
  }
87
119
 
88
- async createPreview (args) {
120
+ async createPreview(args) {
89
121
  return this._call('@media/create-preview', args)
90
122
  }
91
123
 
92
- async decodeImage (args) {
124
+ async decodeImage(args) {
93
125
  return this._call('@media/decode-image', args)
94
126
  }
95
127
 
96
- onCreatePreview (responseFn) {
128
+ onCreatePreview(responseFn) {
97
129
  this._handlers['@media/create-preview'] = responseFn
98
130
  }
99
131
 
100
- onDecodeImage (responseFn) {
132
+ onDecodeImage(responseFn) {
101
133
  this._handlers['@media/decode-image'] = responseFn
102
134
  }
103
135
 
104
- _requestIsStream (command) {
105
- return [
106
- ].includes(command)
136
+ _requestIsStream(command) {
137
+ return [].includes(command)
107
138
  }
108
139
 
109
- _responseIsStream (command) {
110
- return [
111
- ].includes(command)
140
+ _responseIsStream(command) {
141
+ return [].includes(command)
112
142
  }
113
143
 
114
- _requestIsSend (command) {
144
+ // prettier-ignore-start
145
+ _requestIsSend(command) {
115
146
  return [
147
+ // prettier-ignore
116
148
  ].includes(command)
117
149
  }
118
150
  }
@@ -12,15 +12,15 @@ let version = VERSION
12
12
 
13
13
  // @media/dimensions
14
14
  const encoding0 = {
15
- preencode (state, m) {
15
+ preencode(state, m) {
16
16
  c.uint.preencode(state, m.width)
17
17
  c.uint.preencode(state, m.height)
18
18
  },
19
- encode (state, m) {
19
+ encode(state, m) {
20
20
  c.uint.encode(state, m.width)
21
21
  c.uint.encode(state, m.height)
22
22
  },
23
- decode (state) {
23
+ decode(state) {
24
24
  const r0 = c.uint.decode(state)
25
25
  const r1 = c.uint.decode(state)
26
26
 
@@ -36,18 +36,16 @@ const encoding1_1 = c.frame(encoding0)
36
36
 
37
37
  // @media/metadata
38
38
  const encoding1 = {
39
- preencode (state, m) {
39
+ preencode(state, m) {
40
40
  state.end++ // max flag is 4 so always one byte
41
41
 
42
42
  if (m.mimetype) c.string.preencode(state, m.mimetype)
43
43
  if (m.dimensions) encoding1_1.preencode(state, m.dimensions)
44
44
  if (m.duration) c.uint.preencode(state, m.duration)
45
45
  },
46
- encode (state, m) {
46
+ encode(state, m) {
47
47
  const flags =
48
- (m.mimetype ? 1 : 0) |
49
- (m.dimensions ? 2 : 0) |
50
- (m.duration ? 4 : 0)
48
+ (m.mimetype ? 1 : 0) | (m.dimensions ? 2 : 0) | (m.duration ? 4 : 0)
51
49
 
52
50
  c.uint.encode(state, flags)
53
51
 
@@ -55,7 +53,7 @@ const encoding1 = {
55
53
  if (m.dimensions) encoding1_1.encode(state, m.dimensions)
56
54
  if (m.duration) c.uint.encode(state, m.duration)
57
55
  },
58
- decode (state) {
56
+ decode(state) {
59
57
  const flags = c.uint.decode(state)
60
58
 
61
59
  return {
@@ -71,18 +69,16 @@ const encoding2_0 = c.frame(encoding1)
71
69
 
72
70
  // @media/file
73
71
  const encoding2 = {
74
- preencode (state, m) {
72
+ preencode(state, m) {
75
73
  state.end++ // max flag is 4 so always one byte
76
74
 
77
75
  if (m.metadata) encoding2_0.preencode(state, m.metadata)
78
76
  if (m.inlined) c.string.preencode(state, m.inlined)
79
77
  if (m.buffer) c.buffer.preencode(state, m.buffer)
80
78
  },
81
- encode (state, m) {
79
+ encode(state, m) {
82
80
  const flags =
83
- (m.metadata ? 1 : 0) |
84
- (m.inlined ? 2 : 0) |
85
- (m.buffer ? 4 : 0)
81
+ (m.metadata ? 1 : 0) | (m.inlined ? 2 : 0) | (m.buffer ? 4 : 0)
86
82
 
87
83
  c.uint.encode(state, flags)
88
84
 
@@ -90,7 +86,7 @@ const encoding2 = {
90
86
  if (m.inlined) c.string.encode(state, m.inlined)
91
87
  if (m.buffer) c.buffer.encode(state, m.buffer)
92
88
  },
93
- decode (state) {
89
+ decode(state) {
94
90
  const flags = c.uint.decode(state)
95
91
 
96
92
  return {
@@ -103,23 +99,27 @@ const encoding2 = {
103
99
 
104
100
  // @media/create-preview-request
105
101
  const encoding3 = {
106
- preencode (state, m) {
102
+ preencode(state, m) {
107
103
  c.string.preencode(state, m.path)
108
- state.end++ // max flag is 16 so always one byte
104
+ state.end++ // max flag is 64 so always one byte
109
105
 
110
106
  if (m.mimetype) c.string.preencode(state, m.mimetype)
111
107
  if (m.maxWidth) c.uint.preencode(state, m.maxWidth)
112
108
  if (m.maxHeight) c.uint.preencode(state, m.maxHeight)
109
+ if (m.maxFrames) c.uint.preencode(state, m.maxFrames)
110
+ if (m.maxBytes) c.uint.preencode(state, m.maxBytes)
113
111
  if (m.format) c.string.preencode(state, m.format)
114
112
  if (m.encoding) c.string.preencode(state, m.encoding)
115
113
  },
116
- encode (state, m) {
114
+ encode(state, m) {
117
115
  const flags =
118
116
  (m.mimetype ? 1 : 0) |
119
117
  (m.maxWidth ? 2 : 0) |
120
118
  (m.maxHeight ? 4 : 0) |
121
- (m.format ? 8 : 0) |
122
- (m.encoding ? 16 : 0)
119
+ (m.maxFrames ? 8 : 0) |
120
+ (m.maxBytes ? 16 : 0) |
121
+ (m.format ? 32 : 0) |
122
+ (m.encoding ? 64 : 0)
123
123
 
124
124
  c.string.encode(state, m.path)
125
125
  c.uint.encode(state, flags)
@@ -127,10 +127,12 @@ const encoding3 = {
127
127
  if (m.mimetype) c.string.encode(state, m.mimetype)
128
128
  if (m.maxWidth) c.uint.encode(state, m.maxWidth)
129
129
  if (m.maxHeight) c.uint.encode(state, m.maxHeight)
130
+ if (m.maxFrames) c.uint.encode(state, m.maxFrames)
131
+ if (m.maxBytes) c.uint.encode(state, m.maxBytes)
130
132
  if (m.format) c.string.encode(state, m.format)
131
133
  if (m.encoding) c.string.encode(state, m.encoding)
132
134
  },
133
- decode (state) {
135
+ decode(state) {
134
136
  const r0 = c.string.decode(state)
135
137
  const flags = c.uint.decode(state)
136
138
 
@@ -139,8 +141,10 @@ const encoding3 = {
139
141
  mimetype: (flags & 1) !== 0 ? c.string.decode(state) : null,
140
142
  maxWidth: (flags & 2) !== 0 ? c.uint.decode(state) : 0,
141
143
  maxHeight: (flags & 4) !== 0 ? c.uint.decode(state) : 0,
142
- format: (flags & 8) !== 0 ? c.string.decode(state) : null,
143
- encoding: (flags & 16) !== 0 ? c.string.decode(state) : null
144
+ maxFrames: (flags & 8) !== 0 ? c.uint.decode(state) : 0,
145
+ maxBytes: (flags & 16) !== 0 ? c.uint.decode(state) : 0,
146
+ format: (flags & 32) !== 0 ? c.string.decode(state) : null,
147
+ encoding: (flags & 64) !== 0 ? c.string.decode(state) : null
144
148
  }
145
149
  }
146
150
  }
@@ -152,15 +156,15 @@ const encoding4_1 = c.frame(encoding2)
152
156
 
153
157
  // @media/create-preview-response
154
158
  const encoding4 = {
155
- preencode (state, m) {
159
+ preencode(state, m) {
156
160
  encoding4_0.preencode(state, m.metadata)
157
161
  encoding4_1.preencode(state, m.preview)
158
162
  },
159
- encode (state, m) {
163
+ encode(state, m) {
160
164
  encoding4_0.encode(state, m.metadata)
161
165
  encoding4_1.encode(state, m.preview)
162
166
  },
163
- decode (state) {
167
+ decode(state) {
164
168
  const r0 = encoding4_0.decode(state)
165
169
  const r1 = encoding4_1.decode(state)
166
170
 
@@ -173,18 +177,15 @@ const encoding4 = {
173
177
 
174
178
  // @media/decode-image-request
175
179
  const encoding5 = {
176
- preencode (state, m) {
180
+ preencode(state, m) {
177
181
  state.end++ // max flag is 4 so always one byte
178
182
 
179
183
  if (m.path) c.string.preencode(state, m.path)
180
184
  if (m.httpLink) c.string.preencode(state, m.httpLink)
181
185
  if (m.mimetype) c.string.preencode(state, m.mimetype)
182
186
  },
183
- encode (state, m) {
184
- const flags =
185
- (m.path ? 1 : 0) |
186
- (m.httpLink ? 2 : 0) |
187
- (m.mimetype ? 4 : 0)
187
+ encode(state, m) {
188
+ const flags = (m.path ? 1 : 0) | (m.httpLink ? 2 : 0) | (m.mimetype ? 4 : 0)
188
189
 
189
190
  c.uint.encode(state, flags)
190
191
 
@@ -192,7 +193,7 @@ const encoding5 = {
192
193
  if (m.httpLink) c.string.encode(state, m.httpLink)
193
194
  if (m.mimetype) c.string.encode(state, m.mimetype)
194
195
  },
195
- decode (state) {
196
+ decode(state) {
196
197
  const flags = c.uint.decode(state)
197
198
 
198
199
  return {
@@ -208,23 +209,21 @@ const encoding6_0 = encoding2_0
208
209
 
209
210
  // @media/decode-image-response
210
211
  const encoding6 = {
211
- preencode (state, m) {
212
+ preencode(state, m) {
212
213
  state.end++ // max flag is 2 so always one byte
213
214
 
214
215
  if (m.metadata) encoding6_0.preencode(state, m.metadata)
215
216
  if (m.data) c.buffer.preencode(state, m.data)
216
217
  },
217
- encode (state, m) {
218
- const flags =
219
- (m.metadata ? 1 : 0) |
220
- (m.data ? 2 : 0)
218
+ encode(state, m) {
219
+ const flags = (m.metadata ? 1 : 0) | (m.data ? 2 : 0)
221
220
 
222
221
  c.uint.encode(state, flags)
223
222
 
224
223
  if (m.metadata) encoding6_0.encode(state, m.metadata)
225
224
  if (m.data) c.buffer.encode(state, m.data)
226
225
  },
227
- decode (state) {
226
+ decode(state) {
228
227
  const flags = c.uint.decode(state)
229
228
 
230
229
  return {
@@ -234,51 +233,60 @@ const encoding6 = {
234
233
  }
235
234
  }
236
235
 
237
- function setVersion (v) {
236
+ function setVersion(v) {
238
237
  version = v
239
238
  }
240
239
 
241
- function encode (name, value, v = VERSION) {
240
+ function encode(name, value, v = VERSION) {
242
241
  version = v
243
242
  return c.encode(getEncoding(name), value)
244
243
  }
245
244
 
246
- function decode (name, buffer, v = VERSION) {
245
+ function decode(name, buffer, v = VERSION) {
247
246
  version = v
248
247
  return c.decode(getEncoding(name), buffer)
249
248
  }
250
249
 
251
- function getEnum (name) {
250
+ function getEnum(name) {
252
251
  switch (name) {
253
- default: throw new Error('Enum not found ' + name)
252
+ default:
253
+ throw new Error('Enum not found ' + name)
254
254
  }
255
255
  }
256
256
 
257
- function getEncoding (name) {
257
+ function getEncoding(name) {
258
258
  switch (name) {
259
- case '@media/dimensions': return encoding0
260
- case '@media/metadata': return encoding1
261
- case '@media/file': return encoding2
262
- case '@media/create-preview-request': return encoding3
263
- case '@media/create-preview-response': return encoding4
264
- case '@media/decode-image-request': return encoding5
265
- case '@media/decode-image-response': return encoding6
266
- default: throw new Error('Encoder not found ' + name)
259
+ case '@media/dimensions':
260
+ return encoding0
261
+ case '@media/metadata':
262
+ return encoding1
263
+ case '@media/file':
264
+ return encoding2
265
+ case '@media/create-preview-request':
266
+ return encoding3
267
+ case '@media/create-preview-response':
268
+ return encoding4
269
+ case '@media/decode-image-request':
270
+ return encoding5
271
+ case '@media/decode-image-response':
272
+ return encoding6
273
+ default:
274
+ throw new Error('Encoder not found ' + name)
267
275
  }
268
276
  }
269
277
 
270
- function getStruct (name, v = VERSION) {
278
+ function getStruct(name, v = VERSION) {
271
279
  const enc = getEncoding(name)
272
280
  return {
273
- preencode (state, m) {
281
+ preencode(state, m) {
274
282
  version = v
275
283
  enc.preencode(state, m)
276
284
  },
277
- encode (state, m) {
285
+ encode(state, m) {
278
286
  version = v
279
287
  enc.encode(state, m)
280
288
  },
281
- decode (state) {
289
+ decode(state) {
282
290
  version = v
283
291
  return enc.decode(state)
284
292
  }
@@ -287,4 +295,13 @@ function getStruct (name, v = VERSION) {
287
295
 
288
296
  const resolveStruct = getStruct // compat
289
297
 
290
- export { resolveStruct, getStruct, getEnum, getEncoding, encode, decode, setVersion, version }
298
+ export {
299
+ resolveStruct,
300
+ getStruct,
301
+ getEnum,
302
+ getEncoding,
303
+ encode,
304
+ decode,
305
+ setVersion,
306
+ version
307
+ }