@projectinvicta/nails 3.0.5 → 3.0.6

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.
Files changed (2) hide show
  1. package/lib/Nails.ts +7 -0
  2. package/package.json +1 -1
package/lib/Nails.ts CHANGED
@@ -175,9 +175,13 @@ export default class Nails {
175
175
  const schema = modelModule.schema;
176
176
  const options = modelModule.options;
177
177
  const defer = modelModule.defer as (() => Promise<void>) | undefined;
178
+ const afterInitialize = modelModule.afterInitialize as (() => Promise<void>) | undefined;
178
179
  if (modelModule.finalize) {
179
180
  this.modelFinalizations.push(modelModule.finalize as () => Promise<void>);
180
181
  }
182
+ if (modelModule.afterInitializeAll) {
183
+ this.modelFinalizations.push(modelModule.afterInitializeAll as () => Promise<void>);
184
+ }
181
185
  this.modelMigrations.push(modelModule.migrate as () => Promise<void>);
182
186
 
183
187
  modelClass.init(schema, { sequelize: this.sequelize, ...options });
@@ -186,6 +190,9 @@ export default class Nails {
186
190
  if (defer) {
187
191
  await defer();
188
192
  }
193
+ if (afterInitialize) {
194
+ await afterInitialize();
195
+ }
189
196
  await modelClass.sync();
190
197
  }
191
198
  else console.warn("No model found at:", absolutePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectinvicta/nails",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "A node.js webserver scaffold",
5
5
  "type": "module",
6
6
  "main": "index.ts",