🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

pg-sql2

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-sql2 - npm Package Compare versions

Comparing version

to
5.0.0-alpha.2

17

CHANGELOG.md
# pg-sql2
## 5.0.0-alpha.2
### Patch Changes
- [`82cc01152`](https://github.com/benjie/postgraphile-private/commit/82cc01152ee06dafce45299661afd77ad943d785)
Thanks [@benjie](https://github.com/benjie)! - Performance overhaul and new
cache method.
- [`7f857950a`](https://github.com/benjie/postgraphile-private/commit/7f857950a7e4ec763c936eb6bd1fb77824041d71)
Thanks [@benjie](https://github.com/benjie)! - Upgrade to the latest
TypeScript/tslib
- Updated dependencies
[[`98ae00f59`](https://github.com/benjie/postgraphile-private/commit/98ae00f59a8ab3edc5718ad8437a0dab734a7d69),
[`7f857950a`](https://github.com/benjie/postgraphile-private/commit/7f857950a7e4ec763c936eb6bd1fb77824041d71)]:
- @graphile/lru@5.0.0-alpha.2
## 5.0.0-alpha.1

@@ -4,0 +21,0 @@

40

dist/index.js

@@ -135,3 +135,2 @@ "use strict";

}
const CHARCODE_A = "A".charCodeAt(0);
function makeQueryNode(nodes, flags = 0) {

@@ -143,4 +142,5 @@ let checksum = 0;

const { t } = node;
for (let i = 0, l = Math.min(t.length, 10000); i < l; i++) {
checksum += Math.min(t.charCodeAt(i) - CHARCODE_A, 100);
// Max value of charCodeAt is 65535. 65535 * 10000 < 2^30.
for (let i = 0, l = t.length, l2 = l > 10000 ? 10000 : l; i < l2; i++) {
checksum += t.charCodeAt(i);
}

@@ -241,3 +241,5 @@ break;

const sqlFragments = [];
const trustedInput = enforceValidNode(untrustedInput, ``);
const trustedInput = untrustedInput[$$type] !== undefined
? untrustedInput
: enforceValidNode(untrustedInput, ``);
const items = trustedInput[$$type] === "QUERY"

@@ -248,3 +250,6 @@ ? expandQueryNodes(trustedInput)

for (let itemIndex = 0; itemIndex < itemCount; itemIndex++) {
const item = enforceValidNode(items[itemIndex], `item ${itemIndex}`);
const itemAtIndex = items[itemIndex];
const item = itemAtIndex[$$type] !== undefined
? itemAtIndex
: enforceValidNode(itemAtIndex, `item ${itemIndex}`);
switch (item[$$type]) {

@@ -373,7 +378,7 @@ case "RAW": {

}
let node = CACHE_SIMPLE_FRAGMENTS.get(first);
if (!node) {
node = makeRawNode(first);
CACHE_SIMPLE_FRAGMENTS.set(first, node);
}
const existing = CACHE_SIMPLE_FRAGMENTS.get(first);
if (existing)
return existing;
const node = makeRawNode(first);
CACHE_SIMPLE_FRAGMENTS.set(first, node);
return node;

@@ -389,9 +394,8 @@ }

const text = strings[i];
if (typeof text !== "string") {
throw new Error("[pg-sql2] sql.query must be invoked as a template literal, not a function call.");
}
currentText += text;
if (i < l - 1) {
const rawVal = values[i];
const valid = enforceValidNode(rawVal, `template literal placeholder ${i}`);
const valid = rawVal[$$type] !== undefined
? rawVal
: enforceValidNode(rawVal, `template literal placeholder ${i}`);
if (valid[$$type] === "RAW") {

@@ -568,3 +572,5 @@ currentText += valid.t;

const rawNode = items[0];
const node = enforceValidNode(rawNode, `join item ${0}`);
const node = rawNode[$$type] !== undefined
? rawNode
: enforceValidNode(rawNode, `join item ${0}`);
return node;

@@ -578,3 +584,5 @@ }

const addSeparator = i > 0 && hasSeparator;
const node = enforceValidNode(rawNode, `join item ${i}`);
const node = rawNode[$$type] !== undefined
? rawNode
: enforceValidNode(rawNode, `join item ${i}`);
if (addSeparator) {

@@ -581,0 +589,0 @@ currentText += separator;

3

dist/thereCanBeOnlyOne.d.ts

@@ -1,2 +0,3 @@

export {};
declare const $$pgSql2: unique symbol;
declare const globalAny: any;
//# sourceMappingURL=thereCanBeOnlyOne.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const $$pgSql2 = Symbol.for("pgSql2");

@@ -4,0 +3,0 @@ const globalAny = globalThis;

{
"name": "pg-sql2",
"version": "5.0.0-alpha.1",
"version": "5.0.0-alpha.2",
"description": "Generate safe Postgres-compliant SQL with tagged template literals",

@@ -44,7 +44,7 @@ "main": "dist/index.js",

"ts-node": "^10.9.1",
"typescript": "^5.0.0-beta"
"typescript": "^5.0.4"
},
"dependencies": {
"@graphile/lru": "^5.0.0-alpha.1",
"tslib": "^2.4.0"
"@graphile/lru": "^5.0.0-alpha.2",
"tslib": "^2.5.0"
},

@@ -51,0 +51,0 @@ "files": [

@@ -28,8 +28,8 @@ # pg-sql2

<td align="center"><a href="https://surge.io/"><img src="https://graphile.org/images/sponsors/surge.png" width="90" height="90" alt="Surge" /><br />Surge</a> *</td>
<td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
<td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
<td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
<td align="center"><a href="https://qwick.com/"><img src="https://graphile.org/images/sponsors/qwick.png" width="90" height="90" alt="Qwick" /><br />Qwick</a> *</td>
</tr><tr>
<td align="center"><a href="http://chads.website"><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
<td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
<td align="center"><a href="https://www.netflix.com/"><img src="https://graphile.org/images/sponsors/Netflix.png" width="90" height="90" alt="Netflix" /><br />Netflix</a> *</td>
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/chadf.png" width="90" height="90" alt="Chad Furman" /><br />Chad Furman</a> *</td>
<td align="center"><a href="https://www.enzuzo.com/"><img src="https://graphile.org/images/sponsors/enzuzo.png" width="90" height="90" alt="Enzuzo" /><br />Enzuzo</a> *</td>

@@ -36,0 +36,0 @@ <td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet