@cohesivesystems/processes-presentation 0.1.0-alpha.129
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/LICENSE +55 -0
- package/README.md +60 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/process-presentation-graph.d.ts +86 -0
- package/dist/process-presentation-graph.d.ts.map +1 -0
- package/dist/process-presentation-graph.js +847 -0
- package/dist/process-presentation-graph.js.map +1 -0
- package/dist/process-presentation-values.d.ts +8 -0
- package/dist/process-presentation-values.d.ts.map +1 -0
- package/dist/process-presentation-values.js +42 -0
- package/dist/process-presentation-values.js.map +1 -0
- package/dist/process-runtime-overlay.d.ts +78 -0
- package/dist/process-runtime-overlay.d.ts.map +1 -0
- package/dist/process-runtime-overlay.js +381 -0
- package/dist/process-runtime-overlay.js.map +1 -0
- package/package.json +50 -0
- package/src/index.ts +2 -0
- package/src/process-presentation-graph.ts +1517 -0
- package/src/process-presentation-values.ts +55 -0
- package/src/process-runtime-overlay.ts +896 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type DeepReadonly<T> =
|
|
2
|
+
T extends (...args: never[]) => unknown
|
|
3
|
+
? T
|
|
4
|
+
: T extends readonly (infer TItem)[]
|
|
5
|
+
? readonly DeepReadonly<TItem>[]
|
|
6
|
+
: T extends object
|
|
7
|
+
? { readonly [TKey in keyof T]: DeepReadonly<T[TKey]> }
|
|
8
|
+
: T
|
|
9
|
+
|
|
10
|
+
export function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
|
|
11
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function compareOrdinal(left: string, right: string): number {
|
|
15
|
+
return left < right ? -1 : left > right ? 1 : 0
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function cloneWireValue<T>(value: T): DeepReadonly<T> {
|
|
19
|
+
return cloneWireValueCore(value, new WeakMap()) as DeepReadonly<T>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function cloneWireValueCore(value: unknown, seen: WeakMap<object, unknown>): unknown {
|
|
23
|
+
if (typeof value !== 'object' || value === null) {
|
|
24
|
+
return value
|
|
25
|
+
}
|
|
26
|
+
const existing = seen.get(value)
|
|
27
|
+
if (existing !== undefined) {
|
|
28
|
+
return existing
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
const clone: unknown[] = []
|
|
32
|
+
seen.set(value, clone)
|
|
33
|
+
for (const item of value) {
|
|
34
|
+
clone.push(cloneWireValueCore(item, seen))
|
|
35
|
+
}
|
|
36
|
+
return Object.freeze(clone)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const clone: Record<string, unknown> = {}
|
|
40
|
+
seen.set(value, clone)
|
|
41
|
+
for (const [key, item] of Object.entries(value)) {
|
|
42
|
+
clone[key] = cloneWireValueCore(item, seen)
|
|
43
|
+
}
|
|
44
|
+
return Object.freeze(clone)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function deepFreeze<T>(value: T): T {
|
|
48
|
+
if (typeof value !== 'object' || value === null || Object.isFrozen(value)) {
|
|
49
|
+
return value
|
|
50
|
+
}
|
|
51
|
+
for (const nested of Object.values(value)) {
|
|
52
|
+
deepFreeze(nested)
|
|
53
|
+
}
|
|
54
|
+
return Object.freeze(value)
|
|
55
|
+
}
|