{"version":3,"sources":["interface-generator.ts"],"sourcesContent":["// generates typescript code for @namespace JS classes with static @expose methods\n// (matching code to call the methods on another endpoint)\nimport { Pointer } from \"../datex_all.ts\";\nimport { $, Datex } from \"../mod.ts\";\nimport { DX_PTR, DX_SOURCE } from \"../runtime/constants.ts\";\nimport { Storage } from \"../storage/storage.ts\";\nimport { indent } from \"./indent.ts\";\n\nconst logger = new Datex.Logger(\"ts interface generator\")\n\nexport const BACKEND_EXPORT:unique symbol = Symbol(\"BACKEND_EXPORT\");\n\ntype interf = {new(...args:unknown[]):unknown};\n\n/**\n * Generates content for a TS module that can be imported to access a module remotly\n * @param module_path_or_datex_get module URL (for JS modules) or string for DATEX resource\n * @param exports list of exposed exports, all exports are exposed if not provided\n * @param caller caller identifier for logs\n * @param module_name human readable short name of the module for logs, default is module_path_or_datex_get\n* @returns TS source code for the new module\n */\nexport async function generateTSModuleForRemoteAccess(module_path_or_datex_get:URL|string, exports?: Set<string>, types = true, module_name = module_path_or_datex_get.toString(), caller?:string, ignoreFailure:Set<string>|boolean = false){\n\n\tconst values = await getModuleExports(\n\t\tmodule_path_or_datex_get, \n\t\tcaller, \n\t\texports ?? await getAllExportNames(module_path_or_datex_get),\n\t\tignoreFailure\n\t)\n\n\t// TODO: is await Datex.Supranet.init(); required?\n\n\tlet code = indent `\n\t\t/*\n\t\t\tThis Typescript/JavaScript interface code was auto-generated by the DATEX Core JS Library.\n\t\t\tAny external DATEX resources used to generate this source code are provided without warranty of any kind.\n\t\t\t${typeof module_path_or_datex_get == \"string\" ? `Original DATEX: ${module_path_or_datex_get}` :  `Original module: ${module_name}`}\n\t\t\t© ${new Date().getFullYear()} unyt.org\n\t\t*/\n\n\t\timport { Datex, datex, endpoint, property, timeout, sync } from \"datex-core-legacy\";\n\t\tconst logger = new Datex.Logger(\"${module_name.replaceAll(\"\\\\\", \"/\")}\");\\n\\n`;\n\n\tfor (const [name, val, valid, no_pointer] of values) {\n\t\tif (!valid) code += `logger.warn('Another module tried to import \"${name}\", which does not exist in this module. You might need to restart the backend.');\\n`\n\t\telse if (typeof val == \"function\" && val.constructor && (<any>val)[Datex.METADATA]) {\n\t\t\t// TODO: decroators for js only, currently fallback to getValueTSCode\n\t\t\tif (!types) {\n\t\t\t\tcode += `\\nlogger.warn('Exposed classes with decorators are not yet fully supported');\\n`;\n\t\t\t\tcode += await getValueTSCode(module_name, name, val, no_pointer, types);\n\t\t\t}\n\t\t\telse code += getClassTSCode(name, <interf>val, no_pointer);\n\t\t}\n\t\telse code += await getValueTSCode(module_name, name, val, no_pointer, types);\n\t}\n\n\n\treturn code;\n}\n\nconst implicitly_converted_primitives = new Map<string, Set<string>>().setAutoDefault(Set);\nconst implicitly_converted = new Map<string, Set<string>>().setAutoDefault(Set);\n\n\nasync function getModuleExports(path_or_specifier:URL|string, caller:string|undefined, exports:Set<string>, ignoreFailure:Set<string>|boolean = false) {\n\tconst values:[string, unknown, boolean, boolean][] = [];\n\n\ttry {\n\t\tconst module = <any> await datex.get(path_or_specifier);\n\t\tconst is_dx = typeof path_or_specifier == \"string\" || path_or_specifier.toString().endsWith(\".dx\") || path_or_specifier.toString().endsWith(\".dxb\");\n\n\t\t// add default export for imported dx\n\t\tconst inject_default = exports.has(\"default\") && is_dx;\n\n\t\tconst dx_type = Datex.Type.ofValue(module)\n\t\tconst module_is_collapsable_obj = dx_type == Datex.Type.std.Object || dx_type == Datex.Type.js.NativeObject\n\t\t\n\t\tif (module_is_collapsable_obj) {\n\t\t\tfor (const exp of exports) {\n\t\t\t\tif (exp == \"default\" && inject_default) continue;\n\t\t\t\tconst exists = !!exp && typeof module == \"object\" && exp in module;\n\t\t\t\tconst ignoreForExp = ignoreFailure instanceof Set && ignoreFailure.has(exp);\n\t\t\t\t\n\t\t\t\tif (!exists && !ignoreForExp) {\n\t\t\t\t\tif (typeof path_or_specifier == \"string\") logger.error((caller ? caller + \": \" : \"\") + \"'\" + exp + \"' is currently not an exported value in \" + path_or_specifier)\n\t\t\t\t\telse logger.error((caller ? caller + \": \" : \"\") + \"'\" + exp + \"' is currently not an exported value in module \" + path_or_specifier + \" - restart might be required\")\n\t\t\t\t}\n\t\t\t\t// only add if exists\n\t\t\t\tif (exists) {\n\t\t\t\t\tconst val = module[exp];\n\t\t\t\t\tvalues.push([exp, val, exists, dontConvertValueToPointer(exp, val)]);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\tif (inject_default) {\n\t\t\tvalues.push([\"default\", module, true, true]); // export default wrapper object, no pointer\n\t\t}\n\t}\n\tcatch (e) {\n\t\tthrow new Error(\"Could not load module '\"+path_or_specifier+\"' \" + e?.message??e);\n\t} // network error, etc.., TODO: show warning somewhere\n\t\n\n\treturn values;\n}\n\n\n\n// TODO: better solution (currently also targets other objects than uix default exports) exceptions for values that should not be converted to pointers when exported\nfunction dontConvertValueToPointer(name:string, value:any){\n\tconst type = Datex.Type.ofValue(value);\n\treturn name == \"default\" && (type == Datex.Type.std.Object || type == Datex.Type.js.NativeObject);\n}\n\n/**\n * Returns a set of all export names for a module\n */\nasync function getAllExportNames(path:URL|string) {\n\tconst module = await datex.get(path);\n\tconst dx_type = Datex.Type.ofValue(module)\n\tconst names = module && (dx_type == Datex.Type.std.Object || dx_type == Datex.Type.js.NativeObject) ? Object.keys(module) : [];\n\treturn new Set(names);\n\t// try {\n\t\t\n\t// }\n\t// catch { // network error, etc., TODO: warning somewhere\n\t// \treturn new Set<string>(); \n\t// }\n}\n\n\nasync function getValueTSCode(module_name:string, name:string, value: any, no_pointer = false, types = true) {\n\tlet code = \"\";\n\n\tconst is_datex_module = module_name.endsWith(\".dx\") || module_name.endsWith(\".dxb\")\n\n\tconst type = Datex.Type.ofValue(value)\n\tconst is_pointer = (value instanceof Datex.ReactiveValue) || !!(Datex.Pointer.getByValue(value));\n\tconst original_value = value;\n\n\t// if (no_pointer) {\n\t// \t// no pointer\n\t// }\n\n\t// log warning for primitive non-pointer values (cannot be converted to pointer)\n\tif (type.is_primitive && (!is_pointer || implicitly_converted_primitives.get(module_name)?.has(name))) {\n\t\tif (!is_datex_module) code += name ? `logger.warn('The export \"${name}\" cannot be converted to a shared value. Consider explicitly converting it to a primitive pointer using $().');\\n` : `logger.warn('The default export cannot be converted to a shared value. Consider explicitly converting it to a primitive pointer using $().');\\n`\n\t\timplicitly_converted_primitives.getAuto(module_name).add(name);\n\t}\n\n\t// other value -> create pointers\n\telse {\n\t\tif (implicitly_converted.get(module_name)?.has(name)) {\n\t\t\tif (!is_datex_module)  code += name ? `logger.warn('The export \"${name}\" was implicitly converted to a shared pointer value. This might have unintended side effects. Consider explicitly converting it to a ${type} pointer using $().');\\n` : `logger.warn('The default export was implicitly converted to a shared pointer value. This might have unintended side effects. Consider explicitly converting it to a ${type} pointer using $().');\\n`\n\t\t}\n\t\t\n\t\t// special convertions for non-pointer values\n\t\tif (!is_pointer) {\n\t\t\t// convert es6 class with static properties\n\t\t\tif (typeof value == \"function\" && /^\\s*class/.test(value.toString())) {\n\t\t\t\t// convert static class to normal object\n\t\t\t\toriginal_value[BACKEND_EXPORT] = true;\n\t\t\t\tvalue = {}\n\t\t\t\tfor (const prop of Object.getOwnPropertyNames(original_value)) {\n\t\t\t\t\tif (prop != \"length\" && prop != \"name\" && prop != \"prototype\") {\n\t\t\t\t\t\tvalue[prop] = typeof original_value[prop] == \"function\" ? $(Datex.Function.createFromJSFunction(original_value[prop], original_value)) : $(original_value[prop]);\n\t\t\t\t\t\tvalue[prop][BACKEND_EXPORT] = true;\n\t\t\t\t\t\tif (original_value[prop]!=undefined) original_value[prop][BACKEND_EXPORT] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// convert Function to DATEX Function\n\t\t\telse if (value instanceof Function) {\n\t\t\t\tvalue[BACKEND_EXPORT] = true;\n\t\t\t\tvalue = Datex.Function.createFromJSFunction(value);\n\t\t\t}\n\n\t\t\t// log warning for non-pointer arrays and object (ignore defaults aka 'no_pointer')\n\t\t\telse if ((type == Datex.Type.std.Array || type == Datex.Type.std.Object || type == Datex.Type.js.NativeObject) && !no_pointer) {\n\t\t\t\tif (!is_datex_module) code += name ? `logger.warn('The export \"${name}\" was implicitly converted to a shared pointer value. This might have unintended side effects. Consider explicitly converting it to a ${type} pointer using $().');\\n` : `logger.warn('The default export was implicitly converted to a shared pointer value. This might have unintended side effects. Consider explicitly converting it to a ${type} pointer using $().');\\n`\n\t\t\t\timplicitly_converted.getAuto(module_name).add(name);\n\t\t\t}\n\t\t}\n\n\t\t// TODO: cleanup unused pointer ids\n\t\tconst pointerId = await Storage.loadOrCreate(\"ptrid::\" + module_name + \"::\" + name, ()=>Pointer.normalizePointerId(Pointer.getUniquePointerID()));\n\t\tconst resolvedPointer = Pointer.createOrGet(value, undefined, undefined, undefined, undefined, pointerId.val)\n\t\t// only collapses non-primitive pointer values\n\t\tvalue = Pointer.collapseValue(resolvedPointer);\n\n\t\ttry {\n\t\t\tvalue[BACKEND_EXPORT] = true;\n\t\t}\n\t\tcatch {}\n\n\t\t// add public permission\n\t\tconst ptr = Datex.Pointer.pointerifyValue(value);\n\t\tif (ptr instanceof Datex.Pointer) ptr.grantPublicAccess(true)\n\t}\n\n\t// disable garbage collection\n\tconst ptr = <Datex.Pointer> Datex.Pointer.getByValue(value);\n\tif (ptr) {\n\t\tptr.is_persistent = true;\n\t\t// fake pointer binding for original value\n\t\ttry {\n\t\t\t// @ts-ignore\n\t\t\toriginal_value[DX_PTR] = ptr;\n\t\t}\n\t\tcatch {}\n\t\n\t}\n\n\tconst loader = value?.[DX_SOURCE] ? `await datex.get('${value[DX_SOURCE]}')` : `await datex('${Datex.Runtime.valueToDatexStringExperimental(value)}')`\n\tcode += `${name =='default' ? 'export default' : 'export const ' + name + ' ='} ${loader}${types ? ` as ${getValueTSType(value)}` : ''};\\n`;\n\treturn code;\n}\n\n\nfunction getValueDTSCode(module_name:string, name:string, value: any, no_pointer = false) {\n\tlet code = \"\";\n\n\tif (name =='default') {\n\t\tname = `_default`;\n\t\tcode += `declare const ${name}: ${getValueTSType(value)};\\nexport default ${name};\\n`\n\t}\n\telse {\n\t\tcode += `export const ${name}: ${getValueTSType(value)}\\n`\n\t}\n\n\treturn code;\n}\n\n\nfunction getClassTSCode(name:string, interf: interf, no_pointer = false) {\n\n\tconst metadata = (<any>interf)[Datex.METADATA];\n\tconst meta_scope_name = metadata[Datex.Decorators.NAMESPACE]?.constructor;\n\tlet meta_endpoint = metadata[Datex.Decorators.SEND_FILTER]?.constructor;\n\tif (meta_endpoint == true) meta_endpoint = Datex.Runtime.endpoint; // deafult is local endpoint\n\tconst meta_is_sync = metadata[Datex.Decorators.IS_SYNC]?.constructor;\n\tconst meta_is_sealed = metadata[Datex.Decorators.IS_SEALED]?.constructor;\n    const meta_timeout = metadata[Datex.Decorators.TIMEOUT]?.public;\n\n\tlet fields = \"\";\n\n\t// static and non-static properties\n\tconst properties = metadata[Datex.Decorators.PROPERTY]?.public;\n\t// console.log(\"props\",metadata)\n\t\n\tfor (const prop of Object.keys(properties??{})) {\n\t\t// console.log((<any>interf.prototype)[prop]?.toString());\n\t\tfields += `\n\t@property${meta_timeout?.[prop]?` @timeout(${meta_timeout[prop]})`:''} public ${prop}() {}\n`\n\t}\n\n\tconst static_properties = metadata[Datex.Decorators.STATIC_PROPERTY]?.public;\n\t\n\tfor (const prop of Object.keys(static_properties??{})) {\n\t\t// console.log((<any>interf)[prop]?.toString());\n\t\tfields += `\n\t@property${meta_timeout?.[prop]?` @timeout(${meta_timeout[prop]})`:''} public static ${prop}() {}\n`\n\t}\t\n\t\n\n\treturn `\n${meta_endpoint?`@endpoint(\"${meta_endpoint.toString()}\"${meta_scope_name?`, \"${meta_scope_name}\"`:''})`:''}${meta_is_sync?' @sync':''}${meta_is_sync?' @sealed':''} export ${name == 'default' ? 'default ' : ''}class ${(name == 'default')?'DatexValue' : name} {\n${fields}\n}\n`\n}\n\n\nfunction getValueTSType(value:any) {\n\tconst dx_type = Datex.Type.ofValue(value).root_type;\n\tconst [ts_type, is_primitive] = DX_TS_TYPE_MAP.get(dx_type)??[];\n\tconst is_pointer = (value instanceof Datex.Value) || !!(Datex.Pointer.getByValue(value));\n\tconst wrap_pointer = is_pointer && is_primitive;\n\n\tif (wrap_pointer) return ts_type ? `Datex.Pointer<${ts_type}>` : 'any'\n\telse return ts_type ?? 'any';\n}\n\n\n// generate d.ts file (for DATEX module)\nexport async function generateDTSModuleForRemoteAccess(module_path_or_datex_get:URL|string, exports?: Set<string>, module_name = module_path_or_datex_get.toString(), reference?: string, ignoreFailure:Set<string>|boolean = false) {\n\t\n\tconst values = await getModuleExports(\n\t\tmodule_path_or_datex_get, \n\t\treference, \n\t\texports ?? await getAllExportNames(module_path_or_datex_get),\n\t\tignoreFailure\n\t)\n\t\n\t\n\tlet code = indent `\n\t\t/*\n\t\t\tThis TypeScript definition file was auto-generated by the DATEX Core JS Library.\n\t\t\t${typeof module_path_or_datex_get == \"string\" ? `Original DATEX: ${module_path_or_datex_get}` : `Original DATEX module: ${module_path_or_datex_get}`}\n\t\t\t© ${new Date().getFullYear()} unyt.org\n\t\t*/\n\t\t\n\t\timport { Datex } from \"datex-core-legacy\";\\n\\n`\n\n\tfor (const [name, val, valid, no_pointer] of values) {\n\t\tif (!valid) {}\n\t\telse if (typeof val == \"function\" && val.constructor && (<any>val)[Datex.METADATA]) code += getClassTSCode(name, <interf>val, no_pointer);\n\t\telse code += getValueDTSCode(module_name, name, val, no_pointer);\n\t}\n\n\treturn code;\n}\n\n\nexport const DX_TS_TYPE_MAP = new Map<Datex.Type,[string,boolean]>([\n\t[Datex.Type.std.text, [\"string\", true]],\n\t[Datex.Type.std.integer, [\"bigint\", true]],\n\t[Datex.Type.std.decimal, [\"number\", true]],\n\t[Datex.Type.std.quantity, [\"Datex.Quantity<any>\", false]],\n\t[Datex.Type.std.url, [\"URL\", false]],\n\t[Datex.Type.std.boolean, [\"boolean\", true]],\n\t[Datex.Type.std.void, [\"undefined\", true]],\n\t[Datex.Type.std.null, [\"null\", true]],\n\t[Datex.Type.std.time, [\"Datex.Time\", false]],\n\t[Datex.Type.std.endpoint, [\"Datex.Endpoint\", false]],\n\t[Datex.Type.std.Error, [\"Datex.Error\", false]],\n\t[Datex.Type.std.Tuple, [\"Datex.Tuple\", false]],\n\t[Datex.Type.std.Type, [\"Datex.Type\", false]],\n\n\t[Datex.Type.std.Any, [\"any\", false]],\n\t[Datex.Type.std.Object, [\"Record<string,any>\", false]],\n\t[Datex.Type.js.NativeObject, [\"Record<string,any>\", false]],\n\t[Datex.Type.std.Array, [\"any[]\", false]],\n\t[Datex.Type.std.Function, [\"(...args:any[]) => Promise<any>\", false]],\n\t[Datex.Type.std.Map, [\"Map<any,any>\", false]],\n\t[Datex.Type.std.Set, [\"Set<any>\", false]],\n\n\t[Datex.Type.get('std','html'), [\"HTMLElement\", false]],\n\t[Datex.Type.get('std','html','div'), [\"HTMLDivElement\", false]],\n])\n"],"names":["Pointer","$","Datex","DX_PTR","DX_SOURCE","Storage","indent","logger","Logger","BACKEND_EXPORT","Symbol","generateTSModuleForRemoteAccess","module_path_or_datex_get","exports","types","module_name","toString","caller","ignoreFailure","values","getModuleExports","getAllExportNames","code","Date","getFullYear","replaceAll","name","val","valid","no_pointer","constructor","METADATA","getClassTSCode","getValueTSCode","implicitly_converted_primitives","Map","setAutoDefault","Set","implicitly_converted","path_or_specifier","module","datex","get","is_dx","endsWith","inject_default","has","dx_type","Type","ofValue","std","Object","js","NativeObject","exp","exists","ignoreForExp","error","push","dontConvertValueToPointer","e","Error","message","value","type","path","keys","is_datex_module","is_pointer","ReactiveValue","getByValue","original_value","is_primitive","getAuto","add","test","prop","getOwnPropertyNames","Function","createFromJSFunction","undefined","Array","pointerId","loadOrCreate","normalizePointerId","getUniquePointerID","resolvedPointer","createOrGet","collapseValue","ptr","pointerifyValue","grantPublicAccess","is_persistent","loader","Runtime","valueToDatexStringExperimental","getValueTSType","getValueDTSCode","interf","metadata","meta_scope_name","Decorators","NAMESPACE","meta_endpoint","SEND_FILTER","endpoint","meta_is_sync","IS_SYNC","IS_SEALED","meta_timeout","TIMEOUT","public","fields","properties","PROPERTY","static_properties","STATIC_PROPERTY","root_type","ts_type","DX_TS_TYPE_MAP","Value","generateDTSModuleForRemoteAccess","reference","text","integer","decimal","quantity","url","boolean","void","null","time","Tuple","Any"],"mappings":"AAEA,SAASA,OAAO,QAAQ,kBAAkB;AAC1C,SAASC,CAAC,EAAEC,KAAK,QAAQ,YAAY;AACrC,SAASC,MAAM,EAAEC,SAAS,QAAQ,0BAA0B;AAC5D,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,MAAM,QAAQ,cAAc;AAErC,IAAMC,SAAS,IAAIL,MAAMM,MAAM,CAAC;AAEhC,OAAO,MAAMC,iBAA+BC,OAAO,kBAAkB;AAYrE,OAAO,eAAeC,gCAAgCC,wBAAmC,EAAEC,OAAqB,EAAEC,QAAQ,CAAA,CAAI,EAAEC,cAAcH,yBAAyBI,QAAQ,EAAE,EAAEC,MAAc,EAAEC,gBAAoC,CAAA,CAAK;IAE3O,IAAMC,SAAS,MAAMC,iBACpBR,0BACAK,QACAJ,WAAW,MAAMQ,kBAAkBT,2BACnCM,gBAKGI,OAAOhB,MAAO,CAAC;;;;GAIjB,EAAE,AAAmC,YAAnC,OAAOM,2BAAuC,CAAC,gBAAgB,EAAEA,yBAAyB,CAAC,GAAI,CAAC,iBAAiB,EAAEG,YAAY,CAAC,CAAC;KACjI,EAAE,IAAIQ,OAAOC,WAAW,GAAG;;;;mCAIG,EAAET,YAAYU,UAAU,CAAC,MAAM,KAAK,OAAO,CAAC;IAE9E,KAAK,IAAM,CAACC,MAAMC,KAAKC,OAAOC,WAAW,IAAIV,OACvCS,QACI,AAAc,cAAd,OAAOD,OAAqBA,IAAIG,WAAW,IAAI,AAAMH,GAAI,CAACzB,MAAM6B,QAAQ,CAAC,GAE5EjB,QAIAQ,QAAQU,eAAeN,MAAcC,KAAKE,cAF9CP,QADQ,CAAC,+EAA+E,CAAC,GACjF,MAAMW,eAA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