@twin.org/core 0.0.1-next.46 → 0.0.1-next.48
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/cjs/index.cjs +2 -2
- package/dist/esm/index.mjs +2 -2
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/Coerce.md +2 -2
- package/docs/reference/classes/Compression.md +4 -4
- package/docs/reference/classes/Guards.md +2 -2
- package/docs/reference/classes/Is.md +4 -4
- package/docs/reference/classes/ObjectHelper.md +3 -3
- package/docs/reference/classes/Uint8ArrayHelper.md +1 -1
- package/docs/reference/classes/Validation.md +13 -13
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -4021,7 +4021,7 @@ class Compression {
|
|
|
4021
4021
|
const compressionStream = new CompressionStream(type);
|
|
4022
4022
|
const compressionPipe = blob.stream().pipeThrough(compressionStream);
|
|
4023
4023
|
const compressedBlob = await new Response(compressionPipe).blob();
|
|
4024
|
-
const compressedBytes = await compressedBlob.
|
|
4024
|
+
const compressedBytes = new Uint8Array(await compressedBlob.arrayBuffer());
|
|
4025
4025
|
// GZIP header contains a byte which specifies the OS the
|
|
4026
4026
|
// compression was performed on. We set this to 3 (Unix) to ensure
|
|
4027
4027
|
// that we produce consistent results.
|
|
@@ -4043,7 +4043,7 @@ class Compression {
|
|
|
4043
4043
|
const decompressionStream = new DecompressionStream(type);
|
|
4044
4044
|
const decompressionPipe = blob.stream().pipeThrough(decompressionStream);
|
|
4045
4045
|
const decompressedBlob = await new Response(decompressionPipe).blob();
|
|
4046
|
-
return decompressedBlob.bytes();
|
|
4046
|
+
return new Uint8Array(await decompressedBlob.bytes());
|
|
4047
4047
|
}
|
|
4048
4048
|
}
|
|
4049
4049
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4019,7 +4019,7 @@ class Compression {
|
|
|
4019
4019
|
const compressionStream = new CompressionStream(type);
|
|
4020
4020
|
const compressionPipe = blob.stream().pipeThrough(compressionStream);
|
|
4021
4021
|
const compressedBlob = await new Response(compressionPipe).blob();
|
|
4022
|
-
const compressedBytes = await compressedBlob.
|
|
4022
|
+
const compressedBytes = new Uint8Array(await compressedBlob.arrayBuffer());
|
|
4023
4023
|
// GZIP header contains a byte which specifies the OS the
|
|
4024
4024
|
// compression was performed on. We set this to 3 (Unix) to ensure
|
|
4025
4025
|
// that we produce consistent results.
|
|
@@ -4041,7 +4041,7 @@ class Compression {
|
|
|
4041
4041
|
const decompressionStream = new DecompressionStream(type);
|
|
4042
4042
|
const decompressionPipe = blob.stream().pipeThrough(decompressionStream);
|
|
4043
4043
|
const decompressedBlob = await new Response(decompressionPipe).blob();
|
|
4044
|
-
return decompressedBlob.bytes();
|
|
4044
|
+
return new Uint8Array(await decompressedBlob.bytes());
|
|
4045
4045
|
}
|
|
4046
4046
|
}
|
|
4047
4047
|
|
package/docs/changelog.md
CHANGED
|
@@ -254,7 +254,7 @@ TypeError If the value can not be coerced.
|
|
|
254
254
|
|
|
255
255
|
### uint8Array()
|
|
256
256
|
|
|
257
|
-
> `static` **uint8Array**(`value`): `undefined` \| `Uint8Array
|
|
257
|
+
> `static` **uint8Array**(`value`): `undefined` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
258
258
|
|
|
259
259
|
Coerce the value to a Uint8Array.
|
|
260
260
|
|
|
@@ -268,7 +268,7 @@ The value to coerce.
|
|
|
268
268
|
|
|
269
269
|
#### Returns
|
|
270
270
|
|
|
271
|
-
`undefined` \| `Uint8Array
|
|
271
|
+
`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>
|
|
272
272
|
|
|
273
273
|
The value if it can be coerced.
|
|
274
274
|
|
|
@@ -16,7 +16,7 @@ A class to handle compression.
|
|
|
16
16
|
|
|
17
17
|
### compress()
|
|
18
18
|
|
|
19
|
-
> `static` **compress**(`bytes`, `type`): `Promise`\<`Uint8Array
|
|
19
|
+
> `static` **compress**(`bytes`, `type`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
20
20
|
|
|
21
21
|
Compress bytes using GZIP.
|
|
22
22
|
|
|
@@ -36,7 +36,7 @@ The type of compression to use.
|
|
|
36
36
|
|
|
37
37
|
#### Returns
|
|
38
38
|
|
|
39
|
-
`Promise`\<`Uint8Array
|
|
39
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
40
40
|
|
|
41
41
|
The compressed bytes.
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ The compressed bytes.
|
|
|
44
44
|
|
|
45
45
|
### decompress()
|
|
46
46
|
|
|
47
|
-
> `static` **decompress**(`compressedBytes`, `type`): `Promise`\<`Uint8Array
|
|
47
|
+
> `static` **decompress**(`compressedBytes`, `type`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
48
48
|
|
|
49
49
|
Decompress a gzipped compressed byte array.
|
|
50
50
|
|
|
@@ -64,6 +64,6 @@ The type of compression to use.
|
|
|
64
64
|
|
|
65
65
|
#### Returns
|
|
66
66
|
|
|
67
|
-
`Promise`\<`Uint8Array
|
|
67
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
68
68
|
|
|
69
69
|
The decompressed bytes.
|
|
@@ -816,7 +816,7 @@ GuardError If the value does not match the assertion.
|
|
|
816
816
|
|
|
817
817
|
### uint8Array()
|
|
818
818
|
|
|
819
|
-
> `static` **uint8Array**(`source`, `property`, `value`): `asserts value is Uint8Array
|
|
819
|
+
> `static` **uint8Array**(`source`, `property`, `value`): `asserts value is Uint8Array<ArrayBufferLike>`
|
|
820
820
|
|
|
821
821
|
Is the property a Uint8Array.
|
|
822
822
|
|
|
@@ -842,7 +842,7 @@ The value to test.
|
|
|
842
842
|
|
|
843
843
|
#### Returns
|
|
844
844
|
|
|
845
|
-
`asserts value is Uint8Array
|
|
845
|
+
`asserts value is Uint8Array<ArrayBufferLike>`
|
|
846
846
|
|
|
847
847
|
#### Throws
|
|
848
848
|
|
|
@@ -676,7 +676,7 @@ True if the value is an element from the options array.
|
|
|
676
676
|
|
|
677
677
|
### uint8Array()
|
|
678
678
|
|
|
679
|
-
> `static` **uint8Array**(`value`): `value is Uint8Array
|
|
679
|
+
> `static` **uint8Array**(`value`): `value is Uint8Array<ArrayBufferLike>`
|
|
680
680
|
|
|
681
681
|
Is the value a Uint8Array.
|
|
682
682
|
|
|
@@ -690,7 +690,7 @@ The value to test.
|
|
|
690
690
|
|
|
691
691
|
#### Returns
|
|
692
692
|
|
|
693
|
-
`value is Uint8Array
|
|
693
|
+
`value is Uint8Array<ArrayBufferLike>`
|
|
694
694
|
|
|
695
695
|
True if the value is a Uint8Array.
|
|
696
696
|
|
|
@@ -698,7 +698,7 @@ True if the value is a Uint8Array.
|
|
|
698
698
|
|
|
699
699
|
### typedArray()
|
|
700
700
|
|
|
701
|
-
> `static` **typedArray**(`value`): value is Int8Array \| Uint8Array \| Int16Array \| Uint16Array \| Int32Array \| Uint32Array \| Float32Array \| Float64Array
|
|
701
|
+
> `static` **typedArray**(`value`): value is Int8Array\<ArrayBufferLike\> \| Uint8Array\<ArrayBufferLike\> \| Int16Array\<ArrayBufferLike\> \| Uint16Array\<ArrayBufferLike\> \| Int32Array\<ArrayBufferLike\> \| Uint32Array\<ArrayBufferLike\> \| Float32Array\<ArrayBufferLike\> \| Float64Array\<ArrayBufferLike\>
|
|
702
702
|
|
|
703
703
|
Is the value a TypedArray.
|
|
704
704
|
|
|
@@ -712,7 +712,7 @@ The value to test.
|
|
|
712
712
|
|
|
713
713
|
#### Returns
|
|
714
714
|
|
|
715
|
-
value is Int8Array \| Uint8Array \| Int16Array \| Uint16Array \| Int32Array \| Uint32Array \| Float32Array \| Float64Array
|
|
715
|
+
value is Int8Array\<ArrayBufferLike\> \| Uint8Array\<ArrayBufferLike\> \| Int16Array\<ArrayBufferLike\> \| Uint16Array\<ArrayBufferLike\> \| Int32Array\<ArrayBufferLike\> \| Uint32Array\<ArrayBufferLike\> \| Float32Array\<ArrayBufferLike\> \| Float64Array\<ArrayBufferLike\>
|
|
716
716
|
|
|
717
717
|
True if the value is a TypedArray.
|
|
718
718
|
|
|
@@ -62,7 +62,7 @@ Convert a bytes to an object.
|
|
|
62
62
|
|
|
63
63
|
The bytes to convert to an object.
|
|
64
64
|
|
|
65
|
-
`undefined` | `null` | `Uint8Array
|
|
65
|
+
`undefined` | `null` | `Uint8Array`\<`ArrayBufferLike`\>
|
|
66
66
|
|
|
67
67
|
#### Returns
|
|
68
68
|
|
|
@@ -436,13 +436,13 @@ The object to remove the empty properties from.
|
|
|
436
436
|
|
|
437
437
|
The options for the removal.
|
|
438
438
|
|
|
439
|
-
###### removeUndefined
|
|
439
|
+
###### removeUndefined?
|
|
440
440
|
|
|
441
441
|
`boolean`
|
|
442
442
|
|
|
443
443
|
Remove undefined properties, defaults to true.
|
|
444
444
|
|
|
445
|
-
###### removeNull
|
|
445
|
+
###### removeNull?
|
|
446
446
|
|
|
447
447
|
`boolean`
|
|
448
448
|
|
|
@@ -130,19 +130,19 @@ Optional i18n resource of the field name to display in the message.
|
|
|
130
130
|
|
|
131
131
|
Additional options for the validation.
|
|
132
132
|
|
|
133
|
-
###### format
|
|
133
|
+
###### format?
|
|
134
134
|
|
|
135
135
|
`RegExp` \| `"base64"` \| `"base58"` \| `"hex"`
|
|
136
136
|
|
|
137
137
|
Specific format to check.
|
|
138
138
|
|
|
139
|
-
###### minLength
|
|
139
|
+
###### minLength?
|
|
140
140
|
|
|
141
141
|
`number`
|
|
142
142
|
|
|
143
143
|
The minimum length of the string.
|
|
144
144
|
|
|
145
|
-
###### maxLength
|
|
145
|
+
###### maxLength?
|
|
146
146
|
|
|
147
147
|
`number`
|
|
148
148
|
|
|
@@ -192,13 +192,13 @@ Optional i18n resource of the field name to display in the message.
|
|
|
192
192
|
|
|
193
193
|
Additional options for the validation.
|
|
194
194
|
|
|
195
|
-
###### minLength
|
|
195
|
+
###### minLength?
|
|
196
196
|
|
|
197
197
|
`number`
|
|
198
198
|
|
|
199
199
|
The minimum length of the string.
|
|
200
200
|
|
|
201
|
-
###### maxLength
|
|
201
|
+
###### maxLength?
|
|
202
202
|
|
|
203
203
|
`number`
|
|
204
204
|
|
|
@@ -248,13 +248,13 @@ Optional i18n resource of the field name to display in the message.
|
|
|
248
248
|
|
|
249
249
|
Additional options for the validation.
|
|
250
250
|
|
|
251
|
-
###### minValue
|
|
251
|
+
###### minValue?
|
|
252
252
|
|
|
253
253
|
`number`
|
|
254
254
|
|
|
255
255
|
The minimum value of the number.
|
|
256
256
|
|
|
257
|
-
###### maxValue
|
|
257
|
+
###### maxValue?
|
|
258
258
|
|
|
259
259
|
`number`
|
|
260
260
|
|
|
@@ -304,13 +304,13 @@ Optional i18n resource of the field name to display in the message.
|
|
|
304
304
|
|
|
305
305
|
Additional options for the validation.
|
|
306
306
|
|
|
307
|
-
###### minValue
|
|
307
|
+
###### minValue?
|
|
308
308
|
|
|
309
309
|
`number`
|
|
310
310
|
|
|
311
311
|
The minimum value of the integer.
|
|
312
312
|
|
|
313
|
-
###### maxValue
|
|
313
|
+
###### maxValue?
|
|
314
314
|
|
|
315
315
|
`number`
|
|
316
316
|
|
|
@@ -360,13 +360,13 @@ Optional i18n resource of the field name to display in the message.
|
|
|
360
360
|
|
|
361
361
|
Additional options for the validation.
|
|
362
362
|
|
|
363
|
-
###### minValue
|
|
363
|
+
###### minValue?
|
|
364
364
|
|
|
365
365
|
`bigint`
|
|
366
366
|
|
|
367
367
|
The minimum value of the bigint.
|
|
368
368
|
|
|
369
|
-
###### maxValue
|
|
369
|
+
###### maxValue?
|
|
370
370
|
|
|
371
371
|
`bigint`
|
|
372
372
|
|
|
@@ -844,7 +844,7 @@ True if the value is one of the items in the options.
|
|
|
844
844
|
|
|
845
845
|
### uint8Array()
|
|
846
846
|
|
|
847
|
-
> `static` **uint8Array**(`property`, `value`, `failures`, `fieldNameResource`?): `value is Uint8Array
|
|
847
|
+
> `static` **uint8Array**(`property`, `value`, `failures`, `fieldNameResource`?): `value is Uint8Array<ArrayBufferLike>`
|
|
848
848
|
|
|
849
849
|
Is the property a Uint8Array.
|
|
850
850
|
|
|
@@ -876,7 +876,7 @@ Optional i18n resource of the field name to display in the message.
|
|
|
876
876
|
|
|
877
877
|
#### Returns
|
|
878
878
|
|
|
879
|
-
`value is Uint8Array
|
|
879
|
+
`value is Uint8Array<ArrayBufferLike>`
|
|
880
880
|
|
|
881
881
|
True if the value is a Uint8Array.
|
|
882
882
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/core",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.48",
|
|
4
4
|
"description": "Helper methods/classes for data type checking/validation/guarding/error handling",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/nameof": "next",
|
|
18
|
-
"intl-messageformat": "10.7.
|
|
18
|
+
"intl-messageformat": "10.7.15",
|
|
19
19
|
"rfc6902": "5.1.2"
|
|
20
20
|
},
|
|
21
21
|
"main": "./dist/cjs/index.cjs",
|