@projectinvicta/nails 3.0.9 → 3.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectinvicta/nails",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "description": "A node.js webserver scaffold",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,6 +1,6 @@
1
- import nails from 'nails-boilerplate';
1
+ import Nails from '@projectinvicta/nails';
2
2
 
3
- // See self-documented config files
4
- import service_config from '../config/service.js';
3
+ import service_config from '../config/service.ts';
5
4
 
6
- (await nails( service_config )).startServer();
5
+ const nails = new Nails(service_config);
6
+ await nails.startServer();
@@ -1,5 +1,5 @@
1
1
  import {Controller} from "@projectinvicta/nails";
2
- import User from "../models/User";
2
+ import User from "../models/User.ts";
3
3
 
4
4
  export default class UsersController extends Controller {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import {Model, DataTypes} from "@projectinvicta/nails";
2
- import Dog from "./Dog";
2
+ import Dog from "./Dog.ts";
3
3
 
4
4
  export const schema = {
5
5
  name: DataTypes.STRING,
@@ -9,6 +9,10 @@ export const schema = {
9
9
 
10
10
  export default class User extends Model {};
11
11
 
12
- export async function defer() {
12
+ export async function afterInitialize() {
13
+ // Add hooks here
14
+ }
15
+
16
+ export async function afterInitializeAll() {
13
17
  await User.hasMany(Dog);
14
18
  }
@@ -8,6 +8,6 @@ export const schema = {
8
8
 
9
9
  export default class Dog extends Model {};
10
10
 
11
- export async function finalize() {
11
+ export async function afterInitializeAll() {
12
12
  Dog.belongsTo(Owner);
13
13
  }
@@ -7,6 +7,6 @@ export const schema = {
7
7
  };
8
8
  export default class Owner extends Model {};
9
9
 
10
- export async function defer() {
10
+ export async function afterInitializeAll() {
11
11
  Owner.hasMany(Dog);
12
12
  }