onixjs / core

Enterprise Grade #NodeJS Platform implementing Industry Standards & Patterns in order to provide Connectivity, Stability, High-Availability and High-Performance
https://onixjs.io
Other
52 stars 7 forks source link

NPM Start Fails - Errors included #59

Closed engineertdog closed 6 years ago

engineertdog commented 6 years ago
Tylers-MacBook-Pro:starter-master tyler$ npm start

> @onixjs/starter@1.0.4 start /Users/tyler/Downloads/starter-master
> npm run build && node dist/index.js

> @onixjs/starter@1.0.4 build /Users/tyler/Downloads/starter-master
> npm run lint:fix && tsc

> @onixjs/starter@1.0.4 lint:fix /Users/tyler/Downloads/starter-master
> npm run prettier:fix

> @onixjs/starter@1.0.4 prettier:fix /Users/tyler/Downloads/starter-master
> npm run prettier:cli -- --write

> @onixjs/starter@1.0.4 prettier:cli /Users/tyler/Downloads/starter-master
> prettier "**/*.ts" "**/*.js" "--write"

src/example.app/example.component.ts 365ms
src/example.app/example.model.ts 8ms
src/example.app/example.module.ts 7ms
src/example.app/index.ts 4ms
src/example.app/mongo.datasource.ts 14ms
src/index.ts 17ms
src/example.app/example.model.ts:8:8 - error TS2345: Argument of type '{ datasource: typeof MongooseDatasource; }' is not assignable to parameter of type 'IModelConfig'.
  Types of property 'datasource' are incompatible.
    Type 'typeof MongooseDatasource' is not assignable to type 'new () => IDataSource'.
      Type 'MongooseDatasource' is not assignable to type 'IDataSource'.

 8 @Model({
          ~
 9   datasource: MongooseDatasource,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 })
   ~

src/example.app/mongo.datasource.ts:8:2 - error TS2345: Argument of type 'typeof MongooseDatasource' is not assignable to parameter of type 'new () => IDataSource'.
  Type 'MongooseDatasource' is not assignable to type 'IDataSource'.
    Types of property 'register' are incompatible.
      Type '(Class: Constructor, model: any, schema: IModel) => any' is not assignable to type '(register: IModelRegister) => Promise<IModelRegister>'.

8 @DataSource()
   ~~~~~~~~~~~~

src/example.app/mongo.datasource.ts:41:3 - error TS2416: Property 'register' in type 'MongooseDatasource' is not assignable to the same property in base type 'IDataSource'.
  Type '(Class: Constructor, model: any, schema: IModel) => any' is not assignable to type '(register: IModelRegister) => Promise<IModelRegister>'.

41   register(Class: Constructor, model: any, schema: IModel) {
     ~~~~~~~~

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @onixjs/starter@1.0.4 build: `npm run lint:fix && tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @onixjs/starter@1.0.4 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tyler/.npm/_logs/2018-06-09T19_54_26_145Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @onixjs/starter@1.0.4 start: `npm run build && node dist/index.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @onixjs/starter@1.0.4 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tyler/.npm/_logs/2018-06-09T19_54_26_175Z-debug.log
jonathan-casarrubias commented 6 years ago

Hi @engineertdog thanks for reaching out,

hey so yeah that is result of the latest beta version, which changed the way to register models. This is because we just implemented some hooks for you to manipulate the schema before registering the model, or to manipulate the model after it has been registered.

please consider the updated documentation

https://github.com/onixjs/core/wiki/E.-Datasources#example

Also I updated the starter to follow the new convention

Cheers Jon