Line data Source code
1 : export type RootGraphId = string & { readonly __brand: 'RootGraphId' }
2 : export type OwningGraphId = string & { readonly __brand: 'OwningGraphId' }
3 :
4 2138238 : export function toRootGraphId(value: string): RootGraphId {
5 2138238 : return value as RootGraphId
6 : }
7 :
8 2116388 : export function toOwningGraphId(value: string): OwningGraphId {
9 2116388 : return value as OwningGraphId
10 : }
11 :
12 : export interface GraphScope {
13 : readonly rootGraphId: RootGraphId
14 : readonly owningGraphId: OwningGraphId
15 : }
16 :
17 2054382 : export function graphScopeOf(graph: {
18 : id: string
19 : rootGraph: { id: string }
20 : }): GraphScope {
21 2054382 : return {
22 : rootGraphId: toRootGraphId(graph.rootGraph.id),
23 : owningGraphId: toOwningGraphId(graph.id)
24 : }
25 : }
|