{"version":3,"sources":["endpoint_config.ts"],"sourcesContent":["// store and read endpoint config (name, keys, ...)\n\nimport { Deno, logger, projectRootURL } from \"../utils/global_values.ts\";\nimport { client_type } from \"../utils/constants.ts\";\nimport { Endpoint } from \"../types/addressing.ts\";\nimport { Crypto } from \"./crypto.ts\";\nimport { Runtime } from \"./runtime.ts\";\nimport { Tuple } from \"../types/tuple.ts\";\nimport { cache_path } from \"./cache_path.ts\";\nimport { DatexObject } from \"../types/object.ts\";\nimport { ReactiveValue } from \"./pointers.ts\";\nimport { normalizePath } from \"../utils/normalize-path.ts\";\n\ntype channel_type = 'websocket'|'http'\ntype node_config = {\n\tchannels: Record<channel_type, unknown>,\n\tkeys: [ArrayBuffer, ArrayBuffer]\n}\n\nexport interface EndpointConfigData {\n\tendpoint?:Endpoint|string\n\tkeys?: Crypto.ExportedKeySet\n\tconnect?:boolean // default true\n\tws_relay?: boolean // create ws relay on backend server (default: true)\n\ttemporary?:boolean // default false\n\tnodes?: Map<Endpoint, node_config>,\n\tblockchain_relay?: Endpoint // custom blockchain relay endpoint (default: @+unyt2)\n}\n\n\nclass EndpointConfig implements EndpointConfigData {\n\n\tpublic DX_FILE_NAME = '.dx';\n\n\t/* CONFIG VALUES */\n\t#endpoint?:Endpoint\n\tpublic keys?: Crypto.ExportedKeySet\n\tpublic connect?:boolean\n\tpublic temporary?:boolean\n\tpublic ws_relay?:boolean\n\tpublic nodes?: Map<Endpoint, node_config>\n\tpublic blockchain_relay?: Endpoint\n\t/*****************/\n\n\tpublic usingHTTPoverDATEX = false;\n\n\t// not saved in endpoint config, loaded from https://unyt.cc/nodes.dx\n\tpublic publicNodes?: Map<Endpoint, node_config>\n\n\tpublic get endpoint() {\n\t\treturn ReactiveValue.collapseValue(this.#endpoint, true, true)!;\n\t}\n\tpublic set endpoint(endpoint: Endpoint|string|undefined) {\n\t\tthis.#endpoint = typeof endpoint == \"string\" ? Endpoint.get(endpoint) as Endpoint : endpoint;\n\t}\n\n\n\n\t#nodesInitialized = false;\n\t// list of available nodes with public keys\n\t#node_channels_by_type = new Map<string, [Endpoint, unknown][]>();\n\n\n\t/**\n\t * Load the endpoint config data from a .dx file\n\t * @param path URL of the .dx file\n\t */\n\tasync load(path?:URL) {\n\t\tlet config:EndpointConfigData|null = null;\n\n\t\tif (client_type==\"deno\") {\n\t\t\tlet config_file = new URL('./'+this.DX_FILE_NAME, cache_path);\n\t\t\t// try to open .dx from cache\n\t\t\ttry {\n\t\t\t\tconst file = Deno.openSync(normalizePath(config_file));\n\t\t\t\tfile.close()\n\t\t\t\t// console.log(\"using endpoint config cache: \" + config_file);\n\t\t\t} \n\t\t\t// use normal dx file\n\t\t\tcatch {\n\t\t\t\tif (!path) path = new URL('./'+this.DX_FILE_NAME, projectRootURL)\n\t\t\t\tconfig_file = path;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconfig = await datex.get(config_file);\n\t\t\t\tlogger.debug(\"using endpoint config: \" + config_file);\n\t\t\t}\n\t\t\tcatch (e){\n\t\t\t\t// ignore if no .dx file found\n\t\t\t\tif (e instanceof Deno.errors.NotFound) {}\n\t\t\t\telse {\n\t\t\t\t\tlogger.error `Could not read config file ${config_file}: ${e.toString()}`;\n\t\t\t\t\tthrow \"invalid config file\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if (client_type == \"browser\") {\n\t\t\t// get config from cache\n\t\t\tconst serialized = this.storage?.getItem(this.storageId);\n\t\t\tif (serialized) {\n\t\t\t\tconfig = <EndpointConfigData> await Runtime.executeDatexLocally(serialized, undefined, undefined, globalThis.location?.href ? new URL(globalThis.location.href) : undefined)\n\t\t\t}\n\n\t\t\tif (!Runtime.OPTIONS.USE_DX_CONFIG) {\n\t\t\t\tconsole.log(\"Skipping endpoint config file\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// try to get from .dx url\n\t\t\t\tif (!path) path = new URL('/'+this.DX_FILE_NAME, globalThis.location.href)\n\t\t\t\t\ttry {\n\t\t\n\t\t\t\t\t\tconst dxResponse = await fetch(path);\n\t\t\n\t\t\t\t\t\t// check headers for http-over-datex\n\t\t\t\t\t\tif (dxResponse.headers.get(\"x-http-over-datex\") == \"yes\") this.usingHTTPoverDATEX = true;\n\t\t\n\t\t\t\t\t\tif (dxResponse.ok) {\n\t\t\t\t\t\t\tconst content = await dxResponse.text();\n\t\t\t\t\t\t\tconst configUpdate = await Runtime.executeDatexLocally(content, undefined, undefined, path) as EndpointConfigData;\n\t\t\t\t\t\t\tif (!config) {\n\t\t\t\t\t\t\t\tconfig = configUpdate;\n\t\t\t\t\t\t\t\tlogger.info(\"loaded endpoint config from \" + path);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tfor (const [key, value] of DatexObject.entries(configUpdate as Record<string|symbol,unknown>)) {\n\t\t\t\t\t\t\t\t\tDatexObject.set(config as Record<string|symbol,unknown>, key as string, value);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlogger.debug(\"updated endpoint config from \" + path);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// ignore if no .dx file found\n\t\t\n\t\t\t\t\t}\n\t\t\t\t\tcatch (e) {\n\t\t\t\t\t\tlogger.warn `Could not read config file ${path}: ${e.toString()}`;\n\t\t\t\t\t\t// ignore if no .dx file found\n\t\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse {\n\t\t\tlogger.debug(\"Cannot load endpoint config file for client type '\" + client_type + \"'\")\n\t\t}\n\n\t\tif (config!=null) {\n\t\t\tconst configObj = config instanceof Tuple ? config.toObject() : config;\n\t\t\tthis.set(configObj);\n\t\t}\n\n\t\tif (this.storage) {\n\t\t\tif (this.storage === localStorage)\n\t\t\t\tsessionStorage.removeItem(this.storageId);\n\t\t\telse\n\t\t\t\tlocalStorage.removeItem(this.storageId);\n\t\t}\n\n\t\t// set custom blockchain relay\n\t\tif (this.blockchain_relay) {\n\t\t\tif (!Runtime.Blockchain) throw new Error(\"Runtime.Blockchain not initialized\");\n\t\t\tif (this.blockchain_relay instanceof Endpoint) Runtime.Blockchain.setRelayNode(this.blockchain_relay);\n\t\t\telse throw new Error(\"blockchain_relay must be an Endpoint\")\n\t\t}\n\n\t\t// load public nodes from unyt.org\n\t\tif (Runtime.OPTIONS.USE_PUBLIC_NODES) await this.loadPublicNodes();\n\t\tawait this.initNodes()\n\t}\n\t\n\tget storageId() {\n\t\treturn \"endpoint_config::\"+(globalThis.location?.origin ?? '');\n\t}\n\tget locationId() {\n\t\treturn \"endpoint_config_location::\"+(globalThis.location?.origin ?? '');\n\t}\n\n\t/**\n\t * Set the endpoint config data manually\n\t */\n\tset(data: EndpointConfigData) {\n\t\tthis.endpoint = data.endpoint;\n\t\tthis.connect = data.connect;\n\t\tthis.ws_relay = data.ws_relay;\n\t\tthis.temporary = data.temporary;\n\t\tthis.keys = data.keys;\n\t\tthis.nodes = data.nodes;\n\t\tthis.blockchain_relay = data.blockchain_relay;\n\t}\n\n\tsave() {\n\t\tconst serialized = Runtime.valueToDatexString(new Tuple({endpoint:this.#endpoint, connect:this.connect, ws_relay:this.ws_relay, temporary:this.temporary, keys:this.keys, nodes:this.nodes, blockchain_relay:this.blockchain_relay}));\n\n\t\tif (client_type==\"deno\") {\n\t\t\ttry {\n\t\t\t\ttry {\n\t\t\t\t\tDeno.openSync(normalizePath(cache_path));\n\t\t\t\t} catch {\n\t\t\t\t\tDeno.mkdirSync(normalizePath(cache_path), {recursive:true});\n\t\t\t\t}\n\t\t\t\tconst config_file = new URL('./' + this.DX_FILE_NAME, cache_path);\n\t\t\t\t// make writable if file already exists\n\t\t\t\ttry {\n\t\t\t\t\tDeno.chmodSync(normalizePath(config_file), 0o700);\n\t\t\t\t} catch {}\n\t\t\t\tDeno.writeTextFileSync(normalizePath(config_file), serialized)\n\t\t\t\t// make readonly\n\t\t\t\ttry {\n\t\t\t\t\t// not supported by windows\n\t\t\t\t\tDeno.chmodSync(normalizePath(config_file), 0o444);\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.log(e)\n\t\t\t\tlogger.error(\"Cannot save endpoint config cache file\");\n\t\t\t}\t\t\t\n\t\t}\n\t\telse if (client_type == \"worker\") {\n\t\t\t// ignore not saving in worker\n\t\t}\n\t\telse if (!this.storage)\n\t\t\tlogger.warn(\"Cannot save endpoint config\");\n\t\telse {\n\t\t\t// remove endpoint config from previous storage\n\t\t\tif (this.storage == globalThis.localStorage) globalThis.sessionStorage.removeItem(this.storageId)\n\t\t\telse globalThis.localStorage.removeItem(this.storageId)\n\n\t\t\tlocalStorage.setItem(this.locationId, this.temporary ? \"session\" : \"persistent\");\n\t\t\tthis.storage.setItem(this.storageId, serialized);\n\t\t}\n\t}\n\n\tget storage() {\n\t\treturn (this.temporary ?? globalThis.localStorage?.getItem(this.locationId) === \"session\") ?\n\t\t\tglobalThis.sessionStorage :\n\t\t\tglobalThis.localStorage;\n\t}\n\n\tclear() {\n\t\tthis.#endpoint = undefined;\n\t\tthis.connect = undefined;\n\t\tthis.temporary = undefined;\n\t\tthis.ws_relay = undefined;\n\t\tthis.keys = undefined;\n\t\tthis.nodes = undefined;\n\t\tthis.blockchain_relay = undefined;\n\n\t\tif (client_type==\"deno\") {\n\t\t\tconst config_file = new URL('./' + this.DX_FILE_NAME, cache_path);\n\t\t\tDeno.removeSync(config_file)\n\t\t}\n\t\telse if (this.storage) this.storage.removeItem(this.storageId);\n\t}\n\n\t/**\n\t * get public node keys + connection points from unyt.cc/nodes.dx\n\t */\n\tprivate async loadPublicNodes() {\n\t\t// get public nodes\n\t\tif (!this.publicNodes) {\n\t\t\t// try to get from unyt.cc\n\t\t\ttry {\n\t\t\t\tthis.publicNodes = await datex.get('https://unyt.cc/nodes.dx');\n\t\t\t}\n\t\t\t// otherwise try to get local file (only backend)\n\t\t\tcatch {\n\t\t\t\tthis.publicNodes = await datex.get(new URL('../dx_data/nodes.dx', import.meta.url));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * register custom + public nodes as interface channels\n\t */\n\tprivate initNodes(){\n\t\tif (this.#nodesInitialized) return;\n\t\tthis.#nodesInitialized = true;\n\n\t\tfor (const [node, {channels, keys:[verify_key, enc_key]}] of [...(this.nodes??new Map()).entries(), ...(this.publicNodes??new Map()).entries()]) {\n\t\t\t// save keys\n\t\t\tCrypto.bindKeys(node, verify_key, enc_key);\n\n\t\t\t// save interface info in node\n\t\t\tnode.setInterfaceChannels(channels);\n\t\t\t// save in list\n\t\t\tfor (const [channel_name, channel_data] of Object.entries(channels||{})) {\n\t\t\t\tif (!this.#node_channels_by_type.has(channel_name)) this.#node_channels_by_type.set(channel_name, []);\n\t\t\t\tthis.#node_channels_by_type.get(channel_name)!.push([node, channel_data]);\n\t\t\t}\n\t\t}\n\t}\n\n\t// select a node that provides a channel of the requested type\n\tpublic getNodeWithInterfaceType(types:string[], force_use_node?:Endpoint):[Endpoint|null, string|null] {\n\t\tfor (const type of types) {\n\t\t\tconst list = this.#node_channels_by_type.get(type);\n\t\t\tif (list?.length) {\n\t\t\t\tif (!force_use_node) return [list[0][0], type]; // select first node\n\t\t\t\telse { // check if the force_use_node is in the list\n\t\t\t\t\tfor (const [node, _data] of list) {\n\t\t\t\t\t\tif (node == force_use_node) return [node, type];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [null, null];       \n\t}\n\n\n}\n\nexport const endpoint_config = new EndpointConfig();"],"names":["Deno","logger","projectRootURL","client_type","Endpoint","Crypto","Runtime","Tuple","cache_path","DatexObject","ReactiveValue","normalizePath","EndpointConfig","DX_FILE_NAME","keys","connect","temporary","ws_relay","nodes","blockchain_relay","usingHTTPoverDATEX","publicNodes","endpoint","collapseValue","get","Map","load","path","config","config_file","URL","openSync","close","datex","debug","e","errors","NotFound","error","toString","serialized","storage","getItem","storageId","executeDatexLocally","undefined","globalThis","location","href","OPTIONS","USE_DX_CONFIG","dxResponse","fetch","headers","ok","content","text","configUpdate","key","value","entries","set","info","warn","console","log","configObj","toObject","localStorage","sessionStorage","removeItem","Blockchain","Error","setRelayNode","USE_PUBLIC_NODES","loadPublicNodes","initNodes","origin","locationId","data","save","valueToDatexString","mkdirSync","recursive","chmodSync","writeTextFileSync","setItem","clear","removeSync","url","node","channels","verify_key","enc_key","channel_name","channel_data","bindKeys","setInterfaceChannels","Object","has","push","getNodeWithInterfaceType","types","force_use_node","type","list","length","_data","endpoint_config"],"mappings":"AAEA,SAASA,IAAI,EAAEC,MAAM,EAAEC,cAAc,QAAQ,4BAA4B;AACzE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,QAAQ,QAAQ,yBAAyB;AAClD,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,aAAa,QAAQ,6BAA6B;AAmB3D,IAAA,AAAMC,iBAAN,MAAMA;IAEEC,eAAe,MAAM;IAG5B,CAAA,QAAS,CAAU;IACZC,KAA4B;IAC5BC,QAAgB;IAChBC,UAAkB;IAClBC,SAAiB;IACjBC,MAAkC;IAClCC,iBAA2B;IAG3BC,qBAAqB,CAAA,EAAM;IAG3BC,YAAwC;IAE/C,IAAWC,WAAW;QACrB,OAAOZ,cAAca,aAAa,CAAC,IAAI,CAAC,CAAA,QAAS,EAAE,CAAA,GAAM,CAAA;IAC1D;IACA,IAAWD,SAASA,QAAmC,EAAE;QACxD,IAAI,CAAC,CAAA,QAAS,GAAG,AAAmB,YAAnB,OAAOA,WAAuBlB,SAASoB,GAAG,CAACF,YAAwBA;IACrF;IAIA,CAAA,gBAAiB,GAAG,CAAA,EAAM;IAE1B,CAAA,qBAAsB,GAAG,IAAIG,MAAqC;IAOlE,MAAMC,KAAKC,IAAS,EAAE;QACrB,IAAIC,SAAiC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