@feathersjs/cli 5.0.0-pre.26 → 5.0.0-pre.27

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/app/index.js +1 -1
  3. package/lib/app/index.js.map +1 -1
  4. package/lib/app/index.ts +1 -1
  5. package/lib/app/templates/app.tpl.js +2 -2
  6. package/lib/app/templates/app.tpl.ts +2 -2
  7. package/lib/app/templates/client.tpl.js +1 -1
  8. package/lib/app/templates/client.tpl.ts +1 -1
  9. package/lib/app/templates/configuration.tpl.js +23 -20
  10. package/lib/app/templates/configuration.tpl.js.map +1 -1
  11. package/lib/app/templates/configuration.tpl.ts +23 -20
  12. package/lib/app/templates/declarations.tpl.js +1 -1
  13. package/lib/app/templates/declarations.tpl.ts +1 -1
  14. package/lib/app/templates/package.json.tpl.js +2 -0
  15. package/lib/app/templates/package.json.tpl.js.map +1 -1
  16. package/lib/app/templates/package.json.tpl.ts +2 -0
  17. package/lib/app/templates/prettierrc.tpl.d.ts +2 -0
  18. package/lib/app/templates/prettierrc.tpl.js +11 -0
  19. package/lib/app/templates/prettierrc.tpl.js.map +1 -0
  20. package/lib/app/templates/prettierrc.tpl.ts +14 -0
  21. package/lib/authentication/index.d.ts +0 -2
  22. package/lib/authentication/templates/authentication.tpl.js +3 -3
  23. package/lib/authentication/templates/authentication.tpl.js.map +1 -1
  24. package/lib/authentication/templates/authentication.tpl.ts +5 -5
  25. package/lib/authentication/templates/declarations.tpl.js +1 -1
  26. package/lib/authentication/templates/declarations.tpl.js.map +1 -1
  27. package/lib/authentication/templates/declarations.tpl.ts +2 -2
  28. package/lib/authentication/templates/knex.tpl.js +6 -5
  29. package/lib/authentication/templates/knex.tpl.js.map +1 -1
  30. package/lib/authentication/templates/knex.tpl.ts +16 -17
  31. package/lib/authentication/templates/test.tpl.js +2 -2
  32. package/lib/authentication/templates/test.tpl.js.map +1 -1
  33. package/lib/authentication/templates/test.tpl.ts +2 -2
  34. package/lib/authentication/templates/user.resolver.tpl.js +6 -6
  35. package/lib/authentication/templates/user.resolver.tpl.js.map +1 -1
  36. package/lib/authentication/templates/user.resolver.tpl.ts +6 -6
  37. package/lib/authentication/templates/user.schema.tpl.js +7 -13
  38. package/lib/authentication/templates/user.schema.tpl.js.map +1 -1
  39. package/lib/authentication/templates/user.schema.tpl.ts +7 -13
  40. package/lib/commons.d.ts +19 -9
  41. package/lib/commons.js +56 -23
  42. package/lib/commons.js.map +1 -1
  43. package/lib/commons.ts +87 -26
  44. package/lib/connection/templates/knex.tpl.js +13 -16
  45. package/lib/connection/templates/knex.tpl.js.map +1 -1
  46. package/lib/connection/templates/knex.tpl.ts +18 -20
  47. package/lib/connection/templates/mongodb.tpl.js +5 -9
  48. package/lib/connection/templates/mongodb.tpl.js.map +1 -1
  49. package/lib/connection/templates/mongodb.tpl.ts +10 -12
  50. package/lib/index.js +2 -1
  51. package/lib/index.js.map +1 -1
  52. package/lib/index.ts +2 -1
  53. package/lib/service/index.d.ts +0 -16
  54. package/lib/service/index.js +3 -8
  55. package/lib/service/index.js.map +1 -1
  56. package/lib/service/index.ts +3 -16
  57. package/lib/service/templates/class.tpl.d.ts +2 -0
  58. package/lib/service/templates/class.tpl.js +63 -0
  59. package/lib/service/templates/class.tpl.js.map +1 -0
  60. package/lib/service/templates/class.tpl.ts +79 -0
  61. package/lib/service/templates/client.tpl.js +4 -6
  62. package/lib/service/templates/client.tpl.js.map +1 -1
  63. package/lib/service/templates/client.tpl.ts +10 -15
  64. package/lib/service/templates/resolver.tpl.js +4 -4
  65. package/lib/service/templates/resolver.tpl.js.map +1 -1
  66. package/lib/service/templates/resolver.tpl.ts +4 -4
  67. package/lib/service/templates/schema.tpl.js +2 -2
  68. package/lib/service/templates/schema.tpl.js.map +1 -1
  69. package/lib/service/templates/schema.tpl.ts +2 -2
  70. package/lib/service/templates/service.tpl.js +12 -58
  71. package/lib/service/templates/service.tpl.js.map +1 -1
  72. package/lib/service/templates/service.tpl.ts +17 -79
  73. package/lib/service/templates/test.tpl.js +4 -4
  74. package/lib/service/templates/test.tpl.js.map +1 -1
  75. package/lib/service/templates/test.tpl.ts +4 -4
  76. package/lib/service/type/custom.tpl.d.ts +1 -1
  77. package/lib/service/type/custom.tpl.js +24 -16
  78. package/lib/service/type/custom.tpl.js.map +1 -1
  79. package/lib/service/type/custom.tpl.ts +28 -19
  80. package/lib/service/type/knex.tpl.js +11 -5
  81. package/lib/service/type/knex.tpl.js.map +1 -1
  82. package/lib/service/type/knex.tpl.ts +14 -9
  83. package/lib/service/type/mongodb.tpl.js +11 -5
  84. package/lib/service/type/mongodb.tpl.js.map +1 -1
  85. package/lib/service/type/mongodb.tpl.ts +14 -9
  86. package/package.json +19 -19
@@ -1,74 +1,11 @@
1
- import { generator, inject, prepend, toFile, after } from '@feathershq/pinion'
2
- import { getSource, renderSource } from '../../commons'
1
+ import { generator, prepend, toFile, after } from '@feathershq/pinion'
2
+ import { injectSource, renderSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
- const template = ({
6
- relative,
7
- path,
8
- className,
9
- schemaPath,
10
- resolverPath,
11
- camelName,
12
- upperName,
13
- isEntityService,
14
- authentication
15
- }: ServiceGeneratorContext) =>
16
- `import { resolveAll } from '@feathersjs/schema'
17
- ${isEntityService || authentication ? `import { authenticate } from '@feathersjs/authentication'` : ''}
18
- import type { Application } from '${relative}/declarations'
19
- import type {
20
- ${upperName}Data,
21
- ${upperName}Result,
22
- ${upperName}Query,
23
- } from '${relative}/${schemaPath}'
24
- import { ${camelName}Resolvers } from '${relative}/${resolverPath}'
5
+ const template = ({ relative, path, className, camelName, fileName }: ServiceGeneratorContext) =>
6
+ `import type { Application } from '${relative}/declarations'
25
7
 
26
- export const hooks = {
27
- around: {
28
- all: [${
29
- authentication
30
- ? `
31
- authenticate('jwt'),`
32
- : ''
33
- } ${
34
- !isEntityService
35
- ? `
36
- resolveAll(${camelName}Resolvers)`
37
- : ''
38
- }
39
- ]${
40
- isEntityService
41
- ? `,
42
- get: [
43
- authenticate('jwt'),
44
- resolveAll(${camelName}Resolvers)
45
- ],
46
- find: [
47
- authenticate('jwt'),
48
- resolveAll(${camelName}Resolvers)
49
- ],
50
- create: [
51
- resolveAll(${camelName}Resolvers)
52
- ],
53
- patch: [
54
- authenticate('jwt'),
55
- resolveAll(${camelName}Resolvers)
56
- ],
57
- update: [
58
- authenticate('jwt'),
59
- resolveAll(${camelName}Resolvers)
60
- ],
61
- remove: [
62
- authenticate('jwt'),
63
- resolveAll(${camelName}Resolvers)
64
- ]`
65
- : ''
66
- }
67
- },
68
- before: {},
69
- after: {},
70
- error: {}
71
- }
8
+ import { ${className}, ${camelName}Hooks } from './${fileName}.class'
72
9
 
73
10
  // A configure function that registers the service and its hooks via \`app.configure\`
74
11
  export function ${camelName} (app: Application) {
@@ -83,7 +20,7 @@ export function ${camelName} (app: Application) {
83
20
  events: []
84
21
  })
85
22
  // Initialize hooks
86
- app.service('${path}').hooks(hooks)
23
+ app.service('${path}').hooks(${camelName}Hooks)
87
24
  }
88
25
 
89
26
  // Add this service to the service type index
@@ -94,24 +31,25 @@ declare module '${relative}/declarations' {
94
31
  }
95
32
  `
96
33
 
97
- const importTemplate = ({ camelName, path }: ServiceGeneratorContext) =>
98
- `import { ${camelName} } from './${path}'`
34
+ const importTemplate = ({ camelName, folder, fileName }: ServiceGeneratorContext) =>
35
+ `import { ${camelName} } from './${folder.join('/')}/${fileName}.service'`
99
36
 
100
37
  const configureTemplate = ({ camelName }: ServiceGeneratorContext) => ` app.configure(${camelName})`
101
38
 
102
- const toServiceIndex = toFile(({ lib, language }: ServiceGeneratorContext) => [
103
- lib,
104
- 'services',
105
- `index.${language}`
106
- ])
39
+ const toServiceIndex = toFile(({ lib }: ServiceGeneratorContext) => [lib, 'services', `index`])
107
40
 
108
41
  export const generate = (ctx: ServiceGeneratorContext) =>
109
42
  generator(ctx)
110
43
  .then(
111
44
  renderSource(
112
45
  template,
113
- toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [lib, 'services', ...folder, fileName])
46
+ toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
47
+ lib,
48
+ 'services',
49
+ ...folder,
50
+ `${fileName}.service`
51
+ ])
114
52
  )
115
53
  )
116
- .then(inject(getSource(importTemplate), prepend(), toServiceIndex))
117
- .then(inject(configureTemplate, after('export const services'), toServiceIndex))
54
+ .then(injectSource(importTemplate, prepend(), toServiceIndex))
55
+ .then(injectSource(configureTemplate, after('export const services'), toServiceIndex))
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const template = ({ relative, lib, path, name }) => `import assert from 'assert'
6
+ const template = ({ relative, lib, path }) => `import assert from 'assert'
7
7
  import { app } from '../${relative}/${lib}/app'
8
8
 
9
- describe('${name} service', () => {
9
+ describe('${path} service', () => {
10
10
  it('registered the service', () => {
11
11
  const service = app.service('${path}')
12
12
 
@@ -14,11 +14,11 @@ describe('${name} service', () => {
14
14
  })
15
15
  })
16
16
  `;
17
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test, folder, kebabName }) => [
17
+ const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test, folder, fileName }) => [
18
18
  test,
19
19
  'services',
20
20
  ...folder,
21
- `${kebabName}.test`
21
+ `${fileName}.test`
22
22
  ])));
23
23
  exports.generate = generate;
24
24
  //# sourceMappingURL=test.tpl.js.map
@@ -1 +1 @@
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,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAA2B,EAAE,EAAE,CAC1E;0BACwB,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,SAAS,EAAE,EAAE,EAAE,CAAC;IAC/D,IAAI;IACJ,UAAU;IACV,GAAG,MAAM;IACT,GAAG,SAAS,OAAO;CACpB,CAAC,CACH,CACF,CAAA;AAXU,QAAA,QAAQ,YAWlB"}
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,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAA2B,EAAE,EAAE,CACpE;0BACwB,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"}
@@ -2,11 +2,11 @@ import { generator, toFile } from '@feathershq/pinion'
2
2
  import { renderSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
- const template = ({ relative, lib, path, name }: ServiceGeneratorContext) =>
5
+ const template = ({ relative, lib, path }: ServiceGeneratorContext) =>
6
6
  `import assert from 'assert'
7
7
  import { app } from '../${relative}/${lib}/app'
8
8
 
9
- describe('${name} service', () => {
9
+ describe('${path} service', () => {
10
10
  it('registered the service', () => {
11
11
  const service = app.service('${path}')
12
12
 
@@ -19,11 +19,11 @@ export const generate = (ctx: ServiceGeneratorContext) =>
19
19
  generator(ctx).then(
20
20
  renderSource(
21
21
  template,
22
- toFile<ServiceGeneratorContext>(({ test, folder, kebabName }) => [
22
+ toFile<ServiceGeneratorContext>(({ test, folder, fileName }) => [
23
23
  test,
24
24
  'services',
25
25
  ...folder,
26
- `${kebabName}.test`
26
+ `${fileName}.test`
27
27
  ])
28
28
  )
29
29
  )
@@ -1,4 +1,4 @@
1
1
  import { ServiceGeneratorContext } from '../index';
2
- export declare const template: ({ className, upperName }: ServiceGeneratorContext) => string;
2
+ export declare const template: ({ className, upperName, relative }: ServiceGeneratorContext) => string;
3
3
  export declare const importTemplate = "import type { Id, NullableId, Params } from '@feathersjs/feathers'";
4
4
  export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = exports.importTemplate = exports.template = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const template = ({ className, upperName }) => `export interface ${className}Options {
6
+ const template = ({ className, upperName, relative }) => `import type { Application } from '${relative}/declarations'
7
+
8
+ export interface ${className}Options {
7
9
  app: Application
8
10
  }
9
11
 
@@ -22,9 +24,9 @@ export class ${className} {
22
24
 
23
25
  async get (id: Id, _params?: ${upperName}Params): Promise<${upperName}Result> {
24
26
  return {
25
- id: \`\${id}\`,
27
+ id: 0,
26
28
  text: \`A new message with ID: \${id}!\`
27
- };
29
+ }
28
30
  }
29
31
 
30
32
  async create (data: ${upperName}Data, params?: ${upperName}Params): Promise<${upperName}Result>
@@ -35,45 +37,51 @@ export class ${className} {
35
37
  }
36
38
 
37
39
  return {
38
- id: 'created',
40
+ id: 0,
39
41
  ...data
40
- };
42
+ }
41
43
  }
42
44
 
43
45
  async update (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}Result> {
44
46
  return {
45
- id: \`\${id}\`,
47
+ id: 0,
46
48
  ...data
47
- };
49
+ }
48
50
  }
49
51
 
50
52
  async patch (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}Result> {
51
53
  return {
52
- id: \`\${id}\`,
54
+ id: 0,
53
55
  ...data
54
- };
56
+ }
55
57
  }
56
58
 
57
59
  async remove (id: NullableId, _params?: ${upperName}Params): Promise<${upperName}Result> {
58
60
  return {
59
- id: \`\${id}\`,
61
+ id: 0,
60
62
  text: 'removed'
61
- };
63
+ }
62
64
  }
63
65
  }
64
66
  `;
65
67
  exports.template = template;
66
68
  exports.importTemplate = "import type { Id, NullableId, Params } from '@feathersjs/feathers'";
67
69
  const optionTemplate = ({}) => ` app`;
68
- const toServiceFile = (0, pinion_1.toFile)(({ lib, language, folder, fileName }) => [
70
+ const toServiceFile = (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
71
+ lib,
72
+ 'services',
73
+ ...folder,
74
+ `${fileName}.service`
75
+ ]);
76
+ const toClassFile = (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
69
77
  lib,
70
78
  'services',
71
79
  ...folder,
72
- `${fileName}.${language}`
80
+ `${fileName}.class`
73
81
  ]);
74
82
  const generate = (ctx) => (0, pinion_1.generator)(ctx)
75
- .then((0, pinion_1.inject)((0, commons_1.getSource)(exports.template), (0, pinion_1.before)('export const hooks ='), toServiceFile))
76
- .then((0, pinion_1.inject)((0, commons_1.getSource)(exports.importTemplate), (0, pinion_1.prepend)(), toServiceFile))
77
- .then((0, pinion_1.inject)(optionTemplate, (0, pinion_1.after)('const options ='), toServiceFile));
83
+ .then((0, commons_1.injectSource)(exports.template, (0, pinion_1.append)(), toClassFile))
84
+ .then((0, commons_1.injectSource)(exports.importTemplate, (0, pinion_1.prepend)(), toClassFile))
85
+ .then((0, commons_1.injectSource)(optionTemplate, (0, pinion_1.after)('const options ='), toServiceFile, false));
78
86
  exports.generate = generate;
79
87
  //# sourceMappingURL=custom.tpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom.tpl.js","sourceRoot":"","sources":["../../../src/service/type/custom.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsF;AACtF,2CAAyC;AAGlC,MAAM,QAAQ,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAA2B,EAAE,EAAE,CAC5E,oBAAoB,SAAS;;;;mBAIZ,SAAS,yBAAyB,SAAS;;;;;eAK/C,SAAS;iCACS,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,UAAU,SAAS;;;;;;;;;;;wCAWvF,SAAS,mBAAmB,SAAS,oBAAoB,SAAS;;;;;;;uCAOnE,SAAS,mBAAmB,SAAS,oBAAoB,SAAS;;;;;;;4CAO7D,SAAS,oBAAoB,SAAS;;;;;;;CAOjF,CAAA;AA3DY,QAAA,QAAQ,YA2DpB;AAEY,QAAA,cAAc,GAAG,oEAAoE,CAAA;AAElG,MAAM,cAAc,GAAG,CAAC,EAA2B,EAAE,EAAE,CAAC,SAAS,CAAA;AAEjE,MAAM,aAAa,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC7F,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,IAAI,QAAQ,EAAE;CAC1B,CAAC,CAAA;AAEK,MAAM,QAAQ,GAAG,CAAC,G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EAA2B,EAAE,EAAE,CAAC,SAAS,CAAA;AAEjE,MAAM,aAAa,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACnF,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,UAAU;CACtB,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACjF,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,QAAQ;CACpB,CAAC,CAAA;AAEK,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,sBAAY,EAAC,gBAAQ,EAAE,IAAA,eAAM,GAAE,EAAE,WAAW,CAAC,CAAC;KACnD,IAAI,CAAC,IAAA,sBAAY,EAAC,sBAAc,EAAE,IAAA,gBAAO,GAAE,EAAE,WAAW,CAAC,CAAC;KAC1D,IAAI,CAAC,IAAA,sBAAY,EAAC,cAAc,EAAE,IAAA,cAAK,EAAC,iBAAiB,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAA;AAJ1E,QAAA,QAAQ,YAIkE"}
@@ -1,9 +1,11 @@
1
- import { generator, inject, toFile, after, before, prepend } from '@feathershq/pinion'
2
- import { getSource } from '../../commons'
1
+ import { generator, toFile, after, prepend, append } from '@feathershq/pinion'
2
+ import { injectSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
- export const template = ({ className, upperName }: ServiceGeneratorContext) =>
6
- `export interface ${className}Options {
5
+ export const template = ({ className, upperName, relative }: ServiceGeneratorContext) =>
6
+ `import type { Application } from '${relative}/declarations'
7
+
8
+ export interface ${className}Options {
7
9
  app: Application
8
10
  }
9
11
 
@@ -22,9 +24,9 @@ export class ${className} {
22
24
 
23
25
  async get (id: Id, _params?: ${upperName}Params): Promise<${upperName}Result> {
24
26
  return {
25
- id: \`\${id}\`,
27
+ id: 0,
26
28
  text: \`A new message with ID: \${id}!\`
27
- };
29
+ }
28
30
  }
29
31
 
30
32
  async create (data: ${upperName}Data, params?: ${upperName}Params): Promise<${upperName}Result>
@@ -35,30 +37,30 @@ export class ${className} {
35
37
  }
36
38
 
37
39
  return {
38
- id: 'created',
40
+ id: 0,
39
41
  ...data
40
- };
42
+ }
41
43
  }
42
44
 
43
45
  async update (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}Result> {
44
46
  return {
45
- id: \`\${id}\`,
47
+ id: 0,
46
48
  ...data
47
- };
49
+ }
48
50
  }
49
51
 
50
52
  async patch (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}Result> {
51
53
  return {
52
- id: \`\${id}\`,
54
+ id: 0,
53
55
  ...data
54
- };
56
+ }
55
57
  }
56
58
 
57
59
  async remove (id: NullableId, _params?: ${upperName}Params): Promise<${upperName}Result> {
58
60
  return {
59
- id: \`\${id}\`,
61
+ id: 0,
60
62
  text: 'removed'
61
- };
63
+ }
62
64
  }
63
65
  }
64
66
  `
@@ -67,15 +69,22 @@ export const importTemplate = "import type { Id, NullableId, Params } from '@fea
67
69
 
68
70
  const optionTemplate = ({}: ServiceGeneratorContext) => ` app`
69
71
 
70
- const toServiceFile = toFile<ServiceGeneratorContext>(({ lib, language, folder, fileName }) => [
72
+ const toServiceFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
73
+ lib,
74
+ 'services',
75
+ ...folder,
76
+ `${fileName}.service`
77
+ ])
78
+
79
+ const toClassFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
71
80
  lib,
72
81
  'services',
73
82
  ...folder,
74
- `${fileName}.${language}`
83
+ `${fileName}.class`
75
84
  ])
76
85
 
77
86
  export const generate = (ctx: ServiceGeneratorContext) =>
78
87
  generator(ctx)
79
- .then(inject(getSource(template), before<ServiceGeneratorContext>('export const hooks ='), toServiceFile))
80
- .then(inject(getSource(importTemplate), prepend(), toServiceFile))
81
- .then(inject(optionTemplate, after('const options ='), toServiceFile))
88
+ .then(injectSource(template, append(), toClassFile))
89
+ .then(injectSource(importTemplate, prepend(), toClassFile))
90
+ .then(injectSource(optionTemplate, after('const options ='), toServiceFile, false))
@@ -30,16 +30,22 @@ const optionTemplate = ({ kebabName, feathers }) => ` paginate: app.get('pagi
30
30
  Model: app.get('${feathers.database}Client'),
31
31
  name: '${kebabName}'`;
32
32
  exports.optionTemplate = optionTemplate;
33
- const toServiceFile = (0, pinion_1.toFile)(({ lib, folder, fileName, language }) => [
33
+ const toServiceFile = (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
34
34
  lib,
35
35
  'services',
36
36
  ...folder,
37
- `${fileName}.${language}`
37
+ `${fileName}.service`
38
+ ]);
39
+ const toClassFile = (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
40
+ lib,
41
+ 'services',
42
+ ...folder,
43
+ `${fileName}.class`
38
44
  ]);
39
45
  const generate = (ctx) => (0, pinion_1.generator)(ctx)
40
- .then((0, pinion_1.inject)((0, commons_1.getSource)(exports.classCode), (0, pinion_1.before)('export const hooks ='), toServiceFile))
41
- .then((0, pinion_1.inject)((0, commons_1.getSource)(exports.importTemplate), (0, pinion_1.prepend)(), toServiceFile))
42
- .then((0, pinion_1.inject)(exports.optionTemplate, (0, pinion_1.after)('const options ='), toServiceFile))
46
+ .then((0, commons_1.injectSource)(exports.classCode, (0, pinion_1.append)(), toClassFile))
47
+ .then((0, commons_1.injectSource)(exports.importTemplate, (0, pinion_1.prepend)(), toClassFile))
48
+ .then((0, commons_1.injectSource)(exports.optionTemplate, (0, pinion_1.after)('const options ='), toServiceFile, false))
43
49
  .then((0, commons_1.renderSource)(migrationTemplate, (0, pinion_1.toFile)('migrations', ({ kebabName }) => {
44
50
  // Probably not great but it works to align with the Knex migration file format
45
51
  const migrationDate = new Date().toISOString().replace(/\D/g, '').substring(0, 14);
@@ -1 +1 @@
1
- {"version":3,"file":"knex.tpl.js","sourceRoot":"","sources":["../../../src/service/type/knex.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsF;AACtF,2CAAuD;AAGvD,MAAM,iBAAiB,GAAG,CAAC,EAAE,SAAS,EAA2B,EAAE,EAAE,CAAC;;;mCAGnC,SAAS;;;;;;;iCAOX,SAAS;;CAEzC,CAAA;AAEY,QAAA,cAAc,GAAG;4DAC8B,CAAA;AAErD,MAAM,SAAS,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAA2B,EAAE,EAAE,CAC7E,oBAAoB,SAAS,oCAAoC,SAAS;;;;eAI7D,SAAS,wBAAwB,SAAS,WAAW,SAAS,SAAS,SAAS;;CAE9F,CAAA;AAPY,QAAA,SAAS,aAOrB;AAEM,MAAM,cAAc,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAA2B,EAAE,EAAE,CACjF;sBACoB,QAAQ,CAAC,QAAQ;aAC1B,SAAS,GAAG,CAAA;AAHZ,QAAA,cAAc,kBAGF;AAEzB,MAAM,aAAa,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC7F,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,IAAI,QAAQ,EAAE;CAC1B,CAAC,CAAA;AAEK,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,IAAA,eAAM,EAAC,IAAA,mBAAS,EAAC,iBAAS,CAAC,EAAE,IAAA,eAAM,EAA0B,sBAAsB,CAAC,EAAE,aAAa,CAAC,CACrG;KACA,IAAI,CAAC,IAAA,eAAM,EAAC,IAAA,mBAAS,EAAC,sBAAc,CAAC,EAAE,IAAA,gBAAO,GAAE,E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E,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACnF,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,UAAU;CACtB,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACjF,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,QAAQ;CACpB,CAAC,CAAA;AAEK,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,sBAAY,EAAC,iBAAS,EAAE,IAAA,eAAM,GAAE,EAAE,WAAW,CAAC,CAAC;KACpD,IAAI,CAAC,IAAA,sBAAY,EAAC,sBAAc,EAAE,IAAA,gBAAO,GAAE,EAAE,WAAW,CAAC,CAAC;KAC1D,IAAI,CAAC,IAAA,sBAAY,EAAC,sBAAc,EAAE,IAAA,cAAK,EAAC,iBAAiB,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;KAClF,IAAI,CACH,IAAA,sBAAY,EACV,iBAAiB,EACjB,IAAA,eAAM,EAA0B,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IAC9D,+EAA+E;IAC/E,MAAM,aAAa,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAElF,OAAO,GAAG,aAAa,IAAI,SAAS,EAAE,CAAA;AACxC,CAAC,CAAC,CACH,CACF,CAAA;AAfQ,QAAA,QAAQ,YAehB"}
@@ -1,5 +1,5 @@
1
- import { generator, inject, toFile, before, after, prepend } from '@feathershq/pinion'
2
- import { getSource, renderSource } from '../../commons'
1
+ import { generator, toFile, after, prepend, append } from '@feathershq/pinion'
2
+ import { injectSource, renderSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
5
  const migrationTemplate = ({ kebabName }: ServiceGeneratorContext) => `import type { Knex } from 'knex'
@@ -33,20 +33,25 @@ export const optionTemplate = ({ kebabName, feathers }: ServiceGeneratorContext)
33
33
  Model: app.get('${feathers.database}Client'),
34
34
  name: '${kebabName}'`
35
35
 
36
- const toServiceFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName, language }) => [
36
+ const toServiceFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
37
37
  lib,
38
38
  'services',
39
39
  ...folder,
40
- `${fileName}.${language}`
40
+ `${fileName}.service`
41
+ ])
42
+
43
+ const toClassFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
44
+ lib,
45
+ 'services',
46
+ ...folder,
47
+ `${fileName}.class`
41
48
  ])
42
49
 
43
50
  export const generate = (ctx: ServiceGeneratorContext) =>
44
51
  generator(ctx)
45
- .then(
46
- inject(getSource(classCode), before<ServiceGeneratorContext>('export const hooks ='), toServiceFile)
47
- )
48
- .then(inject(getSource(importTemplate), prepend(), toServiceFile))
49
- .then(inject(optionTemplate, after('const options ='), toServiceFile))
52
+ .then(injectSource(classCode, append(), toClassFile))
53
+ .then(injectSource(importTemplate, prepend(), toClassFile))
54
+ .then(injectSource(optionTemplate, after('const options ='), toServiceFile, false))
50
55
  .then(
51
56
  renderSource(
52
57
  migrationTemplate,
@@ -15,15 +15,21 @@ export class ${className} extends MongoDBService<${upperName}Result, ${upperName
15
15
  exports.classCode = classCode;
16
16
  const optionTemplate = ({ kebabName }) => ` paginate: app.get('paginate'),
17
17
  Model: app.get('mongodbClient').then(db => db.collection('${kebabName}'))`;
18
- const toServiceFile = (0, pinion_1.toFile)(({ lib, folder, fileName, language }) => [
18
+ const toServiceFile = (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
19
19
  lib,
20
20
  'services',
21
21
  ...folder,
22
- `${fileName}.${language}`
22
+ `${fileName}.service`
23
+ ]);
24
+ const toClassFile = (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
25
+ lib,
26
+ 'services',
27
+ ...folder,
28
+ `${fileName}.class`
23
29
  ]);
24
30
  const generate = (ctx) => (0, pinion_1.generator)(ctx)
25
- .then((0, pinion_1.inject)((0, commons_1.getSource)(exports.classCode), (0, pinion_1.before)('export const hooks ='), toServiceFile))
26
- .then((0, pinion_1.inject)((0, commons_1.getSource)(exports.importTemplate), (0, pinion_1.prepend)(), toServiceFile))
27
- .then((0, pinion_1.inject)(optionTemplate, (0, pinion_1.after)('const options ='), toServiceFile));
31
+ .then((0, commons_1.injectSource)(exports.classCode, (0, pinion_1.append)(), toClassFile))
32
+ .then((0, commons_1.injectSource)(exports.importTemplate, (0, pinion_1.prepend)(), toClassFile))
33
+ .then((0, commons_1.injectSource)(optionTemplate, (0, pinion_1.after)('const options ='), toServiceFile, false));
28
34
  exports.generate = generate;
29
35
  //# sourceMappingURL=mongodb.tpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mongodb.tpl.js","sourceRoot":"","sources":["../../../src/service/type/mongodb.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsF;AACtF,2CAAyC;AAG5B,QAAA,cAAc,GAAG;kEACoC,CAAA;AAE3D,MAAM,SAAS,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAA2B,EAAE,EAAE,CAC7E,oBAAoB,SAAS,uCAAuC,SAAS;;;;eAIhE,SAAS,2BAA2B,SAAS,WAAW,SAAS,SAAS,SAAS;;CAEjG,CAAA;AAPY,QAAA,SAAS,aAOrB;AAED,MAAM,cAAc,GAAG,CAAC,EAAE,SAAS,EAA2B,EAAE,EAAE,CAChE;gEAC8D,SAAS,KAAK,CAAA;AAE9E,MAAM,aAAa,GAAG,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC7F,GAAG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,IAAA,eAAM,EAA0B,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACjF,GAAG;IACH,UAAU;IACV,GAAG,MAAM;IACT,GAAG,QAAQ,QAAQ;CACpB,CAAC,CAAA;AAEK,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CAAC,IAAA,sBAAY,EAAC,iBAAS,EAAE,IAAA,eAAM,GAAE,EAAE,WAAW,CAAC,CAAC;KACpD,IAAI,CAAC,IAAA,sBAAY,EAAC,sBAAc,EAAE,IAAA,gBAAO,GAAE,EAAE,WAAW,CAAC,CAAC;KAC1D,IAAI,CAAC,IAAA,sBAAY,EAAC,cAAc,EAAE,IAAA,cAAK,EAAC,iBAAiB,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAA;AAJ1E,QAAA,QAAQ,YAIkE"}
@@ -1,5 +1,5 @@
1
- import { generator, inject, toFile, before, after, prepend } from '@feathershq/pinion'
2
- import { getSource } from '../../commons'
1
+ import { generator, toFile, after, prepend, append } from '@feathershq/pinion'
2
+ import { injectSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
5
  export const importTemplate = `import { MongoDBService } from \'@feathersjs/mongodb\'
@@ -18,17 +18,22 @@ const optionTemplate = ({ kebabName }: ServiceGeneratorContext) =>
18
18
  ` paginate: app.get('paginate'),
19
19
  Model: app.get('mongodbClient').then(db => db.collection('${kebabName}'))`
20
20
 
21
- const toServiceFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName, language }) => [
21
+ const toServiceFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
22
22
  lib,
23
23
  'services',
24
24
  ...folder,
25
- `${fileName}.${language}`
25
+ `${fileName}.service`
26
+ ])
27
+
28
+ const toClassFile = toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
29
+ lib,
30
+ 'services',
31
+ ...folder,
32
+ `${fileName}.class`
26
33
  ])
27
34
 
28
35
  export const generate = (ctx: ServiceGeneratorContext) =>
29
36
  generator(ctx)
30
- .then(
31
- inject(getSource(classCode), before<ServiceGeneratorContext>('export const hooks ='), toServiceFile)
32
- )
33
- .then(inject(getSource(importTemplate), prepend(), toServiceFile))
34
- .then(inject(optionTemplate, after('const options ='), toServiceFile))
37
+ .then(injectSource(classCode, append(), toClassFile))
38
+ .then(injectSource(importTemplate, prepend(), toClassFile))
39
+ .then(injectSource(optionTemplate, after('const options ='), toServiceFile, false))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/cli",
3
3
  "description": "The command line interface for creating Feathers applications",
4
- "version": "5.0.0-pre.26",
4
+ "version": "5.0.0-pre.27",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
7
  "bin": {
@@ -60,28 +60,28 @@
60
60
  "prettier": "^2.7.1"
61
61
  },
62
62
  "devDependencies": {
63
- "@feathersjs/authentication": "^5.0.0-pre.26",
64
- "@feathersjs/authentication-local": "^5.0.0-pre.26",
65
- "@feathersjs/authentication-oauth": "^5.0.0-pre.26",
66
- "@feathersjs/configuration": "^5.0.0-pre.26",
67
- "@feathersjs/errors": "^5.0.0-pre.26",
68
- "@feathersjs/express": "^5.0.0-pre.26",
69
- "@feathersjs/feathers": "^5.0.0-pre.26",
70
- "@feathersjs/knex": "^5.0.0-pre.26",
71
- "@feathersjs/koa": "^5.0.0-pre.26",
72
- "@feathersjs/mongodb": "^5.0.0-pre.26",
73
- "@feathersjs/schema": "^5.0.0-pre.26",
74
- "@feathersjs/socketio": "^5.0.0-pre.26",
75
- "@feathersjs/transport-commons": "^5.0.0-pre.26",
63
+ "@feathersjs/authentication": "^5.0.0-pre.27",
64
+ "@feathersjs/authentication-local": "^5.0.0-pre.27",
65
+ "@feathersjs/authentication-oauth": "^5.0.0-pre.27",
66
+ "@feathersjs/configuration": "^5.0.0-pre.27",
67
+ "@feathersjs/errors": "^5.0.0-pre.27",
68
+ "@feathersjs/express": "^5.0.0-pre.27",
69
+ "@feathersjs/feathers": "^5.0.0-pre.27",
70
+ "@feathersjs/knex": "^5.0.0-pre.27",
71
+ "@feathersjs/koa": "^5.0.0-pre.27",
72
+ "@feathersjs/mongodb": "^5.0.0-pre.27",
73
+ "@feathersjs/schema": "^5.0.0-pre.27",
74
+ "@feathersjs/socketio": "^5.0.0-pre.27",
75
+ "@feathersjs/transport-commons": "^5.0.0-pre.27",
76
76
  "@types/mocha": "^9.1.1",
77
- "@types/node": "^17.0.40",
77
+ "@types/node": "^18.0.1",
78
78
  "@types/prettier": "^2.6.3",
79
79
  "axios": "^0.27.2",
80
80
  "mocha": "^10.0.0",
81
81
  "shx": "^0.3.4",
82
- "ts-node": "^10.8.1",
83
- "type-fest": "^2.13.0",
84
- "typescript": "^4.7.3"
82
+ "ts-node": "^10.8.2",
83
+ "type-fest": "^2.16.0",
84
+ "typescript": "^4.7.4"
85
85
  },
86
- "gitHead": "0e7553ded9b24016d36021aaedcc2cdb19ab0157"
86
+ "gitHead": "6032742bce059781e7013fd662870df45bd72bb5"
87
87
  }