sqlmorpheus 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  interface DatabaseAccess {
2
- createBackup?(name: string): Promise<void>;
2
+ createBackup?(backupName: string): Promise<void>;
3
3
  runGetStatement(query: string): Promise<unknown>;
4
4
  runMultipleWriteStatements(query: string): Promise<void>;
5
5
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  interface DatabaseAccess {
2
- createBackup?(name: string): Promise<void>;
2
+ createBackup?(backupName: string): Promise<void>;
3
3
  runGetStatement(query: string): Promise<unknown>;
4
4
  runMultipleWriteStatements(query: string): Promise<void>;
5
5
  }
package/dist/index.js CHANGED
@@ -151,7 +151,9 @@ var NotAllowedException = class extends Error {
151
151
  message += `
152
152
  migrations.allowMigration(${entry.version}, "${entry.tableName}", "${entry.type}");`;
153
153
  }
154
- super(message);
154
+ super(`${message}
155
+
156
+ `);
155
157
  }
156
158
  };
157
159
 
@@ -188,13 +190,15 @@ var Migrations = class {
188
190
  this.notAllowedChanges.push({ version: this.toVersion, tableName, type });
189
191
  }
190
192
  checkIfAllowed(throwIfNotAllowed) {
193
+ if (!this.notAllowedChanges.length)
194
+ return true;
191
195
  const exception = new NotAllowedException(this.notAllowedChanges);
192
196
  if (throwIfNotAllowed)
193
197
  throw exception;
194
198
  else {
195
199
  console.error(exception.message);
200
+ return false;
196
201
  }
197
- return !this.notAllowedChanges.length;
198
202
  }
199
203
  allowMigration(version, table, ...allowedMigrations) {
200
204
  if (version < this.fromVersion || version > this.toVersion)
package/dist/index.mjs CHANGED
@@ -119,7 +119,9 @@ var NotAllowedException = class extends Error {
119
119
  message += `
120
120
  migrations.allowMigration(${entry.version}, "${entry.tableName}", "${entry.type}");`;
121
121
  }
122
- super(message);
122
+ super(`${message}
123
+
124
+ `);
123
125
  }
124
126
  };
125
127
 
@@ -156,13 +158,15 @@ var Migrations = class {
156
158
  this.notAllowedChanges.push({ version: this.toVersion, tableName, type });
157
159
  }
158
160
  checkIfAllowed(throwIfNotAllowed) {
161
+ if (!this.notAllowedChanges.length)
162
+ return true;
159
163
  const exception = new NotAllowedException(this.notAllowedChanges);
160
164
  if (throwIfNotAllowed)
161
165
  throw exception;
162
166
  else {
163
167
  console.error(exception.message);
168
+ return false;
164
169
  }
165
- return !this.notAllowedChanges.length;
166
170
  }
167
171
  allowMigration(version, table, ...allowedMigrations) {
168
172
  if (version < this.fromVersion || version > this.toVersion)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlmorpheus",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "author": "JodliDev",
5
5
  "keywords": [],
6
6
  "license": "MIT",