UNPKG

1.87 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/query-builder/QueryBuilderUtils.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH;IAAA;IA4BA,CAAC;IA1BG;;;OAGG;IACI,iCAAe,GAAtB,UAAuB,GAAQ;QAE3B,gEAAgE;QAChE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,KAAK,CAAC;QAEjB,wCAAwC;QAClC,IAAA,sCAA0C,EAAzC,iBAAS,EAAE,oBAA8B,CAAC,CAAC,0CAA0C;QAC5F,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY;YAC3B,OAAO,KAAK,CAAC;QAEjB,6DAA6D;QAC7D,8CAA8C;QAC9C,+EAA+E;QAC/E,oBAAoB;QACpB,qCAAqC;QACrC,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,KAAK,CAAC;QAEjB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEL,wBAAC;AAAD,CA5BA,AA4BC,IAAA;AA5BY,8CAAiB","file":"QueryBuilderUtils.js","sourcesContent":["/**\n * Helper utility functions for QueryBuilder.\n */\nexport class QueryBuilderUtils {\n\n /**\n * Checks if given value is a string representation of alias property,\n * e.g. \"post.category\" or \"post.id\".\n */\n static isAliasProperty(str: any): str is string {\n\n // alias property must be a string and must have a dot separator\n if (typeof str !== \"string\" || str.indexOf(\".\") === -1)\n return false;\n\n // extra alias and its property relation\n const [aliasName, propertyName] = str.split(\".\"); // todo: what about relations in embedded?\n if (!aliasName || !propertyName)\n return false;\n\n // alias and property must be represented in a special format\n // const aliasNameRegexp = /^[a-zA-Z0-9_-]+$/;\n // if (!aliasNameRegexp.test(aliasName) || !aliasNameRegexp.test(propertyName))\n // return false;\n // make sure string is not a subquery\n if (str.indexOf(\"(\") !== -1 || str.indexOf(\")\") !== -1)\n return false;\n\n return true;\n }\n\n}\n"],"sourceRoot":".."}
\No newline at end of file