@basmilius/apple-encoding 0.3.3 → 0.4.1

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/dist/index.js CHANGED
@@ -68,50 +68,112 @@ function encode(fields) {
68
68
  // src/opack.ts
69
69
  var exports_opack = {};
70
70
  __export(exports_opack, {
71
- sizedInt: () => sizedInt,
71
+ sizedInteger: () => sizedInteger,
72
72
  int: () => int,
73
73
  float: () => float,
74
74
  encode: () => encode2,
75
75
  decode: () => decode2
76
76
  });
77
+ var TAG = {
78
+ TRUE: 1,
79
+ FALSE: 2,
80
+ TERMINATOR: 3,
81
+ NULL: 4,
82
+ UUID: 5,
83
+ TIMESTAMP: 6,
84
+ INT_BASE: 8,
85
+ INT_INLINE_MAX_VALUE: 39,
86
+ INT_MAX_INLINE: 47,
87
+ INT_1BYTE: 48,
88
+ INT_2BYTE: 49,
89
+ INT_4BYTE: 50,
90
+ INT_8BYTE: 51,
91
+ FLOAT32: 53,
92
+ FLOAT64: 54,
93
+ STR_BASE: 64,
94
+ STR_MAX_INLINE: 96,
95
+ STR_1BYTE_LEN: 97,
96
+ STR_2BYTE_LEN: 98,
97
+ STR_3BYTE_LEN: 99,
98
+ STR_4BYTE_LEN: 100,
99
+ BYTES_BASE: 112,
100
+ BYTES_MAX_INLINE: 144,
101
+ BYTES_1BYTE_LEN: 145,
102
+ BYTES_2BYTE_LEN: 146,
103
+ BYTES_4BYTE_LEN: 147,
104
+ REF_BASE: 160,
105
+ REF_MAX_INLINE: 192,
106
+ REF_1BYTE: 193,
107
+ REF_2BYTE: 194,
108
+ REF_4BYTE: 195,
109
+ REF_8BYTE: 196,
110
+ ARRAY_BASE: 208,
111
+ ARRAY_VARIABLE: 223,
112
+ DICT_BASE: 224,
113
+ DICT_VARIABLE: 239,
114
+ DICT_TERMINATOR: 129
115
+ };
77
116
 
78
- class OPackSizedInt extends Number {
79
- size;
80
- constructor(value, size) {
81
- super(value);
82
- this.size = size;
117
+ class Float {
118
+ get value() {
119
+ return this.#value;
83
120
  }
84
- }
85
-
86
- class OPackFloat {
87
- value;
121
+ #value;
88
122
  constructor(value) {
89
- this.value = value;
123
+ this.#value = value;
90
124
  }
91
125
  }
92
126
 
93
- class OPackInteger {
94
- value;
127
+ class Integer {
128
+ get value() {
129
+ return this.#value;
130
+ }
131
+ #value;
95
132
  constructor(value) {
96
- this.value = value;
133
+ this.#value = value;
97
134
  }
98
135
  }
99
- function sizedInt(value, size) {
100
- return new OPackSizedInt(value, size);
136
+
137
+ class SizedInteger {
138
+ get size() {
139
+ return this.#size;
140
+ }
141
+ get value() {
142
+ return this.#value;
143
+ }
144
+ #size;
145
+ #value;
146
+ constructor(value, size) {
147
+ this.#size = size;
148
+ this.#value = value;
149
+ }
150
+ valueOf() {
151
+ return this.#value;
152
+ }
101
153
  }
102
154
  function float(value) {
103
- return new OPackFloat(value);
155
+ return new Float(value);
104
156
  }
105
157
  function int(value) {
106
- return new OPackInteger(value);
158
+ return new Integer(value);
159
+ }
160
+ function sizedInteger(value, size) {
161
+ return new SizedInteger(value, size);
162
+ }
163
+ function decode2(data) {
164
+ const [value] = _unpack(data, []);
165
+ return value;
166
+ }
167
+ function encode2(data) {
168
+ return _pack(data, []);
107
169
  }
108
- function concat(arr) {
109
- const total = arr.reduce((s, a) => s + a.length, 0);
170
+ function concat(arrays) {
171
+ const total = arrays.reduce((sum, a) => sum + a.length, 0);
110
172
  const out = new Uint8Array(total);
111
- let off = 0;
112
- for (const a of arr) {
113
- out.set(a, off);
114
- off += a.length;
173
+ let offset = 0;
174
+ for (const a of arrays) {
175
+ out.set(a, offset);
176
+ offset += a.length;
115
177
  }
116
178
  return out;
117
179
  }
@@ -127,93 +189,99 @@ function uintToLEBytes(value, byteLen) {
127
189
  }
128
190
  return out;
129
191
  }
130
- function concatUint8Arrays(arrays) {
131
- const total = arrays.reduce((sum, a) => sum + a.length, 0);
132
- const out = new Uint8Array(total);
133
- let offset = 0;
134
- for (const a of arrays) {
135
- out.set(a, offset);
136
- offset += a.length;
192
+ function ensureAvailable(buf, need) {
193
+ if (buf.length < need) {
194
+ throw new TypeError(`Not enough data: need ${need} bytes, have ${buf.length}`);
137
195
  }
138
- return out;
139
196
  }
140
- function encode2(data) {
141
- return _pack(data, []);
197
+ function readLittleEndian(buf, offset, len) {
198
+ ensureAvailable(buf.subarray(offset), len);
199
+ let v = 0n;
200
+ for (let i = len - 1;i >= 0; i--) {
201
+ v = v << 8n | BigInt(buf[offset + i]);
202
+ }
203
+ return Number(v);
142
204
  }
143
205
  function _pack(data, objectList) {
144
206
  let packed = null;
145
- if (data === null || data === undefined)
146
- packed = u8(4);
147
- else if (typeof data === "boolean")
148
- packed = u8(data ? 1 : 2);
149
- else if (data instanceof OPackFloat) {
207
+ if (data === null || data === undefined) {
208
+ packed = u8(TAG.NULL);
209
+ } else if (typeof data === "boolean") {
210
+ packed = u8(data ? TAG.TRUE : TAG.FALSE);
211
+ } else if (data instanceof Float) {
150
212
  const buf = new ArrayBuffer(8);
151
213
  new DataView(buf).setFloat64(0, data.value, true);
152
- packed = concat([u8(54), new Uint8Array(buf)]);
153
- } else if (data instanceof OPackInteger) {
214
+ packed = concat([u8(TAG.FLOAT64), new Uint8Array(buf)]);
215
+ } else if (data instanceof Integer) {
154
216
  const val = data.value;
155
- if (val < 40)
156
- packed = u8(8 + val);
157
- else if (val <= 255)
158
- packed = concatUint8Arrays([u8(48), uintToLEBytes(val, 1)]);
159
- else if (val <= 65535)
160
- packed = concatUint8Arrays([u8(49), uintToLEBytes(val, 2)]);
161
- else if (val <= 4294967295)
162
- packed = concatUint8Arrays([u8(50), uintToLEBytes(val, 4)]);
163
- else
164
- packed = concatUint8Arrays([u8(51), uintToLEBytes(val, 8)]);
217
+ if (val <= TAG.INT_INLINE_MAX_VALUE) {
218
+ packed = u8(TAG.INT_BASE + val);
219
+ } else if (val <= 255) {
220
+ packed = concat([u8(TAG.INT_1BYTE), uintToLEBytes(val, 1)]);
221
+ } else if (val <= 65535) {
222
+ packed = concat([u8(TAG.INT_2BYTE), uintToLEBytes(val, 2)]);
223
+ } else if (val <= 4294967295) {
224
+ packed = concat([u8(TAG.INT_4BYTE), uintToLEBytes(val, 4)]);
225
+ } else {
226
+ packed = concat([u8(TAG.INT_8BYTE), uintToLEBytes(val, 8)]);
227
+ }
165
228
  } else if (typeof data === "number") {
166
229
  if (!Number.isInteger(data)) {
167
230
  const buf = new ArrayBuffer(8);
168
231
  new DataView(buf).setFloat64(0, data, true);
169
- packed = concat([u8(54), new Uint8Array(buf)]);
232
+ packed = concat([u8(TAG.FLOAT64), new Uint8Array(buf)]);
170
233
  } else {
171
- if (data < 40)
172
- packed = u8(8 + data);
173
- else if (data <= 255)
174
- packed = concat([u8(48), uintToLEBytes(data, 1)]);
175
- else if (data <= 65535)
176
- packed = concat([u8(49), uintToLEBytes(data, 2)]);
177
- else if (data <= 4294967295)
178
- packed = concat([u8(50), uintToLEBytes(data, 4)]);
179
- else
180
- packed = concat([u8(51), uintToLEBytes(data, 8)]);
234
+ if (data <= TAG.INT_INLINE_MAX_VALUE) {
235
+ packed = u8(TAG.INT_BASE + data);
236
+ } else if (data <= 255) {
237
+ packed = concat([u8(TAG.INT_1BYTE), uintToLEBytes(data, 1)]);
238
+ } else if (data <= 65535) {
239
+ packed = concat([u8(TAG.INT_2BYTE), uintToLEBytes(data, 2)]);
240
+ } else if (data <= 4294967295) {
241
+ packed = concat([u8(TAG.INT_4BYTE), uintToLEBytes(data, 4)]);
242
+ } else {
243
+ packed = concat([u8(TAG.INT_8BYTE), uintToLEBytes(data, 8)]);
244
+ }
181
245
  }
182
- } else if (data instanceof OPackSizedInt) {
183
- packed = concat([u8(48 + Math.log2(data.size)), uintToLEBytes(data.valueOf(), data.size)]);
246
+ } else if (data instanceof SizedInteger) {
247
+ packed = concat([u8(TAG.INT_1BYTE + Math.log2(data.size)), uintToLEBytes(data.valueOf(), data.size)]);
184
248
  } else if (typeof data === "string") {
185
249
  const b = new TextEncoder().encode(data);
186
250
  const len = b.length;
187
- if (len <= 32)
188
- packed = concat([u8(64 + len), b]);
189
- else if (len <= 255)
190
- packed = concat([u8(97), uintToLEBytes(len, 1), b]);
191
- else if (len <= 65535)
192
- packed = concat([u8(98), uintToLEBytes(len, 2), b]);
193
- else if (len <= 16777215)
194
- packed = concat([u8(99), uintToLEBytes(len, 3), b]);
195
- else
196
- packed = concat([u8(100), uintToLEBytes(len, 4), b]);
251
+ if (len <= 32) {
252
+ packed = concat([u8(TAG.STR_BASE + len), b]);
253
+ } else if (len <= 255) {
254
+ packed = concat([u8(TAG.STR_1BYTE_LEN), uintToLEBytes(len, 1), b]);
255
+ } else if (len <= 65535) {
256
+ packed = concat([u8(TAG.STR_2BYTE_LEN), uintToLEBytes(len, 2), b]);
257
+ } else if (len <= 16777215) {
258
+ packed = concat([u8(TAG.STR_3BYTE_LEN), uintToLEBytes(len, 3), b]);
259
+ } else {
260
+ packed = concat([u8(TAG.STR_4BYTE_LEN), uintToLEBytes(len, 4), b]);
261
+ }
197
262
  } else if (data instanceof Uint8Array || Buffer.isBuffer(data)) {
198
263
  const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
199
264
  const len = bytes.length;
200
- if (len <= 32)
201
- packed = concat([u8(112 + len), bytes]);
202
- else if (len <= 255)
203
- packed = concat([u8(145), uintToLEBytes(len, 1), bytes]);
204
- else if (len <= 65535)
205
- packed = concat([u8(146), uintToLEBytes(len, 2), bytes]);
206
- else
207
- packed = concat([u8(147), uintToLEBytes(len, 4), bytes]);
265
+ if (len <= 32) {
266
+ packed = concat([u8(TAG.BYTES_BASE + len), bytes]);
267
+ } else if (len <= 255) {
268
+ packed = concat([u8(TAG.BYTES_1BYTE_LEN), uintToLEBytes(len, 1), bytes]);
269
+ } else if (len <= 65535) {
270
+ packed = concat([u8(TAG.BYTES_2BYTE_LEN), uintToLEBytes(len, 2), bytes]);
271
+ } else {
272
+ packed = concat([u8(TAG.BYTES_4BYTE_LEN), uintToLEBytes(len, 4), bytes]);
273
+ }
208
274
  } else if (Array.isArray(data)) {
209
275
  const body = concat(data.map((d) => _pack(d, objectList)));
210
276
  const len = data.length;
211
277
  if (len <= 15) {
212
- packed = concat([u8(208 + len), body]);
213
- if (len >= 15)
214
- packed = concat([packed, u8(3)]);
215
- } else
216
- packed = concat([u8(223), body, u8(3)]);
278
+ packed = concat([u8(TAG.ARRAY_BASE + len), body]);
279
+ if (len >= 15) {
280
+ packed = concat([packed, u8(TAG.TERMINATOR)]);
281
+ }
282
+ } else {
283
+ packed = concat([u8(TAG.ARRAY_VARIABLE), body, u8(TAG.TERMINATOR)]);
284
+ }
217
285
  } else if (typeof data === "object") {
218
286
  const keys = Object.keys(data);
219
287
  const len = keys.length;
@@ -224,47 +292,35 @@ function _pack(data, objectList) {
224
292
  }
225
293
  let header;
226
294
  if (len <= 15) {
227
- header = u8(224 + len);
295
+ header = u8(TAG.DICT_BASE + len);
228
296
  } else {
229
- header = u8(239);
297
+ header = u8(TAG.DICT_VARIABLE);
230
298
  }
231
- packed = concatUint8Arrays([header, concatUint8Arrays(pairs)]);
299
+ packed = concat([header, concat(pairs)]);
232
300
  if (len >= 15 || objectList.some((v) => v === packed)) {
233
- packed = concatUint8Arrays([packed, u8(129)]);
301
+ packed = concat([packed, u8(TAG.DICT_TERMINATOR)]);
234
302
  }
235
- } else
303
+ } else {
236
304
  throw new TypeError(typeof data + "");
305
+ }
237
306
  const idx = objectList.findIndex((v) => v.length === packed.length && v.every((x, i) => x === packed[i]));
238
307
  if (idx >= 0) {
239
- if (idx < 33)
240
- packed = u8(160 + idx);
241
- else if (idx <= 255)
242
- packed = concat([u8(193), uintToLEBytes(idx, 1)]);
243
- else if (idx <= 65535)
244
- packed = concat([u8(194), uintToLEBytes(idx, 2)]);
245
- else if (idx <= 4294967295)
246
- packed = concat([u8(195), uintToLEBytes(idx, 4)]);
247
- else
248
- packed = concat([u8(196), uintToLEBytes(idx, 8)]);
249
- } else if (packed.length > 1)
308
+ if (idx < 33) {
309
+ packed = u8(TAG.REF_BASE + idx);
310
+ } else if (idx <= 255) {
311
+ packed = concat([u8(TAG.REF_1BYTE), uintToLEBytes(idx, 1)]);
312
+ } else if (idx <= 65535) {
313
+ packed = concat([u8(TAG.REF_2BYTE), uintToLEBytes(idx, 2)]);
314
+ } else if (idx <= 4294967295) {
315
+ packed = concat([u8(TAG.REF_4BYTE), uintToLEBytes(idx, 4)]);
316
+ } else {
317
+ packed = concat([u8(TAG.REF_8BYTE), uintToLEBytes(idx, 8)]);
318
+ }
319
+ } else if (packed.length > 1) {
250
320
  objectList.push(packed);
321
+ }
251
322
  return packed;
252
323
  }
253
- function decode2(data) {
254
- const [value] = _unpack(data, []);
255
- return value;
256
- }
257
- function ensureAvailable(buf, need) {
258
- if (buf.length < need)
259
- throw new TypeError(`Not enough data: need ${need} bytes, have ${buf.length}`);
260
- }
261
- function readLittleEndian(buf, offset, len) {
262
- ensureAvailable(buf.subarray(offset), len);
263
- let v = 0n;
264
- for (let i = len - 1;i >= 0; i--)
265
- v = v << 8n | BigInt(buf[offset + i]);
266
- return Number(v);
267
- }
268
324
  function _unpack(data, objectList) {
269
325
  if (data.length === 0)
270
326
  throw new TypeError("No data to unpack");
@@ -272,62 +328,62 @@ function _unpack(data, objectList) {
272
328
  let addToObjectList = true;
273
329
  let value;
274
330
  let rest;
275
- if (tag === 1) {
331
+ if (tag === TAG.TRUE) {
276
332
  value = true;
277
333
  rest = data.subarray(1);
278
- } else if (tag === 2) {
334
+ } else if (tag === TAG.FALSE) {
279
335
  value = false;
280
336
  rest = data.subarray(1);
281
- } else if (tag === 4) {
337
+ } else if (tag === TAG.NULL) {
282
338
  value = null;
283
339
  rest = data.subarray(1);
284
- } else if (tag === 5) {
340
+ } else if (tag === TAG.UUID) {
285
341
  value = data.subarray(1, 17);
286
342
  rest = data.subarray(17);
287
- } else if (tag === 6) {
343
+ } else if (tag === TAG.TIMESTAMP) {
288
344
  value = readLittleEndian(data, 1, 8);
289
345
  rest = data.subarray(9);
290
- } else if (tag >= 8 && tag <= 47) {
291
- value = tag - 8;
346
+ } else if (tag >= TAG.INT_BASE && tag <= TAG.INT_MAX_INLINE) {
347
+ value = tag - TAG.INT_BASE;
292
348
  rest = data.subarray(1);
293
- } else if (tag === 53) {
349
+ } else if (tag === TAG.FLOAT32) {
294
350
  const view = new DataView(data.buffer, data.byteOffset + 1, 4);
295
351
  value = view.getFloat32(0, true);
296
352
  rest = data.subarray(5);
297
- } else if (tag === 54) {
353
+ } else if (tag === TAG.FLOAT64) {
298
354
  const view = new DataView(data.buffer, data.byteOffset + 1, 8);
299
355
  value = view.getFloat64(0, true);
300
356
  rest = data.subarray(9);
301
- } else if ((tag & 240) === 48) {
357
+ } else if ((tag & 240) === TAG.INT_1BYTE) {
302
358
  const noOfBytes = 2 ** (tag & 15);
303
359
  const val = readLittleEndian(data, 1, noOfBytes);
304
- value = sizedInt(val, noOfBytes);
360
+ value = sizedInteger(val, noOfBytes);
305
361
  rest = data.subarray(1 + noOfBytes);
306
- } else if (tag >= 64 && tag <= 96) {
307
- const length = tag - 64;
362
+ } else if (tag >= TAG.STR_BASE && tag <= TAG.STR_MAX_INLINE) {
363
+ const length = tag - TAG.STR_BASE;
308
364
  value = new TextDecoder().decode(data.subarray(1, 1 + length));
309
365
  rest = data.subarray(1 + length);
310
- } else if (tag >= 97 && tag <= 100) {
366
+ } else if (tag >= TAG.STR_1BYTE_LEN && tag <= TAG.STR_4BYTE_LEN) {
311
367
  const lenBytes = tag & 15;
312
368
  const length = readLittleEndian(data, 1, lenBytes);
313
369
  value = new TextDecoder().decode(data.subarray(1 + lenBytes, 1 + lenBytes + length));
314
370
  rest = data.subarray(1 + lenBytes + length);
315
- } else if (tag >= 112 && tag <= 144) {
316
- const length = tag - 112;
371
+ } else if (tag >= TAG.BYTES_BASE && tag <= TAG.BYTES_MAX_INLINE) {
372
+ const length = tag - TAG.BYTES_BASE;
317
373
  value = data.subarray(1, 1 + length);
318
374
  rest = data.subarray(1 + length);
319
- } else if (tag >= 145 && tag <= 148) {
375
+ } else if (tag >= TAG.BYTES_1BYTE_LEN && tag <= TAG.BYTES_4BYTE_LEN) {
320
376
  const noOfBytes = 1 << (tag & 15) - 1;
321
377
  const length = readLittleEndian(data, 1, noOfBytes);
322
378
  const start = 1 + noOfBytes;
323
379
  value = data.subarray(start, start + length);
324
380
  rest = data.subarray(start + length);
325
- } else if ((tag & 240) === 208) {
381
+ } else if ((tag & 240) === TAG.ARRAY_BASE) {
326
382
  const count = tag & 15;
327
383
  let ptr = data.subarray(1);
328
384
  const arr = [];
329
385
  if (count === 15) {
330
- while (ptr[0] !== 3) {
386
+ while (ptr[0] !== TAG.TERMINATOR) {
331
387
  const [v, r] = _unpack(ptr, objectList);
332
388
  arr.push(v);
333
389
  ptr = r;
@@ -343,12 +399,12 @@ function _unpack(data, objectList) {
343
399
  value = arr;
344
400
  rest = ptr;
345
401
  addToObjectList = false;
346
- } else if ((tag & 224) === 224) {
402
+ } else if ((tag & 240) === TAG.DICT_BASE) {
347
403
  const count = tag & 15;
348
- let ptr = data.subarray(1);
349
404
  const obj = {};
405
+ let ptr = data.subarray(1);
350
406
  if (count === 15) {
351
- while (ptr[0] !== 3) {
407
+ while (ptr[0] !== TAG.TERMINATOR) {
352
408
  const [k, r1] = _unpack(ptr, objectList);
353
409
  const [v, r2] = _unpack(r1, objectList);
354
410
  obj[k] = v;
@@ -366,26 +422,29 @@ function _unpack(data, objectList) {
366
422
  value = obj;
367
423
  rest = ptr;
368
424
  addToObjectList = false;
369
- } else if (tag >= 160 && tag <= 192) {
370
- const idx = tag - 160;
371
- if (idx >= objectList.length)
425
+ } else if (tag >= TAG.REF_BASE && tag <= TAG.REF_MAX_INLINE) {
426
+ const idx = tag - TAG.REF_BASE;
427
+ if (idx >= objectList.length) {
372
428
  throw new TypeError(`Reference index ${idx} out of range`);
429
+ }
373
430
  value = objectList[idx];
374
431
  rest = data.subarray(1);
375
432
  addToObjectList = false;
376
- } else if (tag >= 193 && tag <= 196) {
377
- const len = tag - 192;
433
+ } else if (tag >= TAG.REF_1BYTE && tag <= TAG.REF_8BYTE) {
434
+ const len = tag - TAG.REF_MAX_INLINE;
378
435
  const uid = readLittleEndian(data, 1, len);
379
- if (uid >= objectList.length)
436
+ if (uid >= objectList.length) {
380
437
  throw new TypeError(`UID ${uid} out of range`);
438
+ }
381
439
  value = objectList[uid];
382
440
  rest = data.subarray(1 + len);
383
441
  addToObjectList = false;
384
442
  } else {
385
443
  throw new TypeError(`Unknown tag 0x${tag.toString(16)}`);
386
444
  }
387
- if (addToObjectList)
445
+ if (addToObjectList) {
388
446
  objectList.push(value);
447
+ }
389
448
  return [value, rest];
390
449
  }
391
450
  // src/plist.ts
package/dist/ntp.d.ts CHANGED
@@ -4,14 +4,14 @@ export declare function parts(ntp: bigint): [number, number];
4
4
  export declare function decode(buffer: Buffer): PacketFields;
5
5
  export declare function encode(fields: PacketFields): Buffer;
6
6
  export type PacketFields = {
7
- proto: number;
8
- type: number;
9
- seqno: number;
10
- padding: number;
11
- reftime_sec: number;
12
- reftime_frac: number;
13
- recvtime_sec: number;
14
- recvtime_frac: number;
15
- sendtime_sec: number;
16
- sendtime_frac: number;
7
+ readonly proto: number;
8
+ readonly type: number;
9
+ readonly seqno: number;
10
+ readonly padding: number;
11
+ readonly reftime_sec: number;
12
+ readonly reftime_frac: number;
13
+ readonly recvtime_sec: number;
14
+ readonly recvtime_frac: number;
15
+ readonly sendtime_sec: number;
16
+ readonly sendtime_frac: number;
17
17
  };
package/dist/opack.d.ts CHANGED
@@ -1,10 +1,23 @@
1
- declare class OPackSizedInt extends Number {
2
- size: number;
1
+ declare class Float {
2
+ #private;
3
+ get value(): number;
4
+ constructor(value: number);
5
+ }
6
+ declare class Integer {
7
+ #private;
8
+ get value(): number;
9
+ constructor(value: number);
10
+ }
11
+ declare class SizedInteger {
12
+ #private;
13
+ get size(): number;
14
+ get value(): number;
3
15
  constructor(value: number, size: number);
16
+ valueOf(): number;
4
17
  }
5
- export declare function sizedInt(value: number, size: number): OPackSizedInt;
6
- export declare function float(value: number);
7
- export declare function int(value: number);
8
- export declare function encode(data: any): Uint8Array;
18
+ export declare function float(value: number): Float;
19
+ export declare function int(value: number): Integer;
20
+ export declare function sizedInteger(value: number, size: number): SizedInteger;
9
21
  export declare function decode(data: Uint8Array): any;
22
+ export declare function encode(data: any): Uint8Array;
10
23
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-encoding",
3
3
  "description": "Common encoding utilities for Apple Protocols.",
4
- "version": "0.3.3",
4
+ "version": "0.4.1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {