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
373
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.44 to 1.2.47

1

lib/orm.d.ts

@@ -57,4 +57,5 @@ import { Configuration } from '@spinajs/configuration';

private applyModelMixins;
private getMigrationDate;
private executeAvaibleMigrations;
private prepareMigrations;
}

42

lib/orm.js

@@ -30,11 +30,3 @@ "use strict";

const MIGRATION_TABLE_NAME = 'spinajs_migration';
const MIGRATION_FILE_REGEXP = /(.*)_([0-9]{4}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2})\.(.*)/;
const MIGRATION_TYPE_REGEXP = /(.*)_([0-9]{4}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2})/;
function migrationFileTypeMatcher(name) {
const match = name.match(MIGRATION_TYPE_REGEXP);
if (match === null || match.length !== 3) {
throw new exceptions_2.OrmException(`Invalid migration file name ${name}, expected: ${name}_YYYY_MM_DD_HH_mm_ss`);
}
return match[1];
}
const MIGRATION_FILE_REGEXP = /(.*)_([0-9]{4}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2}_[0-9]{2})/;
class Orm extends di_1.AsyncModule {

@@ -176,6 +168,9 @@ constructor() {

registerMigration(migration) {
const date = luxon_1.DateTime.now().toFormat('yyyy_MM_dd_HH_mm_ss');
const created = this.getMigrationDate(migration);
if (created === null) {
throw new exceptions_2.OrmException(`Migration file ${migration.name} have invalid name format ( invalid migration name, expected: some_name_yyyy_MM_dd_HH_mm_ss got ${migration.name})`);
}
this.Migrations.push({
file: `${migration.name}_${date}.registered`,
name: `${migration.name}_${date}`,
file: `${migration.name}.registered`,
name: `${migration.name}`,
type: migration,

@@ -220,2 +215,13 @@ });

}
getMigrationDate(migration) {
const match = migration.name.match(MIGRATION_FILE_REGEXP);
if (match === null || match.length !== 3) {
return null;
}
const created = luxon_1.DateTime.fromFormat(match[2], 'yyyy_MM_dd_HH_mm_ss');
if (!created.isValid) {
return null;
}
return created;
}
async executeAvaibleMigrations(name, callback, down) {

@@ -226,10 +232,6 @@ var _a, _b;

.map((x) => {
const match = x.file.match(MIGRATION_FILE_REGEXP);
if (match === null || match.length !== 4) {
throw new exceptions_2.OrmException(`Migration file name have invalid format ( expected: some_name_yyyy_MM_dd_HH_mm_ss got ${x.file})`);
const created = this.getMigrationDate(x.type);
if (created === null) {
throw new exceptions_2.OrmException(`Migration file ${x.name} have invalid name format ( invalid migration name, expected: some_name_yyyy_MM_dd_HH_mm_ss got ${x.name})`);
}
const created = luxon_1.DateTime.fromFormat(match[2], 'yyyy_MM_dd_HH_mm_ss');
if (!created.isValid) {
throw new exceptions_2.OrmException(`Migration file ${x.file} have invalid name format ( invalid migration date )`);
}
return Object.assign({ created }, x);

@@ -281,3 +283,3 @@ })

__decorate([
(0, reflection_1.ListFromFiles)('/**/!(*.d).{ts,js}', 'system.dirs.migrations', migrationFileTypeMatcher),
(0, reflection_1.ListFromFiles)('/**/!(*.d).{ts,js}', 'system.dirs.migrations'),
__metadata("design:type", Array)

@@ -284,0 +286,0 @@ ], Orm.prototype, "Migrations", void 0);

{
"name": "@spinajs/orm",
"version": "1.2.44",
"version": "1.2.47",
"description": "framework orm module",

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

},
"gitHead": "1dc720821169a669738d943c5e2ebc07256ae653"
"gitHead": "ad525c0918a3a4c46a2d710f313f78a9468bd9c9"
}

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