@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,67 +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 migrationTemplate = ({ kebabPath }) => /* ts */ `import type { Knex } from 'knex'
7
-
8
- export async function up(knex: Knex): Promise<void> {
9
- await knex.schema.createTable('${kebabPath}', table => {
10
- table.increments('id')
11
- table.string('text')
12
- })
13
- }
14
-
15
- export async function down(knex: Knex): Promise<void> {
16
- await knex.schema.dropTable('${kebabPath}')
17
- }
18
- `;
19
- const template = ({ className, upperName, feathers, schema, fileName, relative }) => /* ts */ `import type { Params } from '@feathersjs/feathers'
20
- import { KnexService } from '@feathersjs/knex'
21
- import type { KnexAdapterParams, KnexAdapterOptions } from '@feathersjs/knex'
22
-
23
- import type { Application } from '${relative}/declarations'
24
- ${schema
25
- ? `import type {
26
- ${upperName},
27
- ${upperName}Data,
28
- ${upperName}Query
29
- } from './${fileName}.schema'
30
- `
31
- : `
32
- export type ${upperName} = any
33
- export type ${upperName}Data = any
34
- export type ${upperName}Query = any
35
- `}
36
-
37
- export interface ${upperName}Params extends KnexAdapterParams<${upperName}Query> {
38
- }
39
-
40
- // By default calls the standard Knex adapter service methods but can be customized with your own functionality.
41
- export class ${className}<ServiceParams extends Params = ${upperName}Params>
42
- extends KnexService<${upperName}, ${upperName}Data, ServiceParams> {
43
- }
44
-
45
- export const getOptions = (app: Application): KnexAdapterOptions => {
46
- return {
47
- paginate: app.get('paginate'),
48
- Model: app.get('${feathers.database}Client'),
49
- name: '${fileName}'
50
- }
51
- }
52
- `;
53
- exports.template = template;
54
- const generate = (ctx) => (0, pinion_1.generator)(ctx)
55
- .then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
56
- lib,
57
- 'services',
58
- ...folder,
59
- `${fileName}.class`
60
- ])))
61
- .then((0, commons_1.renderSource)(migrationTemplate, (0, pinion_1.toFile)('migrations', ({ kebabName }) => {
62
- // Probably not great but it works to align with the Knex migration file format
63
- const migrationDate = new Date().toISOString().replace(/\D/g, '').substring(0, 14);
64
- return `${migrationDate}_${kebabName}`;
65
- })));
66
- exports.generate = generate;
67
- //# sourceMappingURL=knex.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knex.tpl.js","sourceRoot":"","sources":["../../../src/service/type/knex.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,iBAAiB,GAAG,CAAC,EACzB,SAAS,EACe,EAAE,EAAE,CAAC,QAAQ,CAAC;;;mCAGL,SAAS;;;;;;;iCAOX,SAAS;;CAEzC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;oCAIJ,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,oCAAoC,SAAS;;;;eAI1D,SAAS,mCAAmC,SAAS;wBAC5C,SAAS,KAAK,SAAS;;;;;;sBAMzB,QAAQ,CAAC,QAAQ;aAC1B,QAAQ;;;CAGpB,CAAA;AA1CY,QAAA,QAAQ,YA0CpB;AAEM,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,EAAE,CACvD,IAAA,kBAAS,EAAC,GAAG,CAAC;KACX,IAAI,CACH,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;KACA,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;AAvBQ,QAAA,QAAQ,YAuBhB"}
@@ -1,88 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- const migrationTemplate = ({
6
- kebabPath
7
- }: ServiceGeneratorContext) => /* ts */ `import type { Knex } from 'knex'
8
-
9
- export async function up(knex: Knex): Promise<void> {
10
- await knex.schema.createTable('${kebabPath}', table => {
11
- table.increments('id')
12
- table.string('text')
13
- })
14
- }
15
-
16
- export async function down(knex: Knex): Promise<void> {
17
- await knex.schema.dropTable('${kebabPath}')
18
- }
19
- `
20
-
21
- export const template = ({
22
- className,
23
- upperName,
24
- feathers,
25
- schema,
26
- fileName,
27
- relative
28
- }: ServiceGeneratorContext) => /* ts */ `import type { Params } from '@feathersjs/feathers'
29
- import { KnexService } from '@feathersjs/knex'
30
- import type { KnexAdapterParams, KnexAdapterOptions } from '@feathersjs/knex'
31
-
32
- import type { Application } from '${relative}/declarations'
33
- ${
34
- schema
35
- ? `import type {
36
- ${upperName},
37
- ${upperName}Data,
38
- ${upperName}Query
39
- } from './${fileName}.schema'
40
- `
41
- : `
42
- export type ${upperName} = any
43
- export type ${upperName}Data = any
44
- export type ${upperName}Query = any
45
- `
46
- }
47
-
48
- export interface ${upperName}Params extends KnexAdapterParams<${upperName}Query> {
49
- }
50
-
51
- // By default calls the standard Knex adapter service methods but can be customized with your own functionality.
52
- export class ${className}<ServiceParams extends Params = ${upperName}Params>
53
- extends KnexService<${upperName}, ${upperName}Data, ServiceParams> {
54
- }
55
-
56
- export const getOptions = (app: Application): KnexAdapterOptions => {
57
- return {
58
- paginate: app.get('paginate'),
59
- Model: app.get('${feathers.database}Client'),
60
- name: '${fileName}'
61
- }
62
- }
63
- `
64
-
65
- export const generate = (ctx: ServiceGeneratorContext) =>
66
- generator(ctx)
67
- .then(
68
- renderSource(
69
- template,
70
- toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
71
- lib,
72
- 'services',
73
- ...folder,
74
- `${fileName}.class`
75
- ])
76
- )
77
- )
78
- .then(
79
- renderSource(
80
- migrationTemplate,
81
- toFile<ServiceGeneratorContext>('migrations', ({ kebabName }) => {
82
- // Probably not great but it works to align with the Knex migration file format
83
- const migrationDate = new Date().toISOString().replace(/\D/g, '').substring(0, 14)
84
-
85
- return `${migrationDate}_${kebabName}`
86
- })
87
- )
88
- )
@@ -1,3 +0,0 @@
1
- import { ServiceGeneratorContext } from '../index';
2
- export declare const template: ({ className, upperName, schema, fileName, kebabPath, relative }: ServiceGeneratorContext) => string;
3
- export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
@@ -1,47 +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, kebabPath, relative }) => /* ts */ `import type { Params } from '@feathersjs/feathers'
7
- import { MongoDBService } from \'@feathersjs/mongodb\'
8
- import type { MongoDBAdapterParams, MongoDBAdapterOptions } from \'@feathersjs/mongodb\'
9
-
10
- import type { Application } from '${relative}/declarations'
11
- ${schema
12
- ? `import type {
13
- ${upperName},
14
- ${upperName}Data,
15
- ${upperName}Query
16
- } from './${fileName}.schema'
17
- `
18
- : `
19
- export type ${upperName} = any
20
- export type ${upperName}Data = any
21
- export type ${upperName}Query = any
22
- `}
23
-
24
- export interface ${upperName}Params extends MongoDBAdapterParams<${upperName}Query> {
25
- }
26
-
27
- // By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
28
- export class ${className}<ServiceParams extends Params = ${upperName}Params>
29
- extends MongoDBService<${upperName}, ${upperName}Data, ServiceParams> {
30
- }
31
-
32
- export const getOptions = (app: Application): MongoDBAdapterOptions => {
33
- return {
34
- paginate: app.get('paginate'),
35
- Model: app.get('mongodbClient').then(db => db.collection('${kebabPath}'))
36
- }
37
- }
38
- `;
39
- exports.template = template;
40
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(exports.template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
41
- lib,
42
- 'services',
43
- ...folder,
44
- `${fileName}.class`
45
- ])));
46
- exports.generate = generate;
47
- //# sourceMappingURL=mongodb.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mongodb.tpl.js","sourceRoot":"","sources":["../../../src/service/type/mongodb.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAGrC,MAAM,QAAQ,GAAG,CAAC,EACvB,SAAS,EACT,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;oCAIJ,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,uCAAuC,SAAS;;;;eAI7D,SAAS,mCAAmC,SAAS;2BACzC,SAAS,KAAK,SAAS;;;;;;gEAMc,SAAS;;;CAGxE,CAAA;AAzCY,QAAA,QAAQ,YAyCpB;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,59 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- export const template = ({
6
- className,
7
- upperName,
8
- schema,
9
- fileName,
10
- kebabPath,
11
- relative
12
- }: ServiceGeneratorContext) => /* ts */ `import type { Params } from '@feathersjs/feathers'
13
- import { MongoDBService } from \'@feathersjs/mongodb\'
14
- import type { MongoDBAdapterParams, MongoDBAdapterOptions } from \'@feathersjs/mongodb\'
15
-
16
- import type { Application } from '${relative}/declarations'
17
- ${
18
- schema
19
- ? `import type {
20
- ${upperName},
21
- ${upperName}Data,
22
- ${upperName}Query
23
- } from './${fileName}.schema'
24
- `
25
- : `
26
- export type ${upperName} = any
27
- export type ${upperName}Data = any
28
- export type ${upperName}Query = any
29
- `
30
- }
31
-
32
- export interface ${upperName}Params extends MongoDBAdapterParams<${upperName}Query> {
33
- }
34
-
35
- // By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
36
- export class ${className}<ServiceParams extends Params = ${upperName}Params>
37
- extends MongoDBService<${upperName}, ${upperName}Data, ServiceParams> {
38
- }
39
-
40
- export const getOptions = (app: Application): MongoDBAdapterOptions => {
41
- return {
42
- paginate: app.get('paginate'),
43
- Model: app.get('mongodbClient').then(db => db.collection('${kebabPath}'))
44
- }
45
- }
46
- `
47
-
48
- export const generate = (ctx: ServiceGeneratorContext) =>
49
- generator(ctx).then(
50
- renderSource(
51
- template,
52
- toFile<ServiceGeneratorContext>(({ lib, folder, fileName }) => [
53
- lib,
54
- 'services',
55
- ...folder,
56
- `${fileName}.class`
57
- ])
58
- )
59
- )