New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tableland/sdk

Package Overview
Dependencies
Maintainers
5
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tableland/sdk - npm Package Compare versions

Comparing version 4.0.0-pre.6 to 4.0.0-pre.7

14

dist/cjs/registry/create.js

@@ -8,15 +8,9 @@ "use strict";

const firstSearch = /(?<create>^CREATE\s+TABLE\s+)(?<name>\S+)(?<schema>\s*\(.*\)[;]?$)/i;
// Match _anything_ between pairs of "", ``, '', or []
const secondSearch = /(?<=^")(.*?)(?="$)|(?<=^\[)(.*?)(?=\]$)|(?<=^')(.*?)(?='$)|(?<=^`)(.*?)(?=`$)|(^[^[`'].*?[^\]'`]$)/;
const escapeChars = /"|'|`|\]|\[/;
async function prepareCreateTable({ statement, chainId, first, }) {
const { prefix, name: tableName } = await (0, parser_js_1.validateTableName)(`${first}_${chainId}`, true);
const stmt = statement.replace(firstSearch, function (_, create, name, schema) {
const newName = name.replace(secondSearch, function (sub, ...args) {
if (sub != null) {
return tableName;
}
/* c8 ignore next */
return sub;
});
return create + newName + schema;
// If this name has any escape chars, escape the whole thing.
const newName = escapeChars.test(name) ? `[${tableName}]` : tableName;
return `${create.trim()} ${newName.trim()} ${schema.trim()}`;
});

@@ -23,0 +17,0 @@ return { statement: stmt, chainId, prefix };

@@ -5,15 +5,9 @@ import { validateTableName } from "../helpers/parser.js";

const firstSearch = /(?<create>^CREATE\s+TABLE\s+)(?<name>\S+)(?<schema>\s*\(.*\)[;]?$)/i;
// Match _anything_ between pairs of "", ``, '', or []
const secondSearch = /(?<=^")(.*?)(?="$)|(?<=^\[)(.*?)(?=\]$)|(?<=^')(.*?)(?='$)|(?<=^`)(.*?)(?=`$)|(^[^[`'].*?[^\]'`]$)/;
const escapeChars = /"|'|`|\]|\[/;
export async function prepareCreateTable({ statement, chainId, first, }) {
const { prefix, name: tableName } = await validateTableName(`${first}_${chainId}`, true);
const stmt = statement.replace(firstSearch, function (_, create, name, schema) {
const newName = name.replace(secondSearch, function (sub, ...args) {
if (sub != null) {
return tableName;
}
/* c8 ignore next */
return sub;
});
return create + newName + schema;
// If this name has any escape chars, escape the whole thing.
const newName = escapeChars.test(name) ? `[${tableName}]` : tableName;
return `${create.trim()} ${newName.trim()} ${schema.trim()}`;
});

@@ -20,0 +14,0 @@ return { statement: stmt, chainId, prefix };

{
"name": "@tableland/sdk",
"version": "4.0.0-pre.6",
"version": "4.0.0-pre.7",
"description": "A database client and helpers for the Tableland network",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -9,5 +9,3 @@ import { type SignerConfig } from "../helpers/config.js";

/(?<create>^CREATE\s+TABLE\s+)(?<name>\S+)(?<schema>\s*\(.*\)[;]?$)/i;
// Match _anything_ between pairs of "", ``, '', or []
const secondSearch =
/(?<=^")(.*?)(?="$)|(?<=^\[)(.*?)(?=\]$)|(?<=^')(.*?)(?='$)|(?<=^`)(.*?)(?=`$)|(^[^[`'].*?[^\]'`]$)/;
const escapeChars = /"|'|`|\]|\[/;

@@ -41,10 +39,5 @@ export interface PrepareParams {

function (_, create: string, name: string, schema: string) {
const newName = name.replace(secondSearch, function (sub, ...args) {
if (sub != null) {
return tableName;
}
/* c8 ignore next */
return sub;
});
return create + newName + schema;
// If this name has any escape chars, escape the whole thing.
const newName = escapeChars.test(name) ? `[${tableName}]` : tableName;
return `${create.trim()} ${newName.trim()} ${schema.trim()}`;
}

@@ -51,0 +44,0 @@ );

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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