vestjs-runtime 1.0.4 → 1.0.6
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/IsolateSerializer.development.js +18 -2
- package/dist/cjs/IsolateSerializer.development.js.map +1 -1
- package/dist/cjs/IsolateSerializer.production.js +1 -1
- package/dist/cjs/IsolateSerializer.production.js.map +1 -1
- package/dist/cjs/test-utils.development.js +11 -0
- package/dist/cjs/test-utils.development.js.map +1 -1
- package/dist/cjs/test-utils.production.js +1 -1
- package/dist/cjs/test-utils.production.js.map +1 -1
- package/dist/cjs/vestjs-runtime.development.js +164 -123
- package/dist/cjs/vestjs-runtime.development.js.map +1 -1
- package/dist/cjs/vestjs-runtime.production.js +1 -1
- package/dist/cjs/vestjs-runtime.production.js.map +1 -1
- package/dist/es/IsolateSerializer.development.js +18 -2
- package/dist/es/IsolateSerializer.development.js.map +1 -1
- package/dist/es/IsolateSerializer.production.js +1 -1
- package/dist/es/IsolateSerializer.production.js.map +1 -1
- package/dist/es/test-utils.development.js +11 -0
- package/dist/es/test-utils.development.js.map +1 -1
- package/dist/es/test-utils.production.js +1 -1
- package/dist/es/test-utils.production.js.map +1 -1
- package/dist/es/vestjs-runtime.development.js +166 -125
- package/dist/es/vestjs-runtime.development.js.map +1 -1
- package/dist/es/vestjs-runtime.production.js +1 -1
- package/dist/es/vestjs-runtime.production.js.map +1 -1
- package/dist/umd/IsolateSerializer.development.js +18 -2
- package/dist/umd/IsolateSerializer.development.js.map +1 -1
- package/dist/umd/IsolateSerializer.production.js +1 -1
- package/dist/umd/IsolateSerializer.production.js.map +1 -1
- package/dist/umd/test-utils.development.js +11 -0
- package/dist/umd/test-utils.development.js.map +1 -1
- package/dist/umd/test-utils.production.js +1 -1
- package/dist/umd/test-utils.production.js.map +1 -1
- package/dist/umd/vestjs-runtime.development.js +164 -123
- package/dist/umd/vestjs-runtime.development.js.map +1 -1
- package/dist/umd/vestjs-runtime.production.js +1 -1
- package/dist/umd/vestjs-runtime.production.js.map +1 -1
- package/package.json +3 -3
- package/types/IsolateSerializer.d.ts +8 -1
- package/types/IsolateSerializer.d.ts.map +1 -1
- package/types/test-utils.d.ts +8 -1
- package/types/test-utils.d.ts.map +1 -1
- package/types/vestjs-runtime.d.ts +38 -7
- package/types/vestjs-runtime.d.ts.map +1 -1
|
@@ -7,7 +7,7 @@ var ErrorStrings;
|
|
|
7
7
|
ErrorStrings["NO_ACTIVE_ISOLATE"] = "Not within an active isolate";
|
|
8
8
|
ErrorStrings["UNABLE_TO_PICK_NEXT_ISOLATE"] = "Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.";
|
|
9
9
|
ErrorStrings["ENCOUNTERED_THE_SAME_KEY_TWICE"] = "Encountered the same key \"{key}\" twice. This may lead to inconsistent or overriding of results.";
|
|
10
|
-
ErrorStrings["
|
|
10
|
+
ErrorStrings["INVALID_ISOLATE_CANNOT_PARSE"] = "Invalid isolate was passed to IsolateSerializer. Cannot proceed.";
|
|
11
11
|
})(ErrorStrings || (ErrorStrings = {}));
|
|
12
12
|
|
|
13
13
|
var IsolateKeys;
|
|
@@ -18,6 +18,7 @@ var IsolateKeys;
|
|
|
18
18
|
IsolateKeys["Parent"] = "parent";
|
|
19
19
|
IsolateKeys["Data"] = "data";
|
|
20
20
|
IsolateKeys["AllowReorder"] = "allowReorder";
|
|
21
|
+
IsolateKeys["Status"] = "status";
|
|
21
22
|
})(IsolateKeys || (IsolateKeys = {}));
|
|
22
23
|
var MinifiedKeys;
|
|
23
24
|
(function (MinifiedKeys) {
|
|
@@ -27,6 +28,7 @@ var MinifiedKeys;
|
|
|
27
28
|
MinifiedKeys["Parent"] = "P";
|
|
28
29
|
MinifiedKeys["Data"] = "D";
|
|
29
30
|
MinifiedKeys["AllowReorder"] = "aR";
|
|
31
|
+
MinifiedKeys["Status"] = "S";
|
|
30
32
|
})(MinifiedKeys || (MinifiedKeys = {}));
|
|
31
33
|
const KeyToMinified = {
|
|
32
34
|
[IsolateKeys.Type]: MinifiedKeys.Type,
|
|
@@ -35,6 +37,7 @@ const KeyToMinified = {
|
|
|
35
37
|
[IsolateKeys.Data]: MinifiedKeys.Data,
|
|
36
38
|
[IsolateKeys.Key]: MinifiedKeys.Key,
|
|
37
39
|
[IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,
|
|
40
|
+
[IsolateKeys.Status]: MinifiedKeys.Status,
|
|
38
41
|
};
|
|
39
42
|
// This const is an object that looks like this:
|
|
40
43
|
// {
|
|
@@ -47,6 +50,13 @@ const MinifiedToKey = Object.entries(KeyToMinified).reduce((acc, [key, minified]
|
|
|
47
50
|
[minified]: key,
|
|
48
51
|
}), {});
|
|
49
52
|
|
|
53
|
+
var IsolateStatus;
|
|
54
|
+
(function (IsolateStatus) {
|
|
55
|
+
IsolateStatus["PENDING"] = "PENDING";
|
|
56
|
+
IsolateStatus["DONE"] = "DONE";
|
|
57
|
+
IsolateStatus["INITIAL"] = "INITIAL";
|
|
58
|
+
})(IsolateStatus || (IsolateStatus = {}));
|
|
59
|
+
|
|
50
60
|
class IsolateMutator {
|
|
51
61
|
static setParent(isolate, parent) {
|
|
52
62
|
isolate.parent = parent;
|
|
@@ -87,6 +97,12 @@ class IsolateMutator {
|
|
|
87
97
|
static setData(isolate, data) {
|
|
88
98
|
isolate.data = data;
|
|
89
99
|
}
|
|
100
|
+
static setPending(isolate) {
|
|
101
|
+
isolate.status = IsolateStatus.PENDING;
|
|
102
|
+
}
|
|
103
|
+
static setDone(isolate) {
|
|
104
|
+
isolate.status = IsolateStatus.DONE;
|
|
105
|
+
}
|
|
90
106
|
}
|
|
91
107
|
|
|
92
108
|
class IsolateSerializer {
|
|
@@ -143,7 +159,7 @@ class IsolateSerializer {
|
|
|
143
159
|
}
|
|
144
160
|
static validateIsolate(node) {
|
|
145
161
|
vestUtils.invariant(vestUtils.hasOwnProperty(node, IsolateKeys.Type) ||
|
|
146
|
-
vestUtils.hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]), vestUtils.text(ErrorStrings.
|
|
162
|
+
vestUtils.hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]), vestUtils.text(ErrorStrings.INVALID_ISOLATE_CANNOT_PARSE));
|
|
147
163
|
}
|
|
148
164
|
}
|
|
149
165
|
// eslint-disable-next-line max-statements, complexity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsolateSerializer.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/Isolate/IsolateKeys.ts","../../src/Isolate/IsolateMutator.ts","../../src/exports/IsolateSerializer.ts"],"sourcesContent":["export enum ErrorStrings {\n NO_ACTIVE_ISOLATE = 'Not within an active isolate',\n UNABLE_TO_PICK_NEXT_ISOLATE = 'Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.',\n ENCOUNTERED_THE_SAME_KEY_TWICE = `Encountered the same key \"{key}\" twice. This may lead to inconsistent or overriding of results.`,\n IVALID_ISOLATE_CANNOT_PARSE = `Invalid isolate was passed to IsolateSerializer. Cannot proceed.`,\n}\n","export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","import { Nullable, invariant, isNullish } from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\n\nexport class IsolateMutator {\n static setParent(isolate: TIsolate, parent: Nullable<TIsolate>): TIsolate {\n isolate.parent = parent;\n return isolate;\n }\n\n static saveOutput(isolate: TIsolate, output: any): TIsolate {\n isolate.output = output;\n return isolate;\n }\n\n static setKey(isolate: TIsolate, key: Nullable<string>): TIsolate {\n isolate.key = key;\n return isolate;\n }\n\n static addChild(isolate: TIsolate, child: TIsolate): void {\n invariant(isolate);\n\n isolate.children = isolate.children ?? [];\n\n isolate.children.push(child);\n IsolateMutator.setParent(child, isolate);\n }\n\n static removeChild(isolate: TIsolate, node: TIsolate): void {\n isolate.children =\n isolate.children?.filter(child => child !== node) ?? null;\n }\n\n static addChildKey(isolate: TIsolate, key: string, node: TIsolate): void {\n invariant(isolate);\n\n isolate.keys = isolate.keys ?? {};\n\n isolate.keys[key] = node;\n }\n\n static slice(isolate: TIsolate, at: number): void {\n if (isNullish(isolate.children)) {\n return;\n }\n isolate.children.length = at;\n }\n\n static setData(isolate: TIsolate, data: any): void {\n isolate.data = data;\n }\n}\n","import { ErrorStrings } from 'ErrorStrings';\nimport {\n Nullable,\n hasOwnProperty,\n invariant,\n isNotNullish,\n isNullish,\n isStringValue,\n text,\n} from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\nimport { IsolateKeys, KeyToMinified, MinifiedToKey } from 'IsolateKeys';\nimport { IsolateMutator } from 'IsolateMutator';\n\nexport class IsolateSerializer {\n // eslint-disable-next-line max-statements, complexity\n static deserialize(node: Record<string, any> | TIsolate | string): TIsolate {\n // the assumption is that the tree is built correctly,\n // but the children are missing the parent property to\n // avoid circular references during serialization.\n // in the same way, the parents are missing the `keys` property\n // to avoid circular references during serialization.\n // we need to rebuild the tree and add back the parent property to the children\n // and the keys property to the parents.\n\n const root = isStringValue(node)\n ? JSON.parse(node)\n : ({ ...node } as TIsolate);\n\n IsolateSerializer.validateIsolate(root);\n\n const queue = [root];\n\n while (queue.length) {\n const current = queue.shift();\n\n const children = IsolateSerializer.getChildren(current);\n\n for (const key in MinifiedToKey) {\n const value = current[key];\n if (isNotNullish(value)) {\n current[MinifiedToKey[key]] = value;\n delete current[key];\n }\n }\n\n if (!children) {\n continue;\n }\n\n current.children = children.map(child => {\n const nextChild = { ...child };\n\n IsolateMutator.setParent(nextChild, current);\n queue.push(nextChild);\n\n const key = nextChild.key;\n\n if (key) {\n current.keys = current.keys ?? {};\n current.keys[key] = nextChild;\n }\n\n return nextChild;\n });\n }\n\n return root as TIsolate;\n }\n\n static serialize(isolate: Nullable<TIsolate>): string {\n if (isNullish(isolate)) {\n return '';\n }\n\n return JSON.stringify(transformIsolate(isolate));\n }\n\n static getChildren(node: TIsolate): Nullable<TIsolate[]> {\n return node.children ? [...node.children] : null;\n }\n\n static validateIsolate(node: Record<string, any> | TIsolate): void {\n invariant(\n hasOwnProperty(node, IsolateKeys.Type) ||\n hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]),\n text(ErrorStrings.IVALID_ISOLATE_CANNOT_PARSE)\n );\n }\n}\n\n// eslint-disable-next-line max-statements, complexity\nfunction transformIsolate(isolate: TIsolate): Record<string, any> {\n const next: Record<string, any> = {};\n\n if (isolate.children) {\n next.children = isolate.children.map(transformIsolate);\n }\n\n for (const key in isolate) {\n if (key === 'children') {\n continue;\n }\n\n if (isKeyExcluededFromDump(key)) {\n continue;\n }\n const value = isolate[key as keyof TIsolate];\n\n if (isNullish(value)) {\n continue;\n }\n\n if (hasOwnProperty(KeyToMinified, key)) {\n next[KeyToMinified[key]] = value;\n } else {\n next[key] = value;\n }\n }\n\n return next;\n}\n\nfunction isKeyExcluededFromDump(key: string): boolean {\n return [IsolateKeys.Parent, IsolateKeys.Keys].includes(key as IsolateKeys);\n}\n"],"names":["invariant","isNullish","isStringValue","isNotNullish","hasOwnProperty","text"],"mappings":";;;;AAAA,IAAY,YAKX,CAAA;AALD,CAAA,UAAY,YAAY,EAAA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SAAA;AAED,QAAA,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAAE;YAC/B,SAAS;AACV,SAAA;AACD,QAAA,MAAM,KAAK,GAAG,OAAO,CAAC,GAAqB,CAAC,CAAC;AAE7C,QAAA,IAAIJ,mBAAS,CAAC,KAAK,CAAC,EAAE;YACpB,SAAS;AACV,SAAA;AAED,QAAA,IAAIG,wBAAc,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE;YACtC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAClC,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACnB,SAAA;AACF,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW,EAAA;AACzC,IAAA,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAkB,CAAC,CAAC;AAC7E;;;;"}
|
|
1
|
+
{"version":3,"file":"IsolateSerializer.development.js","sources":["../../src/errors/ErrorStrings.ts","../../src/Isolate/IsolateKeys.ts","../../src/Isolate/IsolateStatus.ts","../../src/Isolate/IsolateMutator.ts","../../src/exports/IsolateSerializer.ts"],"sourcesContent":["export enum ErrorStrings {\n NO_ACTIVE_ISOLATE = 'Not within an active isolate',\n UNABLE_TO_PICK_NEXT_ISOLATE = 'Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.',\n ENCOUNTERED_THE_SAME_KEY_TWICE = `Encountered the same key \"{key}\" twice. This may lead to inconsistent or overriding of results.`,\n INVALID_ISOLATE_CANNOT_PARSE = `Invalid isolate was passed to IsolateSerializer. Cannot proceed.`,\n}\n","export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n Status = 'status',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n Status = 'S',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n [IsolateKeys.Status]: MinifiedKeys.Status,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","export enum IsolateStatus {\n PENDING = 'PENDING',\n DONE = 'DONE',\n INITIAL = 'INITIAL',\n}\n","import { Nullable, invariant, isNullish } from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\nimport { IsolateStatus } from 'IsolateStatus';\n\nexport class IsolateMutator {\n static setParent(isolate: TIsolate, parent: Nullable<TIsolate>): TIsolate {\n isolate.parent = parent;\n return isolate;\n }\n\n static saveOutput(isolate: TIsolate, output: any): TIsolate {\n isolate.output = output;\n return isolate;\n }\n\n static setKey(isolate: TIsolate, key: Nullable<string>): TIsolate {\n isolate.key = key;\n return isolate;\n }\n\n static addChild(isolate: TIsolate, child: TIsolate): void {\n invariant(isolate);\n\n isolate.children = isolate.children ?? [];\n\n isolate.children.push(child);\n IsolateMutator.setParent(child, isolate);\n }\n\n static removeChild(isolate: TIsolate, node: TIsolate): void {\n isolate.children =\n isolate.children?.filter(child => child !== node) ?? null;\n }\n\n static addChildKey(isolate: TIsolate, key: string, node: TIsolate): void {\n invariant(isolate);\n\n isolate.keys = isolate.keys ?? {};\n\n isolate.keys[key] = node;\n }\n\n static slice(isolate: TIsolate, at: number): void {\n if (isNullish(isolate.children)) {\n return;\n }\n isolate.children.length = at;\n }\n\n static setData(isolate: TIsolate, data: any): void {\n isolate.data = data;\n }\n\n static setPending(isolate: TIsolate): void {\n isolate.status = IsolateStatus.PENDING;\n }\n\n static setDone(isolate: TIsolate): void {\n isolate.status = IsolateStatus.DONE;\n }\n}\n","import { ErrorStrings } from 'ErrorStrings';\nimport {\n Nullable,\n hasOwnProperty,\n invariant,\n isNotNullish,\n isNullish,\n isStringValue,\n text,\n} from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\nimport { IsolateKeys, KeyToMinified, MinifiedToKey } from 'IsolateKeys';\nimport { IsolateMutator } from 'IsolateMutator';\n\nexport class IsolateSerializer {\n // eslint-disable-next-line max-statements, complexity\n static deserialize(node: Record<string, any> | TIsolate | string): TIsolate {\n // the assumption is that the tree is built correctly,\n // but the children are missing the parent property to\n // avoid circular references during serialization.\n // in the same way, the parents are missing the `keys` property\n // to avoid circular references during serialization.\n // we need to rebuild the tree and add back the parent property to the children\n // and the keys property to the parents.\n\n const root = isStringValue(node)\n ? JSON.parse(node)\n : ({ ...node } as TIsolate);\n\n IsolateSerializer.validateIsolate(root);\n\n const queue = [root];\n\n while (queue.length) {\n const current = queue.shift();\n\n const children = IsolateSerializer.getChildren(current);\n\n for (const key in MinifiedToKey) {\n const value = current[key];\n if (isNotNullish(value)) {\n current[MinifiedToKey[key]] = value;\n delete current[key];\n }\n }\n\n if (!children) {\n continue;\n }\n\n current.children = children.map(child => {\n const nextChild = { ...child };\n\n IsolateMutator.setParent(nextChild, current);\n queue.push(nextChild);\n\n const key = nextChild.key;\n\n if (key) {\n current.keys = current.keys ?? {};\n current.keys[key] = nextChild;\n }\n\n return nextChild;\n });\n }\n\n return root as TIsolate;\n }\n\n static serialize(isolate: Nullable<TIsolate>): string {\n if (isNullish(isolate)) {\n return '';\n }\n\n return JSON.stringify(transformIsolate(isolate));\n }\n\n static getChildren(node: TIsolate): Nullable<TIsolate[]> {\n return node.children ? [...node.children] : null;\n }\n\n static validateIsolate(node: Record<string, any> | TIsolate): void {\n invariant(\n hasOwnProperty(node, IsolateKeys.Type) ||\n hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]),\n text(ErrorStrings.INVALID_ISOLATE_CANNOT_PARSE)\n );\n }\n}\n\n// eslint-disable-next-line max-statements, complexity\nfunction transformIsolate(isolate: TIsolate): Record<string, any> {\n const next: Record<string, any> = {};\n\n if (isolate.children) {\n next.children = isolate.children.map(transformIsolate);\n }\n\n for (const key in isolate) {\n if (key === 'children') {\n continue;\n }\n\n if (isKeyExcluededFromDump(key)) {\n continue;\n }\n const value = isolate[key as keyof TIsolate];\n\n if (isNullish(value)) {\n continue;\n }\n\n if (hasOwnProperty(KeyToMinified, key)) {\n next[KeyToMinified[key]] = value;\n } else {\n next[key] = value;\n }\n }\n\n return next;\n}\n\nfunction isKeyExcluededFromDump(key: string): boolean {\n return [IsolateKeys.Parent, IsolateKeys.Keys].includes(key as IsolateKeys);\n}\n"],"names":["invariant","isNullish","isStringValue","isNotNullish","hasOwnProperty","text"],"mappings":";;;;AAAA,IAAY,YAKX,CAAA;AALD,CAAA,UAAY,YAAY,EAAA;AACtB,IAAA,YAAA,CAAA,mBAAA,CAAA,GAAA,8BAAkD,CAAA;AAClD,IAAA,YAAA,CAAA,6BAAA,CAAA,GAAA,uFAAqH,CAAA;AACrH,IAAA,YAAA,CAAA,gCAAA,CAAA,GAAA,mGAAkI,CAAA;AAClI,IAAA,YAAA,CAAA,8BAAA,CAAA,GAAA,kEAAiG,CAAA;AACnG,CAAC,EALW,YAAY,KAAZ,YAAY,GAKvB,EAAA,CAAA,CAAA;;ACLD,IAAY,WAQX,CAAA;AARD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,OAAc,CAAA;AACd,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IA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C,gBAAgB,CAAC,CAAC;AACxD,KAAA;AAED,IAAA,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE;QACzB,IAAI,GAAG,KAAK,UAAU,EAAE;YACtB,SAAS;AACV,SAAA;AAED,QAAA,IAAI,sBAAsB,CAAC,GAAG,CAAC,EAAE;YAC/B,SAAS;AACV,SAAA;AACD,QAAA,MAAM,KAAK,GAAG,OAAO,CAAC,GAAqB,CAAC,CAAC;AAE7C,QAAA,IAAIJ,mBAAS,CAAC,KAAK,CAAC,EAAE;YACpB,SAAS;AACV,SAAA;AAED,QAAA,IAAIG,wBAAc,CAAC,aAAa,EAAE,GAAG,CAAC,EAAE;YACtC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AAClC,SAAA;AAAM,aAAA;AACL,YAAA,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACnB,SAAA;AACF,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW,EAAA;AACzC,IAAA,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAkB,CAAC,CAAC;AAC7E;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t,i
|
|
1
|
+
"use strict";var e,t,s,i=require("vest-utils");!function(e){e.NO_ACTIVE_ISOLATE="Not within an active isolate",e.UNABLE_TO_PICK_NEXT_ISOLATE="Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.",e.ENCOUNTERED_THE_SAME_KEY_TWICE='Encountered the same key "{key}" twice. This may lead to inconsistent or overriding of results.',e.INVALID_ISOLATE_CANNOT_PARSE="Invalid isolate was passed to IsolateSerializer. Cannot proceed."}(e||(e={})),function(e){e.Type="$type",e.Keys="keys",e.Key="key",e.Parent="parent",e.Data="data",e.AllowReorder="allowReorder",e.Status="status"}(t||(t={})),function(e){e.Type="$",e.Keys="K",e.Key="k",e.Parent="P",e.Data="D",e.AllowReorder="aR",e.Status="S"}(s||(s={}));const n={[t.Type]:s.Type,[t.Keys]:s.Keys,[t.Parent]:s.Parent,[t.Data]:s.Data,[t.Key]:s.Key,[t.AllowReorder]:s.AllowReorder,[t.Status]:s.Status},a=Object.entries(n).reduce(((e,[t,s])=>Object.assign(e,{[s]:t})),{});var r;!function(e){e.PENDING="PENDING",e.DONE="DONE",e.INITIAL="INITIAL"}(r||(r={}));class l{static setParent(e,t){return e.parent=t,e}static saveOutput(e,t){return e.output=t,e}static setKey(e,t){return e.key=t,e}static addChild(e,t){var s;i.invariant(e),e.children=null!==(s=e.children)&&void 0!==s?s:[],e.children.push(t),l.setParent(t,e)}static removeChild(e,t){var s,i;e.children=null!==(i=null===(s=e.children)||void 0===s?void 0:s.filter((e=>e!==t)))&&void 0!==i?i:null}static addChildKey(e,t,s){var n;i.invariant(e),e.keys=null!==(n=e.keys)&&void 0!==n?n:{},e.keys[t]=s}static slice(e,t){i.isNullish(e.children)||(e.children.length=t)}static setData(e,t){e.data=t}static setPending(e){e.status=r.PENDING}static setDone(e){e.status=r.DONE}}class o{static deserialize(e){const t=i.isStringValue(e)?JSON.parse(e):Object.assign({},e);o.validateIsolate(t);const s=[t];for(;s.length;){const e=s.shift(),t=o.getChildren(e);for(const t in a){const s=e[t];i.isNotNullish(s)&&(e[a[t]]=s,delete e[t])}t&&(e.children=t.map((t=>{var i;const n=Object.assign({},t);l.setParent(n,e),s.push(n);const a=n.key;return a&&(e.keys=null!==(i=e.keys)&&void 0!==i?i:{},e.keys[a]=n),n})))}return t}static serialize(e){return i.isNullish(e)?"":JSON.stringify(c(e))}static getChildren(e){return e.children?[...e.children]:null}static validateIsolate(s){i.invariant(i.hasOwnProperty(s,t.Type)||i.hasOwnProperty(s,n[t.Type]),i.text(e.INVALID_ISOLATE_CANNOT_PARSE))}}function c(e){const t={};e.children&&(t.children=e.children.map(c));for(const s in e){if("children"===s)continue;if(u(s))continue;const a=e[s];i.isNullish(a)||(i.hasOwnProperty(n,s)?t[n[s]]=a:t[s]=a)}return t}function u(e){return[t.Parent,t.Keys].includes(e)}exports.IsolateSerializer=o;
|
|
2
2
|
//# sourceMappingURL=IsolateSerializer.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsolateSerializer.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/Isolate/IsolateKeys.ts","../../src/Isolate/IsolateMutator.ts","../../src/exports/IsolateSerializer.ts"],"sourcesContent":["export enum ErrorStrings {\n NO_ACTIVE_ISOLATE = 'Not within an active isolate',\n UNABLE_TO_PICK_NEXT_ISOLATE = 'Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.',\n ENCOUNTERED_THE_SAME_KEY_TWICE = `Encountered the same key \"{key}\" twice. This may lead to inconsistent or overriding of results.`,\n IVALID_ISOLATE_CANNOT_PARSE = `Invalid isolate was passed to IsolateSerializer. Cannot proceed.`,\n}\n","export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","import { Nullable, invariant, isNullish } from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\n\nexport class IsolateMutator {\n static setParent(isolate: TIsolate, parent: Nullable<TIsolate>): TIsolate {\n isolate.parent = parent;\n return isolate;\n }\n\n static saveOutput(isolate: TIsolate, output: any): TIsolate {\n isolate.output = output;\n return isolate;\n }\n\n static setKey(isolate: TIsolate, key: Nullable<string>): TIsolate {\n isolate.key = key;\n return isolate;\n }\n\n static addChild(isolate: TIsolate, child: TIsolate): void {\n invariant(isolate);\n\n isolate.children = isolate.children ?? [];\n\n isolate.children.push(child);\n IsolateMutator.setParent(child, isolate);\n }\n\n static removeChild(isolate: TIsolate, node: TIsolate): void {\n isolate.children =\n isolate.children?.filter(child => child !== node) ?? null;\n }\n\n static addChildKey(isolate: TIsolate, key: string, node: TIsolate): void {\n invariant(isolate);\n\n isolate.keys = isolate.keys ?? {};\n\n isolate.keys[key] = node;\n }\n\n static slice(isolate: TIsolate, at: number): void {\n if (isNullish(isolate.children)) {\n return;\n }\n isolate.children.length = at;\n }\n\n static setData(isolate: TIsolate, data: any): void {\n isolate.data = data;\n }\n}\n","import { ErrorStrings } from 'ErrorStrings';\nimport {\n Nullable,\n hasOwnProperty,\n invariant,\n isNotNullish,\n isNullish,\n isStringValue,\n text,\n} from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\nimport { IsolateKeys, KeyToMinified, MinifiedToKey } from 'IsolateKeys';\nimport { IsolateMutator } from 'IsolateMutator';\n\nexport class IsolateSerializer {\n // eslint-disable-next-line max-statements, complexity\n static deserialize(node: Record<string, any> | TIsolate | string): TIsolate {\n // the assumption is that the tree is built correctly,\n // but the children are missing the parent property to\n // avoid circular references during serialization.\n // in the same way, the parents are missing the `keys` property\n // to avoid circular references during serialization.\n // we need to rebuild the tree and add back the parent property to the children\n // and the keys property to the parents.\n\n const root = isStringValue(node)\n ? JSON.parse(node)\n : ({ ...node } as TIsolate);\n\n IsolateSerializer.validateIsolate(root);\n\n const queue = [root];\n\n while (queue.length) {\n const current = queue.shift();\n\n const children = IsolateSerializer.getChildren(current);\n\n for (const key in MinifiedToKey) {\n const value = current[key];\n if (isNotNullish(value)) {\n current[MinifiedToKey[key]] = value;\n delete current[key];\n }\n }\n\n if (!children) {\n continue;\n }\n\n current.children = children.map(child => {\n const nextChild = { ...child };\n\n IsolateMutator.setParent(nextChild, current);\n queue.push(nextChild);\n\n const key = nextChild.key;\n\n if (key) {\n current.keys = current.keys ?? {};\n current.keys[key] = nextChild;\n }\n\n return nextChild;\n });\n }\n\n return root as TIsolate;\n }\n\n static serialize(isolate: Nullable<TIsolate>): string {\n if (isNullish(isolate)) {\n return '';\n }\n\n return JSON.stringify(transformIsolate(isolate));\n }\n\n static getChildren(node: TIsolate): Nullable<TIsolate[]> {\n return node.children ? [...node.children] : null;\n }\n\n static validateIsolate(node: Record<string, any> | TIsolate): void {\n invariant(\n hasOwnProperty(node, IsolateKeys.Type) ||\n hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]),\n text(ErrorStrings.IVALID_ISOLATE_CANNOT_PARSE)\n );\n }\n}\n\n// eslint-disable-next-line max-statements, complexity\nfunction transformIsolate(isolate: TIsolate): Record<string, any> {\n const next: Record<string, any> = {};\n\n if (isolate.children) {\n next.children = isolate.children.map(transformIsolate);\n }\n\n for (const key in isolate) {\n if (key === 'children') {\n continue;\n }\n\n if (isKeyExcluededFromDump(key)) {\n continue;\n }\n const value = isolate[key as keyof TIsolate];\n\n if (isNullish(value)) {\n continue;\n }\n\n if (hasOwnProperty(KeyToMinified, key)) {\n next[KeyToMinified[key]] = value;\n } else {\n next[key] = value;\n }\n }\n\n return next;\n}\n\nfunction isKeyExcluededFromDump(key: string): boolean {\n return [IsolateKeys.Parent, IsolateKeys.Keys].includes(key as IsolateKeys);\n}\n"],"names":["ErrorStrings","IsolateKeys","MinifiedKeys","KeyToMinified","Type","Keys","Parent","Data","Key","AllowReorder","MinifiedToKey","Object","entries","reduce","acc","key","minified","assign","IsolateMutator","static","isolate","parent","output","child","invariant","children","_a","push","setParent","node","_b","filter","keys","at","isNullish","length","data","IsolateSerializer","root","isStringValue","JSON","parse","validateIsolate","queue","current","shift","getChildren","value","isNotNullish","map","nextChild","stringify","transformIsolate","hasOwnProperty","text","IVALID_ISOLATE_CANNOT_PARSE","next","isKeyExcluededFromDump","includes"],"mappings":"iBAAYA,ECAAC,EASPC,2BDTL,SAAYF,GACVA,EAAA,kBAAA,+BACAA,EAAA,4BAAA,wFACAA,EAAA,+BAAA,kGACAA,EAAA,4BAAA,kEACD,CALD,CAAYA,IAAAA,EAKX,CAAA,ICLD,SAAYC,GACVA,EAAA,KAAA,QACAA,EAAA,KAAA,OACAA,EAAA,IAAA,MACAA,EAAA,OAAA,SACAA,EAAA,KAAA,OACAA,EAAA,aAAA,cACD,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAED,SAAKC,GACHA,EAAA,KAAA,IACAA,EAAA,KAAA,IACAA,EAAA,IAAA,IACAA,EAAA,OAAA,IACAA,EAAA,KAAA,IACAA,EAAA,aAAA,IACD,CAPD,CAAKA,IAAAA,EAOJ,CAAA,IAEM,MAAMC,EAAgB,CAC3B,CAACF,EAAYG,MAAOF,EAAaE,KACjC,CAACH,EAAYI,MAAOH,EAAaG,KACjC,CAACJ,EAAYK,QAASJ,EAAaI,OACnC,CAACL,EAAYM,MAAOL,EAAaK,KACjC,CAACN,EAAYO,KAAMN,EAAaM,IAChC,CAACP,EAAYQ,cAAeP,EAAaO,cAU9BC,EAAgBC,OAAOC,QAAQT,GAAeU,QACzD,CAACC,GAAMC,EAAKC,KACVL,OAAOM,OAAOH,EAAK,CACjBE,CAACA,GAAWD,KAEhB,CAAA,SCnCWG,EACXC,iBAAiBC,EAAmBC,GAElC,OADAD,EAAQC,OAASA,EACVD,CACR,CAEDD,kBAAkBC,EAAmBE,GAEnC,OADAF,EAAQE,OAASA,EACVF,CACR,CAEDD,cAAcC,EAAmBL,GAE/B,OADAK,EAAQL,IAAMA,EACPK,CACR,CAEDD,gBAAgBC,EAA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AAQZ,KAAuB,QAAhBN,EAAAkB,EAAQZ,YAAQ,IAAAN,EAAAA,EAAA,CAAA,EAC/BkB,EAAQZ,KAAKjB,GAAOmC,GAGfA,CAAS,IAEnB,CAED,OAAOZ,CACR,CAEDnB,iBAAiBC,GACf,OAAIc,EAAAA,UAAUd,GACL,GAGFoB,KAAKW,UAAUC,EAAiBhC,GACxC,CAEDD,mBAAmBU,GACjB,OAAOA,EAAKJ,SAAW,IAAII,EAAKJ,UAAY,IAC7C,CAEDN,uBAAuBU,GACrBL,EAAAA,UACE6B,EAAcA,eAACxB,EAAM5B,EAAYG,OAC/BiD,iBAAexB,EAAM1B,EAAcF,EAAYG,OACjDkD,OAAKtD,EAAauD,6BAErB,EAIH,SAASH,EAAiBhC,GACxB,MAAMoC,EAA4B,CAAA,EAE9BpC,EAAQK,WACV+B,EAAK/B,SAAWL,EAAQK,SAASwB,IAAIG,IAGvC,IAAK,MAAMrC,KAAOK,EAAS,CACzB,GAAY,aAARL,EACF,SAGF,GAAI0C,EAAuB1C,GACzB,SAEF,MAAMgC,EAAQ3B,EAAQL,GAElBmB,EAAAA,UAAUa,KAIVM,EAAcA,eAAClD,EAAeY,GAChCyC,EAAKrD,EAAcY,IAAQgC,EAE3BS,EAAKzC,GAAOgC,EAEf,CAED,OAAOS,CACT,CAEA,SAASC,EAAuB1C,GAC9B,MAAO,CAACd,EAAYK,OAAQL,EAAYI,MAAMqD,SAAS3C,EACzD"}
|
|
1
|
+
{"version":3,"file":"IsolateSerializer.production.js","sources":["../../src/errors/ErrorStrings.ts","../../src/Isolate/IsolateKeys.ts","../../src/Isolate/IsolateStatus.ts","../../src/Isolate/IsolateMutator.ts","../../src/exports/IsolateSerializer.ts"],"sourcesContent":["export enum ErrorStrings {\n NO_ACTIVE_ISOLATE = 'Not within an active isolate',\n UNABLE_TO_PICK_NEXT_ISOLATE = 'Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.',\n ENCOUNTERED_THE_SAME_KEY_TWICE = `Encountered the same key \"{key}\" twice. This may lead to inconsistent or overriding of results.`,\n INVALID_ISOLATE_CANNOT_PARSE = `Invalid isolate was passed to IsolateSerializer. Cannot proceed.`,\n}\n","export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n Status = 'status',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n Status = 'S',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n [IsolateKeys.Status]: MinifiedKeys.Status,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","export enum IsolateStatus {\n PENDING = 'PENDING',\n DONE = 'DONE',\n INITIAL = 'INITIAL',\n}\n","import { Nullable, invariant, isNullish } from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\nimport { IsolateStatus } from 'IsolateStatus';\n\nexport class IsolateMutator {\n static setParent(isolate: TIsolate, parent: Nullable<TIsolate>): TIsolate {\n isolate.parent = parent;\n return isolate;\n }\n\n static saveOutput(isolate: TIsolate, output: any): TIsolate {\n isolate.output = output;\n return isolate;\n }\n\n static setKey(isolate: TIsolate, key: Nullable<string>): TIsolate {\n isolate.key = key;\n return isolate;\n }\n\n static addChild(isolate: TIsolate, child: TIsolate): void {\n invariant(isolate);\n\n isolate.children = isolate.children ?? [];\n\n isolate.children.push(child);\n IsolateMutator.setParent(child, isolate);\n }\n\n static removeChild(isolate: TIsolate, node: TIsolate): void {\n isolate.children =\n isolate.children?.filter(child => child !== node) ?? null;\n }\n\n static addChildKey(isolate: TIsolate, key: string, node: TIsolate): void {\n invariant(isolate);\n\n isolate.keys = isolate.keys ?? {};\n\n isolate.keys[key] = node;\n }\n\n static slice(isolate: TIsolate, at: number): void {\n if (isNullish(isolate.children)) {\n return;\n }\n isolate.children.length = at;\n }\n\n static setData(isolate: TIsolate, data: any): void {\n isolate.data = data;\n }\n\n static setPending(isolate: TIsolate): void {\n isolate.status = IsolateStatus.PENDING;\n }\n\n static setDone(isolate: TIsolate): void {\n isolate.status = IsolateStatus.DONE;\n }\n}\n","import { ErrorStrings } from 'ErrorStrings';\nimport {\n Nullable,\n hasOwnProperty,\n invariant,\n isNotNullish,\n isNullish,\n isStringValue,\n text,\n} from 'vest-utils';\n\nimport { TIsolate } from 'Isolate';\nimport { IsolateKeys, KeyToMinified, MinifiedToKey } from 'IsolateKeys';\nimport { IsolateMutator } from 'IsolateMutator';\n\nexport class IsolateSerializer {\n // eslint-disable-next-line max-statements, complexity\n static deserialize(node: Record<string, any> | TIsolate | string): TIsolate {\n // the assumption is that the tree is built correctly,\n // but the children are missing the parent property to\n // avoid circular references during serialization.\n // in the same way, the parents are missing the `keys` property\n // to avoid circular references during serialization.\n // we need to rebuild the tree and add back the parent property to the children\n // and the keys property to the parents.\n\n const root = isStringValue(node)\n ? JSON.parse(node)\n : ({ ...node } as TIsolate);\n\n IsolateSerializer.validateIsolate(root);\n\n const queue = [root];\n\n while (queue.length) {\n const current = queue.shift();\n\n const children = IsolateSerializer.getChildren(current);\n\n for (const key in MinifiedToKey) {\n const value = current[key];\n if (isNotNullish(value)) {\n current[MinifiedToKey[key]] = value;\n delete current[key];\n }\n }\n\n if (!children) {\n continue;\n }\n\n current.children = children.map(child => {\n const nextChild = { ...child };\n\n IsolateMutator.setParent(nextChild, current);\n queue.push(nextChild);\n\n const key = nextChild.key;\n\n if (key) {\n current.keys = current.keys ?? {};\n current.keys[key] = nextChild;\n }\n\n return nextChild;\n });\n }\n\n return root as TIsolate;\n }\n\n static serialize(isolate: Nullable<TIsolate>): string {\n if (isNullish(isolate)) {\n return '';\n }\n\n return JSON.stringify(transformIsolate(isolate));\n }\n\n static getChildren(node: TIsolate): Nullable<TIsolate[]> {\n return node.children ? [...node.children] : null;\n }\n\n static validateIsolate(node: Record<string, any> | TIsolate): void {\n invariant(\n hasOwnProperty(node, IsolateKeys.Type) ||\n hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]),\n text(ErrorStrings.INVALID_ISOLATE_CANNOT_PARSE)\n );\n }\n}\n\n// eslint-disable-next-line max-statements, complexity\nfunction transformIsolate(isolate: TIsolate): Record<string, any> {\n const next: Record<string, any> = {};\n\n if (isolate.children) {\n next.children = isolate.children.map(transformIsolate);\n }\n\n for (const key in isolate) {\n if (key === 'children') {\n continue;\n }\n\n if (isKeyExcluededFromDump(key)) {\n continue;\n }\n const value = isolate[key as keyof TIsolate];\n\n if (isNullish(value)) {\n continue;\n }\n\n if (hasOwnProperty(KeyToMinified, key)) {\n next[KeyToMinified[key]] = value;\n } else {\n next[key] = value;\n }\n }\n\n return next;\n}\n\nfunction isKeyExcluededFromDump(key: string): boolean {\n return [IsolateKeys.Parent, IsolateKeys.Keys].includes(key as IsolateKeys);\n}\n"],"names":["ErrorStrings","IsolateKeys","MinifiedKeys","KeyToMinified","Type","Keys","Parent","Data","Key","AllowReorder","Status","MinifiedToKey","Object","entries","reduce","acc","key","minified","assign","IsolateStatus","IsolateMutator","static","isolate","parent","output","child","invariant","children","_a","push","setParent","node","_b","filter","keys","at","isNullish","length","data","status","PENDING","DONE","IsolateSerializer","root","isStringValue","JSON","parse","validateIsolate","queue","current","shift","getChildren","value","isNotNullish","map","nextChild","stringify","transformIsolate","hasOwnProperty","text","INVALID_ISOLATE_CANNOT_PARSE","next","isKeyExcluededFromDump","includes"],"mappings":"iBAAYA,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yB,EAAWN,GACpCD,EAAMnB,KAAK0B,GAEX,MAAMvC,EAAMuC,EAAUvC,IAOtB,OALIA,IACFiC,EAAQf,KAAuB,QAAhBN,EAAAqB,EAAQf,YAAQ,IAAAN,EAAAA,EAAA,CAAA,EAC/BqB,EAAQf,KAAKlB,GAAOuC,GAGfA,CAAS,IAEnB,CAED,OAAOZ,CACR,CAEDtB,iBAAiBC,GACf,OAAIc,EAAAA,UAAUd,GACL,GAGFuB,KAAKW,UAAUC,EAAiBnC,GACxC,CAEDD,mBAAmBU,GACjB,OAAOA,EAAKJ,SAAW,IAAII,EAAKJ,UAAY,IAC7C,CAEDN,uBAAuBU,GACrBL,EAAAA,UACEgC,EAAcA,eAAC3B,EAAM9B,EAAYG,OAC/BsD,iBAAe3B,EAAM5B,EAAcF,EAAYG,OACjDuD,OAAK3D,EAAa4D,8BAErB,EAIH,SAASH,EAAiBnC,GACxB,MAAMuC,EAA4B,CAAA,EAE9BvC,EAAQK,WACVkC,EAAKlC,SAAWL,EAAQK,SAAS2B,IAAIG,IAGvC,IAAK,MAAMzC,KAAOM,EAAS,CACzB,GAAY,aAARN,EACF,SAGF,GAAI8C,EAAuB9C,GACzB,SAEF,MAAMoC,EAAQ9B,EAAQN,GAElBoB,EAAAA,UAAUgB,KAIVM,EAAcA,eAACvD,EAAea,GAChC6C,EAAK1D,EAAca,IAAQoC,EAE3BS,EAAK7C,GAAOoC,EAEf,CAED,OAAOS,CACT,CAEA,SAASC,EAAuB9C,GAC9B,MAAO,CAACf,EAAYK,OAAQL,EAAYI,MAAM0D,SAAS/C,EACzD"}
|
|
@@ -8,6 +8,7 @@ var IsolateKeys;
|
|
|
8
8
|
IsolateKeys["Parent"] = "parent";
|
|
9
9
|
IsolateKeys["Data"] = "data";
|
|
10
10
|
IsolateKeys["AllowReorder"] = "allowReorder";
|
|
11
|
+
IsolateKeys["Status"] = "status";
|
|
11
12
|
})(IsolateKeys || (IsolateKeys = {}));
|
|
12
13
|
var MinifiedKeys;
|
|
13
14
|
(function (MinifiedKeys) {
|
|
@@ -17,6 +18,7 @@ var MinifiedKeys;
|
|
|
17
18
|
MinifiedKeys["Parent"] = "P";
|
|
18
19
|
MinifiedKeys["Data"] = "D";
|
|
19
20
|
MinifiedKeys["AllowReorder"] = "aR";
|
|
21
|
+
MinifiedKeys["Status"] = "S";
|
|
20
22
|
})(MinifiedKeys || (MinifiedKeys = {}));
|
|
21
23
|
const KeyToMinified = {
|
|
22
24
|
[IsolateKeys.Type]: MinifiedKeys.Type,
|
|
@@ -25,6 +27,7 @@ const KeyToMinified = {
|
|
|
25
27
|
[IsolateKeys.Data]: MinifiedKeys.Data,
|
|
26
28
|
[IsolateKeys.Key]: MinifiedKeys.Key,
|
|
27
29
|
[IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,
|
|
30
|
+
[IsolateKeys.Status]: MinifiedKeys.Status,
|
|
28
31
|
};
|
|
29
32
|
// This const is an object that looks like this:
|
|
30
33
|
// {
|
|
@@ -37,6 +40,13 @@ Object.entries(KeyToMinified).reduce((acc, [key, minified]) => Object.assign(acc
|
|
|
37
40
|
[minified]: key,
|
|
38
41
|
}), {});
|
|
39
42
|
|
|
43
|
+
var IsolateStatus;
|
|
44
|
+
(function (IsolateStatus) {
|
|
45
|
+
IsolateStatus["PENDING"] = "PENDING";
|
|
46
|
+
IsolateStatus["DONE"] = "DONE";
|
|
47
|
+
IsolateStatus["INITIAL"] = "INITIAL";
|
|
48
|
+
})(IsolateStatus || (IsolateStatus = {}));
|
|
49
|
+
|
|
40
50
|
function genTestIsolate(data = {}) {
|
|
41
51
|
return {
|
|
42
52
|
children: [],
|
|
@@ -45,6 +55,7 @@ function genTestIsolate(data = {}) {
|
|
|
45
55
|
keys: {},
|
|
46
56
|
output: null,
|
|
47
57
|
parent: null,
|
|
58
|
+
status: IsolateStatus.INITIAL,
|
|
48
59
|
[IsolateKeys.Type]: 'UnitTest',
|
|
49
60
|
};
|
|
50
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.development.js","sources":["../../src/Isolate/IsolateKeys.ts","../../src/exports/test-utils.ts"],"sourcesContent":["export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","import { TIsolate } from 'Isolate';\nimport { IsolateKeys } from 'IsolateKeys';\n\nexport function genTestIsolate(data: Record<string, any> = {}): TIsolate {\n return {\n children: [],\n data,\n key: null,\n keys: {},\n output: null,\n parent: null,\n [IsolateKeys.Type]: 'UnitTest',\n };\n}\n"],"names":[],"mappings":";;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"test-utils.development.js","sources":["../../src/Isolate/IsolateKeys.ts","../../src/Isolate/IsolateStatus.ts","../../src/exports/test-utils.ts"],"sourcesContent":["export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n Status = 'status',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n Status = 'S',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n [IsolateKeys.Status]: MinifiedKeys.Status,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","export enum IsolateStatus {\n PENDING = 'PENDING',\n DONE = 'DONE',\n INITIAL = 'INITIAL',\n}\n","import { TIsolate } from 'Isolate';\nimport { IsolateKeys } from 'IsolateKeys';\nimport { IsolateStatus } from 'IsolateStatus';\n\nexport function genTestIsolate(data: Record<string, any> = {}): TIsolate {\n return {\n children: [],\n data,\n key: null,\n keys: {},\n output: null,\n parent: null,\n status: IsolateStatus.INITIAL,\n [IsolateKeys.Type]: 'UnitTest',\n };\n}\n"],"names":[],"mappings":";;AAAA,IAAY,WAQX,CAAA;AARD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,OAAc,CAAA;AACd,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,WAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACX,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACjB,IAAA,WAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,WAAA,CAAA,cAAA,CAAA,GAAA,cAA6B,CAAA;AAC7B,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB,CAAA;AACnB,CAAC,EARW,WAAW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J,EAAiC;;AC1CnC,IAAY,aAIX,CAAA;AAJD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACrB,CAAC,EAJW,aAAa,KAAb,aAAa,GAIxB,EAAA,CAAA,CAAA;;ACAe,SAAA,cAAc,CAAC,IAAA,GAA4B,EAAE,EAAA;IAC3D,OAAO;AACL,QAAA,QAAQ,EAAE,EAAE;QACZ,IAAI;AACJ,QAAA,GAAG,EAAE,IAAI;AACT,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,MAAM,EAAE,IAAI;AACZ,QAAA,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,aAAa,CAAC,OAAO;AAC7B,QAAA,CAAC,WAAW,CAAC,IAAI,GAAG,UAAU;KAC/B,CAAC;AACJ;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t;!function(e){e.Type="$type",e.Keys="keys",e.Key="key",e.Parent="parent",e.Data="data",e.AllowReorder="allowReorder"}(e||(e={})),function(e){e.Type="$",e.Keys="K",e.Key="k",e.Parent="P",e.Data="D",e.AllowReorder="aR"}(t||(t={}));const
|
|
1
|
+
"use strict";var e,t;!function(e){e.Type="$type",e.Keys="keys",e.Key="key",e.Parent="parent",e.Data="data",e.AllowReorder="allowReorder",e.Status="status"}(e||(e={})),function(e){e.Type="$",e.Keys="K",e.Key="k",e.Parent="P",e.Data="D",e.AllowReorder="aR",e.Status="S"}(t||(t={}));const a={[e.Type]:t.Type,[e.Keys]:t.Keys,[e.Parent]:t.Parent,[e.Data]:t.Data,[e.Key]:t.Key,[e.AllowReorder]:t.AllowReorder,[e.Status]:t.Status};var r;Object.entries(a).reduce(((e,[t,a])=>Object.assign(e,{[a]:t})),{}),function(e){e.PENDING="PENDING",e.DONE="DONE",e.INITIAL="INITIAL"}(r||(r={})),exports.genTestIsolate=function(t={}){return{children:[],data:t,key:null,keys:{},output:null,parent:null,status:r.INITIAL,[e.Type]:"UnitTest"}};
|
|
2
2
|
//# sourceMappingURL=test-utils.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.production.js","sources":["../../src/Isolate/IsolateKeys.ts","../../src/exports/test-utils.ts"],"sourcesContent":["export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","import { TIsolate } from 'Isolate';\nimport { IsolateKeys } from 'IsolateKeys';\n\nexport function genTestIsolate(data: Record<string, any> = {}): TIsolate {\n return {\n children: [],\n data,\n key: null,\n keys: {},\n output: null,\n parent: null,\n [IsolateKeys.Type]: 'UnitTest',\n };\n}\n"],"names":["IsolateKeys","MinifiedKeys","KeyToMinified","Type","Keys","Parent","Data","Key","AllowReorder","Object","entries","reduce","acc","key","minified","assign","data","children","keys","output","parent"],"mappings":"aAAA,IAAYA,
|
|
1
|
+
{"version":3,"file":"test-utils.production.js","sources":["../../src/Isolate/IsolateKeys.ts","../../src/Isolate/IsolateStatus.ts","../../src/exports/test-utils.ts"],"sourcesContent":["export enum IsolateKeys {\n Type = '$type',\n Keys = 'keys',\n Key = 'key',\n Parent = 'parent',\n Data = 'data',\n AllowReorder = 'allowReorder',\n Status = 'status',\n}\n\nenum MinifiedKeys {\n Type = '$',\n Keys = 'K',\n Key = 'k',\n Parent = 'P',\n Data = 'D',\n AllowReorder = 'aR',\n Status = 'S',\n}\n\nexport const KeyToMinified = {\n [IsolateKeys.Type]: MinifiedKeys.Type,\n [IsolateKeys.Keys]: MinifiedKeys.Keys,\n [IsolateKeys.Parent]: MinifiedKeys.Parent,\n [IsolateKeys.Data]: MinifiedKeys.Data,\n [IsolateKeys.Key]: MinifiedKeys.Key,\n [IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,\n [IsolateKeys.Status]: MinifiedKeys.Status,\n};\n\n// This const is an object that looks like this:\n// {\n// '$': '$type',\n// 'K': 'keys',\n// 'P': 'parent',\n// ...\n// }\nexport const MinifiedToKey = Object.entries(KeyToMinified).reduce(\n (acc, [key, minified]) =>\n Object.assign(acc, {\n [minified]: key,\n }),\n {} as Record<string, IsolateKeys>\n);\n","export enum IsolateStatus {\n PENDING = 'PENDING',\n DONE = 'DONE',\n INITIAL = 'INITIAL',\n}\n","import { TIsolate } from 'Isolate';\nimport { IsolateKeys } from 'IsolateKeys';\nimport { IsolateStatus } from 'IsolateStatus';\n\nexport function genTestIsolate(data: Record<string, any> = {}): TIsolate {\n return {\n children: [],\n data,\n key: null,\n keys: {},\n output: null,\n parent: null,\n status: IsolateStatus.INITIAL,\n [IsolateKeys.Type]: 'UnitTest',\n };\n}\n"],"names":["IsolateKeys","MinifiedKeys","KeyToMinified","Type","Keys","Parent","Data","Key","AllowReorder","Status","IsolateStatus","Object","entries","reduce","acc","key","minified","assign","data","children","keys","output","parent","status","INITIAL"],"mappings":"aAAA,IAAYA,EAUPC,GAVL,SAAYD,GACVA,EAAA,KAAA,QACAA,EAAA,KAAA,OACAA,EAAA,IAAA,MACAA,EAAA,OAAA,SACAA,EAAA,KAAA,OACAA,EAAA,aAAA,eACAA,EAAA,OAAA,QACD,CARD,CAAYA,IAAAA,EAQX,CAAA,IAED,SAAKC,GACHA,EAAA,KAAA,IACAA,EAAA,KAAA,IACAA,EAAA,IAAA,IACAA,EAAA,OAAA,IACAA,EAAA,KAAA,IACAA,EAAA,aAAA,KACAA,EAAA,OAAA,GACD,CARD,CAAKA,IAAAA,EAQJ,CAAA,IAEM,MAAMC,EAAgB,CAC3B,CAACF,EAAYG,MAAOF,EAAaE,KACjC,CAACH,EAAYI,MAAOH,EAAaG,KACjC,CAACJ,EAAYK,QAASJ,EAAaI,OACnC,CAACL,EAAYM,MAAOL,EAAaK,KACjC,CAACN,EAAYO,KAAMN,EAAaM,IAChC,CAACP,EAAYQ,cAAeP,EAAaO,aACzC,CAACR,EAAYS,QAASR,EAAaQ,QC3BrC,IAAYC,EDqCiBC,OAAOC,QAAQV,GAAeW,QACzD,CAACC,GAAMC,EAAKC,KACVL,OAAOM,OAAOH,EAAK,CACjBE,CAACA,GAAWD,KAEhB,CAAiC,GC1CnC,SAAYL,GACVA,EAAA,QAAA,UACAA,EAAA,KAAA,OACAA,EAAA,QAAA,SACD,CAJD,CAAYA,IAAAA,EAIX,CAAA,2BCAe,SAAeQ,EAA4B,IACzD,MAAO,CACLC,SAAU,GACVD,OACAH,IAAK,KACLK,KAAM,CAAE,EACRC,OAAQ,KACRC,OAAQ,KACRC,OAAQb,EAAcc,QACtB,CAACxB,EAAYG,MAAO,WAExB"}
|
|
@@ -37,91 +37,12 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
37
37
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
var IsolateKeys;
|
|
41
|
-
(function (IsolateKeys) {
|
|
42
|
-
IsolateKeys["Type"] = "$type";
|
|
43
|
-
IsolateKeys["Keys"] = "keys";
|
|
44
|
-
IsolateKeys["Key"] = "key";
|
|
45
|
-
IsolateKeys["Parent"] = "parent";
|
|
46
|
-
IsolateKeys["Data"] = "data";
|
|
47
|
-
IsolateKeys["AllowReorder"] = "allowReorder";
|
|
48
|
-
})(IsolateKeys || (IsolateKeys = {}));
|
|
49
|
-
var MinifiedKeys;
|
|
50
|
-
(function (MinifiedKeys) {
|
|
51
|
-
MinifiedKeys["Type"] = "$";
|
|
52
|
-
MinifiedKeys["Keys"] = "K";
|
|
53
|
-
MinifiedKeys["Key"] = "k";
|
|
54
|
-
MinifiedKeys["Parent"] = "P";
|
|
55
|
-
MinifiedKeys["Data"] = "D";
|
|
56
|
-
MinifiedKeys["AllowReorder"] = "aR";
|
|
57
|
-
})(MinifiedKeys || (MinifiedKeys = {}));
|
|
58
|
-
const KeyToMinified = {
|
|
59
|
-
[IsolateKeys.Type]: MinifiedKeys.Type,
|
|
60
|
-
[IsolateKeys.Keys]: MinifiedKeys.Keys,
|
|
61
|
-
[IsolateKeys.Parent]: MinifiedKeys.Parent,
|
|
62
|
-
[IsolateKeys.Data]: MinifiedKeys.Data,
|
|
63
|
-
[IsolateKeys.Key]: MinifiedKeys.Key,
|
|
64
|
-
[IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,
|
|
65
|
-
};
|
|
66
|
-
// This const is an object that looks like this:
|
|
67
|
-
// {
|
|
68
|
-
// '$': '$type',
|
|
69
|
-
// 'K': 'keys',
|
|
70
|
-
// 'P': 'parent',
|
|
71
|
-
// ...
|
|
72
|
-
// }
|
|
73
|
-
const MinifiedToKey = Object.entries(KeyToMinified).reduce((acc, [key, minified]) => Object.assign(acc, {
|
|
74
|
-
[minified]: key,
|
|
75
|
-
}), {});
|
|
76
|
-
|
|
77
|
-
class IsolateMutator {
|
|
78
|
-
static setParent(isolate, parent) {
|
|
79
|
-
isolate.parent = parent;
|
|
80
|
-
return isolate;
|
|
81
|
-
}
|
|
82
|
-
static saveOutput(isolate, output) {
|
|
83
|
-
isolate.output = output;
|
|
84
|
-
return isolate;
|
|
85
|
-
}
|
|
86
|
-
static setKey(isolate, key) {
|
|
87
|
-
isolate.key = key;
|
|
88
|
-
return isolate;
|
|
89
|
-
}
|
|
90
|
-
static addChild(isolate, child) {
|
|
91
|
-
var _a;
|
|
92
|
-
vestUtils.invariant(isolate);
|
|
93
|
-
isolate.children = (_a = isolate.children) !== null && _a !== void 0 ? _a : [];
|
|
94
|
-
isolate.children.push(child);
|
|
95
|
-
IsolateMutator.setParent(child, isolate);
|
|
96
|
-
}
|
|
97
|
-
static removeChild(isolate, node) {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
isolate.children =
|
|
100
|
-
(_b = (_a = isolate.children) === null || _a === void 0 ? void 0 : _a.filter(child => child !== node)) !== null && _b !== void 0 ? _b : null;
|
|
101
|
-
}
|
|
102
|
-
static addChildKey(isolate, key, node) {
|
|
103
|
-
var _a;
|
|
104
|
-
vestUtils.invariant(isolate);
|
|
105
|
-
isolate.keys = (_a = isolate.keys) !== null && _a !== void 0 ? _a : {};
|
|
106
|
-
isolate.keys[key] = node;
|
|
107
|
-
}
|
|
108
|
-
static slice(isolate, at) {
|
|
109
|
-
if (vestUtils.isNullish(isolate.children)) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
isolate.children.length = at;
|
|
113
|
-
}
|
|
114
|
-
static setData(isolate, data) {
|
|
115
|
-
isolate.data = data;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
40
|
var ErrorStrings;
|
|
120
41
|
(function (ErrorStrings) {
|
|
121
42
|
ErrorStrings["NO_ACTIVE_ISOLATE"] = "Not within an active isolate";
|
|
122
43
|
ErrorStrings["UNABLE_TO_PICK_NEXT_ISOLATE"] = "Unable to pick next isolate. This is a bug, please report it to the Vest maintainers.";
|
|
123
44
|
ErrorStrings["ENCOUNTERED_THE_SAME_KEY_TWICE"] = "Encountered the same key \"{key}\" twice. This may lead to inconsistent or overriding of results.";
|
|
124
|
-
ErrorStrings["
|
|
45
|
+
ErrorStrings["INVALID_ISOLATE_CANNOT_PARSE"] = "Invalid isolate was passed to IsolateSerializer. Cannot proceed.";
|
|
125
46
|
})(ErrorStrings || (ErrorStrings = {}));
|
|
126
47
|
|
|
127
48
|
class IsolateInspector {
|
|
@@ -163,22 +84,60 @@ class IsolateInspector {
|
|
|
163
84
|
}
|
|
164
85
|
}
|
|
165
86
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
function isSameIsolateIdentity(a, b) {
|
|
173
|
-
return Object.is(a, b) || (isSameIsolateType(a, b) && a.key === b.key);
|
|
174
|
-
}
|
|
87
|
+
exports.IsolateStatus = void 0;
|
|
88
|
+
(function (IsolateStatus) {
|
|
89
|
+
IsolateStatus["PENDING"] = "PENDING";
|
|
90
|
+
IsolateStatus["DONE"] = "DONE";
|
|
91
|
+
IsolateStatus["INITIAL"] = "INITIAL";
|
|
92
|
+
})(exports.IsolateStatus || (exports.IsolateStatus = {}));
|
|
175
93
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
94
|
+
class IsolateMutator {
|
|
95
|
+
static setParent(isolate, parent) {
|
|
96
|
+
isolate.parent = parent;
|
|
97
|
+
return isolate;
|
|
98
|
+
}
|
|
99
|
+
static saveOutput(isolate, output) {
|
|
100
|
+
isolate.output = output;
|
|
101
|
+
return isolate;
|
|
102
|
+
}
|
|
103
|
+
static setKey(isolate, key) {
|
|
104
|
+
isolate.key = key;
|
|
105
|
+
return isolate;
|
|
106
|
+
}
|
|
107
|
+
static addChild(isolate, child) {
|
|
108
|
+
var _a;
|
|
109
|
+
vestUtils.invariant(isolate);
|
|
110
|
+
isolate.children = (_a = isolate.children) !== null && _a !== void 0 ? _a : [];
|
|
111
|
+
isolate.children.push(child);
|
|
112
|
+
IsolateMutator.setParent(child, isolate);
|
|
113
|
+
}
|
|
114
|
+
static removeChild(isolate, node) {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
isolate.children =
|
|
117
|
+
(_b = (_a = isolate.children) === null || _a === void 0 ? void 0 : _a.filter(child => child !== node)) !== null && _b !== void 0 ? _b : null;
|
|
118
|
+
}
|
|
119
|
+
static addChildKey(isolate, key, node) {
|
|
120
|
+
var _a;
|
|
121
|
+
vestUtils.invariant(isolate);
|
|
122
|
+
isolate.keys = (_a = isolate.keys) !== null && _a !== void 0 ? _a : {};
|
|
123
|
+
isolate.keys[key] = node;
|
|
124
|
+
}
|
|
125
|
+
static slice(isolate, at) {
|
|
126
|
+
if (vestUtils.isNullish(isolate.children)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
isolate.children.length = at;
|
|
130
|
+
}
|
|
131
|
+
static setData(isolate, data) {
|
|
132
|
+
isolate.data = data;
|
|
133
|
+
}
|
|
134
|
+
static setPending(isolate) {
|
|
135
|
+
isolate.status = exports.IsolateStatus.PENDING;
|
|
136
|
+
}
|
|
137
|
+
static setDone(isolate) {
|
|
138
|
+
isolate.status = exports.IsolateStatus.DONE;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
182
141
|
|
|
183
142
|
const PersistedContext = context.createCascade((stateRef, parentContext) => {
|
|
184
143
|
if (parentContext) {
|
|
@@ -321,6 +280,89 @@ function useLoadRootNode(root) {
|
|
|
321
280
|
useSetHistory(root);
|
|
322
281
|
}
|
|
323
282
|
|
|
283
|
+
function useBus() {
|
|
284
|
+
return useX().stateRef.Bus;
|
|
285
|
+
}
|
|
286
|
+
/*
|
|
287
|
+
Returns an emitter, but it also has a shortcut for emitting an event immediately
|
|
288
|
+
by passing an event name.
|
|
289
|
+
*/
|
|
290
|
+
function useEmit(event, data) {
|
|
291
|
+
const emit = useBus().emit;
|
|
292
|
+
if (!vestUtils.isNullish(event)) {
|
|
293
|
+
emit(event, data);
|
|
294
|
+
}
|
|
295
|
+
return persist(emit);
|
|
296
|
+
}
|
|
297
|
+
function usePrepareEmitter(event) {
|
|
298
|
+
const emit = useEmit();
|
|
299
|
+
return (arg) => emit(event, arg);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
var Bus = /*#__PURE__*/Object.freeze({
|
|
303
|
+
__proto__: null,
|
|
304
|
+
useBus: useBus,
|
|
305
|
+
useEmit: useEmit,
|
|
306
|
+
usePrepareEmitter: usePrepareEmitter
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
var IsolateKeys;
|
|
310
|
+
(function (IsolateKeys) {
|
|
311
|
+
IsolateKeys["Type"] = "$type";
|
|
312
|
+
IsolateKeys["Keys"] = "keys";
|
|
313
|
+
IsolateKeys["Key"] = "key";
|
|
314
|
+
IsolateKeys["Parent"] = "parent";
|
|
315
|
+
IsolateKeys["Data"] = "data";
|
|
316
|
+
IsolateKeys["AllowReorder"] = "allowReorder";
|
|
317
|
+
IsolateKeys["Status"] = "status";
|
|
318
|
+
})(IsolateKeys || (IsolateKeys = {}));
|
|
319
|
+
var MinifiedKeys;
|
|
320
|
+
(function (MinifiedKeys) {
|
|
321
|
+
MinifiedKeys["Type"] = "$";
|
|
322
|
+
MinifiedKeys["Keys"] = "K";
|
|
323
|
+
MinifiedKeys["Key"] = "k";
|
|
324
|
+
MinifiedKeys["Parent"] = "P";
|
|
325
|
+
MinifiedKeys["Data"] = "D";
|
|
326
|
+
MinifiedKeys["AllowReorder"] = "aR";
|
|
327
|
+
MinifiedKeys["Status"] = "S";
|
|
328
|
+
})(MinifiedKeys || (MinifiedKeys = {}));
|
|
329
|
+
const KeyToMinified = {
|
|
330
|
+
[IsolateKeys.Type]: MinifiedKeys.Type,
|
|
331
|
+
[IsolateKeys.Keys]: MinifiedKeys.Keys,
|
|
332
|
+
[IsolateKeys.Parent]: MinifiedKeys.Parent,
|
|
333
|
+
[IsolateKeys.Data]: MinifiedKeys.Data,
|
|
334
|
+
[IsolateKeys.Key]: MinifiedKeys.Key,
|
|
335
|
+
[IsolateKeys.AllowReorder]: MinifiedKeys.AllowReorder,
|
|
336
|
+
[IsolateKeys.Status]: MinifiedKeys.Status,
|
|
337
|
+
};
|
|
338
|
+
// This const is an object that looks like this:
|
|
339
|
+
// {
|
|
340
|
+
// '$': '$type',
|
|
341
|
+
// 'K': 'keys',
|
|
342
|
+
// 'P': 'parent',
|
|
343
|
+
// ...
|
|
344
|
+
// }
|
|
345
|
+
const MinifiedToKey = Object.entries(KeyToMinified).reduce((acc, [key, minified]) => Object.assign(acc, {
|
|
346
|
+
[minified]: key,
|
|
347
|
+
}), {});
|
|
348
|
+
|
|
349
|
+
function isIsolateType(node, type) {
|
|
350
|
+
return (node === null || node === void 0 ? void 0 : node[IsolateKeys.Type]) === type;
|
|
351
|
+
}
|
|
352
|
+
function isSameIsolateType(a, b) {
|
|
353
|
+
return isIsolateType(a, b[IsolateKeys.Type]);
|
|
354
|
+
}
|
|
355
|
+
function isSameIsolateIdentity(a, b) {
|
|
356
|
+
return Object.is(a, b) || (isSameIsolateType(a, b) && a.key === b.key);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
var IsolateSelectors = /*#__PURE__*/Object.freeze({
|
|
360
|
+
__proto__: null,
|
|
361
|
+
isIsolateType: isIsolateType,
|
|
362
|
+
isSameIsolateIdentity: isSameIsolateIdentity,
|
|
363
|
+
isSameIsolateType: isSameIsolateType
|
|
364
|
+
});
|
|
365
|
+
|
|
324
366
|
function BaseReconciler(currentNode, historyNode) {
|
|
325
367
|
if (vestUtils.isNullish(historyNode)) {
|
|
326
368
|
return currentNode;
|
|
@@ -391,6 +433,10 @@ function removeAllNextNodesInIsolate() {
|
|
|
391
433
|
IsolateMutator.slice(historyNode, IsolateInspector.cursor(currentNode));
|
|
392
434
|
}
|
|
393
435
|
|
|
436
|
+
const RuntimeEvents = {
|
|
437
|
+
ASYNC_ISOLATE_DONE: 'ASYNC_ISOLATE_DONE',
|
|
438
|
+
};
|
|
439
|
+
|
|
394
440
|
class Isolate {
|
|
395
441
|
static create(type, callback, payload = undefined, key) {
|
|
396
442
|
const parent = useIsolate();
|
|
@@ -405,6 +451,9 @@ class Isolate {
|
|
|
405
451
|
addNodeToHistory(nextIsolateChild);
|
|
406
452
|
return nextIsolateChild;
|
|
407
453
|
}
|
|
454
|
+
static isIsolate(node) {
|
|
455
|
+
return vestUtils.isNotNullish(node) && node[IsolateKeys.Type];
|
|
456
|
+
}
|
|
408
457
|
}
|
|
409
458
|
/**
|
|
410
459
|
* Creates a new child isolate context where the local history node is the current history node, thus advancing the history cursor.
|
|
@@ -416,9 +465,26 @@ class Isolate {
|
|
|
416
465
|
*/
|
|
417
466
|
function useRunAsNew(localHistoryNode, current, callback) {
|
|
418
467
|
const runtimeRoot = useRuntimeRoot();
|
|
468
|
+
const emit = useEmit();
|
|
419
469
|
// We're creating a new child isolate context where the local history node
|
|
420
470
|
// is the current history node, thus advancing the history cursor.
|
|
421
|
-
const output = Run(Object.assign({ historyNode: localHistoryNode, runtimeNode: current }, (!runtimeRoot && { runtimeRoot: current })), () =>
|
|
471
|
+
const output = Run(Object.assign({ historyNode: localHistoryNode, runtimeNode: current }, (!runtimeRoot && { runtimeRoot: current })), () => {
|
|
472
|
+
const output = callback(current);
|
|
473
|
+
if (vestUtils.isPromise(output)) {
|
|
474
|
+
IsolateMutator.setPending(current);
|
|
475
|
+
output.then(iso => {
|
|
476
|
+
if (Isolate.isIsolate(iso)) {
|
|
477
|
+
IsolateMutator.addChild(current, iso);
|
|
478
|
+
}
|
|
479
|
+
IsolateMutator.setDone(current);
|
|
480
|
+
emit(RuntimeEvents.ASYNC_ISOLATE_DONE, current);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
IsolateMutator.setDone(current);
|
|
485
|
+
}
|
|
486
|
+
return output;
|
|
487
|
+
});
|
|
422
488
|
current.output = output;
|
|
423
489
|
return output;
|
|
424
490
|
}
|
|
@@ -430,6 +496,7 @@ function baseIsolate(type, payload = undefined, key = null) {
|
|
|
430
496
|
[IsolateKeys.Parent]: null,
|
|
431
497
|
[IsolateKeys.Type]: type,
|
|
432
498
|
[IsolateKeys.Data]: data,
|
|
499
|
+
[IsolateKeys.Status]: exports.IsolateStatus.INITIAL,
|
|
433
500
|
children: null,
|
|
434
501
|
key,
|
|
435
502
|
output: null,
|
|
@@ -567,32 +634,6 @@ var IsolateWalker = /*#__PURE__*/Object.freeze({
|
|
|
567
634
|
walk: walk
|
|
568
635
|
});
|
|
569
636
|
|
|
570
|
-
function useBus() {
|
|
571
|
-
return useX().stateRef.Bus;
|
|
572
|
-
}
|
|
573
|
-
/*
|
|
574
|
-
Returns an emitter, but it also has a shortcut for emitting an event immediately
|
|
575
|
-
by passing an event name.
|
|
576
|
-
*/
|
|
577
|
-
function useEmit(event, data) {
|
|
578
|
-
const emit = useBus().emit;
|
|
579
|
-
if (!vestUtils.isNullish(event)) {
|
|
580
|
-
emit(event, data);
|
|
581
|
-
}
|
|
582
|
-
return persist(emit);
|
|
583
|
-
}
|
|
584
|
-
function usePrepareEmitter(event) {
|
|
585
|
-
const emit = useEmit();
|
|
586
|
-
return (arg) => emit(event, arg);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
var Bus = /*#__PURE__*/Object.freeze({
|
|
590
|
-
__proto__: null,
|
|
591
|
-
useBus: useBus,
|
|
592
|
-
useEmit: useEmit,
|
|
593
|
-
usePrepareEmitter: usePrepareEmitter
|
|
594
|
-
});
|
|
595
|
-
|
|
596
637
|
class IsolateSerializer {
|
|
597
638
|
// eslint-disable-next-line max-statements, complexity
|
|
598
639
|
static deserialize(node) {
|
|
@@ -647,7 +688,7 @@ class IsolateSerializer {
|
|
|
647
688
|
}
|
|
648
689
|
static validateIsolate(node) {
|
|
649
690
|
vestUtils.invariant(vestUtils.hasOwnProperty(node, IsolateKeys.Type) ||
|
|
650
|
-
vestUtils.hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]), vestUtils.text(ErrorStrings.
|
|
691
|
+
vestUtils.hasOwnProperty(node, KeyToMinified[IsolateKeys.Type]), vestUtils.text(ErrorStrings.INVALID_ISOLATE_CANNOT_PARSE));
|
|
651
692
|
}
|
|
652
693
|
}
|
|
653
694
|
// eslint-disable-next-line max-statements, complexity
|