@sol-x/couchdb-migration-store
Advanced tools
Comparing version
@@ -7,2 +7,3 @@ "use strict"; | ||
const nano_1 = __importDefault(require("nano")); | ||
const wait_on_1 = __importDefault(require("wait-on")); | ||
const MIGRATION_DB_NAME = "migrations"; | ||
@@ -15,4 +16,11 @@ class CouchDbMigrationStore { | ||
} | ||
this.couchDbWaitTime = parseInt(process.env.COUCHDB_WAIT_TIME || "0") || 10 * 1000; | ||
this.couchDbUrl = couchDbUrl; | ||
} | ||
async waitForCouchdb() { | ||
await wait_on_1.default({ | ||
resources: [this.couchDbUrl], | ||
timeout: this.couchDbWaitTime, | ||
}); | ||
} | ||
async save(migrationData, callback) { | ||
@@ -25,2 +33,3 @@ const { lastRun } = migrationData; | ||
const dataToStore = { _id: "1", lastRun, migrations }; | ||
await this.waitForCouchdb(); | ||
const nano = nano_1.default(this.couchDbUrl); | ||
@@ -45,2 +54,3 @@ try { | ||
async load(callback) { | ||
await this.waitForCouchdb(); | ||
const nano = nano_1.default(this.couchDbUrl); | ||
@@ -47,0 +57,0 @@ try { |
{ | ||
"name": "@sol-x/couchdb-migration-store", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "couchdb migration store for node-migrate", | ||
@@ -27,7 +27,9 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"nano": "git://github.com/sol-x/couchdb-nano.git#8.1.3" | ||
"nano": "git://github.com/sol-x/couchdb-nano.git#8.1.3", | ||
"wait-on": "^3.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/wait-on": "^3.2.0", | ||
"typescript": "^3.7.5" | ||
} | ||
} |
import Nano from "nano"; | ||
import waitOn from "wait-on"; | ||
@@ -15,2 +16,3 @@ interface MigrationData { | ||
couchDbUrl: string; | ||
couchDbWaitTime: number; | ||
@@ -24,5 +26,13 @@ constructor() { | ||
} | ||
this.couchDbWaitTime = parseInt(process.env.COUCHDB_WAIT_TIME || "0") || 10 * 1000; | ||
this.couchDbUrl = couchDbUrl; | ||
} | ||
private async waitForCouchdb(): Promise<void> { | ||
await waitOn({ | ||
resources: [this.couchDbUrl], | ||
timeout: this.couchDbWaitTime, | ||
}); | ||
} | ||
async save(migrationData: MigrationData, callback: MigrationSaveCallback): Promise<void> { | ||
@@ -36,2 +46,4 @@ const { lastRun } = migrationData; | ||
await this.waitForCouchdb(); | ||
const nano = Nano(this.couchDbUrl); | ||
@@ -55,2 +67,4 @@ try { | ||
async load(callback: MigrationLoadCallback): Promise<void> { | ||
await this.waitForCouchdb(); | ||
const nano = Nano(this.couchDbUrl); | ||
@@ -57,0 +71,0 @@ try { |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
7818
17.05%157
15.44%2
100%2
100%2
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added