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

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 (155) hide show
  1. package/CHANGELOG.md +28 -28
  2. package/bin/feathers +3 -6
  3. package/lib/app/index.js +34 -11
  4. package/lib/app/index.js.map +1 -1
  5. package/lib/app/index.ts +81 -53
  6. package/lib/app/templates/app.test.tpl.js +1 -1
  7. package/lib/app/templates/app.test.tpl.js.map +1 -1
  8. package/lib/app/templates/app.test.tpl.ts +1 -2
  9. package/lib/app/templates/app.tpl.js +24 -12
  10. package/lib/app/templates/app.tpl.js.map +1 -1
  11. package/lib/app/templates/app.tpl.ts +28 -14
  12. package/lib/app/templates/channels.tpl.js +1 -1
  13. package/lib/app/templates/channels.tpl.js.map +1 -1
  14. package/lib/app/templates/channels.tpl.ts +1 -2
  15. package/lib/app/templates/client.tpl.js +3 -3
  16. package/lib/app/templates/client.tpl.js.map +1 -1
  17. package/lib/app/templates/client.tpl.ts +3 -4
  18. package/lib/app/templates/config.tpl.js +10 -1
  19. package/lib/app/templates/config.tpl.js.map +1 -1
  20. package/lib/app/templates/config.tpl.ts +10 -0
  21. package/lib/app/templates/declarations.tpl.js +3 -3
  22. package/lib/app/templates/declarations.tpl.js.map +1 -1
  23. package/lib/app/templates/declarations.tpl.ts +5 -4
  24. package/lib/app/templates/index.html.tpl.js +12 -52
  25. package/lib/app/templates/index.html.tpl.js.map +1 -1
  26. package/lib/app/templates/index.html.tpl.ts +12 -53
  27. package/lib/app/templates/index.tpl.js +1 -1
  28. package/lib/app/templates/index.tpl.js.map +1 -1
  29. package/lib/app/templates/index.tpl.ts +1 -2
  30. package/lib/app/templates/logger.tpl.js +1 -1
  31. package/lib/app/templates/logger.tpl.js.map +1 -1
  32. package/lib/app/templates/logger.tpl.ts +2 -2
  33. package/lib/app/templates/package.json.tpl.js +4 -3
  34. package/lib/app/templates/package.json.tpl.js.map +1 -1
  35. package/lib/app/templates/package.json.tpl.ts +5 -3
  36. package/lib/app/templates/readme.md.tpl.js +11 -7
  37. package/lib/app/templates/readme.md.tpl.js.map +1 -1
  38. package/lib/app/templates/readme.md.tpl.ts +15 -8
  39. package/lib/app/templates/{configuration.tpl.d.ts → schemas.tpl.d.ts} +0 -0
  40. package/lib/app/templates/schemas.tpl.js +76 -0
  41. package/lib/app/templates/schemas.tpl.js.map +1 -0
  42. package/lib/app/templates/schemas.tpl.ts +90 -0
  43. package/lib/app/templates/services.tpl.js +1 -1
  44. package/lib/app/templates/services.tpl.js.map +1 -1
  45. package/lib/app/templates/services.tpl.ts +1 -2
  46. package/lib/authentication/index.d.ts +4 -3
  47. package/lib/authentication/index.js +12 -3
  48. package/lib/authentication/index.js.map +1 -1
  49. package/lib/authentication/index.ts +23 -5
  50. package/lib/authentication/templates/authentication.tpl.js +4 -6
  51. package/lib/authentication/templates/authentication.tpl.js.map +1 -1
  52. package/lib/authentication/templates/authentication.tpl.ts +6 -9
  53. package/lib/authentication/templates/config.tpl.js +10 -6
  54. package/lib/authentication/templates/config.tpl.js.map +1 -1
  55. package/lib/authentication/templates/config.tpl.ts +40 -34
  56. package/lib/authentication/templates/declarations.tpl.js +3 -3
  57. package/lib/authentication/templates/declarations.tpl.js.map +1 -1
  58. package/lib/authentication/templates/declarations.tpl.ts +9 -4
  59. package/lib/authentication/templates/knex.tpl.js +5 -4
  60. package/lib/authentication/templates/knex.tpl.js.map +1 -1
  61. package/lib/authentication/templates/knex.tpl.ts +5 -4
  62. package/lib/authentication/templates/{user.resolver.tpl.d.ts → schema.json.tpl.d.ts} +0 -0
  63. package/lib/authentication/templates/schema.json.tpl.js +92 -0
  64. package/lib/authentication/templates/schema.json.tpl.js.map +1 -0
  65. package/lib/authentication/templates/schema.json.tpl.ts +108 -0
  66. package/lib/authentication/templates/{user.schema.tpl.d.ts → schema.typebox.tpl.d.ts} +1 -0
  67. package/lib/authentication/templates/schema.typebox.tpl.js +79 -0
  68. package/lib/authentication/templates/schema.typebox.tpl.js.map +1 -0
  69. package/lib/authentication/templates/schema.typebox.tpl.ts +94 -0
  70. package/lib/authentication/templates/test.tpl.js +2 -2
  71. package/lib/authentication/templates/test.tpl.js.map +1 -1
  72. package/lib/authentication/templates/test.tpl.ts +6 -3
  73. package/lib/cli.d.ts +6 -0
  74. package/lib/cli.js +75 -0
  75. package/lib/cli.js.map +1 -0
  76. package/lib/cli.ts +68 -0
  77. package/lib/commons.d.ts +14 -1
  78. package/lib/commons.js +24 -4
  79. package/lib/commons.js.map +1 -1
  80. package/lib/commons.ts +29 -1
  81. package/lib/connection/index.d.ts +5 -3
  82. package/lib/connection/index.js +5 -3
  83. package/lib/connection/index.js.map +1 -1
  84. package/lib/connection/index.ts +19 -5
  85. package/lib/connection/templates/knex.tpl.js +2 -12
  86. package/lib/connection/templates/knex.tpl.js.map +1 -1
  87. package/lib/connection/templates/knex.tpl.ts +6 -20
  88. package/lib/connection/templates/mongodb.tpl.js +1 -3
  89. package/lib/connection/templates/mongodb.tpl.js.map +1 -1
  90. package/lib/connection/templates/mongodb.tpl.ts +1 -12
  91. package/lib/hook/index.d.ts +1 -1
  92. package/lib/hook/index.js +3 -0
  93. package/lib/hook/index.js.map +1 -1
  94. package/lib/hook/index.ts +3 -1
  95. package/lib/hook/templates/hook.tpl.js +2 -3
  96. package/lib/hook/templates/hook.tpl.js.map +1 -1
  97. package/lib/hook/templates/hook.tpl.ts +5 -3
  98. package/lib/index.d.ts +2 -16
  99. package/lib/index.js +16 -24
  100. package/lib/index.js.map +1 -1
  101. package/lib/index.ts +2 -28
  102. package/lib/service/index.d.ts +10 -2
  103. package/lib/service/index.js +79 -41
  104. package/lib/service/index.js.map +1 -1
  105. package/lib/service/index.ts +54 -6
  106. package/lib/service/templates/client.tpl.js +26 -6
  107. package/lib/service/templates/client.tpl.js.map +1 -1
  108. package/lib/service/templates/client.tpl.ts +41 -12
  109. package/lib/service/templates/{class.tpl.d.ts → schema.json.tpl.d.ts} +0 -0
  110. package/lib/service/templates/schema.json.tpl.js +73 -0
  111. package/lib/service/templates/schema.json.tpl.js.map +1 -0
  112. package/lib/service/templates/schema.json.tpl.ts +85 -0
  113. package/lib/service/templates/{resolver.tpl.d.ts → schema.typebox.tpl.d.ts} +0 -0
  114. package/lib/service/templates/schema.typebox.tpl.js +58 -0
  115. package/lib/service/templates/schema.typebox.tpl.js.map +1 -0
  116. package/lib/service/templates/schema.typebox.tpl.ts +70 -0
  117. package/lib/service/templates/service.tpl.d.ts +1 -0
  118. package/lib/service/templates/service.tpl.js +67 -15
  119. package/lib/service/templates/service.tpl.js.map +1 -1
  120. package/lib/service/templates/service.tpl.ts +98 -19
  121. package/lib/service/templates/test.tpl.js +1 -1
  122. package/lib/service/templates/test.tpl.js.map +1 -1
  123. package/lib/service/templates/test.tpl.ts +1 -2
  124. package/lib/service/type/custom.tpl.d.ts +1 -2
  125. package/lib/service/type/custom.tpl.js +32 -25
  126. package/lib/service/type/custom.tpl.js.map +1 -1
  127. package/lib/service/type/custom.tpl.ts +44 -35
  128. package/lib/service/type/knex.tpl.d.ts +1 -3
  129. package/lib/service/type/knex.tpl.js +33 -23
  130. package/lib/service/type/knex.tpl.js.map +1 -1
  131. package/lib/service/type/knex.tpl.ts +51 -29
  132. package/lib/service/type/mongodb.tpl.d.ts +1 -2
  133. package/lib/service/type/mongodb.tpl.js +30 -20
  134. package/lib/service/type/mongodb.tpl.js.map +1 -1
  135. package/lib/service/type/mongodb.tpl.ts +47 -29
  136. package/package.json +23 -24
  137. package/lib/app/templates/configuration.tpl.js +0 -39
  138. package/lib/app/templates/configuration.tpl.js.map +0 -1
  139. package/lib/app/templates/configuration.tpl.ts +0 -44
  140. package/lib/authentication/templates/user.resolver.tpl.js +0 -98
  141. package/lib/authentication/templates/user.resolver.tpl.js.map +0 -1
  142. package/lib/authentication/templates/user.resolver.tpl.ts +0 -111
  143. package/lib/authentication/templates/user.schema.tpl.js +0 -79
  144. package/lib/authentication/templates/user.schema.tpl.js.map +0 -1
  145. package/lib/authentication/templates/user.schema.tpl.ts +0 -87
  146. package/lib/service/templates/class.tpl.js +0 -63
  147. package/lib/service/templates/class.tpl.js.map +0 -1
  148. package/lib/service/templates/class.tpl.ts +0 -79
  149. package/lib/service/templates/resolver.tpl.js +0 -73
  150. package/lib/service/templates/resolver.tpl.js.map +0 -1
  151. package/lib/service/templates/resolver.tpl.ts +0 -78
  152. package/lib/service/templates/schema.tpl.d.ts +0 -2
  153. package/lib/service/templates/schema.tpl.js +0 -75
  154. package/lib/service/templates/schema.tpl.js.map +0 -1
  155. package/lib/service/templates/schema.tpl.ts +0 -80
@@ -1,78 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- const template = ({ camelName, upperName, relative, fileName }: ServiceGeneratorContext) =>
6
- `import { resolve } from '@feathersjs/schema'
7
- import type { HookContext } from '${relative}/declarations'
8
-
9
- import type {
10
- ${upperName}Data,
11
- ${upperName}Patch,
12
- ${upperName}Result,
13
- ${upperName}Query,
14
- } from './${fileName}.schema'
15
- import {
16
- ${camelName}DataSchema,
17
- ${camelName}PatchSchema,
18
- ${camelName}ResultSchema,
19
- ${camelName}QuerySchema
20
- } from './${fileName}.schema'
21
-
22
-
23
- // Resolver for the basic data model (e.g. creating new entries)
24
- export const ${camelName}DataResolver = resolve<${upperName}Data, HookContext>({
25
- schema: ${camelName}DataSchema,
26
- validate: 'before',
27
- properties: {}
28
- })
29
-
30
-
31
- // Resolver for making partial updates
32
- export const ${camelName}PatchResolver = resolve<${upperName}Patch, HookContext>({
33
- schema: ${camelName}PatchSchema,
34
- validate: 'before',
35
- properties: {}
36
- })
37
-
38
-
39
- // Resolver for the data that is being returned
40
- export const ${camelName}ResultResolver = resolve<${upperName}Result, HookContext>({
41
- schema: ${camelName}ResultSchema,
42
- validate: false,
43
- properties: {}
44
- })
45
-
46
-
47
- // Resolver for query properties
48
- export const ${camelName}QueryResolver = resolve<${upperName}Query, HookContext>({
49
- schema: ${camelName}QuerySchema,
50
- validate: 'before',
51
- properties: {}
52
- })
53
-
54
-
55
- // Export all resolvers in a format that can be used with the resolveAll hook
56
- export const ${camelName}Resolvers = {
57
- result: ${camelName}ResultResolver,
58
- data: {
59
- create: ${camelName}DataResolver,
60
- update: ${camelName}DataResolver,
61
- patch: ${camelName}PatchResolver
62
- },
63
- query: ${camelName}QueryResolver
64
- }
65
- `
66
-
67
- export const generate = (ctx: ServiceGeneratorContext) =>
68
- generator(ctx).then(
69
- renderSource(
70
- template,
71
- toFile(({ lib, folder, fileName }: ServiceGeneratorContext) => [
72
- lib,
73
- 'services',
74
- ...folder,
75
- `${fileName}.resolver`
76
- ])
77
- )
78
- )
@@ -1,2 +0,0 @@
1
- import { ServiceGeneratorContext } from '../index';
2
- export declare const generate: (ctx: ServiceGeneratorContext) => Promise<ServiceGeneratorContext>;
@@ -1,75 +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, type }) => `import { schema, querySyntax } from '@feathersjs/schema'
7
- import type { Infer } from '@feathersjs/schema'
8
-
9
- // Schema for the basic data model (e.g. creating new entries)
10
- export const ${camelName}DataSchema = schema({
11
- $id: '${upperName}Data',
12
- type: 'object',
13
- additionalProperties: false,
14
- required: [ 'text' ],
15
- properties: {
16
- text: {
17
- type: 'string'
18
- }
19
- }
20
- } as const)
21
-
22
- export type ${upperName}Data = Infer<typeof ${camelName}DataSchema>
23
-
24
-
25
- // Schema for making partial updates
26
- export const ${camelName}PatchSchema = schema({
27
- $id: '${upperName}Patch',
28
- type: 'object',
29
- additionalProperties: false,
30
- required: [],
31
- properties: {
32
- ...${camelName}DataSchema.properties
33
- }
34
- } as const)
35
-
36
- export type ${upperName}Patch = Infer<typeof ${camelName}PatchSchema>
37
-
38
-
39
- // Schema for the data that is being returned
40
- export const ${camelName}ResultSchema = schema({
41
- $id: '${upperName}Result',
42
- type: 'object',
43
- additionalProperties: false,
44
- required: [ ...${camelName}DataSchema.required, '${type === 'mongodb' ? '_id' : 'id'}' ],
45
- properties: {
46
- ...${camelName}DataSchema.properties,
47
- ${type === 'mongodb' ? '_id' : 'id'}: {
48
- type: '${type === 'mongodb' ? 'string' : 'number'}'
49
- }
50
- }
51
- } as const)
52
-
53
- export type ${upperName}Result = Infer<typeof ${camelName}ResultSchema>
54
-
55
-
56
- // Schema for allowed query properties
57
- export const ${camelName}QuerySchema = schema({
58
- $id: '${upperName}Query',
59
- type: 'object',
60
- additionalProperties: false,
61
- properties: {
62
- ...querySyntax(${camelName}ResultSchema.properties)
63
- }
64
- } as const)
65
-
66
- export type ${upperName}Query = Infer<typeof ${camelName}QuerySchema>
67
- `;
68
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib, folder, fileName }) => [
69
- lib,
70
- 'services',
71
- ...folder,
72
- `${fileName}.schema`
73
- ])));
74
- exports.generate = generate;
75
- //# sourceMappingURL=schema.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.tpl.js","sourceRoot":"","sources":["../../../src/service/templates/schema.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAA2B,EAAE,EAAE,CAC3E;;;;eAIa,SAAS;UACd,SAAS;;;;;;;;;;;cAWL,SAAS,uBAAuB,SAAS;;;;eAIxC,SAAS;UACd,SAAS;;;;;SAKV,SAAS;;;;cAIJ,SAAS,wBAAwB,SAAS;;;;eAIzC,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;;;;;cAKzC,SAAS,yBAAyB,SAAS;;;;eAI1C,SAAS;UACd,SAAS;;;;qBAIE,SAAS;;;;cAIhB,SAAS,wBAAwB,SAAS;CACvD,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,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,CAAA;AAXU,QAAA,QAAQ,YAWlB"}
@@ -1,80 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { ServiceGeneratorContext } from '../index'
4
-
5
- const template = ({ camelName, upperName, type }: ServiceGeneratorContext) =>
6
- `import { schema, querySyntax } from '@feathersjs/schema'
7
- import type { Infer } from '@feathersjs/schema'
8
-
9
- // Schema for the basic data model (e.g. creating new entries)
10
- export const ${camelName}DataSchema = schema({
11
- $id: '${upperName}Data',
12
- type: 'object',
13
- additionalProperties: false,
14
- required: [ 'text' ],
15
- properties: {
16
- text: {
17
- type: 'string'
18
- }
19
- }
20
- } as const)
21
-
22
- export type ${upperName}Data = Infer<typeof ${camelName}DataSchema>
23
-
24
-
25
- // Schema for making partial updates
26
- export const ${camelName}PatchSchema = schema({
27
- $id: '${upperName}Patch',
28
- type: 'object',
29
- additionalProperties: false,
30
- required: [],
31
- properties: {
32
- ...${camelName}DataSchema.properties
33
- }
34
- } as const)
35
-
36
- export type ${upperName}Patch = Infer<typeof ${camelName}PatchSchema>
37
-
38
-
39
- // Schema for the data that is being returned
40
- export const ${camelName}ResultSchema = schema({
41
- $id: '${upperName}Result',
42
- type: 'object',
43
- additionalProperties: false,
44
- required: [ ...${camelName}DataSchema.required, '${type === 'mongodb' ? '_id' : 'id'}' ],
45
- properties: {
46
- ...${camelName}DataSchema.properties,
47
- ${type === 'mongodb' ? '_id' : 'id'}: {
48
- type: '${type === 'mongodb' ? 'string' : 'number'}'
49
- }
50
- }
51
- } as const)
52
-
53
- export type ${upperName}Result = Infer<typeof ${camelName}ResultSchema>
54
-
55
-
56
- // Schema for allowed query properties
57
- export const ${camelName}QuerySchema = schema({
58
- $id: '${upperName}Query',
59
- type: 'object',
60
- additionalProperties: false,
61
- properties: {
62
- ...querySyntax(${camelName}ResultSchema.properties)
63
- }
64
- } as const)
65
-
66
- export type ${upperName}Query = Infer<typeof ${camelName}QuerySchema>
67
- `
68
-
69
- export const generate = (ctx: ServiceGeneratorContext) =>
70
- generator(ctx).then(
71
- renderSource(
72
- template,
73
- toFile(({ lib, folder, fileName }: ServiceGeneratorContext) => [
74
- lib,
75
- 'services',
76
- ...folder,
77
- `${fileName}.schema`
78
- ])
79
- )
80
- )