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

ts-redis-orm

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-redis-orm - npm Package Compare versions

Comparing version 0.1.13 to 0.1.14

36

build/BaseEntity.js

@@ -50,3 +50,3 @@ "use strict";

if (schemaErrors.length) {
throw new RedisOrmSchemaError_1.RedisOrmSchemaError(`(${this.name}) Invalid Schemas`, schemaErrors);
throw new RedisOrmSchemaError_1.RedisOrmSchemaError(`(${this.name}, ${table}) Mismatch with remote Schemas`, schemaErrors);
}

@@ -111,3 +111,3 @@ return yield serviceInstance_1.serviceInstance.getRedis(this);

if (saveResult.error) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.name}) ${saveResult.error}`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.name}, ${table}) ${saveResult.error}`);
}

@@ -124,3 +124,3 @@ debug(`(${this.name}, ${table}) resync db complete`);

if (className !== this.name) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.name}) You need to provide the class name for truncate`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.name}, ${table}) You need to provide the class name for truncate`);
}

@@ -236,3 +236,3 @@ // get redis,

else {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) Invalid number value: ${value} for primary key: ${column}`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Invalid number value: ${value} for primary key: ${column}`);
}

@@ -245,7 +245,7 @@ }

else {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) Invalid string value: '${value}' for primary key: ${column}`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Invalid string value: '${value}' for primary key: ${column}`);
}
}
else {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) Invalid value: ${value} for primary key: ${column}`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Invalid value: ${value} for primary key: ${column}`);
}

@@ -265,15 +265,15 @@ }

if (this.isNew) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) You cannot increment a new entity`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot increment a new entity`);
}
if (serviceInstance_1.serviceInstance.isPrimaryKey(this.constructor, column)) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) You cannot increment primary key`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot increment primary key`);
}
if (serviceInstance_1.serviceInstance.isUniqueKey(this.constructor, column)) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) You cannot increment unique key`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot increment unique key`);
}
if (!serviceInstance_1.serviceInstance.isNumberColumn(this.constructor, column)) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) Column need to be in the type of Number`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Column need to be in the type of Number`);
}
if (!Number.isInteger(value)) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) Increment value need to be an integer`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Increment value need to be an integer`);
}

@@ -347,3 +347,3 @@ this._increments[column] = value;

if (this.isDeleted && !isRestore) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) You cannot update a deleted entity`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot update a deleted entity`);
}

@@ -392,8 +392,8 @@ const changes = this._getChanges();

if (saveResult.error) {
if (saveResult.error === "Invalid Schemas") {
if (saveResult.error === "Mismatch with remote Schemas") {
const schemaErrors = yield serviceInstance_1.serviceInstance.compareSchemas(this.constructor, this._table);
throw new RedisOrmSchemaError_1.RedisOrmSchemaError(`(${this.constructor.name}) ${saveResult.error}`, schemaErrors);
throw new RedisOrmSchemaError_1.RedisOrmSchemaError(`(${this.constructor.name}, ${this._table}) ${saveResult.error}`, schemaErrors);
}
else {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) ${saveResult.error}`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) ${saveResult.error}`);
}

@@ -438,3 +438,3 @@ }

if (this.isNew) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) You cannot delete a new entity`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot delete a new entity`);
}

@@ -444,3 +444,3 @@ // if it's soft delete

if (!forceDelete && this.isDeleted) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) You cannot delete a deleted entity`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot delete a deleted entity`);
}

@@ -471,3 +471,3 @@ // if we didn't set deletedAt, set a new one

if (saveResult.error) {
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}) ${saveResult.error}`);
throw new RedisOrmEntityError_1.RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) ${saveResult.error}`);
}

@@ -474,0 +474,0 @@ // update deleted At

{
"name": "ts-redis-orm",
"version": "0.1.13",
"version": "0.1.14",
"description": "A full functional Redis Orm library written in Typescript.",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -22,3 +22,3 @@ import Debug from "debug";

if (schemaErrors.length) {
throw new RedisOrmSchemaError(`(${this.name}) Invalid Schemas`, schemaErrors);
throw new RedisOrmSchemaError(`(${this.name}, ${table}) Mismatch with remote Schemas`, schemaErrors);
}

@@ -87,3 +87,3 @@

if (saveResult.error) {
throw new RedisOrmEntityError(`(${this.name}) ${saveResult.error}`);
throw new RedisOrmEntityError(`(${this.name}, ${table}) ${saveResult.error}`);
}

@@ -99,3 +99,3 @@

if (className !== this.name) {
throw new RedisOrmEntityError(`(${this.name}) You need to provide the class name for truncate`);
throw new RedisOrmEntityError(`(${this.name}, ${table}) You need to provide the class name for truncate`);
}

@@ -257,3 +257,3 @@

} else {
throw new RedisOrmEntityError(`(${this.constructor.name}) Invalid number value: ${value} for primary key: ${column}`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Invalid number value: ${value} for primary key: ${column}`);
}

@@ -265,6 +265,6 @@

} else {
throw new RedisOrmEntityError(`(${this.constructor.name}) Invalid string value: '${value}' for primary key: ${column}`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Invalid string value: '${value}' for primary key: ${column}`);
}
} else {
throw new RedisOrmEntityError(`(${this.constructor.name}) Invalid value: ${value} for primary key: ${column}`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Invalid value: ${value} for primary key: ${column}`);
}

@@ -288,19 +288,19 @@ }

if (this.isNew) {
throw new RedisOrmEntityError(`(${this.constructor.name}) You cannot increment a new entity`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot increment a new entity`);
}
if (serviceInstance.isPrimaryKey(this.constructor, column as string)) {
throw new RedisOrmEntityError(`(${this.constructor.name}) You cannot increment primary key`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot increment primary key`);
}
if (serviceInstance.isUniqueKey(this.constructor, column as string)) {
throw new RedisOrmEntityError(`(${this.constructor.name}) You cannot increment unique key`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot increment unique key`);
}
if (!serviceInstance.isNumberColumn(this.constructor, column as string)) {
throw new RedisOrmEntityError(`(${this.constructor.name}) Column need to be in the type of Number`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Column need to be in the type of Number`);
}
if (!Number.isInteger(value)) {
throw new RedisOrmEntityError(`(${this.constructor.name}) Increment value need to be an integer`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) Increment value need to be an integer`);
}

@@ -386,3 +386,3 @@

if (this.isDeleted && !isRestore) {
throw new RedisOrmEntityError(`(${this.constructor.name}) You cannot update a deleted entity`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot update a deleted entity`);
}

@@ -439,7 +439,7 @@

if (saveResult.error) {
if (saveResult.error === "Invalid Schemas") {
if (saveResult.error === "Mismatch with remote Schemas") {
const schemaErrors = await serviceInstance.compareSchemas(this.constructor, this._table);
throw new RedisOrmSchemaError(`(${this.constructor.name}) ${saveResult.error}`, schemaErrors);
throw new RedisOrmSchemaError(`(${this.constructor.name}, ${this._table}) ${saveResult.error}`, schemaErrors);
} else {
throw new RedisOrmEntityError(`(${this.constructor.name}) ${saveResult.error}`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) ${saveResult.error}`);
}

@@ -489,3 +489,3 @@ }

if (this.isNew) {
throw new RedisOrmEntityError(`(${this.constructor.name}) You cannot delete a new entity`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot delete a new entity`);
}

@@ -496,3 +496,3 @@

if (!forceDelete && this.isDeleted) {
throw new RedisOrmEntityError(`(${this.constructor.name}) You cannot delete a deleted entity`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) You cannot delete a deleted entity`);
}

@@ -528,3 +528,3 @@

if (saveResult.error) {
throw new RedisOrmEntityError(`(${this.constructor.name}) ${saveResult.error}`);
throw new RedisOrmEntityError(`(${this.constructor.name}, ${this._table}) ${saveResult.error}`);
}

@@ -531,0 +531,0 @@

@@ -354,3 +354,3 @@ import {assert, expect } from "chai";

} catch (err) {
assert.equal(err.message, `(${TestingGeneral.name}) Entity not exist or deleted. Entity Id: ${entity.getEntityId()}`);
assert.equal(err.message, `(${TestingGeneral.name}, testing_general) Entity not exist or deleted. Entity Id: ${entity.getEntityId()}`);
}

@@ -363,3 +363,3 @@

} catch (err) {
assert.equal(err.message, `(${TestingGeneral.name}) Entity already deleted. Entity Id: ${entity.getEntityId()}`);
assert.equal(err.message, `(${TestingGeneral.name}, testing_general) Entity already deleted. Entity Id: ${entity.getEntityId()}`);
}

@@ -377,3 +377,3 @@

} catch (err) {
assert.equal(err.message, `(${TestingGeneral.name}) Entity not exist. Entity Id: ${entity.getEntityId()}`);
assert.equal(err.message, `(${TestingGeneral.name}, testing_general) Entity not exist. Entity Id: ${entity.getEntityId()}`);
}

@@ -380,0 +380,0 @@ });

@@ -150,3 +150,3 @@ import { assert, expect } from "chai";

} catch (err) {
assert.equal(err.message, "(TestingSchema3) Resync can only apply to same primary keys. The remote primary key: id is not the same or not exist in current schemas");
assert.equal(err.message, "(TestingSchema3, testing_schema) Resync can only apply to same primary keys. The remote primary key: id is not the same or not exist in current schemas");
}

@@ -197,3 +197,3 @@ });

} catch (err) {
assert.equal(err.message, `(${TestingSchema1.name}) Unique key: unique1 with value: 0 already exist on entity id: 1. Current entity id: ${duplicatedEntity.id}`);
assert.equal(err.message, `(${TestingSchema1.name}, testing_schema) Unique key: unique1 with value: 0 already exist on entity id: 1. Current entity id: ${duplicatedEntity.id}`);
}

@@ -200,0 +200,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