alizarin 1.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alizarin.umd.cjs","sources":["../../../node_modules/uuid/dist/esm-browser/regex.js","../../../node_modules/uuid/dist/esm-browser/validate.js","../../../node_modules/uuid/dist/esm-browser/parse.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/v35.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../../../node_modules/uuid/dist/esm-browser/sha1.js","../../../node_modules/uuid/dist/esm-browser/v5.js","../src/utils.ts","../src/static-types.ts","../src/client.ts","../src/rdm.ts","../src/staticStore.ts","../src/cards.ts","../src/nodeConfig.ts","../src/viewModels.ts","../src/pseudos.ts","../src/graphManager.ts","../src/renderers.ts","../src/main.ts","../__vite-browser-external"],"sourcesContent":["export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;\n","import REGEX from './regex.js';\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\nexport default validate;\n","import validate from './validate.js';\nfunction parse(uuid) {\n if (!validate(uuid)) {\n throw TypeError('Invalid UUID');\n }\n let v;\n return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 0xff, ((v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000) & 0xff, (v / 0x100000000) & 0xff, (v >>> 24) & 0xff, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff);\n}\nexport default parse;\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n","import parse from './parse.js';\nimport { unsafeStringify } from './stringify.js';\nexport function stringToBytes(str) {\n str = unescape(encodeURIComponent(str));\n const bytes = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i) {\n bytes[i] = str.charCodeAt(i);\n }\n return bytes;\n}\nexport const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexport const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexport default function v35(version, hash, value, namespace, buf, offset) {\n const valueBytes = typeof value === 'string' ? stringToBytes(value) : value;\n const namespaceBytes = typeof namespace === 'string' ? parse(namespace) : namespace;\n if (typeof namespace === 'string') {\n namespace = parse(namespace);\n }\n if (namespace?.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n }\n let bytes = new Uint8Array(16 + valueBytes.length);\n bytes.set(namespaceBytes);\n bytes.set(valueBytes, namespaceBytes.length);\n bytes = hash(bytes);\n bytes[6] = (bytes[6] & 0x0f) | version;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n return buf;\n }\n return unsafeStringify(bytes);\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","function f(s, x, y, z) {\n switch (s) {\n case 0:\n return (x & y) ^ (~x & z);\n case 1:\n return x ^ y ^ z;\n case 2:\n return (x & y) ^ (x & z) ^ (y & z);\n case 3:\n return x ^ y ^ z;\n }\n}\nfunction ROTL(x, n) {\n return (x << n) | (x >>> (32 - n));\n}\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n const newBytes = new Uint8Array(bytes.length + 1);\n newBytes.set(bytes);\n newBytes[bytes.length] = 0x80;\n bytes = newBytes;\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n for (let j = 0; j < 16; ++j) {\n arr[j] =\n (bytes[i * 64 + j * 4] << 24) |\n (bytes[i * 64 + j * 4 + 1] << 16) |\n (bytes[i * 64 + j * 4 + 2] << 8) |\n bytes[i * 64 + j * 4 + 3];\n }\n M[i] = arr;\n }\n M[N - 1][14] = ((bytes.length - 1) * 8) / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = ((bytes.length - 1) * 8) & 0xffffffff;\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = (ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t]) >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n H[0] = (H[0] + a) >>> 0;\n H[1] = (H[1] + b) >>> 0;\n H[2] = (H[2] + c) >>> 0;\n H[3] = (H[3] + d) >>> 0;\n H[4] = (H[4] + e) >>> 0;\n }\n return Uint8Array.of(H[0] >> 24, H[0] >> 16, H[0] >> 8, H[0], H[1] >> 24, H[1] >> 16, H[1] >> 8, H[1], H[2] >> 24, H[2] >> 16, H[2] >> 8, H[2], H[3] >> 24, H[3] >> 16, H[3] >> 8, H[3], H[4] >> 24, H[4] >> 16, H[4] >> 8, H[4]);\n}\nexport default sha1;\n","import sha1 from './sha1.js';\nimport v35, { DNS, URL } from './v35.js';\nexport { DNS, URL } from './v35.js';\nfunction v5(value, namespace, buf, offset) {\n return v35(0x50, sha1, value, namespace, buf, offset);\n}\nv5.DNS = DNS;\nv5.URL = URL;\nexport default v5;\n","import { v5 as uuidv5 } from 'uuid';\nimport { IStringKeyedObject } from \"./interfaces\";\n\n// TODO: make this customizable.\nconst DEFAULT_LANGUAGE = \"en\";\nconst SLUG_LENGTH = 20;\nconst UUID_NAMESPACE = '1a79f1c8-9505-4bea-a18e-28a053f725ca'; // Generated for this purpose.\nconst UUID_NAMESPACE_COMPRESSION = uuidv5('compression', '1a79f1c8-9505-4bea-a18e-28a053f725ca');\n\nlet currentLanguage: string | undefined;\n\nfunction slugify(original: any): string {\n return `${original}`.replaceAll(/[^A-Za-z0-9_]/g, \"\").slice(0, SLUG_LENGTH);\n}\n\nfunction getCurrentLanguage(): string {\n return currentLanguage || ((typeof navigator != 'undefined' && navigator.language) || DEFAULT_LANGUAGE).slice(0, 2);\n}\n\nfunction setCurrentLanguage(lang: string) {\n currentLanguage = lang;\n}\n\nclass AttrPromise<T> extends Promise<T> implements IStringKeyedObject {\n [key: string | symbol]: any;\n [Symbol.toPrimitive]: undefined;\n constructor(\n executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason: any) => void,\n ) => void,\n ) {\n super(executor);\n const proxy = new Proxy(this, {\n set: (object: AttrPromise<T>, keyObj, value) => {\n object.then((val: any) => {\n val[keyObj] = value;\n return val;\n });\n return true;\n },\n get: (object: AttrPromise<T>, keyObj: string | symbol) => {\n if (keyObj in object) {\n const value: any = object[keyObj];\n if (typeof value === \"function\") {\n return value.bind(object);\n }\n return value;\n }\n const key = keyObj.toString();\n if (key in object) {\n const value: any = object[key];\n if (typeof value === \"function\") {\n return value.bind(object);\n }\n return value;\n }\n if (object instanceof Promise) {\n return object.then((val: any) => {\n return val ? val[keyObj] : val;\n });\n }\n return object[keyObj];\n },\n });\n return proxy;\n }\n}\n\nconst KEY_COMPRESSION_LENGTH = 1000;\nfunction generateUuidv5(group: [type: string, id?: string], key: string | string[]) {\n if (Array.isArray(key)) {\n let shortKey = '';\n let keyTracker = '';\n key.forEach(k => {\n if (keyTracker.length + k.length + 1 > KEY_COMPRESSION_LENGTH) {\n shortKey = uuidv5(shortKey + '>' + keyTracker, UUID_NAMESPACE_COMPRESSION);\n keyTracker = k;\n } else {\n keyTracker += ';' + k;\n }\n });\n }\n return uuidv5(`${group[0]}:${group[1]}:${key}`, UUID_NAMESPACE);\n}\n\nexport { slugify, AttrPromise, getCurrentLanguage, generateUuidv5, setCurrentLanguage };\n","import { v4 as uuidv4 } from 'uuid';\nimport { generateUuidv5 } from './utils';\nconst UUID_NAMESPACE = '1a79f1c8-9505-4bea-a18e-28a053f725ca'; // Generated for this purpose.\nimport { getCurrentLanguage, slugify } from './utils';\n\nclass StaticGraphMeta {\n [key: string]: any\n author: string | undefined\n cards: number | undefined\n cards_x_nodes_x_widgets: number | undefined\n color: string | undefined\n description: {[lang: string]: string} | undefined\n edges: number | undefined\n graphid: string\n iconclass: string | undefined\n is_editable: boolean | undefined\n isresource: boolean | undefined\n jsonldcontext: {[key: string]: any} | undefined\n name: {[lang: string]: string} | undefined\n nodegroups: number | undefined\n nodes: number | undefined\n ontology_id: string | undefined\n publication: {[key: string]: string | null} | undefined\n relatable_resource_model_ids: string[] = []\n resource_2_resource_constraints: any[] = []\n root: StaticNode | undefined\n slug: string | undefined\n subtitle: {[lang: string]: string} | undefined\n version: string | undefined\n\n constructor(jsondata: StaticGraphMeta) {\n this.graphid = jsondata.graphid;\n Object.assign(this, jsondata)\n }\n}\n\nclass StaticTranslatableString extends String {\n translations: Map<string, string>;\n lang: string;\n\n constructor(\n s: string | StaticTranslatableString,\n lang: undefined | string = undefined,\n ) {\n let translations: Map<string, string>;\n let finalLang: string;\n if (s instanceof StaticTranslatableString) {\n translations = new Map(s.translations);\n if (lang === undefined) {\n finalLang = s.lang;\n } else {\n finalLang = lang;\n }\n } else if (typeof s === \"object\") {\n translations = new Map(Object.entries(s));\n if (lang === undefined || !translations.has(lang)) {\n const defaultLanguage = getCurrentLanguage();\n if (!translations || translations.has(defaultLanguage)) {\n finalLang = defaultLanguage;\n } else {\n finalLang = Object.keys(s)[0];\n }\n } else {\n finalLang = lang;\n }\n } else {\n translations = new Map();\n finalLang = lang || getCurrentLanguage();\n translations.set(finalLang, s);\n }\n s = translations.get(finalLang) || \"\";\n super(s);\n this.translations = translations;\n this.lang = finalLang;\n }\n\n copy?() {\n return new StaticTranslatableString(this, this.lang);\n }\n\n toString(): string {\n const current = this.lang || getCurrentLanguage();\n let asString;\n if (this.translations.size) {\n asString = this.translations.get(current) || this.translations.values().next().value\n }\n return `${asString}`;\n }\n\n toJSON(): {[key: string]: string} {\n return Object.fromEntries(this.translations);\n }\n}\n\nclass StaticNodegroup {\n cardinality: \"1\" | \"n\" | null;\n legacygroupid: null;\n nodegroupid: string;\n parentnodegroup_id: string | null;\n\n constructor(jsonData: StaticNodegroup) {\n this.legacygroupid = jsonData.legacygroupid;\n this.nodegroupid = jsonData.nodegroupid;\n this.parentnodegroup_id = jsonData.parentnodegroup_id;\n this.cardinality = jsonData.cardinality;\n }\n\n copy?(): StaticNodegroup {\n return new StaticNodegroup(this);\n }\n}\n\nclass StaticNode {\n alias: string | null;\n config: { [key: string]: any };\n datatype: string;\n description: string | null;\n exportable: boolean;\n fieldname: null | string;\n graph_id: string;\n hascustomalias: boolean;\n is_collector: boolean;\n isrequired: boolean;\n issearchable: boolean;\n istopnode: boolean;\n name: string;\n nodegroup_id: string | null;\n nodeid: string;\n ontologyclass: string | null = null;\n parentproperty: string | null = null;\n sortorder: number;\n sourcebranchpublication_id: null | string = null;\n\n constructor(jsonData: StaticNode) {\n this.alias = jsonData.alias;\n this.config = jsonData.config;\n this.datatype = jsonData.datatype;\n this.description = jsonData.description;\n this.exportable = jsonData.exportable;\n this.fieldname = jsonData.fieldname;\n this.graph_id = jsonData.graph_id;\n this.hascustomalias = jsonData.hascustomalias;\n this.is_collector = jsonData.is_collector;\n this.isrequired = jsonData.isrequired;\n this.issearchable = jsonData.issearchable;\n this.istopnode = jsonData.istopnode;\n this.name = jsonData.name;\n this.nodegroup_id = jsonData.nodegroup_id;\n this.nodeid = jsonData.nodeid;\n this.parentproperty = jsonData.parentproperty;\n this.sortorder = jsonData.sortorder;\n this.ontologyclass = jsonData.ontologyclass;\n this.sourcebranchpublication_id = jsonData.sourcebranchpublication_id;\n }\n\n copy?(): StaticNode {\n // TODO: config should be deep copied\n return new StaticNode(this);\n }\n\n // true -- same object\n // 2 -- identical\n // 1 -- identical not counting falsey nodeid, nodegroupid and/or graphid\n // -1 -- identical up to nodeid\n // -2 -- identical up to nodeid, nodegroupid\n // -3 -- identical up to nodeid, nodegroupid and graphid\n // false -- different\n // for <2, falsey nodeid, nodegroupid and graphid count as matches\n // and copy/compare are ignored.\n static compare(nodeA: StaticNode | {[key: string]: any}, nodeB: StaticNode | {[key: string]: any}): number | boolean {\n if (nodeA === nodeB) {\n return true;\n }\n const keys = [...Object.keys(nodeA), ...Object.keys(nodeB)].filter(key => ![\n 'compare',\n 'copy',\n 'nodeid',\n 'graph_id',\n 'nodegroup_id'\n ].includes(key));\n // doubles keys...\n function compareEntries(entriesA: [string, any][], entriesB: [string, any][]) {\n const entryPairs: {[key: string]: any} = {};\n for (const [key, value] of [...entriesA, ...entriesB]) {\n entryPairs[key] = entryPairs[key] || [];\n entryPairs[key].push(value);\n }\n for (const [_, [valA, valB]] of Object.entries(entryPairs)) {\n if (valA && valB && typeof valA === 'object' && typeof valB === 'object') {\n if (!compareEntries(Object.entries(valA), Object.entries(valB))) {\n return false;\n }\n }\n if (Array.isArray(valA) && Array.isArray(valB)) {\n if (!compareEntries(Object.entries(valA), Object.entries(valB))) {\n return false;\n }\n }\n if (valA !== valB) {\n return false;\n }\n }\n return true;\n }\n if (!compareEntries(\n // @ts-expect-error Expecting values to be symbols\n keys.map((k: string): [string, any][] => [k, nodeA[k]]),\n // @ts-expect-error Expecting values to be symbols\n keys.map((k: string): [string, any][] => [k, nodeB[k]])\n )) {\n return false;\n }\n\n // We know these are the same up to the IDs\n if (nodeA.graph_id && nodeB.graph_id && nodeA.graph_id !== nodeB.graph_id) {\n return -3;\n }\n if (nodeA.nodegroup_id && nodeB.nodegroup_id && nodeA.nodegroup_id !== nodeB.nodegroup_id) {\n return -2;\n }\n if (nodeA.nodeid && nodeB.nodeid && nodeA.nodeid !== nodeB.nodeid) {\n return -1;\n }\n if (\n (nodeA.graph_id && nodeB.graph_id || nodeA.graph_id === nodeB.graph_id) &&\n (nodeA.nodegroup_id && nodeB.nodegroup_id || nodeA.nodegroup_id === nodeB.nodegroup_id) &&\n (nodeA.nodeid && nodeB.nodeid || nodeA.nodeid === nodeB.nodeid)\n ) {\n return 2;\n }\n return 1;\n }\n}\n\nclass StaticConstraint {\n card_id: string;\n constraintid: string;\n nodes: Array<string>;\n uniquetoallinstances: boolean;\n\n constructor(jsonData: StaticConstraint) {\n this.card_id = jsonData.card_id;\n this.constraintid = jsonData.constraintid;\n this.nodes = jsonData.nodes;\n this.uniquetoallinstances = jsonData.uniquetoallinstances;\n }\n}\n\nclass StaticCard {\n active: boolean;\n cardid: string;\n component_id: string;\n config?: object;\n constraints: Array<StaticConstraint>;\n cssclass: null | string;\n description: string | null;\n graph_id: string;\n helpenabled: boolean;\n helptext: StaticTranslatableString;\n helptitle: StaticTranslatableString;\n instructions: StaticTranslatableString;\n is_editable: boolean;\n name: StaticTranslatableString;\n nodegroup_id: string;\n sortorder: number | null;\n visible: boolean;\n\n constructor(jsonData: StaticCard) {\n this.active = jsonData.active;\n this.cardid = jsonData.cardid;\n this.component_id = jsonData.component_id;\n this.config = jsonData.config;\n this.constraints = jsonData.constraints.map(\n (constraint) => new StaticConstraint(constraint),\n );\n this.cssclass = jsonData.cssclass;\n this.description = jsonData.description;\n this.graph_id = jsonData.graph_id;\n this.helpenabled = jsonData.helpenabled;\n this.helptext = new StaticTranslatableString(jsonData.helptext);\n this.helptitle = new StaticTranslatableString(jsonData.helptitle);\n this.instructions = new StaticTranslatableString(jsonData.instructions);\n this.is_editable = jsonData.is_editable;\n this.name = new StaticTranslatableString(jsonData.name);\n this.nodegroup_id = jsonData.nodegroup_id;\n this.sortorder = jsonData.sortorder;\n this.visible = jsonData.visible;\n }\n}\n\nclass StaticCardsXNodesXWidgets {\n card_id: string;\n config: object;\n id: string;\n label: StaticTranslatableString;\n node_id: string;\n sortorder: number;\n visible: boolean;\n widget_id: string;\n\n constructor(jsonData: StaticCardsXNodesXWidgets) {\n this.card_id = jsonData.card_id;\n this.config = jsonData.config;\n this.id = jsonData.id;\n this.label = new StaticTranslatableString(jsonData.label);\n this.node_id = jsonData.node_id;\n this.sortorder = jsonData.sortorder;\n this.visible = jsonData.visible;\n this.widget_id = jsonData.widget_id;\n }\n}\n\nclass StaticEdge {\n description: string | null;\n domainnode_id: string;\n edgeid: string;\n graph_id: string;\n name: null | string;\n ontologyproperty: null | string = null;\n rangenode_id: string;\n\n constructor(jsonData: StaticEdge) {\n this.description = jsonData.description;\n this.domainnode_id = jsonData.domainnode_id;\n this.edgeid = jsonData.edgeid;\n this.graph_id = jsonData.graph_id;\n this.name = jsonData.name;\n this.rangenode_id = jsonData.rangenode_id;\n this.ontologyproperty = jsonData.ontologyproperty;\n }\n\n copy?(): StaticEdge {\n return new StaticEdge(this);\n }\n}\n\ninterface IStaticDescriptorConfig {\n descriptor_types: {\n nodegroup_id: string,\n string_template: string\n }[],\n};\n\nclass StaticFunctionsXGraphs {\n config: IStaticDescriptorConfig;\n function_id: string;\n graph_id: string;\n id: string;\n\n constructor(jsonData: StaticFunctionsXGraphs) {\n this.config = jsonData.config;\n this.function_id = jsonData.function_id;\n this.graph_id = jsonData.graph_id;\n this.id = jsonData.id;\n }\n\n copy(): StaticFunctionsXGraphs {\n return new StaticFunctionsXGraphs(this);\n }\n}\n\nclass StaticPublication {\n graph_id: string;\n notes: null | string;\n publicationid: string;\n published_time: string;\n\n constructor(jsonData: StaticPublication) {\n this.graph_id = jsonData.graph_id;\n this.notes = jsonData.notes;\n this.publicationid = jsonData.publicationid;\n this.published_time = jsonData.published_time;\n }\n\n copy?(): StaticPublication {\n return new StaticPublication(this);\n }\n}\n\nclass StaticGraph {\n author: string;\n cards: Array<StaticCard> | null = null;\n cards_x_nodes_x_widgets: Array<StaticCardsXNodesXWidgets> | null = null;\n color: string | null;\n config: object;\n deploymentdate: null | string = null;\n deploymentfile: null | string = null;\n description: StaticTranslatableString;\n edges: Array<StaticEdge>;\n functions_x_graphs: Array<StaticFunctionsXGraphs> | null = null;\n graphid: string;\n iconclass: string;\n is_editable: boolean | null = null;\n isresource: boolean;\n jsonldcontext: string | null = null;\n name: StaticTranslatableString;\n nodegroups: Array<StaticNodegroup>;\n nodes: Array<StaticNode>;\n ontology_id: string | null = null;\n publication: StaticPublication | null = null;\n relatable_resource_model_ids: Array<string>;\n resource_2_resource_constraints: Array<any> | null = null;\n root: StaticNode;\n slug: string | null = null;\n subtitle: StaticTranslatableString;\n template_id: string;\n version: string;\n\n constructor(jsonData: StaticGraph) {\n this.author = jsonData.author;\n this.cards =\n jsonData.cards && jsonData.cards.map((card) => new StaticCard(card));\n this.cards_x_nodes_x_widgets =\n jsonData.cards_x_nodes_x_widgets &&\n jsonData.cards_x_nodes_x_widgets.map(\n (card_x_node_x_widget) =>\n new StaticCardsXNodesXWidgets(card_x_node_x_widget),\n );\n this.color = jsonData.color;\n this.config = jsonData.config;\n this.deploymentdate = jsonData.deploymentdate;\n this.deploymentfile = jsonData.deploymentfile;\n this.description = new StaticTranslatableString(jsonData.description);\n this.edges = jsonData.edges.map((edge) => new StaticEdge(edge));\n this.functions_x_graphs =\n jsonData.functions_x_graphs &&\n jsonData.functions_x_graphs.map(\n (functions_x_graphs) => new StaticFunctionsXGraphs(functions_x_graphs),\n );\n this.graphid = jsonData.graphid;\n this.iconclass = jsonData.iconclass;\n this.is_editable = jsonData.is_editable;\n this.isresource = jsonData.isresource;\n this.jsonldcontext = jsonData.jsonldcontext;\n this.name = new StaticTranslatableString(jsonData.name);\n this.nodegroups = jsonData.nodegroups.map(\n (nodegroup) => new StaticNodegroup(nodegroup),\n );\n // We should probably confirm that there is one node in nodes and it is\n // equivalent to root.\n this.nodes = jsonData.nodes.map((node) => new StaticNode(node));\n this.ontology_id = jsonData.ontology_id;\n this.publication =\n jsonData.publication && new StaticPublication(jsonData.publication);\n this.relatable_resource_model_ids = jsonData.relatable_resource_model_ids;\n this.resource_2_resource_constraints =\n jsonData.resource_2_resource_constraints;\n this.root = jsonData.root;\n this.slug = jsonData.slug;\n this.subtitle = new StaticTranslatableString(jsonData.subtitle);\n this.template_id = jsonData.template_id;\n this.version = jsonData.version;\n }\n\n // TODO: complete deepcopy\n copy?(): StaticGraph {\n const newGraph = new StaticGraph(this);\n Object.assign(newGraph, {\n author: this.author,\n cards: this.cards?.map(card => new StaticCard(card)) || [],\n cards_x_nodes_x_widgets: this.cards_x_nodes_x_widgets?.map(cnw => new StaticCardsXNodesXWidgets(cnw)) || [],\n color: this.color,\n config: Object.assign({}, this.config), // TODO: deepcopy;\n deploymentdate: this.deploymentdate,\n deploymentfile: this.deploymentfile,\n description: this.description.copy && this.description.copy() || this.description,\n edges: this.edges.map(edge => edge.copy && edge.copy() || edge),\n functions_x_graphs: this.functions_x_graphs?.map(fxg => fxg.copy()) || [],\n graphid: this.graphid,\n iconclass: this.iconclass,\n is_editable: this.is_editable,\n isresource: this.isresource,\n jsonldcontext: this.jsonldcontext,\n name: this.name.copy && this.name.copy() || this.name,\n nodegroups: this.nodegroups?.map(ng => ng.copy && ng.copy() || ng),\n nodes: this.nodes?.map(n => n.copy && n.copy() || n),\n ontology_id: this.ontology_id,\n publication: this.publication?.copy && this.publication.copy() || null,\n relatable_resource_model_ids: [...this.relatable_resource_model_ids || []],\n resource_2_resource_constraints: [...this.resource_2_resource_constraints || []],\n root: this.root.copy && this.root.copy() || this.root,\n slug: this.slug,\n subtitle: this.subtitle.copy && this.subtitle.copy(),\n template_id: this.template_id,\n version: this.version\n });\n return newGraph;\n }\n\n static create(props: {\n author?: string,\n color?: string | null,\n config?: object,\n deploymentdate?: null | string,\n deploymentfile?: null | string,\n description?: string | StaticTranslatableString,\n graphid?: string,\n iconclass?: string,\n is_editable?: boolean | null,\n isresource?: boolean,\n jsonldcontext?: string | null,\n name?: string | StaticTranslatableString,\n ontology_id?: string | null,\n relatable_resource_model_ids?: Array<string>,\n resource_2_resource_constraints?: Array<any> | null,\n slug?: string | null,\n subtitle?: string | StaticTranslatableString,\n template_id?: string,\n version?: string\n }, published: boolean=true): StaticGraph {\n const graphid = props.graphid || uuidv4();\n const publication = published ? new StaticPublication({\n graph_id: graphid,\n notes: null,\n publicationid: uuidv4(),\n published_time: (new Date()).toISOString()\n }) : null;\n // TODO: check name is not just string in upstream\n const name = props.name ? (\n props.name instanceof StaticTranslatableString ?\n props.name : new StaticTranslatableString(props.name)\n ) : new StaticTranslatableString('');\n const alias = slugify(name);\n const root = new StaticNode({\n \"alias\": alias,\n \"config\": {},\n \"datatype\": \"semantic\",\n \"description\": \"\",\n \"exportable\": false,\n \"fieldname\": \"\",\n \"graph_id\": graphid,\n \"hascustomalias\": false,\n \"is_collector\": false,\n \"isrequired\": false,\n \"issearchable\": true,\n \"istopnode\": true,\n \"name\": name.toString(),\n \"nodegroup_id\": null,\n \"nodeid\": graphid,\n \"ontologyclass\": props.ontology_id || null,\n \"parentproperty\": null,\n \"sortorder\": 0,\n \"sourcebranchpublication_id\": null\n });\n return new StaticGraph({\n author: props.author,\n cards: null,\n cards_x_nodes_x_widgets: null,\n color: props.color || null,\n config: props.config || {},\n deploymentdate: props.deploymentdate || null,\n deploymentfile: props.deploymentfile || null,\n description: props.description ? (\n props.description instanceof StaticTranslatableString ?\n props.description : new StaticTranslatableString(props.description)\n ) : null,\n edges: [],\n functions_x_graphs: [],\n graphid: graphid,\n iconclass: props.iconclass || '',\n is_editable: props.is_editable || null,\n isresource: props.isresource || null,\n jsonldcontext: props.jsonldcontext || null,\n name: name,\n nodegroups: [],\n nodes: [root.copy()],\n ontology_id: props.ontology_id || null,\n publication: publication,\n relatable_resource_model_ids: props.relatable_resource_model_ids || [],\n resource_2_resource_constraints: props.resource_2_resource_constraints || null,\n root: root,\n slug: props.slug || null,\n subtitle: props.subtitle ? (\n props.subtitle instanceof StaticTranslatableString ?\n props.subtitle : new StaticTranslatableString(props.subtitle)\n ) : new StaticTranslatableString(''),\n template_id: props.template_id || '',\n version: props.version || ''\n });\n }\n}\n\n/// Resources\n//\ntype StaticProvisionalEdit = any;\n\nclass StaticValue {\n id: string;\n value: string;\n __concept?: StaticConcept | null;\n __conceptId?: string | null;\n\n constructor(jsonData: StaticValue, concept: StaticConcept | string | null = null) {\n this.id = jsonData.id;\n this.value = jsonData.value;\n if (concept instanceof StaticConcept) {\n this.__concept = concept;\n this.__conceptId = concept ? concept.id : null;\n } else {\n this.__concept = null;\n this.__conceptId = concept;\n }\n }\n\n toString() {\n return this.value;\n }\n\n static create(referent: string | StaticConcept, valueType: string, value: string, language?: string) {\n const lang = language || getCurrentLanguage();\n const referentId = referent instanceof StaticConcept ? referent.id : referent;\n // NB: this means passing an ID of a concept, and a concept, have different ID-creating behaviour.\n const concept = referent instanceof StaticConcept ? referent : null;\n const id = generateUuidv5(\n ['value'],\n `${referentId}/${valueType}/${value}/${lang}`\n );\n return new StaticValue(\n {\n id: id,\n value: value\n },\n concept\n );\n }\n}\n\nclass StaticConcept {\n id: string;\n prefLabels: { [lang: string]: StaticValue };\n source: string | null;\n sortOrder: number | null;\n children: StaticConcept[] | null;\n\n constructor(jsonData: StaticConcept) {\n this.id = jsonData.id;\n this.prefLabels = jsonData.prefLabels;\n for (const [lang, value] of Object.entries(this.prefLabels)) {\n if (!(value instanceof StaticValue)) {\n this.prefLabels[lang] = new StaticValue(value, this);\n }\n }\n this.source = jsonData.source;\n this.sortOrder = jsonData.sortOrder;\n this.children = jsonData.children;\n if (this.children) {\n this.children = this.children.map((child) => {\n return child instanceof StaticConcept\n ? child\n : new StaticConcept(child);\n });\n }\n }\n\n getPrefLabel?(): StaticValue {\n return (\n this.prefLabels[getCurrentLanguage()] || Object.values(this.prefLabels)[0]\n );\n }\n\n toString() {\n if (!this.getPrefLabel) {\n return this.constructor(this).getPrefLabel().value;\n }\n return this.getPrefLabel().value;\n }\n\n // NB: copies value, does not make it a child\n static fromValue(conceptScheme: StaticConcept | null, value: string | StaticValue | { [lang: string]: StaticValue }, children?: (string | StaticValue | StaticConcept)[], config: {baseLanguage?: string, source?: string | null, sortOrder?: number | null} = {}): StaticConcept {\n // TODO make sure that children are in the same concept scheme so that deterministic IDs are preserved.\n let lang = config?.baseLanguage || getCurrentLanguage();\n let tmpValue;\n let prefLabels: { [lang: string]: StaticValue };\n if (typeof value === 'string') {\n tmpValue = value;\n prefLabels = {[lang]: new StaticValue({id: '', value: tmpValue})};\n } else if (value instanceof StaticValue) {\n tmpValue = value.value;\n prefLabels = {[lang]: value};\n } else if (lang in value) {\n tmpValue = value[lang].value;\n prefLabels = value;\n } else {\n const firstValue = Object.entries(value).sort()[0];\n if (firstValue === undefined) {\n throw Error(\"Cannot create a concept from values without a non-empty value\");\n }\n lang = firstValue[0];\n tmpValue = firstValue[1].value;\n prefLabels = value;\n }\n const conceptId = generateUuidv5(\n ['concept'],\n `${conceptScheme?.id || '(none)'}/${tmpValue}`\n );\n const childConcepts = (children || []).map(child => {\n if (!(child instanceof StaticConcept)) {\n return StaticConcept.fromValue(conceptScheme, value, [], {baseLanguage: config.baseLanguage});\n }\n return child;\n });\n return new StaticConcept({\n id: conceptId,\n prefLabels,\n source: config.source || null,\n sortOrder: config.sortOrder || null,\n children: childConcepts\n });\n }\n}\n\n// A prefLabel, for example, can only exist once per language.\nclass StaticCollection {\n id: string;\n prefLabels: { [lang: string]: StaticValue };\n concepts: { [conceptId: string]: StaticConcept };\n __allConcepts: { [conceptId: string]: StaticConcept };\n __values: { [valueId: string]: StaticValue };\n\n static fromConceptScheme(props: {\n collectionid?: string,\n name?: string | { [lang: string]: StaticValue } | StaticValue;\n conceptScheme: StaticConcept\n }): StaticCollection {\n const collectionName = props.name ?? props.conceptScheme.toString();\n return StaticCollection.create({\n name: collectionName,\n concepts: props.conceptScheme.children || []\n })\n }\n\n static create(props: {\n collectionid?: string,\n name: string | { [lang: string]: StaticValue } | StaticValue;\n concepts: StaticConcept[] | { [conceptId: string]: StaticConcept }\n }): StaticCollection {\n let concepts = props.concepts;\n if (Array.isArray(concepts)) {\n concepts = concepts.reduce(\n (acc: { [conceptId: string]: StaticConcept }, c: StaticConcept) => {\n acc[c.id] = c;\n return acc;\n },\n {});\n }\n const name: StaticValue | { [lang: string]: StaticValue } = (\n typeof props.name === 'string' ?\n StaticValue.create('', 'prefLabel', props.name) :\n props.name\n );\n let collectionid = props.collectionid;\n if (!collectionid) {\n if (typeof name === 'string') {\n collectionid = generateUuidv5(\n ['collection'],\n name\n );\n } else if (name instanceof StaticValue) {\n collectionid = generateUuidv5(\n ['collection'],\n name.value\n );\n } else {\n throw Error(\"Must have a unique name to create a collection ID\");\n }\n }\n const prefLabels: { [lang: string]: StaticValue } = name instanceof StaticValue ? {\n [getCurrentLanguage()]: name\n } : name;\n return new StaticCollection({\n id: collectionid,\n prefLabels: prefLabels,\n concepts: concepts,\n __allConcepts: {},\n __values: {}\n });\n }\n\n constructor(jsonData: StaticCollection) {\n this.id = jsonData.id;\n this.prefLabels = jsonData.prefLabels;\n this.concepts = jsonData.concepts;\n this.__allConcepts = {};\n this.__values = {};\n const addValues = (concept: StaticConcept) => {\n this.__allConcepts[concept.id] = concept;\n for (const [, value] of Object.entries(concept.prefLabels)) {\n this.__values[value.id] = value;\n }\n if (concept.children) {\n for (let child of concept.children) {\n if (!(child instanceof StaticConcept)) {\n child = new StaticConcept(child);\n }\n addValues(child);\n }\n }\n };\n for (const [id, concept] of Object.entries(this.concepts)) {\n if (!(concept instanceof StaticConcept)) {\n this.concepts[id] = new StaticConcept(concept);\n }\n addValues(this.concepts[id]);\n }\n }\n\n getConceptValue?(valueId: string) {\n return this.__values[valueId];\n }\n\n getConceptByValue?(label: string) {\n return Object.values(this.__values).find(value => value.value == label)?.__concept;\n }\n\n toString(): string {\n return (this.prefLabels[getCurrentLanguage()] || Object.values(this.prefLabels)[0] || '').toString();\n }\n}\n\nclass StaticTile {\n data: Map<\n string,\n object | Map<string, any> | Array<any> | null | number | boolean | string\n >;\n nodegroup_id: string;\n resourceinstance_id: string;\n tileid: string | null;\n parenttile_id: string | null = null;\n provisionaledits: null | Array<StaticProvisionalEdit> = null;\n sortorder: number | null = null;\n\n constructor(jsonData: StaticTile) {\n this.data = jsonData.data;\n if (typeof this.data === 'object' && !(this.data instanceof Map)) {\n this.data = new Map(Object.entries(this.data));\n }\n this.nodegroup_id = jsonData.nodegroup_id;\n this.resourceinstance_id = jsonData.resourceinstance_id;\n this.tileid = jsonData.tileid;\n this.parenttile_id = jsonData.parenttile_id;\n this.provisionaledits = jsonData.provisionaledits;\n this.sortorder = jsonData.sortorder;\n }\n\n ensureId(): string {\n if (!this.tileid) {\n this.tileid = crypto.randomUUID();\n }\n return this.tileid;\n }\n}\n\nclass StaticResourceDescriptors {\n [key: string]: (string | undefined | (() => boolean));\n name?: string;\n map_popup?: string;\n description?: string;\n\n constructor(jsonData?: StaticResourceDescriptors) {\n if (jsonData) {\n this.name = jsonData.name;\n this.map_popup = jsonData.map_popup;\n this.description = jsonData.description;\n }\n }\n\n isEmpty(): boolean {\n return !(this.name || this.map_popup || this.description);\n }\n}\n\nclass StaticResourceMetadata {\n descriptors: StaticResourceDescriptors;\n graph_id: string;\n name: string;\n resourceinstanceid: string;\n publication_id: string | null = null;\n principaluser_id: number | null = null;\n legacyid: null | string = null;\n graph_publication_id: string | null = null;\n\n constructor(jsonData: StaticResourceMetadata) {\n this.descriptors = jsonData.descriptors;\n if (!(this.descriptors instanceof StaticResourceDescriptors)) {\n if (jsonData.descriptors instanceof Map) {\n this.descriptors = new StaticResourceDescriptors(Object.fromEntries(jsonData.descriptors.entries()));\n } else {\n this.descriptors = new StaticResourceDescriptors(this.descriptors);\n }\n }\n this.graph_id = jsonData.graph_id;\n this.name = jsonData.name;\n this.resourceinstanceid = jsonData.resourceinstanceid;\n this.publication_id = jsonData.publication_id;\n this.principaluser_id = jsonData.principaluser_id;\n this.legacyid = jsonData.legacyid;\n this.graph_publication_id = jsonData.graph_publication_id;\n }\n}\n\nclass StaticDomainValue {\n id: string\n selected: boolean\n text: {[lang: string]: string}\n\n constructor(jsonData: StaticDomainValue) {\n this.id = jsonData.id;\n this.selected = jsonData.selected;\n this.text = jsonData.text;\n }\n\n toString() {\n const lang = getCurrentLanguage();\n let localized = this.text[lang];\n if (typeof localized !== \"string\") {\n localized = Object.values(this.text)[0];\n }\n if (!localized) {\n throw Error(`Could not render domain value ${this.id} in language ${lang}`);\n }\n return localized;\n }\n\n lang(lang: string): string | undefined {\n return this.text[lang];\n }\n\n async forJson() {\n return {\n id: this.id,\n selected: this.selected,\n text: this.text\n }\n }\n}\n\nclass StaticResourceReference {\n id: string;\n type: string | undefined;\n graphId: string;\n title: string | undefined;\n root: any | undefined;\n meta?: {[key: string]: any};\n\n constructor(jsonData: StaticResourceReference) {\n this.id = jsonData.id;\n this.type = jsonData.type;\n this.graphId = jsonData.graphId;\n this.root = jsonData.root;\n this.title = jsonData.title;\n if (jsonData.meta) {\n this.meta = jsonData.meta;\n }\n }\n}\n\nclass StaticResource {\n resourceinstance: StaticResourceMetadata;\n tiles: Array<StaticTile> | null = null;\n metadata: {[key: string]: string};\n __cache: {[tileId: string]: {[nodeId: string]: {[key: string]: string}}} | undefined = undefined;\n __source: string | undefined = undefined;\n __scopes: string[] | undefined = undefined;\n\n constructor(jsonData: StaticResource) {\n this.resourceinstance = new StaticResourceMetadata(\n jsonData.resourceinstance,\n );\n this.tiles =\n jsonData.tiles && jsonData.tiles.map((tile) => new StaticTile(tile));\n this.metadata = jsonData.metadata || {};\n this.__cache = jsonData.__cache;\n this.__scopes = jsonData.__scopes;\n }\n}\n\nexport {\n StaticValue,\n StaticTile,\n StaticGraph,\n StaticResource,\n StaticResourceMetadata,\n StaticNode,\n StaticNodegroup,\n StaticEdge,\n StaticCard,\n StaticCardsXNodesXWidgets,\n StaticCollection,\n StaticConcept,\n StaticDomainValue,\n StaticResourceReference,\n StaticGraphMeta,\n StaticFunctionsXGraphs,\n StaticResourceDescriptors,\n StaticTranslatableString,\n StaticConstraint,\n type IStaticDescriptorConfig\n};\n","import { StaticGraphMeta, StaticGraph, StaticResource } from \"./static-types\";\nimport { StaticCollection } from \"./rdm\";\n\nclass GraphResult {\n models: {[graphId: string]: StaticGraphMeta};\n\n constructor(jsonData: GraphResult) {\n this.models = Object.fromEntries(\n Object.entries(jsonData.models).map(([k, v]) => [k, new StaticGraphMeta(v)])\n );\n }\n}\n\nabstract class ArchesClient {\n abstract getGraphs(): Promise<GraphResult>;\n\n abstract getGraph(graph: StaticGraphMeta): Promise<StaticGraph | null>;\n\n abstract getGraphByIdOnly(graphId: string): Promise<StaticGraph | null>;\n\n abstract getResources(\n graphId: string,\n limit: number,\n ): Promise<StaticResource[]>;\n\n abstract getResource(resourceId: string): Promise<StaticResource>;\n\n abstract getCollection(collectionId: string): Promise<StaticCollection>;\n}\n\nclass ArchesClientRemote extends ArchesClient {\n archesUrl: string;\n\n constructor(archesUrl: string) {\n super();\n this.archesUrl = archesUrl;\n }\n\n async getGraphs(): Promise<GraphResult> {\n const response = await fetch(\n `${this.archesUrl}/api/arches/graphs?format=arches-json&hide_empty_nodes=false&compact=false`,\n );\n return await response.json();\n }\n\n async getGraph(graph: StaticGraphMeta): Promise<StaticGraph> {\n return this.getGraphByIdOnly(graph.graphid);\n }\n\n async getGraphByIdOnly(graphId: string): Promise<StaticGraph> {\n const response = await fetch(\n `${this.archesUrl}/graphs/${graphId}?format=arches-json&gen=`,\n );\n return await response.json();\n }\n\n async getResource(resourceId: string): Promise<StaticResource> {\n throw Error(`Not implemented yet: getResource(${resourceId}`);\n }\n\n async getCollection(collectionId: string): Promise<StaticCollection> {\n throw Error(`Not implemented yet: getCollection(${collectionId}`);\n }\n\n async getResources(\n graphId: string,\n limit: number,\n ): Promise<StaticResource[]> {\n const response = await fetch(\n `${this.archesUrl}/resources?graph_uuid=${graphId}&format=arches-json&hide_empty_nodes=false&compact=false&limit=${limit}`,\n );\n return await response.json();\n }\n}\n\nclass ArchesClientRemoteStatic extends ArchesClient {\n archesUrl: string;\n allGraphFile: () => string;\n graphToGraphFile?: (graph: StaticGraphMeta) => string;\n graphIdToGraphFile: (graphId: string) => string;\n graphIdToResourcesFiles: (graphId: string) => string[];\n resourceIdToFile: (resourceId: string) => string;\n collectionIdToFile: (collectionId: string) => string;\n\n constructor(\n archesUrl: string,\n {\n allGraphFile,\n graphToGraphFile,\n graphIdToResourcesFiles,\n resourceIdToFile,\n collectionIdToFile,\n graphIdToGraphFile,\n }: {\n allGraphFile?: () => string,\n graphToGraphFile?: (graph: StaticGraphMeta) => string,\n graphIdToGraphFile?: (graphId: string) => string;\n graphIdToResourcesFiles?: (graphId: string) => string[];\n resourceIdToFile?: (resourceId: string) => string;\n collectionIdToFile?: (collectionId: string) => string;\n } = {},\n ) {\n super();\n this.archesUrl = archesUrl;\n this.allGraphFile = allGraphFile || (() => \"resource_models/_all.json\");\n this.graphToGraphFile = graphToGraphFile;\n this.graphIdToGraphFile =\n graphIdToGraphFile ||\n ((graphId: string) => `resource_models/${graphId}.json`);\n this.graphIdToResourcesFiles =\n graphIdToResourcesFiles ||\n ((graphId: string) => [`business_data/_${graphId}.json`]);\n this.resourceIdToFile =\n resourceIdToFile ||\n ((resourceId: string) => `business_data/${resourceId}.json`);\n this.collectionIdToFile =\n collectionIdToFile ||\n ((collectionId: string) => `collections/${collectionId}.json`);\n }\n\n async getGraphs(): Promise<GraphResult> {\n const response = await fetch(`${this.archesUrl}/${this.allGraphFile()}`);\n return await response.json();\n }\n\n async getGraph(graph: StaticGraphMeta): Promise<StaticGraph | null> {\n if (!this.graphToGraphFile) {\n return this.getGraphByIdOnly(graph.graphid);\n }\n const response = await fetch(\n `${this.archesUrl}/${this.graphToGraphFile(graph)}`,\n );\n return (await response.json()).graph[0];\n }\n\n async getGraphByIdOnly(graphId: string): Promise<StaticGraph | null> {\n const response = await fetch(\n `${this.archesUrl}/${this.graphIdToGraphFile(graphId)}`,\n );\n return (await response.json()).graph[0];\n }\n\n async getResource(resourceId: string): Promise<StaticResource> {\n const source = `${this.archesUrl}/${this.resourceIdToFile(resourceId)}`;\n const response = await fetch(source);\n return response.json().then((response: StaticResource) => {\n response.__source = source;\n return response;\n });\n }\n\n async getCollection(collectionId: string): Promise<StaticCollection> {\n const response = await fetch(\n `${this.archesUrl}/${this.collectionIdToFile(collectionId)}`,\n );\n return await response.json();\n }\n\n async getResources(\n graphId: string,\n limit: number,\n ): Promise<StaticResource[]> {\n const resources = [];\n for (const file of this.graphIdToResourcesFiles(graphId)) {\n const source = `${this.archesUrl}/${file}`;\n const response = await fetch(source);\n const resourceSet: StaticResource[] = (await response.json()).business_data.resources;\n for (const resource of resourceSet) {\n resource.__source = source;\n }\n resources.push(...(limit ? resourceSet.slice(0, limit) : resourceSet));\n if (limit && resources.length > limit) {\n break;\n }\n }\n return resources;\n }\n}\n\nclass ArchesClientLocal extends ArchesClient {\n fs: any;\n allGraphFile: () => string;\n graphToGraphFile?: (graph: StaticGraphMeta) => string;\n graphIdToGraphFile: (graphId: string) => string;\n graphIdToResourcesFiles: (graphId: string) => string[];\n resourceIdToFile: (resourceId: string) => string;\n collectionIdToFile: (collectionId: string) => string;\n\n constructor({\n allGraphFile,\n graphToGraphFile,\n graphIdToResourcesFiles,\n resourceIdToFile,\n collectionIdToFile,\n graphIdToGraphFile,\n }: {\n allGraphFile?: () => string,\n graphToGraphFile?: (graph: StaticGraphMeta) => string,\n graphIdToGraphFile?: (graphId: string) => string;\n graphIdToResourcesFiles?: (graphId: string) => string[];\n resourceIdToFile?: (resourceId: string) => string;\n collectionIdToFile?: (collectionId: string) => string;\n } = {}) {\n super();\n this.fs = import(\"fs\");\n this.allGraphFile = allGraphFile || (() => \"tests/definitions/models/_all.json\");\n this.graphToGraphFile =\n graphToGraphFile ||\n ((graph: StaticGraphMeta) => `tests/definitions/models/${graph.graphid}.json`);\n this.graphIdToGraphFile =\n graphIdToGraphFile ||\n ((graphId: string) => `tests/definitions/models/${graphId}.json`);\n this.graphIdToResourcesFiles =\n graphIdToResourcesFiles ||\n ((graphId: string) => [`tests/definitions/resources/_${graphId}.json`]);\n this.resourceIdToFile =\n resourceIdToFile ||\n ((resourceId: string) => `tests/definitions/resources/${resourceId}.json`);\n this.collectionIdToFile =\n collectionIdToFile ||\n ((collectionId: string) => `tests/definitions/collections/${collectionId}.json`);\n }\n\n async getGraphs(): Promise<GraphResult> {\n const fs = await this.fs;\n const response = await fs.promises.readFile(this.allGraphFile(), \"utf8\");\n return new GraphResult(await JSON.parse(response));\n }\n\n async getGraph(graph: StaticGraphMeta): Promise<StaticGraph | null> {\n const fs = await this.fs;\n const graphFile = this.graphToGraphFile ? this.graphToGraphFile(graph) : this.graphIdToGraphFile(graph.graphid);\n if (!graphFile) {\n return null;\n }\n const response = await fs.promises.readFile(\n graphFile,\n \"utf8\",\n );\n return await JSON.parse(response).graph[0];\n }\n\n async getGraphByIdOnly(graphId: string): Promise<StaticGraph | null> {\n const fs = await this.fs;\n const graphFile = this.graphIdToGraphFile(graphId);\n if (!graphFile) {\n return null;\n }\n const response = await fs.promises.readFile(\n graphFile,\n \"utf8\",\n );\n return await JSON.parse(response).graph[0];\n }\n\n async getResource(resourceId: string): Promise<StaticResource> {\n const fs = await this.fs;\n const source = this.resourceIdToFile(resourceId);\n const response = await fs.promises.readFile(\n source,\n \"utf8\",\n );\n return JSON.parse(response).then((resource: StaticResource) => {\n resource.__source = source;\n return resource;\n });\n }\n\n async getCollection(collectionId: string): Promise<StaticCollection> {\n const fs = await this.fs;\n const response = await fs.promises.readFile(\n this.collectionIdToFile(collectionId),\n \"utf8\",\n );\n return await JSON.parse(response);\n }\n\n async getResources(\n graphId: string,\n limit: number | null,\n ): Promise<StaticResource[]> {\n const fs = await this.fs;\n const resources = [];\n for (const file of this.graphIdToResourcesFiles(graphId)) {\n const response = JSON.parse(await fs.promises.readFile(file, \"utf8\"));\n const source = file;\n // const read = fs.createReadStream(file, { encoding: \"utf8\" });\n // let buffer = '';\n // let bufferLength = 0;\n // const response: IStringKeyedObject = await (new Promise(resolve => {\n // read.pipe(bfj.unpipe((error: string, data: string) => {\n // if (error) {\n // throw Error(error);\n // }\n // return data;\n // })).on('data', (data: string) => {\n // const bl = Math.floor(buffer.length / 1000);\n // bufferLength = bl;\n // buffer += data;\n // }).on('end', () => {\n // resolve(JSON.parse(buffer));\n // });\n // }));\n\n const resourceSet: StaticResource[] = response.business_data.resources.filter(\n (resource: StaticResource) => graphId === resource.resourceinstance.graph_id\n );\n for (const resource of resourceSet) {\n resource.__source = source;\n }\n resources.push(...(limit ? resourceSet.slice(0, limit) : resourceSet));\n if (limit && resources.length > limit) {\n break;\n }\n }\n return resources;\n }\n}\n\nconst archesClient = new ArchesClientRemote(\"http://localhost:8000\");\n\nexport {\n archesClient,\n ArchesClient,\n ArchesClientRemoteStatic,\n ArchesClientRemote,\n ArchesClientLocal,\n GraphResult,\n};\n","import { StaticCollection } from \"./static-types\";\nimport { ArchesClient, archesClient } from \"./client\";\n\nclass ReferenceDataManager {\n archesClient: ArchesClient;\n collections: Map<string, Promise<StaticCollection>>;\n\n constructor(archesClient: ArchesClient) {\n this.archesClient = archesClient;\n this.collections = new Map<string, Promise<StaticCollection>>();\n }\n\n retrieveCollection(id: string): Promise<StaticCollection> {\n let collection = this.collections.get(id);\n if (collection !== undefined) {\n return collection;\n }\n collection = this.archesClient\n .getCollection(id)\n .then((jsonData) => new StaticCollection(jsonData));\n this.collections.set(id, collection);\n return collection;\n }\n}\n\nconst RDM = new ReferenceDataManager(archesClient);\n\nexport { StaticCollection, ReferenceDataManager, RDM };\n","import { archesClient, ArchesClient } from \"./client.ts\";\nimport {\n StaticResource,\n StaticResourceMetadata,\n} from \"./static-types\";\n\n// TODO: this does not currently cache, to avoid\n// memory leaks.\nclass StaticStore {\n archesClient: ArchesClient;\n cache: Map<string, StaticResource | StaticResourceMetadata>;\n cacheMetadataOnly: boolean;\n\n constructor(archesClient: ArchesClient, cacheMetadataOnly: boolean = true) {\n this.archesClient = archesClient;\n this.cache = new Map();\n this.cacheMetadataOnly = cacheMetadataOnly;\n }\n\n async getMeta(id: string, onlyIfCached: boolean = true): Promise<StaticResourceMetadata | null> {\n if (this.cache.has(id)) {\n const resource = this.cache.get(id);\n if (resource instanceof StaticResource) {\n return resource.resourceinstance;\n }\n return resource || null;\n }\n\n if (!onlyIfCached) {\n const resource = await this.loadOne(id);\n return resource.resourceinstance;\n }\n return null;\n }\n\n async* loadAll(\n graphId: string,\n limit: number | undefined = undefined,\n ): AsyncIterable<StaticResource> {\n const resourcesJSON: StaticResource[] =\n await this.archesClient.getResources(graphId, limit || 0);\n for (const resourceJSON of resourcesJSON.values()) {\n const resource = new StaticResource(resourceJSON);\n if (resource.resourceinstance.graph_id !== graphId) {\n continue;\n }\n this.cache.set(\n resource.resourceinstance.resourceinstanceid,\n this.cacheMetadataOnly ? resource.resourceinstance : resource\n );\n yield resource;\n }\n }\n\n async loadOne(id: string): Promise<StaticResource> {\n if (this.cache.has(id)) {\n const resource = this.cache.get(id);\n if (resource instanceof StaticResource) {\n return resource;\n }\n }\n\n const resourceJSON: StaticResource =\n await this.archesClient.getResource(id);\n const resource = new StaticResource(resourceJSON);\n if (this.cacheMetadataOnly) {\n this.cache.set(id, this.cacheMetadataOnly ? resource.resourceinstance : resource);\n }\n return resource;\n }\n}\n\nconst staticStore = new StaticStore(archesClient);\n\nexport { staticStore };\n","// The Widgets here are AGPLv3 from Arches DB setup.\n//\nimport {\n StaticNode\n} from \"./static-types\";\n\nclass CardComponent {\n id: string;\n name: string;\n\n constructor(id: string, name: string) {\n this.id = id;\n this.name = name;\n }\n};\n\nclass Widget {\n id: string;\n name: string;\n datatype: string;\n defaultConfig: string; // as JSON - always need a fresh copy\n\n constructor(id: string, name: string, datatype: string, defaultConfig: string) {\n this.id = id;\n this.name = name;\n this.datatype = datatype;\n this.defaultConfig = defaultConfig;\n }\n\n getDefaultConfig(): {[key: string]: any} {\n return JSON.parse(this.defaultConfig);\n }\n};\nconst DEFAULT_CARD_COMPONENT = new CardComponent(\n 'f05e4d3a-53c1-11e8-b0ea-784f435179ea',\n 'Default Card'\n);\nconst _WIDGET_VALUES: [string, string, string, string][] = [\n ['10000000-0000-0000-0000-000000000001', 'text-widget', 'string', '{ \"placeholder\": \"Enter text\", \"width\": \"100%\", \"maxLength\": null}'],\n ['10000000-0000-0000-0000-000000000002', 'concept-select-widget', 'concept', '{ \"placeholder\": \"Select an option\", \"options\": [] }'],\n ['10000000-0000-0000-0000-000000000012', 'concept-multiselect-widget', 'concept-list', '{ \"placeholder\": \"Select an option\", \"options\": [] }'],\n ['10000000-0000-0000-0000-000000000015', 'domain-select-widget', 'domain-value', '{ \"placeholder\": \"Select an option\" }'],\n ['10000000-0000-0000-0000-000000000016', 'domain-multiselect-widget', 'domain-value-list', '{ \"placeholder\": \"Select an option\" }'],\n ['10000000-0000-0000-0000-000000000003', 'switch-widget', 'boolean', '{ \"subtitle\": \"Click to switch\"}'],\n ['10000000-0000-0000-0000-000000000004', 'datepicker-widget', 'date', `{\n \"placeholder\": \"Enter date\",\n \"viewMode\": \"days\",\n \"dateFormat\": \"YYYY-MM-DD\",\n \"minDate\": false,\n \"maxDate\": false\n }`],\n ['10000000-0000-0000-0000-000000000005', 'rich-text-widget', 'string', '{}'],\n ['10000000-0000-0000-0000-000000000006', 'radio-boolean-widget', 'boolean', '{\"trueLabel\": \"Yes\", \"falseLabel\": \"No\"}'],\n ['10000000-0000-0000-0000-000000000007', 'map-widget', 'geojson-feature-collection', `{\n \"basemap\": \"streets\",\n \"geometryTypes\": [{\"text\":\"Point\", \"id\":\"Point\"}, {\"text\":\"Line\", \"id\":\"Line\"}, {\"text\":\"Polygon\", \"id\":\"Polygon\"}],\n \"overlayConfigs\": [],\n \"overlayOpacity\": 0.0,\n \"geocodeProvider\": \"MapzenGeocoder\",\n \"zoom\": 0,\n \"maxZoom\": 20,\n \"minZoom\": 0,\n \"centerX\": 0,\n \"centerY\": 0,\n \"pitch\": 0.0,\n \"bearing\": 0.0,\n \"geocodePlaceholder\": \"Search\",\n \"geocoderVisible\": true,\n \"featureColor\": null,\n \"featureLineWidth\": null,\n \"featurePointSize\": null\n }`],\n ['10000000-0000-0000-0000-000000000008', 'number-widget', 'number', '{ \"placeholder\": \"Enter number\", \"width\": \"100%\", \"min\":\"\", \"max\":\"\"}'],\n ['10000000-0000-0000-0000-000000000009', 'concept-radio-widget', 'concept', '{ \"options\": [] }'],\n ['10000000-0000-0000-0000-000000000013', 'concept-checkbox-widget', 'concept-list', '{ \"options\": [] }'],\n ['10000000-0000-0000-0000-000000000017', 'domain-radio-widget', 'domain-value', '{}'],\n ['10000000-0000-0000-0000-000000000018', 'domain-checkbox-widget', 'domain-value-list', '{}'],\n ['10000000-0000-0000-0000-000000000019', 'file-widget', 'file-list', '{\"acceptedFiles\": \"\", \"maxFilesize\": \"200\"}'],\n];\nconst WIDGETS: {[key: string]: Widget} = Object.fromEntries(_WIDGET_VALUES.map((constructor: [string, string, string, string]): [string, Widget] => [constructor[1], new Widget(...constructor)]));\n\nfunction getDefaultWidgetForNode(node: StaticNode, preferences: {[key: string]: string} = {}) {\n const datatype = node.datatype;\n\n // For example, you can use this to prefer a rich-text field.\n if (datatype in preferences) {\n return WIDGETS[preferences[datatype]];\n }\n\n if (datatype === 'semantic') {\n throw Error(\"Not default widget for a semantic node\");\n } else if (datatype === 'number') {\n return WIDGETS['number-widget'];\n } else if (datatype === 'string') {\n return WIDGETS['text-widget'];\n } else if (datatype === 'concept') {\n return WIDGETS['concept-select-widget'];\n } else if (datatype === 'concept-list') {\n return WIDGETS['concept-multiselect-widget'];\n } else if (datatype === 'domain-value') {\n return WIDGETS['domain-select-widget'];\n } else if (datatype === 'domain-value-list') {\n return WIDGETS['domain-multiselect-widget'];\n } else if (datatype === 'geojson-feature-collection') {\n return WIDGETS['geojson-feature-collection'];\n } else if (datatype === 'boolean') {\n return WIDGETS['switch-widget'];\n } else if (datatype === 'date') {\n return WIDGETS['datepicker-widget'];\n } else {\n throw Error(`No default widget for ${datatype} datatype - perhaps you could supply a manual preference`);\n }\n}\n\nexport { DEFAULT_CARD_COMPONENT, CardComponent, getDefaultWidgetForNode, Widget };\n","import { INodeConfig } from './interfaces';\nimport { StaticNode, StaticDomainValue } from './static-types';\n\ninterface IStaticNodeConfigDomain {\n i18n_config: {[key: string]: string}\n options: StaticDomainValue[];\n};\n\ninterface IStaticNodeConfigBoolean {\n i18n_properties: string[]\n falseLabel: {[key: string]: string}\n trueLabel: {[key: string]: string}\n};\n\ninterface IStaticNodeConfigConcept {\n rdmCollection: string\n};\n\nclass StaticNodeConfigBoolean implements IStaticNodeConfigBoolean, INodeConfig {\n i18n_properties: string[]\n falseLabel: {[key: string]: string}\n trueLabel: {[key: string]: string}\n\n constructor(jsonData: IStaticNodeConfigBoolean) {\n this.i18n_properties = jsonData.i18n_properties;\n this.falseLabel = jsonData.falseLabel;\n this.trueLabel = jsonData.trueLabel;\n }\n}\n\nclass StaticNodeConfigConcept implements IStaticNodeConfigConcept, INodeConfig {\n rdmCollection: string;\n\n constructor(jsonData: IStaticNodeConfigConcept) {\n this.rdmCollection = jsonData.rdmCollection;\n }\n}\n\nclass StaticNodeConfigDomain implements IStaticNodeConfigDomain, INodeConfig {\n i18n_config: {[key: string]: string}\n options: StaticDomainValue[];\n\n getSelected() {\n return this.options.find(option => option.selected);\n }\n\n valueFromId(id: string) {\n return this.options.find(option => option.id == id);\n }\n\n constructor(jsonData: IStaticNodeConfigDomain) {\n this.i18n_config = jsonData.i18n_config;\n this.options = jsonData.options;\n if (this.options) {\n this.options = this.options.map(sdv => {\n if (!(sdv instanceof StaticDomainValue)) {\n return new StaticDomainValue(sdv);\n }\n return sdv;\n });\n }\n }\n}\n\nclass NodeConfigManager {\n static _cache: Map<string, INodeConfig | null>\n cache: Map<string, INodeConfig | null>\n\n constructor(cache: Map<string, INodeConfig | null> | undefined = undefined) {\n if (!cache) {\n cache = NodeConfigManager._cache || new Map();\n }\n this.cache = cache;\n }\n\n retrieve(node: StaticNode) {\n if (this.cache.has(node.nodeid)) {\n return this.cache.get(node.nodeid);\n }\n let nodeConfig = null;\n switch (node.datatype) {\n case \"boolean\":\n // @ts-expect-error node.config is not typed\n nodeConfig = new StaticNodeConfigBoolean(node.config);\n break;\n case \"domain-value-list\":\n case \"domain-value\":\n // @ts-expect-error node.config is not typed\n nodeConfig = new StaticNodeConfigDomain(node.config);\n break;\n default:\n };\n this.cache.set(node.nodeid, nodeConfig);\n return nodeConfig;\n }\n};\n\nconst nodeConfigManager = new NodeConfigManager();\n\nexport { nodeConfigManager, StaticNodeConfigDomain, StaticNodeConfigBoolean, StaticNodeConfigConcept };\n","import {\n IStringKeyedObject,\n IInstanceWrapper,\n IModelWrapper,\n IViewModel,\n IPseudo,\n IGraphManager,\n IRIVM,\n GetMeta,\n} from \"./interfaces.ts\";\nimport { PseudoValue, PseudoList } from \"./pseudos\";\nimport { RDM } from \"./rdm\";\nimport {\n StaticNodeConfigDomain,\n StaticNodeConfigBoolean,\n} from './nodeConfig';\nimport {\n StaticDomainValue,\n StaticTile,\n StaticNode,\n StaticValue,\n StaticConcept,\n StaticResource,\n StaticResourceReference\n} from \"./static-types\";\nimport { AttrPromise } from \"./utils\";\nimport { nodeConfigManager } from './nodeConfig';\n\nconst TILE_LOADING_ERRORS = null; // \"suppress\" or \"silence\" TODO: enum\n\nconst DEFAULT_LANGUAGE = \"en\";\n\nclass ViewContext {\n graphManager: IGraphManager | undefined\n};\nconst viewContext = new ViewContext();\n\nfunction tileLoadingError(reason: string, exc: any) {\n if (TILE_LOADING_ERRORS !== \"silence\") {\n console.error(reason, exc);\n if (TILE_LOADING_ERRORS !== \"suppress\") {\n throw exc;\n }\n }\n}\n\nclass ValueList<T extends IRIVM<T>> {\n values: Map<string, any>;\n wrapper: IInstanceWrapper<T>;\n tiles: StaticTile[] | null;\n promises: Map<string, boolean | Promise<boolean | IViewModel>>;\n writeLock: null | Promise<boolean | IViewModel>;\n\n constructor(\n values: Map<string, any>,\n allNodegroups: Map<string, boolean>,\n wrapper: IInstanceWrapper<T>,\n tiles: StaticTile[] | null,\n ) {\n this.values = values;\n this.wrapper = wrapper;\n this.tiles = tiles;\n this.promises = allNodegroups;\n this.writeLock = null;\n }\n\n async get(key: string) {\n return this.retrieve(key, this.values.get(key), true);\n }\n\n set(key: string, value: any) {\n this.values.set(key, value);\n }\n\n async has(key: string) {\n await this.retrieve(key, null);\n return this.values.has(key);\n }\n\n async retrieve(key: string, dflt: any = null, raiseError: boolean = false) {\n let result: any = this.values.get(key);\n if (Array.isArray(result)) {\n return result;\n }\n const node = this.wrapper.model.getNodeObjectsByAlias().get(key);\n\n result = await result;\n\n if (!node) {\n throw Error(`This key ${key} has no corresponding node`);\n }\n const nodegroupId = node.nodegroup_id || '';\n const promise = node ? await this.promises.get(nodegroupId) : false;\n // When an unloaded node is found, the whole nodegroup is loaded.\n // The promises member ensures that no other node in the nodegroup\n // triggers the same nodegroup load. Note that there is _also_ the\n // individual node promise, which allows any operation to wait for\n // just that node to finish and resolve in to the approach pseudo\n // even if `retrieve` is not used (e.g. allEntries).\n // _However_, this means that allEntries will not see a promise for\n // individual nodes in the nodegroup that are _not_ the first\n // requested, until the first requested resolves and updates the\n // values map for all nodes in the nodegroup.\n if (promise === false) {\n // FIXME: the evidence is that this is not successfully functioning as\n // a resource-wide lock...\n await this.writeLock;\n if (this.wrapper.resource) {\n // Will KeyError if we do not have it.\n const node = this.wrapper.model.getNodeObjectsByAlias().get(key);\n if (node === undefined) {\n throw Error(\n \"Tried to retrieve a node key that does not exist on this resource\",\n );\n }\n const values = new Map([...this.values.entries()]);\n const promise: Promise<IViewModel | boolean> = new Promise((resolve) => {\n return this.wrapper\n .ensureNodegroup(\n values,\n this.promises,\n nodegroupId,\n this.wrapper.model.getNodeObjects(),\n this.wrapper.model.getNodegroupObjects(),\n this.wrapper.model.getEdges(),\n false,\n this.tiles,\n true\n ).then(async ([ngValues]) => {\n let original = false;\n const processValue = (k: string, concreteValue: any) => {\n if (key === k) {\n // Other methods may be waiting on this specific\n // value to resolve.\n original = concreteValue;\n }\n // In theory, this should never happen when this.values[k] is\n // not false, as the resource-wide write lock means that no other nodegroup\n // can write. This _is_ happening however. In theory, once set, the\n // value will be a list, so passed by reference, and so should not\n // undo and changes that happened concurrently.\n if (concreteValue !== false) {\n this.values.set(k, concreteValue);\n }\n }\n return Promise.all([...ngValues.entries()].map(([k, value]) => {\n if (value instanceof Promise) {\n return value.then((concreteValue: any) => processValue(k, concreteValue));\n }\n processValue(k, value);\n })).then(() => {\n resolve(original);\n });\n });\n });\n // No writes should happen until this is done\n this.writeLock = promise;\n // No reads from this nodegroup should happen [legacy comment]\n this.promises.set(nodegroupId, promise);\n // Other readers are welcome to wait for this nodegroup's read\n this.values.set(key, promise);\n await promise;\n this.promises.set(nodegroupId, true);\n } else {\n this.values.delete(key);\n }\n result = await this.values.get(key);\n }\n result = await result;\n if (result === undefined || result === false) {\n if (raiseError) {\n throw Error(`Unset key ${key}`);\n } else {\n return dflt;\n }\n }\n return result;\n }\n\n async setDefault(key: string, value: any) {\n const newValue = await this.retrieve(key, value, false);\n this.values.set(key, newValue);\n return newValue;\n }\n}\n\nclass ConceptListCacheEntry implements IStringKeyedObject {\n [key: string]: any;\n datatype: string = 'concept-list';\n _: ConceptValueCacheEntry[];\n meta: {[key: string]: any};\n\n constructor({meta, _}: {meta: IStringKeyedObject | undefined, _: ConceptValueCacheEntry[]}) {\n this._ = _.map(instance => {\n if (instance instanceof ConceptValueCacheEntry) {\n return instance;\n } else if (instance) {\n return new ConceptValueCacheEntry(instance);\n }\n return null;\n }).filter(cvce => cvce !== null);\n this.meta = meta || {};\n }\n}\n\nclass ConceptValueCacheEntry implements IStringKeyedObject {\n [key: string]: any\n datatype: string = 'concept';\n id: string;\n value: string;\n conceptId: string | null;\n meta: {[key: string]: any};\n\n constructor({meta, id, value, conceptId}: {meta: IStringKeyedObject | undefined, id: string, value: string, conceptId: string | null}) {\n this.id = id;\n this.value = value;\n this.conceptId = conceptId;\n this.meta = meta || {};\n }\n}\n\nclass ResourceInstanceListCacheEntry implements IStringKeyedObject {\n [key: string]: any;\n datatype: string = 'resource-instance-list';\n _: ResourceInstanceCacheEntry[];\n meta: {[key: string]: any};\n\n constructor({meta, _}: {meta: IStringKeyedObject | undefined, _: ResourceInstanceCacheEntry[]}) {\n this._ = _.map(instance => {\n if (instance instanceof ResourceInstanceCacheEntry) {\n return instance;\n }\n return new ResourceInstanceCacheEntry(instance);\n });\n this.meta = meta || {};\n }\n}\n\nclass ResourceInstanceCacheEntry implements IStringKeyedObject {\n [key: string]: any\n datatype: string = 'resource-instance';\n id: string;\n type: string;\n graphId: string;\n title: string | null;\n meta: {[key: string]: any};\n\n constructor({meta, id, type, graphId, title}: {meta: IStringKeyedObject | undefined, id: string, type: string, graphId: string, title: string | null}) {\n this.id = id;\n this.type = type;\n this.graphId = graphId;\n this.meta = meta || {};\n this.title = this.meta.title || title;\n }\n}\n\nclass ResourceInstanceListViewModel extends Array implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: IPseudo | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n _value: Promise<(ResourceInstanceViewModel<any> | null)[]> | null = null;\n\n async forJson() {\n const value = await this._value;\n return value ? value.map((v) => (v ? v.forJson() : null)) : null;\n }\n\n async __forJsonCache(getMeta: GetMeta): Promise<ResourceInstanceListCacheEntry> {\n return new ResourceInstanceListCacheEntry({\n meta: getMeta ? await getMeta(this) : getMeta,\n _: await Promise.all([...this.values()].map(async (rivmPromise: Promise<ResourceInstanceViewModel<any>>) => {\n const rivm = await rivmPromise;\n return await rivm.__forJsonCache(getMeta)\n }))\n });\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n cacheEntry: ResourceInstanceListCacheEntry | null = null\n ): Promise<ResourceInstanceListViewModel | null> {\n const nodeid = node.nodeid;\n let val: (ResourceInstanceViewModel<any> | null | Promise<ResourceInstanceViewModel<any> | null>)[];\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n tile.data.set(nodeid, []);\n if (!Array.isArray(value)) {\n throw Error(\n `Cannot set an (entire) resource list value on node ${nodeid} except via an array: ${JSON.stringify(value)}`,\n );\n }\n val = value.map((v, i) => {\n if (v instanceof ResourceInstanceViewModel) {\n return v;\n }\n return ResourceInstanceViewModel.__create(tile, node, v, cacheEntry && cacheEntry._[i] ? cacheEntry._[i] : null);\n });\n Promise.all(\n val.map(async (c) => {\n const v = await c;\n return v ? (await v).id : null;\n }),\n ).then((ids) => {\n tile.data.set(nodeid, ids.map(id => {\n return {\n resourceId: id\n };\n }));\n return ids;\n });\n value = val;\n }\n } else {\n value = [];\n }\n\n if (!tile || !value) {\n return null;\n }\n const str = new ResourceInstanceListViewModel(...value);\n return str;\n }\n\n async __asTileData() {\n return this._value ? await this._value : null;\n }\n}\n\nclass ResourceInstanceViewModel<RIVM extends IRIVM<RIVM>> implements IStringKeyedObject {\n [key: string | symbol]: any;\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n $: IInstanceWrapper<RIVM> | null;\n __: IModelWrapper<RIVM> | null;\n __parentPseudo: IPseudo | undefined = undefined;\n __cacheEntry: ResourceInstanceCacheEntry | null = null;\n id: string;\n then: undefined;\n [Symbol.toPrimitive]: undefined;\n\n gm: IGraphManager | undefined;\n\n toString(): string {\n if (!this.__) {\n return `[Resource:${this.id}]`;\n }\n return `[${this.__.wkrm.modelClassName}:${this.id ?? \"-\"}]`;\n }\n\n async __has(key: string): Promise<boolean | undefined> {\n // There is a catch here, that because we lazy-load, we do not\n // know, hence three possible return values.\n if (!this.$) {\n return undefined;\n }\n return (await this.$.getRootViewModel() || new Map()).__has(key);\n }\n\n async __asTileData(): Promise<IStringKeyedObject> {\n return {\n resourceId: this.id\n };\n }\n\n async __forJsonCache(getMeta: GetMeta): Promise<ResourceInstanceCacheEntry> {\n // TODO should we re-use the cacheEntry and rely on it being expired correctly?\n let wrapper: IModelWrapper<RIVM>;\n if (!this.__) {\n if (this.__cacheEntry) {\n return this.__cacheEntry;\n } else {\n [, wrapper] = await this.retrieve();\n }\n } else {\n wrapper = this.__;\n }\n this.__cacheEntry = new ResourceInstanceCacheEntry({\n meta: getMeta ? await getMeta(this) : undefined,\n id: this.id,\n type: wrapper.wkrm.modelClassName,\n graphId: wrapper.wkrm.graphId,\n title: null,\n });\n return this.__cacheEntry;\n }\n\n async forJson(cascade: boolean=false) {\n let jsonData: StaticResourceReference;\n if (!cascade && this.__cacheEntry) {\n jsonData = {\n type: this.__cacheEntry.type,\n graphId: this.__cacheEntry.graphId,\n id: this.__cacheEntry.id,\n title: this.__cacheEntry.title || undefined,\n meta: this.__cacheEntry.meta || undefined,\n root: null\n };\n } else if (this.__) {\n jsonData = {\n type: this.__.wkrm.modelClassName,\n graphId: this.__.wkrm.graphId,\n id: this.id,\n title: undefined,\n meta: undefined,\n root: null\n };\n } else {\n jsonData = {\n type: \"(unknown)\",\n graphId: \"\",\n id: this.id,\n title: undefined,\n meta: undefined,\n root: null\n };\n }\n const basic = new StaticResourceReference(jsonData);\n if (cascade) {\n if (!this.$) {\n await this.retrieve();\n if (!this.$) {\n throw Error(\"Could not retrieve resource\");\n }\n }\n const root = await this.$.getRootViewModel();\n basic.root = await root.forJson();\n }\n return basic;\n }\n\n async retrieve(): Promise<[IInstanceWrapper<RIVM>, IModelWrapper<RIVM>]> {\n let iw: IInstanceWrapper<RIVM>;\n let mw: IModelWrapper<RIVM>;\n if (viewContext.graphManager) {\n const replacement = await viewContext.graphManager.getResource(this.id, true);\n\n // @ts-expect-error We cannot guarantee this resource is the right type...\n iw = replacement.$;\n // @ts-expect-error We cannot guarantee this resource is the right type...\n mw = replacement.__;\n } else {\n throw Error(\"Cannot traverse resource relationships without a GraphManager\");\n }\n this.$ = iw;\n this.__ = mw;\n return [iw, mw];\n }\n\n constructor(\n id: string,\n modelWrapper: IModelWrapper<RIVM> | null,\n instanceWrapperFactory: ((\n rivm: RIVM,\n ) => IInstanceWrapper<RIVM>) | null,\n cacheEntry: object | null,\n ) {\n this.id = id;\n // @ts-expect-error I believe some deep type magic would be required to\n // convince TS that `this` is a valid RIVM.\n this.$ = instanceWrapperFactory ? instanceWrapperFactory(this) : null;\n this.__ = modelWrapper;\n if (cacheEntry instanceof ResourceInstanceCacheEntry) {\n this.__cacheEntry = cacheEntry;\n }\n\n return new Proxy(this, {\n // NOTE: set should not return a promise, so could cause a race\n // condition with a subsequent read.\n // @ts-expect-error Returning a promise for set\n set: async (object: ResourceInstanceViewModel<RIVM>, key, value): Promise<boolean> => {\n const k: string = typeof key === 'symbol' ? key.description || '' : key;\n if (key in object) {\n object[key] = value;\n } else if (k in object || k.startsWith('__')) {\n object[k] = value;\n } else {\n if (!object.$) {\n await this.retrieve();\n if (!object.$) {\n throw Error(\"Could not retrieve resource\");\n }\n }\n object.$.setOrmAttribute(k, value);\n }\n return true;\n },\n get: (object: ResourceInstanceViewModel<RIVM>, key) => {\n const k: string = typeof key === 'symbol' ? key.description || '' : key;\n if (key in object) {\n return object[key];\n } else if (k in object || k.startsWith('__')) {\n return object[k];\n }\n return new AttrPromise(async (resolve) => {\n if (!object.$) {\n await this.retrieve();\n if (!object.$) {\n throw Error(\"Could not retrieve resource\");\n }\n }\n return object.$.getOrmAttribute(k).then((v) => {\n return resolve(v);\n });\n });\n },\n });\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n cacheEntry: ResourceInstanceCacheEntry | null\n ): Promise<ResourceInstanceViewModel<any> | null> {\n const nodeid = node.nodeid;\n let val: string | null = value;\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n if (!value && !(value instanceof StaticResource) && !(value instanceof StaticResourceReference)) {\n val = null;\n } else if (value instanceof Promise) {\n return value.then((value) => {\n return ResourceInstanceViewModel.__create(tile, node, value, cacheEntry);\n });\n } else if (typeof value == \"string\") {\n if (\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.exec(\n value,\n )\n ) {\n val = value;\n } else {\n throw Error(\n `Set resource instances using id, not strings in node ${node.alias}: ${value}`,\n );\n }\n } else if (value instanceof Object && value.resourceId) {\n val = value.resourceId;\n } else if (value instanceof Array && value.length < 2 ) {\n if (value.length == 1) {\n return ResourceInstanceViewModel.__create(tile, node, value[0], cacheEntry);\n }\n } else {\n throw Error(\"Could not set resource instance from this data\");\n }\n\n tile.data.set(nodeid, val ? [{resourceId: val}] : null);\n }\n }\n\n if (!tile || !val) {\n return null;\n }\n const str = new ResourceInstanceViewModel(val, null, null, cacheEntry);\n return str;\n }\n}\n\nclass FileListViewModel extends Array implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: IPseudo | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n _value: Promise<(ConceptValueViewModel | null)[]> | null = null;\n\n async forJson() {\n const value = await this._value;\n return value ? value.map((v) => (v ? v.forJson() : null)) : null;\n }\n\n async __forJsonCache(): Promise<null> {\n return null;\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): Promise<FileListViewModel> {\n const nodeid = node.nodeid;\n let val: (ConceptValueViewModel | Promise<ConceptValueViewModel | null> | null)[] = [];\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n tile.data.set(nodeid, []);\n if (!Array.isArray(value)) {\n throw Error(\n `Cannot set an (entire) file list value on node ${nodeid} except via an array: ${JSON.stringify(value)}`,\n );\n }\n val = value.map((c) => {\n return c;\n });\n Promise.all(val).then((vals) => {\n Promise.all(\n vals.map(async (c) => {\n const v = await c;\n return v ? (await v.getValue()).id : null;\n })\n ).then((ids) => {\n tile.data.set(nodeid, ids);\n });\n });\n value = val;\n } else {\n value = [];\n }\n\n const str = new FileListViewModel(...value);\n return str;\n }\n\n async __asTileData() {\n return this._value ? await this._value : null;\n }\n}\n\nclass ConceptListViewModel extends Array implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: IPseudo | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n _value: Promise<(ConceptValueViewModel | null)[]> | null = null;\n\n async forJson() {\n const value = await this._value;\n return value ? value.map((v) => (v ? v.forJson() : null)) : null;\n }\n\n async __forJsonCache(getMeta: GetMeta): Promise<ConceptListCacheEntry> {\n return new ConceptListCacheEntry({\n meta: getMeta ? await getMeta(this) : getMeta,\n _: (await Promise.all([...this.values()].map(async (rivmPromise: Promise<ConceptValueViewModel>) => {\n const rivm = await rivmPromise;\n if (rivm) {\n return await rivm.__forJsonCache(getMeta)\n }\n }))).filter(val => val !== undefined)\n });\n }\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n cacheEntry: ConceptListCacheEntry | null = null\n ): Promise<ConceptListViewModel> {\n const nodeid = node.nodeid;\n let val: (ConceptValueViewModel | Promise<ConceptValueViewModel | null> | null)[] = [];\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n tile.data.set(nodeid, []);\n if (!Array.isArray(value)) {\n throw Error(\n `Cannot set an (entire) concept list value on node ${nodeid} except via an array: ${JSON.stringify(value)}`,\n );\n }\n val = value.map((c, i) => {\n if (c instanceof ConceptValueViewModel) {\n return c;\n }\n return ConceptValueViewModel.__create(tile, node, c, cacheEntry && cacheEntry._[i] ? cacheEntry._[i] : null);\n });\n Promise.all(val).then((vals) => {\n Promise.all(\n vals.map(async (c) => {\n const v = await c;\n return v ? (await v.getValue()).id : null;\n })\n ).then((ids) => {\n tile.data.set(nodeid, ids);\n });\n });\n value = val;\n } else {\n value = [];\n }\n\n const str = new ConceptListViewModel(...value);\n return str;\n }\n\n async __asTileData() {\n return this._value ? await this._value : null;\n }\n}\n\nclass DomainValueListViewModel extends Array implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n _value: Promise<(DomainValueViewModel | null)[]> | null = null;\n\n async forJson() {\n const value = await this._value;\n return value ? value.map((v) => (v ? v.forJson() : null)) : null;\n }\n\n // No point in caching something that is on the graph.\n __forJsonCache(): null {\n return null;\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): Promise<DomainValueListViewModel> {\n const nodeid = node.nodeid;\n let val: (DomainValueViewModel | Promise<DomainValueViewModel | null> | null)[];\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n tile.data.set(nodeid, []);\n if (!Array.isArray(value)) {\n throw Error(\n `Cannot set an (entire) domain list value on node ${nodeid} except via an array: ${JSON.stringify(value)}`,\n );\n }\n val = value.map((c) => {\n if (c instanceof DomainValueViewModel) {\n return c;\n }\n return DomainValueViewModel.__create(tile, node, c);\n });\n Promise.all(val).then(async (vals) => {\n const ids = Promise.all(vals.map(async val => val === null ? val : (await val._value).id));\n ids.then(ids => {\n tile.data.set(nodeid, ids);\n });\n });\n }\n } else {\n value = [];\n }\n\n const str = new DomainValueListViewModel(...value);\n return str;\n }\n\n async __asTileData() {\n const value = await this._value;\n return value ?? null;\n }\n}\n\n\n\nclass DomainValueViewModel extends String implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n _value: StaticDomainValue | Promise<StaticDomainValue>;\n\n constructor(value: StaticDomainValue) {\n super(value.toString());\n this._value = value;\n }\n\n async forJson(): Promise<StaticDomainValue> {\n return this._value;\n }\n\n // No point in caching something that is on the graph.\n __forJsonCache(): null {\n return null;\n }\n\n getValue(): StaticDomainValue | Promise<StaticDomainValue> {\n return this._value;\n }\n\n async lang(lang: string): Promise<string | undefined> {\n return (await this._value).lang(lang);\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): Promise<DomainValueViewModel | null> {\n const nodeid = node.nodeid;\n let val: StaticDomainValue | null = value;\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n if (!value && !(value instanceof StaticDomainValue)) {\n val = null;\n } else if (value instanceof Promise) {\n return value.then((value) => {\n return DomainValueViewModel.__create(tile, node, value);\n });\n } else if (typeof value == \"string\") {\n if (\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i.exec(\n value,\n )\n ) {\n const config = nodeConfigManager.retrieve(node);\n if (!config || !(config instanceof StaticNodeConfigDomain)) {\n throw Error(`Cannot form domain value for ${node.nodeid} without config`);\n }\n val = config.valueFromId(value) || null;\n } else {\n throw Error(\n \"Set domain values using values from domain lists, not strings\",\n );\n }\n } else {\n throw Error(\"Could not set domain value from this data\");\n }\n\n if (!(val instanceof Promise)) {\n tile.data.set(nodeid, val ? val.id : null);\n }\n }\n }\n\n if (!tile || !val) {\n return null;\n }\n const str = new DomainValueViewModel(val);\n return str;\n }\n\n async __asTileData() {\n const value = await this._value;\n return value ? value.id : null;\n }\n}\n\nclass ConceptValueViewModel extends String implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: IPseudo | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n _value: StaticValue | Promise<StaticValue>;\n\n constructor(value: StaticValue) {\n super(value.value);\n this._value = value;\n }\n\n async forJson(): Promise<StaticValue> {\n return this._value;\n }\n\n async __forJsonCache(getMeta: GetMeta): Promise<ConceptValueCacheEntry> {\n const value = await this._value;\n return new ConceptValueCacheEntry({\n meta: getMeta ? await getMeta(this) : undefined,\n id: value.id,\n value: value.value,\n conceptId: value.__conceptId\n });\n }\n\n getValue(): StaticValue | Promise<StaticValue> {\n return this._value;\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n cacheEntry: ConceptValueCacheEntry | null\n ): Promise<ConceptValueViewModel | null> {\n const nodeid = node.nodeid;\n const collectionId = node.config?.rdmCollection;\n if (!collectionId) {\n throw Error(`Node ${node.alias} (${node.nodeid}) missing rdmCollection in config`);\n }\n let val: StaticValue | null = value;\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n if (value instanceof StaticConcept) {\n if (value.getPrefLabel) {\n val = value.getPrefLabel();\n } else {\n throw Error(\"Recognizing value as StaticConcept, but no getPrefLabel member\");\n }\n }\n if (!value) {\n val = null;\n } else if (value instanceof StaticValue) {\n // No change needed.\n } else if (value instanceof Promise) {\n return value.then((value) => {\n return ConceptValueViewModel.__create(tile, node, value, cacheEntry);\n });\n } else if (typeof value == \"string\") {\n if (\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.exec(\n value,\n )\n ) {\n if (cacheEntry) {\n val = new StaticValue({\n id: cacheEntry.id,\n value: cacheEntry.value,\n __concept: null,\n __conceptId: cacheEntry.conceptId,\n }, cacheEntry.conceptId);\n return new ConceptValueViewModel(val);\n } else {\n const collection = RDM.retrieveCollection(collectionId);\n return collection.then((collection) => {\n if (!collection.getConceptValue) {\n throw Error(`Collection ${collection.id} must be a StaticCollection here, not a key/value object`);\n }\n const val = collection.getConceptValue(value);\n\n if (!val) {\n console.error(\"Could not find concept for value\", value, \"for\", node.alias, \"in collection\", collectionId);\n }\n\n tile.data.set(nodeid, val ? val.id : null);\n\n if (!tile || !val) {\n return null;\n }\n const str = new ConceptValueViewModel(val);\n\n return str;\n });\n }\n } else {\n throw Error(\n `Set concepts using values from collections, not strings: ${value}`,\n );\n }\n } else {\n throw Error(\"Could not set concept from this data\");\n }\n\n if (!(val instanceof Promise)) {\n if (!val) {\n console.error(\"Could not find concept for value\", value, \"for\", node.alias, \"in collection\", collectionId);\n }\n\n tile.data.set(nodeid, val ? val.id : null);\n }\n }\n }\n\n if (!tile || !val) {\n return null;\n }\n const str = new ConceptValueViewModel(val);\n return str;\n }\n\n async __asTileData() {\n const value = await this._value;\n return value ? value.id : null;\n }\n}\n\nclass DateViewModel extends Date implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n __original: string;\n then: undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n __forJsonCache(): null {\n return null;\n }\n\n constructor(val: string) {\n super(val);\n this.__original = val;\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): DateViewModel | Promise<DateViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) =>\n DateViewModel.__create(tile, node, value),\n );\n }\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n tile.data.set(nodeid, value);\n }\n }\n\n let val: string | {[key: string]: string} | any = tile.data.get(nodeid);\n // TODO: catch rendering issues - this workaround should be removed\n // as it is overly tolerant of input issues.\n if (typeof val == \"object\" && val['en'] !== undefined) {\n val = val.en;\n }\n if (!tile || val === null || val === undefined || val === '') {\n return null;\n }\n if (typeof val != \"string\") {\n throw Error(\"Date should be a string\");\n }\n const str = new DateViewModel(val);\n return str;\n }\n\n async forJson() {\n try {\n return this.toISOString();\n } catch (e) {\n console.warn(e);\n return this.__original;\n }\n }\n\n __asTileData() {\n return this.toISOString();\n }\n}\n\nclass GeoJSONViewModel implements IViewModel, IStringKeyedObject {\n [key: string | symbol]: any;\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n then: undefined;\n [Symbol.toPrimitive]: undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n _value: { [key: string]: any };\n\n __forJsonCache(): null {\n return null;\n }\n\n constructor(jsonData: { [key: string]: any }) {\n this._value = jsonData;\n return new Proxy(this, {\n get: (object: GeoJSONViewModel, key) => {\n const k: string = typeof key === 'symbol' ? key.description || '' : key;\n if (key in object) {\n return object[key];\n } else if (k in object) {\n return object[k];\n }\n return this._value[k];\n },\n set: (object: GeoJSONViewModel, key, value) => {\n const k: string = typeof key === 'symbol' ? key.description || '' : key;\n if (key in object) {\n object[key] = value;\n } else if (k in object) {\n object[k] = value;\n } else {\n this._value[k] = value;\n }\n return true;\n },\n });\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): GeoJSONViewModel | Promise<GeoJSONViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) =>\n GeoJSONViewModel.__create(tile, node, value),\n );\n }\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, null);\n }\n if (value !== null) {\n tile.data.set(nodeid, value);\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n if (!(val instanceof Object)) {\n throw Error(\"GeoJSON should be a JSON object\");\n }\n const str = new GeoJSONViewModel(val);\n return str;\n }\n\n async forJson() {\n return await this._value;\n }\n\n __asTileData() {\n return this._value;\n }\n}\n\nclass StringTranslatedLanguage {\n value: string = \"\"\n}\n\nclass EDTFViewModel extends String implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n __forJsonCache(): null {\n return null;\n }\n\n forJson(): string {\n return this.toString();\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): EDTFViewModel | Promise<EDTFViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) => EDTFViewModel.__create(tile, node, value));\n }\n if (tile) {\n if (value !== null) {\n tile.data.set(nodeid, value);\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n const string = new EDTFViewModel(val);\n return string;\n }\n\n __asTileData() {\n return `${this}`;\n }\n}\n\nclass NonLocalizedStringViewModel extends String implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n __forJsonCache(): null {\n return null;\n }\n\n forJson(): string {\n return this.toString();\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): NonLocalizedStringViewModel | Promise<NonLocalizedStringViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) => NonLocalizedStringViewModel.__create(tile, node, value));\n }\n if (tile) {\n if (value !== null) {\n tile.data.set(nodeid, value);\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n const string = new NonLocalizedStringViewModel(val);\n return string;\n }\n\n __asTileData() {\n return `${this}`;\n }\n}\n\nclass NumberViewModel extends Number implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n toString(): string {\n return `${this.valueOf()}`;\n }\n\n __forJsonCache(): null {\n return null;\n }\n\n forJson(): number {\n return this.valueOf();\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): NumberViewModel | Promise<NumberViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) => NumberViewModel.__create(tile, node, value));\n }\n if (tile) {\n if (value !== null) {\n tile.data.set(nodeid, value);\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n const num = new NumberViewModel(val);\n return num;\n }\n\n __asTileData() {\n return this.valueOf();\n }\n}\n\n// Note that this is a Boolean _object__, not an actual boolean\nclass BooleanViewModel extends Boolean implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n __config: StaticNodeConfigBoolean;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n constructor(value: boolean, config: StaticNodeConfigBoolean) {\n super(value);\n this.__config = config;\n }\n\n toString(lang?: string | undefined): string {\n const labelLang = lang || DEFAULT_LANGUAGE;\n return this.valueOf() ? (\n this.__config && this.__config.trueLabel ? this.__config.trueLabel[labelLang] || 'true' : 'true'\n ) : (\n this.__config && this.__config.trueLabel ? this.__config.falseLabel[labelLang] || 'false' : 'false'\n );\n }\n\n __forJsonCache(): null {\n return null;\n }\n\n forJson(): boolean {\n return this.valueOf();\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): BooleanViewModel | Promise<BooleanViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) => BooleanViewModel.__create(tile, node, value));\n }\n if (tile) {\n if (value !== null) {\n tile.data.set(nodeid, value);\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n const config = nodeConfigManager.retrieve(node);\n if (!config || !(config instanceof StaticNodeConfigBoolean)) {\n throw Error(`Cannot form boolean value for ${node.nodeid} without config`);\n }\n if (typeof val !== 'boolean' && val !== 0 && val !== 1) {\n throw Error(`Refusing to use truthiness for value ${val} in boolean`);\n }\n const bool = new BooleanViewModel(val ? true : false, config);\n return bool;\n }\n\n __asTileData() {\n return this.valueOf();\n }\n}\n\nclass Url {\n url: string\n url_label?: string\n\n constructor(url: string, url_label?: string) {\n this.url = url;\n this.url_label = url_label;\n }\n}\n\nclass UrlViewModel extends String implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n _value: Url;\n\n __forJsonCache(): null {\n return null;\n }\n\n constructor(value: Url) {\n const displayValue = value.url_label || value.url;\n super(displayValue);\n this._value = value;\n }\n\n forJson(): {[key: string]: string} {\n return {\n url: this._value.url,\n url_label: this._value.url_label || \"\",\n };\n }\n\n label() {\n return this._value.url_label || this._value.url;\n }\n\n href() {\n return this._value.url;\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): UrlViewModel | Promise<UrlViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) => UrlViewModel.__create(tile, node, value));\n }\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, {});\n }\n if (value !== null) {\n if (value instanceof UrlViewModel) {\n value = value._value;\n } else if (value instanceof Object) {\n if (!value.url) {\n throw Error(`A URL must be null or have a 'url' field: ${value}`);\n }\n }\n tile.data.set(nodeid, {\n url: value.url,\n url_label: value.url_label,\n });\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n let url: Url;\n if (typeof val !== 'object') {\n url = new Url(`${val}`);\n } else if (val instanceof Map) {\n url = new Url(val.get('url'), val.get('url_label'));\n } else if ('url' in val && typeof val === 'object' && typeof val.url === 'string' && 'url_label' in val && (val.url_label === undefined || typeof val.url_label === 'string')) {\n url = new Url(val.url, val.url_label);\n } else {\n throw Error(`Unrecognised URL type: ${val}`);\n }\n const str = new UrlViewModel(url);\n return str;\n }\n\n __asTileData() {\n return this.forJson();\n }\n}\n\nclass StringViewModel extends String implements IViewModel {\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n __parentPseudo: PseudoValue<any> | undefined;\n\n describeField = () => (this.__parentPseudo ? this.__parentPseudo.describeField() : null)\n describeFieldGroup = () => (this.__parentPseudo ? this.__parentPseudo.describeFieldGroup() : null)\n\n _value: Map<string, StringTranslatedLanguage>;\n\n __forJsonCache(): null {\n return null;\n }\n\n constructor(value: Map<string, StringTranslatedLanguage>, language: string | null = null) {\n const lang = value.get(language || DEFAULT_LANGUAGE);\n let displayValue: string;\n if (lang) {\n if (typeof lang == \"string\") {\n displayValue = lang;\n } else {\n displayValue = lang.value;\n }\n } else {\n // TODO: allow fallback\n displayValue = \"\";\n }\n super(displayValue);\n this._value = value;\n }\n\n forJson(): string {\n return `${this}`;\n }\n\n lang(language: string) {\n const elt = this._value.get(language);\n if (elt) {\n if (elt instanceof Object) {\n return elt.value;\n }\n return elt;\n } else {\n return undefined;\n }\n }\n\n static __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n ): StringViewModel | Promise<StringViewModel | null> | null {\n const nodeid = node.nodeid;\n if (value instanceof Promise) {\n return value.then((value) => StringViewModel.__create(tile, node, value));\n }\n if (tile) {\n if (!tile.data.has(nodeid)) {\n tile.data.set(nodeid, {});\n }\n if (value !== null) {\n if (value instanceof Object) {\n const entries =\n value instanceof Map ? value.entries() : Object.entries(value);\n for (const [k, v] of [...entries]) {\n const val = tile.data.get(nodeid);\n if (val instanceof Map) {\n val.set(k, v);\n } else if (val instanceof Object) {\n // @ts-expect-error Need better typing of data to make this settable.\n val[k] = v;\n } else if (val !== null) {\n throw Error(\"Malformed string in tile data\");\n }\n }\n } else {\n tile.data.set(nodeid, {\n [DEFAULT_LANGUAGE]: value,\n });\n }\n }\n }\n\n const val = tile.data.get(nodeid);\n if (!tile || val === null || val === undefined) {\n return null;\n }\n let mapVal;\n if (val instanceof Map) {\n mapVal = val;\n } else {\n mapVal = new Map(Object.entries(val));\n }\n const str = new StringViewModel(mapVal);\n return str;\n }\n\n __asTileData() {\n return this._value;\n }\n}\n\nclass SemanticViewModel implements IStringKeyedObject, IViewModel {\n [key: string | symbol]: any;\n _: IViewModel | Promise<IViewModel> | undefined = undefined;\n then: undefined;\n [Symbol.toPrimitive]: undefined;\n\n __parentPseudo: PseudoValue<any> | undefined;\n __childValues: Map<string, any>;\n __parentWkri: IRIVM<any> | null;\n __childNodes: Map<string, StaticNode>;\n __tile: StaticTile | null;\n __node: StaticNode;\n\n __forJsonCache(): null {\n return null;\n }\n\n constructor(\n parentWkri: IRIVM<any> | null,\n childNodes: Map<string, StaticNode>,\n tile: StaticTile | null,\n node: StaticNode,\n ) {\n this.__childValues = new Map<string, any>();\n this.__parentWkri = parentWkri;\n this.__tile = tile;\n this.__node = node;\n this.__childNodes = childNodes;\n return new Proxy(this, {\n set: (object, key, value) => {\n const k: string = typeof key === 'symbol' ? key.description || '' : key;\n if (key in object) {\n object[key] = value;\n } else if (k.startsWith(\"__\") || k in object) {\n object[k] = value;\n } else {\n object.__set(k, value);\n }\n return true;\n },\n get: (object, key) => {\n const k: string = typeof key === 'symbol' ? key.description || '' : key;\n if (key in object) {\n return object[key];\n } else if (k.startsWith(\"__\") || k in object) {\n return object[k];\n }\n if (k == \"length\") {\n return object.__childNodes.size;\n }\n return new AttrPromise((resolve) => {\n object.__get(k).then(resolve);\n });\n },\n });\n }\n\n async toString(): Promise<string> {\n const entries = [...this.__childValues.entries()].map(([k, v]) => `${k}: ${v}`);\n return `[[${entries.join(\",\")}]]`;\n }\n\n async toObject() {\n const entries = [...(await this.__getChildValues()).entries()];\n return Object.fromEntries(await Promise.all(entries.map(async ([k, vl]) => {\n return [k, (await vl).getValue()];\n })));\n }\n\n async forJson() {\n async function _forJson(v: IPseudo | IViewModel | null) {\n v = await v;\n if (!v) {\n return null;\n }\n return await v.forJson();\n };\n const entries = [...(await this.__getChildValues()).entries()];\n return Object.fromEntries(await Promise.all(entries.map(async ([k, vl]) => {\n return [k, vl ? await _forJson(vl) : vl];\n })));\n }\n\n async __update(map: Map<string, any>) {\n return Promise.all(\n [...map.entries()].map(([k, v]) => {\n this.__set(k, v);\n }),\n );\n }\n\n async __get(key: string) {\n const childValue = await this.__getChildValue(key);\n return childValue.getValue();\n }\n\n async __set(key: string, value: any) {\n // async __set(key: string, value: any) {\n if (!this.__childNodes.has(key)) {\n throw Error(\n `Semantic node does not have this key: ${key} (${[...this.__childNodes.keys()]})`,\n );\n }\n\n throw Error(`Setting semantic keys (${key} = ${value}) is not implemented yet in Javascript`);\n // const child = await this.__getChildValue(key, true);\n // child.value = value;\n }\n\n __has(key: string) {\n return this.__childNodes.has(key);\n }\n\n async __getChildTypes() {\n const promises = [...this.__childNodes.keys()].map(async (key): Promise<[string, IPseudo]> => [\n key,\n await this.__getChildValue(key),\n ]);\n const entries: Array<[string, IPseudo]> = await Promise.all(promises);\n return new Map<string, any>([...entries]);\n }\n\n async __getChildren(direct: null | boolean = null) {\n const items = new Map<string, any>();\n for (const [key, value] of [...(await this.__getChildValues()).entries()]) {\n items.set(key, value);\n }\n const children = [...items.entries()]\n .filter((entry) => {\n const child = this.__childNodes.get(entry[0]);\n if (!child) {\n throw Error(\"Child key is not in child nodes\");\n }\n return (\n (direct === null || direct === !child.is_collector) &&\n entry[1] !== null\n );\n })\n .map((entry) => entry[1]);\n return children;\n }\n\n async __getChildValue(key: string, setDefault: boolean = false): Promise<IPseudo> {\n if (!this.__childNodes.has(key)) {\n throw Error(\n `Semantic node does not have this key: ${key} (${[...this.__childNodes.keys()]})`,\n );\n }\n\n let child;\n if (!this.__childValues.has(key)) {\n const children = await this.__getChildValues();\n child = children.get(key) || null;\n\n let set = true;\n if (child === null) {\n child = this.__makePseudo(key);\n set = setDefault;\n }\n if (set) {\n // This ensures that we do not set a default value in our\n // local cache simply because the node is not loaded yet.\n this.__childValues.set(key, child);\n }\n child.parentNode = this.__parentPseudo || null;\n } else {\n child = this.__childValues.get(key);\n }\n return child;\n }\n\n __makePseudo(key: string): IPseudo {\n const childNode = this.__childNodes.get(key);\n\n if (!childNode) {\n throw Error(`Child node key ${key} missing`);\n }\n\n if (!this.__parentWkri) {\n throw Error(\"This semantic node is currently parentless (no WKRI)\");\n }\n\n if (!this.__parentWkri.$) {\n // Could autoretreive?\n throw Error(\"This semantic node is currently on an unloaded WKRI\");\n }\n\n const child = this.__parentWkri.$.addPseudo(childNode, this.__tile, this.__node);\n child.parentNode = this.__parentPseudo || null;\n return child;\n }\n\n static async __create(\n tile: StaticTile,\n node: StaticNode,\n value: any,\n parent: IRIVM<any> | null,\n childNodes: Map<string, StaticNode>,\n ): Promise<SemanticViewModel> {\n const svm = new SemanticViewModel(parent, childNodes, tile, node);\n if (value) {\n try {\n await svm.__update(value);\n } catch (e) {\n tileLoadingError(\n `\n Suppressed a tile loading error: ${e}: ${typeof e} (tile: ${tile}; node: ${node}) - ${value}\n `,\n e,\n );\n }\n }\n // await svm.__getChildren();\n return svm;\n }\n\n async __asTileData() {\n // Ensure all nodes have populated the tile\n const relationships: any[] = [];\n for (const value of [...await this.__getChildren(true)]) {\n // We do not use tile, because a child node will ignore its tile reference.\n const [, subrelationships] = await value.getTile();\n relationships.push(...subrelationships);\n }\n // This is none because the semantic type has no nodal value,\n // only its children have nodal values, and the nodal value of this nodeid should\n // not exist.\n return [null, relationships];\n }\n\n async __getChildValues(): Promise<Map<string, IPseudo>> {\n const parent = this.__parentWkri;\n const childNodes = this.__childNodes;\n const tile = this.__tile;\n const node = this.__node;\n if (!parent || !parent.$) {\n return new Map();\n }\n\n // Ensure lazy-loading done.\n // TODO check this does not go deeper than necessary.\n await parent.$.loadNodes([...childNodes.keys()]);\n\n // TODO: Why not just use edges?\n const children: Map<string, any> = new Map();\n for (const entry of [...parent.$.allEntries()]) {\n const key = entry[0];\n let values = entry[1];\n if (values instanceof Promise) {\n values = await values;\n }\n if (values === false || values === null || values === undefined) {\n continue;\n }\n const childNode = childNodes.get(key);\n if (childNode) {\n for (let value of values) {\n if (\n value !== null &&\n value.node &&\n (!(value.parentNode) ||\n value.parentNode === this.__parentPseudo)\n ) {\n // It is possible that this value has already\n // been requested, but the tile is in-flight.\n value = await value;\n if (!value.node) {\n throw Error(`Node ${childNode.alias} (${childNode.nodeid}) is unavailable`);\n }\n if (\n // value.node.nodegroup_id == node.nodeid in all cases for first possibility?\n (value.node.nodegroup_id != node.nodegroup_id && tile && value.tile && (!(value.tile.parenttile_id) || value.tile.parenttile_id == tile.tileid)) ||\n (value.node.nodegroup_id == node.nodegroup_id &&\n tile &&\n value.tile == tile &&\n !childNode.is_collector) // # It shares a tile\n // it feels like this should be necessary, but area_assignments->area_assignment fails with null parenttile_id\n // (tile && value.tile && value.tile.parenttile_id == tile.tileid) ||\n // (value.node.nodegroup_id == node.nodegroup_id &&\n // tile &&\n // value.tile == tile &&\n // !childNode.is_collector) // # It shares a tile\n ) {\n children.set(key, value);\n } else if (\n node.nodegroup_id != value.node.nodegroup_id &&\n childNode.is_collector // It does not share a tile\n ) {\n // This avoids list types that have their own tiles (like resource or concept lists)\n // from appearing doubly-nested\n const childValue = value instanceof PseudoList ? value : (value.isIterable() ? await value.getValue() : null);\n let listValue: PseudoList | Array<any> | null;\n if (childValue && Array.isArray(childValue)) {\n listValue = childValue;\n } else {\n listValue = null;\n }\n if (listValue !== null) {\n if (children.has(key)) {\n children.get(key).push(...listValue);\n } else {\n children.set(key, listValue);\n }\n } else {\n // In this case, we have a value, but the wrapper logic did not make it a PseudoList, so\n // we should treat it as singular.\n children.set(key, value);\n }\n }\n }\n }\n }\n }\n for (const [key, value] of [...children.entries()]) {\n value.parentNode = this.__parentPseudo;\n this.__childValues.set(key, value);\n }\n\n return children;\n }\n}\n\nconst CUSTOM_DATATYPES: Map<string, string | IViewModel> = new Map();\n\nasync function getViewModel<RIVM extends IRIVM<RIVM>>(\n parentPseudo: PseudoValue<any>,\n tile: StaticTile,\n node: StaticNode,\n data: any,\n parent: IRIVM<RIVM> | null,\n childNodes: Map<string, StaticNode>,\n isInner: boolean = false\n): Promise<IViewModel | null> {\n let vm;\n // TODO: should parentPseudo.parent.$ trigger a retrieve if missing?\n const cacheEntries: {[tileId: string]: {[nodeId: string]: IStringKeyedObject}} | undefined = parentPseudo.parent && parentPseudo.parent.$ ? await parentPseudo.parent.$.getValueCache(false, undefined) : undefined;\n let cacheEntry: IStringKeyedObject | null = null;\n if (cacheEntries) {\n cacheEntry = (tile.tileid ? (cacheEntries[tile.tileid] ?? {}) : {})[node.nodeid]\n };\n const datatype = isInner ? \"semantic\" : CUSTOM_DATATYPES.get(node.datatype) ?? node.datatype;\n\n // TODO: find a neater way.\n let conceptCacheEntry: ConceptListCacheEntry | null;\n let conceptValueCacheEntry: ConceptValueCacheEntry | null;\n let resourceInstanceCacheEntry: ResourceInstanceCacheEntry | null;\n let resourceInstanceListCacheEntry: ResourceInstanceListCacheEntry | null;\n\n if (!(typeof datatype == \"string\")) {\n // @ts-expect-error Cannot make a static member part of the interface\n vm = await datatype.__create(tile, node, data, cacheEntry);\n } else {\n switch (datatype) {\n case \"semantic\":\n vm = await SemanticViewModel.__create(\n tile,\n node,\n data,\n parent,\n childNodes,\n );\n break;\n case \"domain-value\":\n vm = await DomainValueViewModel.__create(tile, node, data);\n break;\n case \"domain-value-list\":\n vm = await DomainValueListViewModel.__create(tile, node, data);\n break;\n case \"concept\":\n if (cacheEntry && typeof cacheEntry === \"object\" && !(cacheEntry instanceof ConceptValueCacheEntry)) {\n // @ts-expect-error We do not know the cache entry is structured correctly, and any such checks are in the constructor.\n conceptValueCacheEntry = new ConceptValueCacheEntry(cacheEntry);\n } else {\n conceptValueCacheEntry = cacheEntry;\n }\n vm = await ConceptValueViewModel.__create(tile, node, data, conceptValueCacheEntry);\n break;\n case \"resource-instance\":\n if (cacheEntry && typeof cacheEntry === \"object\" && !(cacheEntry instanceof ResourceInstanceCacheEntry)) {\n // @ts-expect-error We do not know the cache entry is structured correctly, and any such checks are in the constructor.\n resourceInstanceCacheEntry = new ResourceInstanceCacheEntry(cacheEntry);\n } else {\n resourceInstanceCacheEntry = cacheEntry;\n }\n vm = await ResourceInstanceViewModel.__create(tile, node, data, resourceInstanceCacheEntry);\n break;\n case \"resource-instance-list\":\n if (cacheEntry && typeof cacheEntry === \"object\" && !(cacheEntry instanceof ResourceInstanceListCacheEntry)) {\n // @ts-expect-error We do not know the cache entry is structured correctly, and any such checks are in the constructor.\n resourceInstanceListCacheEntry = new ResourceInstanceListCacheEntry(cacheEntry);\n } else {\n resourceInstanceListCacheEntry = cacheEntry;\n }\n vm = await ResourceInstanceListViewModel.__create(tile, node, data, resourceInstanceListCacheEntry);\n break;\n case \"concept-list\":\n if (cacheEntry && typeof cacheEntry === \"object\" && !(cacheEntry instanceof ConceptListCacheEntry)) {\n // @ts-expect-error We do not know the cache entry is structured correctly, and any such checks are in the constructor.\n conceptCacheEntry = new ConceptListCacheEntry(cacheEntry);\n } else {\n conceptCacheEntry = cacheEntry;\n }\n vm = await ConceptListViewModel.__create(tile, node, data, conceptCacheEntry);\n break;\n case \"date\":\n vm = await DateViewModel.__create(tile, node, data);\n break;\n case \"geojson-feature-collection\":\n vm = await GeoJSONViewModel.__create(tile, node, data);\n break;\n case \"boolean\":\n vm = await BooleanViewModel.__create(tile, node, data);\n break;\n case \"string\":\n vm = await StringViewModel.__create(tile, node, data);\n break\n case \"number\":\n vm = await NumberViewModel.__create(tile, node, data);\n break\n case \"file-list\":\n vm = await FileListViewModel.__create(tile, node, data);\n break;\n case \"edtf\":\n vm = await EDTFViewModel.__create(tile, node, data);\n break;\n case \"url\":\n vm = await UrlViewModel.__create(tile, node, data);\n break;\n case \"non-localized-string\":\n vm = await NonLocalizedStringViewModel.__create(tile, node, data);\n break;\n default:\n console.warn(\"Missing type for tile\", tile.tileid, \"on node\", node.alias, \"with type\", node.datatype);\n vm = await NonLocalizedStringViewModel.__create(tile, node, data);\n }\n }\n\n if (vm === null) {\n return null;\n }\n\n vm.__parentPseudo = parentPseudo;\n if (vm instanceof Array) {\n for (const vme of vm) {\n if (vme instanceof Promise) {\n vme.then(vmep => { if (vmep !== null) vmep.__parentPseudo = parentPseudo; });\n } else {\n vme.__parentPseudo = parentPseudo;\n }\n }\n }\n\n return vm;\n}\n\nexport { ResourceInstanceCacheEntry, DEFAULT_LANGUAGE, ResourceInstanceViewModel, ValueList, getViewModel, DomainValueViewModel, SemanticViewModel, StringViewModel, DateViewModel, GeoJSONViewModel, ConceptValueViewModel, viewContext, NonLocalizedStringViewModel, CUSTOM_DATATYPES, BooleanViewModel, NumberViewModel, UrlViewModel };\n","import { StaticTile, StaticNode } from \"./static-types\";\nimport { ISemantic, IViewModel, IPseudo, IRIVM, IModelWrapper } from \"./interfaces\";\nimport { getViewModel } from \"./viewModels\";\nimport { AttrPromise } from \"./utils\";\n\nclass PseudoUnavailable implements IPseudo {\n parentNode: PseudoValue<any> | null = null;\n tile: null = null;\n node: StaticNode;\n isOuter: boolean = false;\n\n constructor(node: StaticNode) {\n this.node = node;\n }\n\n async forJson(): Promise<{[key: string]: any}[] | null> {\n return null;\n }\n\n describeField() {\n return \"Unavailable field\";\n }\n\n describeFieldGroup() {\n return \"Unavailable field\";\n }\n\n public getValue(): AttrPromise<null> {\n return new AttrPromise(resolve => resolve(null));\n }\n\n getLength() {\n return 0;\n }\n\n getChildren(_: boolean = false) {\n return [];\n }\n\n isIterable(): boolean {\n return false\n }\n}\n\nconst ITERABLE_DATATYPES = [\n \"concept-list\",\n \"resource-instance-list\",\n \"domain-value-list\"\n];\n\nclass PseudoValue<VM extends IViewModel> implements IPseudo {\n node: StaticNode;\n tile: StaticTile | null;\n value: any;\n parent: IRIVM<any> | null;\n parentNode: PseudoValue<any> | null;\n valueLoaded: boolean | undefined = false;\n datatype: string | null = null;\n originalTile: StaticTile | null;\n accessed: boolean;\n childNodes: Map<string, StaticNode>;\n isOuter: boolean = false;\n isInner: boolean = false;\n inner: PseudoValue<ISemantic> | null = null;\n independent: boolean;\n\n isIterable(): boolean {\n return this.datatype !== null && ITERABLE_DATATYPES.includes(this.datatype);\n }\n\n describeField() {\n let fieldName = this.node.name;\n if (this.parent && this.parent.__) {\n fieldName = `${this.parent.__.wkrm.modelName} - ${fieldName}`;\n }\n return fieldName;\n }\n\n describeFieldGroup() {\n let fieldName = this.node.name;\n if (this.parent && this.node.nodegroup_id && this.parent.$) {\n const nodegroup = this.parent.$.model.getNodeObjects().get(this.node.nodegroup_id);\n if (nodegroup && this.parent.__) {\n fieldName = `${this.parent.__.wkrm.modelName} - ${nodegroup.name}`;\n }\n }\n return fieldName;\n }\n\n constructor(\n node: StaticNode,\n tile: StaticTile | null,\n value: any,\n parent: IRIVM<any> | null,\n childNodes: Map<string, StaticNode>,\n inner: boolean | PseudoValue<ISemantic>,\n ) {\n this.node = node;\n this.tile = tile;\n this.independent = tile === null;\n if (!parent) {\n throw Error(\"Must have a parent or parent class for a pseudo-node\");\n }\n this.parent = parent;\n this.parentNode = null;\n this.childNodes = childNodes;\n this.value = value;\n this.accessed = false;\n this.originalTile = tile;\n this.datatype = node.datatype;\n if (inner instanceof PseudoValue) {\n this.isOuter = true;\n this.inner = inner;\n }\n if (inner === true) {\n this.isInner = true;\n this.datatype = 'semantic';\n }\n }\n\n // TODO deepcopy\n //\n\n getParentTileId() {\n return this.tile ? this.tile.parenttile_id : null;\n }\n\n async getTile(): Promise<[StaticTile | null, any[]]> {\n await this.updateValue();\n\n let relationships: Array<any> = [];\n\n if (this.inner) {\n [this.tile, relationships] = await this.inner.getTile();\n }\n\n let tileValue;\n if (this.value !== null) {\n // It may be better to make this fully async if there's a performance benefit.\n const [newTileValue, ownRelationships] = await (await this.value).__asTileData();\n tileValue = newTileValue;\n relationships = [...relationships, ...ownRelationships];\n } else {\n tileValue = null;\n }\n // if isinstance(tile_value, tuple):\n // relationships = [\n // relationship\n // if isinstance(relationship, tuple)\n // else (self.tile.nodegroup_id, self.node.nodeid, relationship)\n // for relationship in tile_value[1]\n // ]\n // tile_value = tile_value[0]\n if (!this.tile) {\n throw Error();\n }\n this.tile.data = this.tile.data || {};\n if (tileValue === null) {\n if (this.tile.data.get(this.node.nodeid)) {\n this.tile.data.delete(this.node.nodeid);\n }\n } else {\n this.tile.data.set(this.node.nodeid, tileValue);\n }\n const tile = this.independent ? this.tile : null;\n\n // TODO relationships\n return [tile, relationships];\n }\n\n clear() {\n this.value = null;\n if (this.tile && this.tile.data && this.tile.data.has(this.node.nodeid)) {\n this.tile.data.delete(this.node.nodeid);\n }\n }\n\n updateValue(tile?: StaticTile | null): AttrPromise<VM> {\n if (tile) {\n this.tile = tile;\n }\n this.accessed = true;\n if (this.inner) {\n this.inner.accessed = true;\n }\n if (!this.tile) {\n if (!this.node) {\n throw Error(\"Empty tile\");\n }\n if (this.inner) {\n return new AttrPromise(async (resolve) => {\n const tile = await this.inner?.getTile();\n resolve(this.updateValue(tile ? tile[0] : undefined));\n });\n }\n if (!this.tile) {\n // NB: You may see issues where the nodegroup is null because it is the root node,\n // and a node below is not marked as a collector, so tries to fill its tile in\n // A cardinality n node below the root should be a collector.\n this.tile = new StaticTile({\n nodegroup_id: this.node.nodegroup_id || \"\",\n tileid: null,\n data: new Map<string, any>(),\n sortorder: this.node.sortorder,\n resourceinstance_id: \"\",\n parenttile_id: null,\n provisionaledits: null,\n ensureId: () => \"\"\n });\n // this.relationships = [];\n }\n }\n if (this.valueLoaded === false) {\n this.valueLoaded = undefined;\n let data: any;\n if (\n this.value === null &&\n this.tile.data !== null &&\n this.tile.data.has(this.node.nodeid) &&\n this.datatype !== 'semantic' // Semantic nodes only have placeholder data\n ) {\n data = this.tile.data.get(this.node.nodeid);\n } else {\n data = this.value;\n }\n\n if (this.isOuter && typeof data === 'object' && this.inner && data) {\n let outerData = undefined;\n if (\"_\" in data && !data.constructor) {\n outerData = data[\"_\"];\n delete data[\"_\"];\n this.inner.getValue().then((v: ISemantic | null) => v && v.update(data));\n data = outerData;\n } else if (data instanceof Map && data.has(\"_\")) {\n outerData = data.get(\"_\");\n data.delete(\"_\");\n this.inner.getValue().then((v: ISemantic | null) => v && v.update(data));\n data = outerData;\n }\n }\n const vm = getViewModel(\n this,\n this.tile,\n this.node,\n data,\n this.parent,\n this.childNodes,\n this.isInner\n );\n\n const resolveAttr = (vm: IViewModel) => {\n if (vm !== null && vm instanceof Object) {\n vm.__parentPseudo = this;\n if (this.isOuter && this.inner) {\n vm._ = this.inner.getValue();\n }\n\n this.valueLoaded = true;\n }\n return vm;\n };\n this.value = new AttrPromise((resolve) => {\n vm.then((vm) => resolve(vm ? resolveAttr(vm) : vm));\n });\n }\n\n return this.value;\n }\n\n public getValue(): AttrPromise<VM | null> {\n return this.updateValue();\n }\n\n // @value.setter\n // def value(this, value):\n\n getLength() {\n return this.getChildren().length;\n }\n\n async getChildTypes() {\n await this.updateValue();\n let childTypes = {};\n if (this.value && this.value instanceof Object && 'getChildTypes' in this.value && typeof this.value.getChildTypes === 'function') {\n childTypes = this.value.getChildTypes();\n }\n if (this.inner) {\n Object.assign(childTypes, this.inner.getChildTypes());\n }\n return childTypes;\n }\n\n getChildren(direct = null): IPseudo[] {\n let children = [];\n if (this.value && this.value instanceof Object && 'getChildren' in this.value && typeof this.value.getChildren === 'function') {\n children = this.value.getChildren(direct);\n }\n if (this.inner) {\n children = [...children, ...this.inner.getChildren(direct)];\n }\n return children;\n }\n\n async forJson(): Promise<{[key: string]: any} | {[key: string]: any}[] | string | number | boolean | null> {\n const value = (await this.getValue());\n return value instanceof Object ? value.forJson() : value;\n }\n}\n\nclass PseudoList extends Array implements IPseudo {\n node: StaticNode | undefined = undefined;\n parent: IRIVM<any> | null | undefined = undefined;\n parentNode: PseudoValue<any> | null = null;\n tile: StaticTile | undefined;\n parenttileId: string | undefined;\n ghostChildren: Set<PseudoValue<any>> | null = null;\n isOuter: boolean = false;\n\n isIterable(): boolean {\n return true;\n }\n\n async sorted() {\n const resolved = await Promise.all(this.map(async (pn) => await pn));\n const test = [];\n const sorted = resolved.sort((a, b) => {\n const vals = [a, b].map(val => {\n if (val && a.__parentPseudo && a.__parentPseudo.tile) {\n if (val.__parentPseudo.tile.sortorder > 0) {\n // RMV\n test.push(1);\n }\n return val.__parentPseudo.tile.sortorder;\n } else {\n return 0;\n }\n });\n return vals[0] - vals[1];\n });\n return sorted;\n }\n\n describeField() {\n if (!this.node) {\n return \"[(uninitialized node)]\";\n }\n\n let fieldName = this.node.name;\n if (this.parent && this.parent.__) {\n fieldName = `${this.parent.__.wkrm.modelName} - ${fieldName}`;\n }\n return `[${fieldName}]`;\n }\n\n describeFieldGroup() {\n if (!this.node) {\n return \"[(uninitialized node)]\";\n }\n\n let fieldName = this.node.name;\n if (this.parent && this.node.nodegroup_id && this.parent.$) {\n const nodegroup = this.parent.$.model.getNodeObjects().get(this.node.nodegroup_id);\n if (nodegroup && this.parent.__) {\n fieldName = `${this.parent.__.wkrm.modelName} - ${nodegroup.name}`;\n }\n }\n return `[${fieldName}]`;\n }\n\n // Otherwise interferes with Array methods;\n initialize(node: StaticNode, parent: IRIVM<any> | null) {\n this.node = node;\n if (Array.isArray(this.node)) {\n throw Error(\"Cannot make a list of lists\");\n }\n if (!parent) {\n throw Error(\"Must have a parent or parent class for a pseudo-node\");\n }\n this.parent = parent;\n this.tile = undefined;\n this.parenttileId = undefined;\n this.ghostChildren = new Set();\n }\n\n async forJson(): Promise<{[key: string]: any}[]> {\n const array: {[key: string]: any}[] = Array.from(\n (await this.sorted()).map(\n async (entry: Promise<IViewModel> | IViewModel) => {\n const value = await entry;\n return (value && value instanceof Object && value.forJson) ? value.forJson() : value;\n }\n )\n );\n return Promise.all(array);\n }\n\n getValue(): AttrPromise<PseudoList> {\n return new AttrPromise(resolve => resolve(this));\n }\n\n toString() {\n return `<PL: ${this.length}>`;\n }\n}\n\n// Fix wkri type.\nfunction makePseudoCls(\n model: IModelWrapper<any>,\n key: string,\n single: boolean,\n tile: StaticTile | null = null,\n wkri: any | null = null,\n): PseudoList | PseudoValue<any> | PseudoUnavailable {\n const nodeObjs = model.getNodeObjectsByAlias();\n const nodeObj = nodeObjs.get(key);\n if (!nodeObj) {\n throw Error(\"Could not find node by alias\");\n }\n\n const nodegroups = model.getNodegroupObjects();\n const nodegroup = nodegroups.get(nodeObj.nodegroup_id || \"\");\n\n let value = null;\n if (\n nodeObj.nodegroup_id &&\n nodeObj.is_collector &&\n nodegroup &&\n nodegroup.cardinality == \"n\" &&\n !single\n ) {\n value = new PseudoList();\n value.initialize(nodeObj, wkri);\n }\n if (value === null || tile) {\n let nodeValue;\n const isPermitted = model.isNodegroupPermitted(nodeObj.nodegroup_id || '', tile, nodeObjs);\n if (isPermitted) {\n const childNodes: Map<string, StaticNode> = model.getChildNodes(nodeObj.nodeid);\n let inner: boolean | PseudoValue<any> = false;\n if (childNodes && childNodes.size && nodeObj.datatype !== 'semantic') {\n inner = new PseudoValue(nodeObj, tile, null, wkri, childNodes, true);\n }\n nodeValue = new PseudoValue(nodeObj, tile, null, wkri, inner !== false ? new Map() : childNodes, inner);\n } else {\n nodeValue = new PseudoUnavailable(nodeObj);\n }\n // If we have a tile in a list, add it\n if (value) {\n value.push(nodeValue.getValue());\n } else {\n value = nodeValue;\n }\n }\n\n return value;\n}\n\nexport { PseudoValue, PseudoList, PseudoUnavailable, makePseudoCls };\n","import { GraphResult, archesClient, ArchesClient, ArchesClientRemote } from './client';\nimport { staticStore } from './staticStore';\nimport { CardComponent, DEFAULT_CARD_COMPONENT, Widget, getDefaultWidgetForNode } from './cards';\nimport {\n StaticTranslatableString,\n StaticCollection,\n StaticConstraint,\n StaticCard,\n StaticEdge,\n StaticCardsXNodesXWidgets,\n StaticFunctionsXGraphs,\n StaticTile,\n StaticGraph,\n StaticNode,\n StaticNodegroup,\n StaticResource,\n StaticResourceDescriptors,\n StaticGraphMeta,\n IStaticDescriptorConfig\n} from \"./static-types\";\nimport { makePseudoCls, PseudoList } from \"./pseudos.ts\";\nimport { DEFAULT_LANGUAGE, ResourceInstanceViewModel, ValueList, viewContext, SemanticViewModel } from \"./viewModels.ts\";\nimport { CheckPermission, GetMeta, IRIVM, IStringKeyedObject, IPseudo, IInstanceWrapper, IViewModel, ResourceInstanceViewModelConstructor } from \"./interfaces\";\nimport { } from \"./nodeConfig.ts\";\nimport { generateUuidv5, AttrPromise } from \"./utils\";\n\nconst MAX_GRAPH_DEPTH = 100;\nconst DESCRIPTOR_FUNCTION_ID = \"60000000-0000-0000-0000-000000000001\";\n\nclass WKRM {\n modelName: string;\n modelClassName: string;\n graphId: string;\n meta: StaticGraphMeta;\n\n constructor(meta: StaticGraphMeta) {\n let name: {[lang: string]: string} | string | undefined;\n if (meta.name instanceof Object) {\n name = meta.name[DEFAULT_LANGUAGE].toString();\n } else {\n name = meta.name;\n }\n this.modelName = name || \"Unnamed\";\n this.graphId = meta.graphid;\n this.modelClassName = (meta.slug || this.modelName)\n .replace(/[_-]/g, \" \")\n .replace(/\\s(.)/g, (c: string) => c.toUpperCase())\n .replace(/\\s/g, \"\");\n this.modelClassName = this.modelClassName[0].toUpperCase() + this.modelClassName.slice(1);\n this.meta = meta;\n }\n}\n\nclass ConfigurationOptions {\n graphs: Array<string> | null | boolean;\n eagerLoadGraphs: boolean = false;\n\n constructor() {\n this.graphs = null;\n }\n}\n\nclass ResourceInstanceWrapper<RIVM extends IRIVM<RIVM>> implements IInstanceWrapper<RIVM> {\n wkri: RIVM;\n model: ResourceModelWrapper<RIVM>;\n\n resource: StaticResource | null | false ;\n valueList: ValueList<RIVM>;\n cache: {[tileId: string]: {[nodeId: string]: IStringKeyedObject}} | undefined;\n scopes?: string[];\n metadata?: {[key: string]: string};\n\n constructor(\n wkri: RIVM,\n model: ResourceModelWrapper<RIVM>,\n resource: StaticResource | null | false, // False to disable dynamic resource-loading\n pruneTiles: boolean = true\n ) {\n this.wkri = wkri;\n this.model = model;\n if (resource) {\n this.model.stripTiles(resource);\n }\n this.resource = resource;\n this.valueList = new ValueList(new Map<string, any>(), new Map<string, boolean>(), this, []);\n this.cache = resource ? resource.__cache : undefined;\n this.scopes = resource ? resource.__scopes : undefined;\n this.metadata = resource ? resource.metadata : undefined;\n if (pruneTiles && this.resource) {\n this.pruneResourceTiles()\n }\n }\n\n pruneResourceTiles(): undefined {\n if (!this.resource) {\n console.warn(\"Trying to prune tiles for an empty resource\", this.wkri.modelClassName);\n return;\n }\n this.resource.tiles = (this.resource.tiles || []).filter((tile: StaticTile) => {\n return this.model.isNodegroupPermitted(tile.nodegroup_id || '', tile);\n });\n }\n\n async loadNodes(aliases: Array<string>): Promise<void> {\n for (const key of aliases) {\n await this.valueList.retrieve(key);\n }\n }\n\n async getName(update: boolean = false) {\n let resourceName = this.resource && this.resource.resourceinstance.name;\n if (update || !resourceName) {\n const descriptors = await this.getDescriptors(update);\n resourceName = (descriptors && descriptors.name) || resourceName || '<Unnamed>';\n if (this.resource && this.resource.resourceinstance) {\n this.resource.resourceinstance.name = resourceName;\n }\n }\n return resourceName;\n }\n\n async getDescriptors(update: boolean = false) {\n let descriptors = this.resource && this.resource.resourceinstance.descriptors;\n if (update || !descriptors || descriptors.isEmpty()) {\n descriptors = new StaticResourceDescriptors();\n let descriptorConfig: IStaticDescriptorConfig | undefined = undefined;\n if (this.model.graph.functions_x_graphs) {\n const descriptorNode = this.model.graph.functions_x_graphs.find(node => node.function_id === DESCRIPTOR_FUNCTION_ID);\n if (descriptorNode) {\n descriptorConfig = descriptorNode.config;\n }\n }\n const nodes = this.model.getNodeObjects();\n if (descriptorConfig) {\n for (const [descriptor, config] of Object.entries(descriptorConfig.descriptor_types)) {\n const semanticNode = nodes.get(config.nodegroup_id);\n let description = config.string_template;\n if (!description) {\n continue;\n }\n let requestedNodes = description.match(/<[A-Za-z _-]*>/g) || [];\n const relevantNodes = [...nodes.values()].filter(node => node.nodegroup_id === config.nodegroup_id && [...requestedNodes].includes(`<${node.name}>`)).map(node => [node.name, node.alias || '']);\n let relevantValues: [string, string | undefined][] = [];\n // First try and see if we can find all of these on one tile, for consistency.\n if (semanticNode) {\n let semanticValue = await (await this.valueList.retrieve(semanticNode.alias || ''))[0];\n if (semanticValue instanceof PseudoList) {\n semanticValue = await semanticValue[0];\n } else if (semanticValue.inner) {\n // TODO: Do we need to re-add the e.g. stringviewmodel as a <...> variable?\n relevantValues.push([semanticNode.name || '', await semanticValue.getValue()]);\n semanticValue = await semanticValue.inner.getValue();\n } else {\n semanticValue = await semanticValue.getValue();\n }\n if (semanticValue) {\n relevantValues = [...relevantValues, ...await Promise.all(relevantNodes.filter(([_, alias]) => semanticValue.__has(alias)).map(([name, alias]) => semanticValue[alias].then((value: IViewModel) => [name, value])))];\n }\n }\n if (relevantValues) {\n description = relevantValues.reduce((desc, [name, value]) => value ? desc.replace(`<${name}>`, value) : desc, description);\n }\n requestedNodes = description.match(/<[A-Za-z _-]*>/g) || [];\n if (requestedNodes.length) {\n relevantValues = await Promise.all(relevantNodes.map(([name, alias]) => this.valueList.retrieve(alias).then((values: string[]): [string, string | undefined] => [name, values ? values[0] : undefined])));\n if (relevantValues) {\n description = relevantValues.reduce((desc, [name, value]) => value ? desc.replace(`<${name}>`, value) : desc, description);\n }\n }\n descriptors[descriptor] = description;\n }\n }\n }\n if (this.resource && this.resource.resourceinstance) {\n this.resource.resourceinstance.descriptors = descriptors;\n if (descriptors.name) {\n this.resource.resourceinstance.descriptors.name = descriptors.name;\n }\n }\n return descriptors;\n }\n\n addPseudo(childNode: StaticNode, tile: StaticTile | null, node: StaticNode): IPseudo {\n const key = childNode.alias;\n if (!key) {\n throw Error(`Cannot add a pseudo node with no alias ${childNode.nodeid}`);\n }\n const child = makePseudoCls(\n this.model,\n key,\n false,\n (!childNode.is_collector && childNode.nodegroup_id === node.nodegroup_id) ? tile : null, // Does it share a tile\n this.wkri,\n );\n\n const valueList: ValueList<any> = this.valueList;\n valueList.setDefault(key, []).then((val: Array<any>) => val.push(child));\n return child;\n }\n\n allEntries(): MapIterator<[string, Array<IPseudo> | false | null]> {\n return this.valueList.values.entries()\n }\n\n async keys() {\n return (await this.getRootViewModel()).keys();\n }\n\n async values() {\n return (await this.getRootViewModel()).values();\n }\n\n async entries() {\n return (await this.getRootViewModel()).entries();\n }\n\n async getRootViewModel(): Promise<SemanticViewModel> {\n const root = await this.getRoot();\n let value: IViewModel | null = null;\n if (root) {\n const rootValue = await root.getValue();\n if (!Array.isArray(rootValue)) {\n value = rootValue;\n }\n }\n if (!value || !(value instanceof SemanticViewModel)) {\n throw Error(`Tried to get root on ${this.model.wkrm.modelClassName}, which has no root`);\n }\n return value;\n }\n\n getOrmAttribute(key: string): AttrPromise<IViewModel> {\n let promise: Promise<void>;\n if (this.resource === null) {\n promise = this.model.findStatic(this.wkri.id).then(resource => {\n this.resource = resource;\n }).then(() => this.populate(true));\n } else {\n promise = new Promise((resolve) => { resolve(); });\n }\n\n // TODO remapping\n return new AttrPromise(resolve => {\n promise.then(() => this.getRootViewModel()).then(root => resolve(root[key]));\n });\n }\n\n async getRoot(): Promise<IPseudo | undefined> {\n const values = this.valueList;\n const node = this.model.getRootNode();\n if (node) {\n let value;\n const alias = node.alias;\n if (!(typeof alias == 'string')) {\n throw Error(`Alias missing for node ${node.nodeid}`);\n }\n await values.setDefault(alias, []);\n const nodeValues = await values.get(alias);\n\n if (nodeValues.length > 1) {\n throw Error(\"Cannot have multiple root tiles\");\n } else if (nodeValues.length == 1) {\n value = nodeValues[0];\n } else {\n value = makePseudoCls(this.model, alias, false, null, this.wkri);\n values.set(alias, [value]);\n }\n return value;\n }\n }\n\n setOrmAttribute(key: string, value: any) {\n // TODO remapping\n return this.getRootViewModel().then((root) => {\n if (root) {\n root[key] = value;\n } else {\n throw Error(`Tried to set ${key} on ${self}, which has no root`);\n }\n });\n }\n\n async ensureNodegroup(\n allValues: Map<string, any>,\n allNodegroups: Map<string, boolean | Promise<any>>,\n nodegroupId: string,\n nodeObjs: Map<string, StaticNode>,\n nodegroupObjs: Map<string, StaticNodegroup>,\n edges: Map<string, string[]>,\n addIfMissing: boolean,\n tiles: StaticTile[] | null,\n doImpliedNodegroups: boolean = true\n ): Promise<[Map<string, any>, Set<string>]> {\n const impliedNodegroups: Set<string> = new Set();\n const sentinel = allNodegroups.get(nodegroupId); // no action required if pending\n let newValues = new Map();\n\n if (sentinel === false || (addIfMissing && sentinel === undefined)) {\n [...nodeObjs.values()].filter((node: StaticNode) => {\n return node.nodegroup_id === nodegroupId;\n }).forEach((node: StaticNode) => allValues.delete(node.alias || ''));\n let nodegroupTiles: (StaticTile | null)[];\n if (tiles === null) {\n nodegroupTiles = [];\n console.error(\"Tiles must be provided and cannot be lazy-loaded yet\");\n } else {\n nodegroupTiles = tiles.filter(\n (tile) => tile.nodegroup_id == nodegroupId && this.model.isNodegroupPermitted(nodegroupId, tile)\n );\n if (nodegroupTiles.length == 0 && addIfMissing) {\n nodegroupTiles = [null];\n }\n const rgValues = await this.valuesFromResourceNodegroup(\n allValues,\n nodegroupTiles,\n nodegroupId,\n nodeObjs,\n edges,\n );\n newValues = rgValues[0];\n const newImpliedNodegroups: Set<string> = rgValues[1];\n\n [...newValues.entries()].forEach((entry) => {\n if (entry[1] !== undefined) {\n allValues.set(entry[0], entry[1]);\n }\n });\n [...newImpliedNodegroups].forEach((v) => {\n impliedNodegroups.add(v);\n });\n allNodegroups.set(nodegroupId, true);\n }\n }\n\n // RMV double-check against Python logic\n if (doImpliedNodegroups) {\n for (const nodegroupId of [...impliedNodegroups]) {\n // TODO: why are we not keeping implied nodegroups?\n const [impliedValues] = await this.ensureNodegroup(\n allValues,\n allNodegroups,\n nodegroupId,\n nodeObjs,\n nodegroupObjs,\n edges,\n true,\n tiles, // RMV different from Python\n true\n );\n for (const [key, value] of impliedValues) {\n newValues.set(key, value);\n }\n }\n impliedNodegroups.clear();\n }\n\n return [newValues, impliedNodegroups];\n }\n\n async populate(lazy: boolean): Promise<void> {\n const nodeObjs = this.model.getNodeObjects();\n const nodegroupObjs = this.model.getNodegroupObjects();\n const edges = this.model.getEdges();\n // FIXME: this needs to be nodeObjs to ensure tiles\n // whose nodegroup node is in a different nodegroup\n // (e.g. children of designation_and_protection_timespan)\n // get loaded - however, just doing that drops performance\n // by half or two-thirds, so a less wasteful approach is needed.\n const allValues: Map<string, any> = new Map();\n const allNodegroups: Map<string, any> = new Map([...nodegroupObjs.keys()].map((id: string) => {\n return [id || \"\", false];\n }));\n //[...nodegroupObjs.keys()].map((id: string) => {\n // const node = nodeObjs.get(id);\n // if (!node) {\n // throw Error(`Could not find node for nodegroup ${id}`);\n // }\n // allValues.set(node.alias || \"\", false);\n //});\n const rootNode = this.model.getRootNode();\n\n if (rootNode.alias === null) {\n throw Error(\"Cannot populate a model with no proper root node\");\n }\n\n allValues.set(rootNode.alias, false);\n\n let tiles = null;\n if (!lazy && this.resource) {\n tiles = this.resource.tiles;\n let impliedNodegroups = new Set<string>();\n for (const [ng] of nodegroupObjs) {\n const [_, newImpliedNodegroups] = await this.ensureNodegroup(\n allValues,\n allNodegroups,\n ng,\n nodeObjs,\n nodegroupObjs,\n edges,\n true, // RMV: check vs python\n tiles,\n false\n );\n\n for (const impliedNodegroup of [...newImpliedNodegroups]) {\n impliedNodegroups.add(impliedNodegroup);\n }\n impliedNodegroups.delete(ng);\n }\n\n while (impliedNodegroups.size) {\n const newImpliedNodegroups = new Set<string>();\n for (const nodegroupId of [...impliedNodegroups]) {\n const currentValue = allNodegroups.get(nodegroupId);\n if (currentValue === false || currentValue === undefined) {\n const [_, newImpliedNodegroups] = await this.ensureNodegroup(\n allValues,\n allNodegroups,\n nodegroupId,\n nodeObjs,\n nodegroupObjs,\n edges,\n true,\n tiles, // RMV different from Python\n true\n );\n for (const impliedNodegroup of [...newImpliedNodegroups]) {\n newImpliedNodegroups.add(impliedNodegroup);\n }\n }\n }\n impliedNodegroups = newImpliedNodegroups;\n }\n } else if (this.resource) {\n this.model.stripTiles(this.resource);\n }\n\n this.valueList = new ValueList(\n allValues,\n allNodegroups,\n this,\n this.resource ? this.resource.tiles : null,\n );\n }\n\n async getValueCache(build: boolean = true, getMeta: GetMeta = undefined): Promise<{[tileId: string]: {[nodeId: string]: IStringKeyedObject}} | undefined> {\n if (build) {\n this.cache = await this.buildValueCache(getMeta);\n }\n return this.cache;\n }\n\n async buildValueCache(getMeta: GetMeta): Promise<{[tileId: string]: {[nodeId: string]: IStringKeyedObject}}> {\n const cacheByTile: {[tileId: string]: {[nodeId: string]: IStringKeyedObject}} = {};\n for (let pseudos of this.valueList.values.values()) {\n pseudos = await pseudos;\n if (pseudos) {\n await Promise.all(pseudos.map(async (pseudo: IPseudo) => {\n const value = await pseudo.getValue();\n // We do not try to cache pseudolists\n if (pseudo.tile && value && (!Array.isArray(pseudo))) {\n // @ts-expect-error this can be IViewModel[] while using a pseudolist\n const cacheJson = await value.__forJsonCache(getMeta); // caching JSON\n if (cacheJson) {\n const tileId = pseudo.tile.ensureId();\n const nodeId = pseudo.node.nodeid;\n if (!(tileId in cacheByTile)) {\n cacheByTile[tileId] = {};\n }\n if (!(nodeId in cacheByTile[tileId])) {\n cacheByTile[tileId][nodeId] = {};\n }\n cacheByTile[tileId][nodeId] = cacheJson;\n }\n }\n }));\n }\n }\n return cacheByTile;\n }\n\n async valuesFromResourceNodegroup(\n existingValues: Map<string, any>,\n nodegroupTiles: (StaticTile | null)[],\n nodegroupId: string,\n nodeObjs: Map<string, StaticNode>,\n edges: Map<string, string[]>,\n ): Promise<[Map<string, any>, Set<string>]> {\n const allValues = new Map<string, any>();\n\n const impliedNodegroups = new Set<string>();\n const impliedNodes: Map<string, [StaticNode, StaticTile]> = new Map();\n\n const nodesUnseen = new Set(\n [...nodeObjs.values()]\n .filter((node) => node.nodegroup_id == nodegroupId)\n .map((node) => node.alias),\n );\n const tileNodesSeen: Set<[string, string]> = new Set();\n const _addPseudo = async (node: StaticNode, tile: StaticTile | null) => {\n const key = node.alias || \"\";\n nodesUnseen.delete(node.alias);\n const tileid = tile && tile.tileid;\n if (tileid) {\n tileNodesSeen.add([node.nodeid, tileid]);\n }\n let existing = existingValues.get(key);\n if (existing instanceof Promise) {\n existing = await existing;\n }\n if (existing !== false && existing !== undefined) {\n // This might be correct - confirm.\n // console.warn(`Tried to load node twice: ${key} (${node.nodeid}<${node.nodegroup_id})`, nodegroupId);\n allValues.set(key, existing);\n }\n if (!allValues.has(key)) {\n allValues.set(key, []);\n }\n const pseudoNode = makePseudoCls(this.model, key, false, tile, this.wkri);\n // We shouldn't have to take care of this case, as it should already\n // be included below.\n // if tile.parenttile_id:\n for (const [domain, ranges] of edges) {\n if (ranges.includes(node.nodeid)) {\n const domainNode = nodeObjs.get(domain);\n if (!domainNode) {\n throw Error(\"Edge error in graph\");\n }\n const toAdd = domainNode.nodegroup_id\n ? domainNode.nodegroup_id\n : '';\n if (toAdd && toAdd !== nodegroupId) {\n impliedNodegroups.add(toAdd);\n }\n if (domainNode.nodegroup_id && tile && domainNode.nodegroup_id === tile.nodegroup_id && domainNode.nodegroup_id !== domainNode.nodeid && tileid && !impliedNodes.has(domainNode.nodeid + tileid)) {\n impliedNodes.set(domainNode.nodeid + tileid, [domainNode, tile]);\n }\n break;\n }\n }\n if (Array.isArray(pseudoNode)) {\n const value = allValues.get(key);\n if (value !== undefined && value !== false) {\n for (const pseudoList of allValues.get(key)) {\n if (!(pseudoList instanceof PseudoList) || !(pseudoNode instanceof PseudoList)) {\n throw Error(`Should be all lists not ${typeof pseudoList} and ${typeof pseudoNode}`);\n }\n\n if (pseudoList.parentNode == pseudoNode.parentNode) {\n for (const ps of pseudoNode) {\n pseudoList.push(ps);\n }\n return;\n }\n }\n }\n }\n allValues.get(key).push(pseudoNode);\n };\n\n for (const tile of nodegroupTiles) {\n const parentNode = nodeObjs.get(nodegroupId);\n if (parentNode === undefined) {\n continue;\n }\n if (!parentNode.nodegroup_id || parentNode.nodegroup_id == nodegroupId) {\n await _addPseudo(parentNode, tile);\n }\n\n if (tile) {\n const tileNodes = new Map();\n for (const [key, value] of [...tile.data.entries()]) {\n tileNodes.set(key, value);\n }\n\n // Semantic nodes in this tile should always have a pseudo-node\n [...nodeObjs.values()].filter((node: StaticNode) => {\n return node.nodegroup_id === nodegroupId && !tileNodes.get(node.nodeid) && node.datatype === 'semantic';\n }).forEach((node: StaticNode) => tileNodes.set(node.nodeid, {}));\n\n if (!tileNodes.has(tile.nodegroup_id)) {\n tileNodes.set(tile.nodegroup_id, {});\n }\n for (const [nodeid, nodeValue] of [...tileNodes.entries()]) {\n if (nodeid == nodegroupId) {\n // RMV is this correct?\n continue;\n }\n const node = nodeObjs.get(nodeid);\n if (!node) {\n throw Error(`Unknown node in nodegroup: ${nodeid} in ${nodegroupId}`);\n }\n if (nodeValue !== null) {\n await _addPseudo(node, tile);\n }\n }\n }\n }\n while (impliedNodes.size > 0) {\n const value = impliedNodes.entries().next().value;\n if (value) {\n const [node, tile] = value[1];\n // If nodeid!=nodegroup_id, then it has its own tile.\n if (tile.tileid && !tileNodesSeen.has([node.nodeid, tile.tileid])) {\n await _addPseudo(node, tile);\n }\n impliedNodes.delete(value[0]);\n }\n }\n // Remove any \"unloaded\" sentinel values so we do not try and\n // reload this nodegroup.\n [...nodesUnseen.keys()].forEach((nodeUnseen) => {\n // if (allValues.get(nodeUnseen) === false) { // TODO: work out why this is not necessary\n if (nodeUnseen) {\n allValues.set(nodeUnseen, undefined);\n }\n // }\n });\n return [allValues, impliedNodegroups];\n }\n}\n\ntype GraphMutation = (baseGraph: StaticGraph) => StaticGraph;\n\nclass GraphMutator {\n baseGraph: StaticGraph;\n mutations: GraphMutation[];\n\n autocreateCard: boolean;\n\n constructor(baseGraph: StaticGraph, options: {\n autocreateCard?: boolean\n } = {}) {\n this.baseGraph = baseGraph;\n this.mutations = [];\n this.autocreateCard = options.autocreateCard === undefined || options.autocreateCard;\n }\n\n _generateUuidv5(key: string) {\n return generateUuidv5(['graph', this.baseGraph.graphid], key);\n }\n\n _generateEdge(fromNode: string, toNode: string, ontologyProperty: string, name?: string, description?: string) {\n const edgeId = this._generateUuidv5(`node-${fromNode}-${toNode}`);\n return new StaticEdge({\n description: description || null,\n domainnode_id: fromNode,\n edgeid: edgeId,\n graph_id: this.baseGraph.graphid,\n name: name || null,\n rangenode_id: toNode,\n ontologyproperty: ontologyProperty,\n });\n }\n\n addSemanticNode(parentAlias: string | null, alias: string, name: string, cardinality: 'n' | '1', ontologyClass: string, parentProperty: string, description?: string, options: {\n exportable?: boolean,\n fieldname?: string,\n hascustomalias?: boolean;\n is_collector?: boolean;\n isrequired?: boolean;\n issearchable?: boolean;\n istopnode?: boolean;\n sortorder?: number;\n } = {}, config?: {[key: string]: any}) {\n return this._addGenericNode(\n parentAlias,\n alias,\n name,\n cardinality,\n \"semantic\",\n ontologyClass,\n parentProperty,\n description,\n options,\n config\n );\n }\n\n addConceptNode(parentAlias: string | null, alias: string, name: string, collection: StaticCollection, cardinality: 'n' | '1', ontologyClass: string, parentProperty: string, description?: string, options: {\n is_list?: boolean,\n exportable?: boolean,\n fieldname?: string,\n hascustomalias?: boolean;\n is_collector?: boolean;\n isrequired?: boolean;\n issearchable?: boolean;\n istopnode?: boolean;\n sortorder?: number;\n } = {}, config?: {[key: string]: any}) {\n config = config || {};\n if (collection?.id) {\n config['rdmCollection'] = collection.id\n }\n return this._addGenericNode(\n parentAlias,\n alias,\n name,\n cardinality,\n options.is_list ? \"concept-list\" : \"concept\",\n ontologyClass,\n parentProperty,\n description,\n options,\n config\n );\n }\n\n addCard(nodegroup: string | StaticNodegroup, name: string | StaticTranslatableString, component?: CardComponent, options: {\n active?: boolean,\n constraints?: Array<StaticConstraint>,\n cssclass?: string | null,\n helpenabled?: boolean,\n helptext?: string | null | StaticTranslatableString,\n helptitle?: string | null | StaticTranslatableString,\n instructions?: string | null | StaticTranslatableString,\n is_editable?: boolean,\n description?: string | null,\n sortorder?: number | null,\n visible?: boolean\n } = {}, config?: {[key: string]: any}) {\n const nodegroupId = typeof nodegroup === 'string' ? nodegroup : nodegroup.nodegroupid;\n const cardName = name instanceof StaticTranslatableString ? name : new StaticTranslatableString(name);\n const cardComponent = component || DEFAULT_CARD_COMPONENT;\n const helptext = options?.helptext && (\n options.helptext instanceof StaticTranslatableString ?\n options.helptext : new StaticTranslatableString(options.helptext)\n );\n const helptitle = (options?.helptitle && (\n options.helptitle instanceof StaticTranslatableString ?\n options.helptitle : new StaticTranslatableString(options.helptitle)\n ));\n const instructions = (options?.instructions && (\n options.instructions instanceof StaticTranslatableString ?\n options.instructions : new StaticTranslatableString(options.instructions)\n ));\n this.mutations.push((graph: StaticGraph) => {\n graph.cards = graph.cards || [];\n if (graph.cards.filter(card => card.nodegroup_id === nodegroup).length > 0) {\n throw Error(`This nodegroup, ${nodegroupId}, already has a card`);\n }\n const cardId = this._generateUuidv5(`card-ng-${nodegroupId}`);\n const card = new StaticCard({\n active: options.active === undefined ? true : options.active,\n cardid: cardId,\n component_id: cardComponent.id,\n config: config || null,\n constraints: options.constraints || [],\n cssclass: options.cssclass || null,\n description: options.description || null,\n graph_id: graph.graphid,\n helpenabled: !!(options.helpenabled || (options.helpenabled === undefined && (helptext || helptitle))),\n helptext: helptext || new StaticTranslatableString(''),\n helptitle: helptitle || new StaticTranslatableString(''),\n instructions: instructions || new StaticTranslatableString(''),\n is_editable: options.is_editable === undefined ? true : options.is_editable,\n name: cardName,\n nodegroup_id: nodegroupId,\n sortorder: options.sortorder || null,\n visible: options.visible === undefined ? true : options.visible\n });\n graph.cards.push(card);\n return graph;\n });\n }\n\n addStringNode(parentAlias: string | null, alias: string, name: string, cardinality: 'n' | '1', ontologyClass: string, parentProperty: string, description?: string, options: {\n exportable?: boolean,\n fieldname?: string,\n hascustomalias?: boolean;\n is_collector?: boolean;\n isrequired?: boolean;\n issearchable?: boolean;\n istopnode?: boolean;\n sortorder?: number;\n } = {}, config?: {[key: string]: any}) {\n return this._addGenericNode(\n parentAlias,\n alias,\n name,\n cardinality,\n \"string\",\n ontologyClass,\n parentProperty,\n description,\n options,\n config\n );\n }\n\n _addNodegroup(parentAlias: string | null, nodegroupId: string, cardinality: 'n' | '1', name?: StaticTranslatableString) {\n this.mutations.push((graph: StaticGraph) => {\n const prnt = parentAlias === null ? graph.root : graph.nodes.find(node => node.alias === parentAlias);\n if (!prnt) {\n throw Error(`Missing parent for nodegroup: ${parentAlias}`);\n }\n const nodegroup = new StaticNodegroup({\n cardinality: cardinality,\n legacygroupid: null,\n nodegroupid: nodegroupId,\n parentnodegroup_id: prnt.nodegroup_id\n });\n graph.nodegroups.push(nodegroup);\n return graph;\n });\n if (this.autocreateCard) {\n this.addCard(nodegroupId, name || '(unnamed)');\n }\n return this;\n }\n\n _addGenericNode(parentAlias: string | null, alias: string, name: string, cardinality: 'n' | '1', datatype: string, ontologyClass: string, parentProperty: string, description?: string, options: {\n exportable?: boolean,\n fieldname?: string,\n hascustomalias?: boolean;\n is_collector?: boolean;\n isrequired?: boolean;\n issearchable?: boolean;\n istopnode?: boolean;\n sortorder?: number;\n } = {}, config?: {[key: string]: any}) {\n const nodeId = this._generateUuidv5(`node-${alias}`);\n const node = {\n alias: alias,\n config: config || {},\n datatype: datatype,\n description: description || null,\n exportable: options.exportable || false,\n fieldname: options.fieldname || null,\n graph_id: this.baseGraph.graphid,\n hascustomalias: options.hascustomalias || false,\n is_collector: options.is_collector || false,\n isrequired: options.isrequired || false,\n issearchable: options.issearchable || true, // This is the default in Arches I believe\n istopnode: options.istopnode || false,\n name: name,\n nodegroup_id: '',\n nodeid: nodeId,\n parentproperty: parentProperty,\n sortorder: options.sortorder || 0,\n ontologyclass: ontologyClass,\n sourcebranchpublication_id: null,\n };\n if (cardinality === 'n' || parentAlias === null) {\n node.nodegroup_id = nodeId;\n this._addNodegroup(parentAlias, node.nodegroup_id, cardinality, new StaticTranslatableString(name));\n }\n this.mutations.push((graph: StaticGraph) => {\n const prnt = parentAlias === null ? graph.root : graph.nodes.find(node => node.alias === parentAlias);\n if (!prnt) {\n throw Error(`Parent node does not exist: ${parentAlias}`);\n }\n // FIXME: we assume we are not adding a root node, but nowhere do we say this.\n node.nodegroup_id = node.nodegroup_id !== '' ? node.nodegroup_id : prnt.nodegroup_id || '';\n const newNode = new StaticNode(node);\n graph.nodes.push(newNode);\n const edge = this._generateEdge(prnt.nodeid, nodeId, parentProperty);\n graph.edges.push(edge);\n return graph;\n });\n\n if (this.autocreateCard && datatype !== 'semantic') {\n const widget = getDefaultWidgetForNode(node);\n const config = widget.getDefaultConfig();\n config.label = name;\n this.addWidgetToCard(\n nodeId,\n widget,\n name,\n config,\n {\n sortorder: node.sortorder,\n silentSkip: true // if, for some reason, the card is not present (i.e. was removed), we should not worry\n }\n );\n }\n return this;\n }\n\n addWidgetToCard(\n nodeId: string,\n widget: Widget,\n name: string,\n config: {[key: string]: any},\n options: {\n sortorder?: number | null,\n silentSkip?: boolean,\n visible?: boolean\n } = {}\n ): GraphMutator {\n this.mutations.push((graph: StaticGraph) => {\n const node = graph.nodes.find(node => node.nodeid === nodeId);\n if (!node) {\n throw Error(`Tried to add card to graph ${graph.graphid} for node ${nodeId} but it was not found.`);\n }\n const card = graph.cards?.find(card => card.nodegroup_id === node.nodegroup_id);\n\n if (card) {\n const cardXNodeXWidgetId = this._generateUuidv5(`cxnxw-${nodeId}-${widget.id}`);\n\n const cardXNodeXWidget = new StaticCardsXNodesXWidgets({\n card_id: card.cardid,\n config: config,\n id: cardXNodeXWidgetId,\n label: new StaticTranslatableString(name),\n node_id: nodeId,\n sortorder: options.sortorder || 0,\n visible: options.visible === undefined || options.visible,\n widget_id: widget.id\n });\n graph.cards_x_nodes_x_widgets = graph.cards_x_nodes_x_widgets || [];\n graph.cards_x_nodes_x_widgets.push(cardXNodeXWidget);\n } else if (!options.silentSkip) {\n throw Error(`Failed adding widget for ${nodeId} to card for ${node.nodegroup_id} on graph ${graph.graphid}, as no card for this nodegroup (yet?)`);\n }\n return graph;\n });\n return this;\n }\n\n apply() {\n if (!this.baseGraph.copy) {\n throw Error(\"Attempt to build a mutator without a proper StaticGraph base graph\");\n }\n // TODO: complete deepcopies\n const graph = this.baseGraph.copy();\n return this.mutations.reduce((graph, mutation) => mutation(graph), graph);\n }\n}\n\nclass ResourceModelWrapper<RIVM extends IRIVM<RIVM>> {\n wkrm: WKRM;\n graph: StaticGraph;\n viewModelClass?: ResourceInstanceViewModelConstructor<RIVM>;\n permittedNodegroups?: Map<string | null, boolean | CheckPermission>;\n\n constructor(wkrm: WKRM, graph: StaticGraph, viewModelClass?: ResourceInstanceViewModelConstructor<RIVM>) {\n this.wkrm = wkrm;\n this.graph = graph;\n this.viewModelClass = viewModelClass;\n }\n\n // TODO: Switch to getBranches\n getBranchPublicationIds(accessible?: boolean): string[] {\n const accessibleOnly = accessible || false;\n const nodes = [...this.graph.nodes.values()];\n return [...nodes.reduce(\n (acc: Set<string>, node: StaticNode): Set<string> => {\n if (node.sourcebranchpublication_id) {\n if (accessibleOnly) {\n if (this.isNodegroupPermitted(node.nodegroup_id || '', null)) {\n acc.add(node.sourcebranchpublication_id);\n }\n } else {\n acc.add(node.sourcebranchpublication_id);\n }\n }\n return acc;\n }, new Set()\n )];\n }\n\n getCollections(accessible?: boolean): string[] {\n const accessibleOnly = accessible || false;\n const nodes = [...this.graph.nodes.values()];\n return [...nodes.reduce(\n (acc: Set<string>, node: StaticNode): Set<string> => {\n if (['concept', 'concept-list'].includes(node.datatype) && node.config?.rdmCollection) {\n if (accessibleOnly) {\n if (this.isNodegroupPermitted(node.nodegroup_id || '', null)) {\n acc.add(node.config.rdmCollection);\n }\n } else {\n acc.add(node.config.rdmCollection);\n }\n }\n return acc;\n }, new Set()\n )];\n }\n\n pruneGraph(keepFunctions?: string[]): undefined {\n const allNodegroups = this.getNodegroupObjects();\n const root = this.graph.root.nodeid;\n // Strictly, this ultimately also contains nodes, but not all allowed nodes - the key point is that\n // it has only and all nodegroups that we will keep.\n const allowedNodegroups = new Map([...allNodegroups.values()].filter((nodegroup: StaticNodegroup) => {\n return this.isNodegroupPermitted(nodegroup.nodegroupid || '', null);\n }).map((nodegroup: StaticNodegroup) => [nodegroup.nodegroupid, nodegroup.nodegroupid === null || nodegroup.nodegroupid === '' || nodegroup.nodegroupid === root]));\n const backedges: Map<string, string> = new Map();\n for (const [d, rs] of this.getEdges()) {\n for (const r of rs) {\n if (backedges.has(r)) {\n throw Error(`Graph is malformed, node ${r} has multiple parents, ${backedges.get(r)} and ${d} at least`);\n }\n backedges.set(r, d);\n }\n }\n\n let loops = 0;\n // This is not a fast approach, but it's simple enough. Optimize if needed.\n allowedNodegroups.set(root, true);\n while (loops < MAX_GRAPH_DEPTH) {\n const unrooted = [...allowedNodegroups.entries()].filter(([_, rooted]: [string, boolean]) => !rooted);\n if (unrooted.length === 0) {\n break;\n }\n for (const [ng] of unrooted) {\n if (ng === root) {\n continue;\n }\n const next = backedges.get(ng);\n if (!next) {\n throw Error(`Graph does not have a parent for ${ng}`);\n }\n allowedNodegroups.set(ng, true);\n if (!allowedNodegroups.has(next)) {\n allowedNodegroups.set(next, false);\n }\n }\n loops += 1;\n }\n\n if (loops >= MAX_GRAPH_DEPTH) {\n throw Error(\"Hit edge traversal limit when pruning, is the graph well-formed without cycles?\")\n }\n\n const allowedNodes = new Set([...this.getNodeObjects().values()].filter((node: StaticNode) => {\n return (node.nodegroup_id && allowedNodegroups.get(node.nodegroup_id)) || node.nodeid === root;\n }).map((node: StaticNode) => node.nodeid));\n\n this.graph.cards = (this.graph.cards || []).filter((card: StaticCard) => allowedNodegroups.get(card.nodegroup_id));\n this.graph.cards_x_nodes_x_widgets = (this.graph.cards_x_nodes_x_widgets || []).filter((card: StaticCardsXNodesXWidgets) => allowedNodes.has(card.node_id));\n this.graph.edges = (this.graph.edges || []).filter((edge: StaticEdge) => (edge.domainnode_id === root || allowedNodes.has(edge.domainnode_id)) && allowedNodes.has(edge.rangenode_id));\n this.graph.nodegroups = (this.graph.nodegroups || []).filter((ng: StaticNodegroup) => allowedNodegroups.has(ng.nodegroupid));\n this.graph.nodes = (this.graph.nodes || []).filter((node: StaticNode) => allowedNodes.has(node.nodeid));\n\n // At this point, every originally-allowed nodegroup has an allowed parent, up to the root.\n if (Array.isArray(keepFunctions) && this.graph.functions_x_graphs) {\n this.graph.functions_x_graphs = this.graph.functions_x_graphs.filter((fxg: StaticFunctionsXGraphs) => keepFunctions.includes(fxg.function_id));\n } else {\n this.graph.functions_x_graphs = [];\n }\n }\n\n exportGraph(): StaticGraph {\n const graph = this.graph;\n return new StaticGraph({\n author: graph.author,\n cards: graph.cards,\n cards_x_nodes_x_widgets: graph.cards_x_nodes_x_widgets,\n color: graph.color,\n config: graph.config,\n deploymentdate: graph.deploymentdate,\n deploymentfile: graph.deploymentfile,\n description: graph.description,\n edges: graph.edges,\n functions_x_graphs: graph.functions_x_graphs,\n graphid: graph.graphid,\n iconclass: graph.iconclass,\n is_editable: graph.is_editable,\n isresource: graph.isresource,\n jsonldcontext: graph.jsonldcontext,\n name: graph.name,\n nodegroups: graph.nodegroups,\n nodes: graph.nodes,\n ontology_id: graph.ontology_id,\n publication: graph.publication,\n relatable_resource_model_ids: graph.relatable_resource_model_ids,\n resource_2_resource_constraints: graph.resource_2_resource_constraints,\n root: graph.root,\n slug: graph.slug,\n subtitle: graph.subtitle,\n template_id: graph.template_id,\n version: graph.version,\n });\n }\n\n async all(params: { limit?: number; lazy?: boolean } | undefined = undefined): Promise<Array<RIVM>> {\n const paramObj = params || { limit: undefined, lazy: undefined };\n const promises = [];\n for await (const resource of this.iterAll(paramObj)) {\n promises.push(resource);\n }\n return Promise.all(promises);\n }\n\n stripTiles(resource: StaticResource) {\n if (resource.tiles) {\n const nodes = this.getNodeObjects();\n resource.tiles = resource.tiles.filter(tile => {\n const node = nodes.get(tile.nodegroup_id);\n if (!node) {\n throw Error(`Tile ${tile.tileid} has nodegroup ${tile.nodegroup_id} that is not on the model ${this.graph.graphid}`);\n }\n return this.isNodegroupPermitted(tile.nodegroup_id || '', tile);\n });\n }\n }\n\n async* resourceGenerator(staticResources: AsyncIterable<StaticResource, RIVM, unknown>, lazy: boolean=false, pruneTiles: boolean = true) {\n for await (const staticResource of staticResources) {\n yield this.fromStaticResource(staticResource, lazy, pruneTiles);\n }\n }\n\n async* iterAll(params: { limit?: number; lazy?: boolean }): AsyncGenerator<RIVM> {\n yield* this.resourceGenerator(staticStore.loadAll(this.wkrm.graphId, params.limit), params.lazy);\n }\n\n async findStatic(id: string): Promise<StaticResource> {\n return await staticStore.loadOne(id);\n }\n\n async find(id: string, lazy: boolean = true, pruneTiles: boolean = true): Promise<RIVM> {\n const rivm = await this.findStatic(id);\n return this.fromStaticResource(rivm, lazy, pruneTiles);\n }\n\n setPermittedNodegroups(permissions: Map<string | null, boolean | CheckPermission>) {\n const nodegroups = this.getNodegroupObjects();\n const nodes = this.getNodeObjectsByAlias();\n this.permittedNodegroups = new Map([...permissions].map(([key, value]): [key: string | null, value: boolean | CheckPermission] => {\n const k = key || '';\n if (nodegroups.has(k) || k === '') {\n return [key, value];\n } else {\n const node = nodes.get(k);\n if (node) {\n // The nodeid is the nodegroup ID of the children, but may not be the nodegroup ID of\n // the semantic node itself.\n return [node.nodeid, value];\n } else {\n throw Error(`Could not find ${key} in nodegroups for permissions`);\n }\n }\n }));\n }\n\n // Defaults to visible, which helps reduce the risk of false sense of security\n // from front-end filtering masking the presence of data transferred to it.\n getPermittedNodegroups(): Map<string | null, boolean | CheckPermission> {\n if (!this.permittedNodegroups) {\n const permissions = new Map([...this.getNodegroupObjects()].map(\n ([k, _]: [k: string, _: StaticNodegroup]) => [k, true]\n ));\n permissions.set(\"\", true); // Have to have access to root node.\n this.setPermittedNodegroups(permissions);\n }\n const permittedNodegroups = this.permittedNodegroups;\n if (permittedNodegroups === undefined) {\n throw Error(\"Could not set permitted nodegroups\");\n }\n // TODO allow reducing\n return permittedNodegroups;\n }\n\n isNodegroupPermitted(nodegroupId: string, tile: StaticTile | null): boolean {\n let permitted: boolean | CheckPermission | undefined = this.getPermittedNodegroups().get(nodegroupId);\n if (permitted && typeof permitted == 'function') {\n const nodes = this.getNodeObjectsByAlias();\n permitted = permitted(nodegroupId, tile, nodes);\n }\n if (!permitted) {\n return false;\n }\n if (permitted === true) {\n return true;\n }\n throw Error(`Ambiguous permission state: ${permitted} for nodegroup ${nodegroupId}`);\n }\n\n makeInstance(id: string, resource: StaticResource | null, pruneTiles: boolean = true): RIVM {\n if (!this.viewModelClass) {\n throw Error(`Cannot instantiate without a viewModelClass in ${this.wkrm.modelClassName}`);\n }\n // TODO: This line needs fixed.\n const instance: RIVM = new this.viewModelClass(\n id,\n this.viewModelClass.prototype.__,\n (rivm: RIVM) =>\n new ResourceInstanceWrapper(rivm, this, resource, pruneTiles),\n null\n );\n return instance;\n }\n\n edges: Map<string, string[]> | undefined;\n nodes: Map<string, StaticNode> | undefined;\n nodegroups: Map<string, StaticNodegroup> | undefined;\n nodesByAlias: Map<string, StaticNode> | undefined;\n\n getChildNodes(nodeId: string): Map<string, StaticNode> {\n const childNodes = new Map<string, StaticNode>();\n const edges = this.getEdges().get(nodeId);\n if (edges) {\n for (const [, n] of this.getNodeObjects()) {\n if (edges.includes(n.nodeid)) {\n if (n.alias) {\n childNodes.set(n.alias, n);\n }\n }\n }\n }\n return childNodes;\n }\n\n buildNodes() {\n if (this.nodes || this.nodegroups) {\n throw Error(\"Cache should never try and rebuild nodes when non-empty\");\n }\n\n this.edges = new Map<string, string[]>();\n this.nodes = new Map<string, StaticNode>();\n this.nodegroups = new Map<string, StaticNodegroup>();\n\n const graph = this.graph ?? graphManager.getGraph(this.wkrm.graphId);\n if (!graph) {\n throw Error(`Could not find graph ${this.wkrm.graphId} for resource`);\n }\n const nodes = new Map(graph.nodes.map((node) => [node.nodeid, node]));\n const nodegroups = new Map(\n graph.nodes\n .filter((node) => node.nodegroup_id)\n .map((node) => [\n node.nodegroup_id || \"\",\n new StaticNodegroup({\n cardinality: \"n\",\n legacygroupid: null,\n nodegroupid: node.nodegroup_id || \"\",\n parentnodegroup_id: null,\n }),\n ]),\n );\n for (const nodegroup of graph.nodegroups) {\n nodegroups.set(nodegroup.nodegroupid, nodegroup);\n }\n\n const edgePairs = graph.edges.map((edge) => [\n edge.domainnode_id,\n edge.rangenode_id,\n ]);\n const edges: Map<string, string[]> = edgePairs.reduce((edges, dr) => {\n const range = edges.get(dr[0]) || [];\n range.push(dr[1]);\n edges.set(dr[0], range);\n return edges;\n }, new Map<string, string[]>());\n\n this.nodes = nodes;\n this.nodegroups = nodegroups;\n this.edges = edges;\n this.nodesByAlias = new Map(\n [...nodes.values()].map((node) => [node.alias || \"\", node]),\n );\n }\n\n getNodeObjectsByAlias(): Map<string, StaticNode> {\n if (!this.nodesByAlias) {\n this.buildNodes();\n }\n if (!this.nodesByAlias) {\n throw Error(\"Could not build nodes\");\n }\n return this.nodesByAlias;\n }\n\n getEdges(): Map<string, string[]> {\n if (!this.edges) {\n this.buildNodes();\n }\n if (!this.edges) {\n throw Error(\"Could not build edges\");\n }\n return this.edges;\n }\n\n getNodeObjects(): Map<string, StaticNode> {\n if (!this.nodes) {\n this.buildNodes();\n }\n if (!this.nodes) {\n throw Error(\"Could not build nodes\");\n }\n return this.nodes;\n }\n\n getNodegroupObjects(): Map<string, StaticNodegroup> {\n if (!this.nodegroups) {\n this.buildNodes();\n }\n if (!this.nodegroups) {\n throw Error(\"Could not build nodegroups\");\n }\n return this.nodegroups;\n }\n\n getRootNode(): StaticNode {\n const nodes = this.getNodeObjects();\n const rootNode = [...nodes.values()].find((n) => !n.nodegroup_id);\n if (!rootNode) {\n throw Error(\n `COULD NOT FIND ROOT NODE FOR ${this.wkrm.modelClassName}. Does the graph ${this.graph.graphid} still exist?`,\n );\n }\n rootNode.alias = rootNode.alias || '';\n return rootNode;\n }\n\n fromStaticResource(\n resource: StaticResource,\n lazy: boolean = false,\n pruneTiles: boolean = true\n ): Promise<RIVM> {\n // TODO: implement lazy\n const wkri: RIVM = this.makeInstance(\n resource.resourceinstance.resourceinstanceid,\n resource,\n pruneTiles\n );\n\n if (!wkri.$) {\n throw Error(\"Could not load resource from static definition\");\n }\n\n return wkri.$.populate(lazy).then(() => wkri);\n }\n}\n\nfunction makeResourceModelWrapper<T extends IRIVM<T>>(\n viewModelClass: ResourceInstanceViewModelConstructor<T> | undefined,\n wkrm: WKRM,\n graph: StaticGraph,\n): ResourceInstanceViewModelConstructor<T> {\n let vmc: ResourceInstanceViewModelConstructor<T>;\n if (!viewModelClass) {\n // @ts-expect-error It may be possible to correct this, but TS does not know that\n // the dynamically-defined class meets the IRIVM interface.\n const viewModelClassObj: {[name: string]: ResourceInstanceViewModelConstructor<T>} = {\n [wkrm.modelClassName]: class extends ResourceInstanceViewModel<T> {\n static _: ResourceInstanceWrapper<T> | null;\n static __: ResourceModelWrapper<T> | null;\n },\n };\n vmc = viewModelClassObj[wkrm.modelClassName];\n } else {\n vmc = viewModelClass;\n }\n\n const wrapper = new ResourceModelWrapper<T>(wkrm, graph, vmc);\n vmc.prototype.__ = wrapper;\n return vmc;\n}\n\nclass GraphManager {\n _initialized: boolean = false;\n archesClient: ArchesClient;\n graphs: Map<string, ResourceModelWrapper<any>>;\n wkrms: Map<string, WKRM>;\n\n constructor(archesClient: ArchesClient) {\n this.archesClient = archesClient;\n this.graphs = new Map<string, ResourceModelWrapper<any>>();\n this.wkrms = new Map<string, WKRM>();\n }\n\n async initialize(configurationOptions: ConfigurationOptions | undefined = undefined) {\n if (this._initialized) {\n return;\n }\n if (configurationOptions === undefined) {\n configurationOptions = new ConfigurationOptions();\n }\n const graphJsons: GraphResult = await this.archesClient.getGraphs();\n\n let graphs: Array<[string, StaticGraphMeta]> = Object.entries(graphJsons[\"models\"]);\n const allowedGraphs = configurationOptions.graphs;\n if (allowedGraphs !== null) {\n if (allowedGraphs === false) {\n throw Error(\"No current meaning of allowedGraphs === false\");\n } else if (allowedGraphs !== true) {\n graphs = graphs.filter(\n ([graphId, _]: [string, StaticGraphMeta]) => allowedGraphs.includes(graphId),\n );\n }\n }\n graphs.forEach(([graphId, meta]: [string, StaticGraphMeta]) => {\n meta.graphid = meta.graphid || graphId;\n const wkrm = new WKRM(meta);\n this.wkrms.set(wkrm.modelClassName, wkrm);\n });\n if (configurationOptions.eagerLoadGraphs) {\n await Promise.all(graphs.map(([g]) => this.loadGraph(g)));\n }\n\n this._initialized = true;\n }\n\n async loadGraph<RIVM extends IRIVM<RIVM>>(modelClass: ResourceInstanceViewModelConstructor<RIVM> | string): Promise<ResourceModelWrapper<RIVM>> {\n let modelClassName: string;\n if (typeof modelClass == 'string') {\n modelClassName = modelClass;\n } else {\n modelClassName = modelClass.name;\n }\n\n let wkrm = this.wkrms.get(modelClassName);\n if (wkrm === undefined) {\n wkrm = [...this.wkrms.values()].find(wkrm => wkrm.graphId === modelClassName);\n if (wkrm === undefined) {\n throw Error(`Only loading graphs for which metadata is present, not ${modelClassName}`);\n }\n modelClass = wkrm.modelClassName;\n }\n\n const wrapper = this.graphs.get(wkrm.graphId);\n if (wrapper !== undefined) {\n return wrapper;\n }\n\n const bodyJson = await this.archesClient.getGraph(wkrm.meta);\n if (!bodyJson) {\n throw Error(`Could not load graph ${wkrm.graphId}`);\n }\n\n const graph = new StaticGraph(bodyJson);\n\n let model: ResourceInstanceViewModelConstructor<RIVM>;\n if (typeof modelClass == 'string') {\n modelClassName = modelClass;\n model = makeResourceModelWrapper<RIVM>(undefined, wkrm, graph);\n } else {\n modelClassName = modelClass.name;\n model = makeResourceModelWrapper<RIVM>(modelClass, wkrm, graph);\n }\n\n this.graphs.set(graph.graphid, model.prototype.__);\n return model.prototype.__;\n }\n\n async get<RIVM extends IRIVM<RIVM>>(modelClass: ResourceInstanceViewModelConstructor<RIVM> | string): Promise<ResourceModelWrapper<RIVM>> {\n let modelClassName: string;\n if (typeof modelClass == 'string') {\n modelClassName = modelClass;\n } else {\n modelClassName = modelClass.name;\n }\n\n // Initialize as a fallback\n this.initialize(undefined);\n let wkrm = this.wkrms.get(modelClassName);\n if (wkrm === undefined) {\n wkrm = [...this.wkrms.values()].find(w => w.graphId === modelClassName);\n if (wkrm === undefined) {\n throw Error(`Cannot find model requested: ${modelClassName}`);\n }\n }\n\n const wrapper = this.graphs.get(wkrm.graphId);\n if (wrapper === undefined) {\n return this.loadGraph(modelClass);\n }\n return wrapper;\n }\n\n async getResource<T extends IRIVM<T>>(resourceId: string, lazy: boolean = true, pruneTiles: boolean = true): Promise<T> {\n const rivm = await staticStore.loadOne(resourceId);\n let graph = this.graphs.get(rivm.resourceinstance.graph_id);\n if (!graph) {\n graph = await this.loadGraph(rivm.resourceinstance.graph_id);\n if (!graph) {\n throw Error(`Graph not found for resource ${resourceId}`);\n }\n }\n return graph.fromStaticResource(rivm, lazy, pruneTiles);\n }\n\n getGraph(graphId: string): StaticGraph {\n const wrapper = this.graphs.get(graphId);\n if (wrapper === undefined) {\n throw Error(`Cannot find graph requested: ${graphId}`);\n }\n return wrapper.graph;\n }\n}\n\nconst graphManager = new GraphManager(archesClient);\nviewContext.graphManager = graphManager;\n\nexport { GraphManager, graphManager, ArchesClientRemote, staticStore, WKRM, ResourceModelWrapper, GraphMutator };\n","import { staticStore } from \"./staticStore.ts\"\nimport { PseudoList } from \"./pseudos.ts\"\nimport { UrlViewModel, DateViewModel, ResourceInstanceViewModel, DomainValueViewModel, ConceptValueViewModel, NonLocalizedStringViewModel, StringViewModel, SemanticViewModel, GeoJSONViewModel, BooleanViewModel, NumberViewModel } from './viewModels';\n\nclass Cleanable extends String {\n __clean: string | undefined\n}\n\nabstract class BaseRenderer {\n async render(asset: ResourceInstanceViewModel<any>) {\n if (!asset.$) {\n throw Error(\"Cannot render unloaded asset - do you want to await asset.retrieve()?\");\n }\n const root = await (await asset.$.getRootViewModel());\n return this.renderValue(root, 0);\n }\n\n abstract renderDomainValue(value: DomainValueViewModel, _depth: number): Promise<any>;\n abstract renderDate(value: DateViewModel, _depth: number): Promise<any>;\n abstract renderConceptValue(value: ConceptValueViewModel, _depth: number): Promise<any>;\n abstract renderResourceReference(value: ResourceInstanceViewModel<any>, _depth: number): Promise<any>;\n abstract renderSemantic(value: SemanticViewModel, depth: number): Promise<any>;\n abstract renderBlock(block: {[key: string]: string} | {[key: string]: string}[], depth: number): any;\n abstract renderArray(value: any[], depth: number): Promise<any>;\n abstract renderString(value: string | StringViewModel | NonLocalizedStringViewModel, _depth: number): Promise<any>;\n abstract renderBoolean(value: boolean | BooleanViewModel, _depth: number): Promise<any>;\n abstract renderNumber(value: number | NumberViewModel, _depth: number): Promise<any>;\n abstract renderUrl(value: UrlViewModel, _depth: number): Promise<any>;\n\n async renderValue(value: any, depth: number): Promise<any> {\n let newValue;\n if (value instanceof Promise) {\n value = await value;\n }\n if (value instanceof DomainValueViewModel) {\n newValue = this.renderDomainValue(value, depth);\n } else if (value instanceof DateViewModel) {\n newValue = this.renderDate(value, depth);\n } else if (value instanceof ConceptValueViewModel) {\n newValue = this.renderConceptValue(value, depth);\n } else if (value instanceof ResourceInstanceViewModel) {\n newValue = this.renderResourceReference(value, depth);\n } else if (value instanceof SemanticViewModel) {\n newValue = this.renderSemantic(value, depth);\n } else if (value instanceof Array) {\n newValue = this.renderArray(value, depth);\n } else if (value instanceof StringViewModel || value instanceof NonLocalizedStringViewModel || typeof value === 'string') {\n newValue = this.renderString(value, depth);\n } else if (value instanceof BooleanViewModel) {\n newValue = this.renderBoolean(value, depth);\n } else if (value instanceof NumberViewModel) {\n newValue = this.renderNumber(value, depth);\n } else if (value instanceof GeoJSONViewModel) {\n newValue = this.renderBlock(await value.forJson(), depth);\n } else if (value instanceof UrlViewModel) {\n newValue = this.renderUrl(await value, depth);\n } else if (value instanceof Object) {\n newValue = this.renderBlock(value, depth);\n } else {\n newValue = value;\n }\n return newValue;\n }\n}\n\nclass Renderer extends BaseRenderer {\n async renderDomainValue(value: DomainValueViewModel, _depth: number): Promise<any> {\n return value;\n }\n\n async renderString(value: string | StringViewModel | NonLocalizedStringViewModel, _depth: number): Promise<any> {\n return `${value}`;\n }\n\n async renderNumber(value: number | NumberViewModel, _depth: number): Promise<any> {\n return `${value}`;\n }\n\n async renderBoolean(value: boolean | BooleanViewModel, _depth: number): Promise<any> {\n return value.toString();\n }\n\n async renderDate(value: DateViewModel, _depth: number): Promise<any> {\n return value;\n }\n\n async renderConceptValue(value: ConceptValueViewModel, _depth: number): Promise<any> {\n return value;\n }\n\n async renderResourceReference(value: ResourceInstanceViewModel<any>, _depth: number): Promise<any> {\n return value;\n }\n\n async renderSemantic(value: SemanticViewModel, depth: number): Promise<any> {\n return this.renderBlock(await value.toObject(), depth);\n }\n\n async renderUrl(value: UrlViewModel, _depth: number): Promise<any> {\n return value;\n }\n\n renderBlock(block: {[key: string]: string} | {[key: string]: string}[], depth: number): any {\n const renderedBlock: {[key: string]: any} = {};\n const promises: Promise<void>[] = [];\n for (const [key, value] of Object.entries(block)) {\n promises.push(\n this.renderValue(value, depth + 1).then((val: any) => { renderedBlock[key] = val; })\n );\n }\n return Promise.all(promises).then(() => renderedBlock);\n }\n\n async renderArray(value: any, depth: number): Promise<any> {\n return Promise.all(value.map((val: any) => this.renderValue(val, depth + 1)));\n }\n\n}\n\nclass MarkdownRenderer extends Renderer {\n conceptValueToUrl: ((value: ConceptValueViewModel) => string) | undefined\n dateToText: ((value: DateViewModel) => string) | undefined\n domainValueToUrl: ((value: DomainValueViewModel) => string) | undefined\n resourceReferenceToUrl: ((value: ResourceInstanceViewModel<any>) => string) | undefined\n nodeToUrl: ((value: string) => string) | undefined\n\n constructor(callbacks: {\n conceptValueToUrl: ((value: ConceptValueViewModel) => string) | undefined,\n dateToText: ((value: DateViewModel) => string) | undefined,\n domainValueToUrl: ((value: DomainValueViewModel) => string) | undefined,\n resourceReferenceToUrl: ((value: ResourceInstanceViewModel<any>) => string) | undefined,\n nodeToUrl: ((value: string) => string) | undefined,\n }) {\n super();\n this.conceptValueToUrl = callbacks.conceptValueToUrl;\n this.dateToText = callbacks.dateToText;\n this.domainValueToUrl = callbacks.domainValueToUrl;\n this.resourceReferenceToUrl = callbacks.resourceReferenceToUrl;\n this.nodeToUrl = callbacks.nodeToUrl;\n }\n\n async renderUrl(value: UrlViewModel, _depth: number): Promise<any> {\n const text = `[${value}](${value})`;\n const wrapper = new Cleanable(text);\n wrapper.__clean = value.href();\n return wrapper;\n }\n\n override async renderDomainValue(domainValue: DomainValueViewModel, _: number): Promise<any> {\n const value = await domainValue.getValue();\n const url = this.domainValueToUrl ? await this.domainValueToUrl(domainValue): null;\n const text = url ? `[${value.toString()}](${url.trim()})` : value.toString();\n const wrapper = new Cleanable(`\n <span\n class='alizarin-domain-value' data-id='${value.id}'\n >\n ${text}\n </span>`.replace(/\\n/g, ' ').trim());\n wrapper.__clean = domainValue.toString();\n return wrapper;\n }\n\n override async renderDate(date: DateViewModel, _: number): Promise<any> {\n const value = await date;\n const text = this.dateToText ? await this.dateToText(value): value.toISOString();\n const wrapper = new Cleanable(`\n <time datetime='${text}'>\n ${text}\n </time>`.replace(/\\n/g, ' ').trim());\n wrapper.__clean = text;\n return wrapper;\n }\n\n override async renderConceptValue(conceptValue: ConceptValueViewModel, _: number): Promise<any> {\n const value = await conceptValue.getValue();\n const url = this.conceptValueToUrl ? await this.conceptValueToUrl(conceptValue): null;\n const text = url ? `[${value.value}](${url.trim()})` : value.value;\n const wrapper = new Cleanable(`\n <span\n class='alizarin-concept-value' data-id='${value.id}'\n data-concept-id='${value.__concept ? value.__concept.id : \"\"}'\n data-concept-ref='$${value.__concept ? value.__concept.source : \"\"}'\n >\n ${text}\n </span>`.replace(/\\n/g, ' ').trim());\n wrapper.__clean = conceptValue.toString();\n return wrapper;\n }\n\n override async renderResourceReference(rivm: ResourceInstanceViewModel<any>, _: number): Promise<any> {\n const value = await rivm.forJson(false);\n const url = this.resourceReferenceToUrl ? await this.resourceReferenceToUrl(rivm): null;\n let title = value.title || value.type || 'Resource';\n const text = url ? `[${title}](${url.trim()})` : title;\n const resourceMetadata = await staticStore.getMeta(value.id);\n if (resourceMetadata) {\n title = resourceMetadata.name;\n }\n const wrapper = new Cleanable(`\n <span\n class='alizarin-resource-instance alizarin-related-resource' data-id='${value.id}'\n data-graph-id='${value.graphId}'\n >\n ${text}\n </span>`.replace(/\\n/g, ' ').trim());\n wrapper.__clean = rivm.toString();\n return wrapper;\n }\n}\n\nclass FlatMarkdownRenderer extends MarkdownRenderer {\n override async renderSemantic(vm: SemanticViewModel, depth: number): Promise<any> {\n const children = [...(await vm.__getChildValues()).entries()].map(([_, v]) => [v.node.alias, v.node]);\n const nodes = Object.fromEntries(await Promise.all(children));\n return super.renderSemantic(vm, depth).then(async block => {\n const text = [\n `* <span class='node-type'>${vm.__node.name}</span> &rarr;`,\n ...Object.entries(await block).map(([key, value]) => {\n const node = nodes[key];\n let nodeName = node.name;\n if (this.nodeToUrl) {\n nodeName = `[${node.name}](${this.nodeToUrl(node)})`;\n }\n if ((typeof value == 'string' || value instanceof String) && value.indexOf('\\n') != -1) {\n return ` * <span class='node-name'>${nodeName}</span> <span class='node-alias'>[*${node.alias}*]</span>:<span class='node-value'>\\n${value.split('\\n').map(x => ` ${x}`).join('\\n')}\\n </span>`;\n } else {\n return ` * <span class='node-name'>${nodeName}</span> <span class='node-alias'>[*${node.alias}*]</span>: <span class='node-value'>${value}</span>`;\n }\n }).join('\\n').split('\\n')\n ];\n if (text[1] == '') {\n text[0] += `<span class='node-empty'>&lt;empty&gt;</span>`;\n text.pop();\n }\n return text.map(line => ` ${line}`).join('\\n');\n });\n }\n\n override async renderArray(value: any, depth: number): Promise<any> {\n const rows = await super.renderArray(value, depth);\n if (value instanceof PseudoList || value.indexOf('\\n') != -1) {\n return rows.map((x: any) => `${x}`).join('\\n');\n } else {\n return rows.join(\", \");\n }\n }\n\n async renderString(value: string | StringViewModel | NonLocalizedStringViewModel, _depth: number): Promise<any> {\n if (value.indexOf('\\n') != -1) {\n value = '\\n ' + value.split('\\n').join('\\n ');\n }\n return value;\n }\n}\n\nclass JsonRenderer extends Renderer {\n async renderDate(value: DateViewModel, _depth: number): Promise<any> {\n return value.forJson();\n }\n\n async renderBoolean(value: boolean | BooleanViewModel, _depth: number): Promise<any> {\n return typeof value === \"boolean\" ? value : value.forJson();\n }\n\n async renderConceptValue(value: ConceptValueViewModel, _depth: number): Promise<any> {\n return value.forJson();\n }\n\n async renderDomainValue(value: DomainValueViewModel, _depth: number): Promise<any> {\n return value.forJson();\n }\n\n async renderResourceReference(value: ResourceInstanceViewModel<any>, _depth: number): Promise<any> {\n // TODO: decide if this makes sense: await value.retrieve();\n const val = value.forJson();\n return val;\n }\n}\n\nexport { MarkdownRenderer, JsonRenderer, Cleanable, FlatMarkdownRenderer };\n","import * as client from \"./client\";\nimport * as interfaces from \"./interfaces\";\nimport { RDM } from \"./rdm\";\nimport { ResourceModelWrapper, WKRM, graphManager, staticStore, GraphManager, GraphMutator } from \"./graphManager\";\nimport * as staticTypes from \"./static-types\";\nimport * as utils from \"./utils\";\nimport * as viewModels from \"./viewModels\";\nimport * as renderers from \"./renderers\";\nimport * as nodeConfig from \"./nodeConfig\";\n\nconst AlizarinModel = viewModels.ResourceInstanceViewModel;\nconst setCurrentLanguage = utils.setCurrentLanguage;\nconst getCurrentLanguage = utils.getCurrentLanguage;\nexport {\n AlizarinModel,\n client,\n graphManager,\n GraphManager,\n staticTypes,\n utils,\n viewModels,\n staticStore,\n RDM,\n renderers,\n interfaces,\n WKRM,\n nodeConfig,\n ResourceModelWrapper,\n GraphMutator,\n setCurrentLanguage,\n getCurrentLanguage,\n};\n","export default {}"],"names":["_a","DEFAULT_LANGUAGE","uuidv5","getCurrentLanguage","setCurrentLanguage","_b","_c","_d","_e","uuidv4","response","archesClient","resource","nodeConfig","node","promise","value","val","ids","collection","str","tile","vm","nodegroupId","newImpliedNodegroups","card","config","graph","edges","wkrm","viewModels.ResourceInstanceViewModel","utils.setCurrentLanguage","utils.getCurrentLanguage"],"mappings":";;;;;;;;AAAA,QAAA,QAAe;ACCf,WAAS,SAAS,MAAM;AACpB,WAAO,OAAO,SAAS,YAAY,MAAM,KAAK,IAAI;AAAA,EACtD;ACFA,WAAS,MAAM,MAAM;AACjB,QAAI,CAAC,SAAS,IAAI,GAAG;AACjB,YAAM,UAAU,cAAc;AAAA,IACtC;AACI,QAAI;AACJ,WAAO,WAAW,IAAI,IAAI,SAAS,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,OAAO,IAAK,MAAM,KAAM,KAAO,MAAM,IAAK,KAAM,IAAI,MAAO,IAAI,SAAS,KAAK,MAAM,GAAG,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,MAAO,IAAI,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,MAAO,IAAI,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,MAAQ,IAAI,SAAS,KAAK,MAAM,IAAI,EAAE,GAAG,EAAE,KAAK,gBAAiB,KAAO,IAAI,aAAe,KAAO,MAAM,KAAM,KAAO,MAAM,KAAM,KAAO,MAAM,IAAK,KAAM,IAAI,GAAI;AAAA,EACvb;ACNA,QAAM,YAAY,CAAE;AACpB,WAAS,IAAI,GAAG,IAAI,KAAK,EAAE,GAAG;AAC1B,cAAU,MAAM,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAAA,EACpD;AACO,WA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