{"version":3,"sources":["request-datex-inspector.ts"],"sourcesContent":["import { cache_path } from \"../../runtime/cache_path.ts\";\nimport { Endpoint } from \"../../types/addressing.ts\";\nimport { PermissionError } from \"../../types/errors.ts\";\nimport { Path } from \"../../utils/path.ts\";\n\n@endpoint export class DatexInspectorRequest {\n\n    static endpointHasAccess(endpoint: Endpoint) {\n\t\t// check if .datex-cache/inspector has file with endpoint name\n\t\tconst path = new Path(cache_path).getChildRoute(\"inspectors\").getChildRoute(endpoint.toString());\n\t\tif (path.fs_exists) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n    /**\n     * requests the DATEX Inspector interface to be loaded\n     * so that an endpoint can create a new inspector connection\n     * This method can only be called by endpoints that are listed\n     * in .datex-cache/inspectors\n     */\n    @property static async request() {\n        if (!this.endpointHasAccess(datex.meta.caller.main)) {\n            throw new PermissionError(\"Unauthorized\");\n        }\n        await import(\"https://cdn.unyt.org/datex-inspector/inspector.ts\")\n        return true;\n    }\n}"],"names":["cache_path","PermissionError","Path","DatexInspectorRequest","property","request","endpoint","endpointHasAccess","path","getChildRoute","toString","fs_exists","datex","meta","caller","main"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,QAAQ,8BAA8B;AAEzD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,IAAI,QAAQ,sBAAsB;;;cAEpBC;;;YAAAA,8BAAAA;;;;wBAiBlBC;;wBAAsBC;;;oBAjB1BC;;;YAEG,OAAOC,kBAAkBD,SAAkB,EAAE;yBAG3CE,AADS,IAAIN,KAAKF,YAAYS,aAAa,CAAC,cAAcA,aAAa,CAACH,UAASI,QAAQ,IACpFC,SAAS;YAInB;YAQG,aAAuBN,UAAU;gBAC7B,IAAI,CAAC,IAAI,CAACE,iBAAiB,CAACK,MAAMC,IAAI,CAACC,MAAM,CAACC,IAAI,GAC9C,MAAM,IAAId,gBAAgB;gBAG9B,OADA,MAAM,MAAM,CAAC,sDACN,CAAA;YACX;;;;SAvBM,AAAaE,0BAAAA,qBAwBtB","sourceRoot":"/lib/datex-core-js-legacy-0.3.14/network/debugging/","file":"request-datex-inspector.ts"}