Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@planetscale/database

Package Overview
Dependencies
Maintainers
7
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@planetscale/database - npm Package Compare versions

Comparing version 1.16.0 to 1.17.0

dist/cast.d.ts

4

dist/cjs/index.d.ts

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

import { cast } from './cast.js';
export { cast } from './cast.js';
import { format } from './sanitization.js';

@@ -60,2 +62,3 @@ export { format } from './sanitization.js';

charset?: number | null;
decimals?: number;
flags?: number | null;

@@ -101,2 +104,1 @@ columnType?: string | null;

export declare function connect(config: Config): Connection;
export declare function cast(field: Field, value: string | null): any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cast = exports.connect = exports.Connection = exports.Client = exports.DatabaseError = exports.hex = exports.format = void 0;
exports.connect = exports.Connection = exports.Client = exports.DatabaseError = exports.hex = exports.format = exports.cast = void 0;
const cast_js_1 = require("./cast.js");
var cast_js_2 = require("./cast.js");
Object.defineProperty(exports, "cast", { enumerable: true, get: function () { return cast_js_2.cast; } });
const sanitization_js_1 = require("./sanitization.js");
var sanitization_js_2 = require("./sanitization.js");
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return sanitization_js_2.format; } });
const text_js_1 = require("./text.js");
var text_js_2 = require("./text.js");
Object.defineProperty(exports, "hex", { enumerable: true, get: function () { return text_js_2.hex; } });
var text_js_1 = require("./text.js");
Object.defineProperty(exports, "hex", { enumerable: true, get: function () { return text_js_1.hex; } });
const version_js_1 = require("./version.js");

@@ -104,3 +106,3 @@ class DatabaseError extends Error {

}
const castFn = options.cast || this.config.cast || cast;
const castFn = options.cast || this.config.cast || cast_js_1.cast;
const rows = result ? parse(result, castFn, options.as || 'object') : [];

@@ -195,54 +197,1 @@ const headers = fields.map((f) => f.name);

}
function cast(field, value) {
if (value == null) {
return value;
}
switch (field.type) {
case 'INT8':
case 'INT16':
case 'INT24':
case 'INT32':
case 'UINT8':
case 'UINT16':
case 'UINT24':
case 'UINT32':
case 'YEAR':
return parseInt(value, 10);
case 'FLOAT32':
case 'FLOAT64':
return parseFloat(value);
case 'DECIMAL':
case 'INT64':
case 'UINT64':
case 'DATE':
case 'TIME':
case 'DATETIME':
case 'TIMESTAMP':
return value;
case 'BLOB':
case 'BIT':
case 'GEOMETRY':
return (0, text_js_1.uint8Array)(value);
case 'BINARY':
case 'VARBINARY':
return isText(field) ? value : (0, text_js_1.uint8Array)(value);
case 'JSON':
return value ? JSON.parse((0, text_js_1.decode)(value)) : value;
default:
return (0, text_js_1.decode)(value);
}
}
exports.cast = cast;
var Flags;
(function (Flags) {
Flags[Flags["NONE"] = 0] = "NONE";
Flags[Flags["ISINTEGRAL"] = 256] = "ISINTEGRAL";
Flags[Flags["ISUNSIGNED"] = 512] = "ISUNSIGNED";
Flags[Flags["ISFLOAT"] = 1024] = "ISFLOAT";
Flags[Flags["ISQUOTED"] = 2048] = "ISQUOTED";
Flags[Flags["ISTEXT"] = 4096] = "ISTEXT";
Flags[Flags["ISBINARY"] = 8192] = "ISBINARY";
})(Flags || (Flags = {}));
function isText(field) {
return ((field.flags ?? 0) & Flags.ISTEXT) === Flags.ISTEXT;
}

@@ -1,4 +0,4 @@

export declare function decode(text: string | null | undefined): string;
export declare function decodeUtf8(text: string | null | undefined): string;
export declare function hex(text: string): string;
export declare function uint8Array(text: string): Uint8Array;
export declare function uint8ArrayToHex(uint8: Uint8Array): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uint8ArrayToHex = exports.uint8Array = exports.hex = exports.decode = void 0;
exports.uint8ArrayToHex = exports.uint8Array = exports.hex = exports.decodeUtf8 = void 0;
const decoder = new TextDecoder('utf-8');
function decode(text) {
function decodeUtf8(text) {
return text ? decoder.decode(uint8Array(text)) : '';
}
exports.decode = decode;
exports.decodeUtf8 = decodeUtf8;
function hex(text) {

@@ -10,0 +10,0 @@ const digits = bytes(text).map((b) => b.toString(16).padStart(2, '0'));

@@ -1,1 +0,1 @@

export declare const Version = "1.16.0";
export declare const Version = "1.17.0";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Version = void 0;
exports.Version = '1.16.0';
exports.Version = '1.17.0';

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

import { cast } from './cast.js';
export { cast } from './cast.js';
import { format } from './sanitization.js';

@@ -60,2 +62,3 @@ export { format } from './sanitization.js';

charset?: number | null;
decimals?: number;
flags?: number | null;

@@ -101,2 +104,1 @@ columnType?: string | null;

export declare function connect(config: Config): Connection;
export declare function cast(field: Field, value: string | null): any;

@@ -0,4 +1,5 @@

import { cast } from './cast.js';
export { cast } from './cast.js';
import { format } from './sanitization.js';
export { format } from './sanitization.js';
import { decode, uint8Array } from './text.js';
export { hex } from './text.js';

@@ -185,53 +186,1 @@ import { Version } from './version.js';

}
export function cast(field, value) {
if (value == null) {
return value;
}
switch (field.type) {
case 'INT8':
case 'INT16':
case 'INT24':
case 'INT32':
case 'UINT8':
case 'UINT16':
case 'UINT24':
case 'UINT32':
case 'YEAR':
return parseInt(value, 10);
case 'FLOAT32':
case 'FLOAT64':
return parseFloat(value);
case 'DECIMAL':
case 'INT64':
case 'UINT64':
case 'DATE':
case 'TIME':
case 'DATETIME':
case 'TIMESTAMP':
return value;
case 'BLOB':
case 'BIT':
case 'GEOMETRY':
return uint8Array(value);
case 'BINARY':
case 'VARBINARY':
return isText(field) ? value : uint8Array(value);
case 'JSON':
return value ? JSON.parse(decode(value)) : value;
default:
return decode(value);
}
}
var Flags;
(function (Flags) {
Flags[Flags["NONE"] = 0] = "NONE";
Flags[Flags["ISINTEGRAL"] = 256] = "ISINTEGRAL";
Flags[Flags["ISUNSIGNED"] = 512] = "ISUNSIGNED";
Flags[Flags["ISFLOAT"] = 1024] = "ISFLOAT";
Flags[Flags["ISQUOTED"] = 2048] = "ISQUOTED";
Flags[Flags["ISTEXT"] = 4096] = "ISTEXT";
Flags[Flags["ISBINARY"] = 8192] = "ISBINARY";
})(Flags || (Flags = {}));
function isText(field) {
return ((field.flags ?? 0) & Flags.ISTEXT) === Flags.ISTEXT;
}

@@ -1,4 +0,4 @@

export declare function decode(text: string | null | undefined): string;
export declare function decodeUtf8(text: string | null | undefined): string;
export declare function hex(text: string): string;
export declare function uint8Array(text: string): Uint8Array;
export declare function uint8ArrayToHex(uint8: Uint8Array): string;
const decoder = new TextDecoder('utf-8');
export function decode(text) {
export function decodeUtf8(text) {
return text ? decoder.decode(uint8Array(text)) : '';

@@ -4,0 +4,0 @@ }

@@ -1,1 +0,1 @@

export declare const Version = "1.16.0";
export declare const Version = "1.17.0";

@@ -1,1 +0,1 @@

export const Version = '1.16.0';
export const Version = '1.17.0';
{
"name": "@planetscale/database",
"version": "1.16.0",
"version": "1.17.0",
"description": "A Fetch API-compatible PlanetScale database driver",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc