{"version":3,"sources":["js_interface.ts"],"sourcesContent":["import { Type } from \"../types/type.ts\";\nimport { Endpoint } from \"../types/addressing.ts\";\nimport type { fundamental } from \"../types/abstract_types.ts\";\nimport type { Class } from \"../utils/global_types.ts\";\nimport { Pointer } from \"./pointers.ts\";\nimport { INVALID, NOT_EXISTING } from \"./constants.ts\";\n\n/** create a custom DATEX JS Interface for a type with handlers \n *  \n * - serialize efficiently with the serialize function and de-serialize in the cast function\n * - do not use @sync classes in combination with an additional js_interface_configuration!; \n *   @sync classes are handled like <std:Object> and proxified per default\n*/\nexport type js_interface_configuration<T=any> = {\n    __type?: Type<T>,\n    // either type or generate_type is needed\n    get_type?: (value:T)=>Type<T>, // get a specific <Type> for a value (with variation/parameters)\n    cast?: (value:any, type:Type<T>, context?:any, origin?:Endpoint, assigningPtrId?: string)=>T|typeof INVALID,     // a function that casts a given value to a value of the type of the pseudo cast, if possible\n    cast_no_tuple?: (value:any, type:Type<T>, context?:any, origin?:Endpoint, assigningPtrId?: string)=>T|typeof INVALID,     // a function that casts a given value to a value of the type of the pseudo cast, if possible - ignores construct (cast from tuple)\n    serialize?: (value:T)=>fundamental, // a function that creates a fundamental value from a given pseudo class value\n                                                // if not provided, assume the value is already a DATEX fundamental value\n    empty_generator?: (type:Type<T>, context?:any, origin?:Endpoint)=>any // return an default empty value if the type is casted from <Void>\n    override_silently?: (ref:T, value:T)=>void, // reset the reference, copy the value to the ref silently\n\n    wrap_transform?: (value: T) => any, // returns a special wrapper value to use instead of the initial value of a transform pointer,\n    unwrap_transform?: (value: any) => T, // returns the original value from a wrapped value\n    handle_transform?: (value: T, pointer: Pointer<T>) => void, // gets called when a transform function produces a new value, default override behaviour is ignored\n    allow_transform_value?: (type: Type<T>, pointer: Pointer<T>) => string|true, // returns true if the value can be wrapped with wrap transform, allows pointer union types\n    class?: Class<T>, // the corresponding JS class or a prototype\n    no_instanceof?: boolean, // if true, don't use instanceof checks for the class, instead use isPrototypeOf\n    prototype?: object, // the inherited JS prototype\n    detect_class?: (value:any)=>boolean, // a function that returns whether the value has the type of the pseudo class\n\n    is_normal_object?: boolean, // if true, handle properties like object properties (no custom handling), ignore add_property, set_property, etc.\n\n    get_reactive_methods_object?: (ptr: Pointer) => Record<string, any>, // returns an object that is mapped to $ methods on the ptr value\n\n    type_params_match?: (params:any[], against_params:any[])=>boolean, // implement for parmetrized types -> return if parameters match\n\n    set_property?: (parent:T, key:any, value:any, exclude?:Endpoint)=>void,\n    get_property?: (parent:T, key:any)=>any,\n    has_property?: (parent:T, key:any)=>boolean,\n    delete_property?: (parent:T, key:any, exclude?:Endpoint)=>void,\n    clear?: (parent:T, exclude?:Endpoint)=>void,\n    apply_value?: (parent:T, args:any[])=>Promise<any>|any,\n\n    set_property_silently?: (parent:T, key:any, value:any, pointer:Pointer)=>void,\n    get_property_silently?: (parent:T, key:any, pointer:Pointer)=>any,\n    delete_property_silently?: (parent:T, key:any, pointer:Pointer)=>void,\n    clear_silently?: (parent:T, pointer:Pointer)=>void,\n\n    keys?: (parent:T)=>Promise<Iterable<any>>|Iterable<any>, // get keys for value\n    values?: (parent:T)=>Promise<Iterable<any>>|Iterable<any>, // get values\n\n    count?: (parent:T)=>Promise<number|bigint>|number|bigint // return size of parent (number of child elements)\n\n    proxify_children?: boolean // set to true if children should be proxified per default\n    \n    visible_children?: Set<any>\n\n    create_proxy?: (value:T, pointer:Pointer)=>T, // return a Proxy for an object (can also be the same, modified object)\n\n\n    // x + y\n    operator_add?: (first:any, second:any)=>any|typeof INVALID\n    operator_subtract?: (first:any, second:any)=>any|typeof INVALID\n    operator_divide?: (first:any, second:any)=>any|typeof INVALID\n    operator_multiply?: (first:any, second:any)=>any|typeof INVALID\n    operator_power?: (first:any, second:any)=>any|typeof INVALID\n    operator_modulo?: (first:any, second:any)=>any|typeof INVALID\n\n    operator_and?: (first:any, second:any)=>any|typeof INVALID\n    operator_or?: (first:any, second:any)=>any|typeof INVALID\n    operator_not?: (first:any, second:any)=>any|typeof INVALID\n\n\n\n    // x += y\n    action_add?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_subtract?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_divide?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_multiply?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_power?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_modulo?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n\n    action_increment?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_decrement?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n\n    action_and?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n    action_or?: (ref:T, value:any, silently:boolean, exclude?:Endpoint)=>void|typeof INVALID\n\n    compare?: (first:T, second:T)=>0|1|-1\n\n}\n\n\n/** handles (custom) type interfaces with custom JS methods */\nexport class JSInterface {\n\n    // list of all pseudo class configurations\n    static configurations_by_type: Map<Type, js_interface_configuration> = new Map();\n    // JS class -> configuration\n    static configurations_by_class: Map<Class, js_interface_configuration> = new Map();\n    static configurations_by_prototype: Map<object, js_interface_configuration> = new Map();\n\n    static configurations_loaders_by_namespace:Map<string,(type:Type)=>Promise<js_interface_configuration|boolean>> = new Map();\n\n\n    /** fetch type configuration for a datex type when required, returns the corresponding JS class */\n    public static async loadTypeConfiguration(type:Type):Promise<boolean> {\n        if (JSInterface.configurations_by_type.has(type)) return true; // already exists\n        else {\n            if (JSInterface.configurations_loaders_by_namespace.has(type.namespace)) {\n                const config = await JSInterface.configurations_loaders_by_namespace.get(type.namespace)(type);\n\n                if (typeof config == \"boolean\") return config;\n                else if (config) type.setJSInterface(config);\n                else return false;\n                return true;\n            }\n            else return false;\n        }\n    }\n    \n    /** add type namespace handler */\n    public static typeConfigurationLoader(namespace:string|string[], loader: (type:Type)=>Promise<js_interface_configuration|boolean>) {\n        if (namespace instanceof Array) {\n            for (let n of namespace) JSInterface.configurations_loaders_by_namespace.set(n, loader);\n        }\n        else JSInterface.configurations_loaders_by_namespace.set(namespace, loader);\n    }\n\n    public static async getClassForType(type:Type):Promise<Class> {\n        // first make sure the configuration is loaded\n        if (!await JSInterface.loadTypeConfiguration(type)) throw new TypeError(\"Could not load type \" + type);\n        else return JSInterface.configurations_by_type.get(type).class;\n    }\n\n\n    // update a existing pseudo class configuration property or create and update a new configuration\n    public static updateJSInterfaceConfiguration<T extends keyof js_interface_configuration>(type:Type, key:T, value:js_interface_configuration[T]){\n        // make sure a configuration for the type exists\n        let config = JSInterface.configurations_by_type.get(type);\n\n        // create new config\n        if (!config) {\n            config = {};\n            JSInterface.configurations_by_type.set(type, config);\n        }\n        // update config\n        else {\n            config[key] = value;\n        }\n\n        JSInterface.handleConfigUpdate(type, config);\n    }\n\n\n\n    public static handleConfigUpdate(type:Type, config:js_interface_configuration){\n\n        if (!type) throw new Error (\"A type is required for a type configuration\")\n        if (!config.class && !config.prototype && !config.detect_class) throw new Error (\"The 'class', or 'prototype' property is required for a type configuration\")\n\n        config.__type = type; // save type to config for faster type reference\n\n        JSInterface.configurations_by_type.set(type, config);\n        if (config.prototype)  JSInterface.configurations_by_prototype.set(config.prototype, config);\n        if (config.class) JSInterface.configurations_by_class.set(config.class, config);\n\n    }\n\n    // apply get_property, set_property, ... if parent matches a pseudo type\n    private static applyMethod(type:Type, parent:any, method_name:string, args:any[]):any {\n        const config = this.configurations_by_type.get(type.root_type) ?? this.configurations_by_type.get(type);\n        if (!config) return NOT_EXISTING;\n        if (config.is_normal_object && !(method_name in config)) return NOT_EXISTING; // act like this pseudo class does not exist, handle default (if method is not implemented)\n        if (config.detect_class instanceof globalThis.Function && !(<globalThis.Function>config.detect_class)(parent)) return NOT_EXISTING; // detect class invalid\n        if (config[method_name] instanceof globalThis.Function) return config[method_name](...args);\n        return INVALID;\n    }\n\n\n    // return if a value has a matching pseudo class configuration\n    static hasPseudoClass(value:any):boolean {\n        for (const [_class, config] of this.configurations_by_class) {\n            if (value instanceof _class) { // is class instance\n                if (config.detect_class instanceof globalThis.Function && !(<globalThis.Function>config.detect_class)(value)) return false; // detect class invalid\n                return true;\n            }\n        }\n\n        for (const [proto, config] of this.configurations_by_prototype) {\n            if (proto.isPrototypeOf(value)) { // has prototype\n                if (config.detect_class instanceof globalThis.Function && !(<globalThis.Function>config.detect_class)(value)) return false; // detect class invalid\n                return true;\n            }\n        }\n        return false;\n    }\n\n    // sets the property of a value\n    static handleSetProperty(parent:any, key:any, value:any, type:Type = Type.ofValue(parent), exclude?:Endpoint):void|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"set_property\", [parent, key, value, exclude])\n    }\n\n    // count value content\n    static handleCount(parent:any, type:Type = Type.ofValue(parent)):number|bigint|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"count\", [parent]);\n    }\n\n    // get the property of a value\n    static handleHas( parent:any, property:any, type:Type = Type.ofValue(parent)):boolean|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"has_property\", [parent, property]);\n    }\n    \n\n    // get the property of a value\n    static handleGetProperty( parent:any, key:any, type:Type = Type.ofValue(parent)):any|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"get_property\", [parent, key]);\n    }\n\n    // delete a value (= void)\n    static handleDeleteProperty(parent:any, value:any, type:Type = Type.ofValue(parent), exclude?:Endpoint):void|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"delete_property\", [parent, value, exclude]);\n    }\n    \n    // get iterable for all values\n    static handleGetAllValues(parent:any, type:Type = Type.ofValue(parent)):Iterable<any>|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"values\", [parent]);\n    }\n\n    // clear value (remove all children)\n    static handleClear(parent:any, type:Type = Type.ofValue(parent), exclude?:Endpoint):void|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"clear\", [parent, exclude]);\n    }\n\n    // get keys for a value\n    static handleKeys(parent:any, type:Type = Type.ofValue(parent)):Iterable<any>|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"keys\", [parent]);\n    }\n    // convert a value to a serializable (fundamental) value\n    static serializeValue(value:any, type:Type = Type.ofValue(value)):fundamental|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, value, \"serialize\", [value]);\n    }\n\n    // creates a proxy object for a given value\n    static createProxy(value:any, pointer:Pointer, type:Type = Type.ofValue(value)):any|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, value, \"create_proxy\", [value, pointer]);\n    }\n\n\n\n    // silent property changes (don't trigger DATEX updates)\n\n    // sets the property of a value\n    static handleSetPropertySilently(parent:any, key:any, value:any, pointer:Pointer, type:Type = Type.ofValue(parent)):void|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"set_property_silently\", [parent, key, value, pointer])\n    }\n\n    // delete a value (= void)\n    static handleDeletePropertySilently(parent:any, key:any, pointer:Pointer, type:Type = Type.ofValue(parent)):void|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"delete_property_silently\", [parent, key, pointer]);\n    }\n    \n    // clear value (remove all children)\n    static handleClearSilently(parent:any, pointer:Pointer, type:Type = Type.ofValue(parent)):void|(typeof INVALID| typeof NOT_EXISTING) {\n        return this.applyMethod(type, parent, \"clear_silently\", [parent, pointer]);\n    }\n\n\n\n    // value -> <Type>\n    static getValueDatexType(value:any):Type {\n\n        for (const [_class, config] of this.configurations_by_class) {\n            if (!config.detect_class && value instanceof _class) {\n                return config.get_type ? config.get_type(value) : config.__type;\n            }\n        }\n\n        for (const [proto, config] of this.configurations_by_prototype) {\n            if (proto.isPrototypeOf(value)) {\n                return config.get_type ? config.get_type(value) : config.__type;\n            }\n        }\n\n        // try afterwards (less likely to happen)\n        for (const [_class, config] of this.configurations_by_class) {\n            if (config.detect_class instanceof globalThis.Function && (<globalThis.Function>config.detect_class)(value) ) {\n                return config.get_type ? config.get_type(value) : config.__type;\n            }\n        }\n    }\n\n    // js class -> <Type>\n    static getClassDatexType(class_constructor:Class):Type|undefined {\n        let config:js_interface_configuration;\n\n        // get directly from class\n        if ((config = this.configurations_by_class.get(class_constructor))) return config.__type;\n        // get from prototype of class\n        if ((config = this.configurations_by_class.get(Object.getPrototypeOf(class_constructor)))) return config.__type;\n\n        // check full prototype chain (should not happen normally, unnessary to loop through every time)\n        // for (let [_class, config] of this.configurations_by_class) {\n        //     console.log(_class)\n        //     if (class_constructor == _class || _class.isPrototypeOf(class_constructor)) {\n        //         return config.__type ?? undefined;\n        //     }\n        // }\n    }\n    \n}\n\n\n\nconst iterateMapReverse = function (this:Map<any,any>) {\n    const values = Array.from(this.entries());\n    // start at the end of the array\n    let index = values.length;\n    return <IterableIterator<any>>{\n      next: function () {\n        return {\n          done: index === 0,\n          value: values[--index]\n        };\n      }\n    }\n};\nconst iterateSetReverse = function (this:Set<any>) {\n    const values = Array.from(this.values());\n    // start at the end of the array\n    let index = values.length;\n    return <IterableIterator<any>>{\n      next: function () {\n        return {\n          done: index === 0,\n          value: values[--index]\n        };\n      }\n    }\n};\n\n\n// add reverse map/set iterators to cast values in correct order\nJSInterface.configurations_by_class[Symbol.iterator] = iterateMapReverse;\nJSInterface.configurations_by_type[Symbol.iterator] = iterateSetReverse;\nJSInterface.configurations_by_prototype[Symbol.iterator] = iterateMapReverse;\n\n\n// exposed DatexCustomPseudoClasses methods\nexport const typeConfigurationLoader = JSInterface.typeConfigurationLoader;\nexport const updateJSInterfaceConfiguration = JSInterface.updateJSInterfaceConfiguration;\n\n// get a JS class corresponding to a DatexType (try loading the class configuration dynamically if possible)\nexport function DX_CLASS(type:Type|string){\n    return JSInterface.getClassForType(type instanceof Type ? type :  Type.get(type));\n}\n\n\n"],"names":["Type","INVALID","NOT_EXISTING","JSInterface","configurations_by_type","Map","configurations_by_class","configurations_by_prototype","configurations_loaders_by_namespace","loadTypeConfiguration","type","has","namespace","config","get","setJSInterface","typeConfigurationLoader","loader","Array","n","set","getClassForType","class","TypeError","updateJSInterfaceConfiguration","key","value","handleConfigUpdate","Error","prototype","detect_class","__type","applyMethod","parent","method_name","args","root_type","is_normal_object","globalThis","Function","hasPseudoClass","_class","proto","isPrototypeOf","handleSetProperty","ofValue","exclude","handleCount","handleHas","property","handleGetProperty","handleDeleteProperty","handleGetAllValues","handleClear","handleKeys","serializeValue","createProxy","pointer","handleSetPropertySilently","handleDeletePropertySilently","handleClearSilently","getValueDatexType","get_type","getClassDatexType","class_constructor","Object","getPrototypeOf","iterateMapReverse","values","from","entries","index","length","next","done","Symbol","iterator","DX_CLASS"],"mappings":"AAAA,SAASA,IAAI,QAAQ,mBAAmB;AAKxC,SAASC,OAAO,EAAEC,YAAY,QAAQ,iBAAiB;AA4FvD,OAAO,MAAMC;IAGT,OAAOC,yBAAgE,IAAIC,MAAM;IAEjF,OAAOC,0BAAkE,IAAID,MAAM;IACnF,OAAOE,8BAAuE,IAAIF,MAAM;IAExF,OAAOG,sCAA2G,IAAIH,MAAM;IAI5H,aAAoBI,sBAAsBC,IAAS,EAAmB;QAClE,IAAIP,YAAYC,sBAAsB,CAACO,GAAG,CAACD,OAAO,OAAO,CAAA;QAErD,KAAIP,YAAYK,mCAAmC,CAACG,GAAG,CAACD,KAAKE,SAAS,GAQjE,OAAO,CAAA;QAR6D;YACrE,IAAMC,SAAS,MAAMV,YAAYK,mCAAmC,CAACM,GAAG,CAACJ,KAAKE,SAAS,EAAEF;mBAEzF,AAAI,AAAiB,aAAjB,OAAOG,SAA4BA,WAC9BA,WAAQH,KAAKK,cAAc,CAACF,SAE9B,CAAA;QACX;IAGR;IAGA,OAAcG,wBAAwBJ,SAAyB,EAAEK,MAAgE,EAAE;QAC/H,IAAIL,qBAAqBM,OACrB,KAAK,IAA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