@feathersjs/cli 5.0.0-pre.30 → 5.0.0-pre.32

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 (76) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/lib/app/index.js +5 -5
  3. package/lib/app/index.js.map +1 -1
  4. package/lib/app/index.ts +13 -12
  5. package/lib/app/templates/app.tpl.js +7 -8
  6. package/lib/app/templates/app.tpl.js.map +1 -1
  7. package/lib/app/templates/app.tpl.ts +11 -8
  8. package/lib/app/templates/channels.tpl.js +4 -30
  9. package/lib/app/templates/channels.tpl.js.map +1 -1
  10. package/lib/app/templates/channels.tpl.ts +6 -30
  11. package/lib/app/templates/client.test.tpl.d.ts +2 -0
  12. package/lib/app/templates/client.test.tpl.js +27 -0
  13. package/lib/app/templates/client.test.tpl.js.map +1 -0
  14. package/lib/app/templates/client.test.tpl.ts +26 -0
  15. package/lib/app/templates/client.tpl.js +17 -3
  16. package/lib/app/templates/client.tpl.js.map +1 -1
  17. package/lib/app/templates/client.tpl.ts +20 -3
  18. package/lib/app/templates/declarations.tpl.js +3 -0
  19. package/lib/app/templates/declarations.tpl.js.map +1 -1
  20. package/lib/app/templates/declarations.tpl.ts +3 -0
  21. package/lib/app/templates/logger.tpl.js +8 -2
  22. package/lib/app/templates/logger.tpl.js.map +1 -1
  23. package/lib/app/templates/logger.tpl.ts +8 -2
  24. package/lib/app/templates/schemas.tpl.js +4 -5
  25. package/lib/app/templates/schemas.tpl.js.map +1 -1
  26. package/lib/app/templates/schemas.tpl.ts +4 -5
  27. package/lib/authentication/index.d.ts +3 -0
  28. package/lib/authentication/index.js +5 -1
  29. package/lib/authentication/index.js.map +1 -1
  30. package/lib/authentication/index.ts +5 -0
  31. package/lib/authentication/templates/authentication.tpl.js +5 -4
  32. package/lib/authentication/templates/authentication.tpl.js.map +1 -1
  33. package/lib/authentication/templates/authentication.tpl.ts +5 -5
  34. package/lib/authentication/templates/{test.tpl.d.ts → client.test.tpl.d.ts} +0 -0
  35. package/lib/authentication/templates/client.test.tpl.js +61 -0
  36. package/lib/authentication/templates/client.test.tpl.js.map +1 -0
  37. package/lib/authentication/templates/client.test.tpl.ts +73 -0
  38. package/lib/authentication/templates/client.tpl.d.ts +2 -0
  39. package/lib/authentication/templates/client.tpl.js +14 -0
  40. package/lib/authentication/templates/client.tpl.js.map +1 -0
  41. package/lib/authentication/templates/client.tpl.ts +19 -0
  42. package/lib/authentication/templates/declarations.tpl.js +1 -1
  43. package/lib/authentication/templates/declarations.tpl.ts +1 -1
  44. package/lib/authentication/templates/knex.tpl.js +3 -3
  45. package/lib/authentication/templates/knex.tpl.ts +3 -3
  46. package/lib/authentication/templates/schema.json.tpl.js +26 -25
  47. package/lib/authentication/templates/schema.json.tpl.js.map +1 -1
  48. package/lib/authentication/templates/schema.json.tpl.ts +26 -26
  49. package/lib/authentication/templates/schema.typebox.tpl.js +26 -27
  50. package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -1
  51. package/lib/authentication/templates/schema.typebox.tpl.ts +28 -28
  52. package/lib/service/index.d.ts +5 -63
  53. package/lib/service/index.js +74 -75
  54. package/lib/service/index.js.map +1 -1
  55. package/lib/service/index.ts +10 -4
  56. package/lib/service/templates/client.tpl.js +15 -20
  57. package/lib/service/templates/client.tpl.js.map +1 -1
  58. package/lib/service/templates/client.tpl.ts +29 -25
  59. package/lib/service/templates/schema.json.tpl.js +24 -22
  60. package/lib/service/templates/schema.json.tpl.js.map +1 -1
  61. package/lib/service/templates/schema.json.tpl.ts +24 -22
  62. package/lib/service/templates/schema.typebox.tpl.js +22 -25
  63. package/lib/service/templates/schema.typebox.tpl.js.map +1 -1
  64. package/lib/service/templates/schema.typebox.tpl.ts +22 -25
  65. package/lib/service/type/knex.tpl.d.ts +1 -1
  66. package/lib/service/type/knex.tpl.js +10 -8
  67. package/lib/service/type/knex.tpl.js.map +1 -1
  68. package/lib/service/type/knex.tpl.ts +10 -9
  69. package/lib/service/type/mongodb.tpl.d.ts +1 -1
  70. package/lib/service/type/mongodb.tpl.js +7 -5
  71. package/lib/service/type/mongodb.tpl.js.map +1 -1
  72. package/lib/service/type/mongodb.tpl.ts +8 -6
  73. package/package.json +18 -16
  74. package/lib/authentication/templates/test.tpl.js +0 -43
  75. package/lib/authentication/templates/test.tpl.js.map +0 -1
  76. package/lib/authentication/templates/test.tpl.ts +0 -53
@@ -1,53 +1,57 @@
1
- import { generator, inject, toFile, when, after, before } from '@feathershq/pinion'
1
+ import { generator, toFile, when, after, before } from '@feathershq/pinion'
2
2
  import { injectSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
- const schemaImports = ({ upperName, folder, fileName }: ServiceGeneratorContext) => /* ts */ `import type {
5
+ const importTemplate = ({
6
+ upperName,
7
+ folder,
8
+ fileName,
9
+ className
10
+ }: ServiceGeneratorContext) => /* ts */ `import type {
6
11
  ${upperName},
7
12
  ${upperName}Data,
8
13
  ${upperName}Query,
14
+ ${className}
9
15
  } from './services/${folder.join('/')}/${fileName}'
10
-
11
16
  export type {
12
17
  ${upperName},
13
18
  ${upperName}Data,
14
- ${upperName}Query,
15
- }`
19
+ ${upperName}Query
20
+ }
21
+ `
22
+
23
+ const methodsTemplate = ({ camelName, upperName, className, type }: ServiceGeneratorContext) => `
24
+ const ${camelName}ServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'] as const
25
+ type ${upperName}ClientService = Pick<${className}${
26
+ type !== 'custom' ? `<Params<${upperName}Query>>` : ''
27
+ }, typeof ${camelName}ServiceMethods[number]>`
16
28
 
17
29
  const declarationTemplate = ({ path, upperName }: ServiceGeneratorContext) =>
18
- ` '${path}': ClientService<
19
- ${upperName},
20
- ${upperName}Data,
21
- Partial<${upperName}Data>,
22
- Paginated<${upperName}>,
23
- Params<${upperName}Query>
24
- > & {
25
- // Add custom methods here
26
- }`
30
+ ` '${path}': ${upperName}ClientService`
27
31
 
28
32
  const registrationTemplate = ({
33
+ camelName,
29
34
  path
30
35
  }: ServiceGeneratorContext) => ` client.use('${path}', connection.service('${path}'), {
31
- // List all standard and custom methods
32
- methods: ['find', 'get', 'create', 'update', 'patch', 'remove']
33
- })
34
- `
36
+ methods: ${camelName}ServiceMethods
37
+ })`
35
38
 
36
- const toClientFile = toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client.ts'])
39
+ const toClientFile = toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'])
37
40
 
38
41
  export const generate = async (ctx: ServiceGeneratorContext) =>
39
42
  generator(ctx)
43
+ .then(injectSource(registrationTemplate, before('return client'), toClientFile))
40
44
  .then(
41
- injectSource(
42
- registrationTemplate,
43
- before('return client'),
44
- toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'])
45
+ when(
46
+ (ctx) => ctx.language === 'js',
47
+ injectSource(methodsTemplate, after('import authenticationClient'), toClientFile)
45
48
  )
46
49
  )
47
50
  .then(
48
51
  when(
49
52
  (ctx) => ctx.language === 'ts',
50
- inject(schemaImports, after("from '@feathersjs/feathers'"), toClientFile),
51
- inject(declarationTemplate, after('export interface ServiceTypes'), toClientFile)
53
+ injectSource(importTemplate, after('import authenticationClient'), toClientFile),
54
+ injectSource(methodsTemplate, before('\nexport interface ServiceTypes'), toClientFile),
55
+ injectSource(declarationTemplate, after('export interface ServiceTypes'), toClientFile)
52
56
  )
53
57
  )
@@ -3,48 +3,50 @@ 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 = ({ camelName, upperName, relative, type }) => /* ts */ `import { jsonSchema, resolve } from '@feathersjs/schema'
6
+ const template = ({ camelName, upperName, relative, type }) => /* ts */ `import { resolve, getDataValidator, getValidator, querySyntax } from '@feathersjs/schema'
7
7
  import type { FromSchema } from '@feathersjs/schema'
8
8
 
9
9
  import type { HookContext } from '${relative}/declarations'
10
10
  import { dataValidator, queryValidator } from '${relative}/schemas/validators'
11
11
 
12
- // Schema for the basic data model (e.g. creating new entries)
13
- export const ${camelName}DataSchema = {
14
- $id: '${upperName}Data',
12
+ // Main data model schema
13
+ export const ${camelName}Schema = {
14
+ $id: '${upperName}',
15
15
  type: 'object',
16
16
  additionalProperties: false,
17
- required: [ 'text' ],
17
+ required: [ '${type === 'mongodb' ? '_id' : 'id'}', 'text' ],
18
18
  properties: {
19
+ ${type === 'mongodb' ? '_id' : 'id'}: {
20
+ type: '${type === 'mongodb' ? 'string' : 'number'}'
21
+ },
19
22
  text: {
20
23
  type: 'string'
21
24
  }
22
25
  }
23
26
  } as const
24
- export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
25
- export const ${camelName}DataValidator = jsonSchema.getDataValidator(${camelName}DataSchema, dataValidator)
26
- export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
27
+ export type ${upperName} = FromSchema<typeof ${camelName}Schema>
28
+ export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
29
+ properties: {}
30
+ })
31
+ export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
27
32
  properties: {}
28
33
  })
29
34
 
30
- // Schema for the data that is being returned
31
- export const ${camelName}Schema = {
32
- $id: '${upperName}',
35
+ // Schema for creating new data
36
+ export const ${camelName}DataSchema = {
37
+ $id: '${upperName}Data',
33
38
  type: 'object',
34
39
  additionalProperties: false,
35
- required: [ ...${camelName}DataSchema.required, '${type === 'mongodb' ? '_id' : 'id'}' ],
40
+ required: [ 'text' ],
36
41
  properties: {
37
- ...${camelName}DataSchema.properties,
38
- ${type === 'mongodb' ? '_id' : 'id'}: {
39
- type: '${type === 'mongodb' ? 'string' : 'number'}'
42
+ text: {
43
+ type: 'string'
40
44
  }
41
45
  }
42
46
  } as const
43
- export type ${upperName} = FromSchema<typeof ${camelName}Schema>
44
- export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
45
- properties: {}
46
- })
47
- export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
47
+ export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
48
+ export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
49
+ export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
48
50
  properties: {}
49
51
  })
50
52
 
@@ -54,11 +56,11 @@ export const ${camelName}QuerySchema = {
54
56
  type: 'object',
55
57
  additionalProperties: false,
56
58
  properties: {
57
- ...jsonSchema.querySyntax(${camelName}Schema.properties)
59
+ ...querySyntax(${camelName}Schema.properties)
58
60
  }
59
61
  } as const
60
62
  export type ${upperName}Query = FromSchema<typeof ${camelName}QuerySchema>
61
- export const ${camelName}QueryValidator = jsonSchema.getValidator(${camelName}QuerySchema, queryValidator)
63
+ export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
62
64
  export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
63
65
  properties: {}
64
66
  })
@@ -1 +1 @@
1
- {"version":3,"file":"schema.json.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.json.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;;;oCAGJ,QAAQ;iDACK,QAAQ;;;eAG1C,SAAS;UACd,SAAS;;;;;;;;;;cAUL,SAAS,4BAA4B,SAAS;eAC7C,SAAS,+CAA+C,SAAS;eACjE,SAAS,0BAA0B,SAAS;;;;;eAK5C,SAAS;UACd,SAAS;;;mBAGA,SAAS,yBAAyB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;;SAE7E,SAAS;MACZ,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;eACxB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;;;;cA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SAAS;;;eAGxC,SAAS,8BAA8B,SAAS;;;;;eAKhD,SAAS;UACd,SAAS;;;;;;;;;;cAUL,SAAS,4BAA4B,SAAS;eAC7C,SAAS,oCAAoC,SAAS;eACtD,SAAS,0BAA0B,SAAS;;;;;eAK5C,SAAS;UACd,SAAS;;;;qBAIE,SAAS;;;cAGhB,SAAS,6BAA6B,SAAS;eAC9C,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,MAAM,EACjC,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"}
@@ -7,48 +7,50 @@ const template = ({
7
7
  upperName,
8
8
  relative,
9
9
  type
10
- }: ServiceGeneratorContext) => /* ts */ `import { jsonSchema, resolve } from '@feathersjs/schema'
10
+ }: ServiceGeneratorContext) => /* ts */ `import { resolve, getDataValidator, getValidator, querySyntax } from '@feathersjs/schema'
11
11
  import type { FromSchema } from '@feathersjs/schema'
12
12
 
13
13
  import type { HookContext } from '${relative}/declarations'
14
14
  import { dataValidator, queryValidator } from '${relative}/schemas/validators'
15
15
 
16
- // Schema for the basic data model (e.g. creating new entries)
17
- export const ${camelName}DataSchema = {
18
- $id: '${upperName}Data',
16
+ // Main data model schema
17
+ export const ${camelName}Schema = {
18
+ $id: '${upperName}',
19
19
  type: 'object',
20
20
  additionalProperties: false,
21
- required: [ 'text' ],
21
+ required: [ '${type === 'mongodb' ? '_id' : 'id'}', 'text' ],
22
22
  properties: {
23
+ ${type === 'mongodb' ? '_id' : 'id'}: {
24
+ type: '${type === 'mongodb' ? 'string' : 'number'}'
25
+ },
23
26
  text: {
24
27
  type: 'string'
25
28
  }
26
29
  }
27
30
  } as const
28
- export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
29
- export const ${camelName}DataValidator = jsonSchema.getDataValidator(${camelName}DataSchema, dataValidator)
30
- export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
31
+ export type ${upperName} = FromSchema<typeof ${camelName}Schema>
32
+ export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
33
+ properties: {}
34
+ })
35
+ export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
31
36
  properties: {}
32
37
  })
33
38
 
34
- // Schema for the data that is being returned
35
- export const ${camelName}Schema = {
36
- $id: '${upperName}',
39
+ // Schema for creating new data
40
+ export const ${camelName}DataSchema = {
41
+ $id: '${upperName}Data',
37
42
  type: 'object',
38
43
  additionalProperties: false,
39
- required: [ ...${camelName}DataSchema.required, '${type === 'mongodb' ? '_id' : 'id'}' ],
44
+ required: [ 'text' ],
40
45
  properties: {
41
- ...${camelName}DataSchema.properties,
42
- ${type === 'mongodb' ? '_id' : 'id'}: {
43
- type: '${type === 'mongodb' ? 'string' : 'number'}'
46
+ text: {
47
+ type: 'string'
44
48
  }
45
49
  }
46
50
  } as const
47
- export type ${upperName} = FromSchema<typeof ${camelName}Schema>
48
- export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
49
- properties: {}
50
- })
51
- export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
51
+ export type ${upperName}Data = FromSchema<typeof ${camelName}DataSchema>
52
+ export const ${camelName}DataValidator = getDataValidator(${camelName}DataSchema, dataValidator)
53
+ export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
52
54
  properties: {}
53
55
  })
54
56
 
@@ -58,11 +60,11 @@ export const ${camelName}QuerySchema = {
58
60
  type: 'object',
59
61
  additionalProperties: false,
60
62
  properties: {
61
- ...jsonSchema.querySyntax(${camelName}Schema.properties)
63
+ ...querySyntax(${camelName}Schema.properties)
62
64
  }
63
65
  } as const
64
66
  export type ${upperName}Query = FromSchema<typeof ${camelName}QuerySchema>
65
- export const ${camelName}QueryValidator = jsonSchema.getValidator(${camelName}QuerySchema, queryValidator)
67
+ export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
66
68
  export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
67
69
  properties: {}
68
70
  })
@@ -3,30 +3,18 @@ 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 = ({ camelName, upperName, relative, type }) => /* ts */ `import { jsonSchema, resolve } from '@feathersjs/schema'
7
- import { Type, querySyntax } from '@feathersjs/typebox'
6
+ const template = ({ camelName, upperName, relative, type }) => /* ts */ `import { resolve } from '@feathersjs/schema'
7
+ import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
8
8
  import type { Static } from '@feathersjs/typebox'
9
9
 
10
10
  import type { HookContext } from '${relative}/declarations'
11
11
  import { dataValidator, queryValidator } from '${relative}/schemas/validators'
12
12
 
13
- // Schema for the basic data model (e.g. creating new entries)
14
- export const ${camelName}DataSchema = Type.Object({
15
- text: Type.String()
16
- }, { $id: '${upperName}Data', additionalProperties: false })
17
- export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
18
- export const ${camelName}DataValidator = jsonSchema.getDataValidator(${camelName}DataSchema, dataValidator)
19
- export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
20
- properties: {}
21
- })
22
-
23
- // Schema for the data that is being returned
24
- export const ${camelName}Schema = Type.Intersect([
25
- ${camelName}DataSchema,
26
- Type.Object({
27
- ${type === 'mongodb' ? '_id: Type.String()' : 'id: Type.Number()'}
28
- })
29
- ], { $id: '${upperName}', additionalProperties: false })
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 })
30
18
  export type ${upperName} = Static<typeof ${camelName}Schema>
31
19
  export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
32
20
  properties: {}
@@ -36,14 +24,23 @@ export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
36
24
  properties: {}
37
25
  })
38
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
+
39
37
  // Schema for allowed query properties
40
- export const ${camelName}QuerySchema = Type.Intersect([
41
- querySyntax(${camelName}Schema),
42
- // Add additional query properties here
43
- Type.Object({})
44
- ])
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)
45
42
  export type ${upperName}Query = Static<typeof ${camelName}QuerySchema>
46
- export const ${camelName}QueryValidator = jsonSchema.getValidator(${camelName}QuerySchema, queryValidator)
43
+ export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
47
44
  export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
48
45
  properties: {}
49
46
  })
@@ -1 +1 @@
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,QA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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"}
@@ -7,30 +7,18 @@ const template = ({
7
7
  upperName,
8
8
  relative,
9
9
  type
10
- }: ServiceGeneratorContext) => /* ts */ `import { jsonSchema, resolve } from '@feathersjs/schema'
11
- import { Type, querySyntax } from '@feathersjs/typebox'
10
+ }: ServiceGeneratorContext) => /* ts */ `import { resolve } from '@feathersjs/schema'
11
+ import { Type, getDataValidator, getValidator, querySyntax } from '@feathersjs/typebox'
12
12
  import type { Static } from '@feathersjs/typebox'
13
13
 
14
14
  import type { HookContext } from '${relative}/declarations'
15
15
  import { dataValidator, queryValidator } from '${relative}/schemas/validators'
16
16
 
17
- // Schema for the basic data model (e.g. creating new entries)
18
- export const ${camelName}DataSchema = Type.Object({
19
- text: Type.String()
20
- }, { $id: '${upperName}Data', additionalProperties: false })
21
- export type ${upperName}Data = Static<typeof ${camelName}DataSchema>
22
- export const ${camelName}DataValidator = jsonSchema.getDataValidator(${camelName}DataSchema, dataValidator)
23
- export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
24
- properties: {}
25
- })
26
-
27
- // Schema for the data that is being returned
28
- export const ${camelName}Schema = Type.Intersect([
29
- ${camelName}DataSchema,
30
- Type.Object({
31
- ${type === 'mongodb' ? '_id: Type.String()' : 'id: Type.Number()'}
32
- })
33
- ], { $id: '${upperName}', additionalProperties: false })
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 })
34
22
  export type ${upperName} = Static<typeof ${camelName}Schema>
35
23
  export const ${camelName}Resolver = resolve<${upperName}, HookContext>({
36
24
  properties: {}
@@ -40,14 +28,23 @@ export const ${camelName}ExternalResolver = resolve<${upperName}, HookContext>({
40
28
  properties: {}
41
29
  })
42
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
+
43
41
  // Schema for allowed query properties
44
- export const ${camelName}QuerySchema = Type.Intersect([
45
- querySyntax(${camelName}Schema),
46
- // Add additional query properties here
47
- Type.Object({})
48
- ])
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)
49
46
  export type ${upperName}Query = Static<typeof ${camelName}QuerySchema>
50
- export const ${camelName}QueryValidator = jsonSchema.getValidator(${camelName}QuerySchema, queryValidator)
47
+ export const ${camelName}QueryValidator = getValidator(${camelName}QuerySchema, queryValidator)
51
48
  export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
52
49
  properties: {}
53
50
  })
@@ -1,3 +1,3 @@
1
1
  import { ServiceGeneratorContext } from '../index';
2
- export declare const template: ({ className, upperName, kebabName, feathers, schema, fileName, relative }: ServiceGeneratorContext) => string;
2
+ export declare const template: ({ className, upperName, feathers, schema, fileName, relative }: ServiceGeneratorContext) => string;
3
3
  export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
@@ -3,21 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = exports.template = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const migrationTemplate = ({ kebabName }) => /* ts */ `import type { Knex } from 'knex'
6
+ const migrationTemplate = ({ kebabPath }) => /* ts */ `import type { Knex } from 'knex'
7
7
 
8
8
  export async function up(knex: Knex): Promise<void> {
9
- await knex.schema.createTable('${kebabName}', table => {
9
+ await knex.schema.createTable('${kebabPath}', table => {
10
10
  table.increments('id')
11
11
  table.string('text')
12
12
  })
13
13
  }
14
14
 
15
15
  export async function down(knex: Knex): Promise<void> {
16
- await knex.schema.dropTable('${kebabName}')
16
+ await knex.schema.dropTable('${kebabPath}')
17
17
  }
18
18
  `;
19
- const template = ({ className, upperName, kebabName, feathers, schema, fileName, relative }) => /* ts */ `import { KnexService } from '@feathersjs/knex'
20
- import type { KnexAdapterParams } from '@feathersjs/knex'
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'
21
22
 
22
23
  import type { Application } from '${relative}/declarations'
23
24
  ${schema
@@ -37,14 +38,15 @@ export interface ${upperName}Params extends KnexAdapterParams<${upperName}Query>
37
38
  }
38
39
 
39
40
  // By default calls the standard Knex adapter service methods but can be customized with your own functionality.
40
- export class ${className} extends KnexService<${upperName}, ${upperName}Data, ${upperName}Params> {
41
+ export class ${className}<ServiceParams extends Params = ${upperName}Params>
42
+ extends KnexService<${upperName}, ${upperName}Data, ServiceParams> {
41
43
  }
42
44
 
43
- export const getOptions = (app: Application) => {
45
+ export const getOptions = (app: Application): KnexAdapterOptions => {
44
46
  return {
45
47
  paginate: app.get('paginate'),
46
48
  Model: app.get('${feathers.database}Client'),
47
- name: '${kebabName}'
49
+ name: '${fileName}'
48
50
  }
49
51
  }
50
52
  `;
@@ -1 +1 @@
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,SAAS,EACT,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACgB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;oCAGJ,QAAQ;EAE1C,MAAM;IACJ,CAAC,CAAC;IACF,SAAS;IACT,SAAS;IACT,SAAS;YACD,QAAQ;CACnB;IACG,CAAC,CAAC;cACQ,SAAS;cACT,SAAS;cACT,SAAS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AAQ,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"}
@@ -3,31 +3,31 @@ import { renderSource } from '../../commons'
3
3
  import { ServiceGeneratorContext } from '../index'
4
4
 
5
5
  const migrationTemplate = ({
6
- kebabName
6
+ kebabPath
7
7
  }: ServiceGeneratorContext) => /* ts */ `import type { Knex } from 'knex'
8
8
 
9
9
  export async function up(knex: Knex): Promise<void> {
10
- await knex.schema.createTable('${kebabName}', table => {
10
+ await knex.schema.createTable('${kebabPath}', table => {
11
11
  table.increments('id')
12
12
  table.string('text')
13
13
  })
14
14
  }
15
15
 
16
16
  export async function down(knex: Knex): Promise<void> {
17
- await knex.schema.dropTable('${kebabName}')
17
+ await knex.schema.dropTable('${kebabPath}')
18
18
  }
19
19
  `
20
20
 
21
21
  export const template = ({
22
22
  className,
23
23
  upperName,
24
- kebabName,
25
24
  feathers,
26
25
  schema,
27
26
  fileName,
28
27
  relative
29
- }: ServiceGeneratorContext) => /* ts */ `import { KnexService } from '@feathersjs/knex'
30
- import type { KnexAdapterParams } from '@feathersjs/knex'
28
+ }: ServiceGeneratorContext) => /* ts */ `import type { Params } from '@feathersjs/feathers'
29
+ import { KnexService } from '@feathersjs/knex'
30
+ import type { KnexAdapterParams, KnexAdapterOptions } from '@feathersjs/knex'
31
31
 
32
32
  import type { Application } from '${relative}/declarations'
33
33
  ${
@@ -49,14 +49,15 @@ export interface ${upperName}Params extends KnexAdapterParams<${upperName}Query>
49
49
  }
50
50
 
51
51
  // By default calls the standard Knex adapter service methods but can be customized with your own functionality.
52
- export class ${className} extends KnexService<${upperName}, ${upperName}Data, ${upperName}Params> {
52
+ export class ${className}<ServiceParams extends Params = ${upperName}Params>
53
+ extends KnexService<${upperName}, ${upperName}Data, ServiceParams> {
53
54
  }
54
55
 
55
- export const getOptions = (app: Application) => {
56
+ export const getOptions = (app: Application): KnexAdapterOptions => {
56
57
  return {
57
58
  paginate: app.get('paginate'),
58
59
  Model: app.get('${feathers.database}Client'),
59
- name: '${kebabName}'
60
+ name: '${fileName}'
60
61
  }
61
62
  }
62
63
  `
@@ -1,3 +1,3 @@
1
1
  import { ServiceGeneratorContext } from '../index';
2
- export declare const template: ({ className, upperName, kebabName, schema, fileName, relative }: ServiceGeneratorContext) => string;
2
+ export declare const template: ({ className, upperName, schema, fileName, kebabPath, relative }: ServiceGeneratorContext) => string;
3
3
  export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate = exports.template = void 0;
4
4
  const pinion_1 = require("@feathershq/pinion");
5
5
  const commons_1 = require("../../commons");
6
- const template = ({ className, upperName, kebabName, schema, fileName, relative }) => /* ts */ `import { MongoDBService } from \'@feathersjs/mongodb\'
7
- import type { MongoDBAdapterParams } from \'@feathersjs/mongodb\'
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\'
8
9
 
9
10
  import type { Application } from '${relative}/declarations'
10
11
  ${schema
@@ -24,13 +25,14 @@ export interface ${upperName}Params extends MongoDBAdapterParams<${upperName}Que
24
25
  }
25
26
 
26
27
  // By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
27
- export class ${className} extends MongoDBService<${upperName}, ${upperName}Data, ${upperName}Params> {
28
+ export class ${className}<ServiceParams extends Params = ${upperName}Params>
29
+ extends MongoDBService<${upperName}, ${upperName}Data, ServiceParams> {
28
30
  }
29
31
 
30
- export const getOptions = (app: Application) => {
32
+ export const getOptions = (app: Application): MongoDBAdapterOptions => {
31
33
  return {
32
34
  paginate: app.get('paginate'),
33
- Model: app.get('mongodbClient').then(db => db.collection('${kebabName}'))
35
+ Model: app.get('mongodbClient').then(db => db.collection('${kebabPath}'))
34
36
  }
35
37
  }
36
38
  `;
@@ -1 +1 @@
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,SAAS,EACT,M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c,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"}
@@ -5,12 +5,13 @@ import { ServiceGeneratorContext } from '../index'
5
5
  export const template = ({
6
6
  className,
7
7
  upperName,
8
- kebabName,
9
8
  schema,
10
9
  fileName,
10
+ kebabPath,
11
11
  relative
12
- }: ServiceGeneratorContext) => /* ts */ `import { MongoDBService } from \'@feathersjs/mongodb\'
13
- import type { MongoDBAdapterParams } from \'@feathersjs/mongodb\'
12
+ }: ServiceGeneratorContext) => /* ts */ `import type { Params } from '@feathersjs/feathers'
13
+ import { MongoDBService } from \'@feathersjs/mongodb\'
14
+ import type { MongoDBAdapterParams, MongoDBAdapterOptions } from \'@feathersjs/mongodb\'
14
15
 
15
16
  import type { Application } from '${relative}/declarations'
16
17
  ${
@@ -32,13 +33,14 @@ export interface ${upperName}Params extends MongoDBAdapterParams<${upperName}Que
32
33
  }
33
34
 
34
35
  // By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
35
- export class ${className} extends MongoDBService<${upperName}, ${upperName}Data, ${upperName}Params> {
36
+ export class ${className}<ServiceParams extends Params = ${upperName}Params>
37
+ extends MongoDBService<${upperName}, ${upperName}Data, ServiceParams> {
36
38
  }
37
39
 
38
- export const getOptions = (app: Application) => {
40
+ export const getOptions = (app: Application): MongoDBAdapterOptions => {
39
41
  return {
40
42
  paginate: app.get('paginate'),
41
- Model: app.get('mongodbClient').then(db => db.collection('${kebabName}'))
43
+ Model: app.get('mongodbClient').then(db => db.collection('${kebabPath}'))
42
44
  }
43
45
  }
44
46
  `