From 7b72ec59bd63103e32a86654a82c92cd0259503c Mon Sep 17 00:00:00 2001 From: Zac McCormick Date: Tue, 16 Aug 2016 10:43:50 -0400 Subject: [PATCH] Update sourcemap --- dist/deparser.js.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/deparser.js.map b/dist/deparser.js.map index b598077..40b82af 100644 --- a/dist/deparser.js.map +++ b/dist/deparser.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/deparser.js"],"names":[],"mappings":";;;;;;;;AAAA;;;;AACA;;;;MAEQ,I,oBAAA,I;;;AAER,MAAM,UAAU,KAAK;AACnB,SAAO,iBAAE,MAAF,CAAS,iBAAE,OAAF,CAAU,CAAV,CAAT,EAAwB,CAAD,IAAO;AACnC,QAAI,KAAK,IAAT,EAAe;AACb,aAAO,KAAP;AACD;;AAED,WAAO,EAAE,QAAF,GAAa,MAApB;AACD,GANM,CAAP;AAOD,CARD;;AAUA,MAAM,OAAO,CAAC,IAAD,EAAO,IAAP,KAAgB;AAC3B,QAAM,IAAI,KAAJ,CAAU,kBAAO,uBAAP,EAAgC,IAAhC,EAAsC,KAAK,SAAL,CAAe,IAAf,CAAtC,CAAV,CAAN;AACD,CAFD;;AAIA,MAAM,SAAU,MAAD,IAAY;AACzB,SAAO,MAAM,MAAN,GAAe,GAAtB;AACD,CAFD;;AAIA,MAAM,SAAS,SAAT,MAAS,CAAC,IAAD;AAAA,MAAO,KAAP,yDAAe,CAAf;AAAA,SAAqB,IAArB;AAAA,CAAf;;AAEe,MAAM,QAAN,CAAe;AAC5B,SAAO,OAAP,CAAe,KAAf,EAAsB;AACpB,WAAO,IAAI,QAAJ,CAAa,KAAb,EAAoB,YAApB,EAAP;AACD;;AAED,cAAY,IAAZ,EAAkB;AAChB,SAAK,IAAL,GAAY,IAAZ;AACD;;AAED,iBAAe;AACb,WAAQ,KAAK,IAAL,CAAU,GAAV,CAAc,QAAQ,KAAK,OAAL,CAAa,IAAb,CAAtB,CAAD,CAA4C,IAA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,CAAE,QAAF,EAAY,QAAZ,CAAlE;;AAEA;AACA;AACA,WAAK,SAAL,CAAe,KAAK,mBAAL,GAA2B,OAA1C,IAAqD,EAArD;AACD;;AAED,WAAO,KAAK,SAAL,CAAe,KAAK,QAAL,EAAf,CAAP;AACD;AA1wC2B;kBAAT,Q","file":"deparser.js","sourcesContent":["import _ from 'lodash';\nimport { format } from 'util';\n\nconst { keys } = _;\n\nconst compact = o => {\n return _.filter(_.compact(o), (p) => {\n if (p == null) {\n return false;\n }\n\n return p.toString().length;\n });\n};\n\nconst fail = (type, node) => {\n throw new Error(format('Unhandled %s node: %s', type, JSON.stringify(node)));\n};\n\nconst parens = (string) => {\n return '(' + string + ')';\n};\n\nconst indent = (text, count = 1) => text;\n\nexport default class Deparser {\n static deparse(query) {\n return new Deparser(query).deparseQuery();\n }\n\n constructor(tree) {\n this.tree = tree;\n }\n\n deparseQuery() {\n return (this.tree.map(node => this.deparse(node))).join('\\n\\n');\n }\n\n deparseNodes(nodes) {\n return nodes.map(node => this.deparse(node));\n }\n\n list(nodes, separator = ', ') {\n if (!nodes) {\n return '';\n }\n\n return this.deparseNodes(nodes).join(separator);\n }\n\n quote(value) {\n if (value == null) {\n return null;\n }\n\n if (_.isArray(value)) {\n return value.map(o => this.quote(o));\n }\n\n return '\"' + value + '\"';\n }\n\n // SELECT encode(E'''123\\\\000\\\\001', 'base64')\n escape(literal) {\n return \"'\" + literal.replace(/'/g, \"''\") + \"'\";\n }\n\n convertTypeName(typeName, size) {\n switch (typeName) {\n case 'bpchar':\n if (size != null) {\n return 'char';\n }\n // return `pg_catalog.bpchar` below so that the following is symmetric\n // SELECT char 'c' = char 'c' AS true\n return 'pg_catalog.bpchar';\n case 'varchar':\n return 'varchar';\n case 'numeric':\n return 'numeric';\n case 'bool':\n return 'boolean';\n case 'int2':\n return 'smallint';\n case 'int4':\n return 'int';\n case 'int8':\n return 'bigint';\n case 'real': case 'float4':\n return 'real';\n case 'float8':\n return 'pg_catalog.float8';\n case 'text':\n // SELECT EXTRACT(CENTURY FROM CURRENT_DATE)>=21 AS True\n return 'pg_catalog.text';\n case 'date':\n return 'pg_catalog.date';\n case 'time':\n return 'time';\n case 'timetz':\n return 'pg_catalog.timetz';\n case 'timestamp':\n return 'timestamp';\n case 'timestamptz':\n return 'pg_catalog.timestamptz';\n case 'interval':\n return 'interval';\n case 'bit':\n return 'bit';\n default:\n throw new Error(format('Unhandled data type: %s', typeName));\n }\n }\n\n type(names, args) {\n const [ catalog, type ] = names.map(name => this.deparse(name));\n\n const mods = (name, size) => {\n if (size != null) {\n return name + '(' + size + ')';\n }\n\n return name;\n };\n\n // handle the special \"char\" (in quotes) type\n if (names[0].String.str === 'char') {\n names[0].String.str = '\"char\"';\n }\n\n if (catalog !== 'pg_catalog') {\n return mods(this.list(names, '.'), args);\n }\n\n const res = this.convertTypeName(type, args);\n\n return mods(res, args);\n }\n\n deparse(item, context) {\n if (item == null) {\n return null;\n }\n\n if (_.isNumber(item)) {\n return item;\n }\n\n const type = keys(item)[0];\n const node = _.values(item)[0];\n\n if (this[type] == null) {\n throw new Error(type + ' is not implemented');\n }\n\n return this[type](node, context);\n }\n\n ['A_Expr'](node, context) {\n const output = [];\n\n switch (node.kind) {\n case 0: // AEXPR_OP\n if (node.lexpr) {\n output.push(parens(this.deparse(node.lexpr)));\n }\n\n if (node.name.length > 1) {\n const schema = this.deparse(node.name[0]);\n const operator = this.deparse(node.name[1]);\n output.push(`OPERATOR(${schema}.${operator})`);\n } else {\n output.push(this.deparse(node.name[0]));\n }\n\n if (node.rexpr) {\n output.push(parens(this.deparse(node.rexpr)));\n }\n\n if (output.length === 2) {\n return parens(output.join(''));\n }\n\n return parens(output.join(' '));\n\n case 1: // AEXPR_OP_ANY\n output.push(this.deparse(node.lexpr));\n output.push(format('ANY (%s)', this.deparse(node.rexpr)));\n return output.join(` ${this.deparse(node.name[0])} `);\n\n case 2: // AEXPR_OP_ALL\n output.push(this.deparse(node.lexpr));\n output.push(format('ALL (%s)', this.deparse(node.rexpr)));\n return output.join(` ${this.deparse(node.name[0])} `);\n\n case 3: // AEXPR_DISTINCT\n return format('%s IS DISTINCT FROM %s', this.deparse(node.lexpr), this.deparse(node.rexpr));\n\n case 4: // AEXPR_NULLIF\n return format('NULLIF(%s, %s)', this.deparse(node.lexpr), this.deparse(node.rexpr));\n\n case 5: { // AEXPR_OF\n const op = node.name[0].String.str === '=' ? 'IS OF' : 'IS NOT OF';\n return format('%s %s (%s)', this.deparse(node.lexpr), op, this.list(node.rexpr));\n }\n\n case 6: { // AEXPR_IN\n const operator = node.name[0].String.str === '=' ? 'IN' : 'NOT IN';\n\n return format('%s %s (%s)', this.deparse(node.lexpr), operator, this.list(node.rexpr));\n }\n\n case 7: // AEXPR_LIKE\n output.push(this.deparse(node.lexpr));\n\n if (node.name[0].String.str === '!~~') {\n output.push(format('NOT LIKE (%s)', this.deparse(node.rexpr)));\n } else {\n output.push(format('LIKE (%s)', this.deparse(node.rexpr)));\n }\n\n return output.join(' ');\n\n case 8: // AEXPR_ILIKE\n output.push(this.deparse(node.lexpr));\n\n if (node.name[0].String.str === '!~~*') {\n output.push(format('NOT ILIKE (%s)', this.deparse(node.rexpr)));\n } else {\n output.push(format('ILIKE (%s)', this.deparse(node.rexpr)));\n }\n\n return output.join(' ');\n\n case 9: // AEXPR_SIMILAR\n // SIMILAR TO emits a similar_escape FuncCall node with the first argument\n output.push(this.deparse(node.lexpr));\n\n if (this.deparse(node.rexpr.FuncCall.args[1].Null)) {\n output.push(format('SIMILAR TO %s', this.deparse(node.rexpr.FuncCall.args[0])));\n } else {\n output.push(format('SIMILAR TO %s ESCAPE %s',\n this.deparse(node.rexpr.FuncCall.args[0]),\n this.deparse(node.rexpr.FuncCall.args[1])));\n }\n\n return output.join(' ');\n\n case 10: // AEXPR_BETWEEN TODO(zhm) untested\n output.push(this.deparse(node.lexpr));\n output.push(format('BETWEEN %s AND %s', this.deparse(node.rexpr[0]), this.deparse(node.rexpr[1])));\n return output.join(' ');\n\n case 11: // AEXPR_NOT_BETWEEN TODO(zhm) untested\n output.push(this.deparse(node.lexpr));\n output.push(format('NOT BETWEEN %s AND %s', this.deparse(node.rexpr[0]), this.deparse(node.rexpr[1])));\n return output.join(' ');\n\n default:\n return fail('A_Expr', node);\n }\n }\n\n ['Alias'](node, context) {\n const name = node.aliasname;\n\n const output = [ 'AS' ];\n\n if (node.colnames) {\n output.push(name + parens(this.list(node.colnames)));\n } else {\n output.push(this.quote(name));\n }\n\n return output.join(' ');\n }\n\n ['A_ArrayExpr'](node) {\n return format('ARRAY[%s]', this.list(node.elements));\n }\n\n ['A_Const'](node, context) {\n if (node.val.String) {\n return this.escape(this.deparse(node.val));\n }\n\n return this.deparse(node.val);\n }\n\n ['A_Indices'](node) {\n if (node.lidx) {\n return format('[%s:%s]', this.deparse(node.lidx), this.deparse(node.uidx));\n }\n\n return format('[%s]', this.deparse(node.uidx));\n }\n\n ['A_Indirection'](node) {\n const output = [ `(${this.deparse(node.arg)})` ];\n\n // TODO(zhm) figure out the actual rules for when a '.' is needed\n //\n // select a.b[0] from a;\n // select (select row(1)).*\n // select c2[2].f2 from comptable\n // select c2.a[2].f2[1].f3[0].a1 from comptable\n\n for (let i = 0; i < node.indirection.length; i++) {\n const subnode = node.indirection[i];\n\n if (subnode.String || subnode.A_Star) {\n const value = subnode.A_Star ? '*' : this.quote(subnode.String.str);\n\n output.push(`.${value}`);\n } else {\n output.push(this.deparse(subnode));\n }\n }\n\n return output.join('');\n }\n\n ['A_Star'](node, context) {\n return '*';\n }\n\n ['BitString'](node) {\n const prefix = node.str[0];\n return `${prefix}'${node.str.substring(1)}'`;\n }\n\n ['BoolExpr'](node) {\n switch (node.boolop) {\n case 0:\n return parens(this.list(node.args, ' AND '));\n case 1:\n return parens(this.list(node.args, ' OR '));\n case 2:\n return format('NOT (%s)', this.deparse(node.args[0]));\n default:\n return fail('BoolExpr', node);\n }\n }\n\n ['BooleanTest'](node) {\n const output = [];\n\n output.push(this.deparse(node.arg));\n\n const tests = [\n 'IS TRUE',\n 'IS NOT TRUE',\n 'IS FALSE',\n 'IS NOT FALSE',\n 'IS UNKNOWN',\n 'IS NOT UNKNOWN'\n ];\n\n output.push(tests[node.booltesttype]);\n\n return output.join(' ');\n }\n\n ['CaseExpr'](node) {\n const output = [ 'CASE' ];\n\n if (node.arg) {\n output.push(this.deparse(node.arg));\n }\n\n for (let i = 0; i < node.args.length; i++) {\n output.push(this.deparse(node.args[i]));\n }\n\n if (node.defresult) {\n output.push('ELSE');\n output.push(this.deparse(node.defresult));\n }\n\n output.push('END');\n\n return output.join(' ');\n }\n\n ['CoalesceExpr'](node) {\n return format('COALESCE(%s)', this.list(node.args));\n }\n\n ['CollateClause'](node) {\n const output = [];\n\n if (node.arg) {\n output.push(this.deparse(node.arg));\n }\n\n output.push('COLLATE');\n\n if (node.collname) {\n output.push(this.quote(this.deparseNodes(node.collname)));\n }\n\n return output.join(' ');\n }\n\n ['ColumnDef'](node) {\n const output = [ this.quote(node.colname) ];\n\n output.push(this.deparse(node.typeName));\n\n if (node.raw_default) {\n output.push('USING');\n output.push(this.deparse(node.raw_default));\n }\n\n if (node.constraints) {\n output.push(this.list(node.constraints, ' '));\n }\n\n return _.compact(output).join(' ');\n }\n\n ['ColumnRef'](node) {\n const fields = node.fields.map(field => {\n if (field.String) {\n return this.quote(this.deparse(field));\n }\n\n return this.deparse(field);\n });\n\n return fields.join('.');\n }\n\n ['CommonTableExpr'](node) {\n const output = [];\n\n output.push(node.ctename);\n\n if (node.aliascolnames) {\n output.push(format('(%s)', this.quote(this.deparseNodes(node.aliascolnames))));\n }\n\n output.push(format('AS (%s)', this.deparse(node.ctequery)));\n\n return output.join(' ');\n }\n\n ['Float'](node) {\n // wrap negative numbers in parens, SELECT (-2147483648)::int4 * (-1)::int4\n if (node.str[0] === '-') {\n return `(${node.str})`;\n }\n\n return node.str;\n }\n\n ['FuncCall'](node, context) {\n const output = [];\n\n let params = [];\n\n if (node.args) {\n params = node.args.map(item => {\n return this.deparse(item);\n });\n }\n\n // COUNT(*)\n if (node.agg_star) {\n params.push('*');\n }\n\n const name = this.list(node.funcname, '.');\n\n const order = [];\n\n const withinGroup = node.agg_within_group;\n\n if (node.agg_order) {\n order.push('ORDER BY');\n order.push(this.list(node.agg_order, ', '));\n }\n\n const call = [];\n\n call.push(name + '(');\n\n if (node.agg_distinct) {\n call.push('DISTINCT ');\n }\n\n // prepend variadic before the last parameter\n // SELECT CONCAT('|', VARIADIC ARRAY['1','2','3'])\n if (node.func_variadic) {\n params[params.length - 1] = 'VARIADIC ' + params[params.length - 1];\n }\n\n call.push(params.join(', '));\n\n if (order.length && !withinGroup) {\n call.push(' ');\n call.push(order.join(' '));\n }\n\n call.push(')');\n\n output.push(compact(call).join(''));\n\n if (order.length && withinGroup) {\n output.push('WITHIN GROUP');\n output.push(parens(order.join(' ')));\n }\n\n if (node.agg_filter != null) {\n output.push(format('FILTER (WHERE %s)', this.deparse(node.agg_filter)));\n }\n\n if (node.over != null) {\n output.push(format('OVER %s', this.deparse(node.over)));\n }\n\n return output.join(' ');\n }\n\n ['GroupingFunc'](node) {\n return 'GROUPING(' + this.list(node.args) + ')';\n }\n\n ['GroupingSet'](node) {\n switch (node.kind) {\n case 0: // GROUPING_SET_EMPTY\n return '()';\n\n case 1: // GROUPING_SET_SIMPLE\n return fail('GroupingSet', node);\n\n case 2: // GROUPING_SET_ROLLUP\n return 'ROLLUP (' + this.list(node.content) + ')';\n\n case 3: // GROUPING_SET_CUBE\n return 'CUBE (' + this.list(node.content) + ')';\n\n case 4: // GROUPING_SET_SETS\n return 'GROUPING SETS (' + this.list(node.content) + ')';\n\n default:\n return fail('GroupingSet', node);\n }\n }\n\n ['Integer'](node) {\n if (node.ival < 0) {\n return `(${node.ival})`;\n }\n\n return node.ival.toString();\n }\n\n ['IntoClause'](node) {\n return this.deparse(node.rel);\n }\n\n ['JoinExpr'](node, context) {\n const output = [];\n\n output.push(this.deparse(node.larg));\n\n if (node.isNatural) {\n output.push('NATURAL');\n }\n\n let join = null;\n\n switch (true) {\n case node.jointype === 0 && (node.quals != null):\n join = 'INNER JOIN';\n break;\n\n case node.jointype === 0 && !node.isNatural && !(node.quals != null) && !(node.usingClause != null):\n join = 'CROSS JOIN';\n break;\n\n case node.jointype === 0:\n join = 'JOIN';\n break;\n\n case node.jointype === 1:\n join = 'LEFT OUTER JOIN';\n break;\n\n case node.jointype === 2:\n join = 'FULL OUTER JOIN';\n break;\n\n case node.jointype === 3:\n join = 'RIGHT OUTER JOIN';\n break;\n\n default:\n fail('JoinExpr', node);\n break;\n }\n\n output.push(join);\n\n if (node.rarg) {\n // wrap nested join expressions in parens to make the following symmetric:\n // select * from int8_tbl x cross join (int4_tbl x cross join lateral (select x.f1) ss)\n if ((node.rarg.JoinExpr != null) && !(node.rarg.JoinExpr.alias != null)) {\n output.push(`(${this.deparse(node.rarg)})`);\n } else {\n output.push(this.deparse(node.rarg));\n }\n }\n\n if (node.quals) {\n output.push(`ON ${this.deparse(node.quals)}`);\n }\n\n if (node.usingClause) {\n const using = this.quote(this.deparseNodes(node.usingClause)).join(', ');\n\n output.push(`USING (${using})`);\n }\n\n const wrapped =\n (node.rarg.JoinExpr != null) || node.alias ? '(' + output.join(' ') + ')'\n : output.join(' ');\n\n if (node.alias) {\n return wrapped + ' ' + this.deparse(node.alias);\n }\n\n return wrapped;\n }\n\n ['LockingClause'](node) {\n const strengths = [\n 'NONE', // LCS_NONE\n 'FOR KEY SHARE',\n 'FOR SHARE',\n 'FOR NO KEY UPDATE',\n 'FOR UPDATE'\n ];\n\n const output = [];\n\n output.push(strengths[node.strength]);\n\n if (node.lockedRels) {\n output.push('OF');\n output.push(this.list(node.lockedRels));\n }\n\n return output.join(' ');\n }\n\n ['MinMaxExpr'](node) {\n const output = [];\n\n if (node.op === 0) {\n output.push('GREATEST');\n } else {\n output.push('LEAST');\n }\n\n output.push(parens(this.list(node.args)));\n\n return output.join('');\n }\n\n ['NamedArgExpr'](node) {\n const output = [];\n\n output.push(node.name);\n output.push(':=');\n output.push(this.deparse(node.arg));\n\n return output.join(' ');\n }\n\n ['Null'](node) {\n return 'NULL';\n }\n\n ['NullTest'](node) {\n const output = [ this.deparse(node.arg) ];\n\n if (node.nulltesttype === 0) {\n output.push('IS NULL');\n } else if (node.nulltesttype === 1) {\n output.push('IS NOT NULL');\n }\n\n return output.join(' ');\n }\n\n ['ParamRef'](node) {\n if (node.number >= 0) {\n return [ '$', node.number ].join('');\n }\n return '?';\n }\n\n ['RangeFunction'](node) {\n const output = [];\n\n if (node.lateral) {\n output.push('LATERAL');\n }\n\n const funcs = [];\n\n for (let i = 0; i < node.functions.length; i++) {\n const funcCall = node.functions[i];\n const call = [ this.deparse(funcCall[0]) ];\n\n if (funcCall[1] && funcCall[1].length) {\n call.push(format('AS (%s)', this.list(funcCall[1])));\n }\n\n funcs.push(call.join(' '));\n }\n\n const calls = funcs.join(', ');\n\n if (node.is_rowsfrom) {\n output.push(`ROWS FROM (${calls})`);\n } else {\n output.push(calls);\n }\n\n if (node.ordinality) {\n output.push('WITH ORDINALITY');\n }\n\n if (node.alias) {\n output.push(this.deparse(node.alias));\n }\n\n if (node.coldeflist) {\n const defList = this.list(node.coldeflist);\n\n if (!node.alias) {\n output.push(` AS (${defList})`);\n } else {\n output.push(`(${defList})`);\n }\n }\n\n return output.join(' ');\n }\n\n ['RangeSubselect'](node, context) {\n let output = '';\n\n if (node.lateral) {\n output += 'LATERAL ';\n }\n\n output += parens(this.deparse(node.subquery));\n\n if (node.alias) {\n return output + ' ' + this.deparse(node.alias);\n }\n\n return output;\n }\n\n ['RangeTableSample'](node) {\n const output = [];\n\n output.push(this.deparse(node.relation));\n output.push('TABLESAMPLE');\n output.push(this.deparse(node.method[0]));\n\n if (node.args) {\n output.push(parens(this.list(node.args)));\n }\n\n if (node.repeatable) {\n output.push('REPEATABLE(' + this.deparse(node.repeatable) + ')');\n }\n\n return output.join(' ');\n }\n\n ['RangeVar'](node, context) {\n const output = [];\n\n if (node.inhOpt === 0) {\n output.push('ONLY');\n }\n\n if (node.relpersistence === 'u') {\n output.push('UNLOGGED');\n }\n\n if (node.relpersistence === 't') {\n output.push('TEMPORARY');\n }\n\n if (node.schemaname != null) {\n output.push(this.quote(node.schemaname));\n output.push('.');\n }\n\n output.push(this.quote(node.relname));\n\n if (node.alias) {\n output.push(this.deparse(node.alias));\n }\n\n return output.join(' ');\n }\n\n ['ResTarget'](node, context) {\n if (context === 'select') {\n return compact([ this.deparse(node.val), this.quote(node.name) ]).join(' AS ');\n } else if (context === 'update') {\n return compact([ node.name, this.deparse(node.val) ]).join(' = ');\n } else if (!(node.val != null)) {\n return this.quote(node.name);\n }\n\n return fail('ResTarget', node);\n }\n\n ['RowExpr'](node) {\n if (node.row_format === 2) {\n return parens(this.list(node.args));\n }\n\n return format('ROW(%s)', this.list(node.args));\n }\n\n ['SelectStmt'](node, context) {\n const output = [];\n\n if (node.withClause) {\n output.push(this.deparse(node.withClause));\n }\n\n if (node.op === 0) {\n // VALUES select's don't get SELECT\n if (node.valuesLists == null) {\n output.push('SELECT');\n }\n } else {\n output.push(parens(this.deparse(node.larg)));\n\n const sets = [\n 'NONE',\n 'UNION',\n 'INTERSECT',\n 'EXCEPT'\n ];\n\n output.push(sets[node.op]);\n\n if (node.all) {\n output.push('ALL');\n }\n\n output.push(parens(this.deparse(node.rarg)));\n }\n\n if (node.distinctClause) {\n if (node.distinctClause[0] != null) {\n output.push('DISTINCT ON');\n\n const clause = (node.distinctClause.map(e => this.deparse(e, 'select'))).join(',\\n');\n\n output.push(`(${clause})`);\n } else {\n output.push('DISTINCT');\n }\n }\n\n if (node.targetList) {\n output.push(indent((node.targetList.map(e => this.deparse(e, 'select'))).join(',\\n')));\n }\n\n if (node.intoClause) {\n output.push('INTO');\n output.push(indent(this.deparse(node.intoClause)));\n }\n\n if (node.fromClause) {\n output.push('FROM');\n output.push(indent((node.fromClause.map(e => this.deparse(e, 'from'))).join(',\\n')));\n }\n\n if (node.whereClause) {\n output.push('WHERE');\n output.push(indent(this.deparse(node.whereClause)));\n }\n\n if (node.valuesLists) {\n output.push('VALUES');\n\n const lists = node.valuesLists.map(list => {\n return `(${(list.map(v => this.deparse(v))).join(', ')})`;\n });\n\n output.push(lists.join(', '));\n }\n\n if (node.groupClause) {\n output.push('GROUP BY');\n output.push(indent((node.groupClause.map(e => this.deparse(e, 'group'))).join(',\\n')));\n }\n\n if (node.havingClause) {\n output.push('HAVING');\n output.push(indent(this.deparse(node.havingClause)));\n }\n\n if (node.windowClause) {\n output.push('WINDOW');\n\n const windows = [];\n\n for (let i = 0; i < node.windowClause.length; i++) {\n const w = node.windowClause[i];\n const window = [];\n\n if (w.WindowDef.name) {\n window.push(this.quote(w.WindowDef.name) + ' AS');\n }\n\n window.push(parens(this.deparse(w, 'window')));\n\n windows.push(window.join(' '));\n }\n\n output.push(windows.join(', '));\n }\n\n if (node.sortClause) {\n output.push('ORDER BY');\n output.push(indent((node.sortClause.map(e => this.deparse(e, 'sort'))).join(',\\n')));\n }\n\n if (node.limitCount) {\n output.push('LIMIT');\n output.push(indent(this.deparse(node.limitCount)));\n }\n\n if (node.limitOffset) {\n output.push('OFFSET');\n output.push(indent(this.deparse(node.limitOffset)));\n }\n\n if (node.lockingClause) {\n node.lockingClause.forEach(item => {\n return output.push(this.deparse(item));\n });\n }\n\n return output.join(' ');\n }\n\n ['SortBy'](node) {\n const output = [];\n\n output.push(this.deparse(node.node));\n\n if (node.sortby_dir === 1) {\n output.push('ASC');\n }\n\n if (node.sortby_dir === 2) {\n output.push('DESC');\n }\n\n if (node.sortby_dir === 3) {\n output.push(`USING ${this.deparseNodes(node.useOp)}`);\n }\n\n if (node.sortby_nulls === 1) {\n output.push('NULLS FIRST');\n }\n\n if (node.sortby_nulls === 2) {\n output.push('NULLS LAST');\n }\n\n return output.join(' ');\n }\n\n ['String'](node) {\n return node.str;\n }\n\n ['SubLink'](node) {\n switch (true) {\n case node.subLinkType === 0:\n return format('EXISTS (%s)', this.deparse(node.subselect));\n case node.subLinkType === 1:\n return format('%s %s ALL (%s)', this.deparse(node.testexpr), this.deparse(node.operName[0]), this.deparse(node.subselect));\n case node.subLinkType === 2 && !(node.operName != null):\n return format('%s IN (%s)', this.deparse(node.testexpr), this.deparse(node.subselect));\n case node.subLinkType === 2:\n return format('%s %s ANY (%s)', this.deparse(node.testexpr), this.deparse(node.operName[0]), this.deparse(node.subselect));\n case node.subLinkType === 3:\n return format('%s %s (%s)', this.deparse(node.testexpr), this.deparse(node.operName[0]), this.deparse(node.subselect));\n case node.subLinkType === 4:\n return format('(%s)', this.deparse(node.subselect));\n case node.subLinkType === 5:\n // TODO(zhm) what is this?\n return fail('SubLink', node);\n // MULTIEXPR_SUBLINK\n // format('(%s)', @deparse(node.subselect))\n case node.subLinkType === 6:\n return format('ARRAY (%s)', this.deparse(node.subselect));\n default:\n return fail('SubLink', node);\n }\n }\n\n ['TypeCast'](node) {\n return this.deparse(node.arg) + '::' + this.deparse(node.typeName);\n }\n\n ['TypeName'](node) {\n if (_.last(node.names).String.str === 'interval') {\n return this.deparseInterval(node);\n }\n\n const output = [];\n\n if (node.setof) {\n output.push('SETOF');\n }\n\n let args = null;\n\n if (node.typmods != null) {\n args = node.typmods.map(item => {\n return this.deparse(item);\n });\n }\n\n const type = [];\n\n type.push(this.type(node.names, args && args.join(', ')));\n\n if (node.arrayBounds != null) {\n type.push('[]');\n }\n\n output.push(type.join(''));\n\n return output.join(' ');\n }\n\n ['CaseWhen'](node) {\n const output = [ 'WHEN' ];\n\n output.push(this.deparse(node.expr));\n output.push('THEN');\n output.push(this.deparse(node.result));\n\n return output.join(' ');\n }\n\n ['WindowDef'](node, context) {\n const output = [];\n\n if (context !== 'window') {\n if (node.name) {\n output.push(node.name);\n }\n }\n\n const empty = (!(node.partitionClause != null) && !(node.orderClause != null));\n\n const frameOptions = this.deparseFrameOptions(node.frameOptions, node.refname, node.startOffset, node.endOffset);\n\n if (empty && context !== 'window' && !(node.name != null) && frameOptions.length === 0) {\n return '()';\n }\n\n const windowParts = [];\n\n let useParens = false;\n\n if (node.partitionClause) {\n const partition = [ 'PARTITION BY' ];\n\n const clause = node.partitionClause.map(item => this.deparse(item));\n\n partition.push(clause.join(', '));\n\n windowParts.push(partition.join(' '));\n useParens = true;\n }\n\n if (node.orderClause) {\n windowParts.push('ORDER BY');\n\n const orders = node.orderClause.map(item => {\n return this.deparse(item);\n });\n\n windowParts.push(orders.join(', '));\n\n useParens = true;\n }\n\n if (frameOptions.length) {\n useParens = true;\n windowParts.push(frameOptions);\n }\n\n if (useParens && context !== 'window') {\n return output.join(' ') + ' (' + windowParts.join(' ') + ')';\n }\n\n return output.join(' ') + windowParts.join(' ');\n }\n\n ['WithClause'](node) {\n const output = [ 'WITH' ];\n\n if (node.recursive) {\n output.push('RECURSIVE');\n }\n\n output.push(this.list(node.ctes));\n\n return output.join(' ');\n }\n\n deparseFrameOptions(options, refName, startOffset, endOffset) {\n const FRAMEOPTION_NONDEFAULT = 0x00001; // any specified?\n const FRAMEOPTION_RANGE = 0x00002; // RANGE behavior\n const FRAMEOPTION_ROWS = 0x00004; // ROWS behavior\n const FRAMEOPTION_BETWEEN = 0x00008; // BETWEEN given?\n const FRAMEOPTION_START_UNBOUNDED_PRECEDING = 0x00010; // start is U. P.\n const FRAMEOPTION_END_UNBOUNDED_PRECEDING = 0x00020; // (disallowed)\n const FRAMEOPTION_START_UNBOUNDED_FOLLOWING = 0x00040; // (disallowed)\n const FRAMEOPTION_END_UNBOUNDED_FOLLOWING = 0x00080; // end is U. F.\n const FRAMEOPTION_START_CURRENT_ROW = 0x00100; // start is C. R.\n const FRAMEOPTION_END_CURRENT_ROW = 0x00200; // end is C. R.\n const FRAMEOPTION_START_VALUE_PRECEDING = 0x00400; // start is V. P.\n const FRAMEOPTION_END_VALUE_PRECEDING = 0x00800; // end is V. P.\n const FRAMEOPTION_START_VALUE_FOLLOWING = 0x01000; // start is V. F.\n const FRAMEOPTION_END_VALUE_FOLLOWING = 0x02000; // end is V. F.\n\n if (!(options & FRAMEOPTION_NONDEFAULT)) {\n return '';\n }\n\n const output = [];\n\n if (refName != null) {\n output.push(refName);\n }\n\n if (options & FRAMEOPTION_RANGE) {\n output.push('RANGE');\n }\n\n if (options & FRAMEOPTION_ROWS) {\n output.push('ROWS');\n }\n\n const between = options & FRAMEOPTION_BETWEEN;\n\n if (between) {\n output.push('BETWEEN');\n }\n\n if (options & FRAMEOPTION_START_UNBOUNDED_PRECEDING) {\n output.push('UNBOUNDED PRECEDING');\n }\n\n if (options & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) {\n output.push('UNBOUNDED FOLLOWING');\n }\n\n if (options & FRAMEOPTION_START_CURRENT_ROW) {\n output.push('CURRENT ROW');\n }\n\n if (options & FRAMEOPTION_START_VALUE_PRECEDING) {\n output.push(this.deparse(startOffset) + ' PRECEDING');\n }\n\n if (options & FRAMEOPTION_START_VALUE_FOLLOWING) {\n output.push(this.deparse(startOffset) + ' FOLLOWING');\n }\n\n if (between) {\n output.push('AND');\n\n if (options & FRAMEOPTION_END_UNBOUNDED_PRECEDING) {\n output.push('UNBOUNDED PRECEDING');\n }\n\n if (options & FRAMEOPTION_END_UNBOUNDED_FOLLOWING) {\n output.push('UNBOUNDED FOLLOWING');\n }\n\n if (options & FRAMEOPTION_END_CURRENT_ROW) {\n output.push('CURRENT ROW');\n }\n\n if (options & FRAMEOPTION_END_VALUE_PRECEDING) {\n output.push(this.deparse(endOffset) + ' PRECEDING');\n }\n\n if (options & FRAMEOPTION_END_VALUE_FOLLOWING) {\n output.push(this.deparse(endOffset) + ' FOLLOWING');\n }\n }\n\n return output.join(' ');\n }\n\n deparseInterval(node) {\n const type = [ 'interval' ];\n\n if (node.arrayBounds != null) {\n type.push('[]');\n }\n\n if (node.typmods) {\n const typmods = node.typmods.map(item => this.deparse(item));\n\n let intervals = this.interval(typmods[0]);\n\n // SELECT interval(0) '1 day 01:23:45.6789'\n if (node.typmods[0] && node.typmods[0].A_Const && node.typmods[0].A_Const.val.Integer.ival === 32767 && node.typmods[1] && (node.typmods[1].A_Const != null)) {\n intervals = [ `(${node.typmods[1].A_Const.val.Integer.ival})` ];\n } else {\n intervals = intervals.map(part => {\n if (part === 'second' && typmods.length === 2) {\n return 'second(' + _.last(typmods) + ')';\n }\n\n return part;\n });\n }\n\n type.push(intervals.join(' to '));\n }\n\n return type.join(' ');\n }\n\n interval(mask) {\n // ported from https://github.com/lfittl/pg_query/blob/master/lib/pg_query/deparse/interval.rb\n if (this.MASKS == null) {\n this.MASKS = {\n 0: 'RESERV',\n 1: 'MONTH',\n 2: 'YEAR',\n 3: 'DAY',\n 4: 'JULIAN',\n 5: 'TZ',\n 6: 'DTZ',\n 7: 'DYNTZ',\n 8: 'IGNORE_DTF',\n 9: 'AMPM',\n 10: 'HOUR',\n 11: 'MINUTE',\n 12: 'SECOND',\n 13: 'MILLISECOND',\n 14: 'MICROSECOND',\n 15: 'DOY',\n 16: 'DOW',\n 17: 'UNITS',\n 18: 'ADBC',\n 19: 'AGO',\n 20: 'ABS_BEFORE',\n 21: 'ABS_AFTER',\n 22: 'ISODATE',\n 23: 'ISOTIME',\n 24: 'WEEK',\n 25: 'DECADE',\n 26: 'CENTURY',\n 27: 'MILLENNIUM',\n 28: 'DTZMOD'\n };\n }\n\n if (this.BITS == null) {\n this.BITS = _.invert(this.MASKS);\n }\n\n if (this.INTERVALS == null) {\n this.INTERVALS = {};\n this.INTERVALS[(1 << this.BITS.YEAR)] = [ 'year' ];\n this.INTERVALS[(1 << this.BITS.MONTH)] = [ 'month' ];\n this.INTERVALS[(1 << this.BITS.DAY)] = [ 'day' ];\n this.INTERVALS[(1 << this.BITS.HOUR)] = [ 'hour' ];\n this.INTERVALS[(1 << this.BITS.MINUTE)] = [ 'minute' ];\n this.INTERVALS[(1 << this.BITS.SECOND)] = [ 'second' ];\n this.INTERVALS[(1 << this.BITS.YEAR | 1 << this.BITS.MONTH)] = [ 'year', 'month' ];\n this.INTERVALS[(1 << this.BITS.DAY | 1 << this.BITS.HOUR)] = [ 'day', 'hour' ];\n this.INTERVALS[(1 << this.BITS.DAY | 1 << this.BITS.HOUR | 1 << this.BITS.MINUTE)] = [ 'day', 'minute' ];\n this.INTERVALS[(1 << this.BITS.DAY | 1 << this.BITS.HOUR | 1 << this.BITS.MINUTE | 1 << this.BITS.SECOND)] = [ 'day', 'second' ];\n this.INTERVALS[(1 << this.BITS.HOUR | 1 << this.BITS.MINUTE)] = [ 'hour', 'minute' ];\n this.INTERVALS[(1 << this.BITS.HOUR | 1 << this.BITS.MINUTE | 1 << this.BITS.SECOND)] = [ 'hour', 'second' ];\n this.INTERVALS[(1 << this.BITS.MINUTE | 1 << this.BITS.SECOND)] = [ 'minute', 'second' ];\n\n // utils/timestamp.h\n // #define INTERVAL_FULL_RANGE (0x7FFF)\n this.INTERVALS[this.INTERVAL_FULL_RANGE = '32767'] = [];\n }\n\n return this.INTERVALS[mask.toString()];\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/deparser.js"],"names":[],"mappings":";;;;;;;;AAAA;;;;AACA;;;;MAEQ,I,oBAAA,I;;;AAER,MAAM,UAAU,KAAK;AACnB,SAAO,iBAAE,MAAF,CAAS,iBAAE,OAAF,CAAU,CAAV,CAAT,EAAwB,CAAD,IAAO;AACnC,QAAI,KAAK,IAAT,EAAe;AACb,aAAO,KAAP;AACD;;AAED,WAAO,EAAE,QAAF,GAAa,MAApB;AACD,GANM,CAAP;AAOD,CARD;;AAUA,MAAM,OAAO,CAAC,IAAD,EAAO,IAAP,KAAgB;AAC3B,QAAM,IAAI,KAAJ,CAAU,kBAAO,uBAAP,EAAgC,IAAhC,EAAsC,KAAK,SAAL,CAAe,IAAf,CAAtC,CAAV,CAAN;AACD,CAFD;;AAIA,MAAM,SAAU,MAAD,IAAY;AACzB,SAAO,MAAM,MAAN,GAAe,GAAtB;AACD,CAFD;;AAIA,MAAM,SAAS,SAAT,MAAS,CAAC,IAAD;AAAA,MAAO,KAAP,yDAAe,CAAf;AAAA,SAAqB,IAArB;AAA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AlG,IAA6G,CAAE,KAAF,EAAS,QAAT,CAA7G;AACA,WAAK,SAAL,CAAgB,KAAK,KAAK,IAAL,CAAU,IAAf,GAAsB,KAAK,KAAK,IAAL,CAAU,MAArD,IAAgE,CAAE,MAAF,EAAU,QAAV,CAAhE;AACA,WAAK,SAAL,CAAgB,KAAK,KAAK,IAAL,CAAU,IAAf,GAAsB,KAAK,KAAK,IAAL,CAAU,MAArC,GAA8C,KAAK,KAAK,IAAL,CAAU,MAA7E,IAAwF,CAAE,MAAF,EAAU,QAAV,CAAxF;AACA,WAAK,SAAL,CAAgB,KAAK,KAAK,IAAL,CAAU,MAAf,GAAwB,KAAK,KAAK,IAAL,CAAU,MAAvD,IAAkE,CAAE,QAAF,EAAY,QAAZ,CAAlE;;;;AAIA,WAAK,SAAL,CAAe,KAAK,mBAAL,GAA2B,OAA1C,IAAqD,EAArD;AACD;;AAED,WAAO,KAAK,SAAL,CAAe,KAAK,QAAL,EAAf,CAAP;AACD;AA1wC2B;kBAAT,Q","file":"deparser.js","sourcesContent":["import _ from 'lodash';\nimport { format } from 'util';\n\nconst { keys } = _;\n\nconst compact = o => {\n return _.filter(_.compact(o), (p) => {\n if (p == null) {\n return false;\n }\n\n return p.toString().length;\n });\n};\n\nconst fail = (type, node) => {\n throw new Error(format('Unhandled %s node: %s', type, JSON.stringify(node)));\n};\n\nconst parens = (string) => {\n return '(' + string + ')';\n};\n\nconst indent = (text, count = 1) => text;\n\nexport default class Deparser {\n static deparse(query) {\n return new Deparser(query).deparseQuery();\n }\n\n constructor(tree) {\n this.tree = tree;\n }\n\n deparseQuery() {\n return (this.tree.map(node => this.deparse(node))).join('\\n\\n');\n }\n\n deparseNodes(nodes) {\n return nodes.map(node => this.deparse(node));\n }\n\n list(nodes, separator = ', ') {\n if (!nodes) {\n return '';\n }\n\n return this.deparseNodes(nodes).join(separator);\n }\n\n quote(value) {\n if (value == null) {\n return null;\n }\n\n if (_.isArray(value)) {\n return value.map(o => this.quote(o));\n }\n\n return '\"' + value + '\"';\n }\n\n // SELECT encode(E'''123\\\\000\\\\001', 'base64')\n escape(literal) {\n return \"'\" + literal.replace(/'/g, \"''\") + \"'\";\n }\n\n convertTypeName(typeName, size) {\n switch (typeName) {\n case 'bpchar':\n if (size != null) {\n return 'char';\n }\n // return `pg_catalog.bpchar` below so that the following is symmetric\n // SELECT char 'c' = char 'c' AS true\n return 'pg_catalog.bpchar';\n case 'varchar':\n return 'varchar';\n case 'numeric':\n return 'numeric';\n case 'bool':\n return 'boolean';\n case 'int2':\n return 'smallint';\n case 'int4':\n return 'int';\n case 'int8':\n return 'bigint';\n case 'real': case 'float4':\n return 'real';\n case 'float8':\n return 'pg_catalog.float8';\n case 'text':\n // SELECT EXTRACT(CENTURY FROM CURRENT_DATE)>=21 AS True\n return 'pg_catalog.text';\n case 'date':\n return 'pg_catalog.date';\n case 'time':\n return 'time';\n case 'timetz':\n return 'pg_catalog.timetz';\n case 'timestamp':\n return 'timestamp';\n case 'timestamptz':\n return 'pg_catalog.timestamptz';\n case 'interval':\n return 'interval';\n case 'bit':\n return 'bit';\n default:\n throw new Error(format('Unhandled data type: %s', typeName));\n }\n }\n\n type(names, args) {\n const [ catalog, type ] = names.map(name => this.deparse(name));\n\n const mods = (name, size) => {\n if (size != null) {\n return name + '(' + size + ')';\n }\n\n return name;\n };\n\n // handle the special \"char\" (in quotes) type\n if (names[0].String.str === 'char') {\n names[0].String.str = '\"char\"';\n }\n\n if (catalog !== 'pg_catalog') {\n return mods(this.list(names, '.'), args);\n }\n\n const res = this.convertTypeName(type, args);\n\n return mods(res, args);\n }\n\n deparse(item, context) {\n if (item == null) {\n return null;\n }\n\n if (_.isNumber(item)) {\n return item;\n }\n\n const type = keys(item)[0];\n const node = _.values(item)[0];\n\n if (this[type] == null) {\n throw new Error(type + ' is not implemented');\n }\n\n return this[type](node, context);\n }\n\n ['A_Expr'](node, context) {\n const output = [];\n\n switch (node.kind) {\n case 0: // AEXPR_OP\n if (node.lexpr) {\n output.push(parens(this.deparse(node.lexpr)));\n }\n\n if (node.name.length > 1) {\n const schema = this.deparse(node.name[0]);\n const operator = this.deparse(node.name[1]);\n output.push(`OPERATOR(${schema}.${operator})`);\n } else {\n output.push(this.deparse(node.name[0]));\n }\n\n if (node.rexpr) {\n output.push(parens(this.deparse(node.rexpr)));\n }\n\n if (output.length === 2) {\n return parens(output.join(''));\n }\n\n return parens(output.join(' '));\n\n case 1: // AEXPR_OP_ANY\n output.push(this.deparse(node.lexpr));\n output.push(format('ANY (%s)', this.deparse(node.rexpr)));\n return output.join(` ${this.deparse(node.name[0])} `);\n\n case 2: // AEXPR_OP_ALL\n output.push(this.deparse(node.lexpr));\n output.push(format('ALL (%s)', this.deparse(node.rexpr)));\n return output.join(` ${this.deparse(node.name[0])} `);\n\n case 3: // AEXPR_DISTINCT\n return format('%s IS DISTINCT FROM %s', this.deparse(node.lexpr), this.deparse(node.rexpr));\n\n case 4: // AEXPR_NULLIF\n return format('NULLIF(%s, %s)', this.deparse(node.lexpr), this.deparse(node.rexpr));\n\n case 5: { // AEXPR_OF\n const op = node.name[0].String.str === '=' ? 'IS OF' : 'IS NOT OF';\n return format('%s %s (%s)', this.deparse(node.lexpr), op, this.list(node.rexpr));\n }\n\n case 6: { // AEXPR_IN\n const operator = node.name[0].String.str === '=' ? 'IN' : 'NOT IN';\n\n return format('%s %s (%s)', this.deparse(node.lexpr), operator, this.list(node.rexpr));\n }\n\n case 7: // AEXPR_LIKE\n output.push(this.deparse(node.lexpr));\n\n if (node.name[0].String.str === '!~~') {\n output.push(format('NOT LIKE (%s)', this.deparse(node.rexpr)));\n } else {\n output.push(format('LIKE (%s)', this.deparse(node.rexpr)));\n }\n\n return output.join(' ');\n\n case 8: // AEXPR_ILIKE\n output.push(this.deparse(node.lexpr));\n\n if (node.name[0].String.str === '!~~*') {\n output.push(format('NOT ILIKE (%s)', this.deparse(node.rexpr)));\n } else {\n output.push(format('ILIKE (%s)', this.deparse(node.rexpr)));\n }\n\n return output.join(' ');\n\n case 9: // AEXPR_SIMILAR\n // SIMILAR TO emits a similar_escape FuncCall node with the first argument\n output.push(this.deparse(node.lexpr));\n\n if (this.deparse(node.rexpr.FuncCall.args[1].Null)) {\n output.push(format('SIMILAR TO %s', this.deparse(node.rexpr.FuncCall.args[0])));\n } else {\n output.push(format('SIMILAR TO %s ESCAPE %s',\n this.deparse(node.rexpr.FuncCall.args[0]),\n this.deparse(node.rexpr.FuncCall.args[1])));\n }\n\n return output.join(' ');\n\n case 10: // AEXPR_BETWEEN TODO(zhm) untested\n output.push(this.deparse(node.lexpr));\n output.push(format('BETWEEN %s AND %s', this.deparse(node.rexpr[0]), this.deparse(node.rexpr[1])));\n return output.join(' ');\n\n case 11: // AEXPR_NOT_BETWEEN TODO(zhm) untested\n output.push(this.deparse(node.lexpr));\n output.push(format('NOT BETWEEN %s AND %s', this.deparse(node.rexpr[0]), this.deparse(node.rexpr[1])));\n return output.join(' ');\n\n default:\n return fail('A_Expr', node);\n }\n }\n\n ['Alias'](node, context) {\n const name = node.aliasname;\n\n const output = [ 'AS' ];\n\n if (node.colnames) {\n output.push(name + parens(this.list(node.colnames)));\n } else {\n output.push(this.quote(name));\n }\n\n return output.join(' ');\n }\n\n ['A_ArrayExpr'](node) {\n return format('ARRAY[%s]', this.list(node.elements));\n }\n\n ['A_Const'](node, context) {\n if (node.val.String) {\n return this.escape(this.deparse(node.val));\n }\n\n return this.deparse(node.val);\n }\n\n ['A_Indices'](node) {\n if (node.lidx) {\n return format('[%s:%s]', this.deparse(node.lidx), this.deparse(node.uidx));\n }\n\n return format('[%s]', this.deparse(node.uidx));\n }\n\n ['A_Indirection'](node) {\n const output = [ `(${this.deparse(node.arg)})` ];\n\n // TODO(zhm) figure out the actual rules for when a '.' is needed\n //\n // select a.b[0] from a;\n // select (select row(1)).*\n // select c2[2].f2 from comptable\n // select c2.a[2].f2[1].f3[0].a1 from comptable\n\n for (let i = 0; i < node.indirection.length; i++) {\n const subnode = node.indirection[i];\n\n if (subnode.String || subnode.A_Star) {\n const value = subnode.A_Star ? '*' : this.quote(subnode.String.str);\n\n output.push(`.${value}`);\n } else {\n output.push(this.deparse(subnode));\n }\n }\n\n return output.join('');\n }\n\n ['A_Star'](node, context) {\n return '*';\n }\n\n ['BitString'](node) {\n const prefix = node.str[0];\n return `${prefix}'${node.str.substring(1)}'`;\n }\n\n ['BoolExpr'](node) {\n switch (node.boolop) {\n case 0:\n return parens(this.list(node.args, ' AND '));\n case 1:\n return parens(this.list(node.args, ' OR '));\n case 2:\n return format('NOT (%s)', this.deparse(node.args[0]));\n default:\n return fail('BoolExpr', node);\n }\n }\n\n ['BooleanTest'](node) {\n const output = [];\n\n output.push(this.deparse(node.arg));\n\n const tests = [\n 'IS TRUE',\n 'IS NOT TRUE',\n 'IS FALSE',\n 'IS NOT FALSE',\n 'IS UNKNOWN',\n 'IS NOT UNKNOWN'\n ];\n\n output.push(tests[node.booltesttype]);\n\n return output.join(' ');\n }\n\n ['CaseExpr'](node) {\n const output = [ 'CASE' ];\n\n if (node.arg) {\n output.push(this.deparse(node.arg));\n }\n\n for (let i = 0; i < node.args.length; i++) {\n output.push(this.deparse(node.args[i]));\n }\n\n if (node.defresult) {\n output.push('ELSE');\n output.push(this.deparse(node.defresult));\n }\n\n output.push('END');\n\n return output.join(' ');\n }\n\n ['CoalesceExpr'](node) {\n return format('COALESCE(%s)', this.list(node.args));\n }\n\n ['CollateClause'](node) {\n const output = [];\n\n if (node.arg) {\n output.push(this.deparse(node.arg));\n }\n\n output.push('COLLATE');\n\n if (node.collname) {\n output.push(this.quote(this.deparseNodes(node.collname)));\n }\n\n return output.join(' ');\n }\n\n ['ColumnDef'](node) {\n const output = [ this.quote(node.colname) ];\n\n output.push(this.deparse(node.typeName));\n\n if (node.raw_default) {\n output.push('USING');\n output.push(this.deparse(node.raw_default));\n }\n\n if (node.constraints) {\n output.push(this.list(node.constraints, ' '));\n }\n\n return _.compact(output).join(' ');\n }\n\n ['ColumnRef'](node) {\n const fields = node.fields.map(field => {\n if (field.String) {\n return this.quote(this.deparse(field));\n }\n\n return this.deparse(field);\n });\n\n return fields.join('.');\n }\n\n ['CommonTableExpr'](node) {\n const output = [];\n\n output.push(node.ctename);\n\n if (node.aliascolnames) {\n output.push(format('(%s)', this.quote(this.deparseNodes(node.aliascolnames))));\n }\n\n output.push(format('AS (%s)', this.deparse(node.ctequery)));\n\n return output.join(' ');\n }\n\n ['Float'](node) {\n // wrap negative numbers in parens, SELECT (-2147483648)::int4 * (-1)::int4\n if (node.str[0] === '-') {\n return `(${node.str})`;\n }\n\n return node.str;\n }\n\n ['FuncCall'](node, context) {\n const output = [];\n\n let params = [];\n\n if (node.args) {\n params = node.args.map(item => {\n return this.deparse(item);\n });\n }\n\n // COUNT(*)\n if (node.agg_star) {\n params.push('*');\n }\n\n const name = this.list(node.funcname, '.');\n\n const order = [];\n\n const withinGroup = node.agg_within_group;\n\n if (node.agg_order) {\n order.push('ORDER BY');\n order.push(this.list(node.agg_order, ', '));\n }\n\n const call = [];\n\n call.push(name + '(');\n\n if (node.agg_distinct) {\n call.push('DISTINCT ');\n }\n\n // prepend variadic before the last parameter\n // SELECT CONCAT('|', VARIADIC ARRAY['1','2','3'])\n if (node.func_variadic) {\n params[params.length - 1] = 'VARIADIC ' + params[params.length - 1];\n }\n\n call.push(params.join(', '));\n\n if (order.length && !withinGroup) {\n call.push(' ');\n call.push(order.join(' '));\n }\n\n call.push(')');\n\n output.push(compact(call).join(''));\n\n if (order.length && withinGroup) {\n output.push('WITHIN GROUP');\n output.push(parens(order.join(' ')));\n }\n\n if (node.agg_filter != null) {\n output.push(format('FILTER (WHERE %s)', this.deparse(node.agg_filter)));\n }\n\n if (node.over != null) {\n output.push(format('OVER %s', this.deparse(node.over)));\n }\n\n return output.join(' ');\n }\n\n ['GroupingFunc'](node) {\n return 'GROUPING(' + this.list(node.args) + ')';\n }\n\n ['GroupingSet'](node) {\n switch (node.kind) {\n case 0: // GROUPING_SET_EMPTY\n return '()';\n\n case 1: // GROUPING_SET_SIMPLE\n return fail('GroupingSet', node);\n\n case 2: // GROUPING_SET_ROLLUP\n return 'ROLLUP (' + this.list(node.content) + ')';\n\n case 3: // GROUPING_SET_CUBE\n return 'CUBE (' + this.list(node.content) + ')';\n\n case 4: // GROUPING_SET_SETS\n return 'GROUPING SETS (' + this.list(node.content) + ')';\n\n default:\n return fail('GroupingSet', node);\n }\n }\n\n ['Integer'](node) {\n if (node.ival < 0) {\n return `(${node.ival})`;\n }\n\n return node.ival.toString();\n }\n\n ['IntoClause'](node) {\n return this.deparse(node.rel);\n }\n\n ['JoinExpr'](node, context) {\n const output = [];\n\n output.push(this.deparse(node.larg));\n\n if (node.isNatural) {\n output.push('NATURAL');\n }\n\n let join = null;\n\n switch (true) {\n case node.jointype === 0 && (node.quals != null):\n join = 'INNER JOIN';\n break;\n\n case node.jointype === 0 && !node.isNatural && !(node.quals != null) && !(node.usingClause != null):\n join = 'CROSS JOIN';\n break;\n\n case node.jointype === 0:\n join = 'JOIN';\n break;\n\n case node.jointype === 1:\n join = 'LEFT OUTER JOIN';\n break;\n\n case node.jointype === 2:\n join = 'FULL OUTER JOIN';\n break;\n\n case node.jointype === 3:\n join = 'RIGHT OUTER JOIN';\n break;\n\n default:\n fail('JoinExpr', node);\n break;\n }\n\n output.push(join);\n\n if (node.rarg) {\n // wrap nested join expressions in parens to make the following symmetric:\n // select * from int8_tbl x cross join (int4_tbl x cross join lateral (select x.f1) ss)\n if ((node.rarg.JoinExpr != null) && !(node.rarg.JoinExpr.alias != null)) {\n output.push(`(${this.deparse(node.rarg)})`);\n } else {\n output.push(this.deparse(node.rarg));\n }\n }\n\n if (node.quals) {\n output.push(`ON ${this.deparse(node.quals)}`);\n }\n\n if (node.usingClause) {\n const using = this.quote(this.deparseNodes(node.usingClause)).join(', ');\n\n output.push(`USING (${using})`);\n }\n\n const wrapped =\n (node.rarg.JoinExpr != null) || node.alias ? '(' + output.join(' ') + ')'\n : output.join(' ');\n\n if (node.alias) {\n return wrapped + ' ' + this.deparse(node.alias);\n }\n\n return wrapped;\n }\n\n ['LockingClause'](node) {\n const strengths = [\n 'NONE', // LCS_NONE\n 'FOR KEY SHARE',\n 'FOR SHARE',\n 'FOR NO KEY UPDATE',\n 'FOR UPDATE'\n ];\n\n const output = [];\n\n output.push(strengths[node.strength]);\n\n if (node.lockedRels) {\n output.push('OF');\n output.push(this.list(node.lockedRels));\n }\n\n return output.join(' ');\n }\n\n ['MinMaxExpr'](node) {\n const output = [];\n\n if (node.op === 0) {\n output.push('GREATEST');\n } else {\n output.push('LEAST');\n }\n\n output.push(parens(this.list(node.args)));\n\n return output.join('');\n }\n\n ['NamedArgExpr'](node) {\n const output = [];\n\n output.push(node.name);\n output.push(':=');\n output.push(this.deparse(node.arg));\n\n return output.join(' ');\n }\n\n ['Null'](node) {\n return 'NULL';\n }\n\n ['NullTest'](node) {\n const output = [ this.deparse(node.arg) ];\n\n if (node.nulltesttype === 0) {\n output.push('IS NULL');\n } else if (node.nulltesttype === 1) {\n output.push('IS NOT NULL');\n }\n\n return output.join(' ');\n }\n\n ['ParamRef'](node) {\n if (node.number >= 0) {\n return [ '$', node.number ].join('');\n }\n return '?';\n }\n\n ['RangeFunction'](node) {\n const output = [];\n\n if (node.lateral) {\n output.push('LATERAL');\n }\n\n const funcs = [];\n\n for (let i = 0; i < node.functions.length; i++) {\n const funcCall = node.functions[i];\n const call = [ this.deparse(funcCall[0]) ];\n\n if (funcCall[1] && funcCall[1].length) {\n call.push(format('AS (%s)', this.list(funcCall[1])));\n }\n\n funcs.push(call.join(' '));\n }\n\n const calls = funcs.join(', ');\n\n if (node.is_rowsfrom) {\n output.push(`ROWS FROM (${calls})`);\n } else {\n output.push(calls);\n }\n\n if (node.ordinality) {\n output.push('WITH ORDINALITY');\n }\n\n if (node.alias) {\n output.push(this.deparse(node.alias));\n }\n\n if (node.coldeflist) {\n const defList = this.list(node.coldeflist);\n\n if (!node.alias) {\n output.push(` AS (${defList})`);\n } else {\n output.push(`(${defList})`);\n }\n }\n\n return output.join(' ');\n }\n\n ['RangeSubselect'](node, context) {\n let output = '';\n\n if (node.lateral) {\n output += 'LATERAL ';\n }\n\n output += parens(this.deparse(node.subquery));\n\n if (node.alias) {\n return output + ' ' + this.deparse(node.alias);\n }\n\n return output;\n }\n\n ['RangeTableSample'](node) {\n const output = [];\n\n output.push(this.deparse(node.relation));\n output.push('TABLESAMPLE');\n output.push(this.deparse(node.method[0]));\n\n if (node.args) {\n output.push(parens(this.list(node.args)));\n }\n\n if (node.repeatable) {\n output.push('REPEATABLE(' + this.deparse(node.repeatable) + ')');\n }\n\n return output.join(' ');\n }\n\n ['RangeVar'](node, context) {\n const output = [];\n\n if (node.inhOpt === 0) {\n output.push('ONLY');\n }\n\n if (node.relpersistence === 'u') {\n output.push('UNLOGGED');\n }\n\n if (node.relpersistence === 't') {\n output.push('TEMPORARY');\n }\n\n if (node.schemaname != null) {\n output.push(this.quote(node.schemaname));\n output.push('.');\n }\n\n output.push(this.quote(node.relname));\n\n if (node.alias) {\n output.push(this.deparse(node.alias));\n }\n\n return output.join(' ');\n }\n\n ['ResTarget'](node, context) {\n if (context === 'select') {\n return compact([ this.deparse(node.val), this.quote(node.name) ]).join(' AS ');\n } else if (context === 'update') {\n return compact([ node.name, this.deparse(node.val) ]).join(' = ');\n } else if (!(node.val != null)) {\n return this.quote(node.name);\n }\n\n return fail('ResTarget', node);\n }\n\n ['RowExpr'](node) {\n if (node.row_format === 2) {\n return parens(this.list(node.args));\n }\n\n return format('ROW(%s)', this.list(node.args));\n }\n\n ['SelectStmt'](node, context) {\n const output = [];\n\n if (node.withClause) {\n output.push(this.deparse(node.withClause));\n }\n\n if (node.op === 0) {\n // VALUES select's don't get SELECT\n if (node.valuesLists == null) {\n output.push('SELECT');\n }\n } else {\n output.push(parens(this.deparse(node.larg)));\n\n const sets = [\n 'NONE',\n 'UNION',\n 'INTERSECT',\n 'EXCEPT'\n ];\n\n output.push(sets[node.op]);\n\n if (node.all) {\n output.push('ALL');\n }\n\n output.push(parens(this.deparse(node.rarg)));\n }\n\n if (node.distinctClause) {\n if (node.distinctClause[0] != null) {\n output.push('DISTINCT ON');\n\n const clause = (node.distinctClause.map(e => this.deparse(e, 'select'))).join(',\\n');\n\n output.push(`(${clause})`);\n } else {\n output.push('DISTINCT');\n }\n }\n\n if (node.targetList) {\n output.push(indent((node.targetList.map(e => this.deparse(e, 'select'))).join(',\\n')));\n }\n\n if (node.intoClause) {\n output.push('INTO');\n output.push(indent(this.deparse(node.intoClause)));\n }\n\n if (node.fromClause) {\n output.push('FROM');\n output.push(indent((node.fromClause.map(e => this.deparse(e, 'from'))).join(',\\n')));\n }\n\n if (node.whereClause) {\n output.push('WHERE');\n output.push(indent(this.deparse(node.whereClause)));\n }\n\n if (node.valuesLists) {\n output.push('VALUES');\n\n const lists = node.valuesLists.map(list => {\n return `(${(list.map(v => this.deparse(v))).join(', ')})`;\n });\n\n output.push(lists.join(', '));\n }\n\n if (node.groupClause) {\n output.push('GROUP BY');\n output.push(indent((node.groupClause.map(e => this.deparse(e, 'group'))).join(',\\n')));\n }\n\n if (node.havingClause) {\n output.push('HAVING');\n output.push(indent(this.deparse(node.havingClause)));\n }\n\n if (node.windowClause) {\n output.push('WINDOW');\n\n const windows = [];\n\n for (let i = 0; i < node.windowClause.length; i++) {\n const w = node.windowClause[i];\n const window = [];\n\n if (w.WindowDef.name) {\n window.push(this.quote(w.WindowDef.name) + ' AS');\n }\n\n window.push(parens(this.deparse(w, 'window')));\n\n windows.push(window.join(' '));\n }\n\n output.push(windows.join(', '));\n }\n\n if (node.sortClause) {\n output.push('ORDER BY');\n output.push(indent((node.sortClause.map(e => this.deparse(e, 'sort'))).join(',\\n')));\n }\n\n if (node.limitCount) {\n output.push('LIMIT');\n output.push(indent(this.deparse(node.limitCount)));\n }\n\n if (node.limitOffset) {\n output.push('OFFSET');\n output.push(indent(this.deparse(node.limitOffset)));\n }\n\n if (node.lockingClause) {\n node.lockingClause.forEach(item => {\n return output.push(this.deparse(item));\n });\n }\n\n return output.join(' ');\n }\n\n ['SortBy'](node) {\n const output = [];\n\n output.push(this.deparse(node.node));\n\n if (node.sortby_dir === 1) {\n output.push('ASC');\n }\n\n if (node.sortby_dir === 2) {\n output.push('DESC');\n }\n\n if (node.sortby_dir === 3) {\n output.push(`USING ${this.deparseNodes(node.useOp)}`);\n }\n\n if (node.sortby_nulls === 1) {\n output.push('NULLS FIRST');\n }\n\n if (node.sortby_nulls === 2) {\n output.push('NULLS LAST');\n }\n\n return output.join(' ');\n }\n\n ['String'](node) {\n return node.str;\n }\n\n ['SubLink'](node) {\n switch (true) {\n case node.subLinkType === 0:\n return format('EXISTS (%s)', this.deparse(node.subselect));\n case node.subLinkType === 1:\n return format('%s %s ALL (%s)', this.deparse(node.testexpr), this.deparse(node.operName[0]), this.deparse(node.subselect));\n case node.subLinkType === 2 && !(node.operName != null):\n return format('%s IN (%s)', this.deparse(node.testexpr), this.deparse(node.subselect));\n case node.subLinkType === 2:\n return format('%s %s ANY (%s)', this.deparse(node.testexpr), this.deparse(node.operName[0]), this.deparse(node.subselect));\n case node.subLinkType === 3:\n return format('%s %s (%s)', this.deparse(node.testexpr), this.deparse(node.operName[0]), this.deparse(node.subselect));\n case node.subLinkType === 4:\n return format('(%s)', this.deparse(node.subselect));\n case node.subLinkType === 5:\n // TODO(zhm) what is this?\n return fail('SubLink', node);\n // MULTIEXPR_SUBLINK\n // format('(%s)', @deparse(node.subselect))\n case node.subLinkType === 6:\n return format('ARRAY (%s)', this.deparse(node.subselect));\n default:\n return fail('SubLink', node);\n }\n }\n\n ['TypeCast'](node) {\n return this.deparse(node.arg) + '::' + this.deparse(node.typeName);\n }\n\n ['TypeName'](node) {\n if (_.last(node.names).String.str === 'interval') {\n return this.deparseInterval(node);\n }\n\n const output = [];\n\n if (node.setof) {\n output.push('SETOF');\n }\n\n let args = null;\n\n if (node.typmods != null) {\n args = node.typmods.map(item => {\n return this.deparse(item);\n });\n }\n\n const type = [];\n\n type.push(this.type(node.names, args && args.join(', ')));\n\n if (node.arrayBounds != null) {\n type.push('[]');\n }\n\n output.push(type.join(''));\n\n return output.join(' ');\n }\n\n ['CaseWhen'](node) {\n const output = [ 'WHEN' ];\n\n output.push(this.deparse(node.expr));\n output.push('THEN');\n output.push(this.deparse(node.result));\n\n return output.join(' ');\n }\n\n ['WindowDef'](node, context) {\n const output = [];\n\n if (context !== 'window') {\n if (node.name) {\n output.push(node.name);\n }\n }\n\n const empty = (!(node.partitionClause != null) && !(node.orderClause != null));\n\n const frameOptions = this.deparseFrameOptions(node.frameOptions, node.refname, node.startOffset, node.endOffset);\n\n if (empty && context !== 'window' && !(node.name != null) && frameOptions.length === 0) {\n return '()';\n }\n\n const windowParts = [];\n\n let useParens = false;\n\n if (node.partitionClause) {\n const partition = [ 'PARTITION BY' ];\n\n const clause = node.partitionClause.map(item => this.deparse(item));\n\n partition.push(clause.join(', '));\n\n windowParts.push(partition.join(' '));\n useParens = true;\n }\n\n if (node.orderClause) {\n windowParts.push('ORDER BY');\n\n const orders = node.orderClause.map(item => {\n return this.deparse(item);\n });\n\n windowParts.push(orders.join(', '));\n\n useParens = true;\n }\n\n if (frameOptions.length) {\n useParens = true;\n windowParts.push(frameOptions);\n }\n\n if (useParens && context !== 'window') {\n return output.join(' ') + ' (' + windowParts.join(' ') + ')';\n }\n\n return output.join(' ') + windowParts.join(' ');\n }\n\n ['WithClause'](node) {\n const output = [ 'WITH' ];\n\n if (node.recursive) {\n output.push('RECURSIVE');\n }\n\n output.push(this.list(node.ctes));\n\n return output.join(' ');\n }\n\n deparseFrameOptions(options, refName, startOffset, endOffset) {\n const FRAMEOPTION_NONDEFAULT = 0x00001; // any specified?\n const FRAMEOPTION_RANGE = 0x00002; // RANGE behavior\n const FRAMEOPTION_ROWS = 0x00004; // ROWS behavior\n const FRAMEOPTION_BETWEEN = 0x00008; // BETWEEN given?\n const FRAMEOPTION_START_UNBOUNDED_PRECEDING = 0x00010; // start is U. P.\n const FRAMEOPTION_END_UNBOUNDED_PRECEDING = 0x00020; // (disallowed)\n const FRAMEOPTION_START_UNBOUNDED_FOLLOWING = 0x00040; // (disallowed)\n const FRAMEOPTION_END_UNBOUNDED_FOLLOWING = 0x00080; // end is U. F.\n const FRAMEOPTION_START_CURRENT_ROW = 0x00100; // start is C. R.\n const FRAMEOPTION_END_CURRENT_ROW = 0x00200; // end is C. R.\n const FRAMEOPTION_START_VALUE_PRECEDING = 0x00400; // start is V. P.\n const FRAMEOPTION_END_VALUE_PRECEDING = 0x00800; // end is V. P.\n const FRAMEOPTION_START_VALUE_FOLLOWING = 0x01000; // start is V. F.\n const FRAMEOPTION_END_VALUE_FOLLOWING = 0x02000; // end is V. F.\n\n if (!(options & FRAMEOPTION_NONDEFAULT)) {\n return '';\n }\n\n const output = [];\n\n if (refName != null) {\n output.push(refName);\n }\n\n if (options & FRAMEOPTION_RANGE) {\n output.push('RANGE');\n }\n\n if (options & FRAMEOPTION_ROWS) {\n output.push('ROWS');\n }\n\n const between = options & FRAMEOPTION_BETWEEN;\n\n if (between) {\n output.push('BETWEEN');\n }\n\n if (options & FRAMEOPTION_START_UNBOUNDED_PRECEDING) {\n output.push('UNBOUNDED PRECEDING');\n }\n\n if (options & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) {\n output.push('UNBOUNDED FOLLOWING');\n }\n\n if (options & FRAMEOPTION_START_CURRENT_ROW) {\n output.push('CURRENT ROW');\n }\n\n if (options & FRAMEOPTION_START_VALUE_PRECEDING) {\n output.push(this.deparse(startOffset) + ' PRECEDING');\n }\n\n if (options & FRAMEOPTION_START_VALUE_FOLLOWING) {\n output.push(this.deparse(startOffset) + ' FOLLOWING');\n }\n\n if (between) {\n output.push('AND');\n\n if (options & FRAMEOPTION_END_UNBOUNDED_PRECEDING) {\n output.push('UNBOUNDED PRECEDING');\n }\n\n if (options & FRAMEOPTION_END_UNBOUNDED_FOLLOWING) {\n output.push('UNBOUNDED FOLLOWING');\n }\n\n if (options & FRAMEOPTION_END_CURRENT_ROW) {\n output.push('CURRENT ROW');\n }\n\n if (options & FRAMEOPTION_END_VALUE_PRECEDING) {\n output.push(this.deparse(endOffset) + ' PRECEDING');\n }\n\n if (options & FRAMEOPTION_END_VALUE_FOLLOWING) {\n output.push(this.deparse(endOffset) + ' FOLLOWING');\n }\n }\n\n return output.join(' ');\n }\n\n deparseInterval(node) {\n const type = [ 'interval' ];\n\n if (node.arrayBounds != null) {\n type.push('[]');\n }\n\n if (node.typmods) {\n const typmods = node.typmods.map(item => this.deparse(item));\n\n let intervals = this.interval(typmods[0]);\n\n // SELECT interval(0) '1 day 01:23:45.6789'\n if (node.typmods[0] && node.typmods[0].A_Const && node.typmods[0].A_Const.val.Integer.ival === 32767 && node.typmods[1] && (node.typmods[1].A_Const != null)) {\n intervals = [ `(${node.typmods[1].A_Const.val.Integer.ival})` ];\n } else {\n intervals = intervals.map(part => {\n if (part === 'second' && typmods.length === 2) {\n return 'second(' + _.last(typmods) + ')';\n }\n\n return part;\n });\n }\n\n type.push(intervals.join(' to '));\n }\n\n return type.join(' ');\n }\n\n interval(mask) {\n // ported from https://github.com/lfittl/pg_query/blob/master/lib/pg_query/deparse/interval.rb\n if (this.MASKS == null) {\n this.MASKS = {\n 0: 'RESERV',\n 1: 'MONTH',\n 2: 'YEAR',\n 3: 'DAY',\n 4: 'JULIAN',\n 5: 'TZ',\n 6: 'DTZ',\n 7: 'DYNTZ',\n 8: 'IGNORE_DTF',\n 9: 'AMPM',\n 10: 'HOUR',\n 11: 'MINUTE',\n 12: 'SECOND',\n 13: 'MILLISECOND',\n 14: 'MICROSECOND',\n 15: 'DOY',\n 16: 'DOW',\n 17: 'UNITS',\n 18: 'ADBC',\n 19: 'AGO',\n 20: 'ABS_BEFORE',\n 21: 'ABS_AFTER',\n 22: 'ISODATE',\n 23: 'ISOTIME',\n 24: 'WEEK',\n 25: 'DECADE',\n 26: 'CENTURY',\n 27: 'MILLENNIUM',\n 28: 'DTZMOD'\n };\n }\n\n if (this.BITS == null) {\n this.BITS = _.invert(this.MASKS);\n }\n\n if (this.INTERVALS == null) {\n this.INTERVALS = {};\n this.INTERVALS[(1 << this.BITS.YEAR)] = [ 'year' ];\n this.INTERVALS[(1 << this.BITS.MONTH)] = [ 'month' ];\n this.INTERVALS[(1 << this.BITS.DAY)] = [ 'day' ];\n this.INTERVALS[(1 << this.BITS.HOUR)] = [ 'hour' ];\n this.INTERVALS[(1 << this.BITS.MINUTE)] = [ 'minute' ];\n this.INTERVALS[(1 << this.BITS.SECOND)] = [ 'second' ];\n this.INTERVALS[(1 << this.BITS.YEAR | 1 << this.BITS.MONTH)] = [ 'year', 'month' ];\n this.INTERVALS[(1 << this.BITS.DAY | 1 << this.BITS.HOUR)] = [ 'day', 'hour' ];\n this.INTERVALS[(1 << this.BITS.DAY | 1 << this.BITS.HOUR | 1 << this.BITS.MINUTE)] = [ 'day', 'minute' ];\n this.INTERVALS[(1 << this.BITS.DAY | 1 << this.BITS.HOUR | 1 << this.BITS.MINUTE | 1 << this.BITS.SECOND)] = [ 'day', 'second' ];\n this.INTERVALS[(1 << this.BITS.HOUR | 1 << this.BITS.MINUTE)] = [ 'hour', 'minute' ];\n this.INTERVALS[(1 << this.BITS.HOUR | 1 << this.BITS.MINUTE | 1 << this.BITS.SECOND)] = [ 'hour', 'second' ];\n this.INTERVALS[(1 << this.BITS.MINUTE | 1 << this.BITS.SECOND)] = [ 'minute', 'second' ];\n\n // utils/timestamp.h\n // #define INTERVAL_FULL_RANGE (0x7FFF)\n this.INTERVALS[this.INTERVAL_FULL_RANGE = '32767'] = [];\n }\n\n return this.INTERVALS[mask.toString()];\n }\n}\n"]} \ No newline at end of file