@feathersjs/cli 5.0.0-pre.34 → 5.0.0-pre.35
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 +13 -0
- package/lib/index.d.ts +6 -2
- package/lib/index.js +59 -2
- package/lib/index.js.map +1 -1
- package/package.json +28 -30
- package/lib/app/index.d.ts +0 -29
- package/lib/app/index.js +0 -146
- package/lib/app/index.js.map +0 -1
- package/lib/app/index.ts +0 -228
- package/lib/app/static/.gitignore +0 -121
- package/lib/app/templates/app.test.tpl.d.ts +0 -2
- package/lib/app/templates/app.test.tpl.js +0 -49
- package/lib/app/templates/app.test.tpl.js.map +0 -1
- package/lib/app/templates/app.test.tpl.ts +0 -50
- package/lib/app/templates/app.tpl.d.ts +0 -2
- package/lib/app/templates/app.tpl.js +0 -123
- package/lib/app/templates/app.tpl.js.map +0 -1
- package/lib/app/templates/app.tpl.ts +0 -138
- package/lib/app/templates/channels.tpl.d.ts +0 -2
- package/lib/app/templates/channels.tpl.js +0 -49
- package/lib/app/templates/channels.tpl.js.map +0 -1
- package/lib/app/templates/channels.tpl.ts +0 -55
- package/lib/app/templates/client.test.tpl.d.ts +0 -2
- package/lib/app/templates/client.test.tpl.js +0 -27
- package/lib/app/templates/client.test.tpl.js.map +0 -1
- package/lib/app/templates/client.test.tpl.ts +0 -26
- package/lib/app/templates/client.tpl.d.ts +0 -2
- package/lib/app/templates/client.tpl.js +0 -38
- package/lib/app/templates/client.tpl.js.map +0 -1
- package/lib/app/templates/client.tpl.ts +0 -45
- package/lib/app/templates/configuration.tpl.d.ts +0 -2
- package/lib/app/templates/configuration.tpl.js +0 -71
- package/lib/app/templates/configuration.tpl.js.map +0 -1
- package/lib/app/templates/configuration.tpl.ts +0 -82
- package/lib/app/templates/declarations.tpl.d.ts +0 -2
- package/lib/app/templates/declarations.tpl.js +0 -28
- package/lib/app/templates/declarations.tpl.js.map +0 -1
- package/lib/app/templates/declarations.tpl.ts +0 -37
- package/lib/app/templates/index.html.tpl.d.ts +0 -2
- package/lib/app/templates/index.html.tpl.js +0 -45
- package/lib/app/templates/index.html.tpl.js.map +0 -1
- package/lib/app/templates/index.html.tpl.ts +0 -44
- package/lib/app/templates/index.tpl.d.ts +0 -2
- package/lib/app/templates/index.tpl.js +0 -18
- package/lib/app/templates/index.tpl.js.map +0 -1
- package/lib/app/templates/index.tpl.ts +0 -22
- package/lib/app/templates/logger.tpl.d.ts +0 -3
- package/lib/app/templates/logger.tpl.js +0 -45
- package/lib/app/templates/logger.tpl.js.map +0 -1
- package/lib/app/templates/logger.tpl.ts +0 -56
- package/lib/app/templates/package.json.tpl.d.ts +0 -2
- package/lib/app/templates/package.json.tpl.js +0 -58
- package/lib/app/templates/package.json.tpl.js.map +0 -1
- package/lib/app/templates/package.json.tpl.ts +0 -71
- package/lib/app/templates/prettierrc.tpl.d.ts +0 -2
- package/lib/app/templates/prettierrc.tpl.js +0 -11
- package/lib/app/templates/prettierrc.tpl.js.map +0 -1
- package/lib/app/templates/prettierrc.tpl.ts +0 -14
- package/lib/app/templates/readme.md.tpl.d.ts +0 -2
- package/lib/app/templates/readme.md.tpl.js +0 -54
- package/lib/app/templates/readme.md.tpl.js.map +0 -1
- package/lib/app/templates/readme.md.tpl.ts +0 -57
- package/lib/app/templates/services.tpl.d.ts +0 -2
- package/lib/app/templates/services.tpl.js +0 -15
- package/lib/app/templates/services.tpl.js.map +0 -1
- package/lib/app/templates/services.tpl.ts +0 -20
- package/lib/app/templates/tsconfig.json.tpl.d.ts +0 -2
- package/lib/app/templates/tsconfig.json.tpl.js +0 -22
- package/lib/app/templates/tsconfig.json.tpl.js.map +0 -1
- package/lib/app/templates/tsconfig.json.tpl.ts +0 -28
- package/lib/app/templates/validators.tpl.d.ts +0 -2
- package/lib/app/templates/validators.tpl.js +0 -36
- package/lib/app/templates/validators.tpl.js.map +0 -1
- package/lib/app/templates/validators.tpl.ts +0 -40
- package/lib/authentication/index.d.ts +0 -73
- package/lib/authentication/index.js +0 -107
- package/lib/authentication/index.js.map +0 -1
- package/lib/authentication/index.ts +0 -126
- package/lib/authentication/templates/authentication.tpl.d.ts +0 -2
- package/lib/authentication/templates/authentication.tpl.js +0 -40
- package/lib/authentication/templates/authentication.tpl.js.map +0 -1
- package/lib/authentication/templates/authentication.tpl.ts +0 -51
- package/lib/authentication/templates/client.test.tpl.d.ts +0 -2
- package/lib/authentication/templates/client.test.tpl.js +0 -62
- package/lib/authentication/templates/client.test.tpl.js.map +0 -1
- package/lib/authentication/templates/client.test.tpl.ts +0 -74
- package/lib/authentication/templates/config.tpl.d.ts +0 -2
- package/lib/authentication/templates/config.tpl.js +0 -50
- package/lib/authentication/templates/config.tpl.js.map +0 -1
- package/lib/authentication/templates/config.tpl.ts +0 -57
- package/lib/authentication/templates/declarations.tpl.d.ts +0 -2
- package/lib/authentication/templates/declarations.tpl.js +0 -19
- package/lib/authentication/templates/declarations.tpl.js.map +0 -1
- package/lib/authentication/templates/declarations.tpl.ts +0 -34
- package/lib/authentication/templates/knex.tpl.d.ts +0 -2
- package/lib/authentication/templates/knex.tpl.js +0 -45
- package/lib/authentication/templates/knex.tpl.js.map +0 -1
- package/lib/authentication/templates/knex.tpl.ts +0 -62
- package/lib/authentication/templates/schema.json.tpl.d.ts +0 -2
- package/lib/authentication/templates/schema.json.tpl.js +0 -103
- package/lib/authentication/templates/schema.json.tpl.js.map +0 -1
- package/lib/authentication/templates/schema.json.tpl.ts +0 -124
- package/lib/authentication/templates/schema.typebox.tpl.d.ts +0 -3
- package/lib/authentication/templates/schema.typebox.tpl.js +0 -86
- package/lib/authentication/templates/schema.typebox.tpl.js.map +0 -1
- package/lib/authentication/templates/schema.typebox.tpl.ts +0 -108
- package/lib/cli.d.ts +0 -6
- package/lib/cli.js +0 -75
- package/lib/cli.js.map +0 -1
- package/lib/cli.ts +0 -68
- package/lib/commons.d.ts +0 -150
- package/lib/commons.js +0 -198
- package/lib/commons.js.map +0 -1
- package/lib/commons.ts +0 -284
- package/lib/connection/index.d.ts +0 -55
- package/lib/connection/index.js +0 -88
- package/lib/connection/index.js.map +0 -1
- package/lib/connection/index.ts +0 -123
- package/lib/connection/templates/knex.tpl.d.ts +0 -2
- package/lib/connection/templates/knex.tpl.js +0 -48
- package/lib/connection/templates/knex.tpl.js.map +0 -1
- package/lib/connection/templates/knex.tpl.ts +0 -67
- package/lib/connection/templates/mongodb.tpl.d.ts +0 -2
- package/lib/connection/templates/mongodb.tpl.js +0 -34
- package/lib/connection/templates/mongodb.tpl.js.map +0 -1
- package/lib/connection/templates/mongodb.tpl.ts +0 -40
- package/lib/hook/index.d.ts +0 -22
- package/lib/hook/index.js +0 -43
- package/lib/hook/index.js.map +0 -1
- package/lib/hook/index.ts +0 -47
- package/lib/hook/templates/hook.tpl.d.ts +0 -2
- package/lib/hook/templates/hook.tpl.js +0 -22
- package/lib/hook/templates/hook.tpl.js.map +0 -1
- package/lib/hook/templates/hook.tpl.ts +0 -33
- package/lib/index.ts +0 -2
- package/lib/service/index.d.ts +0 -64
- package/lib/service/index.js +0 -116
- package/lib/service/index.js.map +0 -1
- package/lib/service/index.ts +0 -191
- package/lib/service/templates/client.tpl.d.ts +0 -2
- package/lib/service/templates/client.tpl.js +0 -31
- package/lib/service/templates/client.tpl.js.map +0 -1
- package/lib/service/templates/client.tpl.ts +0 -57
- package/lib/service/templates/schema.json.tpl.d.ts +0 -2
- package/lib/service/templates/schema.json.tpl.js +0 -83
- package/lib/service/templates/schema.json.tpl.js.map +0 -1
- package/lib/service/templates/schema.json.tpl.ts +0 -98
- package/lib/service/templates/schema.typebox.tpl.d.ts +0 -2
- package/lib/service/templates/schema.typebox.tpl.js +0 -61
- package/lib/service/templates/schema.typebox.tpl.js.map +0 -1
- package/lib/service/templates/schema.typebox.tpl.ts +0 -76
- package/lib/service/templates/service.tpl.d.ts +0 -3
- package/lib/service/templates/service.tpl.js +0 -112
- package/lib/service/templates/service.tpl.js.map +0 -1
- package/lib/service/templates/service.tpl.ts +0 -152
- package/lib/service/templates/test.tpl.d.ts +0 -2
- package/lib/service/templates/test.tpl.js +0 -25
- package/lib/service/templates/test.tpl.js.map +0 -1
- package/lib/service/templates/test.tpl.ts +0 -33
- package/lib/service/type/custom.tpl.d.ts +0 -3
- package/lib/service/type/custom.tpl.js +0 -98
- package/lib/service/type/custom.tpl.js.map +0 -1
- package/lib/service/type/custom.tpl.ts +0 -109
- package/lib/service/type/knex.tpl.d.ts +0 -3
- package/lib/service/type/knex.tpl.js +0 -71
- package/lib/service/type/knex.tpl.js.map +0 -1
- package/lib/service/type/knex.tpl.ts +0 -92
- package/lib/service/type/mongodb.tpl.d.ts +0 -3
- package/lib/service/type/mongodb.tpl.js +0 -50
- package/lib/service/type/mongodb.tpl.js.map +0 -1
- package/lib/service/type/mongodb.tpl.ts +0 -62
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
6
|
-
const template = ({ camelName, upperName, relative, type, cwd, lib }) => /* ts */ `// // For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
|
|
7
|
-
import { resolve } from '@feathersjs/schema'
|
|
8
|
-
import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
|
|
9
|
-
import type { Static } from '@feathersjs/typebox'
|
|
10
|
-
|
|
11
|
-
import type { HookContext } from '${relative}/declarations'
|
|
12
|
-
import { dataValidator, queryValidator } from '${relative}/${(0, commons_1.fileExists)(cwd, lib, 'schemas') ? 'schemas/' : '' // This is for legacy backwards compatibility
|
|
13
|
-
}validators'
|
|
14
|
-
|
|
15
|
-
// Main data model schema
|
|
16
|
-
export const ${camelName}Schema = Type.Object({
|
|
17
|
-
${type === 'mongodb' ? '_id: Type.String()' : 'id: Type.Number()'},
|
|
18
|
-
text: Type.String()
|
|
19
|
-
}, { $id: '${upperName}', additionalProperties: false })
|
|
20
|
-
export type ${upperName} = Static<typeof ${camelName}Schema>
|
|
21
|
-
export const ${camelName}Resolver = resolve<${upperName}, HookContext>({})
|
|
22
|
-
|
|
23
|
-
export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({})
|
|
24
|
-
|
|
25
|
-
// Schema for creating new entries
|
|
26
|
-
export const ${camelName}DataSchema = Type.Pick(${camelName}Schema, ['text'], {
|
|
27
|
-
$id: '${upperName}Data'
|
|
28
|
-
})
|
|
29
|
-
export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
|
|
30
|
-
export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
|
|
31
|
-
export const ${camelName}DataResolver = resolve<${upperName}, HookContext>({})
|
|
32
|
-
|
|
33
|
-
// Schema for updating existing entries
|
|
34
|
-
export const ${camelName}PatchSchema = Type.Partial(${camelName}Schema, {
|
|
35
|
-
$id: '${upperName}Patch'
|
|
36
|
-
})
|
|
37
|
-
export type ${upperName}Patch = Static<typeof ${camelName}PatchSchema>
|
|
38
|
-
export const ${camelName}PatchValidator = getDataValidator(${camelName}PatchSchema, dataValidator)
|
|
39
|
-
export const ${camelName}PatchResolver = resolve<${upperName}, HookContext>({})
|
|
40
|
-
|
|
41
|
-
// Schema for allowed query properties
|
|
42
|
-
export const ${camelName}QueryProperties = Type.Pick(${camelName}Schema, [
|
|
43
|
-
'${type === 'mongodb' ? '_id' : 'id'}', 'text'
|
|
44
|
-
])
|
|
45
|
-
export const ${camelName}QuerySchema = Type.Intersect([
|
|
46
|
-
querySyntax(${camelName}QueryProperties),
|
|
47
|
-
// Add additional query properties here
|
|
48
|
-
Type.Object({}, { additionalProperties: false })
|
|
49
|
-
], { additionalProperties: false })
|
|
50
|
-
export type ${upperName}Query = Static<typeof ${camelName}QuerySchema>
|
|
51
|
-
export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
|
|
52
|
-
export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({})
|
|
53
|
-
`;
|
|
54
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, pinion_1.when)(({ schema }) => schema === 'typebox', (0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
|
|
55
|
-
lib,
|
|
56
|
-
'services',
|
|
57
|
-
...folder,
|
|
58
|
-
`${fileName}.schema`
|
|
59
|
-
]))));
|
|
60
|
-
exports.generate = generate;
|
|
61
|
-
//# sourceMappingURL=schema.typebox.tpl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.typebox.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.typebox.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAC5D,2CAAwD;AAGxD,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,GAAG,EACH,GAAG,EACqB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;oCAKJ,QAAQ;iDACK,QAAQ,IACvD,IAAA,oBAAU,EAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,6CAA6C;AACjG;;;eAGe,SAAS;MAClB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,mBAAmB;;eAEtD,SAAS;cACV,SAAS,oBAAoB,SAAS;eACrC,SAAS,sBAAsB,SAAS;;eAExC,SAAS,8BAA8B,SAAS;;;eAGhD,SAAS,0BAA0B,SAAS;UACjD,SAAS;;cAEL,SAAS,wBAAwB,SAAS;eACzC,SAAS,oCAAoC,SAAS;eACtD,SAAS,0BAA0B,SAAS;;;eAG5C,SAAS,8BAA8B,SAAS;UACrD,SAAS;;cAEL,SAAS,yBAAyB,SAAS;eAC1C,SAAS,qCAAqC,SAAS;eACvD,SAAS,2BAA2B,SAAS;;;eAG7C,SAAS,+BAA+B,SAAS;KAC3D,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;;eAEvB,SAAS;gBACR,SAAS;;;;cAIX,SAAS,yBAAyB,SAAS;eAC1C,SAAS,iCAAiC,SAAS;eACnD,SAAS,2BAA2B,SAAS;CAC3D,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,aAAI,EACF,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,KAAK,SAAS,EACpC,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAA2B,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,SAAS;CACrB,CAAC,CACH,CACF,CACF,CAAA;AAdU,QAAA,QAAQ,YAclB"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { generator, toFile, when } from '@feathershq/pinion'
|
|
2
|
-
import { fileExists, renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
4
|
-
|
|
5
|
-
const template = ({
|
|
6
|
-
camelName,
|
|
7
|
-
upperName,
|
|
8
|
-
relative,
|
|
9
|
-
type,
|
|
10
|
-
cwd,
|
|
11
|
-
lib
|
|
12
|
-
}: ServiceGeneratorContext) => /* ts */ `// // For more information about this file see https://dove.feathersjs.com/guides/cli/service.schemas.html
|
|
13
|
-
import { resolve } from '@feathersjs/schema'
|
|
14
|
-
import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
|
|
15
|
-
import type { Static } from '@feathersjs/typebox'
|
|
16
|
-
|
|
17
|
-
import type { HookContext } from '${relative}/declarations'
|
|
18
|
-
import { dataValidator, queryValidator } from '${relative}/${
|
|
19
|
-
fileExists(cwd, lib, 'schemas') ? 'schemas/' : '' // This is for legacy backwards compatibility
|
|
20
|
-
}validators'
|
|
21
|
-
|
|
22
|
-
// Main data model schema
|
|
23
|
-
export const ${camelName}Schema = Type.Object({
|
|
24
|
-
${type === 'mongodb' ? '_id: Type.String()' : 'id: Type.Number()'},
|
|
25
|
-
text: Type.String()
|
|
26
|
-
}, { $id: '${upperName}', additionalProperties: false })
|
|
27
|
-
export type ${upperName} = Static<typeof ${camelName}Schema>
|
|
28
|
-
export const ${camelName}Resolver = resolve<${upperName}, HookContext>({})
|
|
29
|
-
|
|
30
|
-
export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({})
|
|
31
|
-
|
|
32
|
-
// Schema for creating new entries
|
|
33
|
-
export const ${camelName}DataSchema = Type.Pick(${camelName}Schema, ['text'], {
|
|
34
|
-
$id: '${upperName}Data'
|
|
35
|
-
})
|
|
36
|
-
export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
|
|
37
|
-
export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
|
|
38
|
-
export const ${camelName}DataResolver = resolve<${upperName}, HookContext>({})
|
|
39
|
-
|
|
40
|
-
// Schema for updating existing entries
|
|
41
|
-
export const ${camelName}PatchSchema = Type.Partial(${camelName}Schema, {
|
|
42
|
-
$id: '${upperName}Patch'
|
|
43
|
-
})
|
|
44
|
-
export type ${upperName}Patch = Static<typeof ${camelName}PatchSchema>
|
|
45
|
-
export const ${camelName}PatchValidator = getDataValidator(${camelName}PatchSchema, dataValidator)
|
|
46
|
-
export const ${camelName}PatchResolver = resolve<${upperName}, HookContext>({})
|
|
47
|
-
|
|
48
|
-
// Schema for allowed query properties
|
|
49
|
-
export const ${camelName}QueryProperties = Type.Pick(${camelName}Schema, [
|
|
50
|
-
'${type === 'mongodb' ? '_id' : 'id'}', 'text'
|
|
51
|
-
])
|
|
52
|
-
export const ${camelName}QuerySchema = Type.Intersect([
|
|
53
|
-
querySyntax(${camelName}QueryProperties),
|
|
54
|
-
// Add additional query properties here
|
|
55
|
-
Type.Object({}, { additionalProperties: false })
|
|
56
|
-
], { additionalProperties: false })
|
|
57
|
-
export type ${upperName}Query = Static<typeof ${camelName}QuerySchema>
|
|
58
|
-
export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
|
|
59
|
-
export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({})
|
|
60
|
-
`
|
|
61
|
-
|
|
62
|
-
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
63
|
-
generator(ctx).then(
|
|
64
|
-
when<ServiceGeneratorContext>(
|
|
65
|
-
({ schema }) => schema === 'typebox',
|
|
66
|
-
renderSource(
|
|
67
|
-
template,
|
|
68
|
-
toFile(({ lib, folder, fileName }: ServiceGeneratorContext) => [
|
|
69
|
-
lib,
|
|
70
|
-
'services',
|
|
71
|
-
...folder,
|
|
72
|
-
`${fileName}.schema`
|
|
73
|
-
])
|
|
74
|
-
)
|
|
75
|
-
)
|
|
76
|
-
)
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
2
|
-
export declare const template: ({ camelName, authentication, isEntityService, path, className, relative, schema, fileName }: ServiceGeneratorContext) => string;
|
|
3
|
-
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate = exports.template = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
6
|
-
const template = ({ camelName, authentication, isEntityService, path, className, relative, schema, fileName }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.html
|
|
7
|
-
${authentication || isEntityService ? `import { authenticate } from '@feathersjs/authentication'` : ''}
|
|
8
|
-
${schema
|
|
9
|
-
? `
|
|
10
|
-
import { hooks as schemaHooks } from '@feathersjs/schema'
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
${camelName}DataValidator,
|
|
14
|
-
${camelName}PatchValidator,
|
|
15
|
-
${camelName}QueryValidator,
|
|
16
|
-
${camelName}Resolver,
|
|
17
|
-
${camelName}ExternalResolver,
|
|
18
|
-
${camelName}DataResolver,
|
|
19
|
-
${camelName}PatchResolver,
|
|
20
|
-
${camelName}QueryResolver
|
|
21
|
-
} from './${fileName}.schema'
|
|
22
|
-
`
|
|
23
|
-
: ''}
|
|
24
|
-
|
|
25
|
-
import type { Application } from '${relative}/declarations'
|
|
26
|
-
import { ${className}, getOptions } from './${fileName}.class'
|
|
27
|
-
|
|
28
|
-
export * from './${fileName}.class'
|
|
29
|
-
${schema ? `export * from './${fileName}.schema'` : ''}
|
|
30
|
-
|
|
31
|
-
// A configure function that registers the service and its hooks via \`app.configure\`
|
|
32
|
-
export const ${camelName} = (app: Application) => {
|
|
33
|
-
// Register our service on the Feathers application
|
|
34
|
-
app.use('${path}', new ${className}(getOptions(app)), {
|
|
35
|
-
// A list of all methods this service exposes externally
|
|
36
|
-
methods: ['find', 'get', 'create', 'patch', 'remove'],
|
|
37
|
-
// You can add additional custom events to be sent to clients here
|
|
38
|
-
events: []
|
|
39
|
-
})
|
|
40
|
-
// Initialize hooks
|
|
41
|
-
app.service('${path}').hooks({
|
|
42
|
-
around: {
|
|
43
|
-
all: [${authentication
|
|
44
|
-
? `
|
|
45
|
-
authenticate('jwt'),`
|
|
46
|
-
: ''} ${schema
|
|
47
|
-
? `
|
|
48
|
-
schemaHooks.resolveExternal(${camelName}ExternalResolver),
|
|
49
|
-
schemaHooks.resolveResult(${camelName}Resolver),`
|
|
50
|
-
: ''}
|
|
51
|
-
],${isEntityService
|
|
52
|
-
? `
|
|
53
|
-
find: [authenticate('jwt')],
|
|
54
|
-
get: [authenticate('jwt')],
|
|
55
|
-
create: [],
|
|
56
|
-
update: [authenticate('jwt')],
|
|
57
|
-
patch: [authenticate('jwt')],
|
|
58
|
-
remove: [authenticate('jwt')]`
|
|
59
|
-
: ''}
|
|
60
|
-
},
|
|
61
|
-
before: {
|
|
62
|
-
all: [${schema
|
|
63
|
-
? `
|
|
64
|
-
schemaHooks.validateQuery(${camelName}QueryValidator),
|
|
65
|
-
schemaHooks.resolveQuery(${camelName}QueryResolver)
|
|
66
|
-
`
|
|
67
|
-
: ''}],
|
|
68
|
-
find: [],
|
|
69
|
-
get: [],
|
|
70
|
-
create: [${schema
|
|
71
|
-
? `
|
|
72
|
-
schemaHooks.validateData(${camelName}DataValidator),
|
|
73
|
-
schemaHooks.resolveData(${camelName}DataResolver)
|
|
74
|
-
`
|
|
75
|
-
: ''}],
|
|
76
|
-
patch: [${schema
|
|
77
|
-
? `
|
|
78
|
-
schemaHooks.validateData(${camelName}PatchValidator),
|
|
79
|
-
schemaHooks.resolveData(${camelName}PatchResolver)
|
|
80
|
-
`
|
|
81
|
-
: ''}],
|
|
82
|
-
remove: []
|
|
83
|
-
},
|
|
84
|
-
after: {
|
|
85
|
-
all: []
|
|
86
|
-
},
|
|
87
|
-
error: {
|
|
88
|
-
all: []
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Add this service to the service type index
|
|
94
|
-
declare module '${relative}/declarations' {
|
|
95
|
-
interface ServiceTypes {
|
|
96
|
-
'${path}': ${className}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`;
|
|
100
|
-
exports.template = template;
|
|
101
|
-
const toServiceIndex = (0, pinion_1.toFile)(({ lib }) => [lib, 'services', `index`]);
|
|
102
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx)
|
|
103
|
-
.then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, fileName, folder }) => [
|
|
104
|
-
lib,
|
|
105
|
-
'services',
|
|
106
|
-
...folder,
|
|
107
|
-
`${fileName}`
|
|
108
|
-
])))
|
|
109
|
-
.then((0, commons_1.injectSource)(({ camelName, folder, fileName }) => `import { ${camelName} } from './${folder.join('/')}/${fileName}'`, (0, pinion_1.prepend)(), toServiceIndex))
|
|
110
|
-
.then((0, commons_1.injectSource)(({ camelName }) => ` app.configure(${camelName})`, (0, pinion_1.after)('export const services'), toServiceIndex));
|
|
111
|
-
exports.generate = generate;
|
|
112
|
-
//# sourceMappingURL=service.tpl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/service.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsE;AACtE,2CAA0D;AAGnD,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,cAAc,EACd,eAAe,EACf,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;EACtC,cAAc,IAAI,eAAe,CAAC,CAAC,CAAC,2DAA2D,CAAC,CAAC,CAAC,EAAE;EAEpG,MAAM;IACJ,CAAC,CAAC;;;;IAIF,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;CACnB;IACG,CAAC,CAAC,EACN;;oCAEoC,QAAQ;WACjC,SAAS,0BAA0B,QAAQ;;mBAEnC,QAAQ;EACzB,MAAM,CAAC,CAAC,CAAC,oBAAoB,QAAQ,UAAU,CAAC,CAAC,CAAC,EAAE;;;eAGvC,SAAS;;aAEX,IAAI,UAAU,SAAS;;;;;;;iBAOnB,IAAI;;cAGb,cAAc;IACZ,CAAC,CAAC;6BACiB;IACnB,CAAC,CAAC,EACN,IACJ,MAAM;IACJ,CAAC,CAAC;sCACgC,SAAS;oCACX,SAAS,YAAY;IACrD,CAAC,CAAC,EACN;UAEQ,eAAe;IACb,CAAC,CAAC;;;;;;oCAMwB;IAC1B,CAAC,CAAC,EACN;;;cAIE,MAAM;IACJ,CAAC,CAAC;oCACwB,SAAS;mCACV,SAAS;OACrC;IACG,CAAC,CAAC,EACN;;;iBAIE,MAAM;IACJ,CAAC,CAAC;mCACuB,SAAS;kCACV,SAAS;OACpC;IACG,CAAC,CAAC,EACN;gBAEE,MAAM;IACJ,CAAC,CAAC;mCACuB,SAAS;kCACV,SAAS;OACpC;IACG,CAAC,CAAC,EACN;;;;;;;;;;;;;kBAaY,QAAQ;;OAEnB,IAAI,MAAM,SAAS;;;CAGzB,CAAA;AApHY,QAAA,QAAQ,YAoHpB;AAED,MAAM,cAAc,GAAG,IAAA,eAAM,EAAC,CAAC,EAAE,GAAG,EAA2B,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAA;AAExF,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,sBAAY,EACV,gBAAQ,EACR,IAAA,eAAM,EAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAA2B,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,EAAE;CACd,CAAC,CACH,CACF;KACA,IAAI,CACH,IAAA,sBAAY,EACV,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAClC,YAAY,SAAS,cAAc,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,GAAG,EACpE,IAAA,gBAAO,GAAE,EACT,cAAc,CACf,CACF;KACA,IAAI,CACH,IAAA,sBAAY,EACV,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,mBAAmB,SAAS,GAAG,EAClD,IAAA,cAAK,EAAC,uBAAuB,CAAC,EAC9B,cAAc,CACf,CACF,CAAA;AA3BQ,QAAA,QAAQ,YA2BhB"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { generator, toFile, after, prepend } from '@feathershq/pinion'
|
|
2
|
-
import { injectSource, renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
4
|
-
|
|
5
|
-
export const template = ({
|
|
6
|
-
camelName,
|
|
7
|
-
authentication,
|
|
8
|
-
isEntityService,
|
|
9
|
-
path,
|
|
10
|
-
className,
|
|
11
|
-
relative,
|
|
12
|
-
schema,
|
|
13
|
-
fileName
|
|
14
|
-
}: ServiceGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.html
|
|
15
|
-
${authentication || isEntityService ? `import { authenticate } from '@feathersjs/authentication'` : ''}
|
|
16
|
-
${
|
|
17
|
-
schema
|
|
18
|
-
? `
|
|
19
|
-
import { hooks as schemaHooks } from '@feathersjs/schema'
|
|
20
|
-
|
|
21
|
-
import {
|
|
22
|
-
${camelName}DataValidator,
|
|
23
|
-
${camelName}PatchValidator,
|
|
24
|
-
${camelName}QueryValidator,
|
|
25
|
-
${camelName}Resolver,
|
|
26
|
-
${camelName}ExternalResolver,
|
|
27
|
-
${camelName}DataResolver,
|
|
28
|
-
${camelName}PatchResolver,
|
|
29
|
-
${camelName}QueryResolver
|
|
30
|
-
} from './${fileName}.schema'
|
|
31
|
-
`
|
|
32
|
-
: ''
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
import type { Application } from '${relative}/declarations'
|
|
36
|
-
import { ${className}, getOptions } from './${fileName}.class'
|
|
37
|
-
|
|
38
|
-
export * from './${fileName}.class'
|
|
39
|
-
${schema ? `export * from './${fileName}.schema'` : ''}
|
|
40
|
-
|
|
41
|
-
// A configure function that registers the service and its hooks via \`app.configure\`
|
|
42
|
-
export const ${camelName} = (app: Application) => {
|
|
43
|
-
// Register our service on the Feathers application
|
|
44
|
-
app.use('${path}', new ${className}(getOptions(app)), {
|
|
45
|
-
// A list of all methods this service exposes externally
|
|
46
|
-
methods: ['find', 'get', 'create', 'patch', 'remove'],
|
|
47
|
-
// You can add additional custom events to be sent to clients here
|
|
48
|
-
events: []
|
|
49
|
-
})
|
|
50
|
-
// Initialize hooks
|
|
51
|
-
app.service('${path}').hooks({
|
|
52
|
-
around: {
|
|
53
|
-
all: [${
|
|
54
|
-
authentication
|
|
55
|
-
? `
|
|
56
|
-
authenticate('jwt'),`
|
|
57
|
-
: ''
|
|
58
|
-
} ${
|
|
59
|
-
schema
|
|
60
|
-
? `
|
|
61
|
-
schemaHooks.resolveExternal(${camelName}ExternalResolver),
|
|
62
|
-
schemaHooks.resolveResult(${camelName}Resolver),`
|
|
63
|
-
: ''
|
|
64
|
-
}
|
|
65
|
-
],${
|
|
66
|
-
isEntityService
|
|
67
|
-
? `
|
|
68
|
-
find: [authenticate('jwt')],
|
|
69
|
-
get: [authenticate('jwt')],
|
|
70
|
-
create: [],
|
|
71
|
-
update: [authenticate('jwt')],
|
|
72
|
-
patch: [authenticate('jwt')],
|
|
73
|
-
remove: [authenticate('jwt')]`
|
|
74
|
-
: ''
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
before: {
|
|
78
|
-
all: [${
|
|
79
|
-
schema
|
|
80
|
-
? `
|
|
81
|
-
schemaHooks.validateQuery(${camelName}QueryValidator),
|
|
82
|
-
schemaHooks.resolveQuery(${camelName}QueryResolver)
|
|
83
|
-
`
|
|
84
|
-
: ''
|
|
85
|
-
}],
|
|
86
|
-
find: [],
|
|
87
|
-
get: [],
|
|
88
|
-
create: [${
|
|
89
|
-
schema
|
|
90
|
-
? `
|
|
91
|
-
schemaHooks.validateData(${camelName}DataValidator),
|
|
92
|
-
schemaHooks.resolveData(${camelName}DataResolver)
|
|
93
|
-
`
|
|
94
|
-
: ''
|
|
95
|
-
}],
|
|
96
|
-
patch: [${
|
|
97
|
-
schema
|
|
98
|
-
? `
|
|
99
|
-
schemaHooks.validateData(${camelName}PatchValidator),
|
|
100
|
-
schemaHooks.resolveData(${camelName}PatchResolver)
|
|
101
|
-
`
|
|
102
|
-
: ''
|
|
103
|
-
}],
|
|
104
|
-
remove: []
|
|
105
|
-
},
|
|
106
|
-
after: {
|
|
107
|
-
all: []
|
|
108
|
-
},
|
|
109
|
-
error: {
|
|
110
|
-
all: []
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Add this service to the service type index
|
|
116
|
-
declare module '${relative}/declarations' {
|
|
117
|
-
interface ServiceTypes {
|
|
118
|
-
'${path}': ${className}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
`
|
|
122
|
-
|
|
123
|
-
const toServiceIndex = toFile(({ lib }: ServiceGeneratorContext) => [lib, 'services', `index`])
|
|
124
|
-
|
|
125
|
-
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
126
|
-
generator(ctx)
|
|
127
|
-
.then(
|
|
128
|
-
renderSource(
|
|
129
|
-
template,
|
|
130
|
-
toFile(({ lib, fileName, folder }: ServiceGeneratorContext) => [
|
|
131
|
-
lib,
|
|
132
|
-
'services',
|
|
133
|
-
...folder,
|
|
134
|
-
`${fileName}`
|
|
135
|
-
])
|
|
136
|
-
)
|
|
137
|
-
)
|
|
138
|
-
.then(
|
|
139
|
-
injectSource<ServiceGeneratorContext>(
|
|
140
|
-
({ camelName, folder, fileName }) =>
|
|
141
|
-
`import { ${camelName} } from './${folder.join('/')}/${fileName}'`,
|
|
142
|
-
prepend(),
|
|
143
|
-
toServiceIndex
|
|
144
|
-
)
|
|
145
|
-
)
|
|
146
|
-
.then(
|
|
147
|
-
injectSource<ServiceGeneratorContext>(
|
|
148
|
-
({ camelName }) => ` app.configure(${camelName})`,
|
|
149
|
-
after('export const services'),
|
|
150
|
-
toServiceIndex
|
|
151
|
-
)
|
|
152
|
-
)
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
6
|
-
const template = ({ relative, lib, path }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.test.html
|
|
7
|
-
import assert from 'assert'
|
|
8
|
-
import { app } from '../${relative}/${lib}/app'
|
|
9
|
-
|
|
10
|
-
describe('${path} service', () => {
|
|
11
|
-
it('registered the service', () => {
|
|
12
|
-
const service = app.service('${path}')
|
|
13
|
-
|
|
14
|
-
assert.ok(service, 'Registered the service')
|
|
15
|
-
})
|
|
16
|
-
})
|
|
17
|
-
`;
|
|
18
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test, folder, fileName }) => [
|
|
19
|
-
test,
|
|
20
|
-
'services',
|
|
21
|
-
...folder,
|
|
22
|
-
`${fileName}.test`
|
|
23
|
-
])));
|
|
24
|
-
exports.generate = generate;
|
|
25
|
-
//# sourceMappingURL=test.tpl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,QAAQ,EACR,GAAG,EACH,IAAI,EACoB,EAAE,EAAE,CAAC,QAAQ,CAAC;;0BAEd,QAAQ,IAAI,GAAG;;YAE7B,IAAI;;mCAEmB,IAAI;;;;;CAKtC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAA0B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC9D,IAAI;IACJ,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,OAAO;CACnB,CAAC,CACH,CACF,CAAA;AAXU,QAAA,QAAQ,YAWlB"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { generator, toFile } from '@feathershq/pinion'
|
|
2
|
-
import { renderSource } from '../../commons'
|
|
3
|
-
import { ServiceGeneratorContext } from '../index'
|
|
4
|
-
|
|
5
|
-
const template = ({
|
|
6
|
-
relative,
|
|
7
|
-
lib,
|
|
8
|
-
path
|
|
9
|
-
}: ServiceGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.test.html
|
|
10
|
-
import assert from 'assert'
|
|
11
|
-
import { app } from '../${relative}/${lib}/app'
|
|
12
|
-
|
|
13
|
-
describe('${path} service', () => {
|
|
14
|
-
it('registered the service', () => {
|
|
15
|
-
const service = app.service('${path}')
|
|
16
|
-
|
|
17
|
-
assert.ok(service, 'Registered the service')
|
|
18
|
-
})
|
|
19
|
-
})
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
export const generate = (ctx: ServiceGeneratorContext) =>
|
|
23
|
-
generator(ctx).then(
|
|
24
|
-
renderSource(
|
|
25
|
-
template,
|
|
26
|
-
toFile<ServiceGeneratorContext>(({ test, folder, fileName }) => [
|
|
27
|
-
test,
|
|
28
|
-
'services',
|
|
29
|
-
...folder,
|
|
30
|
-
`${fileName}.test`
|
|
31
|
-
])
|
|
32
|
-
)
|
|
33
|
-
)
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ServiceGeneratorContext } from '../index';
|
|
2
|
-
export declare const template: ({ className, upperName, schema, fileName, relative }: ServiceGeneratorContext) => string;
|
|
3
|
-
export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generate = exports.template = void 0;
|
|
4
|
-
const pinion_1 = require("@feathershq/pinion");
|
|
5
|
-
const commons_1 = require("../../commons");
|
|
6
|
-
const template = ({ className, upperName, schema, fileName, relative }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/service.class.html#custom-services
|
|
7
|
-
import type { Id, NullableId, Params, ServiceInterface } from '@feathersjs/feathers'
|
|
8
|
-
|
|
9
|
-
import type { Application } from '${relative}/declarations'
|
|
10
|
-
${schema
|
|
11
|
-
? `import type {
|
|
12
|
-
${upperName},
|
|
13
|
-
${upperName}Data,
|
|
14
|
-
${upperName}Patch,
|
|
15
|
-
${upperName}Query
|
|
16
|
-
} from './${fileName}.schema'
|
|
17
|
-
`
|
|
18
|
-
: `
|
|
19
|
-
export type ${upperName} = any
|
|
20
|
-
export type ${upperName}Data = any
|
|
21
|
-
export type ${upperName}Patch = any
|
|
22
|
-
export type ${upperName}Query = any
|
|
23
|
-
`}
|
|
24
|
-
|
|
25
|
-
export interface ${className}Options {
|
|
26
|
-
app: Application
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ${upperName}Params extends Params<${upperName}Query> {
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// This is a skeleton for a custom service class. Remove or add the methods you need here
|
|
34
|
-
export class ${className} implements ServiceInterface<${upperName}, ${upperName}Data, ${upperName}Params, ${upperName}Patch> {
|
|
35
|
-
constructor (public options: ${className}Options) {
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async find (_params?: ${upperName}Params): Promise<${upperName}[]> {
|
|
39
|
-
return []
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async get (id: Id, _params?: ${upperName}Params): Promise<${upperName}> {
|
|
43
|
-
return {
|
|
44
|
-
id: 0,
|
|
45
|
-
text: \`A new message with ID: \${id}!\`
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async create (data: ${upperName}Data, params?: ${upperName}Params): Promise<${upperName}>
|
|
50
|
-
async create (data: ${upperName}Data[], params?: ${upperName}Params): Promise<${upperName}[]>
|
|
51
|
-
async create (data: ${upperName}Data|${upperName}Data[], params?: ${upperName}Params): Promise<${upperName}|${upperName}[]> {
|
|
52
|
-
if (Array.isArray(data)) {
|
|
53
|
-
return Promise.all(data.map(current => this.create(current, params)));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
id: 0,
|
|
58
|
-
...data
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// This method has to be added to the 'methods' option to make it available to clients
|
|
63
|
-
async update (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}> {
|
|
64
|
-
return {
|
|
65
|
-
id: 0,
|
|
66
|
-
...data
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async patch (id: NullableId, data: ${upperName}Patch, _params?: ${upperName}Params): Promise<${upperName}> {
|
|
71
|
-
return {
|
|
72
|
-
id: 0,
|
|
73
|
-
text: \`Fallback for \${id}\`,
|
|
74
|
-
...data
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async remove (id: NullableId, _params?: ${upperName}Params): Promise<${upperName}> {
|
|
79
|
-
return {
|
|
80
|
-
id: 0,
|
|
81
|
-
text: 'removed'
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export const getOptions = (app: Application) => {
|
|
87
|
-
return { app }
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
exports.template = template;
|
|
91
|
-
const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
|
|
92
|
-
lib,
|
|
93
|
-
'services',
|
|
94
|
-
...folder,
|
|
95
|
-
`${fileName}.class`
|
|
96
|
-
])));
|
|
97
|
-
exports.generate = generate;
|
|
98
|
-
//# sourceMappingURL=custom.tpl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"custom.tpl.js","sourceRoot":"","sources":["../../../src/service/type/custom.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAGrC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,EACR,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;oCAGJ,QAAQ;EAE1C,MAAM;IACJ,CAAC,CAAC;IACF,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;CACnB;IACG,CAAC,CAAC;cACQ,SAAS;cACT,SAAS;cACT,SAAS;cACT,SAAS;CAEvB;;mBAEmB,SAAS;;;;mBAIT,SAAS,yBAAyB,SAAS;;;;;eAK/C,SAAS,gCAAgC,SAAS,KAAK,SAAS,SAAS,SAAS,WAAW,SAAS;iCACpF,SAAS;;;0BAGhB,SAAS,oBAAoB,SAAS;;;;iCAI/B,SAAS,oBAAoB,SAAS;;;;;;;wBAO/C,SAAS,kBAAkB,SAAS,oBAAoB,SAAS;wBACjE,SAAS,oBAAoB,SAAS,oBAAoB,SAAS;wBACnE,SAAS,QAAQ,SAAS,oBAAoB,SAAS,oBAAoB,SAAS,IAAI,SAAS;;;;;;;;;;;;wCAYjF,SAAS,mBAAmB,SAAS,oBAAoB,SAAS;;;;;;;uCAOnE,SAAS,oBAAoB,SAAS,oBAAoB,SAAS;;;;;;;;4CAQ9D,SAAS,oBAAoB,SAAS;;;;;;;;;;;CAWjF,CAAA;AA3FY,QAAA,QAAQ,YA2FpB;AAEM,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,gBAAQ,EACR,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC7D,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,QAAQ;CACpB,CAAC,CACH,CACF,CAAA;AAXU,QAAA,QAAQ,YAWlB"}
|