@twin.org/core 0.0.4-next.8 → 0.9.0-next.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/es/encoding/base64.js +1 -1
- package/dist/es/encoding/base64.js.map +1 -1
- package/dist/es/errors/conflictError.js +1 -1
- package/dist/es/errors/conflictError.js.map +1 -1
- package/dist/es/errors/generalError.js +1 -1
- package/dist/es/errors/generalError.js.map +1 -1
- package/dist/es/errors/notImplementedError.js +1 -1
- package/dist/es/errors/notImplementedError.js.map +1 -1
- package/dist/es/errors/validationError.js +1 -1
- package/dist/es/errors/validationError.js.map +1 -1
- package/dist/es/helpers/arrayHelper.js +1 -1
- package/dist/es/helpers/arrayHelper.js.map +1 -1
- package/dist/es/helpers/errorHelper.js +1 -1
- package/dist/es/helpers/errorHelper.js.map +1 -1
- package/dist/es/helpers/jsonHelper.js +1 -1
- package/dist/es/helpers/jsonHelper.js.map +1 -1
- package/dist/es/helpers/objectHelper.js +2 -2
- package/dist/es/helpers/objectHelper.js.map +1 -1
- package/dist/es/helpers/stringHelper.js +2 -2
- package/dist/es/helpers/stringHelper.js.map +1 -1
- package/dist/es/index.js +7 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IComponent.js.map +1 -1
- package/dist/es/models/IDuration.js +4 -0
- package/dist/es/models/IDuration.js.map +1 -0
- package/dist/es/models/ILocale.js.map +1 -1
- package/dist/es/models/ISharedObjectBufferOptions.js +4 -0
- package/dist/es/models/ISharedObjectBufferOptions.js.map +1 -0
- package/dist/es/models/ISharedObjectBufferWorkerMessage.js +2 -0
- package/dist/es/models/ISharedObjectBufferWorkerMessage.js.map +1 -0
- package/dist/es/models/IValidationFailure.js.map +1 -1
- package/dist/es/models/coerceType.js +5 -1
- package/dist/es/models/coerceType.js.map +1 -1
- package/dist/es/models/sharedObjectBufferMessageTypes.js +13 -0
- package/dist/es/models/sharedObjectBufferMessageTypes.js.map +1 -0
- package/dist/es/types/duration.js +184 -0
- package/dist/es/types/duration.js.map +1 -0
- package/dist/es/types/durationRegExp.js +4 -0
- package/dist/es/types/durationRegExp.js.map +1 -0
- package/dist/es/types/url.js +1 -0
- package/dist/es/types/url.js.map +1 -1
- package/dist/es/utils/asyncCache.js +1 -1
- package/dist/es/utils/asyncCache.js.map +1 -1
- package/dist/es/utils/coerce.js +34 -20
- package/dist/es/utils/coerce.js.map +1 -1
- package/dist/es/utils/compression.js +1 -1
- package/dist/es/utils/compression.js.map +1 -1
- package/dist/es/utils/guards.js +12 -0
- package/dist/es/utils/guards.js.map +1 -1
- package/dist/es/utils/is.js +65 -16
- package/dist/es/utils/is.js.map +1 -1
- package/dist/es/utils/mutex.js +49 -8
- package/dist/es/utils/mutex.js.map +1 -1
- package/dist/es/utils/sharedObjectBuffer.js +308 -0
- package/dist/es/utils/sharedObjectBuffer.js.map +1 -0
- package/dist/es/utils/sharedStore.js +2 -2
- package/dist/es/utils/sharedStore.js.map +1 -1
- package/dist/types/errors/conflictError.d.ts +1 -1
- package/dist/types/errors/generalError.d.ts +1 -1
- package/dist/types/errors/notImplementedError.d.ts +1 -1
- package/dist/types/errors/validationError.d.ts +1 -1
- package/dist/types/helpers/arrayHelper.d.ts +1 -1
- package/dist/types/helpers/errorHelper.d.ts +1 -1
- package/dist/types/helpers/jsonHelper.d.ts +1 -1
- package/dist/types/helpers/objectHelper.d.ts +2 -2
- package/dist/types/helpers/stringHelper.d.ts +2 -2
- package/dist/types/index.d.ts +7 -0
- package/dist/types/models/IComponent.d.ts +2 -2
- package/dist/types/models/IDuration.d.ts +45 -0
- package/dist/types/models/ILocale.d.ts +1 -1
- package/dist/types/models/ISharedObjectBufferOptions.d.ts +17 -0
- package/dist/types/models/ISharedObjectBufferWorkerMessage.d.ts +29 -0
- package/dist/types/models/IValidationFailure.d.ts +1 -1
- package/dist/types/models/coerceType.d.ts +4 -0
- package/dist/types/models/sharedObjectBufferMessageTypes.d.ts +13 -0
- package/dist/types/types/duration.d.ts +29 -0
- package/dist/types/types/durationRegExp.d.ts +1 -0
- package/dist/types/types/url.d.ts +1 -0
- package/dist/types/utils/asyncCache.d.ts +1 -1
- package/dist/types/utils/coerce.d.ts +19 -20
- package/dist/types/utils/compression.d.ts +1 -1
- package/dist/types/utils/guards.d.ts +9 -0
- package/dist/types/utils/is.d.ts +16 -9
- package/dist/types/utils/mutex.d.ts +12 -1
- package/dist/types/utils/sharedObjectBuffer.d.ts +74 -0
- package/dist/types/utils/sharedStore.d.ts +2 -2
- package/docs/changelog.md +273 -0
- package/docs/reference/classes/ArrayHelper.md +1 -1
- package/docs/reference/classes/AsyncCache.md +1 -1
- package/docs/reference/classes/Coerce.md +32 -48
- package/docs/reference/classes/Compression.md +1 -1
- package/docs/reference/classes/ConflictError.md +1 -1
- package/docs/reference/classes/Duration.md +88 -0
- package/docs/reference/classes/ErrorHelper.md +1 -1
- package/docs/reference/classes/GeneralError.md +1 -1
- package/docs/reference/classes/Guards.md +36 -0
- package/docs/reference/classes/Is.md +31 -9
- package/docs/reference/classes/JsonHelper.md +1 -1
- package/docs/reference/classes/Mutex.md +39 -1
- package/docs/reference/classes/NotImplementedError.md +1 -1
- package/docs/reference/classes/ObjectHelper.md +10 -2
- package/docs/reference/classes/SharedObjectBuffer.md +192 -0
- package/docs/reference/classes/SharedStore.md +2 -2
- package/docs/reference/classes/StringHelper.md +16 -13
- package/docs/reference/classes/Url.md +4 -0
- package/docs/reference/classes/ValidationError.md +1 -1
- package/docs/reference/index.md +8 -0
- package/docs/reference/interfaces/IComponent.md +2 -2
- package/docs/reference/interfaces/IDuration.md +83 -0
- package/docs/reference/interfaces/ILocale.md +1 -1
- package/docs/reference/interfaces/ISharedObjectBufferOptions.md +33 -0
- package/docs/reference/interfaces/ISharedObjectBufferWorkerMessage.md +44 -0
- package/docs/reference/interfaces/IValidationFailure.md +1 -1
- package/docs/reference/type-aliases/SharedObjectBufferMessageTypes.md +5 -0
- package/docs/reference/variables/CoerceType.md +6 -0
- package/docs/reference/variables/DURATION_REG_EXP.md +3 -0
- package/docs/reference/variables/SharedObjectBufferMessageTypes.md +13 -0
- package/locales/en.json +9 -2
- package/package.json +3 -3
|
@@ -32,7 +32,7 @@ The value to test.
|
|
|
32
32
|
|
|
33
33
|
`value is undefined`
|
|
34
34
|
|
|
35
|
-
True if the value is
|
|
35
|
+
True if the value is undefined.
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
@@ -54,7 +54,7 @@ The value to test.
|
|
|
54
54
|
|
|
55
55
|
`value is null`
|
|
56
56
|
|
|
57
|
-
True if the value is
|
|
57
|
+
True if the value is null.
|
|
58
58
|
|
|
59
59
|
***
|
|
60
60
|
|
|
@@ -76,7 +76,7 @@ The value to test.
|
|
|
76
76
|
|
|
77
77
|
value is null \| undefined
|
|
78
78
|
|
|
79
|
-
True if the value is
|
|
79
|
+
True if the value is null or undefined.
|
|
80
80
|
|
|
81
81
|
***
|
|
82
82
|
|
|
@@ -84,7 +84,7 @@ True if the value is a empty.
|
|
|
84
84
|
|
|
85
85
|
> `static` **notEmpty**(`value`): `boolean`
|
|
86
86
|
|
|
87
|
-
Is the property
|
|
87
|
+
Is the property not null or undefined.
|
|
88
88
|
|
|
89
89
|
#### Parameters
|
|
90
90
|
|
|
@@ -98,7 +98,7 @@ The value to test.
|
|
|
98
98
|
|
|
99
99
|
`boolean`
|
|
100
100
|
|
|
101
|
-
True if the value is
|
|
101
|
+
True if the value is not null or undefined.
|
|
102
102
|
|
|
103
103
|
***
|
|
104
104
|
|
|
@@ -128,7 +128,7 @@ True if the value is a string.
|
|
|
128
128
|
|
|
129
129
|
> `static` **stringValue**(`value`): `value is string`
|
|
130
130
|
|
|
131
|
-
Is the value a string.
|
|
131
|
+
Is the value a non-empty string.
|
|
132
132
|
|
|
133
133
|
#### Parameters
|
|
134
134
|
|
|
@@ -142,7 +142,7 @@ The value to test.
|
|
|
142
142
|
|
|
143
143
|
`value is string`
|
|
144
144
|
|
|
145
|
-
True if the value is a string.
|
|
145
|
+
True if the value is a non-empty string.
|
|
146
146
|
|
|
147
147
|
***
|
|
148
148
|
|
|
@@ -512,7 +512,7 @@ The value to test.
|
|
|
512
512
|
|
|
513
513
|
`value is number`
|
|
514
514
|
|
|
515
|
-
True if the value is a
|
|
515
|
+
True if the value is a timestamp in seconds.
|
|
516
516
|
|
|
517
517
|
***
|
|
518
518
|
|
|
@@ -534,7 +534,7 @@ The value to test.
|
|
|
534
534
|
|
|
535
535
|
`value is number`
|
|
536
536
|
|
|
537
|
-
True if the value is a
|
|
537
|
+
True if the value is a timestamp in milliseconds.
|
|
538
538
|
|
|
539
539
|
***
|
|
540
540
|
|
|
@@ -881,3 +881,25 @@ The format of the UUIDv7 string.
|
|
|
881
881
|
`value is string`
|
|
882
882
|
|
|
883
883
|
True if the value is a uuidV7 string.
|
|
884
|
+
|
|
885
|
+
***
|
|
886
|
+
|
|
887
|
+
### duration() {#duration}
|
|
888
|
+
|
|
889
|
+
> `static` **duration**(`value`): value is string \| IDuration
|
|
890
|
+
|
|
891
|
+
Is the value a valid ISO 8601 duration string or an IDuration object.
|
|
892
|
+
|
|
893
|
+
#### Parameters
|
|
894
|
+
|
|
895
|
+
##### value
|
|
896
|
+
|
|
897
|
+
`unknown`
|
|
898
|
+
|
|
899
|
+
The value to test.
|
|
900
|
+
|
|
901
|
+
#### Returns
|
|
902
|
+
|
|
903
|
+
value is string \| IDuration
|
|
904
|
+
|
|
905
|
+
True if the value is a valid ISO 8601 duration string or an IDuration object.
|
|
@@ -35,6 +35,44 @@ Runtime name for the class.
|
|
|
35
35
|
|
|
36
36
|
## Methods
|
|
37
37
|
|
|
38
|
+
### getDefaultTimeoutMs() {#getdefaulttimeoutms}
|
|
39
|
+
|
|
40
|
+
> `static` **getDefaultTimeoutMs**(): `number`
|
|
41
|
+
|
|
42
|
+
Gets the default timeout in milliseconds for lock acquisition.
|
|
43
|
+
|
|
44
|
+
#### Returns
|
|
45
|
+
|
|
46
|
+
`number`
|
|
47
|
+
|
|
48
|
+
The default timeout in milliseconds.
|
|
49
|
+
|
|
50
|
+
***
|
|
51
|
+
|
|
52
|
+
### setDefaultTimeoutMs() {#setdefaulttimeoutms}
|
|
53
|
+
|
|
54
|
+
> `static` **setDefaultTimeoutMs**(`timeoutMs`): `void`
|
|
55
|
+
|
|
56
|
+
Sets the default timeout in milliseconds for lock acquisition.
|
|
57
|
+
|
|
58
|
+
#### Parameters
|
|
59
|
+
|
|
60
|
+
##### timeoutMs
|
|
61
|
+
|
|
62
|
+
`number`
|
|
63
|
+
|
|
64
|
+
The default timeout in milliseconds.
|
|
65
|
+
|
|
66
|
+
#### Returns
|
|
67
|
+
|
|
68
|
+
`void`
|
|
69
|
+
|
|
70
|
+
#### Throws
|
|
71
|
+
|
|
72
|
+
GeneralError if timeoutMs is not a non-negative integer.
|
|
73
|
+
|
|
74
|
+
***
|
|
75
|
+
|
|
38
76
|
### lock() {#lock}
|
|
39
77
|
|
|
40
78
|
> `static` **lock**(`key`, `options?`): `Promise`\<`boolean`\>
|
|
@@ -62,7 +100,7 @@ Lock options.
|
|
|
62
100
|
|
|
63
101
|
`number`
|
|
64
102
|
|
|
65
|
-
The maximum time to wait for the lock in milliseconds,
|
|
103
|
+
The maximum time to wait for the lock in milliseconds, defaults to getDefaultTimeoutMs().
|
|
66
104
|
|
|
67
105
|
###### throwOnTimeout?
|
|
68
106
|
|
|
@@ -336,10 +336,14 @@ Pick a subset of properties from an object.
|
|
|
336
336
|
|
|
337
337
|
#### Param
|
|
338
338
|
|
|
339
|
+
**obj**
|
|
340
|
+
|
|
339
341
|
The object to pick the properties from.
|
|
340
342
|
|
|
341
343
|
#### Param
|
|
342
344
|
|
|
345
|
+
**keys**
|
|
346
|
+
|
|
343
347
|
The property keys to pick.
|
|
344
348
|
|
|
345
349
|
#### Call Signature
|
|
@@ -422,10 +426,14 @@ Omit a subset of properties from an object.
|
|
|
422
426
|
|
|
423
427
|
#### Param
|
|
424
428
|
|
|
429
|
+
**obj**
|
|
430
|
+
|
|
425
431
|
The object to omit the properties from.
|
|
426
432
|
|
|
427
433
|
#### Param
|
|
428
434
|
|
|
435
|
+
**keys**
|
|
436
|
+
|
|
429
437
|
The property keys to omit.
|
|
430
438
|
|
|
431
439
|
#### Call Signature
|
|
@@ -506,7 +514,7 @@ The object without the omitted keys, or undefined if the input was undefined.
|
|
|
506
514
|
|
|
507
515
|
> `static` **toExtended**(`obj`): `any`
|
|
508
516
|
|
|
509
|
-
|
|
517
|
+
Convert the non JSON primitives to extended types.
|
|
510
518
|
|
|
511
519
|
#### Parameters
|
|
512
520
|
|
|
@@ -528,7 +536,7 @@ The object with extended properties.
|
|
|
528
536
|
|
|
529
537
|
> `static` **fromExtended**(`obj`): `any`
|
|
530
538
|
|
|
531
|
-
|
|
539
|
+
Convert the extended types to non JSON primitives.
|
|
532
540
|
|
|
533
541
|
#### Parameters
|
|
534
542
|
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Class: SharedObjectBuffer
|
|
2
|
+
|
|
3
|
+
Manages per-object SharedArrayBuffers that store objects as UTF-8 JSON.
|
|
4
|
+
Buffer layout: 4-byte Int32 header (current data byte length) followed by the JSON-encoded object.
|
|
5
|
+
Buffers are explicitly created with create and cached in SharedStore.
|
|
6
|
+
On a worker thread an existing buffer is fetched via a MessagePort handshake
|
|
7
|
+
(same protocol as Mutex) and cached locally.
|
|
8
|
+
Buffers grow automatically when the payload exceeds capacity; when the payload drops well below
|
|
9
|
+
capacity the buffer is replaced with a smaller one. The caller must hold the objectId-keyed Mutex
|
|
10
|
+
around every read and write. The main thread's worker message handler must forward messages to
|
|
11
|
+
both Mutex.handleWorkerMessage and SharedObjectBuffer.handleWorkerMessage.
|
|
12
|
+
|
|
13
|
+
## Constructors
|
|
14
|
+
|
|
15
|
+
### Constructor
|
|
16
|
+
|
|
17
|
+
> **new SharedObjectBuffer**(): `SharedObjectBuffer`
|
|
18
|
+
|
|
19
|
+
#### Returns
|
|
20
|
+
|
|
21
|
+
`SharedObjectBuffer`
|
|
22
|
+
|
|
23
|
+
## Properties
|
|
24
|
+
|
|
25
|
+
### CLASS\_NAME {#class_name}
|
|
26
|
+
|
|
27
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
28
|
+
|
|
29
|
+
Runtime name for the class.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### DEFAULT\_CAPACITY\_BYTES {#default_capacity_bytes}
|
|
34
|
+
|
|
35
|
+
> `readonly` `static` **DEFAULT\_CAPACITY\_BYTES**: `number`
|
|
36
|
+
|
|
37
|
+
Default payload capacity per object (1 MiB). The first caller that creates the buffer
|
|
38
|
+
for an object determines its initial capacity; later callers that pass a different value
|
|
39
|
+
are ignored.
|
|
40
|
+
|
|
41
|
+
***
|
|
42
|
+
|
|
43
|
+
### MAX\_CAPACITY\_BYTES {#max_capacity_bytes}
|
|
44
|
+
|
|
45
|
+
> `readonly` `static` **MAX\_CAPACITY\_BYTES**: `number`
|
|
46
|
+
|
|
47
|
+
Default upper bound for how large a buffer may grow (256 MiB).
|
|
48
|
+
Override per-object via the maxCapacityBytes option on create.
|
|
49
|
+
|
|
50
|
+
## Methods
|
|
51
|
+
|
|
52
|
+
### create() {#create}
|
|
53
|
+
|
|
54
|
+
> `static` **create**(`objectId`, `options?`): `Promise`\<`void`\>
|
|
55
|
+
|
|
56
|
+
Create the buffer for the given objectId if it does not already exist.
|
|
57
|
+
Must be called while holding Mutex.lock(objectId).
|
|
58
|
+
|
|
59
|
+
#### Parameters
|
|
60
|
+
|
|
61
|
+
##### objectId
|
|
62
|
+
|
|
63
|
+
`string`
|
|
64
|
+
|
|
65
|
+
The object id that identifies the buffer.
|
|
66
|
+
|
|
67
|
+
##### options?
|
|
68
|
+
|
|
69
|
+
[`ISharedObjectBufferOptions`](../interfaces/ISharedObjectBufferOptions.md)
|
|
70
|
+
|
|
71
|
+
Optional capacity configuration used when creating the buffer.
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`Promise`\<`void`\>
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
### read() {#read}
|
|
80
|
+
|
|
81
|
+
> `static` **read**\<`T`\>(`objectId`): `Promise`\<`T` \| `undefined`\>
|
|
82
|
+
|
|
83
|
+
Read and decode the object stored for the given objectId.
|
|
84
|
+
Must be called while holding Mutex.lock(objectId).
|
|
85
|
+
|
|
86
|
+
#### Type Parameters
|
|
87
|
+
|
|
88
|
+
##### T
|
|
89
|
+
|
|
90
|
+
`T`
|
|
91
|
+
|
|
92
|
+
#### Parameters
|
|
93
|
+
|
|
94
|
+
##### objectId
|
|
95
|
+
|
|
96
|
+
`string`
|
|
97
|
+
|
|
98
|
+
The object id that identifies the buffer.
|
|
99
|
+
|
|
100
|
+
#### Returns
|
|
101
|
+
|
|
102
|
+
`Promise`\<`T` \| `undefined`\>
|
|
103
|
+
|
|
104
|
+
The stored object, or undefined when nothing has been written yet.
|
|
105
|
+
|
|
106
|
+
***
|
|
107
|
+
|
|
108
|
+
### write() {#write}
|
|
109
|
+
|
|
110
|
+
> `static` **write**\<`T`\>(`objectId`, `value`): `Promise`\<`void`\>
|
|
111
|
+
|
|
112
|
+
Encode and write the object into the buffer for the given objectId.
|
|
113
|
+
The buffer must already exist, usually by calling create first.
|
|
114
|
+
When the encoded payload exceeds the current buffer capacity the buffer is grown
|
|
115
|
+
in-place via SharedArrayBuffer.grow so every thread with a reference sees the
|
|
116
|
+
new size without any pointer swap. When the payload is smaller than
|
|
117
|
+
_SHRINK_THRESHOLD of the current capacity and the capacity exceeds
|
|
118
|
+
DEFAULT_CAPACITY_BYTES, the buffer is replaced with a smaller one on the calling thread.
|
|
119
|
+
Must be called while holding Mutex.lock(objectId).
|
|
120
|
+
|
|
121
|
+
#### Type Parameters
|
|
122
|
+
|
|
123
|
+
##### T
|
|
124
|
+
|
|
125
|
+
`T`
|
|
126
|
+
|
|
127
|
+
#### Parameters
|
|
128
|
+
|
|
129
|
+
##### objectId
|
|
130
|
+
|
|
131
|
+
`string`
|
|
132
|
+
|
|
133
|
+
The object id that identifies the buffer.
|
|
134
|
+
|
|
135
|
+
##### value
|
|
136
|
+
|
|
137
|
+
`T`
|
|
138
|
+
|
|
139
|
+
The object to persist.
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
`Promise`\<`void`\>
|
|
144
|
+
|
|
145
|
+
***
|
|
146
|
+
|
|
147
|
+
### remove() {#remove}
|
|
148
|
+
|
|
149
|
+
> `static` **remove**(`objectId`): `void`
|
|
150
|
+
|
|
151
|
+
Remove the stored object and release the buffer for the given objectId.
|
|
152
|
+
The entry is deleted from the local cache so subsequent reads or writes will
|
|
153
|
+
create or fetch a fresh buffer. Worker threads that have cached the old buffer
|
|
154
|
+
reference continue using it until they restart or re-request via the worker protocol.
|
|
155
|
+
Must be called while holding Mutex.lock(objectId).
|
|
156
|
+
|
|
157
|
+
#### Parameters
|
|
158
|
+
|
|
159
|
+
##### objectId
|
|
160
|
+
|
|
161
|
+
`string`
|
|
162
|
+
|
|
163
|
+
The object id that identifies the buffer.
|
|
164
|
+
|
|
165
|
+
#### Returns
|
|
166
|
+
|
|
167
|
+
`void`
|
|
168
|
+
|
|
169
|
+
***
|
|
170
|
+
|
|
171
|
+
### handleWorkerMessage() {#handleworkermessage}
|
|
172
|
+
|
|
173
|
+
> `static` **handleWorkerMessage**(`msg`): `boolean`
|
|
174
|
+
|
|
175
|
+
Inspect a message from a worker thread and, if it is a SharedObjectBuffer
|
|
176
|
+
buffer-fetch request, respond to it synchronously.
|
|
177
|
+
Call this from the main thread's worker message handler alongside
|
|
178
|
+
Mutex.handleWorkerMessage.
|
|
179
|
+
|
|
180
|
+
#### Parameters
|
|
181
|
+
|
|
182
|
+
##### msg
|
|
183
|
+
|
|
184
|
+
`unknown`
|
|
185
|
+
|
|
186
|
+
The raw message received from the worker.
|
|
187
|
+
|
|
188
|
+
#### Returns
|
|
189
|
+
|
|
190
|
+
`boolean`
|
|
191
|
+
|
|
192
|
+
True if the message was a SharedObjectBuffer protocol message, false otherwise.
|
|
@@ -297,19 +297,6 @@ The string split into words.
|
|
|
297
297
|
> `static` **isUtf8**(`data`): `boolean`
|
|
298
298
|
|
|
299
299
|
Check if a Node.js Buffer or Uint8Array is UTF-8.
|
|
300
|
-
Url https://tools.ietf.org/html/rfc3629
|
|
301
|
-
Source https://github.com/hcodes/isutf8
|
|
302
|
-
UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4.
|
|
303
|
-
UTF8-1 = %x00-7F.
|
|
304
|
-
UTF8-2 = %xC2-DF UTF8-tail.
|
|
305
|
-
UTF8-3 = %xE0 %xA0-BF UTF8-tail.
|
|
306
|
-
- %xE1-EC 2( UTF8-tail ).
|
|
307
|
-
- %xED %x80-9F UTF8-tail.
|
|
308
|
-
- %xEE-EF 2( UTF8-tail ).
|
|
309
|
-
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ).
|
|
310
|
-
- %xF1-F3 3( UTF8-tail ).
|
|
311
|
-
- %xF4 %x80-8F 2( UTF8-tail ).
|
|
312
|
-
UTF8-tail = %x80-BF.
|
|
313
300
|
|
|
314
301
|
#### Parameters
|
|
315
302
|
|
|
@@ -324,3 +311,19 @@ The data to check.
|
|
|
324
311
|
`boolean`
|
|
325
312
|
|
|
326
313
|
True if the data is utf8.
|
|
314
|
+
|
|
315
|
+
#### See
|
|
316
|
+
|
|
317
|
+
- https://tools.ietf.org/html/rfc3629
|
|
318
|
+
- https://github.com/hcodes/isutf8
|
|
319
|
+
UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4.
|
|
320
|
+
UTF8-1 = %x00-7F.
|
|
321
|
+
UTF8-2 = %xC2-DF UTF8-tail.
|
|
322
|
+
UTF8-3 = %xE0 %xA0-BF UTF8-tail.
|
|
323
|
+
- %xE1-EC 2( UTF8-tail ).
|
|
324
|
+
- %xED %x80-9F UTF8-tail.
|
|
325
|
+
- %xEE-EF 2( UTF8-tail ).
|
|
326
|
+
UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ).
|
|
327
|
+
- %xF1-F3 3( UTF8-tail ).
|
|
328
|
+
- %xF4 %x80-8F 2( UTF8-tail ).
|
|
329
|
+
UTF8-tail = %x80-BF.
|
package/docs/reference/index.md
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
- [StringHelper](classes/StringHelper.md)
|
|
31
31
|
- [Uint8ArrayHelper](classes/Uint8ArrayHelper.md)
|
|
32
32
|
- [BitString](classes/BitString.md)
|
|
33
|
+
- [Duration](classes/Duration.md)
|
|
33
34
|
- [Url](classes/Url.md)
|
|
34
35
|
- [Urn](classes/Urn.md)
|
|
35
36
|
- [AsyncCache](classes/AsyncCache.md)
|
|
@@ -40,12 +41,14 @@
|
|
|
40
41
|
- [I18n](classes/I18n.md)
|
|
41
42
|
- [Is](classes/Is.md)
|
|
42
43
|
- [Mutex](classes/Mutex.md)
|
|
44
|
+
- [SharedObjectBuffer](classes/SharedObjectBuffer.md)
|
|
43
45
|
- [SharedStore](classes/SharedStore.md)
|
|
44
46
|
- [Validation](classes/Validation.md)
|
|
45
47
|
|
|
46
48
|
## Interfaces
|
|
47
49
|
|
|
48
50
|
- [IComponent](interfaces/IComponent.md)
|
|
51
|
+
- [IDuration](interfaces/IDuration.md)
|
|
49
52
|
- [IError](interfaces/IError.md)
|
|
50
53
|
- [IHealth](interfaces/IHealth.md)
|
|
51
54
|
- [II18nShared](interfaces/II18nShared.md)
|
|
@@ -56,6 +59,8 @@
|
|
|
56
59
|
- [ILocalesIndex](interfaces/ILocalesIndex.md)
|
|
57
60
|
- [IMutexWorkerMessage](interfaces/IMutexWorkerMessage.md)
|
|
58
61
|
- [IPatchOperation](interfaces/IPatchOperation.md)
|
|
62
|
+
- [ISharedObjectBufferOptions](interfaces/ISharedObjectBufferOptions.md)
|
|
63
|
+
- [ISharedObjectBufferWorkerMessage](interfaces/ISharedObjectBufferWorkerMessage.md)
|
|
59
64
|
- [IUrlParts](interfaces/IUrlParts.md)
|
|
60
65
|
- [IValidationFailure](interfaces/IValidationFailure.md)
|
|
61
66
|
|
|
@@ -65,6 +70,7 @@
|
|
|
65
70
|
- [CompressionType](type-aliases/CompressionType.md)
|
|
66
71
|
- [HealthStatus](type-aliases/HealthStatus.md)
|
|
67
72
|
- [MutexMessageTypes](type-aliases/MutexMessageTypes.md)
|
|
73
|
+
- [SharedObjectBufferMessageTypes](type-aliases/SharedObjectBufferMessageTypes.md)
|
|
68
74
|
- [ObjectOrArray](type-aliases/ObjectOrArray.md)
|
|
69
75
|
- [SingleOccurrenceArray](type-aliases/SingleOccurrenceArray.md)
|
|
70
76
|
- [SingleOccurrenceArrayDepthHelper](type-aliases/SingleOccurrenceArrayDepthHelper.md)
|
|
@@ -76,3 +82,5 @@
|
|
|
76
82
|
- [CompressionType](variables/CompressionType.md)
|
|
77
83
|
- [HealthStatus](variables/HealthStatus.md)
|
|
78
84
|
- [MutexMessageTypes](variables/MutexMessageTypes.md)
|
|
85
|
+
- [SharedObjectBufferMessageTypes](variables/SharedObjectBufferMessageTypes.md)
|
|
86
|
+
- [DURATION\_REG\_EXP](variables/DURATION_REG_EXP.md)
|
|
@@ -80,7 +80,7 @@ The node logging component type.
|
|
|
80
80
|
|
|
81
81
|
`Promise`\<`void`\>
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
A promise that resolves when the component has started.
|
|
84
84
|
|
|
85
85
|
***
|
|
86
86
|
|
|
@@ -102,7 +102,7 @@ The node logging component type.
|
|
|
102
102
|
|
|
103
103
|
`Promise`\<`void`\>
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
A promise that resolves when the component has stopped.
|
|
106
106
|
|
|
107
107
|
***
|
|
108
108
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Interface: IDuration
|
|
2
|
+
|
|
3
|
+
Represents a duration broken down into its component parts.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### years {#years}
|
|
8
|
+
|
|
9
|
+
> **years**: `number`
|
|
10
|
+
|
|
11
|
+
The number of years.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### months {#months}
|
|
16
|
+
|
|
17
|
+
> **months**: `number`
|
|
18
|
+
|
|
19
|
+
The number of months.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### weeks {#weeks}
|
|
24
|
+
|
|
25
|
+
> **weeks**: `number`
|
|
26
|
+
|
|
27
|
+
The number of weeks.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### days {#days}
|
|
32
|
+
|
|
33
|
+
> **days**: `number`
|
|
34
|
+
|
|
35
|
+
The number of days.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### hours {#hours}
|
|
40
|
+
|
|
41
|
+
> **hours**: `number`
|
|
42
|
+
|
|
43
|
+
The number of hours.
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### minutes {#minutes}
|
|
48
|
+
|
|
49
|
+
> **minutes**: `number`
|
|
50
|
+
|
|
51
|
+
The number of minutes.
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### seconds {#seconds}
|
|
56
|
+
|
|
57
|
+
> **seconds**: `number`
|
|
58
|
+
|
|
59
|
+
The number of seconds.
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### milliseconds? {#milliseconds}
|
|
64
|
+
|
|
65
|
+
> `optional` **milliseconds?**: `number`
|
|
66
|
+
|
|
67
|
+
The number of milliseconds.
|
|
68
|
+
|
|
69
|
+
***
|
|
70
|
+
|
|
71
|
+
### microseconds? {#microseconds}
|
|
72
|
+
|
|
73
|
+
> `optional` **microseconds?**: `number`
|
|
74
|
+
|
|
75
|
+
The number of microseconds.
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
### nanoseconds? {#nanoseconds}
|
|
80
|
+
|
|
81
|
+
> `optional` **nanoseconds?**: `number`
|
|
82
|
+
|
|
83
|
+
The number of nanoseconds.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Interface: ISharedObjectBufferOptions
|
|
2
|
+
|
|
3
|
+
Options for configuring buffer capacity when creating a shared object buffer.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### initialCapacityBytes? {#initialcapacitybytes}
|
|
8
|
+
|
|
9
|
+
> `optional` **initialCapacityBytes?**: `number`
|
|
10
|
+
|
|
11
|
+
Initial payload capacity hint in bytes.
|
|
12
|
+
Only honoured when the buffer does not yet exist; ignored on subsequent writes.
|
|
13
|
+
|
|
14
|
+
#### Default
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
1 MiB.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
***
|
|
21
|
+
|
|
22
|
+
### maxCapacityBytes? {#maxcapacitybytes}
|
|
23
|
+
|
|
24
|
+
> `optional` **maxCapacityBytes?**: `number`
|
|
25
|
+
|
|
26
|
+
Maximum allowed payload capacity in bytes. The buffer will never grow beyond this limit.
|
|
27
|
+
Only honoured when the buffer does not yet exist; ignored on subsequent writes.
|
|
28
|
+
|
|
29
|
+
#### Default
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
256 MiB.
|
|
33
|
+
```
|