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

@nocobase/database

Package Overview
Dependencies
Maintainers
1
Versions
443
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nocobase/database - npm Package Compare versions

Comparing version 0.7.0-alpha.24 to 0.7.0-alpha.25

5

esm/database.d.ts

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { EventEmitter } from 'events';
import { ModelCtor, Options, QueryInterfaceDropAllTablesOptions, Sequelize, SyncOptions } from 'sequelize';
import { ModelCtor, Options, QueryInterfaceDropAllTablesOptions, QueryOptions, Sequelize, SyncOptions } from 'sequelize';
import { Collection, CollectionOptions, RepositoryType } from './collection';

@@ -81,2 +81,5 @@ import { ImportFileExtension } from './collection-importer';

isSqliteMemory(): boolean;
auth(options?: QueryOptions & {
repeat?: number;
}): Promise<any>;
reconnect(): Promise<void>;

@@ -83,0 +86,0 @@ closed(): any;

@@ -195,2 +195,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
auth(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const { repeat = 10 } = options, others = __rest(options, ["repeat"]);
const delay = (ms) => new Promise((yea) => setTimeout(yea, ms));
let count = 0;
const authenticate = () => __awaiter(this, void 0, void 0, function* () {
try {
yield this.sequelize.authenticate(others);
console.log('Connection has been established successfully.');
return true;
}
catch (error) {
console.log('reconnecting...', count);
if (count >= repeat) {
throw error;
}
++count;
yield delay(500);
return yield authenticate();
}
});
return yield authenticate();
});
}
reconnect() {

@@ -197,0 +221,0 @@ return __awaiter(this, void 0, void 0, function* () {

3

esm/model-hook.js

@@ -11,3 +11,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import lodash from 'lodash';
import { Model } from './model';
const { hooks } = require('sequelize/lib/hooks');

@@ -30,3 +29,3 @@ export class ModelHook {

for (const arg of hookArgs) {
if (arg instanceof Model) {
if (arg === null || arg === void 0 ? void 0 : arg._previousDataValues) {
return arg.constructor.name;

@@ -33,0 +32,0 @@ }

@@ -5,3 +5,3 @@ /// <reference types="node" />

import { EventEmitter } from 'events';
import { ModelCtor, Options, QueryInterfaceDropAllTablesOptions, Sequelize, SyncOptions } from 'sequelize';
import { ModelCtor, Options, QueryInterfaceDropAllTablesOptions, QueryOptions, Sequelize, SyncOptions } from 'sequelize';
import { Collection, CollectionOptions, RepositoryType } from './collection';

@@ -81,2 +81,5 @@ import { ImportFileExtension } from './collection-importer';

isSqliteMemory(): boolean;
auth(options?: QueryOptions & {
repeat?: number;
}): Promise<any>;
reconnect(): Promise<void>;

@@ -83,0 +86,0 @@ closed(): any;

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

}
auth(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const { repeat = 10 } = options, others = __rest(options, ["repeat"]);
const delay = (ms) => new Promise((yea) => setTimeout(yea, ms));
let count = 0;
const authenticate = () => __awaiter(this, void 0, void 0, function* () {
try {
yield this.sequelize.authenticate(others);
console.log('Connection has been established successfully.');
return true;
}
catch (error) {
console.log('reconnecting...', count);
if (count >= repeat) {
throw error;
}
++count;
yield delay(500);
return yield authenticate();
}
});
return yield authenticate();
});
}
reconnect() {

@@ -222,0 +246,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -17,3 +17,2 @@ "use strict";

const lodash_1 = __importDefault(require("lodash"));
const model_1 = require("./model");
const { hooks } = require('sequelize/lib/hooks');

@@ -36,3 +35,3 @@ class ModelHook {

for (const arg of hookArgs) {
if (arg instanceof model_1.Model) {
if (arg === null || arg === void 0 ? void 0 : arg._previousDataValues) {
return arg.constructor.name;

@@ -39,0 +38,0 @@ }

{
"name": "@nocobase/database",
"version": "0.7.0-alpha.24",
"version": "0.7.0-alpha.25",
"description": "",

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

"dependencies": {
"@nocobase/utils": "0.7.0-alpha.24",
"@nocobase/utils": "0.7.0-alpha.25",
"async-mutex": "^0.3.2",

@@ -33,3 +33,3 @@ "deepmerge": "^4.2.2",

},
"gitHead": "1fb2dd884c4f2d2167f5dde40a15012a752e53ab"
"gitHead": "b292a36c83a4c4c8cc8c9ebcca15d60b656f2e31"
}

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