@prisma/param-graph
Advanced tools
@@ -30,52 +30,11 @@ "use strict"; | ||
| const MAX_COMPACT_INDEX = 65534; | ||
| const BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; | ||
| function encodeBase64url(bytes) { | ||
| let result = ""; | ||
| const len = bytes.length; | ||
| let i = 0; | ||
| while (i < len) { | ||
| const b0 = bytes[i++]; | ||
| const hasB1 = i < len; | ||
| const b1 = hasB1 ? bytes[i++] : 0; | ||
| const hasB2 = i < len; | ||
| const b2 = hasB2 ? bytes[i++] : 0; | ||
| result += BASE64URL_CHARS[b0 >> 2 & 63]; | ||
| result += BASE64URL_CHARS[(b0 << 4 | b1 >> 4) & 63]; | ||
| if (hasB1) { | ||
| result += BASE64URL_CHARS[(b1 << 2 | b2 >> 6) & 63]; | ||
| } | ||
| if (hasB2) { | ||
| result += BASE64URL_CHARS[b2 & 63]; | ||
| } | ||
| } | ||
| return result; | ||
| return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64url"); | ||
| } | ||
| function decodeBase64url(str) { | ||
| const charToIndex = new Uint8Array(128); | ||
| for (let i = 0; i < BASE64URL_CHARS.length; i++) { | ||
| charToIndex[BASE64URL_CHARS.charCodeAt(i)] = i; | ||
| } | ||
| const len = str.length; | ||
| const outputLen = Math.floor(len * 3 / 4); | ||
| const bytes = new Uint8Array(outputLen); | ||
| let bi = 0; | ||
| for (let i = 0; i < len; ) { | ||
| const c0 = charToIndex[str.charCodeAt(i++)]; | ||
| const c1 = i < len ? charToIndex[str.charCodeAt(i++)] : 0; | ||
| const c2 = i < len ? charToIndex[str.charCodeAt(i++)] : 0; | ||
| const c3 = i < len ? charToIndex[str.charCodeAt(i++)] : 0; | ||
| bytes[bi++] = c0 << 2 | c1 >> 4; | ||
| if (bi < outputLen) bytes[bi++] = (c1 << 4 | c2 >> 2) & 255; | ||
| if (bi < outputLen) bytes[bi++] = (c2 << 6 | c3) & 255; | ||
| } | ||
| return bytes; | ||
| return Buffer.from(str, "base64url"); | ||
| } | ||
| function serializeParamGraph(data) { | ||
| const rootKeys = Object.keys(data.roots); | ||
| const maxIndex = Math.max( | ||
| data.strings.length, | ||
| data.inputNodes.length, | ||
| data.outputNodes.length, | ||
| rootKeys.length | ||
| ); | ||
| const maxIndex = Math.max(data.strings.length, data.inputNodes.length, data.outputNodes.length, rootKeys.length); | ||
| const useWide = maxIndex > MAX_COMPACT_INDEX; | ||
@@ -82,0 +41,0 @@ let size = 1; |
@@ -6,52 +6,11 @@ const FORMAT_COMPACT = 0; | ||
| const MAX_COMPACT_INDEX = 65534; | ||
| const BASE64URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; | ||
| function encodeBase64url(bytes) { | ||
| let result = ""; | ||
| const len = bytes.length; | ||
| let i = 0; | ||
| while (i < len) { | ||
| const b0 = bytes[i++]; | ||
| const hasB1 = i < len; | ||
| const b1 = hasB1 ? bytes[i++] : 0; | ||
| const hasB2 = i < len; | ||
| const b2 = hasB2 ? bytes[i++] : 0; | ||
| result += BASE64URL_CHARS[b0 >> 2 & 63]; | ||
| result += BASE64URL_CHARS[(b0 << 4 | b1 >> 4) & 63]; | ||
| if (hasB1) { | ||
| result += BASE64URL_CHARS[(b1 << 2 | b2 >> 6) & 63]; | ||
| } | ||
| if (hasB2) { | ||
| result += BASE64URL_CHARS[b2 & 63]; | ||
| } | ||
| } | ||
| return result; | ||
| return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).toString("base64url"); | ||
| } | ||
| function decodeBase64url(str) { | ||
| const charToIndex = new Uint8Array(128); | ||
| for (let i = 0; i < BASE64URL_CHARS.length; i++) { | ||
| charToIndex[BASE64URL_CHARS.charCodeAt(i)] = i; | ||
| } | ||
| const len = str.length; | ||
| const outputLen = Math.floor(len * 3 / 4); | ||
| const bytes = new Uint8Array(outputLen); | ||
| let bi = 0; | ||
| for (let i = 0; i < len; ) { | ||
| const c0 = charToIndex[str.charCodeAt(i++)]; | ||
| const c1 = i < len ? charToIndex[str.charCodeAt(i++)] : 0; | ||
| const c2 = i < len ? charToIndex[str.charCodeAt(i++)] : 0; | ||
| const c3 = i < len ? charToIndex[str.charCodeAt(i++)] : 0; | ||
| bytes[bi++] = c0 << 2 | c1 >> 4; | ||
| if (bi < outputLen) bytes[bi++] = (c1 << 4 | c2 >> 2) & 255; | ||
| if (bi < outputLen) bytes[bi++] = (c2 << 6 | c3) & 255; | ||
| } | ||
| return bytes; | ||
| return Buffer.from(str, "base64url"); | ||
| } | ||
| function serializeParamGraph(data) { | ||
| const rootKeys = Object.keys(data.roots); | ||
| const maxIndex = Math.max( | ||
| data.strings.length, | ||
| data.inputNodes.length, | ||
| data.outputNodes.length, | ||
| rootKeys.length | ||
| ); | ||
| const maxIndex = Math.max(data.strings.length, data.inputNodes.length, data.outputNodes.length, rootKeys.length); | ||
| const useWide = maxIndex > MAX_COMPACT_INDEX; | ||
@@ -58,0 +17,0 @@ let size = 1; |
+1
-1
| { | ||
| "name": "@prisma/param-graph", | ||
| "version": "7.4.0-integration-parameterization.8", | ||
| "version": "7.4.0-integration-parameterization.9", | ||
| "description": "This package is intended for Prisma's internal use", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
63013
-3.72%1555
-5.01%