Comparing version 1.0.0-beta.1 to 1.0.0-beta.2
@@ -35,4 +35,5 @@ "use strict"; | ||
type SQLNode = SQLRawNode | SQLValueNode | SQLIdentifierNode | ||
type SQLQuery = Array<SQLNode> | ||
export opaque type SQLNode = SQLRawNode | SQLValueNode | SQLIdentifierNode | ||
export opaque type SQLQuery = Array<SQLNode> | ||
export opaque type SQL = SQLNode | SQLQuery; | ||
@@ -331,8 +332,2 @@ type QueryConfig = { | ||
/*:: | ||
export opaque type OpaqueSQLNode = SQLNode; | ||
export opaque type OpaqueSQLQuery = SQLQuery; | ||
export opaque type SQL = OpaqueSQLNode | OpaqueSQLQuery; | ||
*/ | ||
// The types we export are stricter so people get the right hinting | ||
@@ -342,3 +337,3 @@ | ||
) /*: Array<SQL> */ | ||
/*: OpaqueSQLQuery */{ | ||
/*: SQLQuery */{ | ||
for (var _len3 = arguments.length, values = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
@@ -353,3 +348,3 @@ values[_key3 - 1] = arguments[_key3]; | ||
exports.raw = function sqlRaw(text /*: string */) /*: OpaqueSQLNode */{ | ||
exports.raw = function sqlRaw(text /*: string */) /*: SQLNode */{ | ||
return raw(text); | ||
@@ -359,10 +354,11 @@ }; | ||
exports.identifier = function sqlIdentifier() /*: Array<string | Symbol> */ | ||
/*: OpaqueSQLNode */{ | ||
/*: SQLNode */{ | ||
return identifier.apply(undefined, arguments); | ||
}; | ||
exports.value = function sqlValue(val /*: mixed */) /*: OpaqueSQLNode */{ | ||
exports.value = function sqlValue(val /*: mixed */) /*: SQLNode */{ | ||
return value(val); | ||
}; | ||
exports.literal = function sqlLiteral(val /*: mixed */) /*: OpaqueSQLNode */{ | ||
exports.literal = function sqlLiteral(val /*: mixed */) /*: SQLNode */{ | ||
return literal(val); | ||
@@ -372,3 +368,3 @@ }; | ||
exports.join = function sqlJoin(items /*: Array<SQL> */ | ||
) /*: OpaqueSQLQuery */{ | ||
) /*: SQLQuery */{ | ||
var separator /*: string */ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ""; | ||
@@ -379,4 +375,3 @@ | ||
exports.compile = function sqlCompile(sql /*: OpaqueSQLQuery */ | ||
) /*: QueryConfig */{ | ||
exports.compile = function sqlCompile(sql /*: SQLQuery */) /*: QueryConfig */{ | ||
return compile(sql); | ||
@@ -383,0 +378,0 @@ }; |
{ | ||
"name": "pg-sql2", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"description": "Generate safe Postgres-compliant SQL with tagged template literals", | ||
@@ -44,3 +44,3 @@ "main": "index.js", | ||
"eslint-plugin-prettier": "^2.1.2", | ||
"flow-bin": "^0.50.0", | ||
"flow-bin": "^0.52.0", | ||
"jest": "20.0.4", | ||
@@ -47,0 +47,0 @@ "markdown-doctest": "^0.9.1", |
@@ -34,4 +34,5 @@ "use strict"; | ||
type SQLNode = SQLRawNode | SQLValueNode | SQLIdentifierNode | ||
type SQLQuery = Array<SQLNode> | ||
export opaque type SQLNode = SQLRawNode | SQLValueNode | SQLIdentifierNode | ||
export opaque type SQLQuery = Array<SQLNode> | ||
export opaque type SQL = SQLNode | SQLQuery; | ||
@@ -309,8 +310,2 @@ type QueryConfig = { | ||
/*:: | ||
export opaque type OpaqueSQLNode = SQLNode; | ||
export opaque type OpaqueSQLQuery = SQLQuery; | ||
export opaque type SQL = OpaqueSQLNode | OpaqueSQLQuery; | ||
*/ | ||
// The types we export are stricter so people get the right hinting | ||
@@ -321,3 +316,3 @@ | ||
...values /*: Array<SQL> */ | ||
) /*: OpaqueSQLQuery */ { | ||
) /*: SQLQuery */ { | ||
return query(strings, ...values); | ||
@@ -328,3 +323,3 @@ }; | ||
exports.raw = function sqlRaw(text /*: string */) /*: OpaqueSQLNode */ { | ||
exports.raw = function sqlRaw(text /*: string */) /*: SQLNode */ { | ||
return raw(text); | ||
@@ -335,10 +330,11 @@ }; | ||
...names /*: Array<string | Symbol> */ | ||
) /*: OpaqueSQLNode */ { | ||
) /*: SQLNode */ { | ||
return identifier(...names); | ||
}; | ||
exports.value = function sqlValue(val /*: mixed */) /*: OpaqueSQLNode */ { | ||
exports.value = function sqlValue(val /*: mixed */) /*: SQLNode */ { | ||
return value(val); | ||
}; | ||
exports.literal = function sqlLiteral(val /*: mixed */) /*: OpaqueSQLNode */ { | ||
exports.literal = function sqlLiteral(val /*: mixed */) /*: SQLNode */ { | ||
return literal(val); | ||
@@ -350,9 +346,7 @@ }; | ||
separator /*: string */ = "" | ||
) /*: OpaqueSQLQuery */ { | ||
) /*: SQLQuery */ { | ||
return join(items, separator); | ||
}; | ||
exports.compile = function sqlCompile( | ||
sql /*: OpaqueSQLQuery */ | ||
) /*: QueryConfig */ { | ||
exports.compile = function sqlCompile(sql /*: SQLQuery */) /*: QueryConfig */ { | ||
return compile(sql); | ||
@@ -359,0 +353,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29167
638