Skip to content

Commit babf2db

Browse files
authored
Merge pull request #20 from fabrix-app/v1.5
[fix] generic type
2 parents 0cd35f1 + c028ab2 commit babf2db

File tree

8 files changed

+92
-3
lines changed

8 files changed

+92
-3
lines changed

lib/common/Generic.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import { FabrixApp } from '../index'
2+
3+
export interface FabrixGeneric {
4+
[key: string]: any
5+
app: FabrixApp
6+
methods: string[]
7+
}
28
/**
39
* Fabrix Generic Class.
410
*/
@@ -18,7 +24,7 @@ export class FabrixGeneric {
1824
/**
1925
* Return the id of this controller
2026
*/
21-
get id (): string {
27+
public get id (): string {
2228
return this.constructor.name.toLowerCase()
2329
}
2430
}

lib/common/spools/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export { DatastoreSpool } from './datastore'
2+
export { ExtensionSpool } from './extension'
3+
export { MiscSpool } from './misc'
4+
export { ServerSpool } from './server'
5+
export { ToolSpool } from './tool'

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fabrix/fabrix",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "Strongly Typed Modern Web Application Framework for Node.js",
55
"keywords": [
66
"framework",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const assert = require('assert')
2+
3+
const Fabrix = require('../../../../dist').FabrixApp
4+
const DatastoreSpool = require('./datastorespool')
5+
6+
describe('# Datastore spool', () => {
7+
let app
8+
beforeEach(() => {
9+
app = new Fabrix({
10+
api: {},
11+
config: {
12+
main: {
13+
spools: [
14+
DatastoreSpool
15+
]
16+
}
17+
},
18+
pkg: {}
19+
})
20+
})
21+
22+
describe('#name', () => {
23+
it('should return module name', () => {
24+
const spool= new DatastoreSpool(app)
25+
assert.equal(spool.name, 'datastorespool')
26+
})
27+
})
28+
})
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const assert = require('assert')
2+
3+
const Fabrix = require('../../../../dist').FabrixApp
4+
const ServerSpool = require('./serverspool')
5+
6+
describe('# Server spool', () => {
7+
let app
8+
beforeEach(() => {
9+
app = new Fabrix({
10+
api: {},
11+
config: {
12+
main: {
13+
spools: [
14+
ServerSpool
15+
]
16+
}
17+
},
18+
pkg: {}
19+
})
20+
})
21+
22+
describe('#name', () => {
23+
it('should return module name', () => {
24+
const spool= new ServerSpool(app)
25+
assert.equal(spool.name, 'serverspool')
26+
})
27+
})
28+
})
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Spool = require('../../../../dist/common/spools/datastore').DatastoreSpool
2+
3+
module.exports = class DatastoreSpool extends Spool {
4+
constructor (app) {
5+
super(app, {
6+
pkg: {
7+
name: 'spool-datastorespool'
8+
}
9+
})
10+
}
11+
}

test/lib/common/spools/serverspool.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Spool = require('../../../../dist/common/spools/server').ServerSpool
2+
3+
module.exports = class ServerSpool extends Spool {
4+
constructor (app) {
5+
super(app, {
6+
pkg: {
7+
name: 'spool-serverspool'
8+
}
9+
})
10+
}
11+
}

0 commit comments

Comments
 (0)