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

@contember/database

Package Overview
Dependencies
Maintainers
5
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contember/database - npm Package Compare versions

Comparing version 0.8.0-alpha.2 to 0.8.0-alpha.3

1

dist/src/builders/CaseStatement.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CaseStatement = void 0;
const Literal_1 = require("../Literal");

@@ -4,0 +5,0 @@ const utils_1 = require("./utils");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ColumnExpressionFactory = void 0;
const Literal_1 = require("../Literal");

@@ -4,0 +5,0 @@ const ConditionBuilder_1 = require("./ConditionBuilder");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Compiler = void 0;
const utils_1 = require("../utils");

@@ -4,0 +5,0 @@ const Literal_1 = require("../Literal");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Operator = exports.ConditionBuilder = void 0;
const Literal_1 = require("../Literal");

@@ -4,0 +5,0 @@ const formatUtils_1 = require("./formatUtils");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConflictActionType = void 0;
var ConflictActionType;

@@ -4,0 +5,0 @@ (function (ConflictActionType) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeleteBuilder = void 0;
const Returning_1 = require("./internal/Returning");

@@ -4,0 +5,0 @@ const With_1 = require("./internal/With");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toFqnWrap = exports.toFqn = void 0;
const utils_1 = require("../utils");

@@ -4,0 +5,0 @@ function toFqn(columnName) {

34

dist/src/builders/index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./CaseStatement"));
__export(require("./ConditionBuilder"));
__export(require("./DeleteBuilder"));
__export(require("./InsertBuilder"));
__export(require("./LimitByGroupWrapper"));
__export(require("./SelectBuilder"));
__export(require("./UpdateBuilder"));
__export(require("./WindowFunction"));
__export(require("./LockType"));
__export(require("./ConflictActionType"));
__exportStar(require("./CaseStatement"), exports);
__exportStar(require("./ConditionBuilder"), exports);
__exportStar(require("./DeleteBuilder"), exports);
__exportStar(require("./InsertBuilder"), exports);
__exportStar(require("./LimitByGroupWrapper"), exports);
__exportStar(require("./QueryBuilder"), exports);
__exportStar(require("./SelectBuilder"), exports);
__exportStar(require("./UpdateBuilder"), exports);
__exportStar(require("./WindowFunction"), exports);
__exportStar(require("./LockType"), exports);
__exportStar(require("./ConflictActionType"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InsertBuilder = void 0;
const Returning_1 = require("./internal/Returning");

@@ -4,0 +5,0 @@ const With_1 = require("./internal/With");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Returning = void 0;
const Literal_1 = require("../../Literal");

@@ -4,0 +5,0 @@ const utils_1 = require("../utils");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSubQueryLiteralFactory = void 0;
const SelectBuilder_1 = require("../SelectBuilder");

@@ -4,0 +5,0 @@ function createSubQueryLiteralFactory(expr) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Where = void 0;
const utils_1 = require("../../utils");

@@ -4,0 +5,0 @@ const Literal_1 = require("../../Literal");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.With = void 0;
const utils_1 = require("../../utils");

@@ -4,0 +5,0 @@ const Literal_1 = require("../../Literal");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LimitByGroupWrapper = void 0;
const SelectBuilder_1 = require("./SelectBuilder");

@@ -4,0 +5,0 @@ const ConditionBuilder_1 = require("./ConditionBuilder");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LockType = void 0;
var LockType;

@@ -4,0 +5,0 @@ (function (LockType) {

@@ -18,2 +18,3 @@ import { With } from './internal/With';

unionAll(expression: SubQueryExpression): SelectBuilder<Result>;
unionDistinct(expression: SubQueryExpression): SelectBuilder<Result>;
from(tableName: string | Literal, alias?: string): SelectBuilder<Result>;

@@ -24,4 +25,4 @@ select(columnName: QueryBuilder.ColumnIdentifier, alias?: string): SelectBuilder<Result>;

orderBy(columnName: QueryBuilder.ColumnIdentifier, direction?: 'asc' | 'desc'): SelectBuilder<Result>;
join(table: string, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result>;
leftJoin(table: string, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result>;
join(table: string | Literal, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result>;
leftJoin(table: string | Literal, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result>;
private joinConditionToLiteral;

@@ -50,3 +51,3 @@ groupBy(columnName: QueryBuilder.ColumnIdentifier): SelectBuilder<Result>;

type: 'inner' | 'left';
table: string;
table: string | Literal;
alias: string | undefined;

@@ -53,0 +54,0 @@ condition: Literal | undefined;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectBuilder = void 0;
const With_1 = require("./internal/With");

@@ -43,2 +44,8 @@ const Where_1 = require("./internal/Where");

}
unionDistinct(expression) {
return this.withOption('union', {
type: 'distinct',
literal: Subqueries_1.createSubQueryLiteralFactory(expression),
});
}
from(tableName, alias) {

@@ -45,0 +52,0 @@ return this.withOption('from', [...(this.options.from || []), [tableName, alias]]);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateBuilder = void 0;
const Returning_1 = require("./internal/Returning");

@@ -4,0 +5,0 @@ const With_1 = require("./internal/With");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.columnExpressionToLiteral = exports.resolveValues = exports.toFqnWrap = void 0;
const Literal_1 = require("../Literal");
const ColumnExpressionFactory_1 = require("./ColumnExpressionFactory");
const formatUtils_1 = require("./formatUtils");
exports.toFqnWrap = formatUtils_1.toFqnWrap;
Object.defineProperty(exports, "toFqnWrap", { enumerable: true, get: function () { return formatUtils_1.toFqnWrap; } });
function resolveValues(values) {

@@ -8,0 +9,0 @@ return Object.entries(values)

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WindowFunction = void 0;
const Literal_1 = require("../Literal");

@@ -4,0 +5,0 @@ const utils_1 = require("./utils");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Client = void 0;
const builders_1 = require("../builders");

@@ -4,0 +5,0 @@ const queryable_1 = require("../queryable");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Connection = void 0;
const pg_1 = require("pg");

@@ -4,0 +5,0 @@ const EventManager_1 = require("./EventManager");

@@ -7,2 +7,3 @@ export declare class ConnectionError extends Error {

readonly constraint?: string;
readonly originalMessage?: string;
constructor(sql: string, parameters: any, previous: Error | any);

@@ -18,2 +19,4 @@ }

}
export declare class InvalidDataError extends ConnectionError {
}
//# sourceMappingURL=errors.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvalidDataError = exports.SerializationFailureError = exports.UniqueViolationError = exports.ForeignKeyViolationError = exports.NotNullViolationError = exports.ConnectionError = void 0;
class ConnectionError extends Error {

@@ -16,2 +17,3 @@ constructor(sql, parameters, previous) {

this.constraint = previous.constraint;
this.originalMessage = previous.message;
}

@@ -32,2 +34,5 @@ }

exports.SerializationFailureError = SerializationFailureError;
class InvalidDataError extends ConnectionError {
}
exports.InvalidDataError = InvalidDataError;
//# sourceMappingURL=errors.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EventManager = exports.EventManagerImpl = void 0;
class EventManagerImpl {

@@ -4,0 +5,0 @@ constructor(parent = null) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeQuery = void 0;
const EventManager_1 = require("./EventManager");

@@ -47,2 +48,5 @@ const errors_1 = require("./errors");

throw new errors_1.SerializationFailureError(sql, parameters, error);
case '22P02':
case '22008':
throw new errors_1.InvalidDataError(sql, parameters, error);
default:

@@ -49,0 +53,0 @@ throw new errors_1.ConnectionError(sql, parameters, error);

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./Client"));
__export(require("./errors"));
__export(require("./Connection"));
__export(require("./EventManager"));
__export(require("./Transaction"));
__export(require("./SingleConnection"));
__exportStar(require("./Client"), exports);
__exportStar(require("./errors"), exports);
__exportStar(require("./Connection"), exports);
__exportStar(require("./EventManager"), exports);
__exportStar(require("./Transaction"), exports);
__exportStar(require("./SingleConnection"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SingleConnection = void 0;
const EventManager_1 = require("./EventManager");

@@ -4,0 +5,0 @@ const Client_1 = require("./Client");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transaction = void 0;
const utils_1 = require("../utils");

@@ -4,0 +5,0 @@ const execution_1 = require("./execution");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImplementationException = void 0;
class ImplementationException extends Error {

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

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./client"));
__export(require("./builders"));
__export(require("./queryable"));
__export(require("./Literal"));
__exportStar(require("./client"), exports);
__exportStar(require("./builders"), exports);
__exportStar(require("./queryable"), exports);
__exportStar(require("./Literal"), exports);
__exportStar(require("./types"), exports);
var utils_1 = require("./utils");
exports.wrapIdentifier = utils_1.wrapIdentifier;
Object.defineProperty(exports, "wrapIdentifier", { enumerable: true, get: function () { return utils_1.wrapIdentifier; } });
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Literal = void 0;
class Literal {

@@ -13,6 +14,5 @@ constructor(sql, parameters = [], meta = {}) {

appendAll(literal, separator, prefixSuffix) {
var _a, _b;
const hasPrefixAndSuffix = prefixSuffix && literal.length > 0;
const prefix = hasPrefixAndSuffix ? (_a = prefixSuffix) === null || _a === void 0 ? void 0 : _a[0] : '';
const suffix = hasPrefixAndSuffix ? (_b = prefixSuffix) === null || _b === void 0 ? void 0 : _b[1] : '';
const prefix = hasPrefixAndSuffix ? prefixSuffix === null || prefixSuffix === void 0 ? void 0 : prefixSuffix[0] : '';
const suffix = hasPrefixAndSuffix ? prefixSuffix === null || prefixSuffix === void 0 ? void 0 : prefixSuffix[1] : '';
return new Literal(this.sql + prefix + literal.map(it => it.sql).join(separator) + suffix, [

@@ -19,0 +19,0 @@ ...this.parameters,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseQuery = void 0;
const exceptions_1 = require("../exceptions");

@@ -4,0 +5,0 @@ class DatabaseQuery {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseQueryable = void 0;
class DatabaseQueryable {

@@ -4,0 +5,0 @@ constructor(db, handlerAccessor) {

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./DatabaseQuery"));
__export(require("./DatabaseQueryable"));
__exportStar(require("./DatabaseQuery"), exports);
__exportStar(require("./DatabaseQueryable"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertNever = void 0;
function assertNever(_) {

@@ -4,0 +5,0 @@ throw new Error();

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./assertNever"));
__export(require("./sql"));
__exportStar(require("./assertNever"), exports);
__exportStar(require("./sql"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.prependSchema = exports.aliasLiteral = exports.wrapIdentifier = void 0;
const Literal_1 = require("../Literal");

@@ -4,0 +5,0 @@ exports.wrapIdentifier = (value) => '"' + value.replace(/"/g, '""') + '"';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SQL = void 0;
const genericTaggedString = (strings, ...values) => {

@@ -4,0 +5,0 @@ return strings.reduce((combined, string, i) => {

{
"name": "@contember/database",
"version": "0.8.0-alpha.2",
"version": "0.8.0-alpha.3",
"license": "Apache-2.0",

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

"dependencies": {
"@contember/queryable": "^0.8.0-alpha.2",
"@contember/queryable": "^0.8.0-alpha.3",
"pg": "^7.17.1"
},
"devDependencies": {
"@contember/database-tester": "^0.8.0-alpha.2",
"@contember/database-tester": "^0.8.0-alpha.3",
"@types/jasmine": "^3.5.10",

@@ -21,5 +21,5 @@ "@types/node": "^13.11.1",

"jasmine": "^3.5.0",
"typescript": "^3.7.4"
"typescript": "^3.9.5"
},
"gitHead": "dfc666f11f4d24a67b260bf57f62b420657d51c2"
"gitHead": "8c72aa88a27d3120a52e6968fe0e188490005b39"
}

@@ -54,2 +54,9 @@ import { With } from './internal/With'

public unionDistinct(expression: SubQueryExpression): SelectBuilder<Result> {
return this.withOption('union', {
type: 'distinct',
literal: createSubQueryLiteralFactory(expression),
})
}
public from(tableName: string | Literal, alias?: string): SelectBuilder<Result> {

@@ -80,3 +87,3 @@ return this.withOption('from', [...(this.options.from || []), [tableName, alias]])

public join(table: string, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result> {
public join(table: string | Literal, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result> {
return this.withOption('join', [

@@ -88,3 +95,7 @@ ...this.options.join,

public leftJoin(table: string, alias?: string, condition?: SelectBuilder.JoinCondition): SelectBuilder<Result> {
public leftJoin(
table: string | Literal,
alias?: string,
condition?: SelectBuilder.JoinCondition,
): SelectBuilder<Result> {
return this.withOption('join', [

@@ -172,3 +183,3 @@ ...this.options.join,

type: 'inner' | 'left'
table: string
table: string | Literal
alias: string | undefined

@@ -175,0 +186,0 @@ condition: Literal | undefined

export class ConnectionError extends Error {
public readonly code?: string
public readonly constraint?: string
public readonly originalMessage?: string

@@ -14,2 +15,3 @@ constructor(public readonly sql: string, public readonly parameters: any, public readonly previous: Error | any) {

this.constraint = previous.constraint
this.originalMessage = previous.message
}

@@ -25,1 +27,3 @@ }

export class SerializationFailureError extends ConnectionError {}
export class InvalidDataError extends ConnectionError {}

@@ -7,2 +7,3 @@ import { ClientBase } from 'pg'

ForeignKeyViolationError,
InvalidDataError,
NotNullViolationError,

@@ -67,2 +68,5 @@ SerializationFailureError,

throw new SerializationFailureError(sql, parameters, error)
case '22P02':
case '22008':
throw new InvalidDataError(sql, parameters, error)
default:

@@ -69,0 +73,0 @@ throw new ConnectionError(sql, parameters, error)

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

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

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

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

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

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

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

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

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

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

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

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