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.7 to 0.1.8

20

build/BaseEntity.d.ts

@@ -19,2 +19,12 @@ /// <reference types="ioredis" />

static getEventEmitter<T extends typeof BaseEntity>(this: T): IEvent<InstanceType<T>>;
static getSchemas(): {
columnTypes: any;
indexKeys: string[];
uniqueKeys: string[];
primaryKeys: string[];
autoIncrementKey: string;
table: string;
connection: string;
indexUpdatedAt: boolean;
};
static export(file: string): Promise<void>;

@@ -43,12 +53,2 @@ static exportEntities<T extends BaseEntity>(entities: T[], file: string): Promise<void>;

clone(): this;
getSchemas(): {
columns: string[];
indexKeys: string[];
uniqueKeys: string[];
primaryKeys: string[];
autoIncrementKey: string;
table: string;
connection: string;
indexUpdatedAt: boolean;
};
toJSON(): IInstanceValues<this>;

@@ -55,0 +55,0 @@ protected assignStorageStrings(storageStrings: {

@@ -215,2 +215,26 @@ "use strict";

};
BaseEntity.getSchemas = function () {
var schemas = serviceInstance_1.serviceInstance.getSchemas(this);
var indexKeys = serviceInstance_1.serviceInstance.getIndexKeys(this);
var uniqueKeys = serviceInstance_1.serviceInstance.getUniqueKeys(this);
var primaryKeys = serviceInstance_1.serviceInstance.getPrimaryKeys(this);
var autoIncrementKey = serviceInstance_1.serviceInstance.getAutoIncrementKey(this);
var entityMeta = serviceInstance_1.serviceInstance.getEntityMeta(this);
// convert to column objects
var columnTypes = Object.keys(schemas)
.reduce(function (a, b) {
var _a;
return Object.assign(a, (_a = {}, _a[b] = schemas[b].type, _a));
}, {});
return {
columnTypes: columnTypes,
indexKeys: indexKeys,
uniqueKeys: uniqueKeys,
primaryKeys: primaryKeys,
autoIncrementKey: autoIncrementKey,
table: entityMeta.table,
connection: entityMeta.connection,
indexUpdatedAt: entityMeta.indexUpdatedAt,
};
};
// endregion

@@ -421,20 +445,2 @@ // region static method: import/export

};
BaseEntity.prototype.getSchemas = function () {
var columns = serviceInstance_1.serviceInstance.getColumns(this.constructor);
var indexKeys = serviceInstance_1.serviceInstance.getIndexKeys(this.constructor);
var uniqueKeys = serviceInstance_1.serviceInstance.getUniqueKeys(this.constructor);
var primaryKeys = serviceInstance_1.serviceInstance.getPrimaryKeys(this.constructor);
var autoIncrementKey = serviceInstance_1.serviceInstance.getAutoIncrementKey(this.constructor);
var entityMeta = serviceInstance_1.serviceInstance.getEntityMeta(this.constructor);
return {
columns: columns,
indexKeys: indexKeys,
uniqueKeys: uniqueKeys,
primaryKeys: primaryKeys,
autoIncrementKey: autoIncrementKey,
table: entityMeta.table,
connection: entityMeta.connection,
indexUpdatedAt: entityMeta.indexUpdatedAt,
};
};
BaseEntity.prototype.toJSON = function () {

@@ -441,0 +447,0 @@ return this.getValues();

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

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

@@ -113,2 +113,26 @@ import {entityExporter} from "./entityExporter";

public static getSchemas() {
const schemas = serviceInstance.getSchemas(this);
const indexKeys = serviceInstance.getIndexKeys(this);
const uniqueKeys = serviceInstance.getUniqueKeys(this);
const primaryKeys = serviceInstance.getPrimaryKeys(this);
const autoIncrementKey = serviceInstance.getAutoIncrementKey(this);
const entityMeta = serviceInstance.getEntityMeta(this);
// convert to column objects
const columnTypes: any = Object.keys(schemas)
.reduce<object>((a, b) => Object.assign(a, {[b]: schemas[b].type}), {});
return {
columnTypes,
indexKeys,
uniqueKeys,
primaryKeys,
autoIncrementKey,
table: entityMeta.table,
connection: entityMeta.connection,
indexUpdatedAt: entityMeta.indexUpdatedAt,
};
}
// endregion

@@ -291,20 +315,2 @@

public getSchemas() {
const columns = serviceInstance.getColumns(this.constructor);
const indexKeys = serviceInstance.getIndexKeys(this.constructor);
const uniqueKeys = serviceInstance.getUniqueKeys(this.constructor);
const primaryKeys = serviceInstance.getPrimaryKeys(this.constructor);
const autoIncrementKey = serviceInstance.getAutoIncrementKey(this.constructor);
const entityMeta = serviceInstance.getEntityMeta(this.constructor);
return {
columns,
indexKeys,
uniqueKeys,
primaryKeys,
autoIncrementKey,
table: entityMeta.table,
connection: entityMeta.connection,
indexUpdatedAt: entityMeta.indexUpdatedAt,
};
}

@@ -311,0 +317,0 @@ public toJSON() {

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

it("new entity", async () => {
console.log(TestingGeneral.getSchemas());
const entity = new TestingGeneral();

@@ -63,0 +64,0 @@ assert.isTrue(entity.isNew);

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