@feathersjs/cli 5.0.0-pre.33 → 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.
Files changed (175) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/lib/index.d.ts +6 -2
  3. package/lib/index.js +59 -2
  4. package/lib/index.js.map +1 -1
  5. package/package.json +30 -30
  6. package/lib/app/index.d.ts +0 -29
  7. package/lib/app/index.js +0 -146
  8. package/lib/app/index.js.map +0 -1
  9. package/lib/app/index.ts +0 -227
  10. package/lib/app/static/.gitignore +0 -121
  11. package/lib/app/templates/app.test.tpl.d.ts +0 -2
  12. package/lib/app/templates/app.test.tpl.js +0 -48
  13. package/lib/app/templates/app.test.tpl.js.map +0 -1
  14. package/lib/app/templates/app.test.tpl.ts +0 -47
  15. package/lib/app/templates/app.tpl.d.ts +0 -2
  16. package/lib/app/templates/app.tpl.js +0 -121
  17. package/lib/app/templates/app.tpl.js.map +0 -1
  18. package/lib/app/templates/app.tpl.ts +0 -136
  19. package/lib/app/templates/channels.tpl.d.ts +0 -2
  20. package/lib/app/templates/channels.tpl.js +0 -48
  21. package/lib/app/templates/channels.tpl.js.map +0 -1
  22. package/lib/app/templates/channels.tpl.ts +0 -54
  23. package/lib/app/templates/client.test.tpl.d.ts +0 -2
  24. package/lib/app/templates/client.test.tpl.js +0 -27
  25. package/lib/app/templates/client.test.tpl.js.map +0 -1
  26. package/lib/app/templates/client.test.tpl.ts +0 -26
  27. package/lib/app/templates/client.tpl.d.ts +0 -2
  28. package/lib/app/templates/client.tpl.js +0 -37
  29. package/lib/app/templates/client.tpl.js.map +0 -1
  30. package/lib/app/templates/client.tpl.ts +0 -44
  31. package/lib/app/templates/config.tpl.d.ts +0 -2
  32. package/lib/app/templates/config.tpl.js +0 -30
  33. package/lib/app/templates/config.tpl.js.map +0 -1
  34. package/lib/app/templates/config.tpl.ts +0 -31
  35. package/lib/app/templates/declarations.tpl.d.ts +0 -2
  36. package/lib/app/templates/declarations.tpl.js +0 -27
  37. package/lib/app/templates/declarations.tpl.js.map +0 -1
  38. package/lib/app/templates/declarations.tpl.ts +0 -36
  39. package/lib/app/templates/index.html.tpl.d.ts +0 -2
  40. package/lib/app/templates/index.html.tpl.js +0 -45
  41. package/lib/app/templates/index.html.tpl.js.map +0 -1
  42. package/lib/app/templates/index.html.tpl.ts +0 -44
  43. package/lib/app/templates/index.tpl.d.ts +0 -2
  44. package/lib/app/templates/index.tpl.js +0 -18
  45. package/lib/app/templates/index.tpl.js.map +0 -1
  46. package/lib/app/templates/index.tpl.ts +0 -22
  47. package/lib/app/templates/logger.tpl.d.ts +0 -2
  48. package/lib/app/templates/logger.tpl.js +0 -39
  49. package/lib/app/templates/logger.tpl.js.map +0 -1
  50. package/lib/app/templates/logger.tpl.ts +0 -44
  51. package/lib/app/templates/package.json.tpl.d.ts +0 -2
  52. package/lib/app/templates/package.json.tpl.js +0 -55
  53. package/lib/app/templates/package.json.tpl.js.map +0 -1
  54. package/lib/app/templates/package.json.tpl.ts +0 -68
  55. package/lib/app/templates/prettierrc.tpl.d.ts +0 -2
  56. package/lib/app/templates/prettierrc.tpl.js +0 -11
  57. package/lib/app/templates/prettierrc.tpl.js.map +0 -1
  58. package/lib/app/templates/prettierrc.tpl.ts +0 -14
  59. package/lib/app/templates/readme.md.tpl.d.ts +0 -2
  60. package/lib/app/templates/readme.md.tpl.js +0 -54
  61. package/lib/app/templates/readme.md.tpl.js.map +0 -1
  62. package/lib/app/templates/readme.md.tpl.ts +0 -57
  63. package/lib/app/templates/schemas.tpl.d.ts +0 -2
  64. package/lib/app/templates/schemas.tpl.js +0 -75
  65. package/lib/app/templates/schemas.tpl.js.map +0 -1
  66. package/lib/app/templates/schemas.tpl.ts +0 -89
  67. package/lib/app/templates/services.tpl.d.ts +0 -2
  68. package/lib/app/templates/services.tpl.js +0 -14
  69. package/lib/app/templates/services.tpl.js.map +0 -1
  70. package/lib/app/templates/services.tpl.ts +0 -18
  71. package/lib/app/templates/tsconfig.json.tpl.d.ts +0 -2
  72. package/lib/app/templates/tsconfig.json.tpl.js +0 -22
  73. package/lib/app/templates/tsconfig.json.tpl.js.map +0 -1
  74. package/lib/app/templates/tsconfig.json.tpl.ts +0 -28
  75. package/lib/authentication/index.d.ts +0 -73
  76. package/lib/authentication/index.js +0 -107
  77. package/lib/authentication/index.js.map +0 -1
  78. package/lib/authentication/index.ts +0 -126
  79. package/lib/authentication/templates/authentication.tpl.d.ts +0 -2
  80. package/lib/authentication/templates/authentication.tpl.js +0 -39
  81. package/lib/authentication/templates/authentication.tpl.js.map +0 -1
  82. package/lib/authentication/templates/authentication.tpl.ts +0 -50
  83. package/lib/authentication/templates/client.test.tpl.d.ts +0 -2
  84. package/lib/authentication/templates/client.test.tpl.js +0 -61
  85. package/lib/authentication/templates/client.test.tpl.js.map +0 -1
  86. package/lib/authentication/templates/client.test.tpl.ts +0 -73
  87. package/lib/authentication/templates/client.tpl.d.ts +0 -2
  88. package/lib/authentication/templates/client.tpl.js +0 -14
  89. package/lib/authentication/templates/client.tpl.js.map +0 -1
  90. package/lib/authentication/templates/client.tpl.ts +0 -19
  91. package/lib/authentication/templates/config.tpl.d.ts +0 -2
  92. package/lib/authentication/templates/config.tpl.js +0 -50
  93. package/lib/authentication/templates/config.tpl.js.map +0 -1
  94. package/lib/authentication/templates/config.tpl.ts +0 -57
  95. package/lib/authentication/templates/declarations.tpl.d.ts +0 -2
  96. package/lib/authentication/templates/declarations.tpl.js +0 -19
  97. package/lib/authentication/templates/declarations.tpl.js.map +0 -1
  98. package/lib/authentication/templates/declarations.tpl.ts +0 -34
  99. package/lib/authentication/templates/knex.tpl.d.ts +0 -2
  100. package/lib/authentication/templates/knex.tpl.js +0 -45
  101. package/lib/authentication/templates/knex.tpl.js.map +0 -1
  102. package/lib/authentication/templates/knex.tpl.ts +0 -62
  103. package/lib/authentication/templates/schema.json.tpl.d.ts +0 -2
  104. package/lib/authentication/templates/schema.json.tpl.js +0 -93
  105. package/lib/authentication/templates/schema.json.tpl.js.map +0 -1
  106. package/lib/authentication/templates/schema.json.tpl.ts +0 -108
  107. package/lib/authentication/templates/schema.typebox.tpl.d.ts +0 -3
  108. package/lib/authentication/templates/schema.typebox.tpl.js +0 -78
  109. package/lib/authentication/templates/schema.typebox.tpl.js.map +0 -1
  110. package/lib/authentication/templates/schema.typebox.tpl.ts +0 -94
  111. package/lib/cli.d.ts +0 -6
  112. package/lib/cli.js +0 -75
  113. package/lib/cli.js.map +0 -1
  114. package/lib/cli.ts +0 -68
  115. package/lib/commons.d.ts +0 -143
  116. package/lib/commons.js +0 -190
  117. package/lib/commons.js.map +0 -1
  118. package/lib/commons.ts +0 -276
  119. package/lib/connection/index.d.ts +0 -55
  120. package/lib/connection/index.js +0 -88
  121. package/lib/connection/index.js.map +0 -1
  122. package/lib/connection/index.ts +0 -123
  123. package/lib/connection/templates/knex.tpl.d.ts +0 -2
  124. package/lib/connection/templates/knex.tpl.js +0 -46
  125. package/lib/connection/templates/knex.tpl.js.map +0 -1
  126. package/lib/connection/templates/knex.tpl.ts +0 -63
  127. package/lib/connection/templates/mongodb.tpl.d.ts +0 -2
  128. package/lib/connection/templates/mongodb.tpl.js +0 -33
  129. package/lib/connection/templates/mongodb.tpl.js.map +0 -1
  130. package/lib/connection/templates/mongodb.tpl.ts +0 -38
  131. package/lib/hook/index.d.ts +0 -22
  132. package/lib/hook/index.js +0 -43
  133. package/lib/hook/index.js.map +0 -1
  134. package/lib/hook/index.ts +0 -47
  135. package/lib/hook/templates/hook.tpl.d.ts +0 -2
  136. package/lib/hook/templates/hook.tpl.js +0 -20
  137. package/lib/hook/templates/hook.tpl.js.map +0 -1
  138. package/lib/hook/templates/hook.tpl.ts +0 -31
  139. package/lib/index.ts +0 -2
  140. package/lib/service/index.d.ts +0 -64
  141. package/lib/service/index.js +0 -116
  142. package/lib/service/index.js.map +0 -1
  143. package/lib/service/index.ts +0 -191
  144. package/lib/service/templates/client.tpl.d.ts +0 -2
  145. package/lib/service/templates/client.tpl.js +0 -31
  146. package/lib/service/templates/client.tpl.js.map +0 -1
  147. package/lib/service/templates/client.tpl.ts +0 -57
  148. package/lib/service/templates/schema.json.tpl.d.ts +0 -2
  149. package/lib/service/templates/schema.json.tpl.js +0 -75
  150. package/lib/service/templates/schema.json.tpl.js.map +0 -1
  151. package/lib/service/templates/schema.json.tpl.ts +0 -87
  152. package/lib/service/templates/schema.typebox.tpl.d.ts +0 -2
  153. package/lib/service/templates/schema.typebox.tpl.js +0 -55
  154. package/lib/service/templates/schema.typebox.tpl.js.map +0 -1
  155. package/lib/service/templates/schema.typebox.tpl.ts +0 -67
  156. package/lib/service/templates/service.tpl.d.ts +0 -3
  157. package/lib/service/templates/service.tpl.js +0 -98
  158. package/lib/service/templates/service.tpl.js.map +0 -1
  159. package/lib/service/templates/service.tpl.ts +0 -134
  160. package/lib/service/templates/test.tpl.d.ts +0 -2
  161. package/lib/service/templates/test.tpl.js +0 -24
  162. package/lib/service/templates/test.tpl.js.map +0 -1
  163. package/lib/service/templates/test.tpl.ts +0 -28
  164. package/lib/service/type/custom.tpl.d.ts +0 -3
  165. package/lib/service/type/custom.tpl.js +0 -94
  166. package/lib/service/type/custom.tpl.js.map +0 -1
  167. package/lib/service/type/custom.tpl.ts +0 -99
  168. package/lib/service/type/knex.tpl.d.ts +0 -3
  169. package/lib/service/type/knex.tpl.js +0 -67
  170. package/lib/service/type/knex.tpl.js.map +0 -1
  171. package/lib/service/type/knex.tpl.ts +0 -88
  172. package/lib/service/type/mongodb.tpl.d.ts +0 -3
  173. package/lib/service/type/mongodb.tpl.js +0 -47
  174. package/lib/service/type/mongodb.tpl.js.map +0 -1
  175. package/lib/service/type/mongodb.tpl.ts +0 -59
@@ -1,55 +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 }) => /* ts */ `import { resolve } from '@feathersjs/schema'
7
- import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
8
- import type { Static } from '@feathersjs/typebox'
9
-
10
- import type { HookContext } from '${relative}/declarations'
11
- import { dataValidator, queryValidator } from '${relative}/schemas/validators'
12
-
13
- // Main data model schema
14
- export const ${camelName}Schema = Type.Object({
15
- ${type === 'mongodb' ? '_id: Type.String()' : 'id: Type.Number()'},
16
- text: Type.String()
17
- }, { $id: '${upperName}', additionalProperties: false })
18
- export type ${upperName} = Static<typeof ${camelName}Schema>
19
- export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
20
- properties: {}
21
- })
22
-
23
- export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
24
- properties: {}
25
- })
26
-
27
- // Schema for creating new entries
28
- export const ${camelName}DataSchema = Type.Pick(${camelName}Schema, ['text'], {
29
- $id: '${upperName}Data', additionalProperties: false
30
- })
31
- export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
32
- export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
33
- export const ${camelName}DataResolver = resolve<${upperName}, HookContext>({
34
- properties: {}
35
- })
36
-
37
- // Schema for allowed query properties
38
- export const ${camelName}QueryProperties = Type.Pick(${camelName}Schema, [
39
- '${type === 'mongodb' ? '_id' : 'id'}', 'text'
40
- ], { additionalProperties: false })
41
- export const ${camelName}QuerySchema = querySyntax(${camelName}QueryProperties)
42
- export type ${upperName}Query = Static<typeof ${camelName}QuerySchema>
43
- export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
44
- export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
45
- properties: {}
46
- })
47
- `;
48
- 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 }) => [
49
- lib,
50
- 'services',
51
- ...folder,
52
- `${fileName}.schema`
53
- ]))));
54
- exports.generate = generate;
55
- //# 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,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,IAAI,EACoB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;oCAIJ,QAAQ;iDACK,QAAQ;;;eAG1C,SAAS;MAClB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,mBAAmB;;eAEtD,SAAS;cACV,SAAS,oBAAoB,SAAS;eACrC,SAAS,sBAAsB,SAAS;;;;eAIxC,SAAS,8BAA8B,SAAS;;;;;eAKhD,SAAS,0BAA0B,SAAS;UACjD,SAAS;;cAEL,SAAS,wBAAwB,SAAS;eACzC,SAAS,oCAAoC,SAAS;eACtD,SAAS,0BAA0B,SAAS;;;;;eAK5C,SAAS,+BAA+B,SAAS;KAC3D,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;;eAEvB,SAAS,6BAA6B,SAAS;cAChD,SAAS,yBAAyB,SAAS;eAC1C,SAAS,iCAAiC,SAAS;eACnD,SAAS,2BAA2B,SAAS;;;CAG3D,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,67 +0,0 @@
1
- import { generator, toFile, when } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- const template = ({
6
- camelName,
7
- upperName,
8
- relative,
9
- type
10
- }: ServiceGeneratorContext) => /* ts */ `import { resolve } from '@feathersjs/schema'
11
- import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
12
- import type { Static } from '@feathersjs/typebox'
13
-
14
- import type { HookContext } from '${relative}/declarations'
15
- import { dataValidator, queryValidator } from '${relative}/schemas/validators'
16
-
17
- // Main data model schema
18
- export const ${camelName}Schema = Type.Object({
19
- ${type === 'mongodb' ? '_id: Type.String()' : 'id: Type.Number()'},
20
- text: Type.String()
21
- }, { $id: '${upperName}', additionalProperties: false })
22
- export type ${upperName} = Static<typeof ${camelName}Schema>
23
- export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
24
- properties: {}
25
- })
26
-
27
- export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
28
- properties: {}
29
- })
30
-
31
- // Schema for creating new entries
32
- export const ${camelName}DataSchema = Type.Pick(${camelName}Schema, ['text'], {
33
- $id: '${upperName}Data', additionalProperties: false
34
- })
35
- export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
36
- export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
37
- export const ${camelName}DataResolver = resolve<${upperName}, HookContext>({
38
- properties: {}
39
- })
40
-
41
- // Schema for allowed query properties
42
- export const ${camelName}QueryProperties = Type.Pick(${camelName}Schema, [
43
- '${type === 'mongodb' ? '_id' : 'id'}', 'text'
44
- ], { additionalProperties: false })
45
- export const ${camelName}QuerySchema = querySyntax(${camelName}QueryProperties)
46
- export type ${upperName}Query = Static<typeof ${camelName}QuerySchema>
47
- export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
48
- export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
49
- properties: {}
50
- })
51
- `
52
-
53
- export const generate = (ctx: ServiceGeneratorContext) =>
54
- generator(ctx).then(
55
- when<ServiceGeneratorContext>(
56
- ({ schema }) => schema === 'typebox',
57
- renderSource(
58
- template,
59
- toFile(({ lib, folder, fileName }: ServiceGeneratorContext) => [
60
- lib,
61
- 'services',
62
- ...folder,
63
- `${fileName}.schema`
64
- ])
65
- )
66
- )
67
- )
@@ -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,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 = ({ camelName, authentication, isEntityService, path, className, relative, schema, fileName }) => /* ts */ `
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}QueryValidator,
15
- ${camelName}Resolver,
16
- ${camelName}DataResolver,
17
- ${camelName}QueryResolver,
18
- ${camelName}ExternalResolver
19
- } from './${fileName}.schema'
20
- `
21
- : ''}
22
-
23
- import type { Application } from '${relative}/declarations'
24
- import { ${className}, getOptions } from './${fileName}.class'
25
-
26
- export * from './${fileName}.class'
27
- ${schema ? `export * from './${fileName}.schema'` : ''}
28
-
29
- // A configure function that registers the service and its hooks via \`app.configure\`
30
- export const ${camelName} = (app: Application) => {
31
- // Register our service on the Feathers application
32
- app.use('${path}', new ${className}(getOptions(app)), {
33
- // A list of all methods this service exposes externally
34
- methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
35
- // You can add additional custom events to be sent to clients here
36
- events: []
37
- })
38
- // Initialize hooks
39
- app.service('${path}').hooks({
40
- around: {
41
- all: [${authentication
42
- ? `
43
- authenticate('jwt'),`
44
- : ''}
45
- ]${isEntityService
46
- ? `,
47
- find: [ authenticate('jwt') ],
48
- get: [ authenticate('jwt') ],
49
- create: [],
50
- update: [ authenticate('jwt') ],
51
- patch: [ authenticate('jwt') ],
52
- remove: [ authenticate('jwt') ]`
53
- : ''}
54
- },
55
- before: {
56
- all: [${schema
57
- ? `
58
- schemaHooks.validateQuery(${camelName}QueryValidator),
59
- schemaHooks.validateData(${camelName}DataValidator),
60
- schemaHooks.resolveQuery(${camelName}QueryResolver),
61
- schemaHooks.resolveData(${camelName}DataResolver)
62
- `
63
- : ''}]
64
- },
65
- after: {
66
- all: [${schema
67
- ? `
68
- schemaHooks.resolveResult(${camelName}Resolver),
69
- schemaHooks.resolveExternal(${camelName}ExternalResolver)
70
- `
71
- : ''}]
72
- },
73
- error: {
74
- all: []
75
- }
76
- })
77
- }
78
-
79
- // Add this service to the service type index
80
- declare module '${relative}/declarations' {
81
- interface ServiceTypes {
82
- '${path}': ${className}
83
- }
84
- }
85
- `;
86
- exports.template = template;
87
- const toServiceIndex = (0, pinion_1.toFile)(({ lib }) => [lib, 'services', `index`]);
88
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
89
- .then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, fileName, folder }) => [
90
- lib,
91
- 'services',
92
- ...folder,
93
- `${fileName}`
94
- ])))
95
- .then((0, commons_1.injectSource)(({ camelName, folder, fileName }) => `import { ${camelName} } from './${folder.join('/')}/${fileName}'`, (0, pinion_1.prepend)(), toServiceIndex))
96
- .then((0, commons_1.injectSource)(({ camelName }) => ` app.configure(${camelName})`, (0, pinion_1.after)('export const services'), toServiceIndex));
97
- exports.generate = generate;
98
- //# 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;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;SAEE,eAAe;IACb,CAAC,CAAC;;;;;;sCAM0B;IAC5B,CAAC,CAAC,EACN;;;cAIE,MAAM;IACJ,CAAC,CAAC;oCACwB,SAAS;mCACV,SAAS;mCACT,SAAS;kCACV,SAAS;OACpC;IACG,CAAC,CAAC,EACN;;;cAIE,MAAM;IACJ,CAAC,CAAC;oCACwB,SAAS;sCACP,SAAS;OACxC;IACG,CAAC,CAAC,EACN;;;;;;;;;kBASY,QAAQ;;OAEnB,IAAI,MAAM,SAAS;;;CAGzB,CAAA;AAlGY,QAAA,QAAQ,YAkGpB;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,134 +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 */ `
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}QueryValidator,
24
- ${camelName}Resolver,
25
- ${camelName}DataResolver,
26
- ${camelName}QueryResolver,
27
- ${camelName}ExternalResolver
28
- } from './${fileName}.schema'
29
- `
30
- : ''
31
- }
32
-
33
- import type { Application } from '${relative}/declarations'
34
- import { ${className}, getOptions } from './${fileName}.class'
35
-
36
- export * from './${fileName}.class'
37
- ${schema ? `export * from './${fileName}.schema'` : ''}
38
-
39
- // A configure function that registers the service and its hooks via \`app.configure\`
40
- export const ${camelName} = (app: Application) => {
41
- // Register our service on the Feathers application
42
- app.use('${path}', new ${className}(getOptions(app)), {
43
- // A list of all methods this service exposes externally
44
- methods: ['find', 'get', 'create', 'update', 'patch', 'remove'],
45
- // You can add additional custom events to be sent to clients here
46
- events: []
47
- })
48
- // Initialize hooks
49
- app.service('${path}').hooks({
50
- around: {
51
- all: [${
52
- authentication
53
- ? `
54
- authenticate('jwt'),`
55
- : ''
56
- }
57
- ]${
58
- isEntityService
59
- ? `,
60
- find: [ authenticate('jwt') ],
61
- get: [ authenticate('jwt') ],
62
- create: [],
63
- update: [ authenticate('jwt') ],
64
- patch: [ authenticate('jwt') ],
65
- remove: [ authenticate('jwt') ]`
66
- : ''
67
- }
68
- },
69
- before: {
70
- all: [${
71
- schema
72
- ? `
73
- schemaHooks.validateQuery(${camelName}QueryValidator),
74
- schemaHooks.validateData(${camelName}DataValidator),
75
- schemaHooks.resolveQuery(${camelName}QueryResolver),
76
- schemaHooks.resolveData(${camelName}DataResolver)
77
- `
78
- : ''
79
- }]
80
- },
81
- after: {
82
- all: [${
83
- schema
84
- ? `
85
- schemaHooks.resolveResult(${camelName}Resolver),
86
- schemaHooks.resolveExternal(${camelName}ExternalResolver)
87
- `
88
- : ''
89
- }]
90
- },
91
- error: {
92
- all: []
93
- }
94
- })
95
- }
96
-
97
- // Add this service to the service type index
98
- declare module '${relative}/declarations' {
99
- interface ServiceTypes {
100
- '${path}': ${className}
101
- }
102
- }
103
- `
104
-
105
- const toServiceIndex = toFile(({ lib }: ServiceGeneratorContext) => [lib, 'services', `index`])
106
-
107
- export const generate = (ctx: ServiceGeneratorContext) =>
108
- generator(ctx)
109
- .then(
110
- renderSource(
111
- template,
112
- toFile(({ lib, fileName, folder }: ServiceGeneratorContext) => [
113
- lib,
114
- 'services',
115
- ...folder,
116
- `${fileName}`
117
- ])
118
- )
119
- )
120
- .then(
121
- injectSource<ServiceGeneratorContext>(
122
- ({ camelName, folder, fileName }) =>
123
- `import { ${camelName} } from './${folder.join('/')}/${fileName}'`,
124
- prepend(),
125
- toServiceIndex
126
- )
127
- )
128
- .then(
129
- injectSource<ServiceGeneratorContext>(
130
- ({ camelName }) => ` app.configure(${camelName})`,
131
- after('export const services'),
132
- toServiceIndex
133
- )
134
- )
@@ -1,2 +0,0 @@
1
- import { ServiceGeneratorContext } from '../index';
2
- export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
@@ -1,24 +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 */ `import assert from 'assert'
7
- import { app } from '../${relative}/${lib}/app'
8
-
9
- describe('${path} service', () => {
10
- it('registered the service', () => {
11
- const service = app.service('${path}')
12
-
13
- assert.ok(service, 'Registered the service')
14
- })
15
- })
16
- `;
17
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ test, folder, fileName }) => [
18
- test,
19
- 'services',
20
- ...folder,
21
- `${fileName}.test`
22
- ])));
23
- exports.generate = generate;
24
- //# 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,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAA2B,EAAE,EAAE,CAAC,QAAQ,CAAC;0BACtD,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,28 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- const template = ({ relative, lib, path }: ServiceGeneratorContext) => /* ts */ `import assert from 'assert'
6
- import { app } from '../${relative}/${lib}/app'
7
-
8
- describe('${path} service', () => {
9
- it('registered the service', () => {
10
- const service = app.service('${path}')
11
-
12
- assert.ok(service, 'Registered the service')
13
- })
14
- })
15
- `
16
-
17
- export const generate = (ctx: ServiceGeneratorContext) =>
18
- generator(ctx).then(
19
- renderSource(
20
- template,
21
- toFile<ServiceGeneratorContext>(({ test, folder, fileName }) => [
22
- test,
23
- 'services',
24
- ...folder,
25
- `${fileName}.test`
26
- ])
27
- )
28
- )
@@ -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,94 +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 }) => `
7
- import type { Id, NullableId, Params } from '@feathersjs/feathers'
8
-
9
- import type { Application } from '${relative}/declarations'
10
- ${schema
11
- ? `import type {
12
- ${upperName},
13
- ${upperName}Data,
14
- ${upperName}Query
15
- } from './${fileName}.schema'
16
- `
17
- : `
18
- export type ${upperName} = any
19
- export type ${upperName}Data = any
20
- export type ${upperName}Query = any
21
- `}
22
-
23
- export interface ${className}Options {
24
- app: Application
25
- }
26
-
27
- export interface ${upperName}Params extends Params<${upperName}Query> {
28
-
29
- }
30
-
31
- // This is a skeleton for a custom service class. Remove or add the methods you need here
32
- export class ${className} {
33
- constructor (public options: ${className}Options) {
34
- }
35
-
36
- async find (_params?: ${upperName}Params): Promise<${upperName}[]> {
37
- return []
38
- }
39
-
40
- async get (id: Id, _params?: ${upperName}Params): Promise<${upperName}> {
41
- return {
42
- id: 0,
43
- text: \`A new message with ID: \${id}!\`
44
- }
45
- }
46
-
47
- async create (data: ${upperName}Data, params?: ${upperName}Params): Promise<${upperName}>
48
- async create (data: ${upperName}Data[], params?: ${upperName}Params): Promise<${upperName}[]>
49
- async create (data: ${upperName}Data|${upperName}Data[], params?: ${upperName}Params): Promise<${upperName}|${upperName}[]> {
50
- if (Array.isArray(data)) {
51
- return Promise.all(data.map(current => this.create(current, params)));
52
- }
53
-
54
- return {
55
- id: 0,
56
- ...data
57
- }
58
- }
59
-
60
- async update (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}> {
61
- return {
62
- id: 0,
63
- ...data
64
- }
65
- }
66
-
67
- async patch (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}> {
68
- return {
69
- id: 0,
70
- ...data
71
- }
72
- }
73
-
74
- async remove (id: NullableId, _params?: ${upperName}Params): Promise<${upperName}> {
75
- return {
76
- id: 0,
77
- text: 'removed'
78
- }
79
- }
80
- }
81
-
82
- export const getOptions = (app: Application) => {
83
- return { app }
84
- }
85
- `;
86
- exports.template = template;
87
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
88
- lib,
89
- 'services',
90
- ...folder,
91
- `${fileName}.class`
92
- ])));
93
- exports.generate = generate;
94
- //# 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,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAA2B,EAAE,EAAE,CAAC;;;oCAGvE,QAAQ;EAE1C,MAAM;IACJ,CAAC,CAAC;IACF,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;CACnB;IACG,CAAC,CAAC;cACQ,SAAS;cACT,SAAS;cACT,SAAS;CAEvB;;mBAEmB,SAAS;;;;mBAIT,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,IAAI,SAAS;;;;;;;;;;;wCAWjF,SAAS,mBAAmB,SAAS,oBAAoB,SAAS;;;;;;;uCAOnE,SAAS,mBAAmB,SAAS,oBAAoB,SAAS;;;;;;;4CAO7D,SAAS,oBAAoB,SAAS;;;;;;;;;;;CAWjF,CAAA;AAjFY,QAAA,QAAQ,YAiFpB;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"}
@@ -1,99 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- export const template = ({ className, upperName, schema, fileName, relative }: ServiceGeneratorContext) => `
6
- import type { Id, NullableId, Params } from '@feathersjs/feathers'
7
-
8
- import type { Application } from '${relative}/declarations'
9
- ${
10
- schema
11
- ? `import type {
12
- ${upperName},
13
- ${upperName}Data,
14
- ${upperName}Query
15
- } from './${fileName}.schema'
16
- `
17
- : `
18
- export type ${upperName} = any
19
- export type ${upperName}Data = any
20
- export type ${upperName}Query = any
21
- `
22
- }
23
-
24
- export interface ${className}Options {
25
- app: Application
26
- }
27
-
28
- export interface ${upperName}Params extends Params<${upperName}Query> {
29
-
30
- }
31
-
32
- // This is a skeleton for a custom service class. Remove or add the methods you need here
33
- export class ${className} {
34
- constructor (public options: ${className}Options) {
35
- }
36
-
37
- async find (_params?: ${upperName}Params): Promise<${upperName}[]> {
38
- return []
39
- }
40
-
41
- async get (id: Id, _params?: ${upperName}Params): Promise<${upperName}> {
42
- return {
43
- id: 0,
44
- text: \`A new message with ID: \${id}!\`
45
- }
46
- }
47
-
48
- async create (data: ${upperName}Data, params?: ${upperName}Params): Promise<${upperName}>
49
- async create (data: ${upperName}Data[], params?: ${upperName}Params): Promise<${upperName}[]>
50
- async create (data: ${upperName}Data|${upperName}Data[], params?: ${upperName}Params): Promise<${upperName}|${upperName}[]> {
51
- if (Array.isArray(data)) {
52
- return Promise.all(data.map(current => this.create(current, params)));
53
- }
54
-
55
- return {
56
- id: 0,
57
- ...data
58
- }
59
- }
60
-
61
- async update (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}> {
62
- return {
63
- id: 0,
64
- ...data
65
- }
66
- }
67
-
68
- async patch (id: NullableId, data: ${upperName}Data, _params?: ${upperName}Params): Promise<${upperName}> {
69
- return {
70
- id: 0,
71
- ...data
72
- }
73
- }
74
-
75
- async remove (id: NullableId, _params?: ${upperName}Params): Promise<${upperName}> {
76
- return {
77
- id: 0,
78
- text: 'removed'
79
- }
80
- }
81
- }
82
-
83
- export const getOptions = (app: Application) => {
84
- return { app }
85
- }
86
- `
87
-
88
- export const generate = (ctx: ServiceGeneratorContext) =>
89
- generator(ctx).then(
90
- renderSource(
91
- template,
92
- toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
93
- lib,
94
- 'services',
95
- ...folder,
96
- `${fileName}.class`
97
- ])
98
- )
99
- )
@@ -1,3 +0,0 @@
1
- import { ServiceGeneratorContext } from '../index';
2
- export declare const template: ({ className, upperName, feathers, schema, fileName, relative }: ServiceGeneratorContext) => string;
3
- export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;