@feathersjs/generators 5.0.28 → 5.0.29
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/CHANGELOG.md +6 -0
- package/lib/app/index.js +1 -2
- package/lib/app/index.js.map +1 -1
- package/lib/app/templates/gitignore.tpl.d.ts +5 -0
- package/lib/app/templates/gitignore.tpl.js +125 -0
- package/lib/app/templates/gitignore.tpl.js.map +1 -0
- package/package.json +20 -21
- package/lib/app/index.ts +0 -215
- package/lib/app/templates/app.test.tpl.ts +0 -50
- package/lib/app/templates/app.tpl.ts +0 -141
- package/lib/app/templates/channels.tpl.ts +0 -54
- package/lib/app/templates/client.test.tpl.ts +0 -28
- package/lib/app/templates/client.tpl.ts +0 -53
- package/lib/app/templates/configuration.tpl.ts +0 -89
- package/lib/app/templates/declarations.tpl.ts +0 -42
- package/lib/app/templates/index.html.tpl.ts +0 -44
- package/lib/app/templates/index.tpl.ts +0 -26
- package/lib/app/templates/logger.tpl.ts +0 -56
- package/lib/app/templates/package.json.tpl.ts +0 -78
- package/lib/app/templates/prettierrc.tpl.ts +0 -14
- package/lib/app/templates/readme.md.tpl.ts +0 -57
- package/lib/app/templates/services.tpl.ts +0 -20
- package/lib/app/templates/tsconfig.json.tpl.ts +0 -29
- package/lib/app/templates/validators.tpl.ts +0 -39
- package/lib/authentication/index.ts +0 -119
- package/lib/authentication/templates/authentication.tpl.ts +0 -52
- package/lib/authentication/templates/client.test.tpl.ts +0 -78
- package/lib/authentication/templates/config.tpl.ts +0 -60
- package/lib/authentication/templates/declarations.tpl.ts +0 -38
- package/lib/commons.ts +0 -346
- package/lib/connection/index.ts +0 -138
- package/lib/connection/templates/knex.tpl.ts +0 -73
- package/lib/connection/templates/mongodb.tpl.ts +0 -50
- package/lib/hook/index.ts +0 -52
- package/lib/hook/templates/hook.tpl.ts +0 -33
- package/lib/index.ts +0 -8
- package/lib/service/index.ts +0 -214
- package/lib/service/templates/client.tpl.ts +0 -33
- package/lib/service/templates/schema.json.tpl.ts +0 -143
- package/lib/service/templates/schema.typebox.tpl.ts +0 -131
- package/lib/service/templates/service.tpl.ts +0 -161
- package/lib/service/templates/shared.tpl.ts +0 -64
- package/lib/service/templates/test.tpl.ts +0 -33
- package/lib/service/type/custom.tpl.ts +0 -112
- package/lib/service/type/knex.tpl.ts +0 -105
- package/lib/service/type/mongodb.tpl.ts +0 -64
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { toFile } from '@featherscloud/pinion'
|
|
2
|
-
import { renderSource, yyyymmddhhmmss } from '../../commons.js'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index.js'
|
|
4
|
-
|
|
5
|
-
const migrationTemplate = ({
|
|
6
|
-
kebabPath,
|
|
7
|
-
authStrategies,
|
|
8
|
-
isEntityService
|
|
9
|
-
}: ServiceGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/knexfile.html
|
|
10
|
-
import type { Knex } from 'knex'
|
|
11
|
-
|
|
12
|
-
export async function up(knex: Knex): Promise<void> {
|
|
13
|
-
await knex.schema.createTable('${kebabPath}', table => {
|
|
14
|
-
table.increments('id')
|
|
15
|
-
${
|
|
16
|
-
isEntityService
|
|
17
|
-
? authStrategies
|
|
18
|
-
.map((name) =>
|
|
19
|
-
name === 'local'
|
|
20
|
-
? `
|
|
21
|
-
table.string('email').unique()
|
|
22
|
-
table.string('password')`
|
|
23
|
-
: `
|
|
24
|
-
table.string('${name}Id')`
|
|
25
|
-
)
|
|
26
|
-
.join('\n')
|
|
27
|
-
: `
|
|
28
|
-
table.string('text')`
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function down(knex: Knex): Promise<void> {
|
|
34
|
-
await knex.schema.dropTable('${kebabPath}')
|
|
35
|
-
}
|
|
36
|
-
`
|
|
37
|
-
|
|
38
|
-
export const template = ({
|
|
39
|
-
className,
|
|
40
|
-
upperName,
|
|
41
|
-
feathers,
|
|
42
|
-
schema,
|
|
43
|
-
fileName,
|
|
44
|
-
relative
|
|
45
|
-
}: ServiceGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#database-services
|
|
46
|
-
import type { Params } from '@feathersjs/feathers'
|
|
47
|
-
import { KnexService } from '@feathersjs/knex'
|
|
48
|
-
import type { KnexAdapterParams, KnexAdapterOptions } from '@feathersjs/knex'
|
|
49
|
-
|
|
50
|
-
import type { Application } from '${relative}/declarations'
|
|
51
|
-
${
|
|
52
|
-
schema
|
|
53
|
-
? `import type {
|
|
54
|
-
${upperName},
|
|
55
|
-
${upperName}Data,
|
|
56
|
-
${upperName}Patch,
|
|
57
|
-
${upperName}Query
|
|
58
|
-
} from './${fileName}.schema'
|
|
59
|
-
`
|
|
60
|
-
: `
|
|
61
|
-
type ${upperName} = any
|
|
62
|
-
type ${upperName}Data = any
|
|
63
|
-
type ${upperName}Patch = any
|
|
64
|
-
type ${upperName}Query = any
|
|
65
|
-
`
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export type { ${upperName}, ${upperName}Data, ${upperName}Patch, ${upperName}Query }
|
|
69
|
-
|
|
70
|
-
export interface ${upperName}Params extends KnexAdapterParams<${upperName}Query> {
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// By default calls the standard Knex adapter service methods but can be customized with your own functionality.
|
|
74
|
-
export class ${className}<ServiceParams extends Params = ${upperName}Params>
|
|
75
|
-
extends KnexService<${upperName}, ${upperName}Data, ${upperName}Params, ${upperName}Patch> {
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const getOptions = (app: Application): KnexAdapterOptions => {
|
|
79
|
-
return {
|
|
80
|
-
paginate: app.get('paginate'),
|
|
81
|
-
Model: app.get('${feathers.database}Client'),
|
|
82
|
-
name: '${fileName}'
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
`
|
|
86
|
-
|
|
87
|
-
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
88
|
-
Promise.resolve(ctx)
|
|
89
|
-
.then(
|
|
90
|
-
renderSource(
|
|
91
|
-
template,
|
|
92
|
-
toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
|
|
93
|
-
lib,
|
|
94
|
-
'services',
|
|
95
|
-
...folder,
|
|
96
|
-
`${fileName}.class`
|
|
97
|
-
])
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
.then(
|
|
101
|
-
renderSource(
|
|
102
|
-
migrationTemplate,
|
|
103
|
-
toFile<ServiceGeneratorContext>('migrations', ({ kebabName }) => `${yyyymmddhhmmss()}_${kebabName}`)
|
|
104
|
-
)
|
|
105
|
-
)
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { toFile } from '@featherscloud/pinion'
|
|
2
|
-
import { renderSource } from '../../commons.js'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index.js'
|
|
4
|
-
|
|
5
|
-
export const template = ({
|
|
6
|
-
className,
|
|
7
|
-
upperName,
|
|
8
|
-
schema,
|
|
9
|
-
fileName,
|
|
10
|
-
kebabPath,
|
|
11
|
-
relative
|
|
12
|
-
}: ServiceGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#database-services
|
|
13
|
-
import type { Params } from '@feathersjs/feathers'
|
|
14
|
-
import { MongoDBService } from \'@feathersjs/mongodb\'
|
|
15
|
-
import type { MongoDBAdapterParams, MongoDBAdapterOptions } from \'@feathersjs/mongodb\'
|
|
16
|
-
|
|
17
|
-
import type { Application } from '${relative}/declarations'
|
|
18
|
-
${
|
|
19
|
-
schema
|
|
20
|
-
? `import type {
|
|
21
|
-
${upperName},
|
|
22
|
-
${upperName}Data,
|
|
23
|
-
${upperName}Patch,
|
|
24
|
-
${upperName}Query
|
|
25
|
-
} from './${fileName}.schema'
|
|
26
|
-
`
|
|
27
|
-
: `
|
|
28
|
-
type ${upperName} = any
|
|
29
|
-
type ${upperName}Data = any
|
|
30
|
-
type ${upperName}Patch = any
|
|
31
|
-
type ${upperName}Query = any
|
|
32
|
-
`
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type { ${upperName}, ${upperName}Data, ${upperName}Patch, ${upperName}Query }
|
|
36
|
-
|
|
37
|
-
export interface ${upperName}Params extends MongoDBAdapterParams<${upperName}Query> {
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
|
|
41
|
-
export class ${className}<ServiceParams extends Params = ${upperName}Params>
|
|
42
|
-
extends MongoDBService<${upperName}, ${upperName}Data, ${upperName}Params, ${upperName}Patch> {
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const getOptions = (app: Application): MongoDBAdapterOptions => {
|
|
46
|
-
return {
|
|
47
|
-
paginate: app.get('paginate'),
|
|
48
|
-
Model: app.get('mongodbClient').then(db => db.collection('${kebabPath}'))
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`
|
|
52
|
-
|
|
53
|
-
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
54
|
-
Promise.resolve(ctx).then(
|
|
55
|
-
renderSource(
|
|
56
|
-
template,
|
|
57
|
-
toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
|
|
58
|
-
lib,
|
|
59
|
-
'services',
|
|
60
|
-
...folder,
|
|
61
|
-
`${fileName}.class`
|
|
62
|
-
])
|
|
63
|
-
)
|
|
64
|
-
)
|