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

@spinajs/orm

Package Overview
Dependencies
Maintainers
1
Versions
374
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spinajs/orm - npm Package Compare versions

Comparing version 1.2.192 to 1.2.194

55

lib/model.d.ts

@@ -8,3 +8,56 @@ import { IModelDescriptor, InsertBehaviour, IUpdateResult, IWhereBuilder } from './interfaces';

export declare function extractModelDescriptor(targetOrForward: any): IModelDescriptor;
export declare class ModelBase {
export interface IModelBase {
ModelDescriptor: IModelDescriptor;
Container: IContainer;
PrimaryKeyName: string;
PrimaryKeyValue: any;
getFlattenRelationModels(): IModelBase[];
/**
* Fills model with data. It only fills properties that exists in database
*
* @param data - data to fill
*/
hydrate(data: Partial<this>): void;
/**
*
* Attachess model to proper relation an sets foreign key
*
* @param data - model to attach
*/
attach(data: ModelBase): void;
/**
* Extracts all data from model. It takes only properties that exists in DB
*/
dehydrate(includeRelations?: boolean, omit?: string[]): Partial<this>;
/**
* deletes enitt from db. If model have SoftDelete decorator, model is marked as deleted
*/
destroy(): Promise<void>;
/**
* If model can be in achived state - sets archived at date and saves it to db
*/
archive(): Promise<void>;
update(): Promise<void>;
/**
* Save all changes to db. It creates new entry id db or updates existing one if
* primary key exists
*/
insert(insertBehaviour: InsertBehaviour): Promise<IUpdateResult>;
/**
* Gets model data from database and returns as fresh instance.
*
* If primary key is not fetched, tries to load by columns with unique constraint.
* If there is no unique columns or primary key, throws error
*/
fresh(): Promise<this>;
/**
* Refresh model from database.
*
* If no primary key is set, tries to fetch data base on columns
* with unique constraints. If none exists, throws exception
*/
refresh(): Promise<void>;
toJSON(): any;
}
export declare class ModelBase implements IModelBase {
private _container;

@@ -11,0 +64,0 @@ /**

4

lib/relations.d.ts
import { IRelationDescriptor, IModelDescriptor, InsertBehaviour, ForwardRefFunction, IBuilderMiddleware } from './interfaces';
import { Constructor } from '@spinajs/di';
import { SelectQueryBuilder } from './builders';
import { ModelBase } from './model';
import { IModelBase, ModelBase } from './model';
import { Orm } from './orm';

@@ -76,3 +76,3 @@ export interface IOrmRelation {

}
export declare class SingleRelation<R extends ModelBase> implements IRelation {
export declare class SingleRelation<R extends IModelBase> implements IRelation {
protected _owner: ModelBase;

@@ -79,0 +79,0 @@ protected model: Constructor<R> | ForwardRefFunction;

{
"name": "@spinajs/orm",
"version": "1.2.192",
"version": "1.2.194",
"description": "framework orm module",

@@ -55,3 +55,3 @@ "main": "lib/index.js",

},
"gitHead": "66b10674ad7d527a8abbbbef0c508ed908fa8912"
"gitHead": "a0e0212d10a889112e0f61bdce50be020fa7df26"
}

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