@feathersjs/cli 5.0.0-pre.34 → 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 (171) hide show
  1. package/CHANGELOG.md +13 -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 +28 -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 -228
  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 -49
  13. package/lib/app/templates/app.test.tpl.js.map +0 -1
  14. package/lib/app/templates/app.test.tpl.ts +0 -50
  15. package/lib/app/templates/app.tpl.d.ts +0 -2
  16. package/lib/app/templates/app.tpl.js +0 -123
  17. package/lib/app/templates/app.tpl.js.map +0 -1
  18. package/lib/app/templates/app.tpl.ts +0 -138
  19. package/lib/app/templates/channels.tpl.d.ts +0 -2
  20. package/lib/app/templates/channels.tpl.js +0 -49
  21. package/lib/app/templates/channels.tpl.js.map +0 -1
  22. package/lib/app/templates/channels.tpl.ts +0 -55
  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 -38
  29. package/lib/app/templates/client.tpl.js.map +0 -1
  30. package/lib/app/templates/client.tpl.ts +0 -45
  31. package/lib/app/templates/configuration.tpl.d.ts +0 -2
  32. package/lib/app/templates/configuration.tpl.js +0 -71
  33. package/lib/app/templates/configuration.tpl.js.map +0 -1
  34. package/lib/app/templates/configuration.tpl.ts +0 -82
  35. package/lib/app/templates/declarations.tpl.d.ts +0 -2
  36. package/lib/app/templates/declarations.tpl.js +0 -28
  37. package/lib/app/templates/declarations.tpl.js.map +0 -1
  38. package/lib/app/templates/declarations.tpl.ts +0 -37
  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 -3
  48. package/lib/app/templates/logger.tpl.js +0 -45
  49. package/lib/app/templates/logger.tpl.js.map +0 -1
  50. package/lib/app/templates/logger.tpl.ts +0 -56
  51. package/lib/app/templates/package.json.tpl.d.ts +0 -2
  52. package/lib/app/templates/package.json.tpl.js +0 -58
  53. package/lib/app/templates/package.json.tpl.js.map +0 -1
  54. package/lib/app/templates/package.json.tpl.ts +0 -71
  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/services.tpl.d.ts +0 -2
  64. package/lib/app/templates/services.tpl.js +0 -15
  65. package/lib/app/templates/services.tpl.js.map +0 -1
  66. package/lib/app/templates/services.tpl.ts +0 -20
  67. package/lib/app/templates/tsconfig.json.tpl.d.ts +0 -2
  68. package/lib/app/templates/tsconfig.json.tpl.js +0 -22
  69. package/lib/app/templates/tsconfig.json.tpl.js.map +0 -1
  70. package/lib/app/templates/tsconfig.json.tpl.ts +0 -28
  71. package/lib/app/templates/validators.tpl.d.ts +0 -2
  72. package/lib/app/templates/validators.tpl.js +0 -36
  73. package/lib/app/templates/validators.tpl.js.map +0 -1
  74. package/lib/app/templates/validators.tpl.ts +0 -40
  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 -40
  81. package/lib/authentication/templates/authentication.tpl.js.map +0 -1
  82. package/lib/authentication/templates/authentication.tpl.ts +0 -51
  83. package/lib/authentication/templates/client.test.tpl.d.ts +0 -2
  84. package/lib/authentication/templates/client.test.tpl.js +0 -62
  85. package/lib/authentication/templates/client.test.tpl.js.map +0 -1
  86. package/lib/authentication/templates/client.test.tpl.ts +0 -74
  87. package/lib/authentication/templates/config.tpl.d.ts +0 -2
  88. package/lib/authentication/templates/config.tpl.js +0 -50
  89. package/lib/authentication/templates/config.tpl.js.map +0 -1
  90. package/lib/authentication/templates/config.tpl.ts +0 -57
  91. package/lib/authentication/templates/declarations.tpl.d.ts +0 -2
  92. package/lib/authentication/templates/declarations.tpl.js +0 -19
  93. package/lib/authentication/templates/declarations.tpl.js.map +0 -1
  94. package/lib/authentication/templates/declarations.tpl.ts +0 -34
  95. package/lib/authentication/templates/knex.tpl.d.ts +0 -2
  96. package/lib/authentication/templates/knex.tpl.js +0 -45
  97. package/lib/authentication/templates/knex.tpl.js.map +0 -1
  98. package/lib/authentication/templates/knex.tpl.ts +0 -62
  99. package/lib/authentication/templates/schema.json.tpl.d.ts +0 -2
  100. package/lib/authentication/templates/schema.json.tpl.js +0 -103
  101. package/lib/authentication/templates/schema.json.tpl.js.map +0 -1
  102. package/lib/authentication/templates/schema.json.tpl.ts +0 -124
  103. package/lib/authentication/templates/schema.typebox.tpl.d.ts +0 -3
  104. package/lib/authentication/templates/schema.typebox.tpl.js +0 -86
  105. package/lib/authentication/templates/schema.typebox.tpl.js.map +0 -1
  106. package/lib/authentication/templates/schema.typebox.tpl.ts +0 -108
  107. package/lib/cli.d.ts +0 -6
  108. package/lib/cli.js +0 -75
  109. package/lib/cli.js.map +0 -1
  110. package/lib/cli.ts +0 -68
  111. package/lib/commons.d.ts +0 -150
  112. package/lib/commons.js +0 -198
  113. package/lib/commons.js.map +0 -1
  114. package/lib/commons.ts +0 -284
  115. package/lib/connection/index.d.ts +0 -55
  116. package/lib/connection/index.js +0 -88
  117. package/lib/connection/index.js.map +0 -1
  118. package/lib/connection/index.ts +0 -123
  119. package/lib/connection/templates/knex.tpl.d.ts +0 -2
  120. package/lib/connection/templates/knex.tpl.js +0 -48
  121. package/lib/connection/templates/knex.tpl.js.map +0 -1
  122. package/lib/connection/templates/knex.tpl.ts +0 -67
  123. package/lib/connection/templates/mongodb.tpl.d.ts +0 -2
  124. package/lib/connection/templates/mongodb.tpl.js +0 -34
  125. package/lib/connection/templates/mongodb.tpl.js.map +0 -1
  126. package/lib/connection/templates/mongodb.tpl.ts +0 -40
  127. package/lib/hook/index.d.ts +0 -22
  128. package/lib/hook/index.js +0 -43
  129. package/lib/hook/index.js.map +0 -1
  130. package/lib/hook/index.ts +0 -47
  131. package/lib/hook/templates/hook.tpl.d.ts +0 -2
  132. package/lib/hook/templates/hook.tpl.js +0 -22
  133. package/lib/hook/templates/hook.tpl.js.map +0 -1
  134. package/lib/hook/templates/hook.tpl.ts +0 -33
  135. package/lib/index.ts +0 -2
  136. package/lib/service/index.d.ts +0 -64
  137. package/lib/service/index.js +0 -116
  138. package/lib/service/index.js.map +0 -1
  139. package/lib/service/index.ts +0 -191
  140. package/lib/service/templates/client.tpl.d.ts +0 -2
  141. package/lib/service/templates/client.tpl.js +0 -31
  142. package/lib/service/templates/client.tpl.js.map +0 -1
  143. package/lib/service/templates/client.tpl.ts +0 -57
  144. package/lib/service/templates/schema.json.tpl.d.ts +0 -2
  145. package/lib/service/templates/schema.json.tpl.js +0 -83
  146. package/lib/service/templates/schema.json.tpl.js.map +0 -1
  147. package/lib/service/templates/schema.json.tpl.ts +0 -98
  148. package/lib/service/templates/schema.typebox.tpl.d.ts +0 -2
  149. package/lib/service/templates/schema.typebox.tpl.js +0 -61
  150. package/lib/service/templates/schema.typebox.tpl.js.map +0 -1
  151. package/lib/service/templates/schema.typebox.tpl.ts +0 -76
  152. package/lib/service/templates/service.tpl.d.ts +0 -3
  153. package/lib/service/templates/service.tpl.js +0 -112
  154. package/lib/service/templates/service.tpl.js.map +0 -1
  155. package/lib/service/templates/service.tpl.ts +0 -152
  156. package/lib/service/templates/test.tpl.d.ts +0 -2
  157. package/lib/service/templates/test.tpl.js +0 -25
  158. package/lib/service/templates/test.tpl.js.map +0 -1
  159. package/lib/service/templates/test.tpl.ts +0 -33
  160. package/lib/service/type/custom.tpl.d.ts +0 -3
  161. package/lib/service/type/custom.tpl.js +0 -98
  162. package/lib/service/type/custom.tpl.js.map +0 -1
  163. package/lib/service/type/custom.tpl.ts +0 -109
  164. package/lib/service/type/knex.tpl.d.ts +0 -3
  165. package/lib/service/type/knex.tpl.js +0 -71
  166. package/lib/service/type/knex.tpl.js.map +0 -1
  167. package/lib/service/type/knex.tpl.ts +0 -92
  168. package/lib/service/type/mongodb.tpl.d.ts +0 -3
  169. package/lib/service/type/mongodb.tpl.js +0 -50
  170. package/lib/service/type/mongodb.tpl.js.map +0 -1
  171. package/lib/service/type/mongodb.tpl.ts +0 -62
@@ -1,121 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- lerna-debug.log*
8
- .pnpm-debug.log*
9
-
10
- # Diagnostic reports (https://nodejs.org/api/report.html)
11
- report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12
-
13
- # Runtime data
14
- pids
15
- *.pid
16
- *.seed
17
- *.pid.lock
18
-
19
- # Directory for instrumented libs generated by jscoverage/JSCover
20
- lib-cov
21
-
22
- # Coverage directory used by tools like istanbul
23
- coverage
24
- *.lcov
25
-
26
- # nyc test coverage
27
- .nyc_output
28
-
29
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30
- .grunt
31
-
32
- # Bower dependency directory (https://bower.io/)
33
- bower_components
34
-
35
- # node-waf configuration
36
- .lock-wscript
37
-
38
- # Compiled binary addons (https://nodejs.org/api/addons.html)
39
- build/Release
40
-
41
- # Dependency directories
42
- node_modules/
43
- jspm_packages/
44
-
45
- # Snowpack dependency directory (https://snowpack.dev/)
46
- web_modules/
47
-
48
- # TypeScript cache
49
- *.tsbuildinfo
50
-
51
- # Optional npm cache directory
52
- .npm
53
-
54
- # Optional eslint cache
55
- .eslintcache
56
-
57
- # Microbundle cache
58
- .rpt2_cache/
59
- .rts2_cache_cjs/
60
- .rts2_cache_es/
61
- .rts2_cache_umd/
62
-
63
- # Optional REPL history
64
- .node_repl_history
65
-
66
- # Output of 'npm pack'
67
- *.tgz
68
-
69
- # Yarn Integrity file
70
- .yarn-integrity
71
-
72
- # dotenv environment variables file
73
- .env
74
- .env.test
75
- .env.production
76
-
77
- # parcel-bundler cache (https://parceljs.org/)
78
- .cache
79
- .parcel-cache
80
-
81
- # Next.js build output
82
- .next
83
- out
84
-
85
- # Nuxt.js build / generate output
86
- .nuxt
87
- dist
88
-
89
- # Gatsby files
90
- .cache/
91
- # Comment in the public line in if your project uses Gatsby and not Next.js
92
- # https://nextjs.org/blog/next-9-1#public-directory-support
93
- # public
94
-
95
- # vuepress build output
96
- .vuepress/dist
97
-
98
- # Serverless directories
99
- .serverless/
100
-
101
- # FuseBox cache
102
- .fusebox/
103
-
104
- # DynamoDB Local files
105
- .dynamodb/
106
-
107
- # TernJS port file
108
- .tern-port
109
-
110
- # Stores VSCode versions used for testing VSCode extensions
111
- .vscode-test
112
-
113
- # yarn v2
114
- .yarn/cache
115
- .yarn/unplugged
116
- .yarn/build-state.yml
117
- .yarn/install-state.gz
118
- .pnp.*
119
- .sqlite
120
-
121
- lib/
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,49 +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 = ({ lib }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/app.test.html
7
- import assert from 'assert'
8
- import axios from 'axios'
9
- import type { Server } from 'http'
10
- import { app } from '../${lib}/app'
11
-
12
- const port = app.get('port')
13
- const appUrl = \`http://\${app.get('host')}:\${port}\`
14
-
15
- describe('Feathers application tests', () => {
16
- let server: Server
17
-
18
- before(async () => {
19
- server = await app.listen(port)
20
- })
21
-
22
- after(async () => {
23
- await app.teardown()
24
- })
25
-
26
- it('starts and shows the index page', async () => {
27
- const { data } = await axios.get<string>(appUrl)
28
-
29
- assert.ok(data.indexOf('<html lang="en">') !== -1)
30
- })
31
-
32
- it('shows a 404 JSON error', async () => {
33
- try {
34
- await axios.get(\`\${appUrl}/path/to/nowhere\`, {
35
- responseType: 'json'
36
- })
37
- assert.fail('should never get here')
38
- } catch (error: any) {
39
- const { response } = error
40
- assert.strictEqual(response?.status, 404)
41
- assert.strictEqual(response?.data?.code, 404)
42
- assert.strictEqual(response?.data?.name, 'NotFound')
43
- }
44
- })
45
- })
46
- `;
47
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)('test', 'app.test')));
48
- exports.generate = generate;
49
- //# sourceMappingURL=app.test.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/app.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,GAAG,EACiB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;0BAIV,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC5B,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAY,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAA;AAD5D,QAAA,QAAQ,YACoD"}
@@ -1,50 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const template = ({
6
- lib
7
- }: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/app.test.html
8
- import assert from 'assert'
9
- import axios from 'axios'
10
- import type { Server } from 'http'
11
- import { app } from '../${lib}/app'
12
-
13
- const port = app.get('port')
14
- const appUrl = \`http://\${app.get('host')}:\${port}\`
15
-
16
- describe('Feathers application tests', () => {
17
- let server: Server
18
-
19
- before(async () => {
20
- server = await app.listen(port)
21
- })
22
-
23
- after(async () => {
24
- await app.teardown()
25
- })
26
-
27
- it('starts and shows the index page', async () => {
28
- const { data } = await axios.get<string>(appUrl)
29
-
30
- assert.ok(data.indexOf('<html lang="en">') !== -1)
31
- })
32
-
33
- it('shows a 404 JSON error', async () => {
34
- try {
35
- await axios.get(\`\${appUrl}/path/to/nowhere\`, {
36
- responseType: 'json'
37
- })
38
- assert.fail('should never get here')
39
- } catch (error: any) {
40
- const { response } = error
41
- assert.strictEqual(response?.status, 404)
42
- assert.strictEqual(response?.data?.code, 404)
43
- assert.strictEqual(response?.data?.name, 'NotFound')
44
- }
45
- })
46
- })
47
- `
48
-
49
- export const generate = (ctx: AppGeneratorContext) =>
50
- generator(ctx).then(renderSource(template, toFile('test', 'app.test')))
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,123 +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 tsKoaApp = ({ transports }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
7
- import { feathers } from '@feathersjs/feathers'
8
- import configuration from '@feathersjs/configuration'
9
- import {
10
- koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
11
- } from '@feathersjs/koa'
12
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
13
-
14
- import type { Application } from './declarations'
15
- import { configurationValidator } from './configuration'
16
- import { logError } from './hooks/log-error'
17
- import { services } from './services/index'
18
- import { channels } from './channels'
19
-
20
- const app: Application = koa(feathers())
21
-
22
- // Load our app configuration (see config/ folder)
23
- app.configure(configuration(configurationValidator))
24
-
25
- // Set up Koa middleware
26
- app.use(cors())
27
- app.use(serveStatic(app.get('public')))
28
- app.use(errorHandler())
29
- app.use(parseAuthentication())
30
- app.use(bodyParser())
31
-
32
- // Configure services and transports
33
- app.configure(rest())
34
- ${transports.includes('websockets')
35
- ? `app.configure(socketio({
36
- cors: {
37
- origin: app.get('origins')
38
- }
39
- }))`
40
- : ''}
41
- app.configure(services)
42
- app.configure(channels)
43
-
44
- // Register hooks that run on all service methods
45
- app.hooks({
46
- around: {
47
- all: [ logError ]
48
- },
49
- before: {},
50
- after: {},
51
- error: {}
52
- })
53
- // Register application setup and teardown hooks here
54
- app.hooks({
55
- setup: [],
56
- teardown: []
57
- })
58
-
59
- export { app }
60
- `;
61
- const tsExpressApp = ({ transports }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
62
- import { feathers } from '@feathersjs/feathers'
63
- import express, {
64
- rest, json, urlencoded, cors,
65
- serveStatic, notFound, errorHandler
66
- } from '@feathersjs/express'
67
- import configuration from '@feathersjs/configuration'
68
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
69
-
70
- import type { Application } from './declarations'
71
- import { configurationValidator } from './configuration'
72
- import { logger } from './logger'
73
- import { logError } from './hooks/log-error'
74
- import { services } from './services/index'
75
- import { channels } from './channels'
76
-
77
- const app: Application = express(feathers())
78
-
79
- // Load app configuration
80
- app.configure(configuration(configurationValidator))
81
- app.use(cors())
82
- app.use(json())
83
- app.use(urlencoded({ extended: true }))
84
- // Host the public folder
85
- app.use('/', serveStatic(app.get('public')))
86
-
87
- // Configure services and real-time functionality
88
- app.configure(rest())
89
- ${transports.includes('websockets')
90
- ? `app.configure(socketio({
91
- cors: {
92
- origin: app.get('origins')
93
- }
94
- }))`
95
- : ''}
96
- app.configure(services)
97
- app.configure(channels)
98
-
99
- // Configure a middleware for 404s and the error handler
100
- app.use(notFound())
101
- app.use(errorHandler({ logger }))
102
-
103
- // Register hooks that run on all service methods
104
- app.hooks({
105
- around: {
106
- all: [ logError ]
107
- },
108
- before: {},
109
- after: {},
110
- error: {}
111
- })
112
- // Register application setup and teardown hooks here
113
- app.hooks({
114
- setup: [],
115
- teardown: []
116
- })
117
-
118
- export { app }
119
- `;
120
- const template = (ctx) => ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx);
121
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'app')));
122
- exports.generate = generate;
123
- //# sourceMappingURL=app.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/app.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,UAAU,EACU,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;EAMlC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;EAuBtF,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC/B,CAAC,CAAC;;;;IAIF;IACA,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;;;;;CAoBC,CAAA;AAED,MAAM,YAAY,GAAG,CAAC,EACpB,UAAU,EACU,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;EAOlC,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,6CAA6C,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;EAsBtF,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC;IAC/B,CAAC,CAAC;;;;IAIF;IACA,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CAC5C,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAE1D,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CACrD,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -1,138 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const tsKoaApp = ({
6
- transports
7
- }: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
8
- import { feathers } from '@feathersjs/feathers'
9
- import configuration from '@feathersjs/configuration'
10
- import {
11
- koa, rest, bodyParser, errorHandler, parseAuthentication, cors, serveStatic
12
- } from '@feathersjs/koa'
13
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
14
-
15
- import type { Application } from './declarations'
16
- import { configurationValidator } from './configuration'
17
- import { logError } from './hooks/log-error'
18
- import { services } from './services/index'
19
- import { channels } from './channels'
20
-
21
- const app: Application = koa(feathers())
22
-
23
- // Load our app configuration (see config/ folder)
24
- app.configure(configuration(configurationValidator))
25
-
26
- // Set up Koa middleware
27
- app.use(cors())
28
- app.use(serveStatic(app.get('public')))
29
- app.use(errorHandler())
30
- app.use(parseAuthentication())
31
- app.use(bodyParser())
32
-
33
- // Configure services and transports
34
- app.configure(rest())
35
- ${
36
- transports.includes('websockets')
37
- ? `app.configure(socketio({
38
- cors: {
39
- origin: app.get('origins')
40
- }
41
- }))`
42
- : ''
43
- }
44
- app.configure(services)
45
- app.configure(channels)
46
-
47
- // Register hooks that run on all service methods
48
- app.hooks({
49
- around: {
50
- all: [ logError ]
51
- },
52
- before: {},
53
- after: {},
54
- error: {}
55
- })
56
- // Register application setup and teardown hooks here
57
- app.hooks({
58
- setup: [],
59
- teardown: []
60
- })
61
-
62
- export { app }
63
- `
64
-
65
- const tsExpressApp = ({
66
- transports
67
- }: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/application.html
68
- import { feathers } from '@feathersjs/feathers'
69
- import express, {
70
- rest, json, urlencoded, cors,
71
- serveStatic, notFound, errorHandler
72
- } from '@feathersjs/express'
73
- import configuration from '@feathersjs/configuration'
74
- ${transports.includes('websockets') ? "import socketio from '@feathersjs/socketio'" : ''}
75
-
76
- import type { Application } from './declarations'
77
- import { configurationValidator } from './configuration'
78
- import { logger } from './logger'
79
- import { logError } from './hooks/log-error'
80
- import { services } from './services/index'
81
- import { channels } from './channels'
82
-
83
- const app: Application = express(feathers())
84
-
85
- // Load app configuration
86
- app.configure(configuration(configurationValidator))
87
- app.use(cors())
88
- app.use(json())
89
- app.use(urlencoded({ extended: true }))
90
- // Host the public folder
91
- app.use('/', serveStatic(app.get('public')))
92
-
93
- // Configure services and real-time functionality
94
- app.configure(rest())
95
- ${
96
- transports.includes('websockets')
97
- ? `app.configure(socketio({
98
- cors: {
99
- origin: app.get('origins')
100
- }
101
- }))`
102
- : ''
103
- }
104
- app.configure(services)
105
- app.configure(channels)
106
-
107
- // Configure a middleware for 404s and the error handler
108
- app.use(notFound())
109
- app.use(errorHandler({ logger }))
110
-
111
- // Register hooks that run on all service methods
112
- app.hooks({
113
- around: {
114
- all: [ logError ]
115
- },
116
- before: {},
117
- after: {},
118
- error: {}
119
- })
120
- // Register application setup and teardown hooks here
121
- app.hooks({
122
- setup: [],
123
- teardown: []
124
- })
125
-
126
- export { app }
127
- `
128
-
129
- const template = (ctx: AppGeneratorContext) =>
130
- ctx.framework === 'express' ? tsExpressApp(ctx) : tsKoaApp(ctx)
131
-
132
- export const generate = (ctx: AppGeneratorContext) =>
133
- generator(ctx).then(
134
- renderSource(
135
- template,
136
- toFile<AppGeneratorContext>(({ lib }) => lib, 'app')
137
- )
138
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,49 +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 = ({ language }) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/channels.html
7
- import type { RealTimeConnection, Params } from '@feathersjs/feathers'
8
- import '@feathersjs/transport-commons'
9
- import type { Application, HookContext } from './declarations'
10
- import { logger } from './logger'
11
-
12
- export const channels = (app: Application) => {
13
- if(typeof app.channel !== 'function') {
14
- // If no real-time functionality has been configured just return
15
- return
16
- }
17
-
18
- logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://docs.feathersjs.com/api/channels.html for more information.')
19
-
20
- app.on('connection', (connection: any) => {
21
- // On a new real-time connection, add it to the anonymous channel
22
- app.channel('anonymous').join(connection)
23
- })
24
-
25
- app.on('login', (authResult: any, { connection }: Params) => {
26
- // connection can be undefined if there is no
27
- // real-time connection, e.g. when logging in via REST
28
- if(connection) {
29
- // The connection is no longer anonymous, remove it
30
- app.channel('anonymous').leave(connection)
31
-
32
- // Add it to the authenticated user channel
33
- app.channel('authenticated').join(connection)
34
- }
35
- })
36
-
37
- // eslint-disable-next-line no-unused-vars
38
- app.publish((data: any, context: HookContext) => {
39
- // Here you can add event publishers to channels set up in \`channels.js\`
40
- // To publish only for a specific event use \`app.publish(eventname, () => {})\`
41
-
42
- // e.g. to publish all service events to all authenticated users use
43
- return app.channel('authenticated')
44
- })
45
- }
46
- `;
47
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)(({ lib }) => lib, 'channels')));
48
- exports.generate = generate;
49
- //# sourceMappingURL=channels.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"channels.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/channels.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAChB,QAAQ,EACY,EAAE,EAAE,CAAC,QAAQ,CAAC;;;;;;;;;;;;kFAY8C,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BzF,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CACjB,IAAA,sBAAY,EACV,QAAQ,EACR,IAAA,eAAM,EAAsB,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAC1D,CACF,CAAA;AANU,QAAA,QAAQ,YAMlB"}
@@ -1,55 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const template = ({
6
- language
7
- }: AppGeneratorContext) => /* ts */ `// For more information about this file see https://dove.feathersjs.com/guides/cli/channels.html
8
- import type { RealTimeConnection, Params } from '@feathersjs/feathers'
9
- import '@feathersjs/transport-commons'
10
- import type { Application, HookContext } from './declarations'
11
- import { logger } from './logger'
12
-
13
- export const channels = (app: Application) => {
14
- if(typeof app.channel !== 'function') {
15
- // If no real-time functionality has been configured just return
16
- return
17
- }
18
-
19
- logger.warn('Publishing all events to all authenticated users. See \`channels.${language}\` and https://docs.feathersjs.com/api/channels.html for more information.')
20
-
21
- app.on('connection', (connection: any) => {
22
- // On a new real-time connection, add it to the anonymous channel
23
- app.channel('anonymous').join(connection)
24
- })
25
-
26
- app.on('login', (authResult: any, { connection }: Params) => {
27
- // connection can be undefined if there is no
28
- // real-time connection, e.g. when logging in via REST
29
- if(connection) {
30
- // The connection is no longer anonymous, remove it
31
- app.channel('anonymous').leave(connection)
32
-
33
- // Add it to the authenticated user channel
34
- app.channel('authenticated').join(connection)
35
- }
36
- })
37
-
38
- // eslint-disable-next-line no-unused-vars
39
- app.publish((data: any, context: HookContext) => {
40
- // Here you can add event publishers to channels set up in \`channels.js\`
41
- // To publish only for a specific event use \`app.publish(eventname, () => {})\`
42
-
43
- // e.g. to publish all service events to all authenticated users use
44
- return app.channel('authenticated')
45
- })
46
- }
47
- `
48
-
49
- export const generate = (ctx: AppGeneratorContext) =>
50
- generator(ctx).then(
51
- renderSource(
52
- template,
53
- toFile<AppGeneratorContext>(({ lib }) => lib, 'channels')
54
- )
55
- )
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;
@@ -1,27 +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 = ({ lib }) => /* ts */ `import assert from 'assert'
7
- import axios from 'axios'
8
- import type { Server } from 'http'
9
- import { app } from '../${lib}/app'
10
- import { createClient } from '../${lib}/client'
11
-
12
- import rest from '@feathersjs/rest-client'
13
-
14
- const port = app.get('port')
15
- const appUrl = \`http://\${app.get('host')}:\${port}\`
16
-
17
- describe('client tests', () => {
18
- const client = createClient(rest(appUrl).axios(axios))
19
-
20
- it('initialized the client', () => {
21
- assert.ok(client)
22
- })
23
- })
24
- `;
25
- const generate = (ctx) => (0, pinion_1.generator)(ctx).then((0, commons_1.renderSource)(template, (0, pinion_1.toFile)('test', 'client.test')));
26
- exports.generate = generate;
27
- //# sourceMappingURL=client.test.tpl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.test.tpl.js","sourceRoot":"","sources":["../../../src/app/templates/client.test.tpl.ts"],"names":[],"mappings":";;;AAAA,+CAAsD;AACtD,2CAA4C;AAG5C,MAAM,QAAQ,GAAG,CAAC,EAAE,GAAG,EAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC;;;0BAGlC,GAAG;mCACM,GAAG;;;;;;;;;;;;;;CAcrC,CAAA;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAwB,EAAE,EAAE,CACnD,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,sBAAY,EAAC,QAAQ,EAAE,IAAA,eAAM,EAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;AAD/D,QAAA,QAAQ,YACuD"}
@@ -1,26 +0,0 @@
1
- import { generator, toFile } from '@feathershq/pinion'
2
- import { renderSource } from '../../commons'
3
- import { AppGeneratorContext } from '../index'
4
-
5
- const template = ({ lib }: AppGeneratorContext) => /* ts */ `import assert from 'assert'
6
- import axios from 'axios'
7
- import type { Server } from 'http'
8
- import { app } from '../${lib}/app'
9
- import { createClient } from '../${lib}/client'
10
-
11
- import rest from '@feathersjs/rest-client'
12
-
13
- const port = app.get('port')
14
- const appUrl = \`http://\${app.get('host')}:\${port}\`
15
-
16
- describe('client tests', () => {
17
- const client = createClient(rest(appUrl).axios(axios))
18
-
19
- it('initialized the client', () => {
20
- assert.ok(client)
21
- })
22
- })
23
- `
24
-
25
- export const generate = (ctx: AppGeneratorContext) =>
26
- generator(ctx).then(renderSource(template, toFile('test', 'client.test')))
@@ -1,2 +0,0 @@
1
- import { AppGeneratorContext } from '../index';
2
- export declare const generate: (ctx: AppGeneratorContext) => Promise<AppGeneratorContext>;