vestjs-runtime 1.6.0 → 1.7.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/IsolateSerializer/package.json +8 -12
- package/README.md +1 -3
- package/dist/cjs/IsolateSerializer.development.js +135 -0
- package/dist/cjs/IsolateSerializer.development.js.map +1 -0
- package/dist/cjs/IsolateSerializer.js +6 -0
- package/dist/cjs/IsolateSerializer.production.js +2 -0
- package/dist/cjs/IsolateSerializer.production.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test-utils.development.js +61 -0
- package/dist/cjs/test-utils.development.js.map +1 -0
- package/dist/cjs/test-utils.js +6 -0
- package/dist/cjs/test-utils.production.js +2 -0
- package/dist/cjs/test-utils.production.js.map +1 -0
- package/dist/cjs/vestjs-runtime.development.js +686 -0
- package/dist/cjs/vestjs-runtime.development.js.map +1 -0
- package/dist/cjs/vestjs-runtime.js +6 -0
- package/dist/cjs/vestjs-runtime.production.js +2 -0
- package/dist/cjs/vestjs-runtime.production.js.map +1 -0
- package/dist/es/IsolateSerializer.development.js +133 -0
- package/dist/es/IsolateSerializer.development.js.map +1 -0
- package/dist/es/IsolateSerializer.production.js +2 -0
- package/dist/es/IsolateSerializer.production.js.map +1 -0
- package/dist/es/package.json +1 -0
- package/dist/es/test-utils.development.js +59 -0
- package/dist/es/test-utils.development.js.map +1 -0
- package/dist/es/test-utils.production.js +2 -0
- package/dist/es/test-utils.production.js.map +1 -0
- package/dist/es/vestjs-runtime.development.js +675 -0
- package/dist/es/vestjs-runtime.development.js.map +1 -0
- package/dist/es/vestjs-runtime.production.js +2 -0
- package/dist/es/vestjs-runtime.production.js.map +1 -0
- package/dist/umd/IsolateSerializer.development.js +138 -0
- package/dist/umd/IsolateSerializer.development.js.map +1 -0
- package/dist/umd/IsolateSerializer.production.js +2 -0
- package/dist/umd/IsolateSerializer.production.js.map +1 -0
- package/dist/umd/test-utils.development.js +67 -0
- package/dist/umd/test-utils.development.js.map +1 -0
- package/dist/umd/test-utils.production.js +2 -0
- package/dist/umd/test-utils.production.js.map +1 -0
- package/dist/umd/vestjs-runtime.development.js +688 -0
- package/dist/umd/vestjs-runtime.development.js.map +1 -0
- package/dist/umd/vestjs-runtime.production.js +2 -0
- package/dist/umd/vestjs-runtime.production.js.map +1 -0
- package/package.json +87 -42
- package/test-utils/package.json +8 -12
- package/types/IsolateSerializer.d.ts +42 -0
- package/types/IsolateSerializer.d.ts.map +1 -0
- package/types/test-utils.d.ts +37 -0
- package/types/test-utils.d.ts.map +1 -0
- package/types/vestjs-runtime.d.ts +257 -351
- package/types/vestjs-runtime.d.ts.map +1 -0
- package/vitest.config.ts +17 -9
- package/dist/IsolateKeys-B21aPuBk.mjs +0 -23
- package/dist/IsolateKeys-B21aPuBk.mjs.map +0 -1
- package/dist/IsolateKeys-CCvALpZC.cjs +0 -35
- package/dist/IsolateKeys-CCvALpZC.cjs.map +0 -1
- package/dist/IsolateSerializer-B1hE3gmT.mjs +0 -1004
- package/dist/IsolateSerializer-B1hE3gmT.mjs.map +0 -1
- package/dist/IsolateSerializer-pbEf5gB2.cjs +0 -1121
- package/dist/IsolateSerializer-pbEf5gB2.cjs.map +0 -1
- package/dist/chunk-CLMFDpHK.mjs +0 -18
- package/dist/exports/IsolateSerializer.cjs +0 -4
- package/dist/exports/IsolateSerializer.mjs +0 -4
- package/dist/exports/test-utils.cjs +0 -21
- package/dist/exports/test-utils.cjs.map +0 -1
- package/dist/exports/test-utils.mjs +0 -21
- package/dist/exports/test-utils.mjs.map +0 -1
- package/dist/vestjs-runtime.cjs +0 -153
- package/dist/vestjs-runtime.cjs.map +0 -1
- package/dist/vestjs-runtime.mjs +0 -117
- package/dist/vestjs-runtime.mjs.map +0 -1
- package/docs/IsolateRegistry.docs.md +0 -146
- package/docs/Isolates.md +0 -97
- package/src/Bus.ts +0 -46
- package/src/Isolate/Isolate.ts +0 -163
- package/src/Isolate/IsolateFocused.ts +0 -93
- package/src/Isolate/IsolateIndexer.ts +0 -42
- package/src/Isolate/IsolateInspector.ts +0 -93
- package/src/Isolate/IsolateKeys.ts +0 -18
- package/src/Isolate/IsolateMutator.ts +0 -165
- package/src/Isolate/IsolateRegistry.ts +0 -176
- package/src/Isolate/IsolateReorderable.ts +0 -11
- package/src/Isolate/IsolateSelectors.ts +0 -25
- package/src/Isolate/IsolateStateMachine.ts +0 -30
- package/src/Isolate/IsolateStatus.ts +0 -8
- package/src/Isolate/IsolateTransient.ts +0 -27
- package/src/Isolate/IsolateTypes.ts +0 -33
- package/src/Isolate/__tests__/Isolate.test.ts +0 -123
- package/src/Isolate/__tests__/IsolateFocused.test.ts +0 -199
- package/src/Isolate/__tests__/IsolateInspector.test.ts +0 -136
- package/src/Isolate/__tests__/IsolateMutator.test.ts +0 -164
- package/src/Isolate/__tests__/IsolatePropagation.test.ts +0 -170
- package/src/Isolate/__tests__/IsolateReorderable.test.ts +0 -111
- package/src/Isolate/__tests__/IsolateSelectors.test.ts +0 -72
- package/src/Isolate/__tests__/IsolateStatus.test.ts +0 -44
- package/src/Isolate/__tests__/IsolateTransient.test.ts +0 -58
- package/src/Isolate/__tests__/__snapshots__/asyncIsolate.test.ts.snap +0 -71
- package/src/Isolate/__tests__/asyncIsolate.test.ts +0 -85
- package/src/IsolateWalker.ts +0 -359
- package/src/Orchestrator/RuntimeStates.ts +0 -4
- package/src/Reconciler.ts +0 -178
- package/src/RuntimeEvents.ts +0 -9
- package/src/VestRuntime.ts +0 -421
- package/src/__tests__/Bus.test.ts +0 -57
- package/src/__tests__/IsolateWalker.iterative.test.ts +0 -77
- package/src/__tests__/IsolateWalker.test.ts +0 -418
- package/src/__tests__/Reconciler.test.ts +0 -193
- package/src/__tests__/Reconciler.transient.test.ts +0 -166
- package/src/__tests__/VestRuntime.test.ts +0 -212
- package/src/__tests__/VestRuntimeStateMachine.test.ts +0 -36
- package/src/__tests__/vestjs-runtime.test.ts +0 -19
- package/src/errors/ErrorStrings.ts +0 -6
- package/src/exports/IsolateSerializer.ts +0 -131
- package/src/exports/__tests__/IsolateSerializer.test.ts +0 -334
- package/src/exports/__tests__/IsolateSerializer.transient.test.ts +0 -101
- package/src/exports/__tests__/__snapshots__/IsolateSerializer.test.ts.snap +0 -5
- package/src/exports/test-utils.ts +0 -17
- package/src/vestjs-runtime.ts +0 -28
- package/types/Isolate-DChR7h5K.d.mts +0 -58
- package/types/Isolate-DChR7h5K.d.mts.map +0 -1
- package/types/Isolate-HYIh82M8.d.cts +0 -58
- package/types/Isolate-HYIh82M8.d.cts.map +0 -1
- package/types/IsolateSerializer-BCg01Px5.d.mts +0 -13
- package/types/IsolateSerializer-BCg01Px5.d.mts.map +0 -1
- package/types/IsolateSerializer-CQpP6A4m.d.cts +0 -13
- package/types/IsolateSerializer-CQpP6A4m.d.cts.map +0 -1
- package/types/exports/IsolateSerializer.d.cts +0 -3
- package/types/exports/IsolateSerializer.d.mts +0 -3
- package/types/exports/test-utils.d.cts +0 -7
- package/types/exports/test-utils.d.cts.map +0 -1
- package/types/exports/test-utils.d.mts +0 -7
- package/types/exports/test-utils.d.mts.map +0 -1
- package/types/vestjs-runtime.d.cts +0 -372
- package/types/vestjs-runtime.d.cts.map +0 -1
- package/types/vestjs-runtime.d.mts +0 -370
- package/types/vestjs-runtime.d.mts.map +0 -1
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
import { CB, isFailure, isSuccess } from 'vest-utils';
|
|
2
|
-
import { describe, it, expect, test } from 'vitest';
|
|
3
|
-
|
|
4
|
-
import { Isolate, TIsolate } from '../../Isolate/Isolate';
|
|
5
|
-
import { IsolateKeys } from '../../Isolate/IsolateKeys';
|
|
6
|
-
import { IsolateSerializer } from '../IsolateSerializer';
|
|
7
|
-
import {
|
|
8
|
-
IReconciler,
|
|
9
|
-
VestRuntime,
|
|
10
|
-
IsolateStatus,
|
|
11
|
-
IsolateMutator,
|
|
12
|
-
} from '../../vestjs-runtime';
|
|
13
|
-
|
|
14
|
-
describe('IsolateSerializer', () => {
|
|
15
|
-
describe('safeDeserialize', () => {
|
|
16
|
-
it('Should successfully deserialize a valid isolate string', () => {
|
|
17
|
-
const { serialized } = createRoot();
|
|
18
|
-
|
|
19
|
-
const result = IsolateSerializer.safeDeserialize(serialized);
|
|
20
|
-
|
|
21
|
-
expect(isSuccess(result)).toBe(true);
|
|
22
|
-
expect(result.unwrap()[IsolateKeys.Type]).toBe('URoot');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('Should return failure on malformed JSON', () => {
|
|
26
|
-
const result = IsolateSerializer.safeDeserialize('{ invalid_json: ');
|
|
27
|
-
|
|
28
|
-
expect(isFailure(result)).toBe(true);
|
|
29
|
-
if (isFailure(result)) {
|
|
30
|
-
expect(result.error).toBeInstanceOf(Error);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('Should return failure if payload is not an isolate', () => {
|
|
35
|
-
const result = IsolateSerializer.safeDeserialize('{"foo":"bar"}');
|
|
36
|
-
|
|
37
|
-
expect(isFailure(result)).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe('serialize', () => {
|
|
42
|
-
it('Should produce serialized dump', () => {
|
|
43
|
-
const { serialized } = createRoot();
|
|
44
|
-
|
|
45
|
-
expect(serialized).toMatchSnapshot();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('deserialize', () => {
|
|
50
|
-
it('Should fully inflate the tree', () => {
|
|
51
|
-
const { serialized } = createRoot();
|
|
52
|
-
|
|
53
|
-
const inflated = IsolateSerializer.deserialize(serialized);
|
|
54
|
-
|
|
55
|
-
expect(inflated).toMatchInlineSnapshot(`
|
|
56
|
-
{
|
|
57
|
-
"$type": "URoot",
|
|
58
|
-
"children": [
|
|
59
|
-
{
|
|
60
|
-
"$type": "UChild_1",
|
|
61
|
-
"data": {
|
|
62
|
-
"some_data": true,
|
|
63
|
-
},
|
|
64
|
-
"parent": [Circular],
|
|
65
|
-
"status": "DONE",
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"$type": "UChild_2",
|
|
69
|
-
"parent": [Circular],
|
|
70
|
-
"status": "DONE",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"$type": "UChild_3",
|
|
74
|
-
"parent": [Circular],
|
|
75
|
-
"status": "DONE",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
"data": {
|
|
79
|
-
"some_data": true,
|
|
80
|
-
},
|
|
81
|
-
"status": "DONE",
|
|
82
|
-
}
|
|
83
|
-
`);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('When data is empty, should not add data property', () => {
|
|
87
|
-
const { serialized } = createRoot();
|
|
88
|
-
const inflated = IsolateSerializer.deserialize(serialized);
|
|
89
|
-
|
|
90
|
-
expect(inflated?.children?.[0]).toHaveProperty('data');
|
|
91
|
-
expect(inflated?.children?.[1]).not.toHaveProperty('data');
|
|
92
|
-
expect(inflated?.children?.[2]).not.toHaveProperty('data');
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
describe('Custom Data Serialization', () => {
|
|
97
|
-
it('Should serialize data with custom keys', () => {
|
|
98
|
-
const { serialized } = createRoot();
|
|
99
|
-
|
|
100
|
-
expect(serialized).toMatchSnapshot();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('Should take a replacer param', () => {
|
|
104
|
-
const { root } = createRoot();
|
|
105
|
-
|
|
106
|
-
root.status = IsolateStatus.PENDING;
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
root.children[0].status = 'done';
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
root.children[1].status = 'failed';
|
|
111
|
-
|
|
112
|
-
const serialized = IsolateSerializer.serialize(
|
|
113
|
-
root,
|
|
114
|
-
(value: any, key: string) => {
|
|
115
|
-
if (key === 'status' && value === IsolateStatus.PENDING) {
|
|
116
|
-
return 'incomplete';
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return value;
|
|
120
|
-
},
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
const inflated = IsolateSerializer.deserialize(serialized);
|
|
124
|
-
|
|
125
|
-
expect(inflated.status).toBe('incomplete');
|
|
126
|
-
// @ts-ignore
|
|
127
|
-
expect(inflated.children[0].status).toBe('done');
|
|
128
|
-
// @ts-ignore
|
|
129
|
-
expect(inflated.children[1].status).toBe('failed');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
describe('value serialization', () => {
|
|
133
|
-
it('Should correctly expand values', () => {
|
|
134
|
-
const { root } = createRoot();
|
|
135
|
-
|
|
136
|
-
root.status = IsolateStatus.PENDING;
|
|
137
|
-
// @ts-ignore
|
|
138
|
-
root.children[0].status = 'done';
|
|
139
|
-
// @ts-ignore
|
|
140
|
-
root.children[1].status = 'failed';
|
|
141
|
-
|
|
142
|
-
const serialized = IsolateSerializer.serialize(root, v => v);
|
|
143
|
-
const inflated = IsolateSerializer.deserialize(serialized);
|
|
144
|
-
|
|
145
|
-
expect(inflated.status).toBe(IsolateStatus.PENDING);
|
|
146
|
-
// @ts-ignore
|
|
147
|
-
expect(inflated.children[0].status).toBe('done');
|
|
148
|
-
// @ts-ignore
|
|
149
|
-
expect(inflated.children[1].status).toBe('failed');
|
|
150
|
-
expect(inflated).toMatchInlineSnapshot(`
|
|
151
|
-
{
|
|
152
|
-
"$type": "URoot",
|
|
153
|
-
"children": [
|
|
154
|
-
{
|
|
155
|
-
"$type": "UChild_1",
|
|
156
|
-
"data": {
|
|
157
|
-
"some_data": true,
|
|
158
|
-
},
|
|
159
|
-
"parent": [Circular],
|
|
160
|
-
"status": "done",
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"$type": "UChild_2",
|
|
164
|
-
"parent": [Circular],
|
|
165
|
-
"status": "failed",
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"$type": "UChild_3",
|
|
169
|
-
"parent": [Circular],
|
|
170
|
-
"status": "DONE",
|
|
171
|
-
},
|
|
172
|
-
],
|
|
173
|
-
"data": {
|
|
174
|
-
"some_data": true,
|
|
175
|
-
},
|
|
176
|
-
"status": "PENDING",
|
|
177
|
-
}
|
|
178
|
-
`);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
it('Should inflate with correct keys', () => {
|
|
183
|
-
const { serialized } = createRoot();
|
|
184
|
-
|
|
185
|
-
const inflated = IsolateSerializer.deserialize(serialized);
|
|
186
|
-
|
|
187
|
-
expect(inflated.data.some_data).toBe(true);
|
|
188
|
-
expect(inflated).not.toHaveProperty('sd');
|
|
189
|
-
expect(inflated).toEqual(
|
|
190
|
-
IsolateSerializer.deserialize(createRoot().serialized),
|
|
191
|
-
);
|
|
192
|
-
expect(inflated).toMatchInlineSnapshot(`
|
|
193
|
-
{
|
|
194
|
-
"$type": "URoot",
|
|
195
|
-
"children": [
|
|
196
|
-
{
|
|
197
|
-
"$type": "UChild_1",
|
|
198
|
-
"data": {
|
|
199
|
-
"some_data": true,
|
|
200
|
-
},
|
|
201
|
-
"parent": [Circular],
|
|
202
|
-
"status": "DONE",
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
"$type": "UChild_2",
|
|
206
|
-
"parent": [Circular],
|
|
207
|
-
"status": "DONE",
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
"$type": "UChild_3",
|
|
211
|
-
"parent": [Circular],
|
|
212
|
-
"status": "DONE",
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
"data": {
|
|
216
|
-
"some_data": true,
|
|
217
|
-
},
|
|
218
|
-
"status": "DONE",
|
|
219
|
-
}
|
|
220
|
-
`);
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
describe('Error handling', () => {
|
|
225
|
-
it('Should return error result if deserialization fails', () => {
|
|
226
|
-
const result = IsolateSerializer.safeDeserialize('invalid json');
|
|
227
|
-
expect(isFailure(result)).toBe(true);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('Should return empty string if isolate is null', () => {
|
|
231
|
-
expect(IsolateSerializer.serialize(null)).toBe('');
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
describe('Children with keys', () => {
|
|
236
|
-
it('Should correctly handle children with keys during processing', () => {
|
|
237
|
-
let serialized: string;
|
|
238
|
-
withRunTime(() => {
|
|
239
|
-
const root = Isolate.create('Root', () => {
|
|
240
|
-
const child = Isolate.create('Child', () => {});
|
|
241
|
-
IsolateMutator.setKey(child, 'some-key');
|
|
242
|
-
});
|
|
243
|
-
serialized = IsolateSerializer.serialize(root, v => v);
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
// @ts-ignore
|
|
247
|
-
const inflated = IsolateSerializer.deserialize(serialized);
|
|
248
|
-
// @ts-ignore
|
|
249
|
-
expect(inflated.children[0].key).toBe('some-key');
|
|
250
|
-
// @ts-ignore
|
|
251
|
-
expect(inflated.keys['some-key']).toBeDefined();
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
describe('Security Scenarios', () => {
|
|
256
|
-
it('Should ignore malicious prototype keys in serialized string', () => {
|
|
257
|
-
// Manually constructed malicious string mimicking a serialized Isolate
|
|
258
|
-
// but injecting a __proto__ key into the data object
|
|
259
|
-
const maliciousJson = JSON.stringify([
|
|
260
|
-
{
|
|
261
|
-
$type: 'URoot',
|
|
262
|
-
data: {
|
|
263
|
-
__proto__: { isAdmin: true },
|
|
264
|
-
},
|
|
265
|
-
},
|
|
266
|
-
{},
|
|
267
|
-
]);
|
|
268
|
-
|
|
269
|
-
const inflated = IsolateSerializer.deserialize(maliciousJson);
|
|
270
|
-
|
|
271
|
-
// Verify the object was deserialized
|
|
272
|
-
expect(inflated).toBeDefined();
|
|
273
|
-
|
|
274
|
-
// Verify pollution did not occur
|
|
275
|
-
// @ts-ignore
|
|
276
|
-
expect({}.isAdmin).toBeUndefined();
|
|
277
|
-
|
|
278
|
-
// Verify the malicious key was stripped or ignored
|
|
279
|
-
// @ts-ignore
|
|
280
|
-
expect(inflated.data.__proto__).not.toEqual({ isAdmin: true });
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it('Should strip unsafe keys during JSON parsing (reviver check)', () => {
|
|
284
|
-
// Direct check against JSON.parse behvaior simulated via the serializer
|
|
285
|
-
const json =
|
|
286
|
-
'[{"$type":"URoot","__proto__":{"polluted":true},"valid":true}, {}]';
|
|
287
|
-
|
|
288
|
-
const expanded = IsolateSerializer.deserialize(json);
|
|
289
|
-
|
|
290
|
-
// Even if minifyObject handles it, we want to ensure the reviver did its job
|
|
291
|
-
// or at least that the combination is safe.
|
|
292
|
-
// Since deserialize calls expandNode -> JSON.parse(node, safeReviver)
|
|
293
|
-
// The resulting object should immediately lack the key.
|
|
294
|
-
|
|
295
|
-
// Note: we can't easily spy on the internal JSON.parse reviver without mocking,
|
|
296
|
-
// but we can verify the end result is clean.
|
|
297
|
-
expect(expanded).toBeDefined();
|
|
298
|
-
// @ts-ignore
|
|
299
|
-
expect(expanded.__proto__).not.toEqual({ polluted: true });
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
function withRunTime<T>(fn: CB<T>) {
|
|
305
|
-
return VestRuntime.Run(
|
|
306
|
-
VestRuntime.createRef({} as IReconciler, v => v),
|
|
307
|
-
() => {
|
|
308
|
-
return fn();
|
|
309
|
-
},
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function createRoot(replacer: (_value: any, _key: string) => any = v => v) {
|
|
314
|
-
let serialized: string, root: TIsolate;
|
|
315
|
-
|
|
316
|
-
withRunTime(() => {
|
|
317
|
-
root = Isolate.create(
|
|
318
|
-
'URoot',
|
|
319
|
-
() => {
|
|
320
|
-
Isolate.create('UChild_1', () => {}, { some_data: true });
|
|
321
|
-
Isolate.create('UChild_2', () => {});
|
|
322
|
-
Isolate.create('UChild_3', () => {});
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
some_data: true,
|
|
326
|
-
},
|
|
327
|
-
);
|
|
328
|
-
|
|
329
|
-
serialized = IsolateSerializer.serialize(root, replacer);
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
// @ts-ignore
|
|
333
|
-
return { root, serialized };
|
|
334
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { CB } from 'vest-utils';
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
|
|
4
|
-
import { Isolate, TIsolate } from '../../Isolate/Isolate';
|
|
5
|
-
import { IsolateKeys } from '../../Isolate/IsolateKeys';
|
|
6
|
-
import { IsolateSerializer } from '../IsolateSerializer';
|
|
7
|
-
import { IReconciler, VestRuntime } from '../../vestjs-runtime';
|
|
8
|
-
|
|
9
|
-
describe('IsolateSerializer: Transient', () => {
|
|
10
|
-
function withRunTime<T>(fn: CB<T>) {
|
|
11
|
-
return VestRuntime.Run(
|
|
12
|
-
VestRuntime.createRef({} as IReconciler, v => v),
|
|
13
|
-
() => fn(),
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
it('should drop transient nodes during serialization', () => {
|
|
18
|
-
let root!: TIsolate;
|
|
19
|
-
|
|
20
|
-
withRunTime(() => {
|
|
21
|
-
root = Isolate.create('Root', () => {
|
|
22
|
-
Isolate.create('Test', () => {}, { someData: true }, 'A');
|
|
23
|
-
Isolate.create('Debounce', () => {}, { transient: true });
|
|
24
|
-
Isolate.create('Test', () => {}, { someData: true }, 'B');
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const serialized = IsolateSerializer.serialize(root, v => v);
|
|
29
|
-
const parsed = IsolateSerializer.deserialize(serialized);
|
|
30
|
-
|
|
31
|
-
// Transient node should be stripped — only 2 children remain
|
|
32
|
-
expect(parsed.children).toHaveLength(2);
|
|
33
|
-
expect(parsed.children![0][IsolateKeys.Type]).toBe('Test');
|
|
34
|
-
expect(parsed.children![0].key).toBe('A');
|
|
35
|
-
expect(parsed.children![1][IsolateKeys.Type]).toBe('Test');
|
|
36
|
-
expect(parsed.children![1].key).toBe('B');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should preserve non-transient nodes fully', () => {
|
|
40
|
-
let root!: TIsolate;
|
|
41
|
-
|
|
42
|
-
withRunTime(() => {
|
|
43
|
-
root = Isolate.create('Root', () => {
|
|
44
|
-
Isolate.create('Test', () => {}, {}, 'A');
|
|
45
|
-
Isolate.create('Test', () => {}, {}, 'B');
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const serialized = IsolateSerializer.serialize(root, v => v);
|
|
50
|
-
const parsed = IsolateSerializer.deserialize(serialized);
|
|
51
|
-
|
|
52
|
-
expect(parsed.children).toHaveLength(2);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should handle nested transient children', () => {
|
|
56
|
-
let root!: TIsolate;
|
|
57
|
-
|
|
58
|
-
withRunTime(() => {
|
|
59
|
-
root = Isolate.create('Root', () => {
|
|
60
|
-
Isolate.create('Group', () => {
|
|
61
|
-
Isolate.create('Test', () => {}, {}, 'inner-A');
|
|
62
|
-
Isolate.create('Skip', () => {}, { transient: true });
|
|
63
|
-
Isolate.create('Test', () => {}, {}, 'inner-B');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const serialized = IsolateSerializer.serialize(root, v => v);
|
|
69
|
-
const parsed = IsolateSerializer.deserialize(serialized);
|
|
70
|
-
|
|
71
|
-
// Root has 1 child (Group)
|
|
72
|
-
expect(parsed.children).toHaveLength(1);
|
|
73
|
-
// Group should have 2 children (transient stripped)
|
|
74
|
-
const group = parsed.children![0];
|
|
75
|
-
expect(group.children).toHaveLength(2);
|
|
76
|
-
expect(group.children![0].key).toBe('inner-A');
|
|
77
|
-
expect(group.children![1].key).toBe('inner-B');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should produce identical output when no transient nodes exist (CoW identity)', () => {
|
|
81
|
-
let root!: TIsolate;
|
|
82
|
-
|
|
83
|
-
withRunTime(() => {
|
|
84
|
-
root = Isolate.create('Root', () => {
|
|
85
|
-
Isolate.create('Test', () => {}, {}, 'X');
|
|
86
|
-
Isolate.create('Test', () => {}, {}, 'Y');
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// Serialize twice — both should produce the exact same string
|
|
91
|
-
const first = IsolateSerializer.serialize(root, v => v);
|
|
92
|
-
const second = IsolateSerializer.serialize(root, v => v);
|
|
93
|
-
expect(first).toBe(second);
|
|
94
|
-
|
|
95
|
-
// And the deserialized structure should match
|
|
96
|
-
const parsed = IsolateSerializer.deserialize(first);
|
|
97
|
-
expect(parsed.children).toHaveLength(2);
|
|
98
|
-
expect(parsed.children![0].key).toBe('X');
|
|
99
|
-
expect(parsed.children![1].key).toBe('Y');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`IsolateSerializer > Custom Data Serialization > Should serialize data with custom keys 1`] = `"[{"0":"1","2":"URoot","3":{"4":"5"},"children":[{"0":"1","2":"UChild_1","3":{"4":"5"}},{"0":"1","2":"UChild_2"},{"0":"1","2":"UChild_3"}]},{"0":"status","1":"DONE","2":"$type","3":"data","4":"some_data","5":true}]"`;
|
|
4
|
-
|
|
5
|
-
exports[`IsolateSerializer > serialize > Should produce serialized dump 1`] = `"[{"0":"1","2":"URoot","3":{"4":"5"},"children":[{"0":"1","2":"UChild_1","3":{"4":"5"}},{"0":"1","2":"UChild_2"},{"0":"1","2":"UChild_3"}]},{"0":"status","1":"DONE","2":"$type","3":"data","4":"some_data","5":true}]"`;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { TIsolate } from '../Isolate/Isolate';
|
|
2
|
-
import { IsolateKeys } from '../Isolate/IsolateKeys';
|
|
3
|
-
|
|
4
|
-
export function genTestIsolate(payload: Record<string, any> = {}): TIsolate {
|
|
5
|
-
const { status, ...data } = payload;
|
|
6
|
-
return {
|
|
7
|
-
children: [],
|
|
8
|
-
data,
|
|
9
|
-
key: null,
|
|
10
|
-
keys: {},
|
|
11
|
-
output: null,
|
|
12
|
-
parent: null,
|
|
13
|
-
[IsolateKeys.Type]: 'UnitTest',
|
|
14
|
-
[IsolateKeys.AbortController]: null,
|
|
15
|
-
...(status && { status }),
|
|
16
|
-
};
|
|
17
|
-
}
|
package/src/vestjs-runtime.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { IsolateKeys } from './Isolate/IsolateKeys';
|
|
2
|
-
export type { RuntimeEvents } from './RuntimeEvents';
|
|
3
|
-
export { Isolate } from './Isolate/Isolate';
|
|
4
|
-
export type { IsolateKey, TIsolate } from './Isolate/Isolate';
|
|
5
|
-
export { Reconciler } from './Reconciler';
|
|
6
|
-
export type { IReconciler } from './Reconciler';
|
|
7
|
-
export * as Walker from './IsolateWalker';
|
|
8
|
-
export { RuntimeApi as VestRuntime } from './VestRuntime';
|
|
9
|
-
export { IsolateInspector } from './Isolate/IsolateInspector';
|
|
10
|
-
export { IsolateMutator } from './Isolate/IsolateMutator';
|
|
11
|
-
export * as Bus from './Bus';
|
|
12
|
-
export * as IsolateSelectors from './Isolate/IsolateSelectors';
|
|
13
|
-
export { IsolateSerializer } from './exports/IsolateSerializer';
|
|
14
|
-
export { IsolateStatus } from './Isolate/IsolateStatus';
|
|
15
|
-
export { IsolateStateMachine } from './Isolate/IsolateStateMachine';
|
|
16
|
-
export * as IsolateRegistry from './Isolate/IsolateRegistry';
|
|
17
|
-
export type {
|
|
18
|
-
RegistryCategoryConfig,
|
|
19
|
-
RegistryIndex,
|
|
20
|
-
} from './Isolate/IsolateRegistry';
|
|
21
|
-
export { IsolateReorderable } from './Isolate/IsolateReorderable';
|
|
22
|
-
export { IsolateTransient } from './Isolate/IsolateTransient';
|
|
23
|
-
export {
|
|
24
|
-
IsolateFocused,
|
|
25
|
-
FocusModes,
|
|
26
|
-
FocusSelectors,
|
|
27
|
-
type TIsolateFocused,
|
|
28
|
-
} from './Isolate/IsolateFocused';
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { CB, Maybe, Nullable } from "vest-utils";
|
|
3
|
-
|
|
4
|
-
//#region src/Isolate/IsolateKeys.d.ts
|
|
5
|
-
declare enum IsolateKeys {
|
|
6
|
-
Type = "$type",
|
|
7
|
-
Keys = "keys",
|
|
8
|
-
Key = "key",
|
|
9
|
-
Parent = "parent",
|
|
10
|
-
Data = "data",
|
|
11
|
-
AllowReorder = "allowReorder",
|
|
12
|
-
Transient = "transient",
|
|
13
|
-
Status = "status",
|
|
14
|
-
AbortController = "abortController",
|
|
15
|
-
Children = "children",
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/Isolate/IsolateStatus.d.ts
|
|
19
|
-
declare const IsolateStatus: {
|
|
20
|
-
readonly DONE: "DONE";
|
|
21
|
-
readonly HAS_PENDING: "HAS_PENDING";
|
|
22
|
-
readonly INITIAL: "INITIAL";
|
|
23
|
-
readonly PENDING: "PENDING";
|
|
24
|
-
};
|
|
25
|
-
type IsolateStatus = (typeof IsolateStatus)[keyof typeof IsolateStatus];
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/Isolate/IsolateTypes.d.ts
|
|
28
|
-
type IsolateKey = Nullable<string>;
|
|
29
|
-
type TIsolate<P extends IsolatePayload = IsolatePayload> = {
|
|
30
|
-
[IsolateKeys.AllowReorder]?: boolean;
|
|
31
|
-
[IsolateKeys.Transient]?: boolean;
|
|
32
|
-
[IsolateKeys.Parent]: Nullable<TIsolate>;
|
|
33
|
-
[IsolateKeys.Type]: string;
|
|
34
|
-
[IsolateKeys.Keys]: Nullable<Record<string, TIsolate>>;
|
|
35
|
-
[IsolateKeys.Data]: DataOnly<P>;
|
|
36
|
-
[IsolateKeys.Status]: IsolateStatus;
|
|
37
|
-
[IsolateKeys.AbortController]: Nullable<AbortController>;
|
|
38
|
-
children: Nullable<TIsolate[]>;
|
|
39
|
-
key: IsolateKey;
|
|
40
|
-
output: any;
|
|
41
|
-
} & UsedFeaturesOnly<P>;
|
|
42
|
-
type DataOnly<P extends IsolatePayload> = Omit<P, keyof IsolateFeatures>;
|
|
43
|
-
type UsedFeaturesOnly<P extends IsolatePayload> = Pick<P, keyof IsolateFeatures>;
|
|
44
|
-
type IsolatePayload<P = Record<string, any>> = P & IsolateFeatures;
|
|
45
|
-
type IsolateFeatures = {
|
|
46
|
-
[IsolateKeys.AllowReorder]?: boolean;
|
|
47
|
-
[IsolateKeys.Transient]?: boolean;
|
|
48
|
-
[IsolateKeys.Status]?: IsolateStatus;
|
|
49
|
-
};
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/Isolate/Isolate.d.ts
|
|
52
|
-
declare class Isolate {
|
|
53
|
-
static create<Payload extends IsolatePayload>(type: string, callback: CB, payload?: Maybe<Payload>, key?: IsolateKey): TIsolate<Payload>;
|
|
54
|
-
static isIsolate(node: any): node is TIsolate;
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
export { IsolateStatus as a, TIsolate as i, IsolateKey as n, IsolateKeys as o, IsolatePayload as r, Isolate as t };
|
|
58
|
-
//# sourceMappingURL=Isolate-DChR7h5K.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Isolate-DChR7h5K.d.mts","names":["IsolateKeys","ExcludedFromDump","Set","IsolateStatus","Nullable","IsolateKeys","IsolateStatus","IsolateKey","TIsolate","P","IsolatePayload","AllowReorder","Transient","Parent","Type","Record","Keys","DataOnly","Data","Status","AbortController","UsedFeaturesOnly","IsolateFeatures","Omit","Pick","CB","Maybe","IsolateKey","IsolatePayload","TIsolate","Isolate","Payload"],"sources":["../src/Isolate/IsolateKeys.d.ts","../src/Isolate/IsolateStatus.d.ts","../src/Isolate/IsolateTypes.d.ts","../src/Isolate/Isolate.d.ts"],"sourcesContent":["export declare enum IsolateKeys {\n Type = \"$type\",\n Keys = \"keys\",\n Key = \"key\",\n Parent = \"parent\",\n Data = \"data\",\n AllowReorder = \"allowReorder\",\n Transient = \"transient\",\n Status = \"status\",\n AbortController = \"abortController\",\n Children = \"children\"\n}\nexport declare const ExcludedFromDump: Set<IsolateKeys>;\n","export declare const IsolateStatus: {\n readonly DONE: \"DONE\";\n readonly HAS_PENDING: \"HAS_PENDING\";\n readonly INITIAL: \"INITIAL\";\n readonly PENDING: \"PENDING\";\n};\nexport type IsolateStatus = (typeof IsolateStatus)[keyof typeof IsolateStatus];\n","/// <reference types=\"node\" />\nimport { Nullable } from 'vest-utils';\nimport { IsolateKeys } from './IsolateKeys';\nimport { IsolateStatus } from './IsolateStatus';\nexport type IsolateKey = Nullable<string>;\nexport type TIsolate<P extends IsolatePayload = IsolatePayload> = {\n [IsolateKeys.AllowReorder]?: boolean;\n [IsolateKeys.Transient]?: boolean;\n [IsolateKeys.Parent]: Nullable<TIsolate>;\n [IsolateKeys.Type]: string;\n [IsolateKeys.Keys]: Nullable<Record<string, TIsolate>>;\n [IsolateKeys.Data]: DataOnly<P>;\n [IsolateKeys.Status]: IsolateStatus;\n [IsolateKeys.AbortController]: Nullable<AbortController>;\n children: Nullable<TIsolate[]>;\n key: IsolateKey;\n output: any;\n} & UsedFeaturesOnly<P>;\ntype DataOnly<P extends IsolatePayload> = Omit<P, keyof IsolateFeatures>;\ntype UsedFeaturesOnly<P extends IsolatePayload> = Pick<P, keyof IsolateFeatures>;\nexport type IsolatePayload<P = Record<string, any>> = P & IsolateFeatures;\nexport type IsolateFeatures = {\n [IsolateKeys.AllowReorder]?: boolean;\n [IsolateKeys.Transient]?: boolean;\n [IsolateKeys.Status]?: IsolateStatus;\n};\nexport {};\n","import { CB, Maybe } from 'vest-utils';\nimport type { IsolateKey, IsolatePayload, TIsolate } from './IsolateTypes';\nexport { IsolateKey, TIsolate };\nexport declare class Isolate {\n static create<Payload extends IsolatePayload>(type: string, callback: CB, payload?: Maybe<Payload>, key?: IsolateKey): TIsolate<Payload>;\n static isIsolate(node: any): node is TIsolate;\n}\n"],"mappings":";;;;aAAoBA,WAAAA;;;EAAAA,GAAAA,GAAAA,KAAAA;;;;ECACG,SAAAA,GAAAA,WAKpB;EACWA,MAAAA,GAAAA,QAAa;;;;;;cANJA;;;EDADH,SAAAA,OAAW,EAAA,SAAA;;;KCMnBG,aAAAA,WAAwBA,4BAA4BA;;;KCFpDI,UAAAA,GAAaH;KACbI,mBAAmBE,iBAAiBA;GAC3CL,WAAAA,CAAYM,YAAAA;EDNIR,CCOhBE,WAAAA,CAAYO,SAAAA,EDFhB,EAAA,OAAA;EACWT,CCEPE,WAAAA,CAAYQ,MAAAA,CDFQ,ECECT,QDFUD,CCEDK,QDFCL,CAAAA;GCG/BE,WAAAA,CAAYS,IAAAA;GACZT,WAAAA,CAAYW,IAAAA,GAAOZ,SAASW,eAAeP;GAC3CH,WAAAA,CAAYa,IAAAA,GAAOD,SAASR;EAPrBF,CAQPF,WAAAA,CAAYc,MAAAA,CARK,EAQIb,aARO;EACrBE,CAQPH,WAAAA,CAAYe,eAAAA,CARG,EAQehB,QARf,CAQwBgB,eARxB,CAAA;EAAWV,QAAAA,EASjBN,QATiBM,CASRF,QATQE,EAAAA,CAAAA;EAAiBA,GAAAA,EAUvCH,UAVuCG;EAC3CL,MAAAA,EAAAA,GAAYM;CACZN,GAUDgB,gBAVaT,CAUIH,CAVJG,CAAAA;KAWZK,QAV8BT,CAAAA,UAUXE,cAVWF,CAAAA,GAUOe,IAVPf,CAUYC,CAVZD,EAAAA,MAUqBc,eAVrBd,CAAAA;KAW9Ba,gBAXqBjB,CAAAA,UAWMM,cAXNN,CAAAA,GAWwBoB,IAXxBpB,CAW6BK,CAX7BL,EAAAA,MAWsCkB,eAXtClB,CAAAA;AAArBC,KAYOK,cAZKG,CAAAA,IAYcE,MAZdF,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,CAAAA,GAYqCJ,CAZrCI,GAYyCS,eAZzCT;AACZR,KAYOiB,eAAAA,GAZKR;EAC+BN,CAY3CH,WAAAA,CAAYM,YAAAA,EAZ+BH,EAAAA,OAAAA;EAAfO,CAa5BV,WAAAA,CAAYO,SAAAA,EAbgBG,EAAAA,OAAAA;EAATX,CAcnBC,WAAAA,CAAYc,MAAAA,EAdOf,EAcGE,aAdHF;CAAnBC;;;AFVeL,cGGC8B,OAAAA,CHHU;gCGIGF,wCAAwCH,cAAcC,MAAMK,gBAAgBJ,aAAaE,SAASE;uCAC3FF"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { CB, Maybe, Nullable } from "vest-utils";
|
|
3
|
-
|
|
4
|
-
//#region src/Isolate/IsolateKeys.d.ts
|
|
5
|
-
declare enum IsolateKeys {
|
|
6
|
-
Type = "$type",
|
|
7
|
-
Keys = "keys",
|
|
8
|
-
Key = "key",
|
|
9
|
-
Parent = "parent",
|
|
10
|
-
Data = "data",
|
|
11
|
-
AllowReorder = "allowReorder",
|
|
12
|
-
Transient = "transient",
|
|
13
|
-
Status = "status",
|
|
14
|
-
AbortController = "abortController",
|
|
15
|
-
Children = "children",
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/Isolate/IsolateStatus.d.ts
|
|
19
|
-
declare const IsolateStatus: {
|
|
20
|
-
readonly DONE: "DONE";
|
|
21
|
-
readonly HAS_PENDING: "HAS_PENDING";
|
|
22
|
-
readonly INITIAL: "INITIAL";
|
|
23
|
-
readonly PENDING: "PENDING";
|
|
24
|
-
};
|
|
25
|
-
type IsolateStatus = (typeof IsolateStatus)[keyof typeof IsolateStatus];
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/Isolate/IsolateTypes.d.ts
|
|
28
|
-
type IsolateKey = Nullable<string>;
|
|
29
|
-
type TIsolate<P extends IsolatePayload = IsolatePayload> = {
|
|
30
|
-
[IsolateKeys.AllowReorder]?: boolean;
|
|
31
|
-
[IsolateKeys.Transient]?: boolean;
|
|
32
|
-
[IsolateKeys.Parent]: Nullable<TIsolate>;
|
|
33
|
-
[IsolateKeys.Type]: string;
|
|
34
|
-
[IsolateKeys.Keys]: Nullable<Record<string, TIsolate>>;
|
|
35
|
-
[IsolateKeys.Data]: DataOnly<P>;
|
|
36
|
-
[IsolateKeys.Status]: IsolateStatus;
|
|
37
|
-
[IsolateKeys.AbortController]: Nullable<AbortController>;
|
|
38
|
-
children: Nullable<TIsolate[]>;
|
|
39
|
-
key: IsolateKey;
|
|
40
|
-
output: any;
|
|
41
|
-
} & UsedFeaturesOnly<P>;
|
|
42
|
-
type DataOnly<P extends IsolatePayload> = Omit<P, keyof IsolateFeatures>;
|
|
43
|
-
type UsedFeaturesOnly<P extends IsolatePayload> = Pick<P, keyof IsolateFeatures>;
|
|
44
|
-
type IsolatePayload<P = Record<string, any>> = P & IsolateFeatures;
|
|
45
|
-
type IsolateFeatures = {
|
|
46
|
-
[IsolateKeys.AllowReorder]?: boolean;
|
|
47
|
-
[IsolateKeys.Transient]?: boolean;
|
|
48
|
-
[IsolateKeys.Status]?: IsolateStatus;
|
|
49
|
-
};
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/Isolate/Isolate.d.ts
|
|
52
|
-
declare class Isolate {
|
|
53
|
-
static create<Payload extends IsolatePayload>(type: string, callback: CB, payload?: Maybe<Payload>, key?: IsolateKey): TIsolate<Payload>;
|
|
54
|
-
static isIsolate(node: any): node is TIsolate;
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
export { IsolateStatus as a, TIsolate as i, IsolateKey as n, IsolateKeys as o, IsolatePayload as r, Isolate as t };
|
|
58
|
-
//# sourceMappingURL=Isolate-HYIh82M8.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Isolate-HYIh82M8.d.cts","names":["IsolateKeys","ExcludedFromDump","Set","IsolateStatus","Nullable","IsolateKeys","IsolateStatus","IsolateKey","TIsolate","P","IsolatePayload","AllowReorder","Transient","Parent","Type","Record","Keys","DataOnly","Data","Status","AbortController","UsedFeaturesOnly","IsolateFeatures","Omit","Pick","CB","Maybe","IsolateKey","IsolatePayload","TIsolate","Isolate","Payload"],"sources":["../src/Isolate/IsolateKeys.d.ts","../src/Isolate/IsolateStatus.d.ts","../src/Isolate/IsolateTypes.d.ts","../src/Isolate/Isolate.d.ts"],"sourcesContent":["export declare enum IsolateKeys {\n Type = \"$type\",\n Keys = \"keys\",\n Key = \"key\",\n Parent = \"parent\",\n Data = \"data\",\n AllowReorder = \"allowReorder\",\n Transient = \"transient\",\n Status = \"status\",\n AbortController = \"abortController\",\n Children = \"children\"\n}\nexport declare const ExcludedFromDump: Set<IsolateKeys>;\n","export declare const IsolateStatus: {\n readonly DONE: \"DONE\";\n readonly HAS_PENDING: \"HAS_PENDING\";\n readonly INITIAL: \"INITIAL\";\n readonly PENDING: \"PENDING\";\n};\nexport type IsolateStatus = (typeof IsolateStatus)[keyof typeof IsolateStatus];\n","/// <reference types=\"node\" />\nimport { Nullable } from 'vest-utils';\nimport { IsolateKeys } from './IsolateKeys';\nimport { IsolateStatus } from './IsolateStatus';\nexport type IsolateKey = Nullable<string>;\nexport type TIsolate<P extends IsolatePayload = IsolatePayload> = {\n [IsolateKeys.AllowReorder]?: boolean;\n [IsolateKeys.Transient]?: boolean;\n [IsolateKeys.Parent]: Nullable<TIsolate>;\n [IsolateKeys.Type]: string;\n [IsolateKeys.Keys]: Nullable<Record<string, TIsolate>>;\n [IsolateKeys.Data]: DataOnly<P>;\n [IsolateKeys.Status]: IsolateStatus;\n [IsolateKeys.AbortController]: Nullable<AbortController>;\n children: Nullable<TIsolate[]>;\n key: IsolateKey;\n output: any;\n} & UsedFeaturesOnly<P>;\ntype DataOnly<P extends IsolatePayload> = Omit<P, keyof IsolateFeatures>;\ntype UsedFeaturesOnly<P extends IsolatePayload> = Pick<P, keyof IsolateFeatures>;\nexport type IsolatePayload<P = Record<string, any>> = P & IsolateFeatures;\nexport type IsolateFeatures = {\n [IsolateKeys.AllowReorder]?: boolean;\n [IsolateKeys.Transient]?: boolean;\n [IsolateKeys.Status]?: IsolateStatus;\n};\nexport {};\n","import { CB, Maybe } from 'vest-utils';\nimport type { IsolateKey, IsolatePayload, TIsolate } from './IsolateTypes';\nexport { IsolateKey, TIsolate };\nexport declare class Isolate {\n static create<Payload extends IsolatePayload>(type: string, callback: CB, payload?: Maybe<Payload>, key?: IsolateKey): TIsolate<Payload>;\n static isIsolate(node: any): node is TIsolate;\n}\n"],"mappings":";;;;aAAoBA,WAAAA;;;EAAAA,GAAAA,GAAAA,KAAAA;;;;ECACG,SAAAA,GAAAA,WAKpB;EACWA,MAAAA,GAAAA,QAAa;;;;;;cANJA;;;EDADH,SAAAA,OAAW,EAAA,SAAA;;;KCMnBG,aAAAA,WAAwBA,4BAA4BA;;;KCFpDI,UAAAA,GAAaH;KACbI,mBAAmBE,iBAAiBA;GAC3CL,WAAAA,CAAYM,YAAAA;EDNIR,CCOhBE,WAAAA,CAAYO,SAAAA,EDFhB,EAAA,OAAA;EACWT,CCEPE,WAAAA,CAAYQ,MAAAA,CDFQ,ECECT,QDFUD,CCEDK,QDFCL,CAAAA;GCG/BE,WAAAA,CAAYS,IAAAA;GACZT,WAAAA,CAAYW,IAAAA,GAAOZ,SAASW,eAAeP;GAC3CH,WAAAA,CAAYa,IAAAA,GAAOD,SAASR;EAPrBF,CAQPF,WAAAA,CAAYc,MAAAA,CARK,EAQIb,aARO;EACrBE,CAQPH,WAAAA,CAAYe,eAAAA,CARG,EAQehB,QARf,CAQwBgB,eARxB,CAAA;EAAWV,QAAAA,EASjBN,QATiBM,CASRF,QATQE,EAAAA,CAAAA;EAAiBA,GAAAA,EAUvCH,UAVuCG;EAC3CL,MAAAA,EAAAA,GAAYM;CACZN,GAUDgB,gBAVaT,CAUIH,CAVJG,CAAAA;KAWZK,QAV8BT,CAAAA,UAUXE,cAVWF,CAAAA,GAUOe,IAVPf,CAUYC,CAVZD,EAAAA,MAUqBc,eAVrBd,CAAAA;KAW9Ba,gBAXqBjB,CAAAA,UAWMM,cAXNN,CAAAA,GAWwBoB,IAXxBpB,CAW6BK,CAX7BL,EAAAA,MAWsCkB,eAXtClB,CAAAA;AAArBC,KAYOK,cAZKG,CAAAA,IAYcE,MAZdF,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,CAAAA,GAYqCJ,CAZrCI,GAYyCS,eAZzCT;AACZR,KAYOiB,eAAAA,GAZKR;EAC+BN,CAY3CH,WAAAA,CAAYM,YAAAA,EAZ+BH,EAAAA,OAAAA;EAAfO,CAa5BV,WAAAA,CAAYO,SAAAA,EAbgBG,EAAAA,OAAAA;EAATX,CAcnBC,WAAAA,CAAYc,MAAAA,EAdOf,EAcGE,aAdHF;CAAnBC;;;AFVeL,cGGC8B,OAAAA,CHHU;gCGIGF,wCAAwCH,cAAcC,MAAMK,gBAAgBJ,aAAaE,SAASE;uCAC3FF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { i as TIsolate } from "./Isolate-DChR7h5K.mjs";
|
|
2
|
-
import { Nullable, Result } from "vest-utils";
|
|
3
|
-
|
|
4
|
-
//#region src/exports/IsolateSerializer.d.ts
|
|
5
|
-
declare class IsolateSerializer {
|
|
6
|
-
static safeDeserialize(node: Record<string, any> | TIsolate | string): Result<TIsolate, Error>;
|
|
7
|
-
static deserialize(node: Record<string, any> | TIsolate | string): TIsolate;
|
|
8
|
-
static serialize(isolate: Nullable<TIsolate>, replacer?: (value: any, key: string) => any): string;
|
|
9
|
-
static validateIsolate(node: Record<string, any> | TIsolate): Result<TIsolate, string>;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { IsolateSerializer as t };
|
|
13
|
-
//# sourceMappingURL=IsolateSerializer-BCg01Px5.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IsolateSerializer-BCg01Px5.d.mts","names":["Nullable","Result","TIsolate","IsolateSerializer","Record","Error"],"sources":["../src/exports/IsolateSerializer.d.ts"],"sourcesContent":["import { Nullable, Result } from 'vest-utils';\nimport { TIsolate } from '../Isolate/Isolate';\nexport declare class IsolateSerializer {\n static safeDeserialize(node: Record<string, any> | TIsolate | string): Result<TIsolate, Error>;\n static deserialize(node: Record<string, any> | TIsolate | string): TIsolate;\n static serialize(isolate: Nullable<TIsolate>, replacer?: (value: any, key: string) => any): string;\n static validateIsolate(node: Record<string, any> | TIsolate): Result<TIsolate, string>;\n}\n"],"mappings":";;;;cAEqBG,iBAAAA;+BACYC,sBAAsBF,oBAAoBD,OAAOC,UAAUG;EADvEF,OAAAA,WAAAA,CAAAA,IAAiB,EAETC,MAFS,CAAA,MAAA,EAAA,GAAA,CAAA,GAEaF,QAFb,GAAA,MAAA,CAAA,EAEiCA,QAFjC;EACLE,OAAAA,SAAAA,CAAAA,OAAAA,EAEHJ,QAFGI,CAEMF,QAFNE,CAAAA,EAAAA,QAAAA,CAAAA,EAAAA,CAAAA,KAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAAAA,MAAAA,EAAAA,GAAAA,GAAAA,CAAAA,EAAAA,MAAAA;EAAsBF,OAAAA,eAAAA,CAAAA,IAAAA,EAGtBE,MAHsBF,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAGAA,QAHAA,CAAAA,EAGWD,MAHXC,CAGkBA,QAHlBA,EAAAA,MAAAA,CAAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { i as TIsolate } from "./Isolate-HYIh82M8.cjs";
|
|
2
|
-
import { Nullable, Result } from "vest-utils";
|
|
3
|
-
|
|
4
|
-
//#region src/exports/IsolateSerializer.d.ts
|
|
5
|
-
declare class IsolateSerializer {
|
|
6
|
-
static safeDeserialize(node: Record<string, any> | TIsolate | string): Result<TIsolate, Error>;
|
|
7
|
-
static deserialize(node: Record<string, any> | TIsolate | string): TIsolate;
|
|
8
|
-
static serialize(isolate: Nullable<TIsolate>, replacer?: (value: any, key: string) => any): string;
|
|
9
|
-
static validateIsolate(node: Record<string, any> | TIsolate): Result<TIsolate, string>;
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
12
|
-
export { IsolateSerializer as t };
|
|
13
|
-
//# sourceMappingURL=IsolateSerializer-CQpP6A4m.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IsolateSerializer-CQpP6A4m.d.cts","names":["Nullable","Result","TIsolate","IsolateSerializer","Record","Error"],"sources":["../src/exports/IsolateSerializer.d.ts"],"sourcesContent":["import { Nullable, Result } from 'vest-utils';\nimport { TIsolate } from '../Isolate/Isolate';\nexport declare class IsolateSerializer {\n static safeDeserialize(node: Record<string, any> | TIsolate | string): Result<TIsolate, Error>;\n static deserialize(node: Record<string, any> | TIsolate | string): TIsolate;\n static serialize(isolate: Nullable<TIsolate>, replacer?: (value: any, key: string) => any): string;\n static validateIsolate(node: Record<string, any> | TIsolate): Result<TIsolate, string>;\n}\n"],"mappings":";;;;cAEqBG,iBAAAA;+BACYC,sBAAsBF,oBAAoBD,OAAOC,UAAUG;EADvEF,OAAAA,WAAAA,CAAAA,IAAiB,EAETC,MAFS,CAAA,MAAA,EAAA,GAAA,CAAA,GAEaF,QAFb,GAAA,MAAA,CAAA,EAEiCA,QAFjC;EACLE,OAAAA,SAAAA,CAAAA,OAAAA,EAEHJ,QAFGI,CAEMF,QAFNE,CAAAA,EAAAA,QAAAA,CAAAA,EAAAA,CAAAA,KAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAAAA,MAAAA,EAAAA,GAAAA,GAAAA,CAAAA,EAAAA,MAAAA;EAAsBF,OAAAA,eAAAA,CAAAA,IAAAA,EAGtBE,MAHsBF,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAGAA,QAHAA,CAAAA,EAGWD,MAHXC,CAGkBA,QAHlBA,EAAAA,MAAAA,CAAAA"}
|